-//
-// app.cpp - Qt-based GUI for Virtual Jaguar
-//
-// by James Hammons
-// (C) 2010 Underground Software
-//
-// JLH = James Hammons <jlhamm@acm.org>
-// JPM = Jean-Paul Mari <djipi.mari@gmail.com>
-//
-// Who When What
-// --- ---------- -----------------------------------------------------------
-// JLH 12/23/2009 Created this file
-// JLH 01/21/2011 Added SDL initialization
-// JLH 06/26/2011 Added fix to keep SDL from hijacking main() on win32
-// JLH 05/24/2012 Added option switches
-// JLH 03/05/2013 Fixed console redireciton on win32 platform :-P
-// JPM 06/06/2016 Visual Studio support
-// JPM 06/19/2016 Soft debugger support (--debugger)
-// JPM 09/ /2017 Added option (--dram-max)
-// JPM 09/06/2017 Added the 'Rx' word to the emulator name and updated the credits line
-//
-
-#include "app.h"
-
-#include <SDL.h>
-#include <QApplication>
-#include "gamepad.h"
-#include "log.h"
-#include "mainwin.h"
-#include "profile.h"
-#include "settings.h"
-#include "version.h"
-#include "debugger/DBGManager.h"
-
-// Apparently on win32, SDL is hijacking main from Qt. So let's do this:
-#if defined (__GCCWIN32__) || defined (_MSC_VER)
-#undef main
-#include <windows.h> // Ick, but needed for console redirection on win32 :-O
-#endif
-
-// Function prototypes...
-static bool ParseCommandLine(int argc, char * argv[]);
-static void ParseOptions(int argc, char * argv[]);
-
-
-//hm. :-/
-// This is stuff we pass into the mainWindow...
-// Also, these are defaults. :-)
-bool noUntunedTankPlease = false;
-bool loadAndGo = false;
-bool useLogfile = false;
-QString filename;
-
-// Here's the main application loop--short and simple...
-int main(int argc, char * argv[])
-{
- // Win32 console redirection, because MS and their band of super geniuses
- // decided that nobody would ever launch an app from the command line. :-P
- // [Unfortunately, this doesn't seem to work on Vista/7. :-(]
-#if defined (__GCCWIN32__) || defined (_MSC_VER)
- BOOL(WINAPI * AttachConsole)(DWORD dwProcessId);
-
- AttachConsole = (BOOL (WINAPI *)(DWORD))
- GetProcAddress(LoadLibraryA("kernel32.dll"), "AttachConsole");
-
- if (AttachConsole != NULL && AttachConsole(((DWORD)-1)))
- {
- if (_fileno(stdout) == -1)
- freopen("CONOUT$", "wb", stdout);
- if (_fileno(stderr) == -1)
- freopen("CONOUT$", "wb", stderr);
- if (_fileno(stdin) == -1)
- freopen("CONIN$", "rb", stdin);
-
- // Fix C++
- std::ios::sync_with_stdio();
- }
-#endif
-
- // Normally, this would be read in from the settings module... :-P
- vjs.hardwareTypeAlpine = false;
- vjs.softTypeDebugger = false;
- vjs.DRAM_size = 0x200000;
- // This is stuff we pass into the mainWindow...
-// noUntunedTankPlease = false;
-
- // Check for options that must be in place be constructing the App object
- if (!ParseCommandLine(argc, argv))
- {
- return 0;
- }
-
- Q_INIT_RESOURCE(virtualjaguar); // This must the same name as the exe filename
-//or is it the .qrc filename???
- // This is so we can pass this stuff using signal/slot mechanism...
-//this is left here to remind me not to try doing this again :-P
-//ick int id = qRegisterMetaType<uint32>();
-
- int retVal = -1; // Default is failure
-
- if (useLogfile)
- {
- bool success = (bool)LogInit("./virtualjaguar.log"); // Init logfile
-
- if (!success)
- printf("Failed to open virtualjaguar.log for writing!\n");
- }
-
- // Set up SDL library
- if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_AUDIO) < 0)
- {
- WriteLog("VJ: Could not initialize the SDL library: %s\n", SDL_GetError());
- }
- else
- {
- WriteLog("VJ: SDL (joystick, audio) successfully initialized.\n");
- DBGManager_Init();
- App app(argc, argv); // Declare an instance of the application
- Gamepad::AllocateJoysticks();
- AutoConnectProfiles();
- retVal = app.exec(); // And run it!
- DBGManager_Close();
- Gamepad::DeallocateJoysticks();
-
- // Free SDL components last...!
- SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_AUDIO);
- SDL_Quit();
- }
-
-#if defined (__GCCWIN32__) || defined (_MSC_VER)
-#if 0
- fclose(ctt);
-#endif
-#endif
- // Close logfile
- LogDone();
- return retVal;
-}
-
-//
-// Main app constructor--we stick globally accessible stuff here... (?)
-//
-App::App(int & argc, char * argv[]): QApplication(argc, argv)
-{
- bool loadAndGo = !filename.isEmpty();
-
- mainWindow = new MainWin(loadAndGo);
- mainWindow->plzDontKillMyComputer = noUntunedTankPlease;
- // Override defaults with command line (if any)
- ParseOptions(argc, argv);
- mainWindow->SyncUI();
-
- if (loadAndGo)
- {
- mainWindow->LoadFile(filename);
-
- if (!mainWindow->cartridgeLoaded)
- printf("Could not load file \"%s\"!\n", filename.toUtf8().data());
- }
-
- mainWindow->show();
-}
-
-
-//
-// Here we parse out stuff that needs to be looked at *before* we construct the
-// App object.
-//
-bool ParseCommandLine(int argc, char * argv[])
-{
- for(int i=1; i<argc; i++)
- {
- if ((strcmp(argv[i], "--help") == 0) || (strcmp(argv[i], "-h") == 0) || (strcmp(argv[i], "-?") == 0))
- {
- printf(
- "Virtual Jaguar " VJ_RELEASE_VERSION " (" VJ_RELEASE_SUBVERSION ") Rx\n"
- "Based upon Virtual Jaguar core v1.0.0 by David Raingeard.\n"
- "Based upon the work by James Hammons (Linux/WIN32), Niels Wagenaar (Linux/WIN32),\n"
- "Carwin Jones (BeOS), and Adam Green (MacOS)\n"
- "Contact: http://sdlemu.ngemu.com/ | sdlemu@ngemu.com\n"
- "\n"
- "Usage:\n"
- " virtualjaguar [<filename>] [switches]\n"
- "\n"
- " Option Description\n"
- " ---------------- -----------------------------------\n"
- " <filename> Name of file to autoload\n"
- " --alpine -a Put Virtual Jaguar into Alpine mode\n"
- " --debugger -d Put Virtual Jaguar into Debugger mode\n"
- " --pal -p PAL mode\n"
- " --ntsc -n NTSC mode\n"
- " --dram-max Set DRAM size to 8MB\n"
- " --bios -b Boot using Jagaur BIOS\n"
- " --no-bios Do not use Jaguar BIOS\n"
- " --gpu -g Enable GPU\n"
- " --no-gpu Disable GPU\n"
- " --dsp -d Enable DSP\n"
- " --no-dsp Disable DSP\n"
- " --fullscreen -f Start in full screen mode\n"
- " --blur -B Enable GL bilinear filter\n"
- " --no-blur Disable GL bilinear filtering\n"
- " --log -l Create and use log file\n"
- " --no-log Do not use log file (default)\n"
- " --help -h Show this message\n"
- " -? Show this message\n"
- " --please-dont-kill-my-computer\n"
- " -z Run Virtual Jaguar without \"snow\"\n"
- "\n"
- "Invoking Virtual Jaguar with no filename will cause it to boot up\n"
- "with the VJ GUI. Using Alpine mode will enable log file.\n"
- "\n");
- return false;
- }
-
- // Easter egg
- if (strcmp(argv[i], "--yarrr") == 0)
- {
- printf("\n");
- printf("Shiver me timbers!\n");
- printf("\n");
- return false;
- }
-
- // Alpine/Debug mode
- if ((strcmp(argv[i], "--alpine") == 0) || (strcmp(argv[i], "-a") == 0))
- {
- printf("Alpine Mode enabled.\n");
- vjs.hardwareTypeAlpine = true;
- // We also enable logging as well :-)
- useLogfile = true;
- }
-
- // Debugger mode
- if ((strcmp(argv[i], "--debugger") == 0) || (strcmp(argv[i], "-d") == 0))
- {
- printf("Debugger mode enabled.\n");
- vjs.softTypeDebugger = true;
- }
-
- // No snow display
- if ((strcmp(argv[i], "--please-dont-kill-my-computer") == 0) || (strcmp(argv[i], "-z") == 0))
- {
- noUntunedTankPlease = true;
- }
-
- // Log file
- if ((strcmp(argv[i], "--log") == 0) || (strcmp(argv[i], "-l") == 0))
- {
- printf("Log file enabled.\n");
- useLogfile = true;
- }
-
- // No log file
- if (strcmp(argv[i], "--no-log") == 0)
- {
- printf("Log file disabled.\n");
- useLogfile = false;
- }
-
- // DRAM size max
- if (strcmp(argv[i], "--dram-max") == 0)
- {
- printf("DRAM size set at 8 Mbytes.\n");
- vjs.DRAM_size = 0x800000;
- }
-
- // Check for filename
- if (argv[i][0] != '-')
- {
- loadAndGo = true;
- filename = argv[i];
- }
- }
-
- return true;
-}
-
-
-//
-// This is to override settings loaded from the config file.
-// Note that settings set here will become the new defaults!
-// (Not any more: Settings are only saved if the config dialog was OKed, or the toolbar buttons were pressed.)
-//
-void ParseOptions(int argc, char * argv[])
-{
- for(int i=1; i<argc; i++)
- {
- // PAL mode
- if ((strcmp(argv[i], "--pal") == 0) || (strcmp(argv[i], "-p") == 0))
- {
- vjs.hardwareTypeNTSC = false;
- }
-
- // NTSC mode
- if ((strcmp(argv[i], "--ntsc") == 0) || (strcmp(argv[i], "-n") == 0))
- {
- vjs.hardwareTypeNTSC = true;
- }
-
- // Boot with Bios
- if ((strcmp(argv[i], "--bios") == 0) || (strcmp(argv[i], "-b") == 0))
- {
- vjs.useJaguarBIOS = true;
- }
-
- // No boot with Bios
- if (strcmp(argv[i], "--no-bios") == 0)
- {
- vjs.useJaguarBIOS = false;
- }
-
- // GPU enable
- if ((strcmp(argv[i], "--gpu") == 0) || (strcmp(argv[i], "-g") == 0))
- {
- vjs.GPUEnabled = true;
- }
-
- // GPU disable
- if (strcmp(argv[i], "--no-gpu") == 0)
- {
- vjs.GPUEnabled = false;
- }
-
- // DSP enable
- if ((strcmp(argv[i], "--dsp") == 0) || (strcmp(argv[i], "-d") == 0))
- {
- vjs.DSPEnabled = true;
- vjs.audioEnabled = true;
- }
-
- // DSP disable
- if (strcmp(argv[i], "--no-dsp") == 0)
- {
- vjs.DSPEnabled = false;
- vjs.audioEnabled = false;
- }
-
- // Fullscreen mode
- if ((strcmp(argv[i], "--fullscreen") == 0) || (strcmp(argv[i], "-f") == 0))
- {
- vjs.fullscreen = true;
- }
-
- // Enable GL bilinear filter
- if ((strcmp(argv[i], "--blur") == 0) || (strcmp(argv[i], "-B") == 0))
- {
- vjs.glFilter = 1;
- }
-
- // Disable GL bilinear filter
- if (strcmp(argv[i], "--no-blur") == 0)
- {
- vjs.glFilter = 0;
- }
- }
-}
-
-#if 0
- bool useJoystick;
- int32 joyport; // Joystick port
- bool hardwareTypeNTSC; // Set to false for PAL
- bool useJaguarBIOS;
- bool GPUEnabled;
- bool DSPEnabled;
- bool usePipelinedDSP;
- bool fullscreen;
- bool useOpenGL;
- uint32 glFilter;
- bool hardwareTypeAlpine;
- bool softTypeDebugger;
- bool audioEnabled;
- uint32 frameSkip;
- uint32 renderType;
- bool allowWritesToROM;
-
- // Keybindings in order of U, D, L, R, C, B, A, Op, Pa, 0-9, #, *
-
- uint32 p1KeyBindings[21];
- uint32 p2KeyBindings[21];
-
- // Paths
-
- char ROMPath[MAX_PATH];
- char jagBootPath[MAX_PATH];
- char CDBootPath[MAX_PATH];
- char EEPROMPath[MAX_PATH];
- char alpineROMPath[MAX_PATH];
- char absROMPath[MAX_PATH];
-#endif
-
+//\r
+// app.cpp - Qt-based GUI for Virtual Jaguar\r
+//\r
+// by James Hammons\r
+// (C) 2010 Underground Software\r
+//\r
+// JLH = James Hammons <jlhamm@acm.org>\r
+// JPM = Jean-Paul Mari <djipi.mari@gmail.com>\r
+//\r
+// Who When What\r
+// --- ---------- -----------------------------------------------------------\r
+// JLH 12/23/2009 Created this file\r
+// JLH 01/21/2011 Added SDL initialization\r
+// JLH 06/26/2011 Added fix to keep SDL from hijacking main() on win32\r
+// JLH 05/24/2012 Added option switches\r
+// JLH 03/05/2013 Fixed console redireciton on win32 platform :-P\r
+// JPM 06/06/2016 Visual Studio support\r
+// JPM 06/19/2016 Soft debugger support (--debugger)\r
+// JPM 09/ /2017 Added option (--dram-max) to support 8MB ram (which doesn't exist)\r
+// JPM 09/06/2017 Added the 'Rx' word to the emulator name and updated the credits line\r
+// JPM 09/08/2017 Added option (--es-all, --es-ui, --es-alpine & --es-debugger) to support the erase settings\r
+//\r
+\r
+#include "app.h"\r
+\r
+#include <SDL.h>\r
+#include <QApplication>\r
+#include "gamepad.h"\r
+#include "log.h"\r
+#include "mainwin.h"\r
+#include "profile.h"\r
+#include "settings.h"\r
+#include "version.h"\r
+#include "debugger/DBGManager.h"\r
+\r
+// Apparently on win32, SDL is hijacking main from Qt. So let's do this:\r
+#if defined (__GCCWIN32__) || defined (_MSC_VER)\r
+#undef main\r
+#include <windows.h> // Ick, but needed for console redirection on win32 :-O\r
+#endif\r
+\r
+// Function prototypes...\r
+static bool ParseCommandLine(int argc, char * argv[]);\r
+static void ParseOptions(int argc, char * argv[]);\r
+\r
+\r
+//hm. :-/\r
+// This is stuff we pass into the mainWindow...\r
+// Also, these are defaults. :-)\r
+bool noUntunedTankPlease = false;\r
+bool loadAndGo = false;\r
+bool useLogfile = false;\r
+QString filename;\r
+\r
+// Here's the main application loop--short and simple...\r
+int main(int argc, char * argv[])\r
+{\r
+ // Win32 console redirection, because MS and their band of super geniuses\r
+ // decided that nobody would ever launch an app from the command line. :-P\r
+ // [Unfortunately, this doesn't seem to work on Vista/7. :-(]\r
+#if defined (__GCCWIN32__) || defined (_MSC_VER)\r
+ BOOL(WINAPI * AttachConsole)(DWORD dwProcessId);\r
+\r
+ AttachConsole = (BOOL (WINAPI *)(DWORD))GetProcAddress(LoadLibraryA("kernel32.dll"), "AttachConsole");\r
+\r
+ if (AttachConsole != NULL && AttachConsole(((DWORD)-1)))\r
+ {\r
+ if (_fileno(stdout) == -1)\r
+ freopen("CONOUT$", "wb", stdout);\r
+ if (_fileno(stderr) == -1)\r
+ freopen("CONOUT$", "wb", stderr);\r
+ if (_fileno(stdin) == -1)\r
+ freopen("CONIN$", "rb", stdin);\r
+\r
+ // Fix C++\r
+ std::ios::sync_with_stdio();\r
+ }\r
+#endif\r
+\r
+ // Normally, this would be read in from the settings module... :-P\r
+ vjs.hardwareTypeAlpine = false;\r
+ vjs.softTypeDebugger = false;\r
+ vjs.DRAM_size = 0x200000;\r
+ // This is stuff we pass into the mainWindow...\r
+// noUntunedTankPlease = false;\r
+\r
+ // Check for options that must be in place be constructing the App object\r
+ if (!ParseCommandLine(argc, argv))\r
+ {\r
+ return 0;\r
+ }\r
+\r
+ Q_INIT_RESOURCE(virtualjaguar); // This must the same name as the exe filename\r
+//or is it the .qrc filename???\r
+ // This is so we can pass this stuff using signal/slot mechanism...\r
+//this is left here to remind me not to try doing this again :-P\r
+//ick int id = qRegisterMetaType<uint32>();\r
+\r
+ int retVal = -1; // Default is failure\r
+\r
+ if (useLogfile)\r
+ {\r
+ bool success = (bool)LogInit("./virtualjaguar.log"); // Init logfile\r
+\r
+ if (!success)\r
+ printf("Failed to open virtualjaguar.log for writing!\n");\r
+ }\r
+\r
+ // Set up SDL library\r
+ if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_AUDIO) < 0)\r
+ {\r
+ WriteLog("VJ: Could not initialize the SDL library: %s\n", SDL_GetError());\r
+ }\r
+ else\r
+ {\r
+ WriteLog("VJ: SDL (joystick, audio) successfully initialized.\n");\r
+ DBGManager_Init();\r
+ App app(argc, argv); // Declare an instance of the application\r
+ Gamepad::AllocateJoysticks();\r
+ AutoConnectProfiles();\r
+ retVal = app.exec(); // And run it!\r
+ DBGManager_Close();\r
+ Gamepad::DeallocateJoysticks();\r
+\r
+ // Free SDL components last...!\r
+ SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_AUDIO);\r
+ SDL_Quit();\r
+ }\r
+\r
+#if defined (__GCCWIN32__) || defined (_MSC_VER)\r
+#if 0\r
+ fclose(ctt);\r
+#endif\r
+#endif\r
+ // Close logfile\r
+ LogDone();\r
+ return retVal;\r
+}\r
+\r
+\r
+//\r
+// Main app constructor--we stick globally accessible stuff here... (?)\r
+//\r
+App::App(int & argc, char * argv[]): QApplication(argc, argv)\r
+{\r
+ bool loadAndGo = !filename.isEmpty();\r
+\r
+ mainWindow = new MainWin(loadAndGo);\r
+ mainWindow->plzDontKillMyComputer = noUntunedTankPlease;\r
+ // Override defaults with command line (if any)\r
+ ParseOptions(argc, argv);\r
+ mainWindow->SyncUI();\r
+\r
+ if (loadAndGo)\r
+ {\r
+ mainWindow->LoadFile(filename);\r
+\r
+ if (!mainWindow->cartridgeLoaded)\r
+ printf("Could not load file \"%s\"!\n", filename.toUtf8().data());\r
+ }\r
+\r
+ mainWindow->show();\r
+}\r
+\r
+\r
+//\r
+// Here we parse out stuff that needs to be looked at *before* we construct the \r
+// App object.\r
+//\r
+bool ParseCommandLine(int argc, char * argv[])\r
+{\r
+ for(int i=1; i<argc; i++)\r
+ {\r
+ if ((strcmp(argv[i], "--help") == 0) || (strcmp(argv[i], "-h") == 0) || (strcmp(argv[i], "-?") == 0))\r
+ {\r
+ printf(\r
+ "Virtual Jaguar " VJ_RELEASE_VERSION " (" VJ_RELEASE_SUBVERSION ") Rx\n"\r
+ "Based upon Virtual Jaguar core v1.0.0 by David Raingeard.\n"\r
+ "Based upon the work by James Hammons (Linux/WIN32), Niels Wagenaar (Linux/WIN32),\n"\r
+ "Carwin Jones (BeOS), and Adam Green (MacOS)\n"\r
+ "Contact: http://sdlemu.ngemu.com/ | sdlemu@ngemu.com\n"\r
+ "\n"\r
+ "Usage:\n"\r
+ " virtualjaguar [<filename>] [switches]\n"\r
+ "\n"\r
+ " Option Description\n"\r
+ " ---------------- -----------------------------------\n"\r
+ " <filename> Name of file to autoload\n"\r
+ " --alpine -a Put Virtual Jaguar into Alpine mode\n"\r
+ " --debugger -d Put Virtual Jaguar into Debugger mode\n"\r
+ " --pal -p PAL mode\n"\r
+ " --ntsc -n NTSC mode\n"\r
+ " --dram-max Set DRAM size to 8MB\n"\r
+ " --bios -b Boot using Jagaur BIOS\n"\r
+ " --no-bios Do not use Jaguar BIOS\n"\r
+ " --gpu -g Enable GPU\n"\r
+ " --no-gpu Disable GPU\n"\r
+ " --dsp -d Enable DSP\n"\r
+ " --no-dsp Disable DSP\n"\r
+ " --fullscreen -f Start in full screen mode\n"\r
+ " --blur -B Enable GL bilinear filter\n"\r
+ " --no-blur Disable GL bilinear filtering\n"\r
+ " --log -l Create and use log file\n"\r
+ " --no-log Do not use log file (default)\n"\r
+ " --help -h Show this message\n"\r
+ " -? Show this message\n"\r
+ " --es-all Erase all settings\n"\r
+ " --es-ui Erase UI settings only\n"\r
+ " --es-alpine Erase alpine mode settings only\n"\r
+ " --es-debugger Erase debugger mode settings only\n"\r
+ " --please-dont-kill-my-computer\n"\r
+ " -z Run Virtual Jaguar without \"snow\"\n"\r
+ "\n"\r
+ "Invoking Virtual Jaguar with no filename will cause it to boot up\n"\r
+ "with the VJ GUI. Using Alpine mode will enable log file.\n"\r
+ "\n");\r
+ return false;\r
+ }\r
+\r
+ // Easter egg\r
+ if (strcmp(argv[i], "--yarrr") == 0)\r
+ {\r
+ printf("\n");\r
+ printf("Shiver me timbers!\n");\r
+ printf("\n");\r
+ return false;\r
+ }\r
+\r
+ // Erase settings\r
+ if (strstr(argv[i], "--es-"))\r
+ {\r
+ printf("\n");\r
+ if (EraseSettings(&argv[i][5]))\r
+ {\r
+ printf("Settings have been erased");\r
+ }\r
+ else\r
+ {\r
+ printf("No requested settings have been found");\r
+ }\r
+ printf("\n\n");\r
+ return false;\r
+ }\r
+\r
+ // Alpine/Debug mode\r
+ if ((strcmp(argv[i], "--alpine") == 0) || (strcmp(argv[i], "-a") == 0))\r
+ {\r
+ printf("Alpine Mode enabled.\n");\r
+ vjs.hardwareTypeAlpine = true;\r
+ // We also enable logging as well :-)\r
+ useLogfile = true;\r
+ }\r
+\r
+ // Debugger mode\r
+ if ((strcmp(argv[i], "--debugger") == 0) || (strcmp(argv[i], "-d") == 0))\r
+ {\r
+ printf("Debugger mode enabled.\n");\r
+ vjs.softTypeDebugger = true;\r
+ }\r
+\r
+ // No snow display\r
+ if ((strcmp(argv[i], "--please-dont-kill-my-computer") == 0) || (strcmp(argv[i], "-z") == 0))\r
+ {\r
+ noUntunedTankPlease = true;\r
+ }\r
+\r
+ // Log file\r
+ if ((strcmp(argv[i], "--log") == 0) || (strcmp(argv[i], "-l") == 0))\r
+ {\r
+ printf("Log file enabled.\n");\r
+ useLogfile = true;\r
+ }\r
+\r
+ // No log file\r
+ if (strcmp(argv[i], "--no-log") == 0)\r
+ {\r
+ printf("Log file disabled.\n");\r
+ useLogfile = false;\r
+ }\r
+\r
+ // DRAM size max\r
+ if (strcmp(argv[i], "--dram-max") == 0)\r
+ {\r
+ printf("DRAM size set at 8 Mbytes.\n");\r
+ vjs.DRAM_size = 0x800000;\r
+ }\r
+\r
+ // Check for filename\r
+ if (argv[i][0] != '-')\r
+ {\r
+ loadAndGo = true;\r
+ filename = argv[i];\r
+ }\r
+ }\r
+\r
+ return true;\r
+}\r
+\r
+\r
+//\r
+// This is to override settings loaded from the config file.\r
+// Note that settings set here will become the new defaults!\r
+// (Not any more: Settings are only saved if the config dialog was OKed, or the toolbar buttons were pressed.)\r
+//\r
+void ParseOptions(int argc, char * argv[])\r
+{\r
+ for(int i=1; i<argc; i++)\r
+ {\r
+ // PAL mode\r
+ if ((strcmp(argv[i], "--pal") == 0) || (strcmp(argv[i], "-p") == 0))\r
+ {\r
+ vjs.hardwareTypeNTSC = false;\r
+ }\r
+\r
+ // NTSC mode\r
+ if ((strcmp(argv[i], "--ntsc") == 0) || (strcmp(argv[i], "-n") == 0))\r
+ {\r
+ vjs.hardwareTypeNTSC = true;\r
+ }\r
+\r
+ // Boot with Bios\r
+ if ((strcmp(argv[i], "--bios") == 0) || (strcmp(argv[i], "-b") == 0))\r
+ {\r
+ vjs.useJaguarBIOS = true;\r
+ }\r
+\r
+ // No boot with Bios\r
+ if (strcmp(argv[i], "--no-bios") == 0)\r
+ {\r
+ vjs.useJaguarBIOS = false;\r
+ }\r
+\r
+ // GPU enable\r
+ if ((strcmp(argv[i], "--gpu") == 0) || (strcmp(argv[i], "-g") == 0))\r
+ {\r
+ vjs.GPUEnabled = true;\r
+ }\r
+\r
+ // GPU disable\r
+ if (strcmp(argv[i], "--no-gpu") == 0)\r
+ {\r
+ vjs.GPUEnabled = false;\r
+ }\r
+\r
+ // DSP enable\r
+ if ((strcmp(argv[i], "--dsp") == 0) || (strcmp(argv[i], "-d") == 0))\r
+ {\r
+ vjs.DSPEnabled = true;\r
+ vjs.audioEnabled = true;\r
+ }\r
+\r
+ // DSP disable\r
+ if (strcmp(argv[i], "--no-dsp") == 0)\r
+ {\r
+ vjs.DSPEnabled = false;\r
+ vjs.audioEnabled = false;\r
+ }\r
+\r
+ // Fullscreen mode\r
+ if ((strcmp(argv[i], "--fullscreen") == 0) || (strcmp(argv[i], "-f") == 0))\r
+ {\r
+ vjs.fullscreen = true;\r
+ }\r
+\r
+ // Enable GL bilinear filter\r
+ if ((strcmp(argv[i], "--blur") == 0) || (strcmp(argv[i], "-B") == 0))\r
+ {\r
+ vjs.glFilter = 1;\r
+ }\r
+\r
+ // Disable GL bilinear filter\r
+ if (strcmp(argv[i], "--no-blur") == 0)\r
+ {\r
+ vjs.glFilter = 0;\r
+ }\r
+ }\r
+}\r
+\r
+#if 0\r
+ bool useJoystick;\r
+ int32 joyport; // Joystick port\r
+ bool hardwareTypeNTSC; // Set to false for PAL\r
+ bool useJaguarBIOS;\r
+ bool GPUEnabled;\r
+ bool DSPEnabled;\r
+ bool usePipelinedDSP;\r
+ bool fullscreen;\r
+ bool useOpenGL;\r
+ uint32 glFilter;\r
+ bool hardwareTypeAlpine;\r
+ bool softTypeDebugger;\r
+ bool audioEnabled;\r
+ uint32 frameSkip;\r
+ uint32 renderType;\r
+ bool allowWritesToROM;\r
+\r
+ // Keybindings in order of U, D, L, R, C, B, A, Op, Pa, 0-9, #, *\r
+\r
+ uint32 p1KeyBindings[21];\r
+ uint32 p2KeyBindings[21];\r
+\r
+ // Paths\r
+\r
+ char ROMPath[MAX_PATH];\r
+ char jagBootPath[MAX_PATH];\r
+ char CDBootPath[MAX_PATH];\r
+ char EEPROMPath[MAX_PATH];\r
+ char alpineROMPath[MAX_PATH];\r
+ char absROMPath[MAX_PATH];\r
+#endif\r
+\r