gtk-port: command line option to load savegame
This commit is contained in:
parent
a6c84b7078
commit
f2918281a3
|
@ -39,6 +39,7 @@
|
||||||
#include "desmume.h"
|
#include "desmume.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "rasterize.h"
|
#include "rasterize.h"
|
||||||
|
#include "saves.h"
|
||||||
|
|
||||||
#ifdef GDB_STUB
|
#ifdef GDB_STUB
|
||||||
#include "gdbstub.h"
|
#include "gdbstub.h"
|
||||||
|
@ -129,6 +130,7 @@ GPU3DInterface *core3DList[] = {
|
||||||
|
|
||||||
|
|
||||||
struct configured_features {
|
struct configured_features {
|
||||||
|
int load_slot;
|
||||||
int opengl;
|
int opengl;
|
||||||
int soft_colour;
|
int soft_colour;
|
||||||
|
|
||||||
|
@ -148,6 +150,8 @@ struct configured_features {
|
||||||
static void
|
static void
|
||||||
init_configured_features( struct configured_features *config)
|
init_configured_features( struct configured_features *config)
|
||||||
{
|
{
|
||||||
|
config->load_slot = 0;
|
||||||
|
|
||||||
config->arm9_gdb_port = 0;
|
config->arm9_gdb_port = 0;
|
||||||
config->arm7_gdb_port = 0;
|
config->arm7_gdb_port = 0;
|
||||||
|
|
||||||
|
@ -173,6 +177,7 @@ fill_configured_features( struct configured_features *config,
|
||||||
int argc, char ** argv)
|
int argc, char ** argv)
|
||||||
{
|
{
|
||||||
GOptionEntry options[] = {
|
GOptionEntry options[] = {
|
||||||
|
{ "load-slot", 0, 0, G_OPTION_ARG_INT, &config->load_slot, "Loads savegame from slot NUM", "NUM"},
|
||||||
#ifdef GTKGLEXT_AVAILABLE
|
#ifdef GTKGLEXT_AVAILABLE
|
||||||
{ "opengl-2d", 0, 0, G_OPTION_ARG_NONE, &config->opengl, "Enables using OpenGL for screen rendering", NULL},
|
{ "opengl-2d", 0, 0, G_OPTION_ARG_NONE, &config->opengl, "Enables using OpenGL for screen rendering", NULL},
|
||||||
{ "soft-convert", 0, 0, G_OPTION_ARG_NONE, &config->soft_colour,
|
{ "soft-convert", 0, 0, G_OPTION_ARG_NONE, &config->soft_colour,
|
||||||
|
@ -232,6 +237,11 @@ fill_configured_features( struct configured_features *config,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config->load_slot < 0 || config->load_slot > 10) {
|
||||||
|
g_printerr("I only know how to load from slots 1-10, 0 means 'do not load savegame' and is default\n");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
if (config->engine_3d != 0 && config->engine_3d != 1
|
if (config->engine_3d != 0 && config->engine_3d != 1
|
||||||
#if defined(GTKGLEXT_AVAILABLE) || defined(HAVE_LIBOSMESA)
|
#if defined(GTKGLEXT_AVAILABLE) || defined(HAVE_LIBOSMESA)
|
||||||
&& config->engine_3d != 2
|
&& config->engine_3d != 2
|
||||||
|
@ -2010,7 +2020,6 @@ common_gtk_main( struct configured_features *my_config)
|
||||||
/*
|
/*
|
||||||
* Set the 3D emulation to use
|
* Set the 3D emulation to use
|
||||||
*/
|
*/
|
||||||
printf("3d engine: %d\n", my_config->engine_3d);
|
|
||||||
unsigned core = my_config->engine_3d;
|
unsigned core = my_config->engine_3d;
|
||||||
/* setup the gdk 3D emulation; GTKGLEXT and LIBOSMESA are exclusive currently */
|
/* setup the gdk 3D emulation; GTKGLEXT and LIBOSMESA are exclusive currently */
|
||||||
#if defined(GTKGLEXT_AVAILABLE) || defined(HAVE_LIBOSMESA)
|
#if defined(GTKGLEXT_AVAILABLE) || defined(HAVE_LIBOSMESA)
|
||||||
|
@ -2022,17 +2031,19 @@ common_gtk_main( struct configured_features *my_config)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
printf("changing 3d core to %u\n", core);
|
|
||||||
NDS_3D_ChangeCore(core);
|
NDS_3D_ChangeCore(core);
|
||||||
|
|
||||||
if(my_config->engine_3d != 0 && gpu3D == &gpu3DNull){
|
if(my_config->engine_3d != 0 && gpu3D == &gpu3DNull){
|
||||||
g_printerr("Failed to initialise openGL 3D emulation; "
|
g_printerr("Failed to initialise openGL 3D emulation; "
|
||||||
"removing 3D support\n");
|
"removing 3D support\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Vérifie la ligne de commandes */
|
/* Command line arg */
|
||||||
if( my_config->nds_file != NULL) {
|
if( my_config->nds_file != NULL) {
|
||||||
if(Open( my_config->nds_file, bad_glob_cflash_disk_image_file) >= 0) {
|
if(Open( my_config->nds_file, bad_glob_cflash_disk_image_file) >= 0) {
|
||||||
|
if(my_config->load_slot){
|
||||||
|
loadstate_slot(my_config->load_slot);
|
||||||
|
}
|
||||||
|
|
||||||
Launch();
|
Launch();
|
||||||
} else {
|
} else {
|
||||||
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pWindow),
|
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pWindow),
|
||||||
|
|
Loading…
Reference in New Issue