don't save built-in cheats (vf4 dimm check)

This commit is contained in:
Flyinghead 2022-04-13 13:10:56 +02:00
parent e0058c17ff
commit ac71970561
2 changed files with 8 additions and 3 deletions

View File

@ -398,6 +398,7 @@ void CheatManager::reset(const std::string& gameId)
{
setActive(true);
cheats.emplace_back(Cheat::Type::setValue, "Skip DIMM version check", true, 16, 0x000205c6, 9);
cheats.back().builtIn = true;
}
}
if (config::WidescreenGameHacks)
@ -789,10 +790,11 @@ void CheatManager::saveCheatFile(const std::string& filename)
#ifndef LIBRETRO
emucfg::ConfigFile cfg;
cfg.set_int("", "cheats", cheats.size());
int i = 0;
for (const Cheat& cheat : cheats)
{
if (cheat.builtIn)
continue;
std::string prefix = "cheat" + std::to_string(i) + "_";
cfg.set_int("", prefix + "address", cheat.address);
cfg.set_int("", prefix + "address_bit_position", cheat.valueMask);
@ -832,6 +834,7 @@ void CheatManager::saveCheatFile(const std::string& filename)
cfg.set_int("", prefix + "repeat_add_to_address", cheat.repeatAddressIncrement);
i++;
}
cfg.set_int("", "cheats", i);
FILE *fp = nowide::fopen(filename.c_str(), "w");
if (fp == nullptr)
throw FlycastException("Can't save cheat file");

View File

@ -53,12 +53,14 @@ struct Cheat
u32 repeatValueIncrement;
u32 repeatAddressIncrement;
u32 destAddress;
bool builtIn;
Cheat(Type type = Type::disabled, const std::string& description = "", bool enabled = false, u32 size = 0, u32 address = 0,
u8 valueMask = 0, u32 repeatCount = 1, u32 repeatValueIncrement = 0,
u32 repeatAddressIncrement = 0, u32 destAddress = 0)
u32 repeatAddressIncrement = 0, u32 destAddress = 0, bool builtIn = false)
: type(type), description(description), enabled(enabled), size(size), address(address), valueMask(valueMask),
repeatCount(repeatCount), repeatValueIncrement(repeatValueIncrement), repeatAddressIncrement(repeatAddressIncrement), destAddress(destAddress)
repeatCount(repeatCount), repeatValueIncrement(repeatValueIncrement), repeatAddressIncrement(repeatAddressIncrement),
destAddress(destAddress), builtIn(builtIn)
{
}
};