mirror of https://github.com/PCSX2/pcsx2.git
Linux only: Preliminary fixups for supporting the new improved commandline and g_Startup implementation.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1686 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
62591d04d8
commit
670def4974
|
@ -38,7 +38,7 @@
|
||||||
// performed quite liberally by many games (perhaps intended to keep the PS2 DVD
|
// performed quite liberally by many games (perhaps intended to keep the PS2 DVD
|
||||||
// from spinning down due to idle activity?).
|
// from spinning down due to idle activity?).
|
||||||
// Cache is set to -1 for init and when the disc is removed/changed, which invokes
|
// Cache is set to -1 for init and when the disc is removed/changed, which invokes
|
||||||
// a new DiskTypeCheck. Al subsequent checks use the non-negative value here.
|
// a new DiskTypeCheck. All subsequent checks use the non-negative value here.
|
||||||
//
|
//
|
||||||
static int diskTypeCached = -1;
|
static int diskTypeCached = -1;
|
||||||
|
|
||||||
|
@ -47,9 +47,9 @@ int lastReadSize;
|
||||||
|
|
||||||
// Records last read block length for block dumping
|
// Records last read block length for block dumping
|
||||||
static int plsn = 0;
|
static int plsn = 0;
|
||||||
static isoFile *blockDumpFile;
|
static isoFile *blockDumpFile = NULL;
|
||||||
|
|
||||||
// Assertion check for CDVD != NULL (in devel and debgu builds), because its handier than
|
// Assertion check for CDVD != NULL (in devel and debug builds), because its handier than
|
||||||
// relying on DEP exceptions -- and a little more reliable too.
|
// relying on DEP exceptions -- and a little more reliable too.
|
||||||
static void CheckNullCDVD()
|
static void CheckNullCDVD()
|
||||||
{
|
{
|
||||||
|
@ -103,8 +103,6 @@ int CheckDiskTypeFS(int baseType)
|
||||||
return CDVD_TYPE_ILLEGAL; // << Only for discs which aren't ps2 at all.
|
return CDVD_TYPE_ILLEGAL; // << Only for discs which aren't ps2 at all.
|
||||||
}
|
}
|
||||||
|
|
||||||
static char bleh[2352];
|
|
||||||
|
|
||||||
static int FindDiskType(int mType)
|
static int FindDiskType(int mType)
|
||||||
{
|
{
|
||||||
int dataTracks = 0;
|
int dataTracks = 0;
|
||||||
|
@ -120,6 +118,7 @@ static int FindDiskType(int mType)
|
||||||
}
|
}
|
||||||
else if (mType < 0)
|
else if (mType < 0)
|
||||||
{
|
{
|
||||||
|
static char bleh[2352];
|
||||||
cdvdTD td;
|
cdvdTD td;
|
||||||
|
|
||||||
CDVD->getTD(0,&td);
|
CDVD->getTD(0,&td);
|
||||||
|
|
|
@ -30,7 +30,6 @@ char elfname[g_MaxPath];
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char *file = NULL;
|
|
||||||
char elfname[g_MaxPath];
|
char elfname[g_MaxPath];
|
||||||
|
|
||||||
efile = 0;
|
efile = 0;
|
||||||
|
@ -62,7 +61,7 @@ int main(int argc, char *argv[])
|
||||||
memset(&g_Startup, 0, sizeof(g_Startup));
|
memset(&g_Startup, 0, sizeof(g_Startup));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!ParseCommandLine(argc, argv, file)) return 0;
|
if (!ParseCommandLine(argc, argv)) return 0;
|
||||||
|
|
||||||
// make gtk thread safe if using MTGS
|
// make gtk thread safe if using MTGS
|
||||||
if (CHECK_MULTIGS)
|
if (CHECK_MULTIGS)
|
||||||
|
@ -127,21 +126,18 @@ int main(int argc, char *argv[])
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!g_Startup.NoGui && (file == NULL))
|
if( !g_Startup.Enabled )
|
||||||
{
|
{
|
||||||
StartGui();
|
StartGui();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OpenPlugins(file) == -1) return -1;
|
CDVDsys_ChangeSource( g_Startup.CdvdSource );
|
||||||
|
DoCDVDopen( g_Startup.ImageName );
|
||||||
|
if (OpenPlugins() == -1) return -1;
|
||||||
|
|
||||||
SysReset();
|
SysPrepareExecution( (g_Startup.StartupMode == Startup_FromELF) ? g_Startup.ImageName : NULL, !g_Startup.SkipBios );
|
||||||
|
|
||||||
cpuExecuteBios();
|
|
||||||
if (file) strcpy(elfname, file);
|
|
||||||
if (!efile) efile = GetPS2ElfName(elfname);
|
|
||||||
loadElfFile(elfname);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -332,15 +328,16 @@ void OnLanguage(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
|
||||||
void OnFile_RunCD(GtkMenuItem *menuitem, gpointer user_data)
|
void OnFile_RunCD(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
{
|
{
|
||||||
CDVD = CDVD_plugin;
|
SysReset();
|
||||||
//SysReset();
|
CDVDsys_ChangeSource( CDVDsrc_Plugin );
|
||||||
|
DoCDVDopen( NULL );
|
||||||
SysPrepareExecution(NULL);
|
SysPrepareExecution(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnFile_RunBIOS(GtkMenuItem *menuitem, gpointer user_data)
|
void OnFile_RunBIOS(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
{
|
{
|
||||||
CDVD = NODISC;
|
|
||||||
SysReset();
|
SysReset();
|
||||||
|
CDVDsys_ChangeSource( CDVDsrc_NoDisc );
|
||||||
SysPrepareExecution(NULL, true);
|
SysPrepareExecution(NULL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,13 +345,13 @@ void OnRunIso_Ok(GtkButton* button, gpointer user_data)
|
||||||
{
|
{
|
||||||
gchar *File;
|
gchar *File;
|
||||||
string curdir;
|
string curdir;
|
||||||
CDVD = ISO;
|
|
||||||
|
|
||||||
File = (gchar*)gtk_file_selection_get_filename(GTK_FILE_SELECTION(FileSel));
|
File = (gchar*)gtk_file_selection_get_filename(GTK_FILE_SELECTION(FileSel));
|
||||||
strcpy(isoFileName, File);
|
|
||||||
gtk_widget_destroy(FileSel);
|
gtk_widget_destroy(FileSel);
|
||||||
|
|
||||||
//SysReset();
|
SysReset();
|
||||||
|
CDVDsys_ChangeSource( CDVDsrc_Iso );
|
||||||
|
DoCDVDopen( FileSel );
|
||||||
SysPrepareExecution( NULL );
|
SysPrepareExecution( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,6 +384,9 @@ void OnFile_BlockDump(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Currently this OnRunElf function uses the CDVDplugin source. It's also valid to use the
|
||||||
|
// Iso and NoDisc sources when running ELF files, although those need new menu commands and
|
||||||
|
// are outside the scope of my GTK capabilities. ;) -- air
|
||||||
void OnRunElf_Ok(GtkButton* button, gpointer user_data)
|
void OnRunElf_Ok(GtkButton* button, gpointer user_data)
|
||||||
{
|
{
|
||||||
gchar *File;
|
gchar *File;
|
||||||
|
@ -395,6 +395,9 @@ void OnRunElf_Ok(GtkButton* button, gpointer user_data)
|
||||||
strcpy(elfname, File);
|
strcpy(elfname, File);
|
||||||
gtk_widget_destroy(FileSel);
|
gtk_widget_destroy(FileSel);
|
||||||
|
|
||||||
|
SysReset();
|
||||||
|
CDVDsys_ChangeSource( CDVDsrc_Plugin );
|
||||||
|
OpenCDVD( NULL );
|
||||||
SysPrepareExecution(elfname);
|
SysPrepareExecution(elfname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,7 +410,7 @@ void OnFile_LoadElf(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkWidget *Ok, *Cancel;
|
GtkWidget *Ok, *Cancel;
|
||||||
|
|
||||||
FileSel = gtk_file_selection_new("Select Psx Elf File");
|
FileSel = gtk_file_selection_new("Select PS2 Elf File");
|
||||||
|
|
||||||
Ok = GTK_FILE_SELECTION(FileSel)->ok_button;
|
Ok = GTK_FILE_SELECTION(FileSel)->ok_button;
|
||||||
gtk_signal_connect(GTK_OBJECT(Ok), "clicked", GTK_SIGNAL_FUNC(OnRunElf_Ok), NULL);
|
gtk_signal_connect(GTK_OBJECT(Ok), "clicked", GTK_SIGNAL_FUNC(OnRunElf_Ok), NULL);
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
extern bool applychanges;
|
extern bool applychanges;
|
||||||
extern bool Slots[5];
|
extern bool Slots[5];
|
||||||
|
|
||||||
extern bool ParseCommandLine(int argc, char *argv[], char *file);
|
extern bool ParseCommandLine(int argc, char *argv[], char **file);
|
||||||
extern void MemoryCard_Init();
|
extern void MemoryCard_Init();
|
||||||
|
|
||||||
void OnLanguage(GtkMenuItem *menuitem, gpointer user_data);
|
void OnLanguage(GtkMenuItem *menuitem, gpointer user_data);
|
||||||
|
|
|
@ -87,74 +87,137 @@ __noinline void SysPageFaultExceptionFilter( int signal, siginfo_t *info, void *
|
||||||
mmap_ClearCpuBlock( offset & ~m_pagemask );
|
mmap_ClearCpuBlock( offset & ~m_pagemask );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParseCommandLine(int argc, char *argv[], char *file)
|
#define CmdSwitchIs( text ) ( stricmp( token, text ) == 0 )
|
||||||
|
|
||||||
|
bool ParseCommandLine(int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
int i = 1;
|
int i = 1;
|
||||||
g_Startup.BootMode = BootMode_Bios;
|
|
||||||
|
|
||||||
|
g_Startup.Enabled = false;
|
||||||
|
g_Startup.NoGui = false;
|
||||||
|
g_Startup.ImageName = NULL;
|
||||||
|
g_Startup.ElfFile = NULL;
|
||||||
|
|
||||||
|
g_Startup.StartupMode = Startup_FromCDVD;
|
||||||
|
g_Startup.SkipBios = true;
|
||||||
|
g_Startup.CdvdSource = CDVDsrc_Plugin;
|
||||||
|
|
||||||
|
bool _legacy_ForceElfLoad = false;
|
||||||
|
|
||||||
while (i < argc)
|
while (i < argc)
|
||||||
{
|
{
|
||||||
char* token = argv[i++];
|
const char* token = argv[i++];
|
||||||
|
|
||||||
if (stricmp(token, "-help") == 0 || stricmp(token, "--help") == 0 || stricmp(token, "-h") == 0)
|
if (CmdSwitchIs("-help") || CmdSwitchIs("--help") || CmdSwitchIs("-h"))
|
||||||
{
|
{
|
||||||
//Msgbox::Alert( phelpmsg );
|
//Msgbox::Alert( phelpmsg );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (stricmp(token, "-nogui") == 0)
|
else if (CmdSwitchIs("-nogui"))
|
||||||
{
|
{
|
||||||
g_Startup.NoGui = FALSE;
|
g_Startup.NoGui = true;
|
||||||
|
g_Startup.Enabled = true;
|
||||||
}
|
}
|
||||||
else if (stricmp(token, "-loadgs") == 0)
|
else if( CmdSwitchIs( "skipbios" ) ) {
|
||||||
|
g_Startup.SkipBios = true;
|
||||||
|
}
|
||||||
|
else if( CmdSwitchIs( "nodisc" ) ) {
|
||||||
|
g_Startup.CdvdSource = CDVDsrc_NoDisc;
|
||||||
|
g_Startup.Enabled = true;
|
||||||
|
}
|
||||||
|
else if( CmdSwitchIs( "usecd" ) ) {
|
||||||
|
g_Startup.CdvdSource = CDVDsrc_Plugin;
|
||||||
|
g_Startup.Enabled = true;
|
||||||
|
}
|
||||||
|
else if( CmdSwitchIs( "elf" ) ) {
|
||||||
|
g_Startup.StartupMode = Startup_FromELF;
|
||||||
|
token = argv[i++];
|
||||||
|
g_Startup.ElfFile = token;
|
||||||
|
g_Startup.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// depreciated command switch
|
||||||
|
else if (CmdSwitchIs("-bootmode"))
|
||||||
|
{
|
||||||
|
token = argv[i++];
|
||||||
|
int mode = atoi( token );
|
||||||
|
g_Startup.Enabled = true;
|
||||||
|
g_Startup.SkipBios = !( mode & 0x10000 );
|
||||||
|
switch( mode & 0xf )
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
g_Startup.CdvdSource = CDVDsrc_Plugin;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
_legacy_ForceElfLoad = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
g_Startup.CdvdSource = CDVDsrc_Iso;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
g_Startup.CdvdSource = CDVDsrc_NoDisc;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (CmdSwitchIs("-loadgs"))
|
||||||
{
|
{
|
||||||
g_pRunGSState = argv[i++];
|
g_pRunGSState = argv[i++];
|
||||||
}
|
}
|
||||||
else if( strcmp(token, "-bootmode" ) == 0)
|
else if (CmdSwitchIs("-gs"))
|
||||||
{
|
|
||||||
token = argv[i++];
|
|
||||||
g_Startup.BootMode = (StartupMode)atoi( token);
|
|
||||||
g_Startup.Enabled = true;
|
|
||||||
}
|
|
||||||
else if (stricmp(token, "-gs") == 0)
|
|
||||||
{
|
{
|
||||||
token = argv[i++];
|
token = argv[i++];
|
||||||
g_Startup.gsdll = token;
|
g_Startup.gsdll = token;
|
||||||
}
|
}
|
||||||
else if (stricmp(token, "-cdvd") == 0)
|
else if (CmdSwitchIs("-cdvd"))
|
||||||
{
|
{
|
||||||
token = argv[i++];
|
token = argv[i++];
|
||||||
g_Startup.cdvddll = token;
|
g_Startup.cdvddll = token;
|
||||||
}
|
}
|
||||||
else if (stricmp(token, "-spu") == 0)
|
else if (CmdSwitchIs("-spu"))
|
||||||
{
|
{
|
||||||
token = argv[i++];
|
token = argv[i++];
|
||||||
g_Startup.spudll = token;
|
g_Startup.spudll = token;
|
||||||
}
|
}
|
||||||
else if (stricmp(token, "-pad") == 0)
|
else if (CmdSwitchIs("-pad"))
|
||||||
{
|
{
|
||||||
token = argv[i++];
|
token = argv[i++];
|
||||||
g_Startup.pad1dll = token;
|
g_Startup.pad1dll = token;
|
||||||
g_Startup.pad2dll = token;
|
g_Startup.pad2dll = token;
|
||||||
}
|
}
|
||||||
else if (stricmp(token, "-pad1") == 0)
|
else if (CmdSwitchIs("-pad1"))
|
||||||
{
|
{
|
||||||
token = argv[i++];
|
token = argv[i++];
|
||||||
g_Startup.pad1dll = token;
|
g_Startup.pad1dll = token;
|
||||||
}
|
}
|
||||||
else if (stricmp(token, "-pad2") == 0)
|
else if (CmdSwitchIs("-pad2"))
|
||||||
{
|
{
|
||||||
token = argv[i++];
|
token = argv[i++];
|
||||||
g_Startup.pad2dll = token;
|
g_Startup.pad2dll = token;
|
||||||
}
|
}
|
||||||
else if (stricmp(token, "-loadgs") == 0)
|
else if (CmdSwitchIs("-loadgs"))
|
||||||
{
|
{
|
||||||
token = argv[i++];
|
token = argv[i++];
|
||||||
g_pRunGSState = token;
|
g_pRunGSState = token;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
file = token;
|
printf("opening file %s\n", token);
|
||||||
printf("opening file %s\n", file);
|
|
||||||
|
g_Startup.ImageName = token;
|
||||||
|
g_Startup.Enabled = true;
|
||||||
|
g_Startup.CdvdSource = CDVDsrc_Iso;
|
||||||
|
|
||||||
|
if( _legacy_ForceElfLoad )
|
||||||
|
{
|
||||||
|
// This retains compatibility with the older Bootmode switch.
|
||||||
|
g_Startup.ElfFile = file;
|
||||||
|
g_Startup.StartupMode = Startup_FromELF;
|
||||||
|
g_Startup.CdvdSource = CDVDsrc_Plugin;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -140,6 +140,7 @@ int ParseCommandLine( int tokenCount, TCHAR *const *const tokens )
|
||||||
else if( CmdSwitchIs( "elf" ) ) {
|
else if( CmdSwitchIs( "elf" ) ) {
|
||||||
g_Startup.StartupMode = Startup_FromELF;
|
g_Startup.StartupMode = Startup_FromELF;
|
||||||
g_Startup.ElfFile = param;
|
g_Startup.ElfFile = param;
|
||||||
|
g_Startup.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( CmdSwitchIs( "loadgs" ) ) {
|
else if( CmdSwitchIs( "loadgs" ) ) {
|
||||||
|
|
Loading…
Reference in New Issue