save type select for gtk-glade

boost key working
This commit is contained in:
damdoum 2007-02-01 12:43:02 +00:00
parent 578a10398a
commit 36deb4a060
11 changed files with 189 additions and 184 deletions

View File

@ -701,6 +701,7 @@ INLINE void renderline_textBG(GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG, u16 Y
u16 yoff; u16 yoff;
u16 x = 0; u16 x = 0;
u16 xfin; u16 xfin;
u16 palette_size;
s8 line_dir = 1; s8 line_dir = 1;
u8 pt_xor = 0; u8 pt_xor = 0;
@ -812,8 +813,15 @@ INLINE void renderline_textBG(GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG, u16 Y
} }
return; return;
} }
if(!gpu->dispCnt.bits.ExBGxPalette_Enable) /* color: no extended palette */
palette_size=0; /* color: no extended palette */
if(gpu->dispCnt.bits.ExBGxPalette_Enable) /* color: extended palette */
{ {
palette_size=0x100;
pal = ARM9Mem.ExtPal[gpu->core][gpu->BGExtPalSlot[num]];
if(!pal) return;
}
yoff = ((YBG&7)<<3); yoff = ((YBG&7)<<3);
xfin = 8 - (xoff&7); xfin = 8 - (xoff&7);
for(x = 0; x < LG; xfin = min(x+8, LG)) for(x = 0; x < LG; xfin = min(x+8, LG))
@ -835,39 +843,7 @@ INLINE void renderline_textBG(GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG, u16 Y
} }
for(; x < xfin; ) for(; x < xfin; )
{ {
RENDERL((*line),0) RENDERL((*line),palette_size)
line += line_dir;
}
}
return;
}
/* color: extended palette */
pal = ARM9Mem.ExtPal[gpu->core][gpu->BGExtPalSlot[num]];
if(!pal) return;
yoff = ((YBG&7)<<3);
xfin = 8 - (xoff&7);
for(x = 0; x < LG; xfin = min(x+8, LG))
{
tmp = ((xoff&(lg-1))>>3);
mapinfo = map + (tmp & 0x1F) * 2;
if(tmp>31) mapinfo += 32 * 32 * 2;
tileentry.val = T1ReadWord(mapinfo, 0);
line = (u8 * )tile + (tileentry.bits.TileNum*0x40) + ((tileentry.bits.VFlip)? (7*8)-yoff : yoff);
if(tileentry.bits.HFlip)
{
line += (7 - (xoff&7));
line_dir = -1;
} else {
line += (xoff&7);
line_dir = 1;
}
for(; x < xfin; )
{
RENDERL((*line),0x100)
line += line_dir; line += line_dir;
} }
} }
@ -933,19 +909,15 @@ void rot_BMP_map(GPU * gpu, int num, s32 auxX, s32 auxY, int lg, u8 * dst, u8 *
typedef void (*rot_fun)(GPU * gpu, int num, s32 auxX, s32 auxY, int lg, u8 * dst, u8 * map, u8 * tile, u8 * pal , int i, u16 H); typedef void (*rot_fun)(GPU * gpu, int num, s32 auxX, s32 auxY, int lg, u8 * dst, u8 * map, u8 * tile, u8 * pal , int i, u16 H);
INLINE void apply_rot_fun(GPU * gpu, u8 num, u8 * dst, u16 H, s32 X, s32 Y, s16 PA, s16 PB, s16 PC, s16 PD, u16 LG, rot_fun fun, u8 * map, u8 * tile, u8 * pal) INLINE void rot_scale_op(GPU * gpu, u8 num, u8 * dst, u16 H, s32 X, s32 Y, s16 PA, s16 PB, s16 PC, s16 PD, u16 LG, s32 wh, s32 ht, BOOL wrap, rot_fun fun, u8 * map, u8 * tile, u8 * pal)
{ {
ROTOCOORD x, y; ROTOCOORD x, y;
struct _BGxCNT bgCnt = gpu->bgCnt[num].bits;
s32 dx = (s32)PA; s32 dx = (s32)PA;
s32 dy = (s32)PC; s32 dy = (s32)PC;
s32 lg = gpu->BGSize[num][0];
s32 ht = gpu->BGSize[num][1];
u32 i; u32 i;
s32 auxX, auxY; s32 auxX, auxY;
if (!map) return;
x.val = X + (s32)PB*(s32)H; x.val = X + (s32)PB*(s32)H;
y.val = Y + (s32)PD*(s32)H; y.val = Y + (s32)PD*(s32)H;
@ -956,21 +928,30 @@ INLINE void apply_rot_fun(GPU * gpu, u8 num, u8 * dst, u16 H, s32 X, s32 Y, s16
auxX = x.bits.Integer; auxX = x.bits.Integer;
auxY = y.bits.Integer; auxY = y.bits.Integer;
if(bgCnt.PaletteSet_Wrap) if(wrap)
{ {
// wrap // wrap
auxX = auxX & (lg-1); auxX = auxX & (wh-1);
auxY = auxY & (ht-1); auxY = auxY & (ht-1);
} }
if ((auxX >= 0) && (auxX < lg) && (auxY >= 0) && (auxY < ht)) if ((auxX >= 0) && (auxX < wh) && (auxY >= 0) && (auxY < ht))
fun(gpu, num, auxX, auxY, lg, dst, map, tile, pal, i, H); fun(gpu, num, auxX, auxY, wh, dst, map, tile, pal, i, H);
dst += 2; dst += 2;
x.val += dx; x.val += dx;
y.val += dy; y.val += dy;
} }
} }
INLINE void apply_rot_fun(GPU * gpu, u8 num, u8 * dst, u16 H, s32 X, s32 Y, s16 PA, s16 PB, s16 PC, s16 PD, u16 LG, rot_fun fun, u8 * map, u8 * tile, u8 * pal)
{
struct _BGxCNT bgCnt = gpu->bgCnt[num].bits;
s32 wh = gpu->BGSize[num][0];
s32 ht = gpu->BGSize[num][1];
rot_scale_op(gpu, num, dst, H, X, Y, PA, PB, PC, PD, LG, wh, ht, bgCnt.PaletteSet_Wrap, fun, map, tile, pal);
}
INLINE void rotBG2(GPU * gpu, u8 num, u8 * dst, u16 H, s32 X, s32 Y, s16 PA, s16 PB, s16 PC, s16 PD, u16 LG) { INLINE void rotBG2(GPU * gpu, u8 num, u8 * dst, u16 H, s32 X, s32 Y, s16 PA, s16 PB, s16 PC, s16 PD, u16 LG) {
u8 * map = gpu->BG_map_ram[num]; u8 * map = gpu->BG_map_ram[num];
u8 * tile = (u8 *)gpu->BG_tile_ram[num]; u8 * tile = (u8 *)gpu->BG_tile_ram[num];
@ -1102,6 +1083,7 @@ INLINE void render_sprite_BMP (GPU * gpu, u16 l, u8 * dst, u16 * src,
} }
} }
INLINE void render_sprite_256 (GPU * gpu, u16 l, u8 * dst, u8 * src, u16 * pal, INLINE void render_sprite_256 (GPU * gpu, u16 l, u8 * dst, u8 * src, u16 * pal,
u8 * prioTab, u8 prio, int lg, int sprX, int x, int xdir) { u8 * prioTab, u8 prio, int lg, int sprX, int x, int xdir) {
int i; u8 palette_entry; u16 color; int i; u8 palette_entry; u16 color;

View File

@ -103,6 +103,14 @@ typedef struct {
extern MMU_struct MMU; extern MMU_struct MMU;
static void mmu_select_savetype(int type, int *bmemtype, u32 *bmemsize) {
if (type<0 || type > 5) return;
*bmemtype=save_types[type][0];
*bmemsize=save_types[type][1];
mc_realloc(&MMU.bupmem, *bmemtype, *bmemsize);
}
void MMUInit(void); void MMUInit(void);
void MMUDeInit(void); void MMUDeInit(void);

View File

@ -152,6 +152,13 @@ void on_savestate8_activate (GtkMenuItem *m, gpointer d) { update_savestate(8);
void on_savestate9_activate (GtkMenuItem *m, gpointer d) { update_savestate(9); } void on_savestate9_activate (GtkMenuItem *m, gpointer d) { update_savestate(9); }
void on_savestate10_activate(GtkMenuItem *m, gpointer d) { update_savestate(10); } void on_savestate10_activate(GtkMenuItem *m, gpointer d) { update_savestate(10); }
void on_savetype1_activate (GtkMenuItem *m, gpointer d) { desmume_savetype(1); }
void on_savetype2_activate (GtkMenuItem *m, gpointer d) { desmume_savetype(2); }
void on_savetype3_activate (GtkMenuItem *m, gpointer d) { desmume_savetype(3); }
void on_savetype4_activate (GtkMenuItem *m, gpointer d) { desmume_savetype(4); }
void on_savetype5_activate (GtkMenuItem *m, gpointer d) { desmume_savetype(5); }
void on_savetype6_activate (GtkMenuItem *m, gpointer d) { desmume_savetype(6); }
/* 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

@ -49,6 +49,12 @@ G_MODULE_EXPORT void on_savestate8_activate (GtkMenuItem *, gpointer );
G_MODULE_EXPORT void on_savestate9_activate (GtkMenuItem *, gpointer ); G_MODULE_EXPORT void on_savestate9_activate (GtkMenuItem *, gpointer );
G_MODULE_EXPORT void on_savestate10_activate(GtkMenuItem *, gpointer ); G_MODULE_EXPORT void on_savestate10_activate(GtkMenuItem *, gpointer );
G_MODULE_EXPORT void on_savetype1_activate (GtkMenuItem *, gpointer );
G_MODULE_EXPORT void on_savetype2_activate (GtkMenuItem *, gpointer );
G_MODULE_EXPORT void on_savetype3_activate (GtkMenuItem *, gpointer );
G_MODULE_EXPORT void on_savetype4_activate (GtkMenuItem *, gpointer );
G_MODULE_EXPORT void on_savetype5_activate (GtkMenuItem *, gpointer );
G_MODULE_EXPORT void on_savetype6_activate (GtkMenuItem *, gpointer );

View File

@ -33,10 +33,13 @@ int saveFS;
gboolean on_wMainW_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data) { gboolean on_wMainW_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data) {
u16 Key = lookup_key(event->keyval); u16 Key = lookup_key(event->keyval);
if (event->keyval == keyboard_cfg[KEY_BOOST-1]) { if (event->keyval == keyboard_cfg[KEY_BOOST-1]) {
Boost != Boost; Boost = !Boost;
if (Boost) {
saveFS = Frameskip; saveFS = Frameskip;
if (Boost) Frameskip = BoostFS; Frameskip = BoostFS;
else Frameskip = saveFS; } else {
Frameskip = saveFS;
}
} }
ADD_KEY( Cur_Keypad, Key ); ADD_KEY( Cur_Keypad, Key );
if(desmume_running()) update_keypad(Cur_Keypad); if(desmume_running()) update_keypad(Cur_Keypad);

View File

@ -30,6 +30,8 @@ volatile BOOL execute = FALSE;
BOOL click = FALSE; BOOL click = FALSE;
BOOL fini = FALSE; BOOL fini = FALSE;
unsigned long glock = 0; unsigned long glock = 0;
int savetype=MC_TYPE_AUTODETECT;
u32 savesize=1;
void desmume_mem_init(); void desmume_mem_init();
@ -53,21 +55,28 @@ int desmume_open(const char *filename)
{ {
int i; int i;
clear_savestates(); clear_savestates();
i = NDS_LoadROM(filename, MC_TYPE_AUTODETECT, 1); i = NDS_LoadROM(filename, savetype, savesize);
return i; return i;
} }
void desmume_savetype(int type) {
mmu_select_savetype(type, &savetype, &savesize);
}
void desmume_pause() void desmume_pause()
{ {
execute = FALSE; execute = FALSE;
SPU_Pause(1);
} }
void desmume_resume() void desmume_resume()
{ {
SPU_Pause(0);
execute = TRUE; execute = TRUE;
if(!regMainLoop) if(!regMainLoop)
g_idle_add_full(EMULOOP_PRIO, &EmuLoop, NULL, NULL); regMainLoop = TRUE; g_idle_add_full(EMULOOP_PRIO, &EmuLoop, NULL, NULL);
regMainLoop = TRUE;
} }
void desmume_reset() void desmume_reset()
@ -100,48 +109,12 @@ void desmume_cycle()
SPU_Emulate(); SPU_Emulate();
} }
/////////////////////////////// TOOLS MANAGEMENT ///////////////////////////////
#if 0
//#include "dTool.h"
extern const dTool_t *dTools_list[];
extern const int dTools_list_size;
BOOL *dTools_running;
void Start_dTool(GtkWidget *widget, gpointer data)
{
int tool = GPOINTER_TO_INT(data);
if(dTools_running[tool]) return;
dTools_list[tool]->open(tool);
dTools_running[tool] = TRUE;
}
void dTool_CloseCallback(int tool)
{
dTools_running[tool] = FALSE;
}
/////////////////////////////// MAIN EMULATOR LOOP ///////////////////////////////
static inline void _updateDTools()
{
int i;
for(i = 0; i < dTools_list_size; i++)
{
if(dTools_running[i]) { dTools_list[i]->update(); }
}
}
#endif
Uint32 fps, fps_SecStart, fps_FrameCount; Uint32 fps, fps_SecStart, fps_FrameCount;
static void Draw() static void Draw()
{ {
} }
gboolean EmuLoop(gpointer data) gboolean EmuLoop(gpointer data)
{ {
int i; int i;
@ -167,7 +140,6 @@ gboolean EmuLoop(gpointer data)
Draw(); Draw();
// _updateDTools();
notify_Tools(); notify_Tools();
gtk_widget_queue_draw(pDrawingArea); gtk_widget_queue_draw(pDrawingArea);
gtk_widget_queue_draw(pDrawingArea2); gtk_widget_queue_draw(pDrawingArea2);

View File

@ -26,6 +26,7 @@ extern void desmume_init();
extern void desmume_free(); extern void desmume_free();
extern int desmume_open(const char *filename); extern int desmume_open(const char *filename);
extern void desmume_savetype(int type);
extern void desmume_pause(); extern void desmume_pause();
extern void desmume_resume(); extern void desmume_resume();
extern void desmume_reset(); extern void desmume_reset();

View File

@ -10,7 +10,7 @@
<property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="modal">False</property> <property name="modal">False</property>
<property name="resizable">True</property> <property name="resizable">False</property>
<property name="destroy_with_parent">False</property> <property name="destroy_with_parent">False</property>
<property name="icon">DeSmuME.xpm</property> <property name="icon">DeSmuME.xpm</property>
<property name="decorated">True</property> <property name="decorated">True</property>
@ -98,119 +98,100 @@
<widget class="GtkMenu" id="load_state_menu"> <widget class="GtkMenu" id="load_state_menu">
<child> <child>
<widget class="GtkRadioMenuItem" id="loadstate1"> <widget class="GtkMenuItem" id="loadstate1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 1</property> <property name="label" translatable="yes">State 1</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_loadstate1_activate" last_modification_time="Sun, 21 Jan 2007 06:23:50 GMT"/> <signal name="activate" handler="on_loadstate1_activate" last_modification_time="Sun, 21 Jan 2007 06:23:50 GMT"/>
<accelerator key="F1" modifiers="0" signal="activate"/> <accelerator key="F1" modifiers="0" signal="activate"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkRadioMenuItem" id="loadstate2"> <widget class="GtkMenuItem" id="loadstate2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 2</property> <property name="label" translatable="yes">State 2</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">loadstate1</property>
<signal name="activate" handler="on_loadstate2_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/> <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"/> <accelerator key="F2" modifiers="0" signal="activate"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkRadioMenuItem" id="loadstate3"> <widget class="GtkMenuItem" id="loadstate3">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 3</property> <property name="label" translatable="yes">State 3</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">loadstate1</property>
<signal name="activate" handler="on_loadstate3_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/> <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"/> <accelerator key="F3" modifiers="0" signal="activate"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkRadioMenuItem" id="loadstate4"> <widget class="GtkMenuItem" id="loadstate4">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 4</property> <property name="label" translatable="yes">State 4</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">loadstate1</property>
<signal name="activate" handler="on_loadstate4_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/> <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"/> <accelerator key="F4" modifiers="0" signal="activate"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkRadioMenuItem" id="loadstate5"> <widget class="GtkMenuItem" id="loadstate5">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 5</property> <property name="label" translatable="yes">State 5</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">loadstate1</property>
<signal name="activate" handler="on_loadstate5_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/> <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"/> <accelerator key="F5" modifiers="0" signal="activate"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkRadioMenuItem" id="loadstate6"> <widget class="GtkMenuItem" id="loadstate6">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 6</property> <property name="label" translatable="yes">State 6</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">loadstate1</property>
<signal name="activate" handler="on_loadstate6_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/> <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"/> <accelerator key="F6" modifiers="0" signal="activate"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkRadioMenuItem" id="loadstate7"> <widget class="GtkMenuItem" id="loadstate7">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 7</property> <property name="label" translatable="yes">State 7</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">loadstate1</property>
<signal name="activate" handler="on_loadstate7_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/> <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"/> <accelerator key="F7" modifiers="0" signal="activate"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkRadioMenuItem" id="loadstate8"> <widget class="GtkMenuItem" id="loadstate8">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 8</property> <property name="label" translatable="yes">State 8</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">loadstate1</property>
<signal name="activate" handler="on_loadstate8_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/> <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"/> <accelerator key="F8" modifiers="0" signal="activate"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkRadioMenuItem" id="loadstate9"> <widget class="GtkMenuItem" id="loadstate9">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 9</property> <property name="label" translatable="yes">State 9</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">loadstate1</property>
<signal name="activate" handler="on_loadstate9_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/> <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"/> <accelerator key="F9" modifiers="0" signal="activate"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkRadioMenuItem" id="loadstate10"> <widget class="GtkMenuItem" id="loadstate10">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 10</property> <property name="label" translatable="yes">State 10</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">loadstate1</property>
<signal name="activate" handler="on_loadstate10_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/> <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"/> <accelerator key="F10" modifiers="0" signal="activate"/>
</widget> </widget>
@ -230,119 +211,100 @@
<widget class="GtkMenu" id="save_state_menu"> <widget class="GtkMenu" id="save_state_menu">
<child> <child>
<widget class="GtkRadioMenuItem" id="savestate1"> <widget class="GtkMenuItem" id="savestate1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 1</property> <property name="label" translatable="yes">State 1</property>
<property name="use_underline">True</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"/> <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"/> <accelerator key="F1" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkRadioMenuItem" id="savestate2"> <widget class="GtkMenuItem" id="savestate2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 2</property> <property name="label" translatable="yes">State 2</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">savestate1</property>
<signal name="activate" handler="on_savestate2_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/> <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"/> <accelerator key="F2" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkRadioMenuItem" id="savestate3"> <widget class="GtkMenuItem" id="savestate3">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 3</property> <property name="label" translatable="yes">State 3</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">savestate1</property>
<signal name="activate" handler="on_savestate3_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/> <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"/> <accelerator key="F3" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkRadioMenuItem" id="savestate4"> <widget class="GtkMenuItem" id="savestate4">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 4</property> <property name="label" translatable="yes">State 4</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">savestate1</property>
<signal name="activate" handler="on_savestate4_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/> <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"/> <accelerator key="F4" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkRadioMenuItem" id="savestate5"> <widget class="GtkMenuItem" id="savestate5">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 5</property> <property name="label" translatable="yes">State 5</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">savestate1</property>
<signal name="activate" handler="on_savestate5_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/> <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"/> <accelerator key="F5" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkRadioMenuItem" id="savestate6"> <widget class="GtkMenuItem" id="savestate6">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 6</property> <property name="label" translatable="yes">State 6</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">savestate1</property>
<signal name="activate" handler="on_savestate6_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/> <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"/> <accelerator key="F6" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkRadioMenuItem" id="savestate7"> <widget class="GtkMenuItem" id="savestate7">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 7</property> <property name="label" translatable="yes">State 7</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">savestate1</property>
<signal name="activate" handler="on_savestate7_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/> <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"/> <accelerator key="F7" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkRadioMenuItem" id="savestate8"> <widget class="GtkMenuItem" id="savestate8">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 8</property> <property name="label" translatable="yes">State 8</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">savestate1</property>
<signal name="activate" handler="on_savestate8_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/> <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"/> <accelerator key="F8" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkRadioMenuItem" id="savestate9"> <widget class="GtkMenuItem" id="savestate9">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 9</property> <property name="label" translatable="yes">State 9</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">savestate1</property>
<signal name="activate" handler="on_savestate9_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/> <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"/> <accelerator key="F9" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkRadioMenuItem" id="savestate10"> <widget class="GtkMenuItem" id="savestate10">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">State 10</property> <property name="label" translatable="yes">State 10</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">savestate1</property>
<signal name="activate" handler="on_savestate10_activate" last_modification_time="Thu, 18 Jan 2007 10:10:14 GMT"/> <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"/> <accelerator key="F10" modifiers="GDK_SHIFT_MASK" signal="activate"/>
</widget> </widget>
@ -351,6 +313,74 @@
</child> </child>
</widget> </widget>
</child> </child>
<child>
<widget class="GtkSeparatorMenuItem" id="séparateur1">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="savetype1">
<property name="visible">True</property>
<property name="label" translatable="yes">TYPE: Auto (1B)</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<signal name="activate" handler="on_savetype1_activate" last_modification_time="Thu, 01 Feb 2007 11:41:11 GMT"/>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="savetype2">
<property name="visible">True</property>
<property name="label" translatable="yes">TYPE: EEPROM1 (4KB)</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">savetype1</property>
<signal name="activate" handler="on_savetype2_activate" last_modification_time="Thu, 01 Feb 2007 11:41:11 GMT"/>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="savetype3">
<property name="visible">True</property>
<property name="label" translatable="yes">TYPE: EEPROM2 (64KB)</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">savetype1</property>
<signal name="activate" handler="on_savetype3_activate" last_modification_time="Thu, 01 Feb 2007 11:41:11 GMT"/>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="savetype4">
<property name="visible">True</property>
<property name="label" translatable="yes">TYPE: EEPROM2 (512KB)</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">savetype1</property>
<signal name="activate" handler="on_savetype4_activate" last_modification_time="Thu, 01 Feb 2007 11:41:11 GMT"/>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="savetype5">
<property name="visible">True</property>
<property name="label" translatable="yes">TYPE: FLASH (256KB)</property>
<property name="use_underline">True</property>
<property name="group">savetype1</property>
<property name="active">False</property>
<signal name="activate" handler="on_savetype5_activate" last_modification_time="Thu, 01 Feb 2007 11:41:11 GMT"/>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="savetype6">
<property name="visible">True</property>
<property name="label" translatable="yes">TYPE: FRAM (2MB)</property>
<property name="use_underline">True</property>
<property name="group">savetype1</property>
<property name="active">False</property>
<signal name="activate" handler="on_savetype6_activate" last_modification_time="Thu, 01 Feb 2007 11:41:11 GMT"/>
</widget>
</child>
</widget> </widget>
</child> </child>
</widget> </widget>
@ -394,7 +424,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="image96"> <widget class="GtkImage" id="image116">
<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>
@ -431,7 +461,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">False</property> <property name="active">True</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>
@ -529,7 +559,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">True</property> <property name="active">False</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>
@ -553,7 +583,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">False</property> <property name="active">True</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>
@ -574,7 +604,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">True</property> <property name="active">False</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>
@ -605,7 +635,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="image97"> <widget class="GtkImage" id="image117">
<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>
@ -626,7 +656,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="image98"> <widget class="GtkImage" id="image118">
<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>
@ -700,7 +730,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="image99"> <widget class="GtkImage" id="image119">
<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>
@ -721,7 +751,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="image100"> <widget class="GtkImage" id="image120">
<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>
@ -742,7 +772,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="image101"> <widget class="GtkImage" id="image121">
<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

@ -146,7 +146,6 @@ void clear_savestate_menu(char * cb_name, u8 num)
sprintf( text, "State %d (empty)", num); sprintf( text, "State %d (empty)", num);
w = glade_xml_get_widget(xml, cb); w = glade_xml_get_widget(xml, cb);
set_menuitem_label( w, text ); set_menuitem_label( w, text );
gtk_check_menu_item_set_active((GtkCheckMenuItem*)w, FALSE);
} }
void update_savestate_menu(char * cb_name, u8 num) void update_savestate_menu(char * cb_name, u8 num)

View File

@ -25,6 +25,15 @@ extern "C" {
#define MC_SIZE_16MBITS 0x200000 #define MC_SIZE_16MBITS 0x200000
#define MC_SIZE_64MBITS 0x800000 #define MC_SIZE_64MBITS 0x800000
static int save_types[6][2] = {
{MC_TYPE_AUTODETECT,1},
{MC_TYPE_EEPROM1,MC_SIZE_4KBITS},
{MC_TYPE_EEPROM2,MC_SIZE_64KBITS},
{MC_TYPE_EEPROM2,MC_SIZE_512KBITS},
{MC_TYPE_FLASH,MC_SIZE_256KBITS},
{MC_TYPE_FRAM,MC_SIZE_2MBITS}
};
typedef struct typedef struct
{ {
u8 com; /* persistent command actually handled */ u8 com; /* persistent command actually handled */

View File

@ -34,6 +34,9 @@
#include "../MMU.h" #include "../MMU.h"
#include "../armcpu.h" #include "../armcpu.h"
#include "../NDSSystem.h" #include "../NDSSystem.h"
#include "../debug.h"
#include "../saves.h"
#include "../cflash.h"
#include "resource.h" #include "resource.h"
#include "memView.h" #include "memView.h"
#include "disView.h" #include "disView.h"
@ -42,10 +45,7 @@
#include "palView.h" #include "palView.h"
#include "tileView.h" #include "tileView.h"
#include "oamView.h" #include "oamView.h"
#include "../debug.h"
#include "mapview.h" #include "mapview.h"
#include "../saves.h"
#include "../cflash.h"
#include "ConfigKeys.h" #include "ConfigKeys.h"
#include "snddx.h" #include "snddx.h"
@ -1211,39 +1211,27 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case IDC_SAVETYPE1: case IDC_SAVETYPE1:
saver(MF_CHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED); saver(MF_CHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED);
backupmemorytype = MC_TYPE_AUTODETECT; mmu_select_savetype(0,&backupmemorytype,&backupmemorysize);
backupmemorysize = 1;
mc_realloc(&MMU.bupmem, backupmemorytype,backupmemorysize);
return 0; return 0;
case IDC_SAVETYPE2: case IDC_SAVETYPE2:
saver(MF_UNCHECKED,MF_CHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED); saver(MF_UNCHECKED,MF_CHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED);
backupmemorytype = MC_TYPE_EEPROM1; mmu_select_savetype(1,&backupmemorytype,&backupmemorysize);
backupmemorysize = MC_SIZE_4KBITS;
mc_realloc(&MMU.bupmem, backupmemorytype,backupmemorysize);
return 0; return 0;
case IDC_SAVETYPE3: case IDC_SAVETYPE3:
saver(MF_UNCHECKED,MF_UNCHECKED,MF_CHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED); saver(MF_UNCHECKED,MF_UNCHECKED,MF_CHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED);
backupmemorytype = MC_TYPE_EEPROM2; mmu_select_savetype(2,&backupmemorytype,&backupmemorysize);
backupmemorysize = MC_SIZE_64KBITS;
mc_realloc(&MMU.bupmem, backupmemorytype,backupmemorysize);
return 0; return 0;
case IDC_SAVETYPE4: case IDC_SAVETYPE4:
saver(MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_CHECKED,MF_UNCHECKED,MF_UNCHECKED); saver(MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_CHECKED,MF_UNCHECKED,MF_UNCHECKED);
backupmemorytype = MC_TYPE_EEPROM2; mmu_select_savetype(3,&backupmemorytype,&backupmemorysize);
backupmemorysize = MC_SIZE_512KBITS;
mc_realloc(&MMU.bupmem, backupmemorytype,backupmemorysize);
return 0; return 0;
case IDC_SAVETYPE5: case IDC_SAVETYPE5:
saver(MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_CHECKED,MF_UNCHECKED); saver(MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_CHECKED,MF_UNCHECKED);
backupmemorytype = MC_TYPE_FRAM; mmu_select_savetype(4,&backupmemorytype,&backupmemorysize);
backupmemorysize = MC_SIZE_256KBITS;
mc_realloc(&MMU.bupmem, backupmemorytype,backupmemorysize);
return 0; return 0;
case IDC_SAVETYPE6: case IDC_SAVETYPE6:
saver(MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_CHECKED); saver(MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_UNCHECKED,MF_CHECKED);
backupmemorytype = MC_TYPE_FLASH; mmu_select_savetype(5,&backupmemorytype,&backupmemorysize);
backupmemorysize = MC_SIZE_2MBITS;
mc_realloc(&MMU.bupmem, backupmemorytype,backupmemorysize);
return 0; return 0;
case IDM_RESET: case IDM_RESET: