bsnes/higan/target-tomoko/settings/settings.hpp
Tim Allen afa8ea61c5 Update to v104r06 release.
byuu says:

Changelog:

  - gba,ws: removed Thread::step() override¹
  - processor/m68k: move.b (a7)+ and move.b (a7)- adjust a7 by two, not
    by one²
  - tomoko: created new initialize(Video,Audio,Input)Driver() functions³
  - ruby/audio: split Audio::information into
    Audio::available(Devices,Frequencies,Latencies,Channels)³
  - ws: added Model::(WonderSwan,WonderSwanColor,SwanCrystal)()
    functions for consistency with other cores

¹: this should hopefully fix GBA Pokemon Pinball. Thanks to
SuperMikeMan for pointing out the underlying cause.

²: this fixes A Ressaha de Ikou, Mega Bomberman, and probably more
games.

³: this is the big change: so there was a problem with WASAPI where
you might change your device under the audio settings panel. And your
new device may not support the frequency that your old device used. This
would end up not updating the frequency, and the pitch would be
distorted.

The old Audio::information() couldn't tell you what frequencies,
latencies, or channels were available for all devices simultaneously, so
I had to split them up. The new initializeAudioDriver() function
validates you have a correct driver, or it defaults to none. Then it
validates a correct device name, or it defaults to the first entry in
the list. Then it validates a correct frequency, or defaults to the
first in the list. Then finally it validates a correct latency, or
defaults to the first in the list.

In this way ... we have a clear path now with no API changes required to
select default devices, frequencies, latencies, channel counts: they
need to be the first items in their respective lists.

So, what we need to do now is go through and for every audio driver that
enumerates devices, we need to make sure the default device gets added
to the top of the list. I'm ... not really sure how to do this with most
drivers, so this is definitely going to take some time.

Also, when you change a device, initializeAudioDriver() is called again,
so if it's a bad device, it will disable the audio driver instead of
continuing to send samples at it and hoping that the driver blocked
those API calls when it failed to initialize properly.

Now then ... since it was a decently-sized API change, it's possible
I've broken compilation of the Linux drivers, so please report any
compilation errors so that I can fix them.
2017-08-26 11:15:49 +10:00

162 lines
7 KiB
C++

struct VideoSettings : TabFrameItem {
VideoSettings(TabFrame*);
VerticalLayout layout{this};
Label colorAdjustmentLabel{&layout, Size{~0, 0}, 2};
HorizontalLayout saturationLayout{&layout, Size{~0, 0}};
Label saturationLabel{&saturationLayout, Size{80, 0}};
Label saturationValue{&saturationLayout, Size{50, 0}};
HorizontalSlider saturationSlider{&saturationLayout, Size{~0, 0}};
HorizontalLayout gammaLayout{&layout, Size{~0, 0}};
Label gammaLabel{&gammaLayout, Size{80, 0}};
Label gammaValue{&gammaLayout, Size{50, 0}};
HorizontalSlider gammaSlider{&gammaLayout, Size{~0, 0}};
HorizontalLayout luminanceLayout{&layout, Size{~0, 0}};
Label luminanceLabel{&luminanceLayout, Size{80, 0}};
Label luminanceValue{&luminanceLayout, Size{50, 0}};
HorizontalSlider luminanceSlider{&luminanceLayout, Size{~0, 0}};
Label overscanMaskLabel{&layout, Size{~0, 0}, 2};
HorizontalLayout horizontalMaskLayout{&layout, Size{~0, 0}};
Label horizontalMaskLabel{&horizontalMaskLayout, Size{80, 0}};
Label horizontalMaskValue{&horizontalMaskLayout, Size{50, 0}};
HorizontalSlider horizontalMaskSlider{&horizontalMaskLayout, Size{~0, 0}};
HorizontalLayout verticalMaskLayout{&layout, Size{~0, 0}};
Label verticalMaskLabel{&verticalMaskLayout, Size{80, 0}};
Label verticalMaskValue{&verticalMaskLayout, Size{50, 0}};
HorizontalSlider verticalMaskSlider{&verticalMaskLayout, Size{~0, 0}};
Label windowedModeLabel{&layout, Size{~0, 0}, 2};
HorizontalLayout windowedModeLayout{&layout, Size{~0, 0}};
CheckLabel windowedModeAspectCorrection{&windowedModeLayout, Size{0, 0}};
CheckLabel windowedModeIntegralScaling{&windowedModeLayout, Size{0, 0}};
CheckLabel windowedModeAdaptive{&windowedModeLayout, Size{0, 0}};
Label fullscreenModeLabel{&layout, Size{~0, 0}, 2};
HorizontalLayout fullscreenModeLayout{&layout, Size{~0, 0}};
CheckLabel fullscreenModeAspectCorrection{&fullscreenModeLayout, Size{0, 0}};
CheckLabel fullscreenModeIntegralScaling{&fullscreenModeLayout, Size{0, 0}};
CheckLabel fullscreenModeExclusive{&fullscreenModeLayout, Size{0, 0}};
auto updateColor(bool initializing = false) -> void;
auto updateViewport(bool initializing = false) -> void;
};
struct AudioSettings : TabFrameItem {
AudioSettings(TabFrame*);
VerticalLayout layout{this};
Label driverLabel{&layout, Size{~0, 0}, 2};
HorizontalLayout controlLayout{&layout, Size{~0, 0}};
Label deviceLabel{&controlLayout, Size{0, 0}};
ComboButton deviceList{&controlLayout, Size{~0, 0}};
Label frequencyLabel{&controlLayout, Size{0, 0}};
ComboButton frequencyList{&controlLayout, Size{~0, 0}};
Label latencyLabel{&controlLayout, Size{0, 0}};
ComboButton latencyList{&controlLayout, Size{~0, 0}};
CheckLabel exclusiveMode{&layout, Size{~0, 0}};
Label effectsLabel{&layout, Size{~0, 0}, 2};
HorizontalLayout volumeLayout{&layout, Size{~0, 0}};
Label volumeLabel{&volumeLayout, Size{80, 0}};
Label volumeValue{&volumeLayout, Size{50, 0}};
HorizontalSlider volumeSlider{&volumeLayout, Size{~0, 0}};
HorizontalLayout balanceLayout{&layout, Size{~0, 0}};
Label balanceLabel{&balanceLayout, Size{80, 0}};
Label balanceValue{&balanceLayout, Size{50, 0}};
HorizontalSlider balanceSlider{&balanceLayout, Size{~0, 0}};
CheckLabel reverbEnable{&layout, Size{~0, 0}};
auto updateDevice() -> void;
auto updateEffects(bool initializing = false) -> void;
};
struct InputSettings : TabFrameItem {
InputSettings(TabFrame*);
VerticalLayout layout{this};
HorizontalLayout focusLayout{&layout, Size{~0, 0}};
Label focusLabel{&focusLayout, Size{0, 0}};
CheckLabel pauseEmulation{&focusLayout, Size{0, 0}};
CheckLabel allowInput{&focusLayout, Size{0, 0}};
HorizontalLayout selectionLayout{&layout, Size{~0, 0}};
ComboButton emulatorList{&selectionLayout, Size{~0, 0}};
ComboButton portList{&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 spacer{&controlLayout, Size{~0, 0}};
Button resetButton{&controlLayout, Size{80, 0}};
Button eraseButton{&controlLayout, Size{80, 0}};
auto updateControls() -> void;
auto activeEmulator() -> InputEmulator&;
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;
InputMapping* activeMapping = nullptr;
Timer timer;
};
struct HotkeySettings : TabFrameItem {
HotkeySettings(TabFrame*);
VerticalLayout layout{this};
TableView mappingList{&layout, Size{~0, ~0}};
HorizontalLayout controlLayout{&layout, Size{~0, 0}};
Widget spacer{&controlLayout, Size{~0, 0}};
Button resetButton{&controlLayout, Size{80, 0}};
Button eraseButton{&controlLayout, Size{80, 0}};
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;
InputMapping* activeMapping = nullptr;
Timer timer;
};
struct AdvancedSettings : TabFrameItem {
AdvancedSettings(TabFrame*);
VerticalLayout layout{this};
Label driverLabel{&layout, Size{~0, 0}, 2};
HorizontalLayout driverLayout{&layout, Size{~0, 0}};
Label videoLabel{&driverLayout, Size{0, 0}};
ComboButton videoDriver{&driverLayout, Size{~0, 0}};
Label audioLabel{&driverLayout, Size{0, 0}};
ComboButton audioDriver{&driverLayout, Size{~0, 0}};
Label inputLabel{&driverLayout, Size{0, 0}};
ComboButton inputDriver{&driverLayout, Size{~0, 0}};
Label libraryLabel{&layout, Size{~0, 0}, 2};
HorizontalLayout libraryLayout{&layout, Size{~0, 0}};
Label libraryPrefix{&libraryLayout, Size{0, 0}};
LineEdit libraryLocation{&libraryLayout, Size{~0, 0}};
Button libraryChange{&libraryLayout, Size{0, 0}};
CheckLabel ignoreManifests{&layout, Size{~0, 0}};
};
struct SettingsManager : Window {
SettingsManager();
VerticalLayout layout{this};
TabFrame panel{&layout, Size{~0, ~0}};
VideoSettings video{&panel};
AudioSettings audio{&panel};
InputSettings input{&panel};
HotkeySettings hotkeys{&panel};
AdvancedSettings advanced{&panel};
StatusBar statusBar{this};
auto setVisible(bool visible = true) -> SettingsManager&;
auto show(uint setting) -> void;
};
extern unique_pointer<SettingsManager> settingsManager;