mirror of
https://github.com/libretro/Mesen.git
synced 2024-11-23 09:09:45 +00:00
Fixed some games (Galaxian, Mighty Bomb Jack) + added some games to DB to fix headers
This commit is contained in:
parent
54ef42c869
commit
8032407f28
@ -781,7 +781,9 @@ uint8_t BaseMapper::InternalReadVRAM(uint16_t addr)
|
||||
if(_chrPageAccessType[addr >> 8] & MemoryAccessType::Read) {
|
||||
return _chrPages[addr >> 8][(uint8_t)addr];
|
||||
}
|
||||
return 0;
|
||||
|
||||
//Open bus - "When CHR is disabled, the pattern tables are open bus. Theoretically, this should return the LSB of the address read, but real-world behavior varies."
|
||||
return _vramOpenBusValue >= 0 ? _vramOpenBusValue : addr;
|
||||
}
|
||||
|
||||
uint8_t BaseMapper::DebugReadVRAM(uint16_t addr)
|
||||
|
@ -71,6 +71,7 @@ protected:
|
||||
uint8_t* _workRam = nullptr;
|
||||
bool _hasBattery = false;
|
||||
bool _hasChrBattery = false;
|
||||
int16_t _vramOpenBusValue = -1;
|
||||
|
||||
virtual void InitMapper() = 0;
|
||||
virtual void InitMapper(RomData &romData);
|
||||
|
@ -15,6 +15,9 @@ protected:
|
||||
{
|
||||
SelectPRGPage(0, 0);
|
||||
SelectCHRPage(0, 0);
|
||||
|
||||
//Needed for mighty bomb jack (j)
|
||||
_vramOpenBusValue = 0xFF;
|
||||
}
|
||||
|
||||
bool HasBusConflicts() override { return (_mapperID == 3 && _subMapperID == 2) || _mapperID == 185; }
|
||||
|
@ -63,10 +63,14 @@ bool Console::Initialize(string romFilename, stringstream *filestream, string pa
|
||||
SaveStateManager::SaveRecentGame(_mapper->GetRomName(), _romFilepath, _patchFilename, _archiveFileIndex);
|
||||
}
|
||||
|
||||
MessageManager::SendNotification(ConsoleNotificationType::GameStopped);
|
||||
shared_ptr<BaseMapper> mapper = MapperFactory::InitializeFromFile(romFilename, filestream, patchFilename, archiveFileIndex);
|
||||
|
||||
if(mapper) {
|
||||
if(_mapper) {
|
||||
//Send notification only if a game was already running and we successfully loaded the new one
|
||||
MessageManager::SendNotification(ConsoleNotificationType::GameStopped);
|
||||
}
|
||||
|
||||
_romFilepath = romFilename;
|
||||
_patchFilename = patchFilename;
|
||||
_archiveFileIndex = archiveFileIndex;
|
||||
|
@ -237,6 +237,18 @@ uint8_t GameDatabase::GetSubMapper(GameInfo &info)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool GameDatabase::GetDbRomSize(uint32_t romCrc, uint32_t &prgSize, uint32_t &chrSize)
|
||||
{
|
||||
InitDatabase();
|
||||
auto result = _gameDatabase.find(romCrc);
|
||||
if(result != _gameDatabase.end()) {
|
||||
prgSize = result->second.PrgRomSize * 1024;
|
||||
chrSize = result->second.ChrRomSize * 1024;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GameDatabase::GetiNesHeader(uint32_t romCrc, NESHeader &nesHeader)
|
||||
{
|
||||
GameInfo info = {};
|
||||
|
@ -21,4 +21,5 @@ public:
|
||||
static void InitializeInputDevices(string inputType, GameSystem system);
|
||||
static void SetGameInfo(uint32_t romCrc, RomData &romData, bool updateRomData);
|
||||
static bool GetiNesHeader(uint32_t romCrc, NESHeader &nesHeader);
|
||||
static bool GetDbRomSize(uint32_t romCrc, uint32_t &prgSize, uint32_t &chrSize);
|
||||
};
|
@ -12,6 +12,7 @@ RomData iNesLoader::LoadRom(vector<uint8_t>& romFile, NESHeader *preloadedHeader
|
||||
|
||||
NESHeader header;
|
||||
uint8_t* buffer = romFile.data();
|
||||
uint32_t dataSize = romFile.size();
|
||||
if(preloadedHeader) {
|
||||
header = *preloadedHeader;
|
||||
header.SanitizeHeader(romFile.size() + sizeof(NESHeader));
|
||||
@ -19,6 +20,7 @@ RomData iNesLoader::LoadRom(vector<uint8_t>& romFile, NESHeader *preloadedHeader
|
||||
memcpy((char*)&header, buffer, sizeof(NESHeader));
|
||||
buffer += sizeof(NESHeader);
|
||||
header.SanitizeHeader(romFile.size());
|
||||
dataSize -= sizeof(NESHeader);
|
||||
}
|
||||
|
||||
romData.Format = RomFormat::iNes;
|
||||
@ -54,18 +56,24 @@ RomData iNesLoader::LoadRom(vector<uint8_t>& romFile, NESHeader *preloadedHeader
|
||||
romData.PrgChrCrc32 = romCrc;
|
||||
romData.PrgChrMd5 = GetMd5Sum(buffer, romFile.size() - bytesRead);
|
||||
|
||||
NESHeader dbHeader;
|
||||
GameDatabase::GetiNesHeader(romData.PrgChrCrc32, dbHeader);
|
||||
if(dbHeader.GetPrgSize() != header.GetPrgSize() || dbHeader.GetChrSize() != header.GetChrSize()) {
|
||||
if(dbHeader.GetPrgSize() + dbHeader.GetChrSize() + bytesRead <= romFile.size()) {
|
||||
//Use corrected PRG/CHR sizes from the DB when reading from file
|
||||
header = dbHeader;
|
||||
}
|
||||
uint32_t prgSize = 0;
|
||||
uint32_t chrSize = 0;
|
||||
|
||||
if(EmulationSettings::CheckFlag(EmulationFlags::DisableGameDatabase) || !GameDatabase::GetDbRomSize(romData.PrgChrCrc32, prgSize, chrSize)) {
|
||||
//Fallback on header sizes when game is not in DB (or DB is disabled)
|
||||
prgSize = header.GetPrgSize();
|
||||
chrSize = header.GetChrSize();
|
||||
}
|
||||
|
||||
romData.PrgRom.insert(romData.PrgRom.end(), buffer, buffer + header.GetPrgSize());
|
||||
buffer += header.GetPrgSize();
|
||||
romData.ChrRom.insert(romData.ChrRom.end(), buffer, buffer + header.GetChrSize());
|
||||
if(prgSize + chrSize > dataSize) {
|
||||
//Invalid rom file
|
||||
romData.Error = true;
|
||||
return romData;
|
||||
}
|
||||
|
||||
romData.PrgRom.insert(romData.PrgRom.end(), buffer, buffer + prgSize);
|
||||
buffer += prgSize;
|
||||
romData.ChrRom.insert(romData.ChrRom.end(), buffer, buffer + chrSize);
|
||||
|
||||
romData.PrgCrc32 = CRC32::GetCRC(romData.PrgRom.data(), romData.PrgRom.size());
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Automatically generated database based on Nestopia's DB and NesCartDB
|
||||
#
|
||||
# Generated on 22/05/2017 using:
|
||||
# Generated on 25/05/2017 using:
|
||||
# -NesCartDB (dated 2016-08-20)
|
||||
# -Nestopia UE's latest DB (dated 2015-10-22)
|
||||
#
|
||||
@ -621,6 +621,7 @@
|
||||
3256114C,Famicom,HVC-TGROM,HVC-TGROM-01,MMC3B,4,512,,8,0,0,0,,,,
|
||||
326AB3B6,NesNtsc,NES-TLROM,NES-TLROM-01,MMC3A,4,128,128,,0,0,0,,,,
|
||||
3275FD7E,Famicom,HVC-CNROM,N04,,3,32,32,,0,0,0,v,,,
|
||||
3293AFEA,Famicom,,,,140,128,32,,0,0,0,,,,
|
||||
32CD7DE2,NesNtsc,VS-DualSystem,,,65000,0,,,0,0,0,,,,
|
||||
32CF4307,NesNtsc,NES-SKROM,NES-SKROM-04,MMC1B2,1,128,128,,8,0,0,,,,
|
||||
32FA246F,Famicom,NAMCOT-3311,3311,,0,32,8,,0,0,0,h,,,
|
||||
@ -1400,6 +1401,7 @@
|
||||
766C2CAC,VsUni,,,,99,32,16,4,0,0,0,,,,
|
||||
7678F1D5,Famicom,TAITO-X1-005,アシユラー,X1-005,207,256,128,,0,0,0,,,,
|
||||
768A1B6A,Famicom,HVC-TLROM,HVC-TLROM-02,MMC3A,4,128,128,,0,0,0,,,,
|
||||
76A6A813,Famicom,,,,0,8,8,,0,0,0,,,,
|
||||
76C161E3,NesPal,NES-SGROM,NES-SGROM-04,MMC1B2,1,256,,8,0,0,0,,,,
|
||||
7712BD99,NesNtsc,VS-DualSystem,,,65000,0,,,0,0,0,,,,
|
||||
771C8855,NesNtsc,NES-TLROM,NES-TLROM-03,MMC3B,4,128,128,,0,0,0,,,,
|
||||
@ -2021,6 +2023,7 @@ A7D3635E,Famicom,HVC-UNROM,HVC-UNROM-02,,2,128,,8,0,0,0,v,,,
|
||||
A7DE65E4,NesNtsc,NES-SLROM,NES-SLROM-03,MMC1B2,1,128,128,,0,0,0,,,,
|
||||
A7E784ED,Famicom,,,,1,128,32,,0,0,0,,,,
|
||||
A7EF8F80,NesNtsc,,,,4,128,256,,0,0,0,,,,
|
||||
A80290A6,NesNtsc,,,,0,32,8,,0,0,0,,,,
|
||||
A80A0F01,NesNtsc,ACCLAIM-MC-ACC,55741,MC-ACC,4,128,256,,0,0,0,,,,
|
||||
A80FA181,Famicom,HVC-SGROM,HVC-SGROM-02,MMC1,1,256,,8,0,0,0,,,,
|
||||
A851CAE9,Famicom,IREM-FCG-1,BLUE TRAIN,FCG-1,16,128,256,,0,0,0,,,,
|
||||
@ -2187,6 +2190,7 @@ B4C81ADB,NesNtsc,NES-TFROM,NES-TFROM-01,MMC3A,4,128,64,,0,0,0,,,,
|
||||
B4CDF95F,NesNtsc,NES-SLROM,NES-SLROM-06,MMC1B2,1,128,128,,0,0,0,,,,
|
||||
B4E4879E,NesNtsc,NES-UNROM,NES-UN-ROM-04,,2,128,,8,0,0,0,v,,,
|
||||
B4FF91E7,Famicom,,,,1,128,32,,0,0,0,,,,
|
||||
B52E17DC,NesNtsc,,,,0,32,8,,0,0,0,,,,
|
||||
B5576820,Famicom,HVC-SGROM,HVC-SGROM-02,MMC1A,1,256,,8,0,0,0,,,,
|
||||
B5D10D5C,NesNtsc,NES-AOROM,NES-AOROM-01,,7,128,,8,0,0,0,,,,
|
||||
B5D28EA2,NesNtsc,NES-CNROM,NES-CN-ROM-256-05,,3,32,32,,0,0,0,v,,,
|
||||
@ -2326,7 +2330,7 @@ BF7F54B4,Famicom,,,,4,256,128,,8,0,0,,,,
|
||||
BF888B75,NesPal,NES-SLROM,NES-SLROM-06,MMC1B2,1,128,128,,0,0,0,,,,
|
||||
BF93112A,Famicom,,,,1,128,128,,0,0,0,,,,
|
||||
BFBFD25D,NesNtsc,NES-TLROM,NES-TLROM-03,MMC3C,4,128,128,,0,0,0,,,,
|
||||
BFC7A2E9,Famicom,,,,153,128,256,,0,0,0,,,,
|
||||
BFC7A2E9,Famicom,,,,16,128,256,,0,0,0,,,,
|
||||
BFDE180C,Famicom,,,,116,128,512,,0,0,0,,,,
|
||||
C0103592,NesPal,NES-SLROM,NES-SLROM-06,MMC1B2,1,256,128,,0,0,0,,,,
|
||||
C0303AA3,Famicom,,,,242,512,,8,0,8,1,,,,
|
||||
@ -2340,7 +2344,7 @@ C0EDEDD0,NesPal,NES-UNROM,NES-UNROM-09,,2,128,,8,0,0,0,v,,,
|
||||
C0F251EA,NesPal,NES-TLROM,NES-TLROM-03,MMC3C,4,256,256,,0,0,0,,,,
|
||||
C0FB91AC,Famicom,,,,2,128,,8,0,0,0,v,,,
|
||||
C115A022,NesPal,NES-TLROM,NES-TLROM-03,MMC3C,4,128,128,,0,0,0,,,,
|
||||
C1719664,Famicom,HVC-SKROM,HVC-SKROM-02,MMC1A,1,128,128,,8,0,0,,,,
|
||||
C1719664,Famicom,,,,155,128,128,,0,0,0,,,,
|
||||
C18A7BCB,NesNtsc,BMC-FK23C,,,65000,512,512,,0,0,0,v,,,
|
||||
C1B43207,NesNtsc,NES-AMROM,NES-AMROM-01,,7,128,,8,0,0,0,,FourPlayer,,
|
||||
C1BA8BB9,Famicom,,,,4,256,,8,0,8,1,,PartyTap,,
|
||||
@ -2510,7 +2514,7 @@ CF849F72,NesPal,NES-SLROM,NES-SLROM-06,MMC1B2,1,128,128,,0,0,0,,,,
|
||||
CF9CF7A2,Famicom,HVC-SGROM,HVC-SGROM-02,MMC1,1,128,,8,0,0,0,,,,
|
||||
CFAE9DFA,NesNtsc,NES-SNROM,NES-SNROM-05,MMC1B2,1,128,,8,8,0,0,,FourPlayer,,
|
||||
CFB224E6,Famicom,,,,222,128,128,,0,0,0,,,,
|
||||
CFD4A281,Famicom,HVC-SJROM,HVC-SJROM-01,MMC1A,1,128,32,,0,8,1,,,,
|
||||
CFD4A281,Famicom,,,,155,128,32,,0,0,0,,,,
|
||||
CFD5AC62,NesNtsc,COLORDREAMS-74*377,BC6,,11,128,128,,0,0,0,v,,,
|
||||
CFE02ADA,NesPal,NES-SLROM,NES-SLROM-06,MMC1B3,1,128,128,,0,0,0,,,,
|
||||
D029F841,NesPal,NES-UNROM,NES-UNROM-09,,2,128,,8,0,0,0,v,,,
|
||||
|
Loading…
Reference in New Issue
Block a user