Add the possibility to have a desmume quit after a timeout. The idea is to use
this feature in conjunction with load state to have a more reliable way of profiling the same stuff in different moments. A companion to this patch would be a script that start the profiler, start desmume and close the profiler once desmume exited.
This commit is contained in:
parent
7b49f8923b
commit
c7bd2c7cbd
|
@ -343,6 +343,7 @@ struct configured_features {
|
|||
|
||||
const char *nds_file;
|
||||
const char *cflash_disk_image_file;
|
||||
int timeout;
|
||||
};
|
||||
|
||||
static void
|
||||
|
@ -364,6 +365,8 @@ init_configured_features( struct configured_features *config)
|
|||
|
||||
config->cflash_disk_image_file = NULL;
|
||||
|
||||
config->timeout = 0;
|
||||
|
||||
/* use the default language */
|
||||
config->firmware_language = -1;
|
||||
}
|
||||
|
@ -405,6 +408,7 @@ fill_configured_features( struct configured_features *config,
|
|||
{ "arm7gdb", 0, 0, G_OPTION_ARG_INT, &config->arm7_gdb_port, "Enable the ARM7 GDB stub on the given port", "PORT_NUM"},
|
||||
#endif
|
||||
{ "cflash", 0, 0, G_OPTION_ARG_FILENAME, &config->cflash_disk_image_file, "Enable disk image GBAMP compact flash emulation", "PATH_TO_DISK_IMAGE"},
|
||||
{ "timeout", 0, 0, G_OPTION_ARG_INT, &config->timeout, "Quit desmume after the specified seconds for testing purpose.", "SECONDS"},
|
||||
{ NULL }
|
||||
};
|
||||
GOptionContext *ctx;
|
||||
|
@ -1617,6 +1621,14 @@ static void desmume_gtk_menu_tools (GtkActionGroup *ag)
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean timeout_exit_cb(gpointer data)
|
||||
{
|
||||
gtk_main_quit();
|
||||
INFO("Quit after %d seconds timeout\n", GPOINTER_TO_INT(data));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
common_gtk_main( struct configured_features *my_config)
|
||||
{
|
||||
|
@ -1854,6 +1866,10 @@ common_gtk_main( struct configured_features *my_config)
|
|||
}
|
||||
}
|
||||
|
||||
if (my_config->timeout > 0) {
|
||||
g_timeout_add_seconds(my_config->timeout, timeout_exit_cb, GINT_TO_POINTER(my_config->timeout));
|
||||
}
|
||||
|
||||
/* Main loop */
|
||||
|
||||
// gtk_idle_add(&EmuLoop, pWindow);
|
||||
|
|
Loading…
Reference in New Issue