Skip to content

Commit

Permalink
Misc updates and fixes
Browse files Browse the repository at this point in the history
* Imagine: Allow specializing IG::isValidProperty() for validating a Property
* Imagine: Overload Property assignment operator for underlying type to avoid clobbering default value when it's mutable
* Imagine: Update bundled libc++ to 18.1.0
* GBA.emu: Update core to VBA-M GIT 215e3c5, only code cleanup and no changes to emulation code
* GBA.emu: Add support for using a BIOS ROM
* GBA.emu: Remove unneeded memgzio.c
* Saturn.emu: Fix m3u loading outside of archives and current working directory
  • Loading branch information
Robert Broglia committed Mar 7, 2024
1 parent 4ca6105 commit 79f9a83
Show file tree
Hide file tree
Showing 30 changed files with 422 additions and 998 deletions.
25 changes: 10 additions & 15 deletions EmuFramework/include/emuframework/EmuApp.hh
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ struct MainWindowData;
class EmuMainMenuView;
class EmuViewController;

enum class Tristate : uint8_t
{
OFF, IN_EMU, ON
};

WISE_ENUM_CLASS((AssetFileID, size_t),
ui,
gamepadOverlay,
Expand Down Expand Up @@ -251,7 +246,7 @@ public:
VController &defaultVController() { return inputManager.vController; }
static std::unique_ptr<View> makeView(ViewAttachParams, ViewID);
std::unique_ptr<YesNoAlertView> makeCloseContentView();
void applyOSNavStyle(IG::ApplicationContext, bool inGame);
void applyOSNavStyle(IG::ApplicationContext, bool inEmu);
void setCPUNeedsLowLatency(IG::ApplicationContext, bool needed);
bool advanceFrames(FrameParams, EmuSystemTask *);
void runFrames(EmuSystemTaskContext, EmuVideo *, EmuAudio *, int frames);
Expand Down Expand Up @@ -330,9 +325,9 @@ public:
void applyFontSize(Window &win);
IG::FontSettings fontSettings(Window &win) const;
void setShowsTitleBar(bool on);
void setLowProfileOSNavMode(Tristate mode);
void setHideOSNavMode(Tristate mode);
void setHideStatusBarMode(Tristate mode);
void setLowProfileOSNavMode(InEmuTristate mode);
void setHideOSNavMode(InEmuTristate mode);
void setHideStatusBarMode(InEmuTristate mode);
void setEmuOrientation(Orientations);
void setMenuOrientation(Orientations);
void setShowsBundledGames(bool);
Expand Down Expand Up @@ -534,12 +529,12 @@ public:
PropertyDesc<bool>{.defaultValue = true, .mutableDefault = true}> showsNotificationIcon;
ConditionalProperty<CAN_HIDE_TITLE_BAR, bool, CFGKEY_TITLE_BAR,
PropertyDesc<bool>{.defaultValue = true}> showsTitleBar;
ConditionalProperty<Config::NAVIGATION_BAR, Tristate, CFGKEY_LOW_PROFILE_OS_NAV,
PropertyDesc<Tristate>{.defaultValue = Tristate::IN_EMU}> lowProfileOSNav;
ConditionalProperty<Config::NAVIGATION_BAR, Tristate, CFGKEY_HIDE_OS_NAV,
PropertyDesc<Tristate>{.defaultValue = Tristate::OFF, .mutableDefault = true}> hidesOSNav;
ConditionalProperty<Config::STATUS_BAR, Tristate, CFGKEY_HIDE_STATUS_BAR,
PropertyDesc<Tristate>{.defaultValue = Tristate::IN_EMU}> hidesStatusBar;
ConditionalProperty<Config::NAVIGATION_BAR, InEmuTristate, CFGKEY_LOW_PROFILE_OS_NAV,
PropertyDesc<InEmuTristate>{.defaultValue = InEmuTristate::InEmu}> lowProfileOSNav;
ConditionalProperty<Config::NAVIGATION_BAR, InEmuTristate, CFGKEY_HIDE_OS_NAV,
PropertyDesc<InEmuTristate>{.defaultValue = InEmuTristate::Off, .mutableDefault = true}> hidesOSNav;
ConditionalProperty<Config::STATUS_BAR, InEmuTristate, CFGKEY_HIDE_STATUS_BAR,
PropertyDesc<InEmuTristate>{.defaultValue = InEmuTristate::InEmu}> hidesStatusBar;
Property<Orientations, CFGKEY_GAME_ORIENTATION> emuOrientation;
Property<Orientations, CFGKEY_MENU_ORIENTATION> menuOrientation;
Property<bool, CFGKEY_SHOW_BUNDLED_GAMES, PropertyDesc<bool>{.defaultValue = true}> showsBundledGames;
Expand Down
27 changes: 21 additions & 6 deletions EmuFramework/include/emuframework/EmuOptions.hh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ enum { CFGKEY_SOUND = 0, CFGKEY_TOUCH_CONTROL_DISPLAY = 1,
// 256+ is reserved
};

enum class AutoTristate : uint8_t
{
Auto, Off, On
};

enum class InEmuTristate : uint8_t
{
Off, InEmu, On
};

constexpr unsigned optionImageZoomIntegerOnly = 255, optionImageZoomIntegerOnlyY = 254;

constexpr const char *optionSavePathDefaultToken = ":DEFAULT:";
Expand All @@ -104,12 +114,6 @@ constexpr bool isValidFontSize(const auto &v)
return v >= 2000 && v <= 10000;
}

template<class T>
constexpr bool enumIsValidUpToLast(const T &v)
{
return v <= IG::lastEnum<T>;
}

constexpr bool optionImageZoomIsValid(const auto &v)
{
return v == optionImageZoomIntegerOnly || v == optionImageZoomIntegerOnlyY
Expand Down Expand Up @@ -152,3 +156,14 @@ constexpr bool isValidWithMinMax(const auto &v)
}

}

namespace IG
{

template<>
constexpr bool isValidProperty(const EmuEx::AutoTristate &v) { return unsigned(v) <= 2; }

template<>
constexpr bool isValidProperty(const EmuEx::InEmuTristate &v) { return unsigned(v) <= 2; }

}
10 changes: 5 additions & 5 deletions EmuFramework/src/EmuApp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,14 @@ void EmuApp::closeSystemWithoutSave()
closeSystem();
}

void EmuApp::applyOSNavStyle(IG::ApplicationContext ctx, bool inGame)
void EmuApp::applyOSNavStyle(IG::ApplicationContext ctx, bool inEmu)
{
SystemUIStyleFlags flags;
if(lowProfileOSNav > (inGame ? Tristate::OFF : Tristate::IN_EMU))
if(lowProfileOSNav > (inEmu ? InEmuTristate::Off : InEmuTristate::InEmu))
flags.dimNavigation = true;
if(hidesOSNav > (inGame ? Tristate::OFF : Tristate::IN_EMU))
if(hidesOSNav > (inEmu ? InEmuTristate::Off : InEmuTristate::InEmu))
flags.hideNavigation = true;
if(hidesStatusBar > (inGame ? Tristate::OFF : Tristate::IN_EMU))
if(hidesStatusBar > (inEmu ? InEmuTristate::Off : InEmuTristate::InEmu))
flags.hideStatus = true;
ctx.setSysUIStyle(flags);
}
Expand Down Expand Up @@ -460,7 +460,7 @@ void EmuApp::mainInitCommon(IG::ApplicationInitParams initParams, IG::Applicatio
if(renderer.makeValidTextureBufferMode(mode) != mode)
{
// reset to default if saved non-default mode isn't supported
textureBufferMode = {};
textureBufferMode.reset();
}
}
viewManager.defaultFace = {renderer, fontManager.makeSystem(), fontSettings(win)};
Expand Down
8 changes: 4 additions & 4 deletions EmuFramework/src/EmuOptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void EmuApp::initOptions(IG::ApplicationContext ctx)
auto androidSdk = ctx.androidSDK();
if(!ctx.hasHardwareNavButtons() && androidSdk >= 19)
{
hidesOSNav.resetDefault(Tristate::IN_EMU);
hidesOSNav.resetDefault(InEmuTristate::InEmu);
}
if(androidSdk >= 11)
{
Expand Down Expand Up @@ -172,19 +172,19 @@ void EmuApp::setIdleDisplayPowerSave(bool on)
appContext().setIdleDisplayPowerSave(on);
}

void EmuApp::setLowProfileOSNavMode(Tristate mode)
void EmuApp::setLowProfileOSNavMode(InEmuTristate mode)
{
lowProfileOSNav = mode;
applyOSNavStyle(appContext(), false);
}

void EmuApp::setHideOSNavMode(Tristate mode)
void EmuApp::setHideOSNavMode(InEmuTristate mode)
{
hidesOSNav = mode;
applyOSNavStyle(appContext(), false);
}

void EmuApp::setHideStatusBarMode(Tristate mode)
void EmuApp::setHideStatusBarMode(InEmuTristate mode)
{
hidesStatusBar = mode;
applyOSNavStyle(appContext(), false);
Expand Down
30 changes: 15 additions & 15 deletions EmuFramework/src/gui/GUIOptionView.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,50 +100,50 @@ GUIOptionView::GUIOptionView(ViewAttachParams attach, bool customMenu):
},
statusBarItem
{
{"Off", attach, MenuItem::Config{.id = Tristate::OFF}},
{"In Emu", attach, MenuItem::Config{.id = Tristate::IN_EMU}},
{"On", attach, MenuItem::Config{.id = Tristate::ON}}
{"Off", attach, MenuItem::Config{.id = InEmuTristate::Off}},
{"In Emu", attach, MenuItem::Config{.id = InEmuTristate::InEmu}},
{"On", attach, MenuItem::Config{.id = InEmuTristate::On}}
},
statusBar
{
"Hide Status Bar", attach,
MenuId(Tristate(app().hidesStatusBar.value())),
MenuId(InEmuTristate(app().hidesStatusBar.value())),
statusBarItem,
MultiChoiceMenuItem::Config
{
.defaultItemOnSelect = [this](TextMenuItem &item) { app().setHideStatusBarMode(Tristate(item.id.val)); }
.defaultItemOnSelect = [this](TextMenuItem &item) { app().setHideStatusBarMode(InEmuTristate(item.id.val)); }
},
},
lowProfileOSNavItem
{
{"Off", attach, MenuItem::Config{.id = Tristate::OFF}},
{"In Emu", attach, MenuItem::Config{.id = Tristate::IN_EMU}},
{"On", attach, MenuItem::Config{.id = Tristate::ON}}
{"Off", attach, MenuItem::Config{.id = InEmuTristate::Off}},
{"In Emu", attach, MenuItem::Config{.id = InEmuTristate::InEmu}},
{"On", attach, MenuItem::Config{.id = InEmuTristate::On}}
},
lowProfileOSNav
{
"Dim OS UI", attach,
MenuId(Tristate(app().lowProfileOSNav.value())),
MenuId(InEmuTristate(app().lowProfileOSNav.value())),
lowProfileOSNavItem,
MultiChoiceMenuItem::Config
{
.defaultItemOnSelect = [this](TextMenuItem &item) { app().setLowProfileOSNavMode(Tristate(item.id.val)); }
.defaultItemOnSelect = [this](TextMenuItem &item) { app().setLowProfileOSNavMode(InEmuTristate(item.id.val)); }
},
},
hideOSNavItem
{
{"Off", attach, MenuItem::Config{.id = Tristate::OFF}},
{"In Emu", attach, MenuItem::Config{.id = Tristate::IN_EMU}},
{"On", attach, MenuItem::Config{.id = Tristate::ON}}
{"Off", attach, MenuItem::Config{.id = InEmuTristate::Off}},
{"In Emu", attach, MenuItem::Config{.id = InEmuTristate::InEmu}},
{"On", attach, MenuItem::Config{.id = InEmuTristate::On}}
},
hideOSNav
{
"Hide OS Navigation", attach,
MenuId(Tristate(app().hidesOSNav.value())),
MenuId(InEmuTristate(app().hidesOSNav.value())),
hideOSNavItem,
MultiChoiceMenuItem::Config
{
.defaultItemOnSelect = [this](TextMenuItem &item) { app().setHideOSNavMode(Tristate(item.id.val)); }
.defaultItemOnSelect = [this](TextMenuItem &item) { app().setHideOSNavMode(InEmuTristate(item.id.val)); }
},
},
idleDisplayPowerSave
Expand Down
1 change: 0 additions & 1 deletion GBA.emu/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ gba/gbafilter.cpp \
gba/RTC.cpp \
gba/Sound.cpp \
gba/Sram.cpp \
common/memgzio.c \
common/Patch.cpp \
Util.cpp
#gba/remote.cpp gba/GBASockClient.cpp gba/GBALink.cpp gba/agbprint.cpp
Expand Down
Loading

0 comments on commit 79f9a83

Please sign in to comment.