included stave states menus (not complete)

This commit is contained in:
damdoum 2007-01-18 10:39:33 +00:00
parent ec0299ff6f
commit c4481ce975
7 changed files with 358 additions and 31 deletions

View File

@ -510,7 +510,7 @@ static INLINE void GPU_ligne(Screen * screen, u16 l)
if (gpu->sprEnable && gpu->dispOBJ) { if (gpu->sprEnable && gpu->dispOBJ) {
// nothing else to display but sprites... // nothing else to display but sprites...
if(!gpu->nbBGActif) { if(0==1 && !gpu->nbBGActif) {
gpu->spriteRender(gpu, l, dst, sprPrio); gpu->spriteRender(gpu, l, dst, sprPrio);
return; return;
} }

View File

@ -127,6 +127,30 @@ void on_menu_pscreen_activate (GtkMenuItem *menuitem, gpointer user_data) { Wr
void on_menu_quit_activate (GtkMenuItem *menuitem, gpointer user_data) { gtk_main_quit(); } void on_menu_quit_activate (GtkMenuItem *menuitem, gpointer user_data) { gtk_main_quit(); }
/* MENU SAVES ***** ***** ***** ***** */
void on_loadstate1_activate (GtkMenuItem *m, gpointer d) { loadstate_slot(1); }
void on_loadstate2_activate (GtkMenuItem *m, gpointer d) { loadstate_slot(2); }
void on_loadstate3_activate (GtkMenuItem *m, gpointer d) { loadstate_slot(3); }
void on_loadstate4_activate (GtkMenuItem *m, gpointer d) { loadstate_slot(4); }
void on_loadstate5_activate (GtkMenuItem *m, gpointer d) { loadstate_slot(5); }
void on_loadstate6_activate (GtkMenuItem *m, gpointer d) { loadstate_slot(6); }
void on_loadstate7_activate (GtkMenuItem *m, gpointer d) { loadstate_slot(7); }
void on_loadstate8_activate (GtkMenuItem *m, gpointer d) { loadstate_slot(8); }
void on_loadstate9_activate (GtkMenuItem *m, gpointer d) { loadstate_slot(9); }
void on_loadstate10_activate(GtkMenuItem *m, gpointer d) { loadstate_slot(10); }
void on_savestate1_activate (GtkMenuItem *m, gpointer d) { savestate_slot(1); }
void on_savestate2_activate (GtkMenuItem *m, gpointer d) { savestate_slot(2); }
void on_savestate3_activate (GtkMenuItem *m, gpointer d) { savestate_slot(3); }
void on_savestate4_activate (GtkMenuItem *m, gpointer d) { savestate_slot(4); }
void on_savestate5_activate (GtkMenuItem *m, gpointer d) { savestate_slot(5); }
void on_savestate6_activate (GtkMenuItem *m, gpointer d) { savestate_slot(6); }
void on_savestate7_activate (GtkMenuItem *m, gpointer d) { savestate_slot(7); }
void on_savestate8_activate (GtkMenuItem *m, gpointer d) { savestate_slot(8); }
void on_savestate9_activate (GtkMenuItem *m, gpointer d) { savestate_slot(9); }
void on_savestate10_activate(GtkMenuItem *m, gpointer d) { savestate_slot(10); }
/* MENU EMULATION ***** ***** ***** ***** */ /* MENU EMULATION ***** ***** ***** ***** */
void on_menu_exec_activate (GtkMenuItem *menuitem, gpointer user_data) { desmume_resume(); } void on_menu_exec_activate (GtkMenuItem *menuitem, gpointer user_data) { desmume_resume(); }

View File

@ -26,6 +26,32 @@ void on_menu_ouvrir_activate (GtkMenuItem *menuitem, gpointer user_data);
void on_menu_pscreen_activate (GtkMenuItem *menuitem, gpointer user_data); void on_menu_pscreen_activate (GtkMenuItem *menuitem, gpointer user_data);
void on_menu_quit_activate (GtkMenuItem *menuitem, gpointer user_data); void on_menu_quit_activate (GtkMenuItem *menuitem, gpointer user_data);
/* MENU SAVES */
void on_loadstate1_activate (GtkMenuItem *, gpointer );
void on_loadstate2_activate (GtkMenuItem *, gpointer );
void on_loadstate3_activate (GtkMenuItem *, gpointer );
void on_loadstate4_activate (GtkMenuItem *, gpointer );
void on_loadstate5_activate (GtkMenuItem *, gpointer );
void on_loadstate6_activate (GtkMenuItem *, gpointer );
void on_loadstate7_activate (GtkMenuItem *, gpointer );
void on_loadstate8_activate (GtkMenuItem *, gpointer );
void on_loadstate9_activate (GtkMenuItem *, gpointer );
void on_loadstate10_activate(GtkMenuItem *, gpointer );
void on_savestate1_activate (GtkMenuItem *, gpointer );
void on_savestate2_activate (GtkMenuItem *, gpointer );
void on_savestate3_activate (GtkMenuItem *, gpointer );
void on_savestate4_activate (GtkMenuItem *, gpointer );
void on_savestate5_activate (GtkMenuItem *, gpointer );
void on_savestate6_activate (GtkMenuItem *, gpointer );
void on_savestate7_activate (GtkMenuItem *, gpointer );
void on_savestate8_activate (GtkMenuItem *, gpointer );
void on_savestate9_activate (GtkMenuItem *, gpointer );
void on_savestate10_activate(GtkMenuItem *, gpointer );
/* MENU EMULATION */ /* MENU EMULATION */
void on_menu_exec_activate (GtkMenuItem *menuitem, gpointer user_data); void on_menu_exec_activate (GtkMenuItem *menuitem, gpointer user_data);
void on_menu_pause_activate (GtkMenuItem *menuitem, gpointer user_data); void on_menu_pause_activate (GtkMenuItem *menuitem, gpointer user_data);

View File

@ -79,6 +79,265 @@
</widget> </widget>
</child> </child>
<child>
<widget class="GtkMenuItem" id="menu_save">
<property name="visible">True</property>
<property name="label" translatable="yes">_Saves</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="menu_save_menu">
<child>
<widget class="GtkMenuItem" id="load_state">
<property name="visible">True</property>
<property name="label" translatable="yes">Load State</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="load_state_menu">
<child>
<widget class="GtkCheckMenuItem" id="loadstate1">
<property name="visible">True</property>
<property name="label" translatable="yes">State 1</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_loadstate1_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F1" modifiers="0" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="loadstate2">
<property name="visible">True</property>
<property name="label" translatable="yes">State 2</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_loadstate2_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F2" modifiers="0" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="loadstate3">
<property name="visible">True</property>
<property name="label" translatable="yes">State 3</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_loadstate3_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F3" modifiers="0" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="loadstate4">
<property name="visible">True</property>
<property name="label" translatable="yes">State 4</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_loadstate4_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F4" modifiers="0" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="loadstate5">
<property name="visible">True</property>
<property name="label" translatable="yes">State 5</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_loadstate5_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F5" modifiers="0" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="loadstate6">
<property name="visible">True</property>
<property name="label" translatable="yes">State 6</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_loadstate6_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F6" modifiers="0" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="loadstate7">
<property name="visible">True</property>
<property name="label" translatable="yes">State 7</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_loadstate7_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F7" modifiers="0" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="loadstate8">
<property name="visible">True</property>
<property name="label" translatable="yes">State 8</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_loadstate8_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F8" modifiers="0" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="loadstate9">
<property name="visible">True</property>
<property name="label" translatable="yes">State 9</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_loadstate9_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F9" modifiers="0" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="loadstate10">
<property name="visible">True</property>
<property name="label" translatable="yes">State 10</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_loadstate10_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F10" modifiers="0" signal="activate"/>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="save_state">
<property name="visible">True</property>
<property name="label" translatable="yes">Save State</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="save_state_menu">
<child>
<widget class="GtkCheckMenuItem" id="savestate1">
<property name="visible">True</property>
<property name="label" translatable="yes">State 1</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_savestate1_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F1" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="savestate2">
<property name="visible">True</property>
<property name="label" translatable="yes">State 2</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_savestate2_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F2" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="savestate3">
<property name="visible">True</property>
<property name="label" translatable="yes">State 3</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_savestate3_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F3" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="savestate4">
<property name="visible">True</property>
<property name="label" translatable="yes">State 4</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_savestate4_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F4" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="savestate5">
<property name="visible">True</property>
<property name="label" translatable="yes">State 5</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_savestate5_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F5" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="savestate6">
<property name="visible">True</property>
<property name="label" translatable="yes">State 6</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_savestate6_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F6" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="savestate7">
<property name="visible">True</property>
<property name="label" translatable="yes">State 7</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_savestate7_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F7" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="savestate8">
<property name="visible">True</property>
<property name="label" translatable="yes">State 8</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_savestate8_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F8" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="savestate9">
<property name="visible">True</property>
<property name="label" translatable="yes">State 9</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_savestate9_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F9" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="savestate10">
<property name="visible">True</property>
<property name="label" translatable="yes">State 10</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_savestate10_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/>
<accelerator key="F10" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child> <child>
<widget class="GtkMenuItem" id="menu_emulation"> <widget class="GtkMenuItem" id="menu_emulation">
<property name="visible">True</property> <property name="visible">True</property>
@ -117,7 +376,7 @@
<signal name="activate" handler="on_menu_reset_activate" last_modification_time="Mon, 01 Jan 2007 16:40:47 GMT"/> <signal name="activate" handler="on_menu_reset_activate" last_modification_time="Mon, 01 Jan 2007 16:40:47 GMT"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image66"> <widget class="GtkImage" id="image81">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-refresh</property> <property name="stock">gtk-refresh</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -154,7 +413,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">0</property> <property name="label" translatable="yes">0</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">True</property> <property name="active">False</property>
<signal name="activate" handler="on_fs0_activate" last_modification_time="Tue, 02 Jan 2007 14:35:13 GMT"/> <signal name="activate" handler="on_fs0_activate" last_modification_time="Tue, 02 Jan 2007 14:35:13 GMT"/>
</widget> </widget>
</child> </child>
@ -252,7 +511,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">9</property> <property name="label" translatable="yes">9</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property> <property name="active">True</property>
<property name="group">fs0</property> <property name="group">fs0</property>
<signal name="activate" handler="on_fs9_activate" last_modification_time="Mon, 01 Jan 2007 16:45:37 GMT"/> <signal name="activate" handler="on_fs9_activate" last_modification_time="Mon, 01 Jan 2007 16:45:37 GMT"/>
</widget> </widget>
@ -276,7 +535,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">1x</property> <property name="label" translatable="yes">1x</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">True</property> <property name="active">False</property>
<signal name="activate" handler="on_size1x_activate" last_modification_time="Mon, 01 Jan 2007 20:14:20 GMT"/> <signal name="activate" handler="on_size1x_activate" last_modification_time="Mon, 01 Jan 2007 20:14:20 GMT"/>
</widget> </widget>
</child> </child>
@ -297,7 +556,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">3x</property> <property name="label" translatable="yes">3x</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property> <property name="active">True</property>
<property name="group">size1x</property> <property name="group">size1x</property>
<signal name="activate" handler="on_size3x_activate" last_modification_time="Mon, 01 Jan 2007 20:14:20 GMT"/> <signal name="activate" handler="on_size3x_activate" last_modification_time="Mon, 01 Jan 2007 20:14:20 GMT"/>
</widget> </widget>
@ -328,7 +587,7 @@
<signal name="activate" handler="on_menu_controls_activate" last_modification_time="Mon, 01 Jan 2007 16:53:11 GMT"/> <signal name="activate" handler="on_menu_controls_activate" last_modification_time="Mon, 01 Jan 2007 16:53:11 GMT"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image67"> <widget class="GtkImage" id="image82">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-preferences</property> <property name="stock">gtk-preferences</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -349,7 +608,7 @@
<signal name="activate" handler="on_menu_joy_controls_activate" last_modification_time="Fri, 12 Jan 2007 22:26:36 GMT"/> <signal name="activate" handler="on_menu_joy_controls_activate" last_modification_time="Fri, 12 Jan 2007 22:26:36 GMT"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image68"> <widget class="GtkImage" id="image83">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-preferences</property> <property name="stock">gtk-preferences</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -423,7 +682,7 @@
<signal name="activate" handler="on_menu_IO_regs_activate" last_modification_time="Mon, 01 Jan 2007 16:53:11 GMT"/> <signal name="activate" handler="on_menu_IO_regs_activate" last_modification_time="Mon, 01 Jan 2007 16:53:11 GMT"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image69"> <widget class="GtkImage" id="image84">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-properties</property> <property name="stock">gtk-properties</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -444,7 +703,7 @@
<signal name="activate" handler="on_menu_memview_activate" last_modification_time="Fri, 12 Jan 2007 15:44:42 GMT"/> <signal name="activate" handler="on_menu_memview_activate" last_modification_time="Fri, 12 Jan 2007 15:44:42 GMT"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image70"> <widget class="GtkImage" id="image85">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-properties</property> <property name="stock">gtk-properties</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -465,7 +724,7 @@
<signal name="activate" handler="on_menu_palview_activate" last_modification_time="Sun, 14 Jan 2007 10:34:32 GMT"/> <signal name="activate" handler="on_menu_palview_activate" last_modification_time="Sun, 14 Jan 2007 10:34:32 GMT"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image71"> <widget class="GtkImage" id="image86">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-properties</property> <property name="stock">gtk-properties</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>

View File

@ -29,6 +29,26 @@
#define SAVESTATE_VERSION 010 #define SAVESTATE_VERSION 010
#ifndef MAX_PATH
#define MAX_PATH 256
#endif
void savestate_slot(int num)
{
char filename[MAX_PATH];
strcpy(filename, szRomBaseName);
sprintf(filename+strlen(filename), "%d.dst", num);
savestate_save(filename);
}
void loadstate_slot(int num)
{
char filename[MAX_PATH];
strcpy(filename, szRomBaseName);
sprintf(filename+strlen(filename), "%d.dst", num);
savestate_load(filename);
}
u8 sram_read (u32 address) { u8 sram_read (u32 address) {
address = address - SRAM_ADDRESS; address = address - SRAM_ADDRESS;

View File

@ -37,6 +37,10 @@ extern "C" {
int savestate_load (const char *file_name); int savestate_load (const char *file_name);
int savestate_save (const char *file_name); int savestate_save (const char *file_name);
void savestate_slot(int num);
void loadstate_slot(int num);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -400,6 +400,20 @@ void NDS_UnPause()
SPU_Pause(0); SPU_Pause(0);
} }
void StateSaveSlot(int num)
{
NDS_Pause();
savestate_slot
NDS_UnPause();
}
void StateLoadSlot(int num)
{
NDS_Pause();
loadstate_slot(num);
NDS_UnPause();
}
BOOL LoadROM(char * filename) BOOL LoadROM(char * filename)
{ {
NDS_Pause(); NDS_Pause();
@ -530,26 +544,6 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
return messages.wParam; return messages.wParam;
} }
void StateSaveSlot(int num)
{
char filename[MAX_PATH];
NDS_Pause();
strcpy(filename, szRomBaseName);
sprintf(filename+strlen(filename), "%d.dst", num);
savestate_save(filename);
NDS_UnPause();
}
void StateLoadSlot(int num)
{
char filename[MAX_PATH];
NDS_Pause();
strcpy(filename, szRomBaseName);
sprintf(filename+strlen(filename), "%d.dst", num);
savestate_load(filename);
NDS_UnPause();
}
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
switch (message) // handle the messages switch (message) // handle the messages