mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-22 10:39:18 +01:00
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:
parent
a2f4cbae70
commit
8947904911
@ -37,7 +37,7 @@ GuiTrigger userInput[4];
|
||||
static int rumbleCount[4] = {0,0,0,0};
|
||||
#endif
|
||||
|
||||
bool cartridgeRumble = false;
|
||||
bool cartridgeRumble = false, possibleCartridgeRumble = false;
|
||||
int gameRumbleCount = 0, menuRumbleCount = 0, rumbleCountAlready = 0;
|
||||
|
||||
unsigned int vbapadmap[10]; // VBA controller buttons
|
||||
@ -173,11 +173,19 @@ void DoRumble(int i)
|
||||
}
|
||||
#endif
|
||||
|
||||
static int SilenceNeeded = 0;
|
||||
|
||||
static void updateRumble()
|
||||
{
|
||||
bool r = false;
|
||||
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
|
||||
// Rumble wii remote 0
|
||||
@ -189,27 +197,30 @@ static void updateRumble()
|
||||
void updateRumbleFrame() {
|
||||
// If we already rumbled continuously for more than 50 frames,
|
||||
// then disable rumbling for a while.
|
||||
if (rumbleCountAlready > 50) {
|
||||
gameRumbleCount = 0;
|
||||
menuRumbleCount = 0;
|
||||
// disable rumbling for 10 more frames
|
||||
if (rumbleCountAlready > 50+10)
|
||||
if (rumbleCountAlready > 70) {
|
||||
SilenceNeeded = 5;
|
||||
rumbleCountAlready = 0;
|
||||
else rumbleCountAlready++;
|
||||
} else if (ConfigRequested) {
|
||||
if (menuRumbleCount>0)
|
||||
rumbleCountAlready++;
|
||||
if (menuRumbleCount>0) rumbleCountAlready++;
|
||||
else rumbleCountAlready=0;
|
||||
} else {
|
||||
if (gameRumbleCount>0 || menuRumbleCount>0 || cartridgeRumble)
|
||||
if (gameRumbleCount>0 || menuRumbleCount>0 || possibleCartridgeRumble)
|
||||
rumbleCountAlready++;
|
||||
else rumbleCountAlready=0;
|
||||
}
|
||||
updateRumble();
|
||||
if (gameRumbleCount>0 && !ConfigRequested) gameRumbleCount--;
|
||||
if (menuRumbleCount>0) menuRumbleCount--;
|
||||
}
|
||||
|
||||
void systemPossibleCartridgeRumble(bool RumbleOn) {
|
||||
possibleCartridgeRumble = RumbleOn;
|
||||
updateRumble();
|
||||
}
|
||||
|
||||
void systemCartridgeRumble(bool RumbleOn) {
|
||||
cartridgeRumble = RumbleOn;
|
||||
possibleCartridgeRumble = false;
|
||||
updateRumble();
|
||||
}
|
||||
|
||||
|
@ -2781,7 +2781,8 @@ static int MenuSettingsVideo()
|
||||
case 5:
|
||||
if (GCSettings.colorize) GCSettings.colorize = 0;
|
||||
else GCSettings.colorize = 1;
|
||||
if (GCSettings.colorize) LoadPalette(RomTitle);
|
||||
if (strcmp(RomTitle, "MEGAMAN")==0) StopColorizing();
|
||||
else if (GCSettings.colorize) LoadPalette(RomTitle);
|
||||
else StopColorizing();
|
||||
break;
|
||||
|
||||
|
@ -800,7 +800,8 @@ static void gbApplyPerImagePreferences()
|
||||
// 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)
|
||||
if ((Colour != 0x80) && (Colour != 0xC0)) {
|
||||
if (GCSettings.colorize) LoadPalette(RomTitle);
|
||||
if (strcmp(RomTitle, "MEGAMAN")==0) StopColorizing();
|
||||
else if (GCSettings.colorize) LoadPalette(RomTitle);
|
||||
else StopColorizing();
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ extern bool systemReadJoypads();
|
||||
extern u32 systemReadJoypad(int);
|
||||
// this function should turn on or off rumble on the gamepad
|
||||
extern void systemCartridgeRumble(bool);
|
||||
extern void systemPossibleCartridgeRumble(bool);
|
||||
// This should be called once per frame
|
||||
extern void updateRumbleFrame();
|
||||
extern u32 systemGetClock();
|
||||
|
@ -586,9 +586,12 @@ void mapperMBC5ROM(u16 address, u8 value)
|
||||
// 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,
|
||||
// so it must be a rumble signal instead.
|
||||
if(gbDataMBC5.isRumbleCartridge || gbRamSizeMask <= 0x7FFF) {
|
||||
if(gbDataMBC5.isRumbleCartridge) {
|
||||
systemCartridgeRumble(value & 0x08);
|
||||
value &= 0x07;
|
||||
} else if (gbRamSizeMask <= 0x7FFF) {
|
||||
systemPossibleCartridgeRumble(value & 0x08);
|
||||
value &= 0x07;
|
||||
} else
|
||||
value &= 0x0f;
|
||||
if(value == gbDataMBC5.mapperRAMBank)
|
||||
|
Loading…
Reference in New Issue
Block a user