diff --git a/tools/bsnes/Makefile b/tools/bsnes/Makefile index 557e4e6..f894ac7 100755 --- a/tools/bsnes/Makefile +++ b/tools/bsnes/Makefile @@ -6,13 +6,12 @@ ui = ui_qt ### compiler ### ################ -platform=x +platform=mac compiler=gcc -enable_gzip=true +enable_gzip=false ifneq ($(findstring gcc,$(compiler)),) # GCC family flags = -O2 -fomit-frame-pointer -Ilib - # note: libco *requires* -fomit-frame-pointer on i386 arch libcoflags := $(flags) -static c = $(compiler) cpp = $(subst cc,++,$(compiler)) @@ -24,7 +23,6 @@ ifneq ($(findstring gcc,$(compiler)),) # GCC family mkincpath = -I$1 mklib = -l$1 mklibpath = -L$1 - # profile-guided optimization: #flags += -fprofile-generate #link += -lgcov @@ -51,16 +49,46 @@ endif ### os ### ########## + +ifeq ($(platform),mac) #Mac + ruby = video.glx video.xv video.sdl audio.alsa audio.openal audio.oss audio.pulseaudio audio.ao input.sdl input.x + mkbin = -o $1 + delete = rm -f $1 + link += -L/opt/local/lib \ + -lSDL -framework,Cocoa \ + -lX11 \ + -lm \ + -framework Foundation\ + -framework Cocoa \ + -framework AGL \ + -framework OpenAL\ + -framework ApplicationServices \ + -framework Foundation\ + -framework OpenGL\ + -framework GLUT \ + -lz \ + -lgl \ + -lao + + + flags +=-I/opt/local/include \ + -I/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers/\ + -DVIDEO_SDL \ + -DINPUT_SDL \ + -DVIDEO_GLX \ + -DAUDIO_AO \ + -DAUDIO_OPENAL +endif + ifeq ($(platform),x) # X11 ruby = video.glx video.xv video.sdl audio.alsa audio.openal audio.oss audio.pulseaudio audio.ao input.sdl input.x delete = rm -f $1 + else ifeq ($(platform),win) # Windows mingw_link_flags = -mwindows # mingw_links_flags = -mconsole - # enable static linking to Qt for Windows build mingw_link_flags += -enable-stdcall-fixup -Wl,-s -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc - ruby = video.direct3d video.wgl video.directdraw video.gdi audio.directsound input.rawinput input.directinput delete = $(if $(findstring i586-mingw-gcc,$(compiler)),rm -f $1,del $(subst /,\,$1)) link += $(if $(findstring mingw,$(compiler)),$(mingw_link_flags)) @@ -69,8 +97,6 @@ else ifeq ($(platform),win) # Windows link += $(call mklib,user32) link += $(call mklib,gdi32) link += $(call mklib,shell32) -else - unknown_platform: help; endif ############ @@ -78,20 +104,20 @@ endif ############ rubyflags = $(if $(findstring .sdl,$(ruby)),`sdl-config --cflags`) -link += $(if $(findstring .sdl,$(ruby)),`sdl-config --libs`) +#link += $(if $(findstring .sdl,$(ruby)),`sdl-config --libs`) -link += $(if $(findstring video.direct3d,$(ruby)),$(call mklib,d3d9)) -link += $(if $(findstring video.directdraw,$(ruby)),$(call mklib,ddraw)) -link += $(if $(findstring video.glx,$(ruby)),$(call mklib,GL)) -link += $(if $(findstring video.wgl,$(ruby)),$(call mklib,opengl32)) -link += $(if $(findstring video.xv,$(ruby)),$(call mklib,Xv)) -link += $(if $(findstring audio.alsa,$(ruby)),$(call mklib,asound)) -link += $(if $(findstring audio.ao,$(ruby)),$(call mklib,ao)) -link += $(if $(findstring audio.directsound,$(ruby)),$(call mklib,dsound)) -link += $(if $(findstring audio.openal,$(ruby)),$(if $(call streq,$(platform),x),$(call mklib,openal),$(call mklib,openal32))) -link += $(if $(findstring audio.pulseaudio,$(ruby)),$(call mklib,pulse-simple)) -link += $(if $(findstring input.directinput,$(ruby)),$(call mklib,dinput8) $(call mklib,dxguid)) -link += $(if $(findstring input.rawinput,$(ruby)),$(call mklib,xinput) $(call mklib,dinput8) $(call mklib,dxguid)) +#link += $(if $(findstring video.direct3d,$(ruby)),$(call mklib,d3d9)) +#link += $(if $(findstring video.directdraw,$(ruby)),$(call mklib,ddraw)) +#link += $(if $(findstring video.glx,$(ruby)),$(call mklib,GL)) +#link += $(if $(findstring video.wgl,$(ruby)),$(call mklib,opengl32)) +#link += $(if $(findstring video.xv,$(ruby)),$(call mklib,Xv)) +#link += $(if $(findstring audio.alsa,$(ruby)),$(call mklib,asound)) +#link += $(if $(findstring audio.ao,$(ruby)),$(call mklib,ao)) +#link += $(if $(findstring audio.directsound,$(ruby)),$(call mklib,dsound)) +#link += $(if $(findstring audio.openal,$(ruby)),$(if $(call streq,$(platform),x),$(call mklib,openal),$(call mklib,openal32))) +#link += $(if $(findstring audio.pulseaudio,$(ruby)),$(call mklib,pulse-simple)) +#link += $(if $(findstring input.directinput,$(ruby)),$(call mklib,dinput8) $(call mklib,dxguid)) +#link += $(if $(findstring input.rawinput,$(ruby)),$(call mklib,xinput) $(call mklib,dinput8) $(call mklib,dxguid)) #################### ### core objects ### @@ -103,13 +129,13 @@ objects = libco ruby libfilter string \ bsx srtc sdd1 spc7110 cx4 dsp1 dsp2 dsp3 dsp4 obc1 st010 ifeq ($(enable_gzip),true) - objects += adler32 compress crc32 deflate gzio inffast inflate inftrees ioapi trees unzip zip zutil - flags += $(call mkdef,GZIP_SUPPORT) + #objects += adler32 compress crc32 deflate gzio inffast inflate inftrees ioapi trees unzip zip zutil + #flags += $(call mkdef,GZIP_SUPPORT) endif ifeq ($(enable_jma),true) - objects += jma jcrc32 lzmadec 7zlzma iiostrm inbyte lzma winout - flags += $(call mkdef,JMA_SUPPORT) + #objects += jma jcrc32 lzmadec 7zlzma iiostrm inbyte lzma winout + #flags += $(call mkdef,JMA_SUPPORT) endif ###################### @@ -131,8 +157,9 @@ compile = \ all: build; include $(ui)/Makefile + objects := $(patsubst %,obj/%.$(obj),$(objects)) -rubydef := $(foreach c,$(subst .,_,$(call strupper,$(ruby))),$(call mkdef,$c)) +#rubydef := $(foreach c,$(subst .,_,$(call strupper,$(ruby))),$(call mkdef,$c)) ################# ### libraries ### @@ -246,7 +273,7 @@ obj/winout.$(obj) : reader/jma/winout.cpp reader/jma/* ############### build: ui_build $(objects) - gcc $(call mkbin,bsnes) $(objects) $(link) + g++ $(call mkbin,bsnes) $(objects) $(link) install: install -D -m 755 ../bsnes $(DESTDIR)$(prefix)/bin/bsnes diff --git a/tools/bsnes/lib/ruby/audio/openal.cpp b/tools/bsnes/lib/ruby/audio/openal.cpp index 69d811e..90c0698 100755 --- a/tools/bsnes/lib/ruby/audio/openal.cpp +++ b/tools/bsnes/lib/ruby/audio/openal.cpp @@ -1,6 +1,11 @@ -#include -#include +#ifdef __APPLE__ + #include + #include +#else + #include + #include +#endif namespace ruby { #include "openal.hpp" diff --git a/tools/bsnes/reader/zlib/inffast.c b/tools/bsnes/reader/zlib/inffast.c index de92735..8868d6e 100755 --- a/tools/bsnes/reader/zlib/inffast.c +++ b/tools/bsnes/reader/zlib/inffast.c @@ -8,7 +8,7 @@ #include "inflate.h" #include "inffast.h" -#ifdef __i386__ +#ifdef __FALSE__ void inflate_fast(strm, start) z_streamp strm; diff --git a/tools/bsnes/snes/input/input.hpp b/tools/bsnes/snes/input/input.hpp index 339f174..ac86b9b 100755 --- a/tools/bsnes/snes/input/input.hpp +++ b/tools/bsnes/snes/input/input.hpp @@ -75,11 +75,6 @@ public: ) ppu.latch_counters(); } } - -private: - bool iobit; - uint16_t latchx, latchy; - struct port_t { unsigned device; unsigned counter0; //read counters @@ -110,5 +105,11 @@ private: } justifier; } port[2]; + +private: + bool iobit; + uint16_t latchx, latchy; + friend class SNES; + } input; diff --git a/tools/bsnes/ui_qt/Makefile b/tools/bsnes/ui_qt/Makefile index 4ee4d8e..05bfa76 100755 --- a/tools/bsnes/ui_qt/Makefile +++ b/tools/bsnes/ui_qt/Makefile @@ -4,13 +4,28 @@ objects := main $(if $(call streq,$(platform),win),resource) $(objects) -moc = moc-qt4 -rcc = rcc +ifeq ($(platform),mac) + moc = moc + rcc = rcc + link +=-F/Developer/SDKs/Qt/lib \ + -L/Developer/SDKs/Qt/lib \ + -framework QtOpenGL \ + -framework QtGui \ + -framework Carbon \ + -framework AppKit \ + -framework QtCore + qtflags= -I/Developer/SDKs/Qt/include/ \ + -I/Developer/SDKs/Qt/include/Qt \ + -I/Developer/SDKs/Qt/include/QtCore \ + -I/Developer/SDKs/Qt/include/QtGui +endif ifeq ($(platform),x) # X11 - link += $(call mklib,Xtst) - link += `pkg-config --libs QtCore QtGui` - qtflags = `pkg-config --cflags QtCore QtGui` + moc = moc-qt4 + rcc = rcc + link += $(call mklib,Xtst) + link += `pkg-config --libs QtCore QtGui` + qtflags = `pkg-config --cflags QtCore QtGui` else ifeq ($(platform),win) # Windows qtdir = c:/qt450 diff --git a/tools/bsnes/ui_qt/platform.cpp b/tools/bsnes/ui_qt/platform.cpp index d3abb4e..9cdb339 100755 --- a/tools/bsnes/ui_qt/platform.cpp +++ b/tools/bsnes/ui_qt/platform.cpp @@ -93,7 +93,7 @@ //keycode of 255 does not map to any actual key, //but it will block screensaver and power management. Display *display = XOpenDisplay(0); - XTestFakeKeyEvent(display, 255, True, 0); - XTestFakeKeyEvent(display, 255, False, 0); + //XTestFakeKeyEvent(display, 255, True, 0); + //XTestFakeKeyEvent(display, 255, False, 0); } #endif