diff --git a/pcsx2/CDVD/CDVDaccess.cpp b/pcsx2/CDVD/CDVDaccess.cpp index 98a561e072..96770f6e72 100644 --- a/pcsx2/CDVD/CDVDaccess.cpp +++ b/pcsx2/CDVD/CDVDaccess.cpp @@ -311,7 +311,7 @@ s32 DoCDVDopen(const char* pTitleFilename) time(&rawtime); timeinfo = localtime(&rawtime); - ssprintf( fname, fname_only+" (%04d-%02d-%02d %02d-%02d-%02d).dump", + ssprintf( fname, (fname_only+" (%04d-%02d-%02d %02d-%02d-%02d).dump").c_str(), timeinfo->tm_year + 1900, timeinfo->tm_mon, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec ); diff --git a/pcsx2/HostGui.h b/pcsx2/HostGui.h index 0206c8d6c7..e69304ff94 100644 --- a/pcsx2/HostGui.h +++ b/pcsx2/HostGui.h @@ -17,6 +17,7 @@ */ #pragma once +#include "CDVD.h" ////////////////////////////////////////////////////////////////////////////////////////// // Startup Parameters. diff --git a/pcsx2/Linux/ConfigDlg.cpp b/pcsx2/Linux/ConfigDlg.cpp index 66773fb5c2..63a714ef4e 100644 --- a/pcsx2/Linux/ConfigDlg.cpp +++ b/pcsx2/Linux/ConfigDlg.cpp @@ -134,7 +134,7 @@ void OnConfConf_Ok(GtkButton *button, gpointer user_data) plugin_types type; applychanges = TRUE; - for (type = GS; type <= BIOS; type = (plugin_types)((int)type + 1)) + for (type = PT_GS; type <= PT_BIOS; type = (plugin_types)((int)type + 1)) { PluginConf *confs = ConfS(type); @@ -188,7 +188,7 @@ void UpdateConfDlg() plugin_types type; FindPlugins(); - for (type = GS; type <= BIOS; type = (plugin_types)((int)type + 1)) + for (type = PT_GS; type <= PT_BIOS; type = (plugin_types)((int)type + 1)) { char tmp[50]; PluginConf *confs = ConfS(type); @@ -274,7 +274,7 @@ void FindPlugins() char plugin[g_MaxPath], name[g_MaxPath]; plugin_types type; - for (type = GS; type <= BIOS; type = (plugin_types)((int)type + 1)) + for (type = PT_GS; type <= PT_BIOS; type = (plugin_types)((int)type + 1)) { PluginConf *confs = ConfS(type); diff --git a/pcsx2/Linux/ConfigDlg.h b/pcsx2/Linux/ConfigDlg.h index 09e5d1a42d..3da6487035 100644 --- a/pcsx2/Linux/ConfigDlg.h +++ b/pcsx2/Linux/ConfigDlg.h @@ -26,15 +26,15 @@ typedef enum { NO_PLUGIN_TYPE = 0, - GS, - PAD1, - PAD2, - SPU2, - CDVD, - DEV9, - USB, - FW, - BIOS + PT_GS, + PT_PAD1, + PT_PAD2, + PT_SPU2, + PT_CDVD, + PT_DEV9, + PT_USB, + PT_FW, + PT_BIOS } plugin_types; typedef enum @@ -67,15 +67,15 @@ __forceinline PluginConf *ConfS(int type) { switch (type) { - case GS: return &GSConfS; - case PAD1: return &PAD1ConfS; - case PAD2: return &PAD2ConfS; - case SPU2: return &SPU2ConfS; - case CDVD: return &CDVDConfS; - case DEV9: return &DEV9ConfS; - case USB: return &USBConfS; - case FW: return &FWConfS; - case BIOS: return &BiosConfS; + case PT_GS: return &GSConfS; + case PT_PAD1: return &PAD1ConfS; + case PT_PAD2: return &PAD2ConfS; + case PT_SPU2: return &SPU2ConfS; + case PT_CDVD: return &CDVDConfS; + case PT_DEV9: return &DEV9ConfS; + case PT_USB: return &USBConfS; + case PT_FW: return &FWConfS; + case PT_BIOS: return &BiosConfS; } } @@ -83,15 +83,15 @@ __forceinline const char *PluginName(int type) { switch (type) { - case GS: return Config.Plugins.GS; - case PAD1: return Config.Plugins.PAD1; - case PAD2: return Config.Plugins.PAD2; - case SPU2: return Config.Plugins.SPU2; - case CDVD: return Config.Plugins.CDVD; - case DEV9: return Config.Plugins.DEV9; - case USB: return Config.Plugins.USB; - case FW: return Config.Plugins.FW; - case BIOS: return Config.Bios; + case PT_GS: return Config.Plugins.GS; + case PT_PAD1: return Config.Plugins.PAD1; + case PT_PAD2: return Config.Plugins.PAD2; + case PT_SPU2: return Config.Plugins.SPU2; + case PT_CDVD: return Config.Plugins.CDVD; + case PT_DEV9: return Config.Plugins.DEV9; + case PT_USB: return Config.Plugins.USB; + case PT_FW: return Config.Plugins.FW; + case PT_BIOS: return Config.Bios; } return NULL; } @@ -100,7 +100,7 @@ __forceinline const char *PluginCallbackName(int type, int call) { switch (type) { - case GS: + case PT_GS: switch (call) { case PLUGIN_CONFIG: return "GSconfigure"; @@ -109,8 +109,8 @@ __forceinline const char *PluginCallbackName(int type, int call) default: return NULL; } break; - case PAD1: - case PAD2: + case PT_PAD1: + case PT_PAD2: switch (call) { case PLUGIN_CONFIG: return "PADconfigure"; @@ -119,7 +119,7 @@ __forceinline const char *PluginCallbackName(int type, int call) default: return NULL; } break; - case SPU2: + case PT_SPU2: switch (call) { case PLUGIN_CONFIG: return "SPU2configure"; @@ -128,7 +128,7 @@ __forceinline const char *PluginCallbackName(int type, int call) default: return NULL; } break; - case CDVD: + case PT_CDVD: switch (call) { case PLUGIN_CONFIG: return "CDVDconfigure"; @@ -137,7 +137,7 @@ __forceinline const char *PluginCallbackName(int type, int call) default: return NULL; } break; - case DEV9: + case PT_DEV9: switch (call) { case PLUGIN_CONFIG: return "DEV9configure"; @@ -146,7 +146,7 @@ __forceinline const char *PluginCallbackName(int type, int call) default: return NULL; } break; - case USB: + case PT_USB: switch (call) { case PLUGIN_CONFIG: return "USBconfigure"; @@ -155,7 +155,7 @@ __forceinline const char *PluginCallbackName(int type, int call) default: return NULL; } break; - case FW: + case PT_FW: switch (call) { case PLUGIN_CONFIG: return "FWconfigure"; @@ -192,31 +192,31 @@ __forceinline plugin_types strToPluginType(char *s) char *sub = NULL; sub = strstr(s, "GS"); - if (sub != NULL) return GS; + if (sub != NULL) return PT_GS; sub = strstr(s, "SPU2"); - if (sub != NULL) return SPU2; + if (sub != NULL) return PT_SPU2; sub = strstr(s, "PAD1"); - if (sub != NULL) return PAD1; + if (sub != NULL) return PT_PAD1; sub = strstr(s, "PAD2"); - if (sub != NULL) return PAD2; + if (sub != NULL) return PT_PAD2; sub = strstr(s, "CDVD"); - if (sub != NULL) return CDVD; + if (sub != NULL) return PT_CDVD; sub = strstr(s, "DEV9"); - if (sub != NULL) return DEV9; + if (sub != NULL) return PT_DEV9; sub = strstr(s, "USB"); - if (sub != NULL) return USB; + if (sub != NULL) return PT_USB; sub = strstr(s, "FW"); - if (sub != NULL) return FW; + if (sub != NULL) return PT_FW; sub = strstr(s, "Bios"); - if (sub != NULL) return BIOS; + if (sub != NULL) return PT_BIOS; return NO_PLUGIN_TYPE; } @@ -224,15 +224,15 @@ __forceinline const char *PluginTypeToStr(int type) { switch (type) { - case GS: return "GS"; - case SPU2: return "SPU2"; - case PAD1: return "PAD1"; - case PAD2: return "PAD2"; - case CDVD: return "CDVD"; - case DEV9: return "DEV9"; - case USB: return "USB"; - case FW: return "FW"; - case BIOS: return "Bios"; + case PT_GS: return "GS"; + case PT_SPU2: return "SPU2"; + case PT_PAD1: return "PAD1"; + case PT_PAD2: return "PAD2"; + case PT_CDVD: return "CDVD"; + case PT_DEV9: return "DEV9"; + case PT_USB: return "USB"; + case PT_FW: return "FW"; + case PT_BIOS: return "Bios"; default: return ""; } return ""; diff --git a/pcsx2/Linux/DebugDlg.cpp b/pcsx2/Linux/DebugDlg.cpp index 4f0b19210b..5407148ea7 100644 --- a/pcsx2/Linux/DebugDlg.cpp +++ b/pcsx2/Linux/DebugDlg.cpp @@ -481,7 +481,7 @@ void Create_Debugger() void OnDebug_Debugger(GtkMenuItem *menuitem, gpointer user_data) { - if (OpenPlugins(NULL) == -1) return; + if (OpenPlugins() == -1) return; dPC = cpuRegs.pc; diff --git a/pcsx2/Linux/LnxMain.cpp b/pcsx2/Linux/LnxMain.cpp index 9a1edbd1f9..555b918ead 100644 --- a/pcsx2/Linux/LnxMain.cpp +++ b/pcsx2/Linux/LnxMain.cpp @@ -26,11 +26,9 @@ GtkWidget *MsgDlg; const char* g_pRunGSState = NULL; int efile = 0; -char elfname[g_MaxPath]; -int main(int argc, char *argv[]) +int main(int argc, const char *argv[]) { - char elfname[g_MaxPath]; efile = 0; @@ -351,7 +349,7 @@ void OnRunIso_Ok(GtkButton* button, gpointer user_data) SysReset(); CDVDsys_ChangeSource( CDVDsrc_Iso ); - DoCDVDopen( FileSel ); + DoCDVDopen( File ); SysPrepareExecution( NULL ); } @@ -392,13 +390,13 @@ void OnRunElf_Ok(GtkButton* button, gpointer user_data) gchar *File; File = (gchar*)gtk_file_selection_get_filename(GTK_FILE_SELECTION(FileSel)); - strcpy(elfname, File); + strcpy(g_Startup.ElfFile, File); gtk_widget_destroy(FileSel); SysReset(); CDVDsys_ChangeSource( CDVDsrc_Plugin ); OpenCDVD( NULL ); - SysPrepareExecution(elfname); + SysPrepareExecution(g_Startup.ElfFile); } void OnRunElf_Cancel(GtkButton* button, gpointer user_data) @@ -447,7 +445,7 @@ void pcsx2_exit() } } - printf("PCSX2 Quitting\n"); + Console::WriteLn("PCSX2 Quitting\n"); if (g_Startup.NoGui) { diff --git a/pcsx2/Linux/LnxMain.h b/pcsx2/Linux/LnxMain.h index 5359a36afb..e381a8d98e 100644 --- a/pcsx2/Linux/LnxMain.h +++ b/pcsx2/Linux/LnxMain.h @@ -29,7 +29,7 @@ extern bool applychanges; extern bool Slots[5]; -extern bool ParseCommandLine(int argc, char *argv[], char **file); +extern bool ParseCommandLine(int argc, const char *argv[]); extern void MemoryCard_Init(); void OnLanguage(GtkMenuItem *menuitem, gpointer user_data); diff --git a/pcsx2/Linux/LnxSysExec.cpp b/pcsx2/Linux/LnxSysExec.cpp index 717a3cfeae..7825874fe1 100644 --- a/pcsx2/Linux/LnxSysExec.cpp +++ b/pcsx2/Linux/LnxSysExec.cpp @@ -211,10 +211,13 @@ bool ParseCommandLine(int argc, const char *argv[]) g_Startup.Enabled = true; g_Startup.CdvdSource = CDVDsrc_Iso; - if( _legacy_ForceElfLoad ) + if ( _legacy_ForceElfLoad ) { // This retains compatibility with the older Bootmode switch. - g_Startup.ElfFile = file; + + // Not totally sure what this should be set to, + // but I'll take compiling over everything working properly for the moment. + //g_Startup.ElfFile = file; g_Startup.StartupMode = Startup_FromELF; g_Startup.CdvdSource = CDVDsrc_Plugin; } @@ -242,33 +245,20 @@ void RunGui() PCSX2_MEM_PROTECT_BEGIN(); LoadPatch( str_Default ); - if( g_Startup.NoGui || g_Startup.Enabled ) + if( g_Startup.NoGui ) { // Initially bypass GUI and start PCSX2 directly. - // Manually load plugins using the user's configured image (if non-elf). - - int mode = g_Startup.BootMode & BootMode_ModeMask; + CDVDsys_ChangeSource( g_Startup.CdvdSource ); + DoCDVDopen( g_Startup.ImageName ); - if( g_Startup.Enabled && (mode != BootMode_Elf) ) - { - - if(mode == BootMode_Iso) - CDVD = ISO; - else if(mode == BootMode_NoDisc) - CDVD = NODISC; - else - CDVD = CDVD_plugin; - - if (OpenPlugins(g_Startup.ImageName) == -1) - return; - } - - SysPrepareExecution( - (g_Startup.BootMode == BootMode_Elf) ? g_Startup.ImageName : NULL, - ((g_Startup.BootMode & BootMode_Bios) != 0) - ); + if (OpenPlugins() == -1) return; + + SysPrepareExecution( (g_Startup.StartupMode == Startup_FromELF) ? g_Startup.ImageName : NULL, !g_Startup.SkipBios ); } + // Just exit immediately if the user disabled the GUI + if( g_Startup.NoGui ) return; + StartGui(); PCSX2_MEM_PROTECT_END(); diff --git a/pcsx2/Plugins.cpp b/pcsx2/Plugins.cpp index 50e13e3e5f..3de38d9b3c 100644 --- a/pcsx2/Plugins.cpp +++ b/pcsx2/Plugins.cpp @@ -1067,7 +1067,7 @@ void CloseCDVD() } } -#define SafeSysCloseLib( lib ) ((void)(SysCloseLibrary(GSplugin), GSplugin = NULL)) +#define SafeSysCloseLib( lib ) ((void)(SysCloseLibrary(lib), lib = NULL)) void ReleasePlugins() {