Merge branch 'juhalaukken-master'

This commit is contained in:
Brandon Wright 2016-10-08 21:16:27 -05:00
commit 27cf1b4f47
9 changed files with 71 additions and 4 deletions

View File

@ -173,7 +173,8 @@ snes9x_gtk_SOURCES += \
../logger.cpp \
../snapshot.cpp \
../screenshot.cpp \
../movie.cpp
../movie.cpp \
../statemanager.cpp
# ASMCPU Doesn't exist anymore.
snes9x_gtk_SOURCES += \

View File

@ -175,6 +175,9 @@ Snes9xConfig::load_defaults (void)
netplay_last_host [0] = '\0';
netplay_last_port = 6096;
modal_dialogs = 1;
rewindGranularity = 5;
rewindBufferSize = 150;
#ifdef USE_OPENGL
sync_to_vblank = 1;

View File

@ -133,6 +133,9 @@ class Snes9xConfig
int pointer_is_visible;
struct timeval pointer_timestamp;
unsigned int rewindGranularity;
unsigned int rewindBufferSize;
#ifdef USE_XRANDR
XRRScreenConfiguration *xrr_config;

View File

@ -89,6 +89,7 @@ const BindingLink b_links[] =
{ "b_load_movie", "LoadMovie" },
{ "b_seek_to_frame", "GTK_seek_to_frame" },
{ "b_swap_controllers", "GTK_swap_controllers" },
{ "b_rewind", "GTK_rewind" },
{ NULL, NULL }
};
@ -193,6 +194,8 @@ S9xHandlePortCommand (s9xcommand_t cmd, int16 data1, int16 data2)
{
if (cmd.port[0] == PORT_QUIT)
quit_binding_down = TRUE;
else if (cmd.port[0] == PORT_REWIND)
top_level->user_rewind = TRUE;
}
if (data1 == FALSE) /* Release */
@ -225,6 +228,11 @@ S9xHandlePortCommand (s9xcommand_t cmd, int16 data1, int16 data2)
top_level->unpause_from_user ();
}
else if (cmd.port[0] == PORT_REWIND)
{
top_level->user_rewind = FALSE;
}
else if (cmd.port[0] == PORT_SEEK_TO_FRAME)
{
top_level->movie_seek_dialog ();
@ -307,6 +315,11 @@ S9xGetPortCommandT (const char *name)
cmd.port[0] = PORT_SWAP_CONTROLLERS;
}
else if (!strcasecmp (name, "GTK_rewind"))
{
cmd.port[0] = PORT_REWIND;
}
else
{
cmd = S9xGetCommandT (name);

View File

@ -26,6 +26,7 @@
#define PORT_SEEK_TO_FRAME 5
#define PORT_QUIT 6
#define PORT_SWAP_CONTROLLERS 7
#define PORT_REWIND 8
typedef struct BindingLink
{
@ -37,7 +38,7 @@ typedef struct BindingLink
extern const BindingLink b_links[];
extern const int b_breaks[];
#define NUM_JOYPAD_LINKS 24
#define NUM_EMU_LINKS 52
#define NUM_EMU_LINKS 53
typedef struct JoypadBinding
{

View File

@ -9,6 +9,8 @@
#include "gtk_sound.h"
#include "gtk_display.h"
#include "statemanager.h"
#ifdef NETPLAY_SUPPORT
#include "gtk_netplay.h"
#endif
@ -23,6 +25,7 @@ static gboolean S9xScreenSaverCheckFunc (gpointer data);
Snes9xWindow *top_level;
Snes9xConfig *gui_config;
StateManager stateMan;
static struct timeval next_frame_time = { 0, 0 };
static struct timeval now;
static int needs_fullscreening = FALSE;
@ -219,6 +222,12 @@ S9xOpenROM (const char *rom_filename)
CPU.Flags = flags;
if (gui_config->rewindBufferSize)
{
printf("Setting buffer size to %u\n", gui_config->rewindBufferSize * 1024 * 1024);
stateMan.init(gui_config->rewindBufferSize * 1024 * 1024);
}
S9xROMLoaded ();
return 0;
@ -356,6 +365,11 @@ S9xIdleFunc (gpointer data)
{
#endif
if(top_level->user_rewind)
top_level->user_rewind = stateMan.pop();
else if(IPPU.TotalEmulatedFrames % gui_config->rewindGranularity == 0)
stateMan.push();
static int muted_from_turbo = FALSE;
static int mute_saved_state = FALSE;
@ -372,7 +386,6 @@ S9xIdleFunc (gpointer data)
Settings.Mute = mute_saved_state;
}
S9xMainLoop ();
S9xMixSound ();

View File

@ -588,6 +588,7 @@ Snes9xWindow::Snes9xWindow (Snes9xConfig *config) :
};
user_pause = 0;
user_rewind = 0;
sys_pause = 0;
last_width = -1;
last_height = -1;

View File

@ -64,6 +64,7 @@ class Snes9xWindow : public GtkBuilderWindow
Snes9xConfig *config;
int user_pause, sys_pause;
int user_rewind;
int last_width, last_height;
int mouse_region_x, mouse_region_y;
int mouse_region_width, mouse_region_height;

View File

@ -8043,7 +8043,7 @@
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">10</property>
<property name="n_rows">6</property>
<property name="n_rows">7</property>
<property name="n_columns">2</property>
<property name="column_spacing">10</property>
<property name="row_spacing">5</property>
@ -8239,6 +8239,37 @@
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label177">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Rewind</property>
</object>
<packing>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkEntry" id="b_rewind">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</object>
<packing>
<property name="position">4</property>