2015-04-21 11:51:57 +00:00
|
|
|
CheatDatabase::CheatDatabase() {
|
|
|
|
cheatDatabase = this;
|
|
|
|
|
|
|
|
layout.setMargin(5);
|
|
|
|
cheatList.setCheckable();
|
2015-06-12 13:14:38 +00:00
|
|
|
selectAllButton.setText("Select All").onActivate([&] { cheatList.checkAll(); });
|
|
|
|
unselectAllButton.setText("Unselect All").onActivate([&] { cheatList.uncheckAll(); });
|
2015-04-21 11:51:57 +00:00
|
|
|
addCodesButton.setText("Add Codes").onActivate([&] { addCodes(); });
|
|
|
|
|
|
|
|
setSize({800, 400});
|
|
|
|
setPlacement(0.5, 1.0);
|
2015-06-12 13:14:38 +00:00
|
|
|
|
|
|
|
onSize([&] { cheatList.resizeColumns(); });
|
2015-04-21 11:51:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto CheatDatabase::findCodes() -> void {
|
|
|
|
if(!emulator) return;
|
|
|
|
auto sha256 = emulator->sha256();
|
|
|
|
|
2015-07-02 10:22:24 +00:00
|
|
|
auto contents = string::read(locate({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();
|
2015-06-12 13:14:38 +00:00
|
|
|
cheatList.append(ListViewColumn().setExpandable());
|
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());
|
2015-06-12 13:14:38 +00:00
|
|
|
cheatList.append(ListViewItem()
|
|
|
|
.append(ListViewCell().setText(cheat["description"].text()))
|
|
|
|
);
|
2015-04-21 11:51:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
setTitle(cartridge["name"].text());
|
|
|
|
setVisible();
|
2015-06-12 13:14:38 +00:00
|
|
|
cheatList.resizeColumns();
|
2015-04-21 11:51:57 +00:00
|
|
|
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(), "");
|
2015-06-12 13:14:38 +00:00
|
|
|
string description = item->cell(0)->text();
|
2015-04-21 11:51:57 +00:00
|
|
|
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
|
|
|
}
|