diff --git a/.gitignore b/.gitignore index 48ce6d22..874e1c61 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,6 @@ rom lsnes *.util /core +/bsnes src/fonts/font.cpp src/core/version.cpp diff --git a/Makefile b/Makefile index e01ee2e0..c9195840 100644 --- a/Makefile +++ b/Makefile @@ -1,62 +1,65 @@ -CROSS_PREFIX= -DOT_EXECUTABLE_SUFFIX= -OBJECT_SUFFIX = o -ARCHIVE_SUFFIX = a -FONT_SRC := unifontfull-5.1.20080820.hex +OPTIONS=options.build +include $(OPTIONS) -USER_CFLAGS= -USER_LDFLAGS= #Compilers. -CC := g++ -LD := ld REALCC = $(CROSS_PREFIX)$(CC) REALLD = $(CROSS_PREFIX)$(LD) -HOSTCC = $(CC) +REALRANLIB = $(CROSS_PREFIX)$(RANLIB) + +BSNES_PATH=$(shell pwd)/bsnes #Flags. HOSTCCFLAGS = -std=gnu++0x CFLAGS = -I$(BSNES_PATH) -std=gnu++0x $(USER_CFLAGS) -LDFLAGS = -lboost_iostreams-mt -lboost_filesystem-mt -lboost_system-mt -lboost_regex-mt -lz $(USER_LDFLAGS) - -#Platform -GRAPHICS=SDL -SOUND=SDL -JOYSTICK=SDL -THREADS=BOOST - -#bsnes -ifdef BSNES_VERSION -CFLAGS += -DBSNES_V$(BSNES_VERSION) +ifdef BOOST_NEEDS_MT +BOOST_LIB_POSTFIX=-mt +else +BOOST_LIB_POSTFIX= endif -#Threads -ifdef THREADS +LDFLAGS = -lboost_iostreams$(BOOST_LIB_POSTFIX) -lboost_filesystem$(BOOST_LIB_POSTFIX) -lboost_system$(BOOST_LIB_POSTFIX) -lboost_regex$(BOOST_LIB_POSTFIX) -lz $(USER_LDFLAGS) + ifeq ($(THREADS), NATIVE) CFLAGS += -DNATIVE_THREADS else ifeq ($(THREADS), BOOST) CFLAGS += -DBOOST_THREADS -ifdef BOOST_THREAD_LIB -LDFLAGS += -l$(BOOST_THREAD_LIB) -else -LDFLAGS += -lboost_thread-mt -endif +LDFLAGS += -lboost_thread$(BOOST_LIB_POSTFIX) else $(error "Bad value for THREADS (expected NATIVE or BOOST)") endif endif -endif ifdef BSNES_IS_COMPAT CFLAGS += -DBSNES_IS_COMPAT endif -export DOT_EXECUTABLE_SUFFIX OBJECT_SUFFIX ARCHIVE_SUFFIX FONT_SRC REALCC HOSTCC REALLD HOSTCCFLAGS CFLAGS LDFLAGS GRAPHICS SOUND JOYSTICK THREADS +export all: src/__all_files__ -src/__all_files__: src/core/version.cpp forcelook +ifeq ($(BSNES_VERSION), 087) +BSNES_TARGET_STRING=target=libsnes +else +BSNES_TARGET_STRING=ui=ui-libsnes +endif + +CFLAGS += -DBSNES_V${BSNES_VERSION} + +ifdef BSNES_IS_COMPAT +BSNES_PROFILE_STRING=profile=compatibility +else +BSNES_PROFILE_STRING=profile=accuracy +endif + +bsnes_compiler=$(subst ++,cc,$(REALCC)) + +bsnes/out/libsnes.$(ARCHIVE_SUFFIX): bsnes/snes/snes.hpp forcelook + $(MAKE) -C bsnes options=debugger $(BSNES_PROFILE_STRING) $(BSNES_TARGET_STRING) compiler=$(bsnes_compiler) + $(REALRANLIB) $@ + +src/__all_files__: src/core/version.cpp forcelook bsnes/out/libsnes.$(ARCHIVE_SUFFIX) $(MAKE) -C src precheck $(MAKE) -C src cp src/lsnes$(DOT_EXECUTABLE_SUFFIX) . @@ -68,6 +71,7 @@ src/core/version.cpp: buildaux/version.exe forcelook clean: + $(MAKE) -C bsnes clean $(MAKE) -C src clean forcelook: diff --git a/include/core/controllerframe.hpp b/include/core/controllerframe.hpp index 2f3388ad..7acff11e 100644 --- a/include/core/controllerframe.hpp +++ b/include/core/controllerframe.hpp @@ -1127,6 +1127,28 @@ public: * Returns: The state of autohold. */ bool autohold(unsigned port, unsigned pcid, unsigned pbid) throw(); +/** + * Reset all frame holds. + */ + void reset_framehold() throw(); +/** + * Manipulate hold for frame. + * + * Parameter port: The port. + * Parameter pcid: The physical controller ID to manipulate. + * Parameter pbid: The physical button ID to manipulate. + * Parameter newstate: The new state for framehold. + */ + void framehold(unsigned port, unsigned pcid, unsigned pbid, bool newstate) throw(); +/** + * Query hold for frame. + * + * Parameter port: The port. + * Parameter pcid: The physical controller ID to query. + * Parameter pbid: The physical button ID to query. + * Returns: The state of framehold. + */ + bool framehold(unsigned port, unsigned pcid, unsigned pbid) throw(); /** * Manipulate button. * @@ -1174,6 +1196,7 @@ private: porttype_t porttypes[MAX_PORTS]; controller_frame _input; controller_frame _autohold; + controller_frame _framehold; controller_frame _committed; std::vector _autofire; }; diff --git a/include/video/avi/codec.hpp b/include/video/avi/codec.hpp index c8046e08..f1cf22b2 100644 --- a/include/video/avi/codec.hpp +++ b/include/video/avi/codec.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "video/avi/structure.hpp" #include "video/avi/samplequeue.hpp" #include "video/avi/timer.hpp" diff --git a/manual.lyx b/manual.lyx index cba6fe38..9e1a3319 100644 --- a/manual.lyx +++ b/manual.lyx @@ -77,15 +77,15 @@ bsnes libsnes \begin_deeper \begin_layout Enumerate -v084 or 085 +v084-v087 (v084 or v085 for delayreset support) \end_layout \begin_layout Enumerate -accuracy or compatiblity core. +accuracy or compatiblity core with debugger enabled. \end_layout \begin_layout Enumerate -Patched version (using included 6 patches) +Patched version (using included 7 patches) \end_layout \end_deeper @@ -102,7 +102,7 @@ boost_filesystem \end_layout \begin_layout Enumerate -boost_thread +boost_thread (if native std::thread is not available) \end_layout \begin_layout Enumerate @@ -125,347 +125,42 @@ libswscale (wxwidgets graphics only) Portaudio (portaudio sound only) \end_layout -\begin_layout Enumerate -std::thread and co (for threaded dumper only, not needed if std::thread - is available) -\end_layout - \begin_layout Enumerate Lua (if Lua support is needed). \end_layout +\begin_deeper \begin_layout Itemize Version 5.1.X or 5.2X. \end_layout +\end_deeper +\begin_layout Enumerate +G++ 4.6 (bsnes doesn't seem to like 4.7). +\end_layout + \begin_layout Section Building \end_layout -\begin_layout Standard -Building is via makefile, the following options are available: -\end_layout - -\begin_layout Itemize -CROSS_PREFIX= -\end_layout - -\begin_deeper -\begin_layout Itemize -Prefix to apply to commands when building executables / object files for - the target architecture. - -\end_layout - -\begin_layout Itemize -Default is blank. -\end_layout - -\end_deeper -\begin_layout Itemize -CC= -\end_layout - -\begin_deeper -\begin_layout Itemize -Name of C++ compiler. -\end_layout - -\begin_layout Itemize -CROSS_PREFIX is prepended if compiling for target architecture. -\end_layout - -\begin_layout Itemize -This needs to be at least GCC 4.6. -\end_layout - -\begin_layout Itemize -Set to 'g++-mp-4.6' if compiling on Mac OS X using GCC 4.6 from Macports. -\end_layout - -\begin_layout Itemize -Default is 'g++'. -\end_layout - -\end_deeper -\begin_layout Itemize -HOSTCC= -\end_layout - -\begin_deeper -\begin_layout Itemize -Name of host C++ compiler. -\end_layout - -\begin_layout Itemize -Default is value of 'CC' option. -\end_layout - -\end_deeper -\begin_layout Itemize -USER_HOSTCCFLAGS=: -\end_layout - -\begin_deeper -\begin_layout Itemize -Compiler flags to pass when compiling/linking for host architecture. -\end_layout - -\begin_layout Itemize -Default is blank. -\end_layout - -\end_deeper -\begin_layout Itemize -USER_CFLAGS= -\end_layout - -\begin_deeper -\begin_layout Itemize -Extra flags to pass when compiling for target architecture -\end_layout - -\begin_layout Itemize -Default is blank. -\end_layout - -\end_deeper -\begin_layout Itemize -USER_LDFLAGS=: -\end_layout - -\begin_deeper -\begin_layout Itemize -Extra flags to pass when linking for target architecture. -\end_layout - -\begin_layout Itemize -Default is blank. -\end_layout - -\end_deeper -\begin_layout Itemize -USER_PLATFORM_CFLAGS= -\end_layout - -\begin_deeper -\begin_layout Itemize -Extra flags to pass when compiling files using platform-dependent code for - target architecture. -\end_layout - -\begin_layout Itemize -Default is blank. -\end_layout - -\end_deeper -\begin_layout Itemize -USER_PLATFORM_LDFLAGS= -\end_layout - -\begin_deeper -\begin_layout Itemize -Extra flags to pass when linking files using platform-dependent code for - target architecture. -\end_layout - -\begin_layout Itemize -Default is blank. -\end_layout - -\end_deeper -\begin_layout Itemize -FONT_SRC= -\end_layout - -\begin_deeper -\begin_layout Itemize -Set the font file to use. -\end_layout - -\begin_layout Itemize -Currently the valid values are: -\end_layout - -\begin_deeper -\begin_layout Itemize -cp437.hex: Standard VGA font (256 characters). -\end_layout - -\begin_layout Itemize -unifontfull-5.1.20080820.hex: GNU unifont (covers most of Unicode BMP) -\end_layout - -\end_deeper -\begin_layout Itemize -Default is 'unifontfull-5.1.20080820.hex' -\end_layout - -\end_deeper -\begin_layout Itemize -LUA= -\end_layout - -\begin_deeper -\begin_layout Itemize -Package to use for Lua support. -\end_layout - -\begin_layout Itemize -Usually valid value is 'lua' or 'lua5.1'. -\end_layout - -\begin_layout Itemize -Default is not to build Lua support. -\end_layout - -\end_deeper -\begin_layout Itemize -THREADS= -\end_layout - -\begin_deeper -\begin_layout Itemize -Override platform default for dumper threading support. -\end_layout - -\begin_layout Itemize -Threading is default on Linux. -\end_layout - -\begin_layout Itemize -'YES' tries to use threading (std::thread). -\end_layout - -\begin_layout Itemize -'BOOST' tries to use threading (boost::thread). -\end_layout - -\begin_layout Itemize -'NO' disables threading. -\end_layout - -\begin_layout Itemize -Note: This has absolutely nothing to do with platform threading. -\end_layout - -\end_deeper -\begin_layout Itemize -BSNES_IS_COMPAT= -\end_layout - -\begin_deeper -\begin_layout Itemize -Signals that BSNES core used is compatiblity core, not accuracy core. -\end_layout - -\begin_layout Itemize -Default is to assume accuracy core. -\end_layout - -\end_deeper -\begin_layout Itemize -SECRET_RABBIT_CODE= -\end_layout - -\begin_deeper -\begin_layout Itemize -Signals that SRC (a.k.a. - libsamplerate) should be used for high-quality samplerate conversions. -\end_layout - -\end_deeper -\begin_layout Itemize -JOYSTICK= -\end_layout - -\begin_deeper -\begin_layout Itemize -Set joystick implementation. - Valid values are: -\end_layout - -\begin_deeper -\begin_layout Itemize -SDL: Use SDL for joystick (requires SDL graphics) -\end_layout - -\begin_layout Itemize -EVDEV: Use EVDEV for joystick (Linux only). -\end_layout - -\begin_layout Itemize -WIN32MM: Use Win32mm for joystick (Windows only). -\end_layout - -\begin_layout Itemize -WXWIDGETS: Use Wxwidgets for joystick (requires WXWIDGETS graphics) -\end_layout - -\begin_layout Itemize -DUMMY: Disable joystick support. -\end_layout - -\end_deeper -\begin_layout Itemize -Default is SDL. -\end_layout - -\end_deeper -\begin_layout Itemize -SOUND= -\end_layout - -\begin_deeper -\begin_layout Itemize -Set sound implementation. - Valid values are: -\end_layout - -\begin_deeper -\begin_layout Itemize -SDL: Use SDL for sound (requires SDL graphics) -\end_layout - -\begin_layout Itemize -PORTAUDIO: Use Portaudio for sound. -\end_layout - -\begin_layout Itemize -DUMMY: Disable sound support -\end_layout - -\end_deeper -\begin_layout Itemize -Default is SDL. -\end_layout - -\end_deeper -\begin_layout Itemize -GRAPHICS= -\end_layout - -\begin_deeper \begin_layout Itemize -Set windowing library to use. - Valid values are: +Copy bsnes sources (the bsnes subdirectory) to subdirectory 'bsnes'. \end_layout -\begin_deeper \begin_layout Itemize -SDL: Use SDL for graphics +Patch the bsnes sources with included patches (directory 'bsnes-patches/') \end_layout \begin_layout Itemize -WXWIDGETS: Use wxWidgets for graphics. +Edit options.build (or copy of that file) \end_layout -\end_deeper \begin_layout Itemize -Default is SDL. +Run make (passing 'OPTIONS=' if using something else than options.build +). \end_layout -\end_deeper \begin_layout Section Command line options \end_layout @@ -1642,6 +1337,15 @@ Hold/unhold button