Fixes for issues 96 and 113. Stops constant rumbling and stops palette flickering in Megaman 1 (by disabling palettes for that game).

This commit is contained in:
Carl.Kenner 2009-05-28 14:15:56 +00:00
parent a2f4cbae70
commit 8947904911
5 changed files with 32 additions and 15 deletions

View File

@ -37,7 +37,7 @@ GuiTrigger userInput[4];
static int rumbleCount[4] = {0,0,0,0}; static int rumbleCount[4] = {0,0,0,0};
#endif #endif
bool cartridgeRumble = false; bool cartridgeRumble = false, possibleCartridgeRumble = false;
int gameRumbleCount = 0, menuRumbleCount = 0, rumbleCountAlready = 0; int gameRumbleCount = 0, menuRumbleCount = 0, rumbleCountAlready = 0;
unsigned int vbapadmap[10]; // VBA controller buttons unsigned int vbapadmap[10]; // VBA controller buttons
@ -173,11 +173,19 @@ void DoRumble(int i)
} }
#endif #endif
static int SilenceNeeded = 0;
static void updateRumble() static void updateRumble()
{ {
bool r = false; bool r = false;
if (ConfigRequested) r = (menuRumbleCount > 0); if (ConfigRequested) r = (menuRumbleCount > 0);
else r = cartridgeRumble || (gameRumbleCount > 0) || (menuRumbleCount > 0); else r = cartridgeRumble || possibleCartridgeRumble || (gameRumbleCount > 0) || (menuRumbleCount > 0);
if (SilenceNeeded>0) {
if (r) SilenceNeeded = 5;
else SilenceNeeded--;
if (SilenceNeeded>0) r = false;
}
#ifdef HW_RVL #ifdef HW_RVL
// Rumble wii remote 0 // Rumble wii remote 0
@ -189,27 +197,30 @@ static void updateRumble()
void updateRumbleFrame() { void updateRumbleFrame() {
// If we already rumbled continuously for more than 50 frames, // If we already rumbled continuously for more than 50 frames,
// then disable rumbling for a while. // then disable rumbling for a while.
if (rumbleCountAlready > 50) { if (rumbleCountAlready > 70) {
gameRumbleCount = 0; SilenceNeeded = 5;
menuRumbleCount = 0; rumbleCountAlready = 0;
// disable rumbling for 10 more frames
if (rumbleCountAlready > 50+10)
rumbleCountAlready = 0;
else rumbleCountAlready++;
} else if (ConfigRequested) { } else if (ConfigRequested) {
if (menuRumbleCount>0) if (menuRumbleCount>0) rumbleCountAlready++;
rumbleCountAlready++; else rumbleCountAlready=0;
} else { } else {
if (gameRumbleCount>0 || menuRumbleCount>0 || cartridgeRumble) if (gameRumbleCount>0 || menuRumbleCount>0 || possibleCartridgeRumble)
rumbleCountAlready++; rumbleCountAlready++;
else rumbleCountAlready=0;
} }
updateRumble(); updateRumble();
if (gameRumbleCount>0 && !ConfigRequested) gameRumbleCount--; if (gameRumbleCount>0 && !ConfigRequested) gameRumbleCount--;
if (menuRumbleCount>0) menuRumbleCount--; if (menuRumbleCount>0) menuRumbleCount--;
} }
void systemPossibleCartridgeRumble(bool RumbleOn) {
possibleCartridgeRumble = RumbleOn;
updateRumble();
}
void systemCartridgeRumble(bool RumbleOn) { void systemCartridgeRumble(bool RumbleOn) {
cartridgeRumble = RumbleOn; cartridgeRumble = RumbleOn;
possibleCartridgeRumble = false;
updateRumble(); updateRumble();
} }

View File

@ -2781,7 +2781,8 @@ static int MenuSettingsVideo()
case 5: case 5:
if (GCSettings.colorize) GCSettings.colorize = 0; if (GCSettings.colorize) GCSettings.colorize = 0;
else GCSettings.colorize = 1; else GCSettings.colorize = 1;
if (GCSettings.colorize) LoadPalette(RomTitle); if (strcmp(RomTitle, "MEGAMAN")==0) StopColorizing();
else if (GCSettings.colorize) LoadPalette(RomTitle);
else StopColorizing(); else StopColorizing();
break; break;

View File

@ -800,7 +800,8 @@ static void gbApplyPerImagePreferences()
// look for matching palettes if a monochrome gameboy game // look for matching palettes if a monochrome gameboy game
// (or if a Super Gameboy game, but the palette will be ignored later in that case) // (or if a Super Gameboy game, but the palette will be ignored later in that case)
if ((Colour != 0x80) && (Colour != 0xC0)) { if ((Colour != 0x80) && (Colour != 0xC0)) {
if (GCSettings.colorize) LoadPalette(RomTitle); if (strcmp(RomTitle, "MEGAMAN")==0) StopColorizing();
else if (GCSettings.colorize) LoadPalette(RomTitle);
else StopColorizing(); else StopColorizing();
} }
} }

View File

@ -50,6 +50,7 @@ extern bool systemReadJoypads();
extern u32 systemReadJoypad(int); extern u32 systemReadJoypad(int);
// this function should turn on or off rumble on the gamepad // this function should turn on or off rumble on the gamepad
extern void systemCartridgeRumble(bool); extern void systemCartridgeRumble(bool);
extern void systemPossibleCartridgeRumble(bool);
// This should be called once per frame // This should be called once per frame
extern void updateRumbleFrame(); extern void updateRumbleFrame();
extern u32 systemGetClock(); extern u32 systemGetClock();

View File

@ -586,9 +586,12 @@ void mapperMBC5ROM(u16 address, u8 value)
// rumble cartridge. As long as the RAM is less than or equal to 256Kbit // rumble cartridge. As long as the RAM is less than or equal to 256Kbit
// we know that the last address line is not used for real RAM addresses, // we know that the last address line is not used for real RAM addresses,
// so it must be a rumble signal instead. // so it must be a rumble signal instead.
if(gbDataMBC5.isRumbleCartridge || gbRamSizeMask <= 0x7FFF) { if(gbDataMBC5.isRumbleCartridge) {
systemCartridgeRumble(value & 0x08); systemCartridgeRumble(value & 0x08);
value &= 0x07; value &= 0x07;
} else if (gbRamSizeMask <= 0x7FFF) {
systemPossibleCartridgeRumble(value & 0x08);
value &= 0x07;
} else } else
value &= 0x0f; value &= 0x0f;
if(value == gbDataMBC5.mapperRAMBank) if(value == gbDataMBC5.mapperRAMBank)