2015-04-21 11:51:57 +00:00
|
|
|
CheatEditor::CheatEditor(TabFrame* parent) : TabFrameItem(parent) {
|
2016-01-07 08:14:33 +00:00
|
|
|
setIcon(Icon::Edit::Replace);
|
2015-04-21 11:51:57 +00:00
|
|
|
setText("Cheat Editor");
|
|
|
|
|
|
|
|
layout.setMargin(5);
|
Update to v094r40 release.
byuu says:
Changelog:
- updated to newest hiro API
- SFC performance profile builds once again
- hiro: Qt port completed
Errata 1: the hiro/Qt target won't run tomoko just yet. Starts by
crashing inside InputSettings because hiro/Qt isn't forcefully selecting
the first item added to a ComboButton just yet. Even with a monkey patch
to get around that, the UI is incredibly unstable. Lots of geometry
calculation bugs, and a crash when you try and access certain folders in
the browser dialog. Lots of work left to be done there, sadly.
Errata 2: the hiro/Windows port has black backgrounds on all ListView
items. It's because I need to test for unassigned colors and grab the
default Windows brush colors in those cases.
Note: alternating row colors on multi-column ListView widgets is gone
now. Not a bug. May add it back later, but I'm not sure. It doesn't
interact nicely with per-cell background colors.
Things left to do:
First, I have to fix the Windows and Qt target bugs.
Next, I need to go through and revise the hiro API even more (nothing
too major.)
Next, I need to update icarus to use the new hiro API, and add support
for the SFC games database.
Next, I have to rewrite my TSV->BML cheat code tool.
Next, I need to post a final WIP of higan+icarus publicly and wait a few
days.
Next, I need to fix any bugs reported from the final WIP that I can.
Finally, I should be able to release v095.
2015-08-18 10:18:00 +00:00
|
|
|
cheatList.append(ListViewHeader().setVisible()
|
|
|
|
.append(ListViewColumn().setText("Slot").setForegroundColor({0, 128, 0}).setAlignment(1.0))
|
|
|
|
.append(ListViewColumn().setText("Code(s)"))
|
|
|
|
.append(ListViewColumn().setText("Description").setExpandable())
|
|
|
|
);
|
2015-06-12 13:14:38 +00:00
|
|
|
for(auto slot : range(Slots)) {
|
|
|
|
cheatList.append(ListViewItem()
|
Update to v094r40 release.
byuu says:
Changelog:
- updated to newest hiro API
- SFC performance profile builds once again
- hiro: Qt port completed
Errata 1: the hiro/Qt target won't run tomoko just yet. Starts by
crashing inside InputSettings because hiro/Qt isn't forcefully selecting
the first item added to a ComboButton just yet. Even with a monkey patch
to get around that, the UI is incredibly unstable. Lots of geometry
calculation bugs, and a crash when you try and access certain folders in
the browser dialog. Lots of work left to be done there, sadly.
Errata 2: the hiro/Windows port has black backgrounds on all ListView
items. It's because I need to test for unassigned colors and grab the
default Windows brush colors in those cases.
Note: alternating row colors on multi-column ListView widgets is gone
now. Not a bug. May add it back later, but I'm not sure. It doesn't
interact nicely with per-cell background colors.
Things left to do:
First, I have to fix the Windows and Qt target bugs.
Next, I need to go through and revise the hiro API even more (nothing
too major.)
Next, I need to update icarus to use the new hiro API, and add support
for the SFC games database.
Next, I have to rewrite my TSV->BML cheat code tool.
Next, I need to post a final WIP of higan+icarus publicly and wait a few
days.
Next, I need to fix any bugs reported from the final WIP that I can.
Finally, I should be able to release v095.
2015-08-18 10:18:00 +00:00
|
|
|
.append(ListViewCell().setCheckable().setText(1 + slot))
|
2015-06-12 13:14:38 +00:00
|
|
|
.append(ListViewCell())
|
|
|
|
.append(ListViewCell())
|
|
|
|
);
|
|
|
|
}
|
2015-04-21 11:58:59 +00:00
|
|
|
cheatList.onChange([&] { doChangeSelected(); });
|
Update to v094r40 release.
byuu says:
Changelog:
- updated to newest hiro API
- SFC performance profile builds once again
- hiro: Qt port completed
Errata 1: the hiro/Qt target won't run tomoko just yet. Starts by
crashing inside InputSettings because hiro/Qt isn't forcefully selecting
the first item added to a ComboButton just yet. Even with a monkey patch
to get around that, the UI is incredibly unstable. Lots of geometry
calculation bugs, and a crash when you try and access certain folders in
the browser dialog. Lots of work left to be done there, sadly.
Errata 2: the hiro/Windows port has black backgrounds on all ListView
items. It's because I need to test for unassigned colors and grab the
default Windows brush colors in those cases.
Note: alternating row colors on multi-column ListView widgets is gone
now. Not a bug. May add it back later, but I'm not sure. It doesn't
interact nicely with per-cell background colors.
Things left to do:
First, I have to fix the Windows and Qt target bugs.
Next, I need to go through and revise the hiro API even more (nothing
too major.)
Next, I need to update icarus to use the new hiro API, and add support
for the SFC games database.
Next, I have to rewrite my TSV->BML cheat code tool.
Next, I need to post a final WIP of higan+icarus publicly and wait a few
days.
Next, I need to fix any bugs reported from the final WIP that I can.
Finally, I should be able to release v095.
2015-08-18 10:18:00 +00:00
|
|
|
cheatList.onToggle([&](ListViewCell cell) {
|
|
|
|
cheats[cell.parent().offset()].enabled = cell.checked();
|
2015-04-21 11:58:59 +00:00
|
|
|
synchronizeCodes();
|
|
|
|
});
|
2015-04-21 11:51:57 +00:00
|
|
|
codeLabel.setText("Code(s):");
|
|
|
|
codeValue.onChange([&] { doModify(); });
|
|
|
|
descriptionLabel.setText("Description:");
|
|
|
|
descriptionValue.onChange([&] { doModify(); });
|
|
|
|
findCodesButton.setText("Find Codes ...").onActivate([&] { cheatDatabase->findCodes(); });
|
|
|
|
resetButton.setText("Reset").onActivate([&] { doReset(); });
|
|
|
|
eraseButton.setText("Erase").onActivate([&] { doErase(); });
|
|
|
|
}
|
|
|
|
|
2015-04-21 11:58:59 +00:00
|
|
|
auto CheatEditor::doChangeSelected() -> void {
|
2015-04-21 11:51:57 +00:00
|
|
|
if(auto item = cheatList.selected()) {
|
2015-06-18 10:48:53 +00:00
|
|
|
auto& cheat = cheats[item.offset()];
|
2015-04-21 11:58:59 +00:00
|
|
|
codeValue.setEnabled(true).setText(cheat.code);
|
|
|
|
descriptionValue.setEnabled(true).setText(cheat.description);
|
2015-04-21 11:51:57 +00:00
|
|
|
eraseButton.setEnabled(true);
|
|
|
|
} else {
|
|
|
|
codeValue.setEnabled(false).setText("");
|
|
|
|
descriptionValue.setEnabled(false).setText("");
|
|
|
|
eraseButton.setEnabled(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto CheatEditor::doModify() -> void {
|
|
|
|
if(auto item = cheatList.selected()) {
|
2015-06-18 10:48:53 +00:00
|
|
|
auto& cheat = cheats[item.offset()];
|
2015-04-21 11:58:59 +00:00
|
|
|
cheat.code = codeValue.text();
|
|
|
|
cheat.description = descriptionValue.text();
|
2015-04-21 11:51:57 +00:00
|
|
|
doRefresh();
|
|
|
|
synchronizeCodes();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto CheatEditor::doRefresh() -> void {
|
|
|
|
for(auto slot : range(Slots)) {
|
2015-04-21 11:58:59 +00:00
|
|
|
auto& cheat = cheats[slot];
|
|
|
|
if(cheat.code || cheat.description) {
|
|
|
|
lstring codes = cheat.code.split("+");
|
2015-04-21 11:51:57 +00:00
|
|
|
if(codes.size() > 1) codes[0].append("+...");
|
Update to v094r40 release.
byuu says:
Changelog:
- updated to newest hiro API
- SFC performance profile builds once again
- hiro: Qt port completed
Errata 1: the hiro/Qt target won't run tomoko just yet. Starts by
crashing inside InputSettings because hiro/Qt isn't forcefully selecting
the first item added to a ComboButton just yet. Even with a monkey patch
to get around that, the UI is incredibly unstable. Lots of geometry
calculation bugs, and a crash when you try and access certain folders in
the browser dialog. Lots of work left to be done there, sadly.
Errata 2: the hiro/Windows port has black backgrounds on all ListView
items. It's because I need to test for unassigned colors and grab the
default Windows brush colors in those cases.
Note: alternating row colors on multi-column ListView widgets is gone
now. Not a bug. May add it back later, but I'm not sure. It doesn't
interact nicely with per-cell background colors.
Things left to do:
First, I have to fix the Windows and Qt target bugs.
Next, I need to go through and revise the hiro API even more (nothing
too major.)
Next, I need to update icarus to use the new hiro API, and add support
for the SFC games database.
Next, I have to rewrite my TSV->BML cheat code tool.
Next, I need to post a final WIP of higan+icarus publicly and wait a few
days.
Next, I need to fix any bugs reported from the final WIP that I can.
Finally, I should be able to release v095.
2015-08-18 10:18:00 +00:00
|
|
|
cheatList.item(slot).cell(0).setChecked(cheat.enabled);
|
2015-06-18 10:48:53 +00:00
|
|
|
cheatList.item(slot).cell(1).setText(codes[0]);
|
|
|
|
cheatList.item(slot).cell(2).setText(cheat.description).setForegroundColor({0, 0, 0});
|
2015-04-21 11:51:57 +00:00
|
|
|
} else {
|
Update to v094r40 release.
byuu says:
Changelog:
- updated to newest hiro API
- SFC performance profile builds once again
- hiro: Qt port completed
Errata 1: the hiro/Qt target won't run tomoko just yet. Starts by
crashing inside InputSettings because hiro/Qt isn't forcefully selecting
the first item added to a ComboButton just yet. Even with a monkey patch
to get around that, the UI is incredibly unstable. Lots of geometry
calculation bugs, and a crash when you try and access certain folders in
the browser dialog. Lots of work left to be done there, sadly.
Errata 2: the hiro/Windows port has black backgrounds on all ListView
items. It's because I need to test for unassigned colors and grab the
default Windows brush colors in those cases.
Note: alternating row colors on multi-column ListView widgets is gone
now. Not a bug. May add it back later, but I'm not sure. It doesn't
interact nicely with per-cell background colors.
Things left to do:
First, I have to fix the Windows and Qt target bugs.
Next, I need to go through and revise the hiro API even more (nothing
too major.)
Next, I need to update icarus to use the new hiro API, and add support
for the SFC games database.
Next, I have to rewrite my TSV->BML cheat code tool.
Next, I need to post a final WIP of higan+icarus publicly and wait a few
days.
Next, I need to fix any bugs reported from the final WIP that I can.
Finally, I should be able to release v095.
2015-08-18 10:18:00 +00:00
|
|
|
cheatList.item(slot).cell(0).setChecked(false);
|
2015-06-18 10:48:53 +00:00
|
|
|
cheatList.item(slot).cell(1).setText("");
|
|
|
|
cheatList.item(slot).cell(2).setText("(empty)").setForegroundColor({128, 128, 128});
|
2015-04-21 11:51:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cheatList.resizeColumns();
|
|
|
|
}
|
|
|
|
|
2015-04-21 11:58:59 +00:00
|
|
|
auto CheatEditor::doReset(bool force) -> void {
|
Update to v094r23 release.
byuu says:
The library window is gone, and replaced with
hiro::BrowserWindow::openFolder(). This gives navigation capabilities to
game loading, and it also completes our slotted cart selection code. As
an added bonus, it's less code this way, too.
I also set the window size to consistent sizes between all emulated
systems, so that switching between SFC and GB don't cause the window
size to keep changing, and so that the scaling size is consistent (eg at
normal scale, GB @ 3x is closer to SNES @ 2x.) This means black borders
in GB/GBA mode, but it doesn't look that bad, and it's not like many
people ever use these modes anyway.
Finally, added the placeholder tabs for video, audio and timing. I don't
intend to add the timing calculator code to v095 (it might be better as
a separate tool), but I'll add the ability to set video/audio rates, at
least.
Glitch 1: despite selecting the first item in the BrowserDialog list, if
you press enter when the window appears, it doesn't activate the item
until you press an arrow key first.
Glitch 2: in Game Boy mode, if you set the 4x window size, it's not
honoring the full requested height because the viewport is smaller than
the window. 8+ years of trying to get GTK+ and Qt to simply set the god
damned window size I ask for, and I still can't get them to do it
reliably.
Remaining issues:
- finish configuration panels (video, audio, timing)
- fix ruby driver compilation on Windows
- add DIP switch selection window (NSS) [I may end up punting this one
to v096]
2015-05-30 11:39:09 +00:00
|
|
|
if(force || MessageDialog().setParent(*toolsManager).setText("Permanently erase all slots?").question() == "Yes") {
|
2015-04-21 11:51:57 +00:00
|
|
|
for(auto& cheat : cheats) {
|
2015-04-21 11:58:59 +00:00
|
|
|
cheat.enabled = false;
|
2015-04-21 11:51:57 +00:00
|
|
|
cheat.code = "";
|
|
|
|
cheat.description = "";
|
|
|
|
}
|
Update to v094r40 release.
byuu says:
Changelog:
- updated to newest hiro API
- SFC performance profile builds once again
- hiro: Qt port completed
Errata 1: the hiro/Qt target won't run tomoko just yet. Starts by
crashing inside InputSettings because hiro/Qt isn't forcefully selecting
the first item added to a ComboButton just yet. Even with a monkey patch
to get around that, the UI is incredibly unstable. Lots of geometry
calculation bugs, and a crash when you try and access certain folders in
the browser dialog. Lots of work left to be done there, sadly.
Errata 2: the hiro/Windows port has black backgrounds on all ListView
items. It's because I need to test for unassigned colors and grab the
default Windows brush colors in those cases.
Note: alternating row colors on multi-column ListView widgets is gone
now. Not a bug. May add it back later, but I'm not sure. It doesn't
interact nicely with per-cell background colors.
Things left to do:
First, I have to fix the Windows and Qt target bugs.
Next, I need to go through and revise the hiro API even more (nothing
too major.)
Next, I need to update icarus to use the new hiro API, and add support
for the SFC games database.
Next, I have to rewrite my TSV->BML cheat code tool.
Next, I need to post a final WIP of higan+icarus publicly and wait a few
days.
Next, I need to fix any bugs reported from the final WIP that I can.
Finally, I should be able to release v095.
2015-08-18 10:18:00 +00:00
|
|
|
for(auto& item : cheatList.items()) {
|
|
|
|
item.cell(0).setChecked(false);
|
|
|
|
}
|
2015-04-21 11:58:59 +00:00
|
|
|
doChangeSelected();
|
2015-04-21 11:51:57 +00:00
|
|
|
doRefresh();
|
|
|
|
synchronizeCodes();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto CheatEditor::doErase() -> void {
|
|
|
|
if(auto item = cheatList.selected()) {
|
2015-06-18 10:48:53 +00:00
|
|
|
auto& cheat = cheats[item.offset()];
|
2015-04-21 11:58:59 +00:00
|
|
|
cheat.enabled = false;
|
|
|
|
cheat.code = "";
|
|
|
|
cheat.description = "";
|
2015-04-21 11:51:57 +00:00
|
|
|
codeValue.setText("");
|
|
|
|
descriptionValue.setText("");
|
|
|
|
doRefresh();
|
|
|
|
synchronizeCodes();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto CheatEditor::synchronizeCodes() -> void {
|
|
|
|
if(!emulator) return;
|
|
|
|
|
|
|
|
lstring codes;
|
2015-04-21 11:58:59 +00:00
|
|
|
for(auto& cheat : cheats) {
|
|
|
|
if(!cheat.enabled || !cheat.code) continue;
|
|
|
|
codes.append(cheat.code);
|
2015-04-21 11:51:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
emulator->cheatSet(codes);
|
|
|
|
}
|
|
|
|
|
|
|
|
//returns true if code was added
|
|
|
|
//returns false if there are no more free slots for additional codes
|
2015-04-21 11:58:59 +00:00
|
|
|
auto CheatEditor::addCode(const string& code, const string& description, bool enabled) -> bool {
|
2015-04-21 11:51:57 +00:00
|
|
|
for(auto& cheat : cheats) {
|
|
|
|
if(cheat.code || cheat.description) continue;
|
2015-04-21 11:58:59 +00:00
|
|
|
cheat.enabled = enabled;
|
2015-04-21 11:51:57 +00:00
|
|
|
cheat.code = code;
|
|
|
|
cheat.description = description;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2015-04-21 11:58:59 +00:00
|
|
|
|
|
|
|
auto CheatEditor::loadCheats() -> void {
|
|
|
|
doReset(true);
|
|
|
|
auto contents = string::read({program->folderPaths[0], "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);
|
|
|
|
for(auto cheat : document["cartridge"].find("cheat")) {
|
|
|
|
if(!addCode(cheat["code"].text(), cheat["description"].text(), (bool)cheat["enabled"])) break;
|
2015-04-21 11:58:59 +00:00
|
|
|
}
|
|
|
|
doRefresh();
|
|
|
|
synchronizeCodes();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto CheatEditor::saveCheats() -> void {
|
|
|
|
if(!emulator) return;
|
|
|
|
string document = {"cartridge sha256:", emulator->sha256(), "\n"};
|
2015-12-21 09:16:47 +00:00
|
|
|
uint count = 0;
|
2015-04-21 11:58:59 +00:00
|
|
|
for(auto& cheat : cheats) {
|
|
|
|
if(!cheat.code && !cheat.description) continue;
|
|
|
|
document.append(" cheat", cheat.enabled ? " enabled" : "", "\n");
|
|
|
|
document.append(" description:", cheat.description, "\n");
|
|
|
|
document.append(" code:", cheat.code, "\n");
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
if(count) {
|
|
|
|
file::write({program->folderPaths[0], "cheats.bml"}, document);
|
|
|
|
} else {
|
|
|
|
file::remove({program->folderPaths[0], "cheats.bml"});
|
|
|
|
}
|
|
|
|
doReset(true);
|
|
|
|
}
|