Fixed mapper 48 IRQ issues

This commit is contained in:
Souryo 2017-05-18 22:43:21 -04:00
parent ada46d8428
commit f40a802e10
4 changed files with 3180 additions and 3164 deletions

View file

@ -32,7 +32,7 @@ void GameDatabase::InitDatabase()
continue; continue;
} }
vector<string> values = StringUtilities::Split(lineContent, ','); vector<string> values = StringUtilities::Split(lineContent, ',');
if(values.size() >= 15) { if(values.size() >= 16) {
GameInfo gameInfo{ GameInfo gameInfo{
(uint32_t)std::stoll(values[0], nullptr, 16), (uint32_t)std::stoll(values[0], nullptr, 16),
values[1], values[1],
@ -48,7 +48,8 @@ void GameDatabase::InitDatabase()
ToInt<uint32_t>(values[11]) == 0 ? false : true, ToInt<uint32_t>(values[11]) == 0 ? false : true,
values[12], values[12],
values[13], values[13],
values[14] values[14],
values[15]
}; };
if(gameInfo.MapperID == 65000) { if(gameInfo.MapperID == 65000) {
@ -147,89 +148,92 @@ void GameDatabase::InitializeInputDevices(string inputType, GameSystem system)
uint8_t GameDatabase::GetSubMapper(GameInfo &info) uint8_t GameDatabase::GetSubMapper(GameInfo &info)
{ {
switch(info.MapperID) { if(!info.SubmapperID.empty()) {
case 1: return ToInt<uint8_t>(info.SubmapperID);
if(info.Board.find("SEROM") != string::npos || } else {
info.Board.find("SHROM") != string::npos || switch(info.MapperID) {
info.Board.find("SH1ROM") != string::npos) { case 1:
//SEROM, SHROM, SH1ROM have fixed PRG banking if(info.Board.find("SEROM") != string::npos ||
return 5; info.Board.find("SHROM") != string::npos ||
} info.Board.find("SH1ROM") != string::npos) {
break; //SEROM, SHROM, SH1ROM have fixed PRG banking
return 5;
}
break;
case 3: case 3:
if(info.Board.compare("NES-CNROM") == 0) { if(info.Board.compare("NES-CNROM") == 0) {
//Enable bus conflicts for CNROM games //Enable bus conflicts for CNROM games
//Fixes "Cybernoid - The Fighting Machine" which requires open bus behavior to work properly //Fixes "Cybernoid - The Fighting Machine" which requires open bus behavior to work properly
return 2; return 2;
} }
break; break;
case 4: case 4:
if(info.Board.compare("ACCLAIM-MC-ACC") == 0) { if(info.Board.compare("ACCLAIM-MC-ACC") == 0) {
return 3; //Acclaim MC-ACC (MMC3 clone) return 3; //Acclaim MC-ACC (MMC3 clone)
} else if(info.Chip.compare("MMC6B") == 0) { } else if(info.Chip.compare("MMC6B") == 0) {
return 1; //MMC6 (Star Tropics) return 1; //MMC6 (Star Tropics)
} }
break; break;
case 21: case 21:
if(info.Pcb.compare("352398") == 0) { if(info.Pcb.compare("352398") == 0) {
return 1; //VRC4a return 1; //VRC4a
} else if(info.Pcb.compare("352889") == 0) { } else if(info.Pcb.compare("352889") == 0) {
return 2; //VRC4c return 2; //VRC4c
} }
break; break;
case 23: case 23:
if(info.Pcb.compare("352396") == 0) { if(info.Pcb.compare("352396") == 0) {
return 2; //VRC4e return 2; //VRC4e
} else if(info.Pcb.compare("350603") == 0 || info.Pcb.compare("350636") == 0 || info.Pcb.compare("350926") == 0 || info.Pcb.compare("351179") == 0 || info.Pcb.compare("LROG009-00") == 0) { } else if(info.Pcb.compare("350603") == 0 || info.Pcb.compare("350636") == 0 || info.Pcb.compare("350926") == 0 || info.Pcb.compare("351179") == 0 || info.Pcb.compare("LROG009-00") == 0) {
return 3; //VRC2b return 3; //VRC2b
} }
break; break;
case 25: case 25:
if(info.Pcb.compare("351406") == 0) { if(info.Pcb.compare("351406") == 0) {
return 1; //VRC4b return 1; //VRC4b
} else if(info.Pcb.compare("352400") == 0) { } else if(info.Pcb.compare("352400") == 0) {
return 2; //VRC4d return 2; //VRC4d
} else if(info.Pcb.compare("351948") == 0) { } else if(info.Pcb.compare("351948") == 0) {
return 3; //VRC2c return 3; //VRC2c
} }
break; break;
case 32: case 32:
if(info.Board.compare("IREM-G101-B") == 0) { if(info.Board.compare("IREM-G101-B") == 0) {
return 1; //Major League return 1; //Major League
} }
break; break;
case 71: case 71:
if(info.Board.compare("CAMERICA-BF9097") == 0) { if(info.Board.compare("CAMERICA-BF9097") == 0) {
return 1; //Fire Hawk return 1; //Fire Hawk
} }
break; break;
case 78: case 78:
if(info.Board.compare("IREM-HOLYDIVER") == 0) { if(info.Board.compare("IREM-HOLYDIVER") == 0) {
return 3; //Holy Diver return 3; //Holy Diver
} }
break; break;
case 185: case 185:
if(info.Crc == 0x0F05FF0A) { if(info.Crc == 0x0F05FF0A) {
//Seicross (v2) //Seicross (v2)
//Not a real submapper, used to alter behavior specifically for this game //Not a real submapper, used to alter behavior specifically for this game
//This is equivalent to FCEUX's mapper 181 //This is equivalent to FCEUX's mapper 181
return 16; return 16;
} }
break; break;
case 210: case 210:
if(info.Board.compare("NAMCOT-175") == 0) { if(info.Board.compare("NAMCOT-175") == 0) {
return 1; //Namco 175 return 1; //Namco 175
} else if(info.Board.compare("NAMCOT-340") == 0) { } else if(info.Board.compare("NAMCOT-340") == 0) {
return 2; //Namco 340 return 2; //Namco 340
} }
break; break;
}
} }
return 0; return 0;
} }

View file

@ -281,6 +281,7 @@ struct GameInfo
string Mirroring; string Mirroring;
string InputType; string InputType;
string BusConflicts; string BusConflicts;
string SubmapperID;
}; };
enum class RomFormat enum class RomFormat

View file

@ -7,6 +7,7 @@ class TaitoTc0690 : public MMC3
{ {
private: private:
uint8_t _irqDelay; uint8_t _irqDelay;
bool _isFlintstones;
protected: protected:
virtual void InitMapper() override virtual void InitMapper() override
@ -14,6 +15,10 @@ protected:
_irqDelay = 0; _irqDelay = 0;
SelectPRGPage(2, -2); SelectPRGPage(2, -2);
SelectPRGPage(3, -1); SelectPRGPage(3, -1);
//This cart appears to behave differently (maybe not an identical mapper?)
//IRQ seems to be triggered at a different timing (approx 100 cpu cycles before regular mapper 48 timings)
_isFlintstones = _subMapperID == 255;
} }
virtual void StreamState(bool saving) override virtual void StreamState(bool saving) override
@ -25,8 +30,8 @@ protected:
virtual void TriggerIrq() override virtual void TriggerIrq() override
{ {
//"The IRQ seems to trip a little later than it does on MMC3. It looks like about a 4 CPU cycle delay from the normal MMC3 IRQ time." //"The IRQ seems to trip a little later than it does on MMC3. It looks like about a 4 CPU cycle delay from the normal MMC3 IRQ time."
//A value of 5 removes the shaking from The Jetsons //A value of 6 removes the shaking from The Jetsons
_irqDelay = 5; _irqDelay = _isFlintstones ? 19 : 6;
} }
void ProcessCpuClock() override void ProcessCpuClock() override
@ -61,9 +66,15 @@ protected:
break; break;
case 0xC000: case 0xC000:
_irqReloadValue = (0x100 - value) & 0xFF; //Flintstones expects either $C000 or $C001 to clear the irq flag
CPU::ClearIRQSource(IRQSource::External);
_irqReloadValue = (value ^ 0xFF) + (_isFlintstones ? 0 : 1);
break; break;
case 0xC001: case 0xC001:
//Flintstones expects either $C000 or $C001 to clear the irq flag
CPU::ClearIRQSource(IRQSource::External);
_irqCounter = 0; _irqCounter = 0;
_irqReload = true; _irqReload = true;
break; break;

File diff suppressed because it is too large Load diff