Merge branch 'rr1-maint'

Conflicts:
	src/core/controller.cpp
	src/core/controllerframe.cpp
This commit is contained in:
Ilari Liusvaara 2012-05-13 02:07:22 +03:00
commit fb203e1fc4
16 changed files with 290 additions and 529 deletions

1
.gitignore vendored
View file

@ -9,5 +9,6 @@ rom
lsnes
*.util
/core
/bsnes
src/fonts/font.cpp
src/core/version.cpp

View file

@ -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:

View file

@ -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<controller_frame> _autofire;
};

View file

@ -4,6 +4,7 @@
#include <cstdint>
#include <vector>
#include <cstdlib>
#include <map>
#include "video/avi/structure.hpp"
#include "video/avi/samplequeue.hpp"
#include "video/avi/timer.hpp"

View file

@ -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=<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=<name>
\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=<name>
\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=<flags>:
\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=<flags>
\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=<flags>:
\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=<flags>
\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=<flags>
\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=<file>
\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=<package>
\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=<value>
\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=<anything>
\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=<anything>
\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=<implementation>
\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=<implementation>
\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=<implementation>
\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/<version
>')
\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=<filename>' 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 <button> on controller <num> (1-8).
See +controller for button names.
\end_layout
\begin_layout Subsubsection
controllerf<num><button>
\end_layout
\begin_layout Standard
Hold/unhold button <button> on controller <num> (1-8) for the next frame.
See +controller for button names.
\end_layout
\begin_layout Subsubsection
autofire (<pattern>|-)...
\end_layout

View file

@ -6,11 +6,11 @@ lsnes is SNES rerecording emulator based on bsnes core.
1. bsnes libsnes
(a) v084 or 085
(a) v084-v087 (v084 or v085 for delayreset support)
(b) accuracy or compatiblity core.
(b) accuracy or compatiblity core with debugger enabled.
(c) Patched version (using included 6 patches)
(c) Patched version (using included 7 patches)
2. Zlib
@ -18,7 +18,7 @@ lsnes is SNES rerecording emulator based on bsnes core.
4. boost_filesystem
5. boost_thread
5. boost_thread (if native std::thread is not available)
6. libsdl (SDL only)
@ -30,163 +30,24 @@ lsnes is SNES rerecording emulator based on bsnes core.
10. Portaudio (portaudio sound only)
11. std::thread and co (for threaded dumper only, not needed if
std::thread is available)
11. Lua (if Lua support is needed).
12. Lua (if Lua support is needed).
• Version 5.1.X or 5.2X.
• Version 5.1.X or 5.2X.
12. G++ 4.6 (bsnes doesn't seem to like 4.7).
3 Building
Building is via makefile, the following options are available:
• Copy bsnes sources (the bsnes subdirectory) to subdirectory
'bsnes'.
• CROSS_PREFIX=<prefix>
• Patch the bsnes sources with included patches (directory
'bsnes-patches/<version>')
Prefix to apply to commands when building executables /
object files for the target architecture.
• Edit options.build (or copy of that file)
Default is blank.
• CC=<name>
Name of C++ compiler.
CROSS_PREFIX is prepended if compiling for target
architecture.
This needs to be at least GCC 4.6.
Set to 'g++-mp-4.6' if compiling on Mac OS X using GCC 4.6
from Macports.
Default is 'g++'.
• HOSTCC=<name>
Name of host C++ compiler.
Default is value of 'CC' option.
• USER_HOSTCCFLAGS=<flags>:
Compiler flags to pass when compiling/linking for host
architecture.
Default is blank.
• USER_CFLAGS=<flags>
Extra flags to pass when compiling for target architecture
Default is blank.
• USER_LDFLAGS=<flags>:
Extra flags to pass when linking for target architecture.
Default is blank.
• USER_PLATFORM_CFLAGS=<flags>
Extra flags to pass when compiling files using
platform-dependent code for target architecture.
Default is blank.
• USER_PLATFORM_LDFLAGS=<flags>
Extra flags to pass when linking files using
platform-dependent code for target architecture.
Default is blank.
• FONT_SRC=<file>
Set the font file to use.
Currently the valid values are:
cp437.hex: Standard VGA font (256 characters).
unifontfull-5.1.20080820.hex: GNU unifont (covers most of
Unicode BMP)
Default is 'unifontfull-5.1.20080820.hex'
• LUA=<package>
Package to use for Lua support.
Usually valid value is 'lua' or 'lua5.1'.
Default is not to build Lua support.
• THREADS=<value>
Override platform default for dumper threading support.
Threading is default on Linux.
'YES' tries to use threading (std::thread).
'BOOST' tries to use threading (boost::thread).
'NO' disables threading.
Note: This has absolutely nothing to do with platform
threading.
• BSNES_IS_COMPAT=<anything>
Signals that BSNES core used is compatiblity core, not
accuracy core.
Default is to assume accuracy core.
• SECRET_RABBIT_CODE=<anything>
Signals that SRC (a.k.a. libsamplerate) should be used for
high-quality samplerate conversions.
• JOYSTICK=<implementation>
Set joystick implementation. Valid values are:
SDL: Use SDL for joystick (requires SDL graphics)
EVDEV: Use EVDEV for joystick (Linux only).
WIN32MM: Use Win32mm for joystick (Windows only).
WXWIDGETS: Use Wxwidgets for joystick (requires WXWIDGETS
graphics)
DUMMY: Disable joystick support.
Default is SDL.
• SOUND=<implementation>
Set sound implementation. Valid values are:
SDL: Use SDL for sound (requires SDL graphics)
PORTAUDIO: Use Portaudio for sound.
DUMMY: Disable sound support
Default is SDL.
• GRAPHICS=<implementation>
Set windowing library to use. Valid values are:
SDL: Use SDL for graphics
WXWIDGETS: Use wxWidgets for graphics.
Default is SDL.
• Run make (passing 'OPTIONS=<filename>' if using something else
than options.build).
4 Command line options
@ -787,14 +648,19 @@ button names are known:
Hold/unhold button <button> on controller <num> (1-8). See
+controller for button names.
6.7.27 autofire (<pattern>|-)...
6.7.27 controllerf<num><button>
Hold/unhold button <button> on controller <num> (1-8) for the
next frame. See +controller for button names.
6.7.28 autofire (<pattern>|-)...
Set autofire pattern. Each parameter is comma-separated list of
button names (in form of 1start, 1A, 2B, etc..) to hold on that
frame. After reaching the end of pattern, the pattern restarts
from the beginning.
6.7.28 repaint
6.7.29 repaint
Force a repaint.

116
options.build Normal file
View file

@ -0,0 +1,116 @@
#
# Host system:
# - The system lsnes is being built on.
# Target system:
# - The system the built lsnes will run on.
# - If not crosscompiling, this is the same as host system.
#
# Prefix to apply to compiler commands for the target system.
CROSS_PREFIX=
# Postfix for object files
OBJECT_SUFFIX=o
# Postfix for archive files
ARCHIVE_SUFFIX=a
# Postfix (including possible '.') for executable files.
# Usually blank for any unix-type system, '.exe' for Windows.
DOT_EXECUTABLE_SUFFIX=
# C++ compiler (GCC 4.6)
# CROSS_PREFIX is prepended to this.
CC=g++-4.6
# Linker for target system.
# CROSS_PREFIX is prepended to this.
LD=ld
# Ranlib for target system.
# CROSS_PREFIX is prepended to this.
RANLIB=ranlib
# Host system C++ compiler.
# If not crosscompiling, build host system and target system are one and the same.
# $(CC) means the same compiler as main C++ compiler to use (but without prefix). Otherwise, set to host C++ compiler.
HOSTCC=$(CC)
# Host C++ compiler/linker flags.
USER_HOSTCCFLAGS=
# C++ complier extra flags.
USER_CFLAGS=-g
# Linker extra flags.
USER_LDFLAGS=
# C++ compiler extra flags for platform code.
USER_PLATFORM_CFLAGS=
# Linker extra flags for platform code.
USER_PLATFORM_LDFLAGS=
# The name of font file to use.
# Currently supported:
# - cp437.hex: Standard VGA font (256 characters).
# - unifontfull-5.1.20080820.hex: GNU unifont (covers most of Unicode BMP)
FONT_SRC=unifontfull-5.1.20080820.hex
# Lua package to use.
# - Usually either 'lua' or 'lua5.1'.
# - Empty value disables Lua support.
LUA=lua
# Threading package to use.
# Currently supported:
# - NATIVE: std::thread
# - BOOST: boost_thread
THREADS=BOOST
# Graphics library to use.
# Currently supported:
# - SDL: Simple Directmedia Layer.
# - WXWIDGETS: wxWidgets
GRAPHICS=WXWIDGETS
# Sound library to use.
# Currently supported:
# - DUMMY: No sound.
# - SDL: Simple Directmedia Layer (GRAPHICS=SDL only).
# - PORTAUDIO: Portaudio.
SOUND=PORTAUDIO
# Joystick library to use.
# Currently supported:
# - DUMMY: No joystick.
# - EVDEV: EVDEV (Linux only)
# - WIN32MM: Windows Multimedia (Win32 only).
# - SDL: Simple Directmedia Layer (GRAPHICS=SDL only).
# - WXWIDGETS: wxWidgets (GRAPHICS=WXWIDGETS only)
JOYSTICK=DUMMY
# Enable use of Secret Rabbit Code (a.k.a. libsamperate).
# Set to non-blank (e.g. 'yes') to enable.
SECRET_RABBIT_CODE=
# Bsnes version used.
# 087 has different layout from the rest.
BSNES_VERSION=085
# Bsnes build uses compatiblity core, not accuracy core.
# Set to non-empty value (e.g. 'yes') if so.
BSNES_IS_COMPAT=
# Do boost libraries need the '-mt' prefix?
# Set to non-empty value (e.g. 'yes') if so.
BOOST_NEEDS_MT=
# Does the linker not need -rdynamic to export the symbols?
# Set to non-empty value (e.g. 'yes') if so.
NO_RDYNAMIC=
# Disable use of DLFCN.
# Set to non-empty value (e.g. 'yes') if so.
NO_DLFCN=

View file

@ -7,6 +7,8 @@ LDFLAGS += -rdynamic
endif
ifdef NO_DLFCN
CFLAGS += -DNO_DLFCN
else
LDFLAGS += -ldl
endif
DUMMY_LIBRARY=core lua fonts interface library video dummy

View file

@ -30,7 +30,7 @@ namespace
}
//Do button action.
void do_button_action(unsigned ui_id, unsigned button, short newstate, bool autoh)
void do_button_action(unsigned ui_id, unsigned button, short newstate, int mode)
{
auto x = controls.lcid_to_pcid(ui_id);
if(x.first < 0) {
@ -42,11 +42,22 @@ namespace
messages << "Invalid button for controller type" << std::endl;
return;
}
if(autoh) {
if(mode == 1) {
//Autohold.
controls.autohold(x.first, x.second, bid, controls.autohold(x.first, x.second, bid) ^
newstate);
information_dispatch::do_autohold_update(x.first, x.second, bid, controls.autohold(x.first,
x.second, bid));
} else if(mode == 2) {
//Framehold.
bool nstate = controls.framehold(x.first, x.second, bid) ^ newstate;
controls.framehold(x.first, x.second, bid, nstate);
if(nstate)
messages << "Holding " << (ui_id + 1) << get_logical_button_name(button)
<< " for the next frame" << std::endl;
else
messages << "Not holding " << (ui_id + 1) << get_logical_button_name(button)
<< " for the next frame" << std::endl;
} else
controls.button(x.first, x.second, bid, newstate);
}
@ -132,7 +143,14 @@ namespace
if(!buttonmap.count(button))
return;
auto i = buttonmap[button];
do_button_action(i.first, i.second, (type != 1) ? 1 : 0, (type == 2));
if(type == 0)
do_button_action(i.first, i.second, 1, 0);
else if(type == 1)
do_button_action(i.first, i.second, 0, 0);
else if(type == 2)
do_button_action(i.first, i.second, 1, 1);
else if(type == 3)
do_button_action(i.first, i.second, 1, 2);
update_movie_state();
information_dispatch::do_status_update();
}
@ -183,7 +201,7 @@ namespace
button_action_helper()
{
for(size_t i = 0; i < MAX_LOGICAL_BUTTONS; ++i)
for(int j = 0; j < 3; ++j)
for(int j = 0; j < 4; ++j)
for(unsigned k = 0; k < 8; ++k) {
stringfmt x, y, expx;
switch(j) {
@ -196,6 +214,9 @@ namespace
case 2:
x << "controllerh";
break;
case 3:
x << "controllerf";
break;
};
x << (k + 1) << get_logical_button_name(i);
y << (k + 1) << get_logical_button_name(i);
@ -203,6 +224,12 @@ namespace
our_commands.insert(new button_action(x.str(), j, k, y.str()));
if(j == 0)
our_icommands.insert(new inverse_key(x.str(), expx.str()));
if(j == 2)
our_icommands.insert(new inverse_key(x.str(), expx.str() +
" (hold)"));
if(j == 3)
our_icommands.insert(new inverse_key(x.str(), expx.str() +
" (typed)"));
}
for(unsigned k = 0; k < 8; ++k) {
stringfmt x, expx;

View file

@ -862,9 +862,9 @@ devicetype_t controller_state::pcid_to_type(unsigned port, unsigned pcid) throw(
controller_frame controller_state::get(uint64_t framenum) throw()
{
if(_autofire.size())
return _input ^ _autohold ^ _autofire[framenum % _autofire.size()];
return _input ^ _framehold ^ _autohold ^ _autofire[framenum % _autofire.size()];
else
return _input ^ _autohold;
return _input ^ _framehold ^ _autohold;
}
void controller_state::analog(unsigned port, unsigned pcid, int x, int y) throw()
@ -895,6 +895,21 @@ bool controller_state::autohold(unsigned port, unsigned pcid, unsigned pbid) thr
return (_autohold.axis(port, pcid, pbid) != 0);
}
void controller_state::reset_framehold() throw()
{
_framehold = _framehold.blank_frame();
}
void controller_state::framehold(unsigned port, unsigned pcid, unsigned pbid, bool newstate) throw()
{
_framehold.axis(port, pcid, pbid, newstate ? 1 : 0);
}
bool controller_state::framehold(unsigned port, unsigned pcid, unsigned pbid) throw()
{
return (_framehold.axis(port, pcid, pbid) != 0);
}
void controller_state::button(unsigned port, unsigned pcid, unsigned pbid, bool newstate) throw()
{
_input.axis(port, pcid, pbid, newstate ? 1 : 0);
@ -931,6 +946,7 @@ void controller_state::set_port(unsigned port, porttype_t ptype, bool set_core)
_input.set_port_type(port, ptype);
_autohold.set_port_type(port, ptype);
_committed.set_port_type(port, ptype);
_framehold.set_port_type(port, ptype);
//The old autofire pattern no longer applies.
_autofire.clear();
}

View file

@ -782,6 +782,7 @@ namespace
if(cycles == 0)
messages << "SNES reset" << std::endl;
else if(cycles > 0) {
#if defined(BSNES_V084) || defined(BSNES_V085)
messages << "Executing delayed reset... This can take some time!" << std::endl;
delayreset_cycles_run = 0;
delayreset_cycles_target = cycles;
@ -792,6 +793,10 @@ namespace
messages << "SNES reset (delayed " << delayreset_cycles_run << ")" << std::endl;
else
messages << "SNES reset (forced at " << delayreset_cycles_run << ")" << std::endl;
#else
messages << "Delayresets not supported on this bsnes version (needs v084 or v085)"
<< std::endl;
#endif
}
SNES::system.reset();
lua_callback_do_reset();
@ -869,6 +874,7 @@ void main_loop(struct loaded_rom& rom, struct moviefile& initial, bool load_has_
amode = ADVANCE_SKIPLAG;
if(!first_round) {
controls.reset_framehold();
resetcycles = movb.new_frame_starting(amode == ADVANCE_SKIPLAG);
if(amode == ADVANCE_QUIT && queued_saves.empty())
break;
@ -890,6 +896,7 @@ void main_loop(struct loaded_rom& rom, struct moviefile& initial, bool load_has_
else
amode = old_mode;
just_did_loadstate = first_round;
controls.reset_framehold();
continue;
} else if(r < 0) {
//Not exactly desriable, but this at least won't desync.

View file

@ -1,4 +1,4 @@
OBJECTS=$(patsubst %.cpp,%.$(OBJECT_SUFFIX),$(wildcard *.cpp)) avi/__all__.o
OBJECTS=$(patsubst %.cpp,%.$(OBJECT_SUFFIX),$(wildcard *.cpp)) avi/__all__.$(OBJECT_SUFFIX)
ifdef SECRET_RABBIT_CODE
AVI_CFLAGS=-DWITH_SECRET_RABBIT_CODE
@ -7,8 +7,6 @@ endif
.PRECIOUS: %.$(OBJECT_SUFFIX)
export VIDEO_CFLAGS
__all__.$(OBJECT_SUFFIX): $(OBJECTS)
$(REALLD) -r -o $@ $^
echo $(AVI_LDFLAGS) >__all__.ldflags

View file

@ -1,15 +1,15 @@
OBJECTS=$(patsubst %.cpp,%.$(OBJECT_SUFFIX),$(wildcard *.cpp)) codec/__all__.o
OBJECTS=$(patsubst %.cpp,%.$(OBJECT_SUFFIX),$(wildcard *.cpp)) codec/__all__.$(OBJECT_SUFFIX)
.PRECIOUS: %.$(OBJECT_SUFFIX)
__all__.o: $(OBJECTS)
__all__.$(OBJECT_SUFFIX): $(OBJECTS)
$(REALLD) -r -o $@ $^
codec/__all__.o: forcelook
codec/__all__.$(OBJECT_SUFFIX): forcelook
$(MAKE) -C codec
%.$(OBJECT_SUFFIX): %.cpp
$(REALCC) $(CFLAGS) -c -o $@ $< -I../../../include $(VIDEO_CLFAGS)
$(REALCC) $(CFLAGS) -c -o $@ $< -I../../../include
forcelook:
@true

View file

@ -12,7 +12,7 @@ video/__all__.$(OBJECT_SUFFIX): forcelook
$(MAKE) -C video
%.$(OBJECT_SUFFIX): %.cpp
$(REALCC) $(CFLAGS) -c -o $@ $< -I../../include $(VIDEO_CLFAGS)
$(REALCC) $(CFLAGS) -c -o $@ $< -I../../include
forcelook:
@true

View file

@ -2,13 +2,11 @@ OBJECTS=$(patsubst %.cpp,%.$(OBJECT_SUFFIX),$(wildcard *.cpp))
.PRECIOUS: %.$(OBJECT_SUFFIX)
export VIDEO_CFLAGS
__all__.o: $(OBJECTS)
__all__.$(OBJECT_SUFFIX): $(OBJECTS)
$(REALLD) -r -o $@ $^
%.$(OBJECT_SUFFIX): %.cpp
$(REALCC) $(CFLAGS) -c -o $@ $< -I../../../../../include $(VIDEO_CLFAGS)
$(REALCC) $(CFLAGS) -c -o $@ $< -I../../../../../include
precheck:
@true

View file

@ -2,13 +2,11 @@ OBJECTS=$(patsubst %.cpp,%.$(OBJECT_SUFFIX),$(wildcard *.cpp))
.PRECIOUS: %.$(OBJECT_SUFFIX)
export VIDEO_CFLAGS
__all__.o: $(OBJECTS)
__all__.$(OBJECT_SUFFIX): $(OBJECTS)
$(REALLD) -r -o $@ $^
%.$(OBJECT_SUFFIX): %.cpp
$(REALCC) $(CFLAGS) -c -o $@ $< -I../../../../../include $(VIDEO_CLFAGS)
$(REALCC) $(CFLAGS) -c -o $@ $< -I../../../../../include
precheck:
@true