diff --git a/desmume/src/commandline.cpp b/desmume/src/commandline.cpp index 049fa7887..ccc07ea53 100644 --- a/desmume/src/commandline.cpp +++ b/desmume/src/commandline.cpp @@ -67,6 +67,7 @@ CommandLine::CommandLine() , start_paused(FALSE) , autodetect_method(-1) , render3d(COMMANDLINE_RENDER3D_DEFAULT) +, language(-1) { #ifndef HOST_WINDOWS disable_sound = 0; @@ -117,6 +118,7 @@ ENDL " --bios-arm9 BIN_FILE Uses the ARM9 BIOS provided at the specified path" ENDL " --bios-arm7 BIN_FILE Uses the ARM7 BIOS provided at the specified path" ENDL " --bios-swi Uses SWI from the provided bios files (else HLE)" ENDL +" --lang N Pick firmware language (can affect game translations)" ENDL ENDL "Arguments affecting contents of SLOT-1:" ENDL " --slot1 [RETAIL|RETAILAUTO|R4|RETAILNAND|RETAILMCDROM|RETAILDEBUG]" ENDL @@ -163,6 +165,7 @@ ENDL #define OPT_CONSOLE_TYPE 200 #define OPT_ARM9 201 #define OPT_ARM7 202 +#define OPT_LANGUAGE 203 #define OPT_SLOT1 300 #define OPT_SLOT1_FAT_DIR 301 @@ -224,7 +227,8 @@ bool CommandLine::parse(int argc,char **argv) { "console-type", required_argument, NULL, OPT_CONSOLE_TYPE }, { "bios-arm9", required_argument, NULL, OPT_ARM9}, { "bios-arm7", required_argument, NULL, OPT_ARM7}, - { "bios-swi", required_argument, &_bios_swi, 1}, + { "bios-swi", no_argument, &_bios_swi, 1}, + { "lang", required_argument, NULL, OPT_LANGUAGE}, //slot-1 contents { "slot1", required_argument, NULL, OPT_SLOT1}, @@ -308,6 +312,7 @@ bool CommandLine::parse(int argc,char **argv) //utilities case OPT_ADVANSCENE: CommonSettings.run_advanscene_import = optarg; break; + case OPT_LANGUAGE: language = atoi(optarg); break; } } //arg parsing loop @@ -354,10 +359,10 @@ bool CommandLine::parse(int argc,char **argv) //process 3d renderer _render3d = strtoupper(_render3d); if(_render3d == "NONE") render3d = COMMANDLINE_RENDER3D_NONE; - if(_render3d == "SW") render3d = COMMANDLINE_RENDER3D_SW; - if(_render3d == "OLDGL") render3d = COMMANDLINE_RENDER3D_OLDGL; - if(_render3d == "AUTOGL") render3d = COMMANDLINE_RENDER3D_AUTOGL; - if(_render3d == "GL") render3d = COMMANDLINE_RENDER3D_GL; + else if(_render3d == "SW") render3d = COMMANDLINE_RENDER3D_SW; + else if(_render3d == "OLDGL") render3d = COMMANDLINE_RENDER3D_OLDGL; + else if(_render3d == "AUTOGL") render3d = COMMANDLINE_RENDER3D_AUTOGL; + else if(_render3d == "GL") render3d = COMMANDLINE_RENDER3D_GL; if (autodetect_method != -1) CommonSettings.autodetectBackupMethod = autodetect_method; diff --git a/desmume/src/commandline.h b/desmume/src/commandline.h index b77239400..3e095bc0e 100644 --- a/desmume/src/commandline.h +++ b/desmume/src/commandline.h @@ -47,6 +47,7 @@ public: int depth_threshold; int autodetect_method; int render3d; + int language; std::string nds_file; std::string play_movie_file; std::string record_movie_file; diff --git a/desmume/src/gtk/main.cpp b/desmume/src/gtk/main.cpp index 5b335cafb..8bde91193 100644 --- a/desmume/src/gtk/main.cpp +++ b/desmume/src/gtk/main.cpp @@ -1,6 +1,6 @@ /* main.cpp - this file is part of DeSmuME * - * Copyright (C) 2006-2015 DeSmuME Team + * Copyright (C) 2006-2016 DeSmuME Team * Copyright (C) 2007 Pascal Giard (evilynux) * * This file is free software; you can redistribute it and/or modify @@ -649,24 +649,30 @@ public: }; static void -init_configured_features( class configured_features *config) +init_configured_features( class configured_features *config ) { - config->engine_3d = 1; + if(config->render3d == COMMANDLINE_RENDER3D_GL || config->render3d == COMMANDLINE_RENDER3D_OLDGL || config->render3d == COMMANDLINE_RENDER3D_AUTOGL) + config->engine_3d = 2; + else + config->engine_3d = 1; config->savetype = 0; config->timeout = 0; /* use the default language */ - config->firmware_language = -1; + config->firmware_language = -1; + + /* If specified by --lang option the lang will change to choosed one */ + config->firmware_language = config->language; } static int fill_configured_features( class configured_features *config, - int argc, char ** argv) + char ** argv) { GOptionEntry options[] = { - { "3d-engine", 0, 0, G_OPTION_ARG_INT, &config->engine_3d, "Select 3d rendering engine. Available engines:\n" + { "3d-render", 0, 0, G_OPTION_ARG_INT, &config->engine_3d, "Select 3D rendering engine. Available engines:\n" "\t\t\t\t 0 = 3d disabled\n" "\t\t\t\t 1 = internal rasterizer (default)\n" #if defined(HAVE_LIBOSMESA) || defined(HAVE_GL_GLX) @@ -696,7 +702,6 @@ fill_configured_features( class configured_features *config, //g_option_context_add_main_entries (config->ctx, options, "options"); //g_option_context_add_group (config->ctx, gtk_get_option_group (TRUE)); - config->parse(argc,argv); if(!config->validate()) goto error; @@ -3252,6 +3257,7 @@ int main (int argc, char *argv[]) // The global menu screws up the window size... unsetenv("UBUNTU_MENUPROXY"); + my_config.parse(argc, argv); init_configured_features( &my_config); if (!g_thread_supported()) @@ -3259,7 +3265,7 @@ int main (int argc, char *argv[]) gtk_init(&argc, &argv); - if ( !fill_configured_features( &my_config, argc, argv)) { + if ( !fill_configured_features( &my_config, argv)) { exit(0); } diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index 1f7b29b1f..abc51e050 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -3383,6 +3383,9 @@ int _main() } } + if(cmdline.language != -1) + CommonSettings.fw_config.language = cmdline.language; + cmdline.process_movieCommands(); if(cmdline.load_slot != -1)