mirror of https://github.com/bsnes-emu/bsnes.git
Update to v106r15 release.
byuu says: Changelog: - main menu renamed again (Library→System→Systems) - the 'Hidden' checkbox on system properties was moved to the main list as a 'Show' checkbox instead - the move up/move down buttons on the systems panel now function - added icons to indicate 'system' versus 'game boot' entries in the systems list I still didn't add ComboEdit to the Windows hiro port, so once again this will be Linux/BSD only. I polished the browse button for selecting a boot game. It'll use a list of all bootable media file extensions, so that if you double-click any supported game, it'll select it instead of going inside the folder. If you pick a non-bootable folder, like say a Sufami Turbo cartridge, it will go inside the folder instead, because it will treat it like any other regular folder. Having a checkbox next to text in the same cell doesn't work so well on lists that have an onActivate action. Say you tried to double-click the “Name” field on the Systems tab, it would toggle the checkbox twice before popping open the system properties editor window. So because of this, I made the show checkbox its own column. And for consistency, I did the same for the slot# on the cheat editor window. As a bit of really pedantic polish: if there are no systems enabled, then the main menu won't show the separator before the “Load ROM Image” option anymore. I think something is wrong with the Markup::Node::insert syntax, but I realized I have Markup::Node::swap, and just used that for the up/down arrows on the systems panel for now. But we should probably fix insert() at some point ... sigh.
This commit is contained in:
parent
0ea17abfea
commit
8023d9cbe8
|
@ -12,7 +12,7 @@ using namespace nall;
|
||||||
|
|
||||||
namespace Emulator {
|
namespace Emulator {
|
||||||
static const string Name = "higan";
|
static const string Name = "higan";
|
||||||
static const string Version = "106.15";
|
static const string Version = "106.16";
|
||||||
static const string Author = "byuu";
|
static const string Author = "byuu";
|
||||||
static const string License = "GPLv3";
|
static const string License = "GPLv3";
|
||||||
static const string Website = "https://byuu.org/";
|
static const string Website = "https://byuu.org/";
|
||||||
|
|
|
@ -6,7 +6,7 @@ unique_pointer<Presentation> presentation;
|
||||||
Presentation::Presentation() {
|
Presentation::Presentation() {
|
||||||
presentation = this;
|
presentation = this;
|
||||||
|
|
||||||
libraryMenu.setText("System");
|
libraryMenu.setText("Systems");
|
||||||
|
|
||||||
systemMenu.setVisible(false);
|
systemMenu.setVisible(false);
|
||||||
resetSystem.setText("Soft Reset").onActivate([&] { program->softReset(); });
|
resetSystem.setText("Soft Reset").onActivate([&] { program->softReset(); });
|
||||||
|
@ -306,7 +306,7 @@ auto Presentation::toggleFullScreen() -> void {
|
||||||
auto Presentation::loadSystems() -> void {
|
auto Presentation::loadSystems() -> void {
|
||||||
libraryMenu.reset();
|
libraryMenu.reset();
|
||||||
for(auto system : settings.find("Systems/System")) {
|
for(auto system : settings.find("Systems/System")) {
|
||||||
if(system["Hidden"].boolean()) continue;
|
if(!system["Show"].boolean()) continue;
|
||||||
MenuItem item;
|
MenuItem item;
|
||||||
string boot = system["Boot"].text();
|
string boot = system["Boot"].text();
|
||||||
item.setText({system["Name"].text(), " ..."}).onActivate([=] {
|
item.setText({system["Name"].text(), " ..."}).onActivate([=] {
|
||||||
|
@ -328,7 +328,7 @@ auto Presentation::loadSystems() -> void {
|
||||||
|
|
||||||
//add icarus menu option -- but only if icarus binary is present
|
//add icarus menu option -- but only if icarus binary is present
|
||||||
if(execute("icarus", "--name").output.strip() == "icarus") {
|
if(execute("icarus", "--name").output.strip() == "icarus") {
|
||||||
libraryMenu.append(MenuSeparator());
|
if(libraryMenu.actionCount()) libraryMenu.append(MenuSeparator());
|
||||||
libraryMenu.append(MenuItem().setText("Load ROM File ...").onActivate([&] {
|
libraryMenu.append(MenuItem().setText("Load ROM File ...").onActivate([&] {
|
||||||
audio->clear();
|
audio->clear();
|
||||||
if(auto location = execute("icarus", "--import")) {
|
if(auto location = execute("icarus", "--import")) {
|
||||||
|
|
|
@ -12,8 +12,7 @@ struct SystemProperties : Window {
|
||||||
ComboEdit bootEdit{&bootLayout, Size{~0, 0}};
|
ComboEdit bootEdit{&bootLayout, Size{~0, 0}};
|
||||||
Button bootBrowse{&bootLayout, Size{80, 0}};
|
Button bootBrowse{&bootLayout, Size{80, 0}};
|
||||||
HorizontalLayout controlLayout{&layout, Size{~0, 0}};
|
HorizontalLayout controlLayout{&layout, Size{~0, 0}};
|
||||||
Widget spacer{&controlLayout, Size{40, 0}};
|
Widget spacer{&controlLayout, Size{~0, 0}};
|
||||||
CheckLabel hiddenOption{&controlLayout, Size{~0, 0}};
|
|
||||||
Button acceptButton{&controlLayout, Size{80, 0}};
|
Button acceptButton{&controlLayout, Size{80, 0}};
|
||||||
Button cancelButton{&controlLayout, Size{80, 0}};
|
Button cancelButton{&controlLayout, Size{80, 0}};
|
||||||
};
|
};
|
||||||
|
@ -21,7 +20,12 @@ struct SystemProperties : Window {
|
||||||
struct SystemSettings : TabFrameItem {
|
struct SystemSettings : TabFrameItem {
|
||||||
SystemSettings(TabFrame*);
|
SystemSettings(TabFrame*);
|
||||||
auto reload() -> void;
|
auto reload() -> void;
|
||||||
auto acceptProperties() -> void;
|
auto toggle(TableViewCell) -> void;
|
||||||
|
auto moveUp() -> void;
|
||||||
|
auto moveDown() -> void;
|
||||||
|
auto modify() -> void;
|
||||||
|
auto remove() -> void;
|
||||||
|
auto accept() -> void;
|
||||||
|
|
||||||
VerticalLayout layout{this};
|
VerticalLayout layout{this};
|
||||||
TableView systemList{&layout, Size{~0, ~0}};
|
TableView systemList{&layout, Size{~0, ~0}};
|
||||||
|
|
|
@ -9,14 +9,24 @@ SystemProperties::SystemProperties() {
|
||||||
bootEdit.append(ComboEditItem().setText(emulator->information.name));
|
bootEdit.append(ComboEditItem().setText(emulator->information.name));
|
||||||
}
|
}
|
||||||
bootBrowse.setText("Browse ...").onActivate([&] {
|
bootBrowse.setText("Browse ...").onActivate([&] {
|
||||||
if(auto location = BrowserDialog().setTitle("Select Boot Game").setPath(settings["Library/Location"].text()).selectFolder()) {
|
string filters = "Games|";
|
||||||
|
for(auto& emulator : program->emulators) {
|
||||||
|
for(auto& media : emulator->media) {
|
||||||
|
filters.append("*.", media.type, ":");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filters.trimRight(":", 1L);
|
||||||
|
if(auto location = BrowserDialog()
|
||||||
|
.setTitle("Select Boot Game")
|
||||||
|
.setPath(settings["Library/Location"].text())
|
||||||
|
.setFilters(filters)
|
||||||
|
.openFolder()) {
|
||||||
bootEdit.setText(location);
|
bootEdit.setText(location);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
hiddenOption.setText("Hidden");
|
|
||||||
acceptButton.onActivate([&] {
|
acceptButton.onActivate([&] {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
settingsManager->systems.acceptProperties();
|
settingsManager->systems.accept();
|
||||||
});
|
});
|
||||||
cancelButton.setText("Cancel").onActivate([&] {
|
cancelButton.setText("Cancel").onActivate([&] {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
|
@ -31,7 +41,6 @@ auto SystemProperties::append() -> void {
|
||||||
setCentered(*settingsManager);
|
setCentered(*settingsManager);
|
||||||
nameEdit.setText("");
|
nameEdit.setText("");
|
||||||
bootEdit.setText("");
|
bootEdit.setText("");
|
||||||
hiddenOption.setChecked(false);
|
|
||||||
acceptButton.setText("Append");
|
acceptButton.setText("Append");
|
||||||
setFocused();
|
setFocused();
|
||||||
setVisible();
|
setVisible();
|
||||||
|
@ -42,7 +51,6 @@ auto SystemProperties::modify(Markup::Node system) -> void {
|
||||||
setCentered(*settingsManager);
|
setCentered(*settingsManager);
|
||||||
nameEdit.setText(system["Name"].text());
|
nameEdit.setText(system["Name"].text());
|
||||||
bootEdit.setText(system["Boot"].text());
|
bootEdit.setText(system["Boot"].text());
|
||||||
hiddenOption.setChecked(system["Hidden"].boolean());
|
|
||||||
acceptButton.setText("Modify");
|
acceptButton.setText("Modify");
|
||||||
setFocused();
|
setFocused();
|
||||||
setVisible();
|
setVisible();
|
||||||
|
|
|
@ -9,41 +9,23 @@ SystemSettings::SystemSettings(TabFrame* parent) : TabFrameItem(parent) {
|
||||||
});
|
});
|
||||||
|
|
||||||
systemList.onChange([&] {
|
systemList.onChange([&] {
|
||||||
auto selected = (bool)systemList.selected();
|
auto selected = systemList.selected();
|
||||||
upButton.setEnabled(selected);
|
upButton.setEnabled((bool)selected && selected.offset() != 0);
|
||||||
downButton.setEnabled(selected);
|
downButton.setEnabled((bool)selected && selected.offset() != systemList.itemCount() - 1);
|
||||||
modifyButton.setEnabled(selected);
|
modifyButton.setEnabled((bool)selected);
|
||||||
removeButton.setEnabled(selected);
|
removeButton.setEnabled((bool)selected);
|
||||||
});
|
});
|
||||||
|
|
||||||
upButton.setIcon(Icon::Go::Up);
|
systemList.onToggle([&](TableViewCell cell) {
|
||||||
downButton.setIcon(Icon::Go::Down);
|
toggle(cell);
|
||||||
|
|
||||||
appendButton.setText("Append").onActivate([&] {
|
|
||||||
systemProperties->append();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modifyButton.setText("Modify").onActivate([&] {
|
upButton.setIcon(Icon::Go::Up).onActivate([&] { moveUp(); });
|
||||||
if(auto item = systemList.selected()) {
|
downButton.setIcon(Icon::Go::Down).onActivate([&] { moveDown(); });
|
||||||
if(auto system = settings.find("Systems/System")[item.offset()]) {
|
|
||||||
systemProperties->modify(system);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
removeButton.setText("Remove").onActivate([&] {
|
appendButton.setText("Append").onActivate([&] { systemProperties->append(); });
|
||||||
if(auto item = systemList.selected()) {
|
modifyButton.setText("Modify").onActivate([&] { modify(); });
|
||||||
if(auto system = settings.find("Systems/System")[item.offset()]) {
|
removeButton.setText("Remove").onActivate([&] { remove(); });
|
||||||
if(MessageDialog().setParent(*settingsManager).setText({
|
|
||||||
"Are you sure you want to delete this system?\n\n"
|
|
||||||
"Name: ", system["Name"].text()
|
|
||||||
}).question() == "Yes") {
|
|
||||||
settings["Systems"].remove(system);
|
|
||||||
reload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
@ -51,33 +33,88 @@ SystemSettings::SystemSettings(TabFrame* parent) : TabFrameItem(parent) {
|
||||||
auto SystemSettings::reload() -> void {
|
auto SystemSettings::reload() -> void {
|
||||||
systemList.reset();
|
systemList.reset();
|
||||||
systemList.append(TableViewHeader().setVisible()
|
systemList.append(TableViewHeader().setVisible()
|
||||||
|
.append(TableViewColumn())
|
||||||
.append(TableViewColumn().setText("Name"))
|
.append(TableViewColumn().setText("Name"))
|
||||||
.append(TableViewColumn().setText("Boot").setExpandable())
|
.append(TableViewColumn().setText("Boot").setExpandable())
|
||||||
);
|
);
|
||||||
for(auto system : settings.find("Systems/System")) {
|
for(auto system : settings.find("Systems/System")) {
|
||||||
|
string boot = Location::base(system["Boot"].text());
|
||||||
systemList.append(TableViewItem()
|
systemList.append(TableViewItem()
|
||||||
|
.append(TableViewCell().setCheckable().setChecked(system["Show"].boolean()))
|
||||||
.append(TableViewCell().setText(system["Name"].text()))
|
.append(TableViewCell().setText(system["Name"].text()))
|
||||||
.append(TableViewCell().setText(Location::base(system["Boot"].text()).trimRight("/", 1L)))
|
.append(TableViewCell()
|
||||||
.setForegroundColor(system["Hidden"].boolean() ? Color{160, 160, 160} : Color{})
|
.setIcon(boot.endsWith("/") ? Icon::Emblem::Folder : Icon::Device::Storage)
|
||||||
|
.setText(string{boot}.trimRight("/", 1L))
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
systemList.resizeColumns().doChange();
|
systemList.resizeColumns().doChange();
|
||||||
presentation->loadSystems();
|
presentation->loadSystems();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto SystemSettings::acceptProperties() -> void {
|
auto SystemSettings::toggle(TableViewCell cell) -> void {
|
||||||
|
if(auto item = cell->parentTableViewItem()) {
|
||||||
|
if(auto system = settings.find("Systems/System")[item->offset()]) {
|
||||||
|
system("Show").setValue(item->cell(0).checked());
|
||||||
|
presentation->loadSystems();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto SystemSettings::moveUp() -> void {
|
||||||
|
if(auto item = systemList.selected()) {
|
||||||
|
auto offset = item.offset();
|
||||||
|
settings["Systems"].swap(offset, offset - 1);
|
||||||
|
reload();
|
||||||
|
systemList.item(offset - 1).setSelected();
|
||||||
|
systemList.doChange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto SystemSettings::moveDown() -> void {
|
||||||
|
if(auto item = systemList.selected()) {
|
||||||
|
auto offset = item.offset();
|
||||||
|
settings["Systems"].swap(offset, offset + 1);
|
||||||
|
reload();
|
||||||
|
systemList.item(offset + 1).setSelected();
|
||||||
|
systemList.doChange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto SystemSettings::modify() -> void {
|
||||||
|
if(auto item = systemList.selected()) {
|
||||||
|
if(auto system = settings.find("Systems/System")[item.offset()]) {
|
||||||
|
systemProperties->modify(system);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto SystemSettings::remove() -> void {
|
||||||
|
if(auto item = systemList.selected()) {
|
||||||
|
if(auto system = settings.find("Systems/System")[item.offset()]) {
|
||||||
|
if(MessageDialog().setParent(*settingsManager).setText({
|
||||||
|
"Are you sure you want to delete this system?\n\n"
|
||||||
|
"Name: ", system["Name"].text()
|
||||||
|
}).question() == "Yes") {
|
||||||
|
settings["Systems"].remove(system);
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto SystemSettings::accept() -> void {
|
||||||
if(systemProperties->acceptButton.text() == "Append") {
|
if(systemProperties->acceptButton.text() == "Append") {
|
||||||
Markup::Node system{"System"};
|
Markup::Node system{"System"};
|
||||||
system.append({"Name", systemProperties->nameEdit.text()});
|
system.append({"Name", systemProperties->nameEdit.text()});
|
||||||
system.append({"Boot", systemProperties->bootEdit.text()});
|
system.append({"Boot", systemProperties->bootEdit.text()});
|
||||||
system.append({"Hidden", systemProperties->hiddenOption.checked()});
|
system.append({"Show", "true"});
|
||||||
settings["Systems"].append(system);
|
settings["Systems"].append(system);
|
||||||
} else if(systemProperties->acceptButton.text() == "Modify") {
|
} else if(systemProperties->acceptButton.text() == "Modify") {
|
||||||
if(auto item = systemList.selected()) {
|
if(auto item = systemList.selected()) {
|
||||||
if(auto system = settings.find("Systems/System")[item.offset()]) {
|
if(auto system = settings.find("Systems/System")[item.offset()]) {
|
||||||
system("Name").setValue(systemProperties->nameEdit.text());
|
system("Name").setValue(systemProperties->nameEdit.text());
|
||||||
system("Boot").setValue(systemProperties->bootEdit.text());
|
system("Boot").setValue(systemProperties->bootEdit.text());
|
||||||
system("Hidden").setValue(systemProperties->hiddenOption.checked());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,15 @@ CheatEditor::CheatEditor(TabFrame* parent) : TabFrameItem(parent) {
|
||||||
|
|
||||||
layout.setMargin(5);
|
layout.setMargin(5);
|
||||||
cheatList.append(TableViewHeader().setVisible()
|
cheatList.append(TableViewHeader().setVisible()
|
||||||
|
.append(TableViewColumn())
|
||||||
.append(TableViewColumn().setText("Slot").setForegroundColor({0, 128, 0}).setAlignment(1.0))
|
.append(TableViewColumn().setText("Slot").setForegroundColor({0, 128, 0}).setAlignment(1.0))
|
||||||
.append(TableViewColumn().setText("Code(s)"))
|
.append(TableViewColumn().setText("Code(s)"))
|
||||||
.append(TableViewColumn().setText("Description").setExpandable())
|
.append(TableViewColumn().setText("Description").setExpandable())
|
||||||
);
|
);
|
||||||
for(auto slot : range(Slots)) {
|
for(auto slot : range(Slots)) {
|
||||||
cheatList.append(TableViewItem()
|
cheatList.append(TableViewItem()
|
||||||
.append(TableViewCell().setCheckable().setText(1 + slot))
|
.append(TableViewCell().setCheckable())
|
||||||
|
.append(TableViewCell().setText(1 + slot))
|
||||||
.append(TableViewCell())
|
.append(TableViewCell())
|
||||||
.append(TableViewCell())
|
.append(TableViewCell())
|
||||||
);
|
);
|
||||||
|
@ -62,12 +64,12 @@ auto CheatEditor::doRefresh() -> void {
|
||||||
auto codes = cheat.code.split("+");
|
auto codes = cheat.code.split("+");
|
||||||
if(codes.size() > 1) codes[0].append("+...");
|
if(codes.size() > 1) codes[0].append("+...");
|
||||||
cheatList.item(slot).cell(0).setChecked(cheat.enabled);
|
cheatList.item(slot).cell(0).setChecked(cheat.enabled);
|
||||||
cheatList.item(slot).cell(1).setText(codes[0]);
|
cheatList.item(slot).cell(2).setText(codes[0]);
|
||||||
cheatList.item(slot).cell(2).setText(cheat.description).setForegroundColor({0, 0, 0});
|
cheatList.item(slot).cell(3).setText(cheat.description).setForegroundColor({0, 0, 0});
|
||||||
} else {
|
} else {
|
||||||
cheatList.item(slot).cell(0).setChecked(false);
|
cheatList.item(slot).cell(0).setChecked(false);
|
||||||
cheatList.item(slot).cell(1).setText("");
|
cheatList.item(slot).cell(2).setText("");
|
||||||
cheatList.item(slot).cell(2).setText("(empty)").setForegroundColor({128, 128, 128});
|
cheatList.item(slot).cell(3).setText("(empty)").setForegroundColor({128, 128, 128});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ auto pTableView::_cellWidth(unsigned _row, unsigned _column) -> unsigned {
|
||||||
if(auto item = self().item(_row)) {
|
if(auto item = self().item(_row)) {
|
||||||
if(auto cell = item->cell(_column)) {
|
if(auto cell = item->cell(_column)) {
|
||||||
if(cell->state.checkable) {
|
if(cell->state.checkable) {
|
||||||
width += 24;
|
width += 16 + (cell->state.icon || cell->state.text ? 4 : 0);
|
||||||
}
|
}
|
||||||
if(auto& icon = cell->state.icon) {
|
if(auto& icon = cell->state.icon) {
|
||||||
width += icon.width() + 2;
|
width += icon.width() + 2;
|
||||||
|
|
Loading…
Reference in New Issue