2015-04-21 11:51:57 +00:00
|
|
|
CheatDatabase::CheatDatabase() {
|
|
|
|
cheatDatabase = this;
|
|
|
|
|
|
|
|
layout.setMargin(5);
|
|
|
|
cheatList.setCheckable();
|
|
|
|
selectAllButton.setText("Select All").onActivate([&] { cheatList.setChecked(true); });
|
|
|
|
unselectAllButton.setText("Unselect All").onActivate([&] { cheatList.setChecked(false); });
|
|
|
|
addCodesButton.setText("Add Codes").onActivate([&] { addCodes(); });
|
|
|
|
|
|
|
|
setSize({800, 400});
|
|
|
|
setPlacement(0.5, 1.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto CheatDatabase::findCodes() -> void {
|
|
|
|
if(!emulator) return;
|
|
|
|
auto sha256 = emulator->sha256();
|
|
|
|
|
|
|
|
auto contents = string::read({localpath(), "tomoko/cheats.bml"});
|
Update to v094r17 release.
byuu says:
This updates higan to use the new Markup::Node changes. This is a really
big change, and one slight typo anywhere could break certain classes of
games from playing.
I don't have ananke hooked up again yet, so I don't have the ability to
test this much. If anyone with some v094 game folders wouldn't mind
testing, I'd help out a great deal.
I'm most concerned about testing one of each SNES special chip game.
Most notably, systems like the SA-1, HitachiDSP and NEC-DSP were using
the fancier lookups, eg node["rom[0]/name"], which I had to convert to
a rather ugly node["rom"].at(0)["name"], which I'm fairly confident
won't work. I'm going to blame that on the fumes from the shelves I just
stained >.> Might work with node.find("rom[0]/name")(0) though ...? But
so ugly ... ugh.
That aside, this WIP adds the accuracy-PPU inlining, so the accuracy
profile should run around 7.5% faster than before.
2015-05-02 13:05:46 +00:00
|
|
|
auto document = BML::unserialize(contents);
|
2015-04-21 11:51:57 +00:00
|
|
|
|
Update to v094r17 release.
byuu says:
This updates higan to use the new Markup::Node changes. This is a really
big change, and one slight typo anywhere could break certain classes of
games from playing.
I don't have ananke hooked up again yet, so I don't have the ability to
test this much. If anyone with some v094 game folders wouldn't mind
testing, I'd help out a great deal.
I'm most concerned about testing one of each SNES special chip game.
Most notably, systems like the SA-1, HitachiDSP and NEC-DSP were using
the fancier lookups, eg node["rom[0]/name"], which I had to convert to
a rather ugly node["rom"].at(0)["name"], which I'm fairly confident
won't work. I'm going to blame that on the fumes from the shelves I just
stained >.> Might work with node.find("rom[0]/name")(0) though ...? But
so ugly ... ugh.
That aside, this WIP adds the accuracy-PPU inlining, so the accuracy
profile should run around 7.5% faster than before.
2015-05-02 13:05:46 +00:00
|
|
|
for(auto cartridge : document.find("cartridge")) {
|
2015-04-21 11:51:57 +00:00
|
|
|
if(cartridge["sha256"].text() != sha256) continue;
|
|
|
|
|
|
|
|
codes.reset();
|
|
|
|
cheatList.reset();
|
|
|
|
cheatList.append(ListViewColumn().setWidth(~0));
|
Update to v094r17 release.
byuu says:
This updates higan to use the new Markup::Node changes. This is a really
big change, and one slight typo anywhere could break certain classes of
games from playing.
I don't have ananke hooked up again yet, so I don't have the ability to
test this much. If anyone with some v094 game folders wouldn't mind
testing, I'd help out a great deal.
I'm most concerned about testing one of each SNES special chip game.
Most notably, systems like the SA-1, HitachiDSP and NEC-DSP were using
the fancier lookups, eg node["rom[0]/name"], which I had to convert to
a rather ugly node["rom"].at(0)["name"], which I'm fairly confident
won't work. I'm going to blame that on the fumes from the shelves I just
stained >.> Might work with node.find("rom[0]/name")(0) though ...? But
so ugly ... ugh.
That aside, this WIP adds the accuracy-PPU inlining, so the accuracy
profile should run around 7.5% faster than before.
2015-05-02 13:05:46 +00:00
|
|
|
for(auto cheat : cartridge.find("cheat")) {
|
2015-04-21 11:51:57 +00:00
|
|
|
codes.append(cheat["code"].text());
|
|
|
|
cheatList.append(ListViewItem().setText(0, cheat["description"].text()));
|
|
|
|
}
|
|
|
|
|
|
|
|
setTitle(cartridge["name"].text());
|
|
|
|
setVisible();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
MessageDialog().setParent(*toolsManager).setText("Sorry, no cheats were found for this game.").information();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto CheatDatabase::addCodes() -> void {
|
|
|
|
for(auto item : cheatList.checked()) {
|
|
|
|
string code = codes(item->offset(), "");
|
|
|
|
string description = item->text(0);
|
|
|
|
if(toolsManager->cheatEditor.addCode(code, description) == false) {
|
|
|
|
MessageDialog().setParent(*this).setText("Free slots exhausted. Not all codes could be added.").warning();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setVisible(false);
|
2015-04-21 11:58:59 +00:00
|
|
|
toolsManager->cheatEditor.doRefresh();
|
2015-04-21 11:51:57 +00:00
|
|
|
}
|