mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-24 15:12:23 +01:00
byuu says: Implemented the cheat database dialog, and most of the cheat editor dialog. I still have to handle loading and saving the cheats.bml file for each game. I wanted to finish it today, but I burned out. It's a ton of really annoying work to support cheat codes. There's also some issue with the width calculation for the "code(s)" column in hiro/GTK. Short-term: - add input port changing support - add other input types (mouse-based, etc) - finish cheat codes Long-term: - add slotted cart loader (SGB, BSX, ST) - add DIP switch selection window (NSS) - add overscan masking - add timing configuration (video/audio sync) Not planned: - video color adjustments (will allow emulated color vs raw color; but no more sliders) - pixel shaders - ananke integration (will need to make a command-line version to get my games in) - fancy audio adjustment controls (resampler, latency, volume) - input focus settings - localization support (not enough users) - window geometry memory - anything else not in higan v094
30 lines
1.1 KiB
C++
30 lines
1.1 KiB
C++
auto Program::stateName(unsigned slot, bool manager) -> string {
|
|
return {
|
|
folderPaths[0], "higan/states/",
|
|
manager ? "managed/" : "quick/",
|
|
"slot-", decimal<2>(slot), ".bst"
|
|
};
|
|
}
|
|
|
|
auto Program::loadState(unsigned slot, bool manager) -> bool {
|
|
if(!emulator) return false;
|
|
auto location = stateName(slot, manager);
|
|
auto memory = file::read(location);
|
|
if(memory.size() == 0) return showMessage({"Slot ", slot, " does not exist"}), false;
|
|
serializer s(memory.data(), memory.size());
|
|
if(emulator->unserialize(s) == false) return showMessage({"Slot ", slot, " state incompatible"}), false;
|
|
return showMessage({"Loaded from slot ", slot}), true;
|
|
}
|
|
|
|
auto Program::saveState(unsigned slot, bool manager) -> bool {
|
|
if(!emulator) return false;
|
|
auto location = stateName(slot, manager);
|
|
serializer s = emulator->serialize();
|
|
if(s.size() == 0) return showMessage({"Failed to save state to slot ", slot}), false;
|
|
directory::create(location.pathname());
|
|
if(file::write(location, s.data(), s.size()) == false) {
|
|
return showMessage({"Unable to write to slot ", slot}), false;
|
|
}
|
|
return showMessage({"Saved to slot ", slot}), true;
|
|
}
|