|
|
|
@ -52,10 +52,8 @@
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_APP(DolphinApp)
|
|
|
|
|
|
|
|
|
|
#if defined(HAVE_WX) && HAVE_WX
|
|
|
|
|
#include <wx/stdpaths.h>
|
|
|
|
|
bool wxMsgAlert(const char*, const char*, bool, int);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
CFrame* main_frame = NULL;
|
|
|
|
|
|
|
|
|
@ -106,103 +104,7 @@ bool DolphinApp::OnInit()
|
|
|
|
|
wxString padPluginFilename;
|
|
|
|
|
wxString wiimotePluginFilename;
|
|
|
|
|
|
|
|
|
|
#if defined _DEBUG && defined _WIN32
|
|
|
|
|
int tmpflag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
|
|
|
|
tmpflag |= _CRTDBG_DELAY_FREE_MEM_DF;
|
|
|
|
|
_CrtSetDbgFlag(tmpflag);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
LogManager::Init();
|
|
|
|
|
EventHandler::Init();
|
|
|
|
|
SConfig::Init();
|
|
|
|
|
CPluginManager::Init();
|
|
|
|
|
|
|
|
|
|
// Register message box handler
|
|
|
|
|
#if ! defined(_WIN32) && defined(HAVE_WX) && HAVE_WX
|
|
|
|
|
RegisterMsgAlertHandler(&wxMsgAlert);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// "ExtendedTrace" looks freakin dangerous!!!
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
EXTENDEDTRACEINITIALIZE(".");
|
|
|
|
|
SetUnhandledExceptionFilter(&MyUnhandledExceptionFilter);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// TODO: if First Boot
|
|
|
|
|
if (!cpu_info.bSSE2)
|
|
|
|
|
{
|
|
|
|
|
PanicAlert("Hi,\n\nDolphin requires that your CPU has support for SSE2 extensions.\n"
|
|
|
|
|
"Unfortunately your CPU does not support them, so Dolphin will not run.\n\n"
|
|
|
|
|
"Sayonara!\n");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
#if ! defined(__APPLE__) && ! defined(__linux__)
|
|
|
|
|
// Keep the user config dir free unless user wants to save the working dir
|
|
|
|
|
if (!File::Exists((std::string(File::GetUserPath(D_CONFIG_IDX)) + "portable").c_str()))
|
|
|
|
|
{
|
|
|
|
|
char tmp[1024];
|
|
|
|
|
sprintf(tmp, "%s/.dolphin%swd", (const char*)wxStandardPaths::Get().GetUserConfigDir().mb_str(),
|
|
|
|
|
#ifdef _M_IX86
|
|
|
|
|
"x32");
|
|
|
|
|
#else
|
|
|
|
|
"x64");
|
|
|
|
|
#endif
|
|
|
|
|
FILE* workingDir = fopen(tmp, "r");
|
|
|
|
|
if (!workingDir)
|
|
|
|
|
{
|
|
|
|
|
if (PanicYesNo("Dolphin has not been configured with an install location,\nKeep Dolphin portable?"))
|
|
|
|
|
{
|
|
|
|
|
FILE* portable = fopen((std::string(File::GetUserPath(D_CONFIG_IDX)) + "portable").c_str(), "w");
|
|
|
|
|
if (!portable)
|
|
|
|
|
{
|
|
|
|
|
PanicAlert("Portable Setting could not be saved\n Are you running Dolphin from read only media or from a directory that dolphin is not located in?");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fclose(portable);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
char CWD[1024];
|
|
|
|
|
sprintf(CWD, "%s", (const char*)wxGetCwd().mb_str());
|
|
|
|
|
if (PanicYesNo("Set install location to:\n %s ?", CWD))
|
|
|
|
|
{
|
|
|
|
|
FILE* workingDirF = fopen(tmp, "w");
|
|
|
|
|
if (!workingDirF)
|
|
|
|
|
PanicAlert("Install directory could not be saved");
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fwrite(CWD, ((std::string)CWD).size()+1, 1, workingDirF);
|
|
|
|
|
fwrite("", 1, 1, workingDirF); //seems to be needed on linux
|
|
|
|
|
fclose(workingDirF);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
PanicAlert("Relaunch Dolphin from the install directory and save from there");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
char *tmpChar;
|
|
|
|
|
long len;
|
|
|
|
|
fseek(workingDir, 0, SEEK_END);
|
|
|
|
|
len = ftell(workingDir);
|
|
|
|
|
fseek(workingDir, 0, SEEK_SET);
|
|
|
|
|
tmpChar = new char[len];
|
|
|
|
|
fread(tmpChar, len, 1, workingDir);
|
|
|
|
|
fclose(workingDir);
|
|
|
|
|
if (!wxSetWorkingDirectory(wxString::FromAscii(tmpChar)))
|
|
|
|
|
{
|
|
|
|
|
INFO_LOG(CONSOLE, "set working directory failed");
|
|
|
|
|
}
|
|
|
|
|
delete [] tmpChar;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// Parse command lines
|
|
|
|
|
#if wxUSE_CMDLINE_PARSER
|
|
|
|
|
#if wxUSE_CMDLINE_PARSER // Parse command lines
|
|
|
|
|
#if wxCHECK_VERSION(2, 9, 0)
|
|
|
|
|
wxCmdLineEntryDesc cmdLineDesc[] =
|
|
|
|
|
{
|
|
|
|
@ -279,7 +181,128 @@ bool DolphinApp::OnInit()
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
#endif
|
|
|
|
|
#if defined(__APPLE__)
|
|
|
|
|
// Gets the command line parameters
|
|
|
|
|
wxCmdLineParser parser(cmdLineDesc, argc, argv);
|
|
|
|
|
|
|
|
|
|
if (parser.Parse() != 0)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
#if wxCHECK_VERSION(2, 9, 0)
|
|
|
|
|
UseDebugger = parser.Found("debugger");
|
|
|
|
|
UseLogger = parser.Found("logger");
|
|
|
|
|
LoadElf = parser.Found("elf", &ElfFile);
|
|
|
|
|
#else
|
|
|
|
|
UseDebugger = parser.Found(_("debugger"));
|
|
|
|
|
UseLogger = parser.Found(_("logger"));
|
|
|
|
|
LoadElf = parser.Found(_("elf"), &ElfFile);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if wxCHECK_VERSION(2, 9, 0)
|
|
|
|
|
selectVideoPlugin = parser.Found("video_plugin", &videoPluginFilename);
|
|
|
|
|
selectAudioPlugin = parser.Found("audio_plugin", &audioPluginFilename);
|
|
|
|
|
selectPadPlugin = parser.Found("pad_plugin", &padPluginFilename);
|
|
|
|
|
selectWiimotePlugin = parser.Found("wiimote_plugin", &wiimotePluginFilename);
|
|
|
|
|
#else
|
|
|
|
|
selectVideoPlugin = parser.Found(_T("video_plugin"), &videoPluginFilename);
|
|
|
|
|
selectAudioPlugin = parser.Found(_T("audio_plugin"), &audioPluginFilename);
|
|
|
|
|
selectPadPlugin = parser.Found(_T("pad_plugin"), &padPluginFilename);
|
|
|
|
|
selectWiimotePlugin = parser.Found(_T("wiimote_plugin"), &wiimotePluginFilename);
|
|
|
|
|
#endif
|
|
|
|
|
#endif // wxUSE_CMDLINE_PARSER
|
|
|
|
|
|
|
|
|
|
#if defined _DEBUG && defined _WIN32
|
|
|
|
|
int tmpflag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
|
|
|
|
tmpflag |= _CRTDBG_DELAY_FREE_MEM_DF;
|
|
|
|
|
_CrtSetDbgFlag(tmpflag);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// Register message box handler
|
|
|
|
|
#ifndef _WIN32
|
|
|
|
|
RegisterMsgAlertHandler(&wxMsgAlert);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// "ExtendedTrace" looks freakin dangerous!!!
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
EXTENDEDTRACEINITIALIZE(".");
|
|
|
|
|
SetUnhandledExceptionFilter(&MyUnhandledExceptionFilter);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// TODO: if First Boot
|
|
|
|
|
if (!cpu_info.bSSE2)
|
|
|
|
|
{
|
|
|
|
|
PanicAlert("Hi,\n\nDolphin requires that your CPU has support for SSE2 extensions.\n"
|
|
|
|
|
"Unfortunately your CPU does not support them, so Dolphin will not run.\n\n"
|
|
|
|
|
"Sayonara!\n");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if ! defined(__APPLE__) && ! defined(__linux__)
|
|
|
|
|
// Keep the user config dir free unless user wants to save the working dir
|
|
|
|
|
if (!File::Exists((std::string(File::GetUserPath(D_CONFIG_IDX)) + "portable").c_str()))
|
|
|
|
|
{
|
|
|
|
|
char tmp[1024];
|
|
|
|
|
sprintf(tmp, "%s/.dolphin%swd", (const char*)wxStandardPaths::Get().GetUserConfigDir().mb_str(),
|
|
|
|
|
#ifdef _M_IX86
|
|
|
|
|
"x32");
|
|
|
|
|
#else
|
|
|
|
|
"x64");
|
|
|
|
|
#endif
|
|
|
|
|
FILE* workingDir = fopen(tmp, "r");
|
|
|
|
|
if (!workingDir)
|
|
|
|
|
{
|
|
|
|
|
if (PanicYesNo("Dolphin has not been configured with an install location,\nKeep Dolphin portable?"))
|
|
|
|
|
{
|
|
|
|
|
FILE* portable = fopen((std::string(File::GetUserPath(D_CONFIG_IDX)) + "portable").c_str(), "w");
|
|
|
|
|
if (!portable)
|
|
|
|
|
{
|
|
|
|
|
PanicAlert("Portable Setting could not be saved\n Are you running Dolphin from read only media or from a directory that dolphin is not located in?");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fclose(portable);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
char CWD[1024];
|
|
|
|
|
sprintf(CWD, "%s", (const char*)wxGetCwd().mb_str());
|
|
|
|
|
if (PanicYesNo("Set install location to:\n %s ?", CWD))
|
|
|
|
|
{
|
|
|
|
|
FILE* workingDirF = fopen(tmp, "w");
|
|
|
|
|
if (!workingDirF)
|
|
|
|
|
PanicAlert("Install directory could not be saved");
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fwrite(CWD, ((std::string)CWD).size()+1, 1, workingDirF);
|
|
|
|
|
fwrite("", 1, 1, workingDirF); //seems to be needed on linux
|
|
|
|
|
fclose(workingDirF);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
PanicAlert("Relaunch Dolphin from the install directory and save from there");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
char *tmpChar;
|
|
|
|
|
long len;
|
|
|
|
|
fseek(workingDir, 0, SEEK_END);
|
|
|
|
|
len = ftell(workingDir);
|
|
|
|
|
fseek(workingDir, 0, SEEK_SET);
|
|
|
|
|
tmpChar = new char[len];
|
|
|
|
|
fread(tmpChar, len, 1, workingDir);
|
|
|
|
|
fclose(workingDir);
|
|
|
|
|
if (!wxSetWorkingDirectory(wxString::FromAscii(tmpChar)))
|
|
|
|
|
{
|
|
|
|
|
INFO_LOG(CONSOLE, "set working directory failed");
|
|
|
|
|
}
|
|
|
|
|
delete [] tmpChar;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
|
|
|
|
// check to see if ~/Library/Application Support/Dolphin exists; if not, create it
|
|
|
|
|
char AppSupportDir[MAXPATHLEN];
|
|
|
|
|
snprintf(AppSupportDir, sizeof(AppSupportDir), "%s/Library/Application Support", getenv("HOME"));
|
|
|
|
@ -297,22 +320,31 @@ bool DolphinApp::OnInit()
|
|
|
|
|
chdir(AppSupportDir);
|
|
|
|
|
|
|
|
|
|
//create all necessary dir in user directory
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_CONFIG_IDX))) File::CreateDir(File::GetUserPath(D_CONFIG_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_GCUSER_IDX))) File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_WIISYSCONF_IDX))) File::CreateFullPath(File::GetUserPath(D_WIISYSCONF_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_CACHE_IDX))) File::CreateFullPath(File::GetUserPath(D_CACHE_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_DUMPDSP_IDX))) File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_DUMPTEXTURES_IDX))) File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_HIRESTEXTURES_IDX))) File::CreateFullPath(File::GetUserPath(D_HIRESTEXTURES_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_MAILLOGS_IDX))) File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_SCREENSHOTS_IDX))) File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_STATESAVES_IDX))) File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_CONFIG_IDX)))
|
|
|
|
|
File::CreateDir(File::GetUserPath(D_CONFIG_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_GCUSER_IDX)))
|
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_WIISYSCONF_IDX)))
|
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_WIISYSCONF_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_CACHE_IDX)))
|
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_CACHE_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_DUMPDSP_IDX)))
|
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_DUMPTEXTURES_IDX)))
|
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_HIRESTEXTURES_IDX)))
|
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_HIRESTEXTURES_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_MAILLOGS_IDX)))
|
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_SCREENSHOTS_IDX)))
|
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_STATESAVES_IDX)))
|
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX));
|
|
|
|
|
|
|
|
|
|
//copy user wii shared2 SYSCONF if not exist
|
|
|
|
|
if (!File::Exists(File::GetUserPath(F_WIISYSCONF_IDX)))
|
|
|
|
|
File::Copy((File::GetBundleDirectory() + DIR_SEP + "Contents" + DIR_SEP + USERDATA_DIR + DIR_SEP + WII_SYSCONF_DIR + DIR_SEP + WII_SYSCONF).c_str(),
|
|
|
|
|
File::GetUserPath(F_WIISYSCONF_IDX));
|
|
|
|
|
SConfig::GetInstance().m_SYSCONF->Reload();
|
|
|
|
|
//TODO : if not exist copy game config dir in user dir and detect the revision to upgrade if necessary
|
|
|
|
|
//TODO : if not exist copy maps dir in user dir and detect revision to upgrade if necessary
|
|
|
|
|
|
|
|
|
@ -334,78 +366,54 @@ bool DolphinApp::OnInit()
|
|
|
|
|
File::CopyDir(SHARED_USER_DIR MAPS_DIR DIR_SEP, File::GetUserPath(D_MAPS_IDX));
|
|
|
|
|
File::CopyDir(SHARED_USER_DIR SHADERS_DIR DIR_SEP, File::GetUserPath(D_SHADERS_IDX));
|
|
|
|
|
File::CopyDir(SHARED_USER_DIR WII_USER_DIR DIR_SEP, File::GetUserPath(D_WIIUSER_IDX));
|
|
|
|
|
SConfig::GetInstance().m_SYSCONF->Reload();
|
|
|
|
|
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_GCUSER_IDX))) File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_CACHE_IDX))) File::CreateFullPath(File::GetUserPath(D_CACHE_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_DUMPDSP_IDX))) File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_DUMPTEXTURES_IDX))) File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_HIRESTEXTURES_IDX))) File::CreateFullPath(File::GetUserPath(D_HIRESTEXTURES_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_SCREENSHOTS_IDX))) File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_STATESAVES_IDX))) File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_LOGS_IDX))) {
|
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_LOGS_IDX));
|
|
|
|
|
LogManager::GetInstance()->getFileListener()->Reload();
|
|
|
|
|
}
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_MAILLOGS_IDX))) File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_GCUSER_IDX)))
|
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_CACHE_IDX)))
|
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_CACHE_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_DUMPDSP_IDX)))
|
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_DUMPTEXTURES_IDX)))
|
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_HIRESTEXTURES_IDX)))
|
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_HIRESTEXTURES_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_SCREENSHOTS_IDX)))
|
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_STATESAVES_IDX)))
|
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX));
|
|
|
|
|
if (!File::Exists(File::GetUserPath(D_MAILLOGS_IDX)))
|
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX));
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// Gets the passed media files from command line
|
|
|
|
|
wxCmdLineParser parser(cmdLineDesc, argc, argv);
|
|
|
|
|
|
|
|
|
|
// Get filenames from the command line
|
|
|
|
|
if (parser.Parse() != 0)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
#if wxCHECK_VERSION(2, 9, 0)
|
|
|
|
|
UseDebugger = parser.Found("debugger");
|
|
|
|
|
UseLogger = parser.Found("logger");
|
|
|
|
|
LoadElf = parser.Found("elf", &ElfFile);
|
|
|
|
|
#else
|
|
|
|
|
UseDebugger = parser.Found(_("debugger"));
|
|
|
|
|
UseLogger = parser.Found(_("logger"));
|
|
|
|
|
LoadElf = parser.Found(_("elf"), &ElfFile);
|
|
|
|
|
#endif
|
|
|
|
|
if( LoadElf && ElfFile == wxEmptyString )
|
|
|
|
|
PanicAlert("You did not specify a file name");
|
|
|
|
|
|
|
|
|
|
#if wxCHECK_VERSION(2, 9, 0)
|
|
|
|
|
selectVideoPlugin = parser.Found("video_plugin", &videoPluginFilename);
|
|
|
|
|
selectAudioPlugin = parser.Found("audio_plugin", &audioPluginFilename);
|
|
|
|
|
selectPadPlugin = parser.Found("pad_plugin", &padPluginFilename);
|
|
|
|
|
selectWiimotePlugin = parser.Found("wiimote_plugin", &wiimotePluginFilename);
|
|
|
|
|
#else
|
|
|
|
|
selectVideoPlugin = parser.Found(_T("video_plugin"), &videoPluginFilename);
|
|
|
|
|
selectAudioPlugin = parser.Found(_T("audio_plugin"), &audioPluginFilename);
|
|
|
|
|
selectPadPlugin = parser.Found(_T("pad_plugin"), &padPluginFilename);
|
|
|
|
|
selectWiimotePlugin = parser.Found(_T("wiimote_plugin"), &wiimotePluginFilename);
|
|
|
|
|
#endif
|
|
|
|
|
// ============
|
|
|
|
|
#endif
|
|
|
|
|
LogManager::Init();
|
|
|
|
|
EventHandler::Init();
|
|
|
|
|
SConfig::Init();
|
|
|
|
|
CPluginManager::Init();
|
|
|
|
|
|
|
|
|
|
if (selectVideoPlugin && videoPluginFilename != wxEmptyString)
|
|
|
|
|
{
|
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin = std::string(videoPluginFilename.mb_str());
|
|
|
|
|
}
|
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin =
|
|
|
|
|
std::string(videoPluginFilename.mb_str());
|
|
|
|
|
|
|
|
|
|
if (selectAudioPlugin && audioPluginFilename != wxEmptyString)
|
|
|
|
|
{
|
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin = std::string(audioPluginFilename.mb_str());
|
|
|
|
|
}
|
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin =
|
|
|
|
|
std::string(audioPluginFilename.mb_str());
|
|
|
|
|
|
|
|
|
|
if (selectPadPlugin && padPluginFilename != wxEmptyString)
|
|
|
|
|
{
|
|
|
|
|
int k;
|
|
|
|
|
for(k=0;k<MAXPADS;k++)
|
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[k] = std::string(padPluginFilename.mb_str());
|
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[k] =
|
|
|
|
|
std::string(padPluginFilename.mb_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (selectWiimotePlugin && wiimotePluginFilename != wxEmptyString)
|
|
|
|
|
{
|
|
|
|
|
int k;
|
|
|
|
|
for(k=0;k<MAXWIIMOTES;k++)
|
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[k] = std::string(wiimotePluginFilename.mb_str());
|
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[k] =
|
|
|
|
|
std::string(wiimotePluginFilename.mb_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Enable the PNG image handler
|
|
|
|
|
wxInitAllImageHandlers();
|
|
|
|
|
|
|
|
|
@ -427,7 +435,8 @@ bool DolphinApp::OnInit()
|
|
|
|
|
int w = SConfig::GetInstance().m_LocalCoreStartupParameter.iWidth;
|
|
|
|
|
int h = SConfig::GetInstance().m_LocalCoreStartupParameter.iHeight;
|
|
|
|
|
|
|
|
|
|
// TODO: Do the same check for Linux
|
|
|
|
|
// The following is not needed in linux. Linux window managers do not allow windows to
|
|
|
|
|
// be created off the desktop.
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
// Out of desktop check
|
|
|
|
|
HWND hDesktop = GetDesktopWindow();
|
|
|
|
@ -443,13 +452,13 @@ bool DolphinApp::OnInit()
|
|
|
|
|
// ------------
|
|
|
|
|
// Check the autoboot options.
|
|
|
|
|
|
|
|
|
|
// First check if we have a elf command line. Todo: Should we place this under #if wxUSE_CMDLINE_PARSER?
|
|
|
|
|
// First check if we have an elf command line.
|
|
|
|
|
if (LoadElf && ElfFile != wxEmptyString)
|
|
|
|
|
{
|
|
|
|
|
main_frame->StartGame(std::string(ElfFile.mb_str()));
|
|
|
|
|
}
|
|
|
|
|
/* If we have selected Automatic Start, start the default ISO, or if no default
|
|
|
|
|
ISO exists, start the last loaded ISO */
|
|
|
|
|
// If we have selected Automatic Start, start the default ISO, or if no default
|
|
|
|
|
// ISO exists, start the last loaded ISO
|
|
|
|
|
else if (main_frame->g_pCodeWindow)
|
|
|
|
|
{
|
|
|
|
|
if (main_frame->g_pCodeWindow->AutomaticStart())
|
|
|
|
@ -472,9 +481,11 @@ bool DolphinApp::OnInit()
|
|
|
|
|
|
|
|
|
|
// Set main parent window
|
|
|
|
|
SetTopWindow(main_frame);
|
|
|
|
|
|
|
|
|
|
#if defined HAVE_X11 && HAVE_X11
|
|
|
|
|
XInitThreads();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -514,7 +525,6 @@ void Host_SysMessage(const char *fmt, ...)
|
|
|
|
|
PanicAlert("%s", msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if defined HAVE_WX && HAVE_WX
|
|
|
|
|
bool wxMsgAlert(const char* caption, const char* text, bool yes_no, int /*Style*/)
|
|
|
|
|
{
|
|
|
|
|
return wxYES == wxMessageBox(wxString::FromAscii(text),
|
|
|
|
@ -671,4 +681,3 @@ void Host_SetWiiMoteConnectionState(int _State)
|
|
|
|
|
|
|
|
|
|
main_frame->GetEventHandler()->AddPendingEvent(event);
|
|
|
|
|
}
|
|
|
|
|
#endif // HAVE_WX
|
|
|
|
|