bsnes/higan/target-bsnes/settings/settings.hpp

133 lines
5.2 KiB
C++
Raw Normal View History

struct Settings : Markup::Node {
Settings();
auto save() -> void;
};
struct InputSettings : TabFrameItem {
InputSettings(TabFrame*);
auto updateControls() -> void;
auto activePort() -> InputPort&;
auto activeDevice() -> InputDevice&;
auto reloadPorts() -> void;
auto reloadDevices() -> void;
auto reloadMappings() -> void;
auto refreshMappings() -> void;
auto assignMapping() -> void;
auto assignMouseInput(uint id) -> void;
auto inputEvent(shared_pointer<HID::Device> device, uint group, uint input, int16 oldValue, int16 newValue, bool allowMouseInput = false) -> void;
public:
maybe<InputMapping&> activeMapping;
Timer timer;
VerticalLayout layout{this};
HorizontalLayout defocusLayout{&layout, Size{~0, 0}};
Label defocusLabel{&defocusLayout, Size{0, 0}};
RadioLabel pauseEmulation{&defocusLayout, Size{0, 0}};
RadioLabel blockInput{&defocusLayout, Size{0, 0}};
RadioLabel allowInput{&defocusLayout, Size{0, 0}};
Group defocusGroup{&pauseEmulation, &blockInput, &allowInput};
HorizontalLayout selectionLayout{&layout, Size{~0, 0}};
Label portLabel{&selectionLayout, Size{0, 0}};
ComboButton portList{&selectionLayout, Size{~0, 0}};
Label deviceLabel{&selectionLayout, Size{0, 0}};
ComboButton deviceList{&selectionLayout, Size{~0, 0}};
TableView mappingList{&layout, Size{~0, ~0}};
HorizontalLayout controlLayout{&layout, Size{~0, 0}};
Button assignMouse1{&controlLayout, Size{100, 0}};
Button assignMouse2{&controlLayout, Size{100, 0}};
Button assignMouse3{&controlLayout, Size{100, 0}};
Widget controlSpacer{&controlLayout, Size{~0, 0}};
Button resetButton{&controlLayout, Size{80, 0}};
Button eraseButton{&controlLayout, Size{80, 0}};
};
struct HotkeySettings : TabFrameItem {
HotkeySettings(TabFrame*);
auto reloadMappings() -> void;
auto refreshMappings() -> void;
auto assignMapping() -> void;
auto inputEvent(shared_pointer<HID::Device> device, uint group, uint input, int16 oldValue, int16 newValue) -> void;
public:
maybe<InputMapping&> activeMapping;
Timer timer;
VerticalLayout layout{this};
TableView mappingList{&layout, Size{~0, ~0}};
HorizontalLayout controlLayout{&layout, Size{~0, 0}};
Widget controlSpacer{&controlLayout, Size{~0, 0}};
Button resetButton{&controlLayout, Size{80, 0}};
Button eraseButton{&controlLayout, Size{80, 0}};
};
struct PathSettings : TabFrameItem {
PathSettings(TabFrame*);
auto refreshPaths() -> void;
public:
VerticalLayout layout{this};
HorizontalLayout gamesLayout{&layout, Size{~0, 0}};
Label gamesLabel{&gamesLayout, Size{55, 0}};
LineEdit gamesPath{&gamesLayout, Size{~0, 0}};
Button gamesAssign{&gamesLayout, Size{80, 0}};
Button gamesReset{&gamesLayout, Size{80, 0}};
HorizontalLayout patchesLayout{&layout, Size{~0, 0}};
Label patchesLabel{&patchesLayout, Size{55, 0}};
LineEdit patchesPath{&patchesLayout, Size{~0, 0}};
Button patchesAssign{&patchesLayout, Size{80, 0}};
Button patchesReset{&patchesLayout, Size{80, 0}};
HorizontalLayout savesLayout{&layout, Size{~0, 0}};
Label savesLabel{&savesLayout, Size{55, 0}};
LineEdit savesPath{&savesLayout, Size{~0, 0}};
Button savesAssign{&savesLayout, Size{80, 0}};
Button savesReset{&savesLayout, Size{80, 0}};
HorizontalLayout statesLayout{&layout, Size{~0, 0}};
Label statesLabel{&statesLayout, Size{55, 0}};
LineEdit statesPath{&statesLayout, Size{~0, 0}};
Button statesAssign{&statesLayout, Size{80, 0}};
Button statesReset{&statesLayout, Size{80, 0}};
HorizontalLayout cheatsLayout{&layout, Size{~0, 0}};
Label cheatsLabel{&cheatsLayout, Size{55, 0}};
LineEdit cheatsPath{&cheatsLayout, Size{~0, 0}};
Button cheatsAssign{&cheatsLayout, Size{80, 0}};
Button cheatsReset{&cheatsLayout, Size{80, 0}};
};
Update to v106r27 release. byuu says: Changelog: - nall: merged Path::config() and Path::local() to Path::userData() - ~/.local/share or %appdata or ~/Library/ApplicationSupport - higan, bsnes: render main window icon onto viewport instead of canvas - should hopefully fix a brief flickering glitch that appears on Windows - icarus: improved Super Famicom heuristics for Starfox / Starwing RAM - ruby/Direct3D: handle viewport size changes in lock() instead of output() - fixes icon disappearing when resizing main window - hiro/Windows: remove WS_DISABLED from StatusBar to fix window resize grip - this is experimental: I initially used WS_DISABLED to work around a focus bug - yet trying things now, said bug seems(?) to have gone away at some point ... - bsnes: added advanced settings panel with real-time driver change support I'd like feedback on the real-time driver change, for possible consideration into adding this to higan as well. Some drivers just crash, it's a fact of life. The ASIO driver in particular likes to crash inside the driver itself, without any error messages ever returned to try and catch. When you try to change a driver with a game loaded, it gives you a scary warning, asking if you want to proceed. When you change a driver, it sets a crash flag, and if the driver crashes while initializing, then restarting bsnes will disable the errant driver. If it fails in a recoverable way, then it sets the driver to “None” and warns you that the driver cannot be used. What I'm thinking of further adding is to call emulator→save() to write out the save RAM contents beforehand (although the periodic auto-saving RAM will handle this anyway when it's enabled), and possibly it might be wise to capture an emulator save state, although those can't be taken without advancing the emulator to the next frame, so that might not be a good idea. I'm also thinking we should show some kind of message somewhere when a driver is set to “None”. The status bar can be hidden, so perhaps on the title bar? Or maybe just a warning on startup that a driver is set to “None”.
2018-05-25 08:02:38 +00:00
struct AdvancedSettings : TabFrameItem {
AdvancedSettings(TabFrame*);
public:
VerticalLayout layout{this};
HorizontalLayout videoDriverLayout{&layout, Size{~0, 0}};
Label videoDriverLabel{&videoDriverLayout, Size{75, 0}};
ComboButton videoDriverOption{&videoDriverLayout, Size{~0, 0}};
Button videoDriverChange{&videoDriverLayout, Size{80, 0}};
HorizontalLayout audioDriverLayout{&layout, Size{~0, 0}};
Label audioDriverLabel{&audioDriverLayout, Size{75, 0}};
ComboButton audioDriverOption{&audioDriverLayout, Size{~0, 0}};
Button audioDriverChange{&audioDriverLayout, Size{80, 0}};
HorizontalLayout inputDriverLayout{&layout, Size{~0, 0}};
Label inputDriverLabel{&inputDriverLayout, Size{75, 0}};
ComboButton inputDriverOption{&inputDriverLayout, Size{~0, 0}};
Button inputDriverChange{&inputDriverLayout, Size{80, 0}};
};
struct SettingsWindow : Window {
SettingsWindow();
auto setVisible(bool visible = true) -> SettingsWindow&;
auto show(uint index) -> void;
public:
VerticalLayout layout{this};
TabFrame panel{&layout, Size{~0, ~0}};
InputSettings input{&panel};
HotkeySettings hotkeys{&panel};
PathSettings paths{&panel};
Update to v106r27 release. byuu says: Changelog: - nall: merged Path::config() and Path::local() to Path::userData() - ~/.local/share or %appdata or ~/Library/ApplicationSupport - higan, bsnes: render main window icon onto viewport instead of canvas - should hopefully fix a brief flickering glitch that appears on Windows - icarus: improved Super Famicom heuristics for Starfox / Starwing RAM - ruby/Direct3D: handle viewport size changes in lock() instead of output() - fixes icon disappearing when resizing main window - hiro/Windows: remove WS_DISABLED from StatusBar to fix window resize grip - this is experimental: I initially used WS_DISABLED to work around a focus bug - yet trying things now, said bug seems(?) to have gone away at some point ... - bsnes: added advanced settings panel with real-time driver change support I'd like feedback on the real-time driver change, for possible consideration into adding this to higan as well. Some drivers just crash, it's a fact of life. The ASIO driver in particular likes to crash inside the driver itself, without any error messages ever returned to try and catch. When you try to change a driver with a game loaded, it gives you a scary warning, asking if you want to proceed. When you change a driver, it sets a crash flag, and if the driver crashes while initializing, then restarting bsnes will disable the errant driver. If it fails in a recoverable way, then it sets the driver to “None” and warns you that the driver cannot be used. What I'm thinking of further adding is to call emulator→save() to write out the save RAM contents beforehand (although the periodic auto-saving RAM will handle this anyway when it's enabled), and possibly it might be wise to capture an emulator save state, although those can't be taken without advancing the emulator to the next frame, so that might not be a good idea. I'm also thinking we should show some kind of message somewhere when a driver is set to “None”. The status bar can be hidden, so perhaps on the title bar? Or maybe just a warning on startup that a driver is set to “None”.
2018-05-25 08:02:38 +00:00
AdvancedSettings advanced{&panel};
StatusBar statusBar{this};
};
extern Settings settings;
extern unique_pointer<SettingsWindow> settingsWindow;