diff --git a/src/burn/drv/galaxian/d_galaxian.cpp b/src/burn/drv/galaxian/d_galaxian.cpp index be712525f1..f8cd5319b3 100644 --- a/src/burn/drv/galaxian/d_galaxian.cpp +++ b/src/burn/drv/galaxian/d_galaxian.cpp @@ -15855,6 +15855,12 @@ static void FroggerEncGfxPostLoad() MapFrogger(); } +static void Frogger4WayInit() +{ + GalSet4WAY( 0, GalInputPort2 + 4, GalInputPort2 + 6, GalInputPort0 + 5, GalInputPort0 + 4 ); + GalSet4WAY( 1, GalInputPort0 + 0, GalInputPort2 + 0, GalInputPort1 + 5, GalInputPort1 + 4 ); +} + static INT32 FroggerEncGfxInit() { INT32 nRet; @@ -15865,6 +15871,8 @@ static INT32 FroggerEncGfxInit() nRet = GalInit(); if (nRet) return 1; FroggerSoundInit(); + Frogger4WayInit(); + GalScreenUnflipper = 1; // unflip coctail! FroggerAdjust = 1; @@ -15901,6 +15909,10 @@ static INT32 FroggermcInit() nRet = GalInit(); if (nRet) return 1; FroggerSoundInit(); + // different from other frogger sets + GalSet4WAY( 0, GalInputPort0 + 4, GalInputPort0 + 5, GalInputPort0 + 2, GalInputPort0 + 3 ); + GalSet4WAY( 1, GalInputPort1 + 4, GalInputPort1 + 5, GalInputPort1 + 2, GalInputPort1 + 3 ); + GalScreenUnflipper = 1; // unflip coctail! GalRenderBackgroundFunction = FroggerDrawBackground; @@ -15921,6 +15933,8 @@ static INT32 FroggersInit() nRet = GalInit(); if (nRet) return 1; FroggerSoundInit(); + Frogger4WayInit(); + GalScreenUnflipper = 1; // unflip coctail! KonamiPPIInit(); @@ -15960,7 +15974,9 @@ static INT32 FrogfInit() nRet = GalInit(); if (nRet) return 1; FroggerSoundInit(); - + + Frogger4WayInit(); + KonamiPPIInit(); GalRenderBackgroundFunction = FroggerDrawBackground; @@ -15987,7 +16003,9 @@ static INT32 FroggInit() GalPostLoadCallbackFunction = FroggPostLoad; nRet = GalInit(); - + + Frogger4WayInit(); + GalRenderBackgroundFunction = FroggerDrawBackground; GalExtendTileInfoFunction = FroggerExtendTileInfo; GalExtendSpriteInfoFunction = FroggerExtendSpriteInfo; @@ -16018,6 +16036,8 @@ static INT32 FroggrsInit() nRet = GalInit(); if (nRet) return 1; FroggerSoundInit(); + Frogger4WayInit(); + GalScreenUnflipper = 1; // unflip coctail! KonamiPPIInit(); @@ -16433,6 +16453,9 @@ static INT32 TurtlesInit() nRet = GalInit(); if (nRet) return 1; KonamiSoundInit(); + GalSet4WAY( 0, GalInputPort2 + 4, GalInputPort2 + 6, GalInputPort0 + 5, GalInputPort0 + 4 ); + GalSet4WAY( 1, GalInputPort0 + 0, GalInputPort2 + 0, GalInputPort1 + 5, GalInputPort1 + 4 ); + GalScreenUnflipper = 1; // unflip coctail! GalRenderBackgroundFunction = TurtlesDrawBackground; @@ -16462,7 +16485,10 @@ static INT32 TurpinsInit() nRet = GalInit(); if (nRet) return 1; KonamiSoundInit(); - + + GalSet4WAY( 0, GalInputPort2 + 4, GalInputPort2 + 6, GalInputPort0 + 5, GalInputPort0 + 4 ); + GalSet4WAY( 1, GalInputPort0 + 0, GalInputPort2 + 0, GalInputPort1 + 5, GalInputPort1 + 4 ); + GalRenderBackgroundFunction = TurtlesDrawBackground; GalDrawBulletsFunction = NULL; @@ -19357,7 +19383,11 @@ static INT32 TriplepInit() GalSoundSubType = 1; // diff. AY8910 clock nRet = GalInit(); - + + // 4-way same as turtles / amidar + GalSet4WAY( 0, GalInputPort2 + 4, GalInputPort2 + 6, GalInputPort0 + 5, GalInputPort0 + 4 ); + GalSet4WAY( 1, GalInputPort0 + 0, GalInputPort2 + 0, GalInputPort1 + 5, GalInputPort1 + 4 ); + GalRenderBackgroundFunction = ScrambleDrawBackground; GalDrawBulletsFunction = ScrambleDrawBullets; @@ -22274,7 +22304,10 @@ static INT32 AnteaterInit() nRet = GalInit(); if (nRet) return 1; KonamiSoundInit(); - + + GalSet4WAY(0, GalInputPort0 + 2, GalInputPort0 + 3, GalInputPort0 + 5, GalInputPort0 + 4); + GalSet4WAY(1, GalInputPort1 + 2, GalInputPort1 + 3, GalInputPort1 + 5, GalInputPort1 + 4); + GalTempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); UINT8 *TempRom = (UINT8*)BurnMalloc(GalTilesSharedRomSize); BurnLoadRom(TempRom + 0x0000, GAL_ROM_OFFSET_TILES_SHARED + 0, 1); @@ -22347,7 +22380,10 @@ static INT32 AnteatergInit() nRet = GalInit(); if (nRet) return 1; KonamiSoundInit(); - + + GalSet4WAY(0, GalInputPort0 + 4, GalInputPort0 + 6, GalInputPort2 + 5, GalInputPort2 + 4); + GalSet4WAY(1, GalInputPort2 + 0, GalInputPort0 + 0, GalInputPort1 + 5, GalInputPort1 + 4); + GalRenderBackgroundFunction = AnteaterDrawBackground; GalDrawBulletsFunction = ScrambleDrawBullets; @@ -22401,7 +22437,10 @@ static INT32 AnteaterukInit() nRet = GalInit(); if (nRet) return 1; KonamiSoundInit(); - + + GalSet4WAY(0, GalInputPort2 + 4, GalInputPort2 + 6, GalInputPort0 + 5, GalInputPort0 + 4); + GalSet4WAY(1, GalInputPort0 + 0, GalInputPort2 + 0, GalInputPort1 + 5, GalInputPort1 + 4); + GalRenderBackgroundFunction = ScrambleDrawBackground; GalDrawBulletsFunction = ScrambleDrawBullets; diff --git a/src/burn/drv/galaxian/gal.h b/src/burn/drv/galaxian/gal.h index b9f4c980af..ff22b69325 100644 --- a/src/burn/drv/galaxian/gal.h +++ b/src/burn/drv/galaxian/gal.h @@ -199,6 +199,10 @@ extern UINT8 GalFakeDip; extern INT32 GalAnalogPort0; extern INT32 GalAnalogPort1; +extern INT32 Gal4Way; +extern UINT8 *GalUDLR[2][4]; +void GalSet4WAY(INT32 player, UINT8 *u, UINT8 *d, UINT8 *l, UINT8 *r); + extern UINT8 *GalMem; extern UINT8 *GalMemEnd; extern UINT8 *GalRamStart; diff --git a/src/burn/drv/galaxian/gal_run.cpp b/src/burn/drv/galaxian/gal_run.cpp index 72a771bd72..3bfb5d9a92 100644 --- a/src/burn/drv/galaxian/gal_run.cpp +++ b/src/burn/drv/galaxian/gal_run.cpp @@ -91,8 +91,49 @@ UINT8 Dingo = 0; UINT8 Harem = 0; UINT8 Namenayo = 0; +INT32 Gal4Way = 0; +UINT8 *GalUDLR[2][4] = { { NULL, NULL, NULL, NULL }, { NULL, NULL, NULL, NULL } }; + +void GalInit4WAY() +{ + Gal4Way = 0; + memset(GalUDLR, 0, sizeof(GalUDLR)); +} + +void GalSet4WAY(INT32 player, UINT8 *u, UINT8 *d, UINT8 *l, UINT8 *r) +{ + Gal4Way = 1 + player; + + GalUDLR[player][0] = u; + GalUDLR[player][1] = d; + GalUDLR[player][2] = l; + GalUDLR[player][3] = r; +} + static inline void GalMakeInputs() { + if (Gal4Way) { + // Some games on this hw spread u/d/l/r across different inputs. + // Since ProcessJoystick() doesn't support this: + // Compile raw inputs to a single input for ProcessJoystick() + // then update the raw inputs w/the result. + UINT8 inp0 = 0; + UINT8 inp1 = 0; + + for (INT32 i = 0; i < 4; i++) { + inp0 |= *GalUDLR[0][i] << i; + if (Gal4Way > 1) inp1 |= *GalUDLR[1][i] << i; + } + + ProcessJoystick(&inp0, 0, 0, 1, 2, 3, INPUT_4WAY); + ProcessJoystick(&inp1, 1, 0, 1, 2, 3, INPUT_4WAY); + + for (INT32 i = 0; i < 4; i++) { + *GalUDLR[0][i] = (inp0 & (1 << i)) >> i; + if (Gal4Way > 1) *GalUDLR[1][i] = (inp1 & (1 << i)) >> i; + } + } + // Reset Inputs GalInput[0] = GalInput[1] = GalInput[2] = GalInput[3] = GalInput[4] = 0x00; @@ -606,7 +647,9 @@ INT32 GalInit() GalMemIndex(); if (GalLoadRoms(1)) return 1; - + + GalInit4WAY(); // disable by default + // Setup the Z80 emulation if (GalSoundType != GAL_SOUND_HARDWARE_TYPE_HUNCHBACKAY8910) { if (GalZ80Rom3Size) {