2009-07-28 15:32:10 -06:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
2008-12-07 22:30:24 -07:00
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
|
2010-07-19 21:23:25 -06:00
|
|
|
#include "Common.h"
|
|
|
|
#include "CommonPaths.h"
|
2010-02-19 21:18:19 -07:00
|
|
|
|
|
|
|
#if defined HAVE_X11 && HAVE_X11
|
2009-10-29 15:12:11 -06:00
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#endif
|
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
#include "CPUDetect.h"
|
|
|
|
#include "IniFile.h"
|
|
|
|
#include "FileUtil.h"
|
2009-02-22 14:16:12 -07:00
|
|
|
#include "Setup.h"
|
|
|
|
|
|
|
|
#include "Host.h" // Core
|
2010-10-12 13:42:29 -06:00
|
|
|
#include "HW/Wiimote.h"
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2009-02-22 14:16:12 -07:00
|
|
|
#include "Globals.h" // Local
|
|
|
|
#include "Main.h"
|
2009-01-17 16:41:21 -07:00
|
|
|
#include "ConfigManager.h"
|
2011-02-12 23:06:32 -07:00
|
|
|
#include "Debugger/CodeWindow.h"
|
|
|
|
#include "Debugger/JitWindow.h"
|
2009-01-08 17:09:07 -07:00
|
|
|
#include "ExtendedTrace.h"
|
2008-12-07 22:30:24 -07:00
|
|
|
#include "BootManager.h"
|
2010-01-22 14:41:25 -07:00
|
|
|
#include "Frame.h"
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2011-01-30 18:28:32 -07:00
|
|
|
#include "VideoBackendBase.h"
|
|
|
|
|
2011-01-04 21:35:46 -07:00
|
|
|
#include <wx/intl.h>
|
|
|
|
|
2009-09-05 19:40:44 -06:00
|
|
|
// ------------
|
2009-09-03 14:00:09 -06:00
|
|
|
// Main window
|
2009-09-05 19:40:44 -06:00
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
IMPLEMENT_APP(DolphinApp)
|
|
|
|
|
2010-07-07 16:00:41 -06:00
|
|
|
BEGIN_EVENT_TABLE(DolphinApp, wxApp)
|
|
|
|
EVT_TIMER(wxID_ANY, DolphinApp::AfterInit)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
2010-03-18 08:34:37 -06:00
|
|
|
#include <wx/stdpaths.h>
|
|
|
|
bool wxMsgAlert(const char*, const char*, bool, int);
|
2011-01-13 17:15:08 -07:00
|
|
|
std::string wxStringTranslator(const char *);
|
2008-12-14 05:30:37 -07:00
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
CFrame* main_frame = NULL;
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
//Has no error handling.
|
|
|
|
//I think that if an error occurs here there's no way to handle it anyway.
|
|
|
|
LONG WINAPI MyUnhandledExceptionFilter(LPEXCEPTION_POINTERS e) {
|
|
|
|
//EnterCriticalSection(&g_uefcs);
|
|
|
|
|
2009-02-17 15:48:16 -07:00
|
|
|
FILE* file = NULL;
|
2008-12-07 22:30:24 -07:00
|
|
|
fopen_s(&file, "exceptioninfo.txt", "a");
|
2010-12-03 20:50:55 -07:00
|
|
|
fseeko(file, 0, SEEK_END);
|
2009-01-08 17:09:07 -07:00
|
|
|
etfprint(file, "\n");
|
|
|
|
//etfprint(file, g_buildtime);
|
|
|
|
//etfprint(file, "\n");
|
2008-12-07 22:30:24 -07:00
|
|
|
//dumpCurrentDate(file);
|
2009-01-08 17:09:07 -07:00
|
|
|
etfprintf(file, "Unhandled Exception\n Code: 0x%08X\n",
|
2008-12-07 22:30:24 -07:00
|
|
|
e->ExceptionRecord->ExceptionCode);
|
|
|
|
#ifndef _M_X64
|
|
|
|
STACKTRACE2(file, e->ContextRecord->Eip, e->ContextRecord->Esp, e->ContextRecord->Ebp);
|
|
|
|
#else
|
|
|
|
STACKTRACE2(file, e->ContextRecord->Rip, e->ContextRecord->Rsp, e->ContextRecord->Rbp);
|
|
|
|
#endif
|
|
|
|
fclose(file);
|
|
|
|
_flushall();
|
|
|
|
|
|
|
|
//LeaveCriticalSection(&g_uefcs);
|
|
|
|
return EXCEPTION_CONTINUE_SEARCH;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-02-19 14:53:53 -07:00
|
|
|
bool DolphinApp::Initialize(int& c, wxChar **v)
|
|
|
|
{
|
|
|
|
#if defined HAVE_X11 && HAVE_X11
|
|
|
|
XInitThreads();
|
|
|
|
#endif
|
|
|
|
return wxApp::Initialize(c, v);
|
|
|
|
}
|
|
|
|
|
2009-07-11 22:10:52 -06:00
|
|
|
// The `main program' equivalent that creates the main window and return the main frame
|
2009-01-04 14:53:41 -07:00
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
bool DolphinApp::OnInit()
|
|
|
|
{
|
2011-01-04 21:35:46 -07:00
|
|
|
InitLanguageSupport();
|
|
|
|
|
2009-01-04 14:53:41 -07:00
|
|
|
// Declarations and definitions
|
|
|
|
bool UseDebugger = false;
|
2009-09-01 09:16:44 -06:00
|
|
|
bool UseLogger = false;
|
2011-02-02 09:34:12 -07:00
|
|
|
bool selectVideoBackend = false;
|
|
|
|
bool selectAudioEmulation = false;
|
2009-09-05 20:55:14 -06:00
|
|
|
|
2011-02-02 09:34:12 -07:00
|
|
|
wxString videoBackendName;
|
|
|
|
wxString audioEmulationName;
|
2009-09-05 20:55:14 -06:00
|
|
|
|
2010-03-18 08:34:37 -06:00
|
|
|
#if wxUSE_CMDLINE_PARSER // Parse command lines
|
|
|
|
wxCmdLineEntryDesc cmdLineDesc[] =
|
|
|
|
{
|
|
|
|
{
|
2011-01-11 18:03:49 -07:00
|
|
|
wxCMD_LINE_SWITCH, wxS("h"), wxS("help"),
|
2011-01-04 21:35:46 -07:00
|
|
|
_("Show this help message"),
|
2010-03-18 08:34:37 -06:00
|
|
|
wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP
|
|
|
|
},
|
|
|
|
{
|
2011-01-11 18:03:49 -07:00
|
|
|
wxCMD_LINE_SWITCH, wxS("d"), wxS("debugger"),
|
2011-02-14 14:58:53 -07:00
|
|
|
_("Opens the debugger"),
|
|
|
|
wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL
|
2010-03-18 08:34:37 -06:00
|
|
|
},
|
|
|
|
{
|
2011-01-11 18:03:49 -07:00
|
|
|
wxCMD_LINE_SWITCH, wxS("l"), wxS("logger"),
|
2011-02-14 14:58:53 -07:00
|
|
|
_("Opens the logger"),
|
|
|
|
wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL
|
2010-03-18 08:34:37 -06:00
|
|
|
},
|
|
|
|
{
|
2011-01-11 18:03:49 -07:00
|
|
|
wxCMD_LINE_OPTION, wxS("e"), wxS("exec"),
|
2011-02-14 14:58:53 -07:00
|
|
|
_("Loads the specified file (DOL,ELF,GCM,ISO,WAD)"),
|
2010-03-18 08:34:37 -06:00
|
|
|
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
|
|
|
|
},
|
2010-07-08 17:27:51 -06:00
|
|
|
{
|
2011-01-11 18:03:49 -07:00
|
|
|
wxCMD_LINE_SWITCH, wxS("b"), wxS("batch"),
|
2011-02-14 14:58:53 -07:00
|
|
|
_("Exit Dolphin with emulator"),
|
|
|
|
wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL
|
2010-07-08 17:27:51 -06:00
|
|
|
},
|
2010-03-18 08:34:37 -06:00
|
|
|
{
|
2011-02-02 09:34:12 -07:00
|
|
|
wxCMD_LINE_OPTION, wxS("V"), wxS("video_backend"),
|
|
|
|
_("Specify a video backend"),
|
2010-03-18 08:34:37 -06:00
|
|
|
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
|
|
|
|
},
|
|
|
|
{
|
2011-02-02 09:34:12 -07:00
|
|
|
wxCMD_LINE_OPTION, wxS("A"), wxS("audio_emulation"),
|
2011-02-14 14:58:53 -07:00
|
|
|
_("Low level (LLE) or high level (HLE) audio"),
|
2010-03-18 08:34:37 -06:00
|
|
|
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
|
|
|
|
},
|
|
|
|
{
|
2011-02-14 14:58:53 -07:00
|
|
|
wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, 0
|
2010-03-18 08:34:37 -06:00
|
|
|
}
|
|
|
|
};
|
2011-01-10 17:07:22 -07:00
|
|
|
|
2010-03-18 08:34:37 -06:00
|
|
|
// Gets the command line parameters
|
|
|
|
wxCmdLineParser parser(cmdLineDesc, argc, argv);
|
|
|
|
if (parser.Parse() != 0)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2011-01-10 17:07:22 -07:00
|
|
|
|
2011-01-11 18:03:49 -07:00
|
|
|
UseDebugger = parser.Found(wxT("debugger"));
|
|
|
|
UseLogger = parser.Found(wxT("logger"));
|
|
|
|
LoadFile = parser.Found(wxT("exec"), &FileToLoad);
|
|
|
|
BatchMode = parser.Found(wxT("batch"));
|
2011-02-02 09:34:12 -07:00
|
|
|
selectVideoBackend = parser.Found(wxT("video_backend"),
|
|
|
|
&videoBackendName);
|
|
|
|
// TODO: This currently has no effect. Implement or delete.
|
|
|
|
selectAudioEmulation = parser.Found(wxT("audio_emulation"),
|
|
|
|
&audioEmulationName);
|
2010-03-18 08:34:37 -06:00
|
|
|
#endif // wxUSE_CMDLINE_PARSER
|
|
|
|
|
|
|
|
#if defined _DEBUG && defined _WIN32
|
|
|
|
int tmpflag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
|
|
|
tmpflag |= _CRTDBG_DELAY_FREE_MEM_DF;
|
|
|
|
_CrtSetDbgFlag(tmpflag);
|
|
|
|
#endif
|
2010-02-15 21:34:41 -07:00
|
|
|
|
2011-01-13 08:32:14 -07:00
|
|
|
// Register message box and translation handlers
|
2010-03-18 08:34:37 -06:00
|
|
|
RegisterMsgAlertHandler(&wxMsgAlert);
|
2011-01-12 19:05:58 -07:00
|
|
|
RegisterStringTranslator(&wxStringTranslator);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2009-08-10 18:35:07 -06:00
|
|
|
// "ExtendedTrace" looks freakin dangerous!!!
|
2010-03-18 08:34:37 -06:00
|
|
|
#ifdef _WIN32
|
|
|
|
EXTENDEDTRACEINITIALIZE(".");
|
|
|
|
SetUnhandledExceptionFilter(&MyUnhandledExceptionFilter);
|
2011-01-21 09:54:37 -07:00
|
|
|
#elif wxUSE_ON_FATAL_EXCEPTION
|
2011-01-11 18:27:01 -07:00
|
|
|
wxHandleFatalExceptions(true);
|
2010-03-18 08:34:37 -06:00
|
|
|
#endif
|
|
|
|
|
2009-08-10 18:35:07 -06:00
|
|
|
// TODO: if First Boot
|
|
|
|
if (!cpu_info.bSSE2)
|
|
|
|
{
|
2011-01-12 19:05:58 -07:00
|
|
|
PanicAlertT("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");
|
2009-08-10 18:35:07 -06:00
|
|
|
return false;
|
|
|
|
}
|
2010-03-18 08:34:37 -06:00
|
|
|
|
2010-07-22 02:09:14 -06:00
|
|
|
#ifdef _WIN32
|
2009-07-11 22:10:52 -06:00
|
|
|
// Keep the user config dir free unless user wants to save the working dir
|
2011-02-28 20:06:14 -07:00
|
|
|
if (!File::Exists(File::GetUserPath(D_CONFIG_IDX) + "portable"))
|
2009-07-11 22:10:52 -06:00
|
|
|
{
|
|
|
|
char tmp[1024];
|
2009-08-01 23:59:55 -06:00
|
|
|
sprintf(tmp, "%s/.dolphin%swd", (const char*)wxStandardPaths::Get().GetUserConfigDir().mb_str(),
|
2009-07-17 00:03:53 -06:00
|
|
|
#ifdef _M_IX86
|
|
|
|
"x32");
|
|
|
|
#else
|
|
|
|
"x64");
|
|
|
|
#endif
|
2009-07-11 22:10:52 -06:00
|
|
|
FILE* workingDir = fopen(tmp, "r");
|
|
|
|
if (!workingDir)
|
|
|
|
{
|
2011-01-12 19:05:58 -07:00
|
|
|
if (PanicYesNoT("Dolphin has not been configured with an install location,\nKeep Dolphin portable?"))
|
2009-07-11 22:10:52 -06:00
|
|
|
{
|
2011-02-28 13:40:15 -07:00
|
|
|
FILE* portable = fopen((File::GetUserPath(D_CONFIG_IDX) + "portable").c_str(), "w");
|
2009-07-11 22:10:52 -06:00
|
|
|
if (!portable)
|
|
|
|
{
|
2011-01-12 19:05:58 -07:00
|
|
|
PanicAlertT("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?");
|
2009-07-11 22:10:52 -06:00
|
|
|
}
|
2009-08-31 16:51:19 -06:00
|
|
|
else
|
|
|
|
{
|
|
|
|
fclose(portable);
|
|
|
|
}
|
2009-07-11 22:10:52 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char CWD[1024];
|
2009-08-01 23:59:55 -06:00
|
|
|
sprintf(CWD, "%s", (const char*)wxGetCwd().mb_str());
|
2011-01-12 19:05:58 -07:00
|
|
|
if (PanicYesNoT("Set install location to:\n %s ?", CWD))
|
2009-07-11 22:10:52 -06:00
|
|
|
{
|
|
|
|
FILE* workingDirF = fopen(tmp, "w");
|
2009-08-11 06:09:46 -06:00
|
|
|
if (!workingDirF)
|
2011-01-12 19:05:58 -07:00
|
|
|
PanicAlertT("Install directory could not be saved");
|
2009-07-11 22:10:52 -06:00
|
|
|
else
|
|
|
|
{
|
|
|
|
fwrite(CWD, ((std::string)CWD).size()+1, 1, workingDirF);
|
|
|
|
fwrite("", 1, 1, workingDirF); //seems to be needed on linux
|
|
|
|
fclose(workingDirF);
|
|
|
|
}
|
|
|
|
}
|
2009-08-11 06:09:46 -06:00
|
|
|
else
|
2011-01-12 19:05:58 -07:00
|
|
|
PanicAlertT("Relaunch Dolphin from the install directory and save from there");
|
2009-07-11 22:10:52 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-07-12 01:17:43 -06:00
|
|
|
char *tmpChar;
|
2010-12-03 05:42:01 -07:00
|
|
|
size_t len = (size_t)File::GetSize(workingDir);
|
2009-07-12 01:17:43 -06:00
|
|
|
tmpChar = new char[len];
|
|
|
|
fread(tmpChar, len, 1, workingDir);
|
2009-07-11 22:10:52 -06:00
|
|
|
fclose(workingDir);
|
2010-06-11 02:39:03 -06:00
|
|
|
if (!wxSetWorkingDirectory(wxString::From8BitData(tmpChar)))
|
2009-07-11 22:10:52 -06:00
|
|
|
{
|
2009-07-17 00:03:53 -06:00
|
|
|
INFO_LOG(CONSOLE, "set working directory failed");
|
2009-07-11 22:10:52 -06:00
|
|
|
}
|
2009-07-12 01:17:43 -06:00
|
|
|
delete [] tmpChar;
|
2009-07-11 22:10:52 -06:00
|
|
|
}
|
|
|
|
}
|
2010-12-26 17:26:52 -07:00
|
|
|
#else
|
2010-03-18 08:34:37 -06:00
|
|
|
//create all necessary directories in user directory
|
|
|
|
//TODO : detect the revision and upgrade where necessary
|
2011-02-28 20:06:14 -07:00
|
|
|
File::CopyDir(std::string(SHARED_USER_DIR CONFIG_DIR DIR_SEP),
|
|
|
|
File::GetUserPath(D_CONFIG_IDX));
|
|
|
|
File::CopyDir(std::string(SHARED_USER_DIR GAMECONFIG_DIR DIR_SEP),
|
|
|
|
File::GetUserPath(D_GAMECONFIG_IDX));
|
|
|
|
File::CopyDir(std::string(SHARED_USER_DIR MAPS_DIR DIR_SEP),
|
|
|
|
File::GetUserPath(D_MAPS_IDX));
|
|
|
|
File::CopyDir(std::string(SHARED_USER_DIR SHADERS_DIR DIR_SEP),
|
|
|
|
File::GetUserPath(D_SHADERS_IDX));
|
|
|
|
File::CopyDir(std::string(SHARED_USER_DIR WII_USER_DIR DIR_SEP),
|
|
|
|
File::GetUserPath(D_WIIUSER_IDX));
|
|
|
|
File::CopyDir(std::string(SHARED_USER_DIR OPENCL_DIR DIR_SEP),
|
|
|
|
File::GetUserPath(D_OPENCL_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));
|
2010-02-02 14:56:29 -07:00
|
|
|
#endif
|
|
|
|
|
2010-03-18 08:34:37 -06:00
|
|
|
LogManager::Init();
|
|
|
|
SConfig::Init();
|
2011-01-30 18:28:32 -07:00
|
|
|
VideoBackend::PopulateList();
|
2010-10-12 13:42:29 -06:00
|
|
|
WiimoteReal::LoadSettings();
|
2009-01-04 14:53:41 -07:00
|
|
|
|
2011-02-02 09:34:12 -07:00
|
|
|
if (selectVideoBackend && videoBackendName != wxEmptyString)
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend =
|
|
|
|
std::string(videoBackendName.mb_str());
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2011-02-02 09:34:12 -07:00
|
|
|
VideoBackend::ActivateBackend(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend);
|
2011-01-30 18:28:32 -07:00
|
|
|
|
2010-08-01 09:48:11 -06:00
|
|
|
// Enable the PNG image handler for screenshots
|
|
|
|
wxImage::AddHandler(new wxPNGHandler);
|
2009-09-05 20:55:14 -06:00
|
|
|
|
2010-03-18 08:34:37 -06:00
|
|
|
SetEnableAlert(SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2010-01-18 11:01:03 -07:00
|
|
|
int x = SConfig::GetInstance().m_LocalCoreStartupParameter.iPosX;
|
|
|
|
int y = SConfig::GetInstance().m_LocalCoreStartupParameter.iPosY;
|
|
|
|
int w = SConfig::GetInstance().m_LocalCoreStartupParameter.iWidth;
|
|
|
|
int h = SConfig::GetInstance().m_LocalCoreStartupParameter.iHeight;
|
2009-09-15 15:35:32 -06:00
|
|
|
|
2011-02-02 11:21:20 -07:00
|
|
|
// The following is not needed with X11, where window managers
|
|
|
|
// do not allow windows to be created off the desktop.
|
2010-01-25 05:17:48 -07:00
|
|
|
#ifdef _WIN32
|
|
|
|
// Out of desktop check
|
|
|
|
HWND hDesktop = GetDesktopWindow();
|
|
|
|
RECT rc;
|
|
|
|
GetWindowRect(hDesktop, &rc);
|
|
|
|
if (rc.right < x + w || rc.bottom < y + h)
|
2011-02-02 11:21:20 -07:00
|
|
|
x = y = wxDefaultCoord;
|
|
|
|
#elif defined __APPLE__
|
|
|
|
if (y < 1)
|
|
|
|
y = wxDefaultCoord;
|
2010-01-25 05:17:48 -07:00
|
|
|
#endif
|
|
|
|
|
2010-07-08 09:25:01 -06:00
|
|
|
main_frame = new CFrame((wxFrame*)NULL, wxID_ANY,
|
|
|
|
wxString::FromAscii(svn_rev_str),
|
|
|
|
wxPoint(x, y), wxSize(w, h),
|
2010-07-08 17:27:51 -06:00
|
|
|
UseDebugger, BatchMode, UseLogger);
|
2010-07-07 16:00:41 -06:00
|
|
|
SetTopWindow(main_frame);
|
2011-01-15 03:33:07 -07:00
|
|
|
main_frame->SetMinSize(wxSize(400, 300));
|
2010-07-07 16:00:41 -06:00
|
|
|
|
2011-01-19 20:26:51 -07:00
|
|
|
// Postpone final actions until event handler is running.
|
|
|
|
// Updating the game list makes use of wxProgressDialog which may
|
|
|
|
// only be run after OnInit() when the event handler is running.
|
2010-07-07 16:00:41 -06:00
|
|
|
m_afterinit = new wxTimer(this, wxID_ANY);
|
|
|
|
m_afterinit->Start(1, wxTIMER_ONE_SHOT);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-01-19 20:26:51 -07:00
|
|
|
void DolphinApp::MacOpenFile(const wxString &fileName)
|
2010-07-07 16:00:41 -06:00
|
|
|
{
|
2011-01-19 20:26:51 -07:00
|
|
|
FileToLoad = fileName;
|
|
|
|
LoadFile = true;
|
2010-07-07 16:00:41 -06:00
|
|
|
|
2011-01-19 20:26:51 -07:00
|
|
|
if (m_afterinit == NULL)
|
|
|
|
main_frame->BootGame(std::string(FileToLoad.mb_str()));
|
|
|
|
}
|
2009-01-04 14:53:41 -07:00
|
|
|
|
2011-01-19 20:26:51 -07:00
|
|
|
void DolphinApp::AfterInit(wxTimerEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
delete m_afterinit;
|
|
|
|
m_afterinit = NULL;
|
2009-09-05 19:40:44 -06:00
|
|
|
|
2011-01-20 19:56:54 -07:00
|
|
|
if (!BatchMode)
|
|
|
|
main_frame->UpdateGameList();
|
|
|
|
|
2010-07-03 04:24:55 -06:00
|
|
|
// First check if we have an exec command line.
|
|
|
|
if (LoadFile && FileToLoad != wxEmptyString)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2010-07-03 04:24:55 -06:00
|
|
|
main_frame->BootGame(std::string(FileToLoad.mb_str()));
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
2010-07-07 16:00:41 -06:00
|
|
|
// If we have selected Automatic Start, start the default ISO,
|
|
|
|
// or if no default ISO exists, start the last loaded ISO
|
2009-09-07 06:40:43 -06:00
|
|
|
else if (main_frame->g_pCodeWindow)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2009-08-24 19:50:27 -06:00
|
|
|
if (main_frame->g_pCodeWindow->AutomaticStart())
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2009-08-24 19:50:27 -06:00
|
|
|
if(!SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.empty()
|
2011-02-28 20:06:14 -07:00
|
|
|
&& File::Exists(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM))
|
2009-08-24 19:50:27 -06:00
|
|
|
{
|
2010-04-16 21:17:36 -06:00
|
|
|
main_frame->BootGame(SConfig::GetInstance().m_LocalCoreStartupParameter.
|
2010-03-18 08:34:37 -06:00
|
|
|
m_strDefaultGCM);
|
2009-08-24 19:50:27 -06:00
|
|
|
}
|
|
|
|
else if(!SConfig::GetInstance().m_LastFilename.empty()
|
2011-02-28 20:06:14 -07:00
|
|
|
&& File::Exists(SConfig::GetInstance().m_LastFilename))
|
2009-08-24 19:50:27 -06:00
|
|
|
{
|
2010-04-16 21:17:36 -06:00
|
|
|
main_frame->BootGame(SConfig::GetInstance().m_LastFilename);
|
2009-08-24 19:50:27 -06:00
|
|
|
}
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-04 21:35:46 -07:00
|
|
|
void DolphinApp::InitLanguageSupport()
|
|
|
|
{
|
2011-01-08 10:35:34 -07:00
|
|
|
unsigned int language = 0;
|
2011-01-04 21:35:46 -07:00
|
|
|
|
|
|
|
IniFile ini;
|
2011-02-28 20:06:14 -07:00
|
|
|
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
2011-01-10 12:26:36 -07:00
|
|
|
ini.Get("Interface", "Language", &language, wxLANGUAGE_DEFAULT);
|
2011-01-04 21:35:46 -07:00
|
|
|
|
|
|
|
// Load language if possible, fall back to system default otherwise
|
2011-01-10 12:26:36 -07:00
|
|
|
if(wxLocale::IsAvailable(language))
|
2011-01-04 21:35:46 -07:00
|
|
|
{
|
2011-01-10 12:26:36 -07:00
|
|
|
m_locale = new wxLocale(language);
|
2011-01-04 21:35:46 -07:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
m_locale->AddCatalogLookupPathPrefix(wxT("Languages"));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
m_locale->AddCatalog(wxT("dolphin-emu"));
|
|
|
|
|
|
|
|
if(!m_locale->IsOk())
|
|
|
|
{
|
2011-01-14 08:09:30 -07:00
|
|
|
PanicAlertT("Error loading selected language. Falling back to system default.");
|
2011-01-04 21:35:46 -07:00
|
|
|
delete m_locale;
|
|
|
|
m_locale = new wxLocale(wxLANGUAGE_DEFAULT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-01-14 08:09:30 -07:00
|
|
|
PanicAlertT("The selected language is not supported by your system. Falling back to system default.");
|
2011-01-04 21:35:46 -07:00
|
|
|
m_locale = new wxLocale(wxLANGUAGE_DEFAULT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-15 21:34:41 -07:00
|
|
|
int DolphinApp::OnExit()
|
|
|
|
{
|
2010-10-12 13:42:29 -06:00
|
|
|
WiimoteReal::Shutdown();
|
2010-06-19 20:17:53 -06:00
|
|
|
#ifdef _WIN32
|
|
|
|
if (SConfig::GetInstance().m_WiiAutoUnpair)
|
2010-10-12 13:42:29 -06:00
|
|
|
WiimoteReal::UnPair();
|
2010-06-19 20:17:53 -06:00
|
|
|
#endif
|
2011-01-30 18:28:32 -07:00
|
|
|
VideoBackend::ClearList();
|
2010-02-15 21:34:41 -07:00
|
|
|
SConfig::Shutdown();
|
|
|
|
LogManager::Shutdown();
|
|
|
|
|
2011-01-04 21:35:46 -07:00
|
|
|
delete m_locale;
|
|
|
|
|
2010-02-15 21:34:41 -07:00
|
|
|
return wxApp::OnExit();
|
|
|
|
}
|
|
|
|
|
2011-01-11 18:27:01 -07:00
|
|
|
void DolphinApp::OnFatalException()
|
|
|
|
{
|
|
|
|
WiimoteReal::Shutdown();
|
|
|
|
}
|
|
|
|
|
2009-09-03 01:59:24 -06:00
|
|
|
|
2009-09-05 19:40:44 -06:00
|
|
|
// ------------
|
2009-09-03 14:00:09 -06:00
|
|
|
// Talk to GUI
|
2009-09-05 19:40:44 -06:00
|
|
|
|
2009-09-03 01:59:24 -06:00
|
|
|
void Host_SysMessage(const char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list list;
|
|
|
|
char msg[512];
|
|
|
|
|
|
|
|
va_start(list, fmt);
|
|
|
|
vsprintf(msg, fmt, list);
|
|
|
|
va_end(list);
|
|
|
|
|
|
|
|
if (msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = 0;
|
|
|
|
//wxMessageBox(wxString::FromAscii(msg));
|
|
|
|
PanicAlert("%s", msg);
|
|
|
|
}
|
|
|
|
|
2009-01-23 17:45:46 -07:00
|
|
|
bool wxMsgAlert(const char* caption, const char* text, bool yes_no, int /*Style*/)
|
2008-12-28 11:50:24 -07:00
|
|
|
{
|
2010-11-10 17:55:06 -07:00
|
|
|
#ifdef __WXGTK__
|
|
|
|
if (wxIsMainThread())
|
|
|
|
#endif
|
2011-01-13 08:32:14 -07:00
|
|
|
return wxYES == wxMessageBox(wxString::FromUTF8(text),
|
2011-01-13 13:53:37 -07:00
|
|
|
wxString::FromUTF8(caption),
|
2011-02-26 19:27:43 -07:00
|
|
|
(yes_no) ? wxYES_NO : wxOK, wxGetActiveWindow());
|
2010-11-10 17:55:06 -07:00
|
|
|
#ifdef __WXGTK__
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_PANIC);
|
2011-01-13 08:32:14 -07:00
|
|
|
event.SetString(wxString::FromUTF8(text));
|
2010-11-10 17:55:06 -07:00
|
|
|
event.SetInt(yes_no);
|
|
|
|
main_frame->GetEventHandler()->AddPendingEvent(event);
|
|
|
|
main_frame->panic_event.Wait();
|
|
|
|
return main_frame->bPanicResult;
|
|
|
|
}
|
|
|
|
#endif
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
2011-01-13 17:15:08 -07:00
|
|
|
std::string wxStringTranslator(const char *text)
|
2011-01-12 19:05:58 -07:00
|
|
|
{
|
2011-01-13 17:15:08 -07:00
|
|
|
return (const char *)wxString(wxGetTranslation(wxString::From8BitData(text))).ToUTF8();
|
2011-01-12 19:05:58 -07:00
|
|
|
}
|
|
|
|
|
2009-03-20 12:25:36 -06:00
|
|
|
// Accessor for the main window class
|
|
|
|
CFrame* DolphinApp::GetCFrame()
|
|
|
|
{
|
|
|
|
return main_frame;
|
|
|
|
}
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2009-09-07 06:40:43 -06:00
|
|
|
void Host_Message(int Id)
|
|
|
|
{
|
2010-07-18 20:09:34 -06:00
|
|
|
wxCommandEvent event(wxEVT_HOST_COMMAND, Id);
|
|
|
|
main_frame->GetEventHandler()->AddPendingEvent(event);
|
2009-09-07 06:40:43 -06:00
|
|
|
}
|
|
|
|
|
2011-02-12 14:25:49 -07:00
|
|
|
#ifdef _WIN32
|
|
|
|
extern "C" HINSTANCE wxGetInstance();
|
|
|
|
void* Host_GetInstance()
|
|
|
|
{
|
|
|
|
return (void*)wxGetInstance();
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
void* Host_GetInstance()
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void* Host_GetRenderHandle()
|
|
|
|
{
|
|
|
|
return main_frame->GetRenderHandle();
|
|
|
|
}
|
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
// OK, this thread boundary is DANGEROUS on linux
|
|
|
|
// wxPostEvent / wxAddPendingEvent is the solution.
|
|
|
|
void Host_NotifyMapLoaded()
|
|
|
|
{
|
|
|
|
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_NOTIFYMAPLOADED);
|
2010-01-20 04:49:11 -07:00
|
|
|
main_frame->GetEventHandler()->AddPendingEvent(event);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2009-09-03 01:59:24 -06:00
|
|
|
if (main_frame->g_pCodeWindow)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2010-01-20 04:49:11 -07:00
|
|
|
main_frame->g_pCodeWindow->GetEventHandler()->AddPendingEvent(event);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Host_UpdateLogDisplay()
|
|
|
|
{
|
|
|
|
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATELOGDISPLAY);
|
2010-01-20 04:49:11 -07:00
|
|
|
main_frame->GetEventHandler()->AddPendingEvent(event);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2009-09-03 01:59:24 -06:00
|
|
|
if (main_frame->g_pCodeWindow)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2010-01-20 04:49:11 -07:00
|
|
|
main_frame->g_pCodeWindow->GetEventHandler()->AddPendingEvent(event);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Host_UpdateDisasmDialog()
|
|
|
|
{
|
|
|
|
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATEDISASMDIALOG);
|
2010-01-20 04:49:11 -07:00
|
|
|
main_frame->GetEventHandler()->AddPendingEvent(event);
|
2009-07-15 09:09:20 -06:00
|
|
|
|
2009-09-03 01:59:24 -06:00
|
|
|
if (main_frame->g_pCodeWindow)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2010-01-20 04:49:11 -07:00
|
|
|
main_frame->g_pCodeWindow->GetEventHandler()->AddPendingEvent(event);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-11 14:37:55 -06:00
|
|
|
void Host_ShowJitResults(unsigned int address)
|
|
|
|
{
|
2011-02-24 20:56:14 -07:00
|
|
|
if (main_frame->g_pCodeWindow && main_frame->g_pCodeWindow->m_JitWindow)
|
|
|
|
main_frame->g_pCodeWindow->m_JitWindow->ViewAddr(address);
|
2009-07-11 14:37:55 -06:00
|
|
|
}
|
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
void Host_UpdateMainFrame()
|
|
|
|
{
|
|
|
|
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATEGUI);
|
2010-01-20 04:49:11 -07:00
|
|
|
main_frame->GetEventHandler()->AddPendingEvent(event);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2009-09-03 01:59:24 -06:00
|
|
|
if (main_frame->g_pCodeWindow)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2010-01-20 04:49:11 -07:00
|
|
|
main_frame->g_pCodeWindow->GetEventHandler()->AddPendingEvent(event);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
}
|
2009-09-27 15:28:09 -06:00
|
|
|
|
2010-04-15 14:58:34 -06:00
|
|
|
void Host_UpdateTitle(const char* title)
|
|
|
|
{
|
|
|
|
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATETITLE);
|
|
|
|
event.SetString(wxString::FromAscii(title));
|
|
|
|
main_frame->GetEventHandler()->AddPendingEvent(event);
|
2011-02-15 02:07:55 -07:00
|
|
|
Host_UpdateMainFrame();
|
2010-04-15 14:58:34 -06:00
|
|
|
}
|
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
void Host_UpdateBreakPointView()
|
|
|
|
{
|
|
|
|
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATEBREAKPOINTS);
|
2010-01-20 04:49:11 -07:00
|
|
|
main_frame->GetEventHandler()->AddPendingEvent(event);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2009-09-03 01:59:24 -06:00
|
|
|
if (main_frame->g_pCodeWindow)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2010-01-20 04:49:11 -07:00
|
|
|
main_frame->g_pCodeWindow->GetEventHandler()->AddPendingEvent(event);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-30 09:40:38 -07:00
|
|
|
bool Host_GetKeyState(int keycode)
|
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
|
|
|
return GetAsyncKeyState(keycode);
|
2011-01-30 15:02:47 -07:00
|
|
|
#elif defined __WXGTK__
|
|
|
|
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_KEYSTATE);
|
|
|
|
event.SetInt(keycode);
|
|
|
|
main_frame->GetEventHandler()->AddPendingEvent(event);
|
|
|
|
main_frame->keystate_event.Wait();
|
|
|
|
return main_frame->bKeyStateResult;
|
2011-01-30 09:40:38 -07:00
|
|
|
#else
|
|
|
|
return wxGetKeyState(wxKeyCode(keycode));
|
|
|
|
#endif
|
|
|
|
}
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2011-01-06 21:57:59 -07:00
|
|
|
void Host_GetRenderWindowSize(int& x, int& y, int& width, int& height)
|
2010-04-11 19:33:10 -06:00
|
|
|
{
|
2011-01-06 21:57:59 -07:00
|
|
|
main_frame->GetRenderWindowSize(x, y, width, height);
|
|
|
|
}
|
|
|
|
|
2011-01-24 20:30:12 -07:00
|
|
|
void Host_RequestRenderWindowSize(int width, int height)
|
2011-01-06 21:57:59 -07:00
|
|
|
{
|
2011-01-31 21:35:25 -07:00
|
|
|
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_WINDOWSIZEREQUEST);
|
|
|
|
event.SetClientData(new std::pair<int, int>(width, height));
|
|
|
|
main_frame->GetEventHandler()->AddPendingEvent(event);
|
2010-04-11 19:33:10 -06:00
|
|
|
}
|
|
|
|
|
2011-02-12 14:25:49 -07:00
|
|
|
void Host_SetStartupDebuggingParameters()
|
|
|
|
{
|
|
|
|
SCoreStartupParameter& StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter;
|
|
|
|
if (main_frame->g_pCodeWindow)
|
|
|
|
{
|
|
|
|
StartUp.bBootToPause = main_frame->g_pCodeWindow->BootToPause();
|
|
|
|
StartUp.bAutomaticStart = main_frame->g_pCodeWindow->AutomaticStart();
|
|
|
|
StartUp.bJITNoBlockCache = main_frame->g_pCodeWindow->JITNoBlockCache();
|
|
|
|
StartUp.bJITBlockLinking = main_frame->g_pCodeWindow->JITBlockLinking();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
StartUp.bBootToPause = false;
|
|
|
|
}
|
|
|
|
StartUp.bEnableDebugging = main_frame->g_pCodeWindow ? true : false; // RUNNING_DEBUG
|
|
|
|
}
|
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
void Host_SetWaitCursor(bool enable)
|
|
|
|
{
|
2009-12-01 08:39:37 -07:00
|
|
|
if (enable)
|
2010-04-11 19:33:10 -06:00
|
|
|
wxBeginBusyCursor();
|
2009-12-01 08:39:37 -07:00
|
|
|
else
|
2010-04-11 19:33:10 -06:00
|
|
|
wxEndBusyCursor();
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
2009-02-15 23:18:18 -07:00
|
|
|
void Host_UpdateStatusBar(const char* _pText, int Field)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
|
|
|
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATESTATUSBAR);
|
2009-02-15 23:18:18 -07:00
|
|
|
// Set the event string
|
2008-12-07 22:30:24 -07:00
|
|
|
event.SetString(wxString::FromAscii(_pText));
|
2009-02-15 23:18:18 -07:00
|
|
|
// Update statusbar field
|
|
|
|
event.SetInt(Field);
|
|
|
|
// Post message
|
2010-01-20 04:49:11 -07:00
|
|
|
main_frame->GetEventHandler()->AddPendingEvent(event);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void Host_SetWiiMoteConnectionState(int _State)
|
|
|
|
{
|
|
|
|
static int currentState = -1;
|
|
|
|
if (_State == currentState)
|
|
|
|
return;
|
|
|
|
currentState = _State;
|
|
|
|
|
|
|
|
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATESTATUSBAR);
|
|
|
|
|
|
|
|
switch(_State)
|
|
|
|
{
|
2011-01-05 10:56:08 -07:00
|
|
|
case 0: event.SetString(_("Not connected")); break;
|
|
|
|
case 1: event.SetString(_("Connecting...")); break;
|
|
|
|
case 2: event.SetString(_("Wiimote Connected")); break;
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
2009-02-15 23:18:18 -07:00
|
|
|
// Update field 1 or 2
|
2009-12-31 20:55:39 -07:00
|
|
|
event.SetInt(1);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2010-01-20 04:49:11 -07:00
|
|
|
main_frame->GetEventHandler()->AddPendingEvent(event);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
2010-04-11 19:33:10 -06:00
|
|
|
|
|
|
|
bool Host_RendererHasFocus()
|
|
|
|
{
|
|
|
|
return main_frame->RendererHasFocus();
|
|
|
|
}
|
2011-01-07 08:18:00 -07:00
|
|
|
|
|
|
|
void Host_ConnectWiimote(int wm_idx, bool connect)
|
|
|
|
{
|
|
|
|
CFrame::ConnectWiimote(wm_idx, connect);
|
|
|
|
}
|