mirror of
https://github.com/libretro/Mesen.git
synced 2024-12-14 21:08:44 +00:00
Changed save/work ram size defaults - DB is not accurate, often doesn't list work ram for games that have it.
This commit is contained in:
parent
96959eb1ed
commit
596526c1d8
@ -90,7 +90,7 @@ void BaseMapper::SetCpuMemoryMapping(uint16_t startAddr, uint16_t endAddr, int16
|
||||
#endif
|
||||
|
||||
//If range is bigger than a single page, keep going until we reach the last page
|
||||
while(pageNumber < pageCount && startAddr <= endAddr - pageSize + 1) {
|
||||
while((uint32_t)pageNumber < pageCount && startAddr <= endAddr - pageSize + 1) {
|
||||
SetCpuMemoryMapping(startAddr, startAddr + pageSize - 1, source, accessType);
|
||||
pageNumber++;
|
||||
startAddr += pageSize;
|
||||
@ -425,12 +425,18 @@ void BaseMapper::Initialize(RomData &romData)
|
||||
_romFilename = romData.Filename;
|
||||
_batteryFilename = GetBatteryFilename();
|
||||
|
||||
_hasBattery = (romData.HasBattery || ForceBattery());
|
||||
|
||||
if(romData.SaveRamSize == -1 || ForceSaveRamSize()) {
|
||||
_saveRamSize = GetSaveRamSize(); //Needed because we need to call SaveBattery() in the destructor (and calling virtual functions in the destructor doesn't work correctly)
|
||||
} else {
|
||||
_saveRamSize = romData.SaveRamSize;
|
||||
}
|
||||
|
||||
if(_saveRamSize == 0) {
|
||||
_hasBattery = false;
|
||||
}
|
||||
|
||||
if(romData.WorkRamSize == -1 || ForceWorkRamSize()) {
|
||||
_workRamSize = GetWorkRamSize();
|
||||
} else {
|
||||
@ -458,7 +464,6 @@ void BaseMapper::Initialize(RomData &romData)
|
||||
memcpy(_chrRom, romData.ChrRom.data(), _chrRomSize);
|
||||
}
|
||||
|
||||
_hasBattery = (romData.HasBattery || ForceBattery()) && _saveRamSize > 0;
|
||||
_hasChrBattery = romData.SaveChrRamSize > 0 || ForceChrBattery();
|
||||
|
||||
_gameSystem = romData.System;
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "RomData.h"
|
||||
#include "MessageManager.h"
|
||||
#include "../Utilities/CRC32.h"
|
||||
#include "../Utilities/FolderUtilities.h"
|
||||
#include "GameDatabase.h"
|
||||
#include "EmulationSettings.h"
|
||||
|
||||
@ -31,7 +32,8 @@ vector<string> GameDatabase::split(const string &s, char delim)
|
||||
void GameDatabase::InitDatabase()
|
||||
{
|
||||
if(_gameDatabase.size() == 0) {
|
||||
ifstream db("MesenDB.txt", ios::in | ios::binary);
|
||||
string dbPath = FolderUtilities::CombinePath(FolderUtilities::GetHomeFolder(), "MesenDB.txt");
|
||||
ifstream db(dbPath, ios::in | ios::binary);
|
||||
while(db.good()) {
|
||||
string lineContent;
|
||||
std::getline(db, lineContent);
|
||||
@ -280,8 +282,12 @@ void GameDatabase::UpdateRomData(GameInfo &info, RomData &romData)
|
||||
romData.System = GetGameSystem(info.System);
|
||||
romData.SubMapperID = GetSubMapper(info);
|
||||
romData.ChrRamSize = info.ChrRamSize * 1024;
|
||||
romData.WorkRamSize = info.WorkRamSize * 1024;
|
||||
romData.SaveRamSize = info.SaveRamSize * 1024;
|
||||
if(info.WorkRamSize > 0) {
|
||||
romData.WorkRamSize = info.WorkRamSize * 1024;
|
||||
}
|
||||
if(info.SaveRamSize > 0) {
|
||||
romData.SaveRamSize = info.SaveRamSize * 1024;
|
||||
}
|
||||
romData.HasBattery |= info.HasBattery;
|
||||
|
||||
if(!info.Mirroring.empty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user