bsnes-libretro/ruby/implementation.cpp
Tim Allen 7bf4cff946 Update to v094r22 release.
byuu says:

I fixed the hiro layout enable bug, so when you go to assign joypad
input, the window disables itself so your input doesn't mess with the
controls.

I added "reset" to the hotkeys, in case you feel like clearing all of
them at once.

I added device selection support and the ability to disable audio
synchronization (run > 60fps) to the ruby/OSS driver. This is exposed in
tomoko's configuration file.

I added checks to stringify so that assigning null char* strings to
nall::string won't cause crashes anymore (technically the crash was in
strlen(), which doesn't check for null strings, but whatever ... I'll do
the check myself.)

I hooked up BrowserDialog::folderSelect() to loading slotted media for
now. Tested it by loading a Game Boy game successfully through the Super
Game Boy. Definitely want to write a custom window for this though, that
looks more like the library dialog.

Remaining issues:
- finish slotted cart loader (SGB, BSX, ST)
- add DIP switch selection window (NSS) [I may end up punting this one
  to v096]
- add more configuration panels (video, audio, timing)
2015-05-30 21:40:07 +10:00

173 lines
3.9 KiB
C++

/* Global Headers */
#if defined(PLATFORM_XORG)
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#elif defined(PLATFORM_MACOSX)
#define decimal CocoaDecimal
#include <Cocoa/Cocoa.h>
#include <Carbon/Carbon.h>
#undef decimal
#elif defined(PLATFORM_WINDOWS)
#include <windows.h>
#endif
using namespace nall;
/* Video */
#define DeclareVideo(Name) \
struct Video##Name : Video { \
Video##Name() : p(*new pVideo##Name) {} \
~Video##Name() { delete &p; } \
\
auto cap(const string& name) -> bool { return p.cap(name); } \
auto get(const string& name) -> any { return p.get(name); } \
auto set(const string& name, const any& value) -> bool { return p.set(name, value); } \
\
auto lock(uint32_t*& data, unsigned& pitch, unsigned width, unsigned height) -> bool { return p.lock(data, pitch, width, height); } \
auto unlock() -> void { p.unlock(); } \
auto clear() -> void { p.clear(); } \
auto refresh() -> void { p.refresh(); } \
\
auto init() -> bool { return p.init(); } \
auto term() -> void { p.term(); } \
\
private: \
pVideo##Name& p; \
};
#ifdef VIDEO_CGL
#include <ruby/video/cgl.cpp>
#endif
#ifdef VIDEO_DIRECT3D
#include <ruby/video/direct3d.cpp>
#endif
#ifdef VIDEO_DIRECTDRAW
#include <ruby/video/directdraw.cpp>
#endif
#ifdef VIDEO_GDI
#include <ruby/video/gdi.cpp>
#endif
#ifdef VIDEO_GLX
#include <ruby/video/glx.cpp>
#endif
#ifdef VIDEO_SDL
#include <ruby/video/sdl.cpp>
#endif
#ifdef VIDEO_WGL
#include <ruby/video/wgl.cpp>
#endif
#ifdef VIDEO_XSHM
#include <ruby/video/xshm.cpp>
#endif
#ifdef VIDEO_XV
#include <ruby/video/xv.cpp>
#endif
/* Audio */
#define DeclareAudio(Name) \
struct Audio##Name : Audio { \
Audio##Name() : p(*new pAudio##Name) {} \
~Audio##Name() { delete &p; } \
\
auto cap(const string& name) -> bool { return p.cap(name); } \
auto get(const string& name) -> any { return p.get(name); } \
auto set(const string& name, const any& value) -> bool { return p.set(name, value); } \
\
auto sample(uint16_t left, uint16_t right) -> void { p.sample(left, right); } \
auto clear() -> void { p.clear(); } \
\
auto init() -> bool { return p.init(); } \
auto term() -> void { p.term(); } \
\
private: \
pAudio##Name& p; \
};
#ifdef AUDIO_ALSA
#include <ruby/audio/alsa.cpp>
#endif
#ifdef AUDIO_AO
#include <ruby/audio/ao.cpp>
#endif
#ifdef AUDIO_DIRECTSOUND
#include <ruby/audio/directsound.cpp>
#endif
#ifdef AUDIO_OPENAL
#include <ruby/audio/openal.cpp>
#endif
#ifdef AUDIO_OSS
#include <ruby/audio/oss.cpp>
#endif
#ifdef AUDIO_PULSEAUDIO
#include <ruby/audio/pulseaudio.cpp>
#endif
#ifdef AUDIO_PULSEAUDIOSIMPLE
#include <ruby/audio/pulseaudiosimple.cpp>
#endif
#ifdef AUDIO_XAUDIO2
#include <ruby/audio/xaudio2.cpp>
#endif
/* Input */
#define DeclareInput(Name) \
struct Input##Name : Input { \
Input##Name() : p(*new pInput##Name) {} \
~Input##Name() { delete &p; } \
\
auto cap(const string& name) -> bool { return p.cap(name); } \
auto get(const string& name) -> any { return p.get(name); } \
auto set(const string& name, const any& value) -> bool { return p.set(name, value); } \
\
auto acquire() -> bool { return p.acquire(); } \
auto unacquire() -> bool { return p.unacquire(); } \
auto acquired() -> bool { return p.acquired(); } \
auto poll() -> vector<shared_pointer<HID::Device>> { return p.poll(); } \
auto rumble(uint64_t id, bool enable) -> bool { return p.rumble(id, enable); } \
\
auto init() -> bool { return p.init(); } \
auto term() -> void { p.term(); } \
\
private: \
pInput##Name& p; \
};
#ifdef INPUT_CARBON
#include <ruby/input/carbon.cpp>
#endif
#ifdef INPUT_SDL
#include <ruby/input/sdl.cpp>
#endif
#ifdef INPUT_UDEV
#include <ruby/input/udev.cpp>
#endif
#ifdef INPUT_WINDOWS
#include <ruby/input/windows.cpp>
#endif
#ifdef INPUT_XLIB
#include <ruby/input/xlib.cpp>
#endif