mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-24 23:22:25 +01:00
byuu says: The library window is gone, and replaced with hiro::BrowserWindow::openFolder(). This gives navigation capabilities to game loading, and it also completes our slotted cart selection code. As an added bonus, it's less code this way, too. I also set the window size to consistent sizes between all emulated systems, so that switching between SFC and GB don't cause the window size to keep changing, and so that the scaling size is consistent (eg at normal scale, GB @ 3x is closer to SNES @ 2x.) This means black borders in GB/GBA mode, but it doesn't look that bad, and it's not like many people ever use these modes anyway. Finally, added the placeholder tabs for video, audio and timing. I don't intend to add the timing calculator code to v095 (it might be better as a separate tool), but I'll add the ability to set video/audio rates, at least. Glitch 1: despite selecting the first item in the BrowserDialog list, if you press enter when the window appears, it doesn't activate the item until you press an arrow key first. Glitch 2: in Game Boy mode, if you set the 4x window size, it's not honoring the full requested height because the viewport is smaller than the window. 8+ years of trying to get GTK+ and Qt to simply set the god damned window size I ask for, and I still can't get them to do it reliably. Remaining issues: - finish configuration panels (video, audio, timing) - fix ruby driver compilation on Windows - add DIP switch selection window (NSS) [I may end up punting this one to v096]
83 lines
1.7 KiB
C++
83 lines
1.7 KiB
C++
#include <SDL/SDL.h>
|
|
#include <sys/ipc.h>
|
|
#include <sys/shm.h>
|
|
|
|
#include "keyboard/xlib.cpp"
|
|
#include "mouse/xlib.cpp"
|
|
#include "joypad/sdl.cpp"
|
|
|
|
namespace ruby {
|
|
|
|
struct pInputSDL {
|
|
InputKeyboardXlib xlibKeyboard;
|
|
InputMouseXlib xlibMouse;
|
|
InputJoypadSDL sdl;
|
|
|
|
struct Settings {
|
|
uintptr_t handle = 0;
|
|
} settings;
|
|
|
|
auto cap(const string& name) -> bool {
|
|
if(name == Input::Handle) return true;
|
|
if(name == Input::KeyboardSupport) return true;
|
|
if(name == Input::MouseSupport) return true;
|
|
if(name == Input::JoypadSupport) return true;
|
|
return false;
|
|
}
|
|
|
|
auto get(const string& name) -> any {
|
|
if(name == Input::Handle) return (uintptr_t)settings.handle;
|
|
return {};
|
|
}
|
|
|
|
auto set(const string& name, const any& value) -> bool {
|
|
if(name == Input::Handle && value.is<uintptr_t>()) {
|
|
settings.handle = value.get<uintptr_t>();
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
auto acquire() -> bool {
|
|
return xlibMouse.acquire();
|
|
}
|
|
|
|
auto unacquire() -> bool {
|
|
return xlibMouse.unacquire();
|
|
}
|
|
|
|
auto acquired() -> bool {
|
|
return xlibMouse.acquired();
|
|
}
|
|
|
|
auto poll() -> vector<shared_pointer<HID::Device>> {
|
|
vector<shared_pointer<HID::Device>> devices;
|
|
xlibKeyboard.poll(devices);
|
|
xlibMouse.poll(devices);
|
|
sdl.poll(devices);
|
|
return devices;
|
|
}
|
|
|
|
auto rumble(uint64_t id, bool enable) -> bool {
|
|
return false;
|
|
}
|
|
|
|
auto init() -> bool {
|
|
if(!xlibKeyboard.init()) return false;
|
|
if(!xlibMouse.init(settings.handle)) return false;
|
|
if(!sdl.init()) return false;
|
|
return true;
|
|
}
|
|
|
|
auto term() -> void {
|
|
xlibKeyboard.term();
|
|
xlibMouse.term();
|
|
sdl.term();
|
|
}
|
|
};
|
|
|
|
DeclareInput(SDL)
|
|
|
|
}
|