mirror of https://github.com/snes9xgit/snes9x.git
GTK+: Relative save slots.
This commit is contained in:
parent
9f795150fc
commit
cadffa0073
|
@ -158,6 +158,7 @@ int Snes9xConfig::load_defaults ()
|
|||
netplay_last_port = 6096;
|
||||
modal_dialogs = 1;
|
||||
use_headerbar = 0;
|
||||
current_save_slot = 0;
|
||||
S9xCheatsEnable ();
|
||||
|
||||
rewind_granularity = 5;
|
||||
|
@ -361,6 +362,7 @@ int Snes9xConfig::save_config_file ()
|
|||
outbool (cf, z"UseModalDialogs", modal_dialogs);
|
||||
cf.SetInt (z"RewindBufferSize", rewind_buffer_size, "Amount of memory (in MB) to use for rewinding");
|
||||
cf.SetInt (z"RewindGranularity", rewind_granularity, "Only save rewind snapshots every N frames");
|
||||
cf.SetInt (z"CurrentSaveSlot", current_save_slot);
|
||||
|
||||
#undef z
|
||||
#define z "Emulation::"
|
||||
|
@ -562,6 +564,7 @@ int Snes9xConfig::load_config_file ()
|
|||
inbool (z"UseModalDialogs", modal_dialogs);
|
||||
inint (z"RewindBufferSize", rewind_buffer_size);
|
||||
inint (z"RewindGranularity", rewind_granularity);
|
||||
inint (z"CurrentSaveSlot", current_save_slot);
|
||||
|
||||
#undef z
|
||||
#define z "Emulation::"
|
||||
|
|
|
@ -135,6 +135,8 @@ class Snes9xConfig
|
|||
unsigned int rewind_granularity;
|
||||
unsigned int rewind_buffer_size;
|
||||
|
||||
int current_save_slot;
|
||||
|
||||
XRRScreenResources *xrr_screen_resources;
|
||||
XRRCrtcInfo *xrr_crtc_info;
|
||||
|
||||
|
|
|
@ -57,6 +57,12 @@ const BindingLink b_links[] =
|
|||
{ "b_bg_layering_hack", "BGLayeringHack" },
|
||||
{ "b_screenshot", "Screenshot" },
|
||||
{ "b_fullscreen", "GTK_fullscreen" },
|
||||
{ "b_state_save_current", "GTK_state_save_current" },
|
||||
{ "b_state_load_current", "GTK_state_load_current" },
|
||||
{ "b_state_increment_save","GTK_state_increment_save" },
|
||||
{ "b_state_decrement_load","GTK_state_decrement_load" },
|
||||
{ "b_state_increment", "GTK_state_increment" },
|
||||
{ "b_state_decrement", "GTK_state_decrement" },
|
||||
{ "b_save_0", "QuickSave000" },
|
||||
{ "b_save_1", "QuickSave001" },
|
||||
{ "b_save_2", "QuickSave002" },
|
||||
|
@ -104,9 +110,9 @@ const int b_breaks[] =
|
|||
24, /* End of turbo/sticky buttons */
|
||||
35, /* End of base emulator buttons */
|
||||
43, /* End of Graphic options */
|
||||
63, /* End of save/load states */
|
||||
72, /* End of sound buttons */
|
||||
79, /* End of miscellaneous buttons */
|
||||
69, /* End of save/load states */
|
||||
78, /* End of sound buttons */
|
||||
85, /* End of miscellaneous buttons */
|
||||
-1
|
||||
};
|
||||
|
||||
|
@ -171,6 +177,19 @@ static void swap_controllers_1_2 ()
|
|||
gui_config->rebind_keys ();
|
||||
}
|
||||
|
||||
static void change_slot (int difference)
|
||||
{
|
||||
static char buf[256];
|
||||
|
||||
gui_config->current_save_slot += difference;
|
||||
gui_config->current_save_slot %= 1000;
|
||||
if (gui_config->current_save_slot < 0)
|
||||
gui_config->current_save_slot += 1000;
|
||||
snprintf (buf, 256, "Slot %d", gui_config->current_save_slot);
|
||||
S9xSetInfoString (buf);
|
||||
GFX.InfoStringTimeout = 60;
|
||||
}
|
||||
|
||||
void S9xHandlePortCommand (s9xcommand_t cmd, int16 data1, int16 data2)
|
||||
{
|
||||
static bool quit_binding_down = FALSE;
|
||||
|
@ -238,6 +257,38 @@ void S9xHandlePortCommand (s9xcommand_t cmd, int16 data1, int16 data2)
|
|||
{
|
||||
S9xQuickLoadSlot (cmd.port[0] - PORT_QUICKLOAD0);
|
||||
}
|
||||
|
||||
else if (cmd.port[0] == PORT_SAVESLOT)
|
||||
{
|
||||
S9xQuickSaveSlot (gui_config->current_save_slot);
|
||||
}
|
||||
|
||||
else if (cmd.port[0] == PORT_LOADSLOT)
|
||||
{
|
||||
S9xQuickLoadSlot (gui_config->current_save_slot);
|
||||
}
|
||||
|
||||
else if (cmd.port[0] == PORT_INCREMENTSAVESLOT)
|
||||
{
|
||||
change_slot (1);
|
||||
S9xQuickSaveSlot (gui_config->current_save_slot);
|
||||
}
|
||||
|
||||
else if (cmd.port[0] == PORT_DECREMENTLOADSLOT)
|
||||
{
|
||||
change_slot (-1);
|
||||
S9xQuickLoadSlot (gui_config->current_save_slot);
|
||||
}
|
||||
|
||||
else if (cmd.port[0] == PORT_INCREMENTSLOT)
|
||||
{
|
||||
change_slot (1);
|
||||
}
|
||||
|
||||
else if (cmd.port[0] == PORT_DECREMENTSLOT)
|
||||
{
|
||||
change_slot (-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -356,6 +407,37 @@ s9xcommand_t S9xGetPortCommandT (const char *name)
|
|||
cmd.port[0] = PORT_QUICKLOAD9;
|
||||
}
|
||||
|
||||
else if (strstr (name, "GTK_state_save_current"))
|
||||
{
|
||||
cmd.port[0] = PORT_SAVESLOT;
|
||||
}
|
||||
|
||||
else if (strstr (name, "GTK_state_load_current"))
|
||||
{
|
||||
cmd.port[0] = PORT_LOADSLOT;
|
||||
}
|
||||
|
||||
else if (strstr (name, "GTK_state_increment_save"))
|
||||
{
|
||||
cmd.port[0] = PORT_INCREMENTSAVESLOT;
|
||||
}
|
||||
|
||||
else if (strstr (name, "GTK_state_decrement_load"))
|
||||
{
|
||||
cmd.port[0] = PORT_DECREMENTLOADSLOT;
|
||||
}
|
||||
|
||||
else if (strstr (name, "GTK_state_increment"))
|
||||
{
|
||||
cmd.port[0] = PORT_INCREMENTSLOT;
|
||||
}
|
||||
|
||||
else if (strstr (name, "GTK_state_decrement"))
|
||||
{
|
||||
cmd.port[0] = PORT_DECREMENTSLOT;
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
cmd = S9xGetCommandT (name);
|
||||
|
|
|
@ -42,7 +42,13 @@ enum
|
|||
PORT_QUICKLOAD6 = 15,
|
||||
PORT_QUICKLOAD7 = 16,
|
||||
PORT_QUICKLOAD8 = 17,
|
||||
PORT_QUICKLOAD9 = 18
|
||||
PORT_QUICKLOAD9 = 18,
|
||||
PORT_SAVESLOT = 19,
|
||||
PORT_LOADSLOT = 20,
|
||||
PORT_INCREMENTSAVESLOT = 21,
|
||||
PORT_DECREMENTLOADSLOT = 22,
|
||||
PORT_INCREMENTSLOT = 23,
|
||||
PORT_DECREMENTSLOT = 24,
|
||||
};
|
||||
|
||||
typedef struct BindingLink
|
||||
|
@ -55,7 +61,7 @@ typedef struct BindingLink
|
|||
extern const BindingLink b_links[];
|
||||
extern const int b_breaks[];
|
||||
const int NUM_JOYPAD_LINKS = 24;
|
||||
const int NUM_EMU_LINKS = 55;
|
||||
const int NUM_EMU_LINKS = 61;
|
||||
|
||||
typedef struct JoypadBinding
|
||||
{
|
||||
|
|
|
@ -489,6 +489,9 @@ S9xQuickSaveSlot (int slot)
|
|||
char dir[_MAX_DIR];
|
||||
char ext[_MAX_EXT];
|
||||
|
||||
if (!gui_config->rom_loaded)
|
||||
return;
|
||||
|
||||
_splitpath (Memory.ROMFilename, drive, dir, def, ext);
|
||||
|
||||
snprintf (filename, PATH_MAX, "%s%s%s.%03d",
|
||||
|
@ -503,8 +506,7 @@ S9xQuickSaveSlot (int slot)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
S9xQuickLoadSlot (int slot)
|
||||
void S9xQuickLoadSlot (int slot)
|
||||
{
|
||||
char def[PATH_MAX];
|
||||
char filename[PATH_MAX];
|
||||
|
@ -512,6 +514,9 @@ S9xQuickLoadSlot (int slot)
|
|||
char dir[_MAX_DIR];
|
||||
char ext[_MAX_EXT];
|
||||
|
||||
if (!gui_config->rom_loaded)
|
||||
return;
|
||||
|
||||
_splitpath (Memory.ROMFilename, drive, dir, def, ext);
|
||||
|
||||
snprintf (filename, PATH_MAX, "%s%s%s.%03d",
|
||||
|
|
|
@ -7425,12 +7425,236 @@
|
|||
<property name="can_focus">False</property>
|
||||
<property name="resize_mode">queue</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkVBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">5</property>
|
||||
|
||||
<child>
|
||||
|
||||
<object class="GtkTable">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">10</property>
|
||||
<property name="n_rows">8</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="column_spacing">10</property>
|
||||
<property name="row_spacing">5</property>
|
||||
|
||||
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Save current slot</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="b_state_save_current">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">False</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">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Load current slot</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="b_state_load_current">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">False</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">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Increment and save</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="b_state_increment_save">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">False</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">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Decrement and load</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="b_state_decrement_load">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">False</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">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Increment slot</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="b_state_increment">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">False</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">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Decrement slot</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="b_state_decrement">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">False</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">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkTable" id="table10">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">10</property>
|
||||
<property name="n_rows">11</property>
|
||||
<property name="n_rows">14</property>
|
||||
<property name="n_columns">4</property>
|
||||
<property name="column_spacing">10</property>
|
||||
<property name="row_spacing">5</property>
|
||||
|
@ -8146,6 +8370,8 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
Loading…
Reference in New Issue