2010-08-09 13:28:56 +00:00
|
|
|
/* Global Headers */
|
|
|
|
|
|
|
|
#if defined(PLATFORM_X)
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xutil.h>
|
|
|
|
#include <X11/Xatom.h>
|
|
|
|
#elif defined(PLATFORM_OSX)
|
2013-04-14 08:52:47 +00:00
|
|
|
#define decimal CocoaDecimal
|
2013-03-19 08:48:50 +00:00
|
|
|
#include <Cocoa/Cocoa.h>
|
2010-08-09 13:28:56 +00:00
|
|
|
#include <Carbon/Carbon.h>
|
2013-04-14 08:52:47 +00:00
|
|
|
#undef decimal
|
2011-09-29 12:08:22 +00:00
|
|
|
#elif defined(PLATFORM_WINDOWS)
|
2010-08-09 13:28:56 +00:00
|
|
|
#define _WIN32_WINNT 0x0501
|
|
|
|
#include <windows.h>
|
|
|
|
#endif
|
|
|
|
|
2011-02-28 23:45:31 +00:00
|
|
|
using namespace nall;
|
|
|
|
|
2010-08-09 13:28:56 +00:00
|
|
|
/* Video */
|
|
|
|
|
|
|
|
#define DeclareVideo(Name) \
|
|
|
|
class Video##Name : public Video { \
|
|
|
|
public: \
|
|
|
|
bool cap(const string& name) { return p.cap(name); } \
|
|
|
|
any get(const string& name) { return p.get(name); } \
|
|
|
|
bool set(const string& name, const any& value) { return p.set(name, value); } \
|
|
|
|
\
|
2013-05-02 11:25:45 +00:00
|
|
|
bool lock(uint32_t*& data, unsigned& pitch, unsigned width, unsigned height) { return p.lock(data, pitch, width, height); } \
|
2010-08-09 13:28:56 +00:00
|
|
|
void unlock() { p.unlock(); } \
|
|
|
|
\
|
|
|
|
void clear() { p.clear(); } \
|
|
|
|
void refresh() { p.refresh(); } \
|
|
|
|
bool init() { return p.init(); } \
|
|
|
|
void term() { p.term(); } \
|
|
|
|
\
|
|
|
|
Video##Name() : p(*new pVideo##Name) {} \
|
|
|
|
~Video##Name() { delete &p; } \
|
|
|
|
\
|
|
|
|
private: \
|
2013-05-02 11:25:45 +00:00
|
|
|
pVideo##Name& p; \
|
2010-08-09 13:28:56 +00:00
|
|
|
};
|
|
|
|
|
2013-03-19 08:48:50 +00:00
|
|
|
#ifdef VIDEO_CGL
|
|
|
|
#include <ruby/video/cgl.cpp>
|
|
|
|
#endif
|
|
|
|
|
2010-08-09 13:28:56 +00:00
|
|
|
#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
|
|
|
|
|
Update to v084r03 release.
(r02 was not posted to the WIP thread)
byuu says:
Internally, all color is processed with 30-bit precision. The filters
also operate at 30-bit depth.
There's a new config file setting, video.depth, which defaults to 24.
This causes the final output to downsample to 24-bit, as most will
require.
If you set it to 30-bit, the downsampling will not occur, and bsnes will
ask ruby for a 30-bit surface. If you don't have one available, you're
going to get bad colors. Or maybe even a crash with OpenGL.
I don't yet have detection code to make sure you have an appropriate
visual in place.
30-bit mode will really only work if you are running Linux, running Xorg
at Depth 30, use the OpenGL or XShm driver, have an nVidia Quadro or AMD
FireGL card with the official drivers, and have a 30-bit capable
monitor.
Lots of planning and work for very little gain here, but it's nice that
it's finally finished.
Oh, I had to change the contrast/brightness formulas a tiny bit, but
they still work and look nice.
2011-12-03 03:22:54 +00:00
|
|
|
#ifdef VIDEO_XSHM
|
|
|
|
#include <ruby/video/xshm.cpp>
|
|
|
|
#endif
|
|
|
|
|
2010-08-09 13:28:56 +00:00
|
|
|
#ifdef VIDEO_XV
|
|
|
|
#include <ruby/video/xv.cpp>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Audio */
|
|
|
|
|
|
|
|
#define DeclareAudio(Name) \
|
|
|
|
class Audio##Name : public Audio { \
|
|
|
|
public: \
|
|
|
|
bool cap(const string& name) { return p.cap(name); } \
|
|
|
|
any get(const string& name) { return p.get(name); } \
|
|
|
|
bool set(const string& name, const any& value) { return p.set(name, value); } \
|
|
|
|
\
|
|
|
|
void sample(uint16_t left, uint16_t right) { p.sample(left, right); } \
|
|
|
|
void clear() { p.clear(); } \
|
|
|
|
bool init() { return p.init(); } \
|
|
|
|
void term() { p.term(); } \
|
|
|
|
\
|
|
|
|
Audio##Name() : p(*new pAudio##Name) {} \
|
|
|
|
~Audio##Name() { delete &p; } \
|
|
|
|
\
|
|
|
|
private: \
|
2013-05-02 11:25:45 +00:00
|
|
|
pAudio##Name& p; \
|
2010-08-09 13:28:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#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
|
2010-08-16 04:10:50 +00:00
|
|
|
|
|
|
|
#ifdef AUDIO_XAUDIO2
|
|
|
|
#include <ruby/audio/xaudio2.cpp>
|
|
|
|
#endif
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
/* Input */
|
|
|
|
|
|
|
|
#define DeclareInput(Name) \
|
|
|
|
class Input##Name : public Input { \
|
|
|
|
public: \
|
|
|
|
bool cap(const string& name) { return p.cap(name); } \
|
|
|
|
any get(const string& name) { return p.get(name); } \
|
|
|
|
bool set(const string& name, const any& value) { return p.set(name, value); } \
|
|
|
|
\
|
|
|
|
bool acquire() { return p.acquire(); } \
|
|
|
|
bool unacquire() { return p.unacquire(); } \
|
|
|
|
bool acquired() { return p.acquired(); } \
|
|
|
|
\
|
2013-05-02 11:25:45 +00:00
|
|
|
bool poll(int16_t* table) { return p.poll(table); } \
|
2010-08-09 13:28:56 +00:00
|
|
|
bool init() { return p.init(); } \
|
|
|
|
void term() { p.term(); } \
|
|
|
|
\
|
|
|
|
Input##Name() : p(*new pInput##Name) {} \
|
|
|
|
~Input##Name() { delete &p; } \
|
|
|
|
\
|
|
|
|
private: \
|
2013-05-02 11:25:45 +00:00
|
|
|
pInput##Name& p; \
|
2010-08-09 13:28:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef INPUT_DIRECTINPUT
|
|
|
|
#include <ruby/input/directinput.cpp>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INPUT_RAWINPUT
|
|
|
|
#include <ruby/input/rawinput.cpp>
|
|
|
|
#endif
|
|
|
|
|
2013-03-19 08:48:50 +00:00
|
|
|
#ifdef INPUT_CARBON
|
|
|
|
#include <ruby/input/carbon.cpp>
|
|
|
|
#endif
|
|
|
|
|
2010-08-09 13:28:56 +00:00
|
|
|
#ifdef INPUT_SDL
|
|
|
|
#include <ruby/input/sdl.cpp>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef INPUT_X
|
|
|
|
#include <ruby/input/x.cpp>
|
|
|
|
#endif
|