mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-01-17 20:58:28 +01:00
2b8df2e70e
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”.
112 lines
4.3 KiB
C++
112 lines
4.3 KiB
C++
#pragma once
|
|
|
|
#include <nall/nall.hpp>
|
|
|
|
namespace ruby {
|
|
|
|
struct Video {
|
|
static auto create(nall::string driver = "") -> Video*;
|
|
static auto optimalDriver() -> nall::string;
|
|
static auto safestDriver() -> nall::string;
|
|
static auto availableDrivers() -> nall::string_vector;
|
|
|
|
virtual ~Video() = default;
|
|
|
|
virtual auto ready() -> bool { return true; }
|
|
virtual auto driver() -> nall::string { return _driver; }
|
|
|
|
virtual auto exclusive() -> bool { return false; }
|
|
virtual auto context() -> uintptr { return 0; }
|
|
virtual auto blocking() -> bool { return false; }
|
|
virtual auto depth() -> uint { return 24; }
|
|
virtual auto smooth() -> bool { return false; }
|
|
virtual auto shader() -> nall::string { return ""; }
|
|
|
|
virtual auto setExclusive(bool exclusive) -> bool { return false; }
|
|
virtual auto setContext(uintptr context) -> bool { return false; }
|
|
virtual auto setBlocking(bool blocking) -> bool { return false; }
|
|
virtual auto setDepth(uint depth) -> bool { return false; }
|
|
virtual auto setSmooth(bool smooth) -> bool { return false; }
|
|
virtual auto setShader(nall::string shader) -> bool { return false; }
|
|
|
|
virtual auto clear() -> void {}
|
|
virtual auto lock(uint32_t*& data, uint& pitch, uint width, uint height) -> bool { return false; }
|
|
virtual auto unlock() -> void {}
|
|
virtual auto output() -> void {}
|
|
|
|
private:
|
|
nall::string _driver;
|
|
};
|
|
|
|
struct Audio {
|
|
static auto create(nall::string driver = "") -> Audio*;
|
|
static auto optimalDriver() -> nall::string;
|
|
static auto safestDriver() -> nall::string;
|
|
static auto availableDrivers() -> nall::string_vector;
|
|
|
|
virtual ~Audio() = default;
|
|
|
|
virtual auto availableDevices() -> nall::string_vector { return {"Default"}; }
|
|
virtual auto availableFrequencies() -> nall::vector<double> { return {44100.0}; }
|
|
virtual auto availableLatencies() -> nall::vector<uint> { return {0}; }
|
|
virtual auto availableChannels() -> nall::vector<uint> { return {2}; }
|
|
|
|
virtual auto ready() -> bool { return true; }
|
|
virtual auto driver() -> nall::string { return _driver; }
|
|
|
|
virtual auto exclusive() -> bool { return false; }
|
|
virtual auto context() -> uintptr { return 0; }
|
|
virtual auto device() -> nall::string { return "None"; }
|
|
virtual auto blocking() -> bool { return false; }
|
|
virtual auto channels() -> uint { return 2; }
|
|
virtual auto frequency() -> double { return 48000.0; }
|
|
virtual auto latency() -> uint { return 0; }
|
|
|
|
virtual auto setExclusive(bool exclusive) -> bool { return false; }
|
|
virtual auto setContext(uintptr context) -> bool { return false; }
|
|
virtual auto setDevice(nall::string device) -> bool { return false; }
|
|
virtual auto setBlocking(bool blocking) -> bool { return false; }
|
|
virtual auto setChannels(uint channels) -> bool { return false; }
|
|
virtual auto setFrequency(double frequency) -> bool { return false; }
|
|
virtual auto setLatency(uint latency) -> bool { return false; }
|
|
|
|
virtual auto clear() -> void {}
|
|
virtual auto output(const double samples[]) -> void {}
|
|
|
|
private:
|
|
nall::string _driver;
|
|
};
|
|
|
|
struct Input {
|
|
static auto create(nall::string driver = "") -> Input*;
|
|
static auto optimalDriver() -> nall::string;
|
|
static auto safestDriver() -> nall::string;
|
|
static auto availableDrivers() -> nall::string_vector;
|
|
|
|
virtual ~Input() = default;
|
|
|
|
virtual auto ready() -> bool { return true; }
|
|
virtual auto driver() -> nall::string { return _driver; }
|
|
|
|
virtual auto context() -> uintptr { return 0; }
|
|
|
|
virtual auto setContext(uintptr context) -> bool { return false; }
|
|
|
|
virtual auto acquired() -> bool { return false; }
|
|
virtual auto acquire() -> bool { return false; }
|
|
virtual auto release() -> bool { return false; }
|
|
virtual auto poll() -> nall::vector<nall::shared_pointer<nall::HID::Device>> { return {}; }
|
|
virtual auto rumble(uint64_t id, bool enable) -> bool { return false; }
|
|
|
|
auto onChange(const nall::function<void (nall::shared_pointer<nall::HID::Device>, uint, uint, int16_t, int16_t)>& callback) { _onChange = callback; }
|
|
auto doChange(nall::shared_pointer<nall::HID::Device> device, uint group, uint input, int16_t oldValue, int16_t newValue) -> void {
|
|
if(_onChange) _onChange(device, group, input, oldValue, newValue);
|
|
}
|
|
|
|
private:
|
|
nall::string _driver;
|
|
nall::function<void (nall::shared_pointer<nall::HID::Device> device, uint group, uint input, int16_t oldValue, int16_t newValue)> _onChange;
|
|
};
|
|
|
|
}
|