mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-10-06 13:21:34 +02:00
byuu says: Lots of changes this time around. FreeBSD stability and compilation is still a work in progress. FreeBSD 10 + Clang 3.3 = 108fps FreeBSD 10 + GCC 4.7 = 130fps Errata 1: I've been fighting that god-damned endian.h header for the past nine WIPs now. The above WIP isn't building now because FreeBSD isn't including headers before using certain types, and you end up with a trillion error messages. So just delete all the endian.h includes from nall/intrinsics.hpp to build. Errata 2: I was trying to match g++ and g++47, so I used $(findstring g++,$(compiler)), which ends up also matching clang++. Oops. Easy fix, put Clang first and then else if g++ next. Not ideal, but oh well. All it's doing for now is declaring -fwrapv twice, so you don't have to fix it just yet. Probably just going to alias g++="g++47" and do exact matching instead. Errata 3: both OpenGL::term and VideoGLX::term are causing a core dump on BSD. No idea why. The resources are initialized and valid, but releasing them crashes the application. Changelog: - nall/Makefile is more flexible with overriding $(compiler), so you can build with GCC or Clang on BSD (defaults to GCC now) - PLATFORM_X was renamed to PLATFORM_XORG, and it's also declared with PLATFORM_LINUX or PLATFORM_BSD - PLATFORM_XORG probably isn't the best name ... still thinking about what best to call LINUX|BSD|SOLARIS or ^(WINDOWS|MACOSX) - fixed a few legitimate Clang warning messages in nall - Compiler::VisualCPP is ugly as hell, renamed to Compiler::CL - nall/platform includes nall/intrinsics first. Trying to move away from testing for _WIN32, etc directly in all files. Work in progress. - nall turns off Clang warnings that I won't "fix", because they aren't broken. It's much less noisy to compile with warnings on now. - phoenix gains the ability to set background and foreground colors on various text container widgets (GTK only for now.) - rewrote a lot of the MSU1 code to try and simplify it. Really hope I didn't break anything ... I don't have any MSU1 test ROMs handy - SNES coprocessor audio is now mixed as sclamp<16>(system_sample + coprocessor_sample) instead of sclamp<16>((sys + cop) / 2) - allows for greater chance of aliasing (still low, SNES audio is quiet), but doesn't cut base system volume in half anymore - fixed Super Scope and Justifier cursor colors - use input.xlib instead of input.x ... allows Xlib input driver to be visible on Linux and BSD once again - make install and make uninstall must be run as root again; no longer using install but cp instead for BSD compatibility - killed $(DESTDIR) ... use make prefix=$DESTDIR$prefix instead - you can now set text/background colors for the loki console via (eg): - settings.terminal.background-color 0x000000 - settings.terminal.foreground-color 0xffffff
173 lines
3.7 KiB
C++
173 lines
3.7 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)
|
|
#define _WIN32_WINNT 0x0501
|
|
#include <windows.h>
|
|
#endif
|
|
|
|
using namespace nall;
|
|
|
|
/* Video */
|
|
|
|
#define DeclareVideo(Name) \
|
|
struct Video##Name : Video { \
|
|
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 lock(uint32_t*& data, unsigned& pitch, unsigned width, unsigned height) { return p.lock(data, pitch, width, height); } \
|
|
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: \
|
|
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 { \
|
|
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: \
|
|
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 { \
|
|
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(); } \
|
|
\
|
|
vector<HID::Device*> poll() { return p.poll(); } \
|
|
bool rumble(uint64_t id, bool enable) { return p.rumble(id, enable); } \
|
|
bool init() { return p.init(); } \
|
|
void term() { p.term(); } \
|
|
\
|
|
Input##Name() : p(*new pInput##Name) {} \
|
|
~Input##Name() { delete &p; } \
|
|
\
|
|
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
|