Update to v106r53 release.

byuu says:

Okay, so the WIPs-within-WIPs thing wasn't achieving its desired effect,
and it ended up causing me to have to redo some work on hiro since my
last local snapshot was of r52. So, heck it. I'll just do mostly
non-functional WIPs for a bit, and worry about the fallout years later
when I'm trying to find an emulation regression and cursing that the
WIPs aren't compiling.

I ported all of the ruby input drivers to the new syntax, as well as the
OpenAL driver. If you patch the ruby drivers for Linux with this in
mind, bsnes should compile and run there again.

Also, the bsnes program icon has returned, now that the new hiro layout
code is mature enough and I can simply add and remove the icon as a
Canvas instead of having to try and render into a viewport. The icon
shows up instantly with the main window.
This commit is contained in:
Tim Allen
2018-08-01 19:07:28 +10:00
parent 2335bb0df8
commit 5d135b556d
25 changed files with 231 additions and 228 deletions

View File

@@ -12,65 +12,57 @@
#include "mouse/xlib.cpp"
#include "joypad/udev.cpp"
struct InputUdev : Input {
InputUdev() : _keyboard(*this), _mouse(*this), _joypad(*this) { initialize(); }
struct InputUdev : InputDriver {
InputUdev(Input& super) : InputDriver(super), keyboard(super), mouse(super), joypad(super) {}
~InputUdev() { terminate(); }
auto driver() -> string override { return "udev"; }
auto ready() -> bool { return _ready; }
auto hasContext() -> bool override { return true; }
auto setContext(uintptr context) -> bool override {
if(context == Input::context()) return true;
if(!Input::setContext(context)) return false;
auto create() -> bool override {
return initialize();
}
auto acquired() -> bool override {
return _mouse.acquired();
}
auto driver() -> string override { return "udev"; }
auto ready() -> bool { return isReady; }
auto acquire() -> bool override {
return _mouse.acquire();
}
auto hasContext() -> bool override { return true; }
auto release() -> bool override {
return _mouse.release();
}
auto setContext(uintptr context) -> bool override { return initialize(); }
auto acquired() -> bool override { return mouse.acquired(); }
auto acquire() -> bool override { return mouse.acquire(); }
auto release() -> bool override { return mouse.release(); }
auto poll() -> vector<shared_pointer<HID::Device>> override {
vector<shared_pointer<HID::Device>> devices;
_keyboard.poll(devices);
_mouse.poll(devices);
_joypad.poll(devices);
keyboard.poll(devices);
mouse.poll(devices);
joypad.poll(devices);
return devices;
}
auto rumble(uint64_t id, bool enable) -> bool override {
return _joypad.rumble(id, enable);
return joypad.rumble(id, enable);
}
private:
auto initialize() -> bool {
terminate();
if(!_context) return false;
if(!_keyboard.initialize()) return false;
if(!_mouse.initialize(_context)) return false;
if(!_joypad.initialize()) return false;
return _ready = true;
if(!self.context) return false;
if(!keyboard.initialize()) return false;
if(!mouse.initialize(self.context)) return false;
if(!joypad.initialize()) return false;
return isReady = true;
}
auto terminate() -> void {
_ready = false;
_keyboard.terminate();
_mouse.terminate();
_joypad.terminate();
isReady = false;
keyboard.terminate();
mouse.terminate();
joypad.terminate();
}
bool _ready = false;
InputKeyboardXlib _keyboard;
InputMouseXlib _mouse;
InputJoypadUdev _joypad;
InputUdev& self = *this;
bool isReady = false;
InputKeyboardXlib keyboard;
InputMouseXlib mouse;
InputJoypadUdev joypad;
};