DB: Added possibility to disable/enable bus conflicts on a per-game basis (fixes Free Fall)
This commit is contained in:
parent
4187ffb45f
commit
f49a375224
5 changed files with 3046 additions and 3028 deletions
|
@ -527,7 +527,11 @@ void BaseMapper::Initialize(RomData &romData)
|
|||
_gameSystem = romData.System;
|
||||
_crc32 = romData.Crc32;
|
||||
_prgCrc32 = romData.PrgCrc32;
|
||||
_hasBusConflicts = HasBusConflicts();
|
||||
switch(romData.BusConflicts) {
|
||||
case BusConflictType::Default: _hasBusConflicts = HasBusConflicts(); break;
|
||||
case BusConflictType::Yes: _hasBusConflicts = true; break;
|
||||
case BusConflictType::No: _hasBusConflicts = false; break;
|
||||
}
|
||||
|
||||
_saveRam = new uint8_t[_saveRamSize];
|
||||
_workRam = new uint8_t[_workRamSize];
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "MessageManager.h"
|
||||
#include "../Utilities/CRC32.h"
|
||||
#include "../Utilities/FolderUtilities.h"
|
||||
#include "../Utilities/StringUtilities.h"
|
||||
#include "GameDatabase.h"
|
||||
#include "EmulationSettings.h"
|
||||
|
||||
|
@ -17,17 +18,6 @@ T GameDatabase::ToInt(string value)
|
|||
return std::stoi(value);
|
||||
}
|
||||
|
||||
vector<string> GameDatabase::split(const string &s, char delim)
|
||||
{
|
||||
vector<string> tokens;
|
||||
std::stringstream ss(s);
|
||||
std::string item;
|
||||
while(std::getline(ss, item, delim)) {
|
||||
tokens.push_back(item);
|
||||
}
|
||||
return tokens;
|
||||
}
|
||||
|
||||
void GameDatabase::InitDatabase()
|
||||
{
|
||||
if(_gameDatabase.size() == 0) {
|
||||
|
@ -39,8 +29,8 @@ void GameDatabase::InitDatabase()
|
|||
if(lineContent.empty() || lineContent[0] == '#') {
|
||||
continue;
|
||||
}
|
||||
vector<string> values = split(lineContent, ',');
|
||||
if(values.size() >= 13) {
|
||||
vector<string> values = StringUtilities::Split(lineContent, ',');
|
||||
if(values.size() >= 15) {
|
||||
GameInfo gameInfo{
|
||||
(uint32_t)std::stoll(values[0], nullptr, 16),
|
||||
values[1],
|
||||
|
@ -55,7 +45,8 @@ void GameDatabase::InitDatabase()
|
|||
ToInt<uint32_t>(values[10]),
|
||||
ToInt<uint32_t>(values[11]) == 0 ? false : true,
|
||||
values[12],
|
||||
values.size() > 13 ? values[13] : ""
|
||||
values[13],
|
||||
values[14]
|
||||
};
|
||||
|
||||
if(!gameInfo.InputType.empty() && gameInfo.InputType[gameInfo.InputType.size() - 1] == '\r') {
|
||||
|
@ -71,6 +62,16 @@ void GameDatabase::InitDatabase()
|
|||
}
|
||||
}
|
||||
|
||||
BusConflictType GameDatabase::GetBusConflictType(string busConflictSetting)
|
||||
{
|
||||
if(busConflictSetting.compare("Y") == 0) {
|
||||
return BusConflictType::Yes;
|
||||
} else if(busConflictSetting.compare("N") == 0) {
|
||||
return BusConflictType::No;
|
||||
}
|
||||
return BusConflictType::Default;
|
||||
}
|
||||
|
||||
GameSystem GameDatabase::GetGameSystem(string system)
|
||||
{
|
||||
if(system.compare("NesNtsc") == 0) {
|
||||
|
@ -317,6 +318,9 @@ void GameDatabase::SetGameInfo(uint32_t romCrc, RomData &romData, bool updateRom
|
|||
if(!info.Chip.empty()) {
|
||||
MessageManager::Log("[DB] Chip: " + info.Chip);
|
||||
}
|
||||
if(!info.BusConflicts.empty()) {
|
||||
MessageManager::Log("[DB] Bus conflicts: " + info.BusConflicts);
|
||||
}
|
||||
|
||||
if(!info.Mirroring.empty()) {
|
||||
MessageManager::Log("[DB] Mirroring: " + string(info.Mirroring.compare("h") == 0 ? "Horizontal" : "Vertical"));
|
||||
|
@ -355,6 +359,7 @@ void GameDatabase::UpdateRomData(GameInfo &info, RomData &romData)
|
|||
romData.MapperID = info.MapperID;
|
||||
romData.System = GetGameSystem(info.System);
|
||||
romData.SubMapperID = GetSubMapper(info);
|
||||
romData.BusConflicts = GetBusConflictType(info.BusConflicts);
|
||||
romData.ChrRamSize = info.ChrRamSize * 1024;
|
||||
if(info.WorkRamSize > 0) {
|
||||
romData.WorkRamSize = info.WorkRamSize * 1024;
|
||||
|
|
|
@ -9,8 +9,8 @@ private:
|
|||
static std::unordered_map<uint32_t, GameInfo> _gameDatabase;
|
||||
|
||||
template<typename T> static T ToInt(string value);
|
||||
static vector<string> split(const string &s, char delim);
|
||||
|
||||
static BusConflictType GetBusConflictType(string busConflictSetting);
|
||||
static GameSystem GetGameSystem(string system);
|
||||
static uint8_t GetSubMapper(GameInfo &info);
|
||||
|
||||
|
|
|
@ -30,6 +30,13 @@ enum class GameSystem
|
|||
Unknown,
|
||||
};
|
||||
|
||||
enum class BusConflictType
|
||||
{
|
||||
Default = 0,
|
||||
Yes,
|
||||
No
|
||||
};
|
||||
|
||||
struct NESHeader
|
||||
{
|
||||
/*
|
||||
|
@ -257,6 +264,7 @@ struct GameInfo
|
|||
bool HasBattery;
|
||||
string Mirroring;
|
||||
string InputType;
|
||||
string BusConflicts;
|
||||
};
|
||||
|
||||
enum class RomFormat
|
||||
|
@ -279,6 +287,7 @@ struct RomData
|
|||
bool HasBattery = false;
|
||||
bool HasTrainer = false;
|
||||
MirroringType Mirroring = MirroringType::Horizontal;
|
||||
BusConflictType BusConflicts = BusConflictType::Default;
|
||||
|
||||
int32_t ChrRamSize = -1;
|
||||
int32_t SaveChrRamSize = -1;
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue