Update to v094r43 release.

byuu says:

Updated to compile with all of the new hiro changes. My next step is to
write up hiro API documentation, and move the API from alpha (constantly
changing) to beta (rarely changing), in preparation for the first stable
release (backward-compatible changes only.)

Added "--fullscreen" command-line option. I like this over
a configuration file option. Lets you use the emulator in both modes
without having to modify the config file each time.

Also enhanced the command-line game loading. You can now use any of
these methods:

    higan /path/to/game-folder.sfc
    higan /path/to/game-folder.sfc/
    higan /path/to/game-folder.sfc/program.rom

The idea is to support launchers that insist on loading files only.

Technically, the file can be any name (manifest.bml also works); the
only criteria is that the file actually exists and is a file, and not
a directory. This is a requirement to support the first version (a
directory lacking the trailing / identifier), because I don't want my
nall::string class to query the file system to determine if the string
is an actual existing file or directory for its pathname() / dirname()
functions.

Anyway, every game folder I've made so far has program.rom, and that's
very unlikely to change, so this should be fine.

Now, of course, if you drop a regular "game.sfc" file on the emulator,
it won't even try to load it, unless it's in a folder that ends in .fc,
.sfc, etc. In which case, it'll bail out immediately by being unable to
produce a manifest for what is obviously not really a game folder.
This commit is contained in:
Tim Allen
2015-08-30 12:08:26 +10:00
parent c45633550e
commit 0c87bdabed
230 changed files with 1939 additions and 1408 deletions

View File

@@ -15,8 +15,8 @@ private:
VerticalLayout layout{&window};
HorizontalLayout pathLayout{&layout, Size{~0, 0}, 5};
LineEdit pathName{&pathLayout, Size{~0, 0}, 0};
Button pathHome{&pathLayout, Size{0, 0}, 0};
Button pathRefresh{&pathLayout, Size{0, 0}, 0};
Button pathHome{&pathLayout, Size{0, 0}, 0};
Button pathUp{&pathLayout, Size{0, 0}, 0};
ListView view{&layout, Size{~0, ~0}, 5};
HorizontalLayout controlLayout{&layout, Size{~0, 0}};
@@ -118,9 +118,9 @@ auto BrowserDialogWindow::run() -> lstring {
layout.setMargin(5);
pathName.onActivate([&] { setPath(pathName.text()); });
pathHome.setBordered(false).setIcon(Icon::Go::Home).onActivate([&] { setPath(userpath()); });
pathRefresh.setBordered(false).setIcon(Icon::Action::Refresh).onActivate([&] { setPath(state.path); });
pathUp.setBordered(false).setIcon(Icon::Go::Up).onActivate([&] { setPath(state.path.dirname()); });
pathRefresh.setBordered(false).setImage(Icon::Action::Refresh).onActivate([&] { setPath(state.path); });
pathHome.setBordered(false).setImage(Icon::Go::Home).onActivate([&] { setPath(userpath()); });
pathUp.setBordered(false).setImage(Icon::Go::Up).onActivate([&] { setPath(state.path.dirname()); });
view.setBatchable(state.action == "openFiles").onActivate([&] { activate(); }).onChange([&] { change(); });
filterList.setVisible(state.action != "selectFolder").onChange([&] { setPath(state.path); });
for(auto& filter : state.filters) {
@@ -175,7 +175,7 @@ auto BrowserDialogWindow::setPath(string path) -> void {
if(folderMode && isMatch(content)) continue;
view.append(ListViewItem()
.append(ListViewCell().setText(content).setIcon(Icon::Emblem::Folder))
.append(ListViewCell().setText(content).setImage(Icon::Emblem::Folder))
);
}
@@ -185,7 +185,7 @@ auto BrowserDialogWindow::setPath(string path) -> void {
if(!isMatch(content)) continue;
view.append(ListViewItem()
.append(ListViewCell().setText(content).setIcon(folderMode ? Icon::Action::Open : Icon::Emblem::File))
.append(ListViewCell().setText(content).setImage(folderMode ? Icon::Action::Open : Icon::Emblem::File))
);
}

View File

@@ -7,6 +7,14 @@ auto mFixedLayout::append(sSizable sizable, Geometry geometry) -> type& {
return *this;
}
auto mFixedLayout::modify(sSizable sizable, Geometry geometry) -> type& {
if(sizable && this->sizable(sizable->offset()) == sizable) {
auto& properties = this->properties[sizable->offset()];
properties.geometry = geometry;
}
return *this;
}
auto mFixedLayout::minimumSize() const -> Size {
signed width = Size::Minimum, height = Size::Minimum;
for(auto n : range(sizableCount())) {
@@ -36,7 +44,7 @@ auto mFixedLayout::setEnabled(bool enabled) -> type& {
return *this;
}
auto mFixedLayout::setFont(const string& font) -> type& {
auto mFixedLayout::setFont(const Font& font) -> type& {
mLayout::setFont(font);
for(auto n : range(sizableCount())) {
sizable(n)->setFont(sizable(n)->font());

View File

@@ -6,11 +6,12 @@ struct mFixedLayout : mLayout {
using mLayout::remove;
auto append(sSizable sizable, Geometry geometry) -> type&;
auto modify(sSizable sizable, Geometry geometry) -> type&;
auto minimumSize() const -> Size override;
auto remove(sSizable sizable) -> type& override;
auto reset() -> type& override;
auto setEnabled(bool enabled = true) -> type& override;
auto setFont(const string& font = "") -> type& override;
auto setFont(const Font& font = {}) -> type& override;
auto setVisible(bool visible = true) ->type& override;
struct Properties {

View File

@@ -6,6 +6,16 @@ auto mHorizontalLayout::append(sSizable sizable, Size size, signed spacing) -> t
return *this;
}
auto mHorizontalLayout::modify(sSizable sizable, Size size, signed spacing) -> type& {
if(sizable && this->sizable(sizable->offset()) == sizable) {
auto& properties = this->properties[sizable->offset()];
properties.width = size.width();
properties.height = size.height();
properties.spacing = spacing;
}
return *this;
}
auto mHorizontalLayout::minimumSize() const -> Size {
signed width = 0, height = 0;
@@ -56,7 +66,7 @@ auto mHorizontalLayout::setEnabled(bool enabled) -> type& {
return *this;
}
auto mHorizontalLayout::setFont(const string& font) -> type& {
auto mHorizontalLayout::setFont(const Font& font) -> type& {
mLayout::setFont(font);
for(auto n : range(sizableCount())) {
sizable(n)->setFont(sizable(n)->font());

View File

@@ -7,11 +7,12 @@ struct mHorizontalLayout : mLayout {
auto append(sSizable sizable, Size size, signed spacing = 5) -> type&;
auto minimumSize() const -> Size override;
auto modify(sSizable sizable, Size size, signed spacing = 5) -> type&;
auto remove(sSizable sizable) -> type& override;
auto reset() -> type& override;
auto setAlignment(double alignment = 0.5) -> type&;
auto setEnabled(bool enabled = true) -> type& override;
auto setFont(const string& font = "") -> type& override;
auto setFont(const Font& font = {}) -> type& override;
auto setGeometry(Geometry geometry) -> type& override;
auto setMargin(signed margin = 0) -> type&;
auto setSpacing(signed spacing = 5) -> type&;

View File

@@ -6,19 +6,19 @@ MessageDialog::MessageDialog(const string& text) {
auto MessageDialog::error(const lstring& buttons) -> string {
state.buttons = buttons;
state.icon = Icon::Prompt::Error;
state.image = Icon::Prompt::Error;
return _run();
}
auto MessageDialog::information(const lstring& buttons) -> string {
state.buttons = buttons;
state.icon = Icon::Prompt::Information;
state.image = Icon::Prompt::Information;
return _run();
}
auto MessageDialog::question(const lstring& buttons) -> string {
state.buttons = buttons;
state.icon = Icon::Prompt::Question;
state.image = Icon::Prompt::Question;
return _run();
}
@@ -39,7 +39,7 @@ auto MessageDialog::setTitle(const string& title) -> type& {
auto MessageDialog::warning(const lstring& buttons) -> string {
state.buttons = buttons;
state.icon = Icon::Prompt::Warning;
state.image = Icon::Prompt::Warning;
return _run();
}
@@ -53,7 +53,7 @@ auto MessageDialog::_run() -> string {
Widget controlSpacer{&controlLayout, Size{~0, 0}};
layout.setMargin(5);
messageIcon.setIcon(state.icon);
messageIcon.setImage(state.image);
messageText.setText(state.text);
for(auto n : range(state.buttons)) {
Button button{&controlLayout, Size{80, 0}, 5};
@@ -62,7 +62,7 @@ auto MessageDialog::_run() -> string {
button.setFocused(); //the last button will have effective focus
}
signed widthMessage = 5 + 16 + 5 + Font::size(Font::sans(), state.text).width() + 5;
signed widthMessage = 5 + 16 + 5 + Font().size(state.text).width() + 5;
signed widthButtons = 5 + state.buttons.size() * 85;
signed width = max(320, widthMessage, widthButtons);

View File

@@ -15,7 +15,7 @@ struct MessageDialog {
private:
struct State {
lstring buttons;
vector<uint8_t> icon;
vector<uint8_t> image;
sWindow parent;
string response;
string text;

View File

@@ -4,6 +4,7 @@ struct FixedLayout : sFixedLayout {
DeclareSharedLayout(FixedLayout)
auto append(sSizable sizable, Geometry geometry) { return self().append(sizable, geometry), *this; }
auto modify(sSizable sizable, Geometry geometry) { return self().modify(sizable, geometry), *this; }
};
#endif
@@ -13,6 +14,7 @@ struct HorizontalLayout : sHorizontalLayout {
DeclareSharedLayout(HorizontalLayout)
auto append(sSizable sizable, Size size, signed spacing = 5) { return self().append(sizable, size, spacing), *this; }
auto modify(sSizable sizable, Size size, signed spacing = 5) { return self().modify(sizable, size, spacing), *this; }
auto setAlignment(double alignment = 0.5) { return self().setAlignment(alignment), *this; }
auto setMargin(signed margin = 0) { return self().setMargin(margin), *this; }
auto setSpacing(signed spacing = 5) { return self().setSpacing(spacing), *this; }
@@ -25,6 +27,7 @@ struct VerticalLayout : sVerticalLayout {
DeclareSharedLayout(VerticalLayout)
auto append(sSizable sizable, Size size, signed spacing = 5) { return self().append(sizable, size, spacing), *this; }
auto modify(sSizable sizable, Size size, signed spacing = 5) { return self().modify(sizable, size, spacing), *this; }
auto setAlignment(double alignment = 0.0) { return self().setAlignment(alignment), *this; }
auto setMargin(signed margin = 0) { return self().setMargin(margin), *this; }
auto setSpacing(signed spacing = 5) { return self().setSpacing(spacing), *this; }

View File

@@ -6,6 +6,16 @@ auto mVerticalLayout::append(sSizable sizable, Size size, signed spacing) -> typ
return *this;
}
auto mVerticalLayout::modify(sSizable sizable, Size size, signed spacing) -> type& {
if(sizable && this->sizable(sizable->offset()) == sizable) {
auto& properties = this->properties[sizable->offset()];
properties.width = size.width();
properties.height = size.height();
properties.spacing = spacing;
}
return *this;
}
auto mVerticalLayout::minimumSize() const -> Size {
signed width = 0, height = 0;
@@ -56,7 +66,7 @@ auto mVerticalLayout::setEnabled(bool enabled) -> type& {
return *this;
}
auto mVerticalLayout::setFont(const string& font) -> type& {
auto mVerticalLayout::setFont(const Font& font) -> type& {
mLayout::setFont(font);
for(auto n : range(sizableCount())) {
sizable(n)->setFont(sizable(n)->font());

View File

@@ -6,12 +6,13 @@ struct mVerticalLayout : mLayout {
using mLayout::remove;
auto append(sSizable sizable, Size size, signed spacing = 5) -> type&;
auto modify(sSizable sizable, Size size, signed spacing = 5) -> type&;
auto minimumSize() const -> Size override;
auto remove(sSizable sizable) -> type& override;
auto reset() -> type& override;
auto setAlignment(double alignment = 0.0) -> type&;
auto setEnabled(bool enabled = true) -> type& override;
auto setFont(const string& font = "") -> type& override;
auto setFont(const Font& font = {}) -> type& override;
auto setGeometry(Geometry geometry) -> type& override;
auto setMargin(signed margin = 0) -> type&;
auto setSpacing(signed spacing = 5) -> type&;