// Display and Interface settings void CConfigMain::DisplaySettingsChanged(wxCommandEvent& event) { switch (event.GetId()) { // Display - Interface case ID_INTERFACE_CONFIRMSTOP: SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop = ConfirmStop->IsChecked(); break; case ID_INTERFACE_USEPANICHANDLERS: SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers = UsePanicHandlers->IsChecked(); SetEnableAlert(UsePanicHandlers->IsChecked()); break; case ID_INTERFACE_ONSCREENDISPLAYMESSAGES: SConfig::GetInstance().m_LocalCoreStartupParameter.bOnScreenDisplayMessages = OnScreenDisplayMessages->IsChecked(); SetEnableAlert(OnScreenDisplayMessages->IsChecked()); break; case ID_INTERFACE_LANG: if (SConfig::GetInstance().m_InterfaceLanguage != langIds[InterfaceLang->GetSelection()]) SuccessAlertT("You must restart Dolphin in order for the change to take effect."); SConfig::GetInstance().m_InterfaceLanguage = langIds[InterfaceLang->GetSelection()]; break; case ID_HOTKEY_CONFIG: { HotkeyConfigDialog m_HotkeyDialog(this); m_HotkeyDialog.ShowModal(); } // Update the GUI in case menu accelerators were changed main_frame->UpdateGUI(); break; } }
void Init() { LogManager::Init(); SConfig::Init(); VideoBackend::PopulateList(); WiimoteReal::LoadSettings(); GCAdapter::Init(); VideoBackend::ActivateBackend(SConfig::GetInstance().m_strVideoBackend); SetEnableAlert(SConfig::GetInstance().bUsePanicHandlers); }
void Init() { Config::Init(); Config::AddConfigChangedCallback(InitCustomPaths); Config::AddLayer(ConfigLoaders::GenerateBaseConfigLoader()); SConfig::Init(); Discord::Init(); LogManager::Init(); VideoBackendBase::PopulateList(); WiimoteReal::LoadSettings(); GCAdapter::Init(); VideoBackendBase::ActivateBackend(SConfig::GetInstance().m_strVideoBackend); SetEnableAlert(SConfig::GetInstance().bUsePanicHandlers); }
static bool QtMsgAlertHandler(const char* caption, const char* text, bool yes_no, MsgType style) { std::optional<bool> r = RunOnObject(QApplication::instance(), [&] { QMessageBox message_box(QApplication::activeWindow()); message_box.setWindowTitle(QString::fromUtf8(caption)); message_box.setText(QString::fromUtf8(text)); message_box.setStandardButtons(yes_no ? QMessageBox::Yes | QMessageBox::No : QMessageBox::Ok); if (style == MsgType::Warning) message_box.addButton(QMessageBox::Ignore)->setText(QObject::tr("Ignore for this session")); message_box.setIcon([&] { switch (style) { case MsgType::Information: return QMessageBox::Information; case MsgType::Question: return QMessageBox::Question; case MsgType::Warning: return QMessageBox::Warning; case MsgType::Critical: return QMessageBox::Critical; } // appease MSVC return QMessageBox::NoIcon; }()); const int button = message_box.exec(); if (button == QMessageBox::Yes) return true; if (button == QMessageBox::Ignore) SetEnableAlert(false); return false; }); if (r.has_value()) return *r; return false; }
bool DolphinApp::OnInit() { InitLanguageSupport(); // Declarations and definitions bool UseDebugger = false; bool UseLogger = false; bool selectVideoBackend = false; bool selectAudioEmulation = false; wxString videoBackendName; wxString audioEmulationName; #if wxUSE_CMDLINE_PARSER // Parse command lines wxCmdLineEntryDesc cmdLineDesc[] = { { wxCMD_LINE_SWITCH, wxS("h"), wxS("help"), _("Show this help message"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, { wxCMD_LINE_SWITCH, wxS("d"), wxS("debugger"), _("Opens the debugger"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_SWITCH, wxS("l"), wxS("logger"), _("Opens the logger"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_OPTION, wxS("e"), wxS("exec"), _("Loads the specified file (DOL,ELF,GCM,ISO,WAD)"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_SWITCH, wxS("b"), wxS("batch"), _("Exit Dolphin with emulator"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_OPTION, wxS("V"), wxS("video_backend"), _("Specify a video backend"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_OPTION, wxS("A"), wxS("audio_emulation"), _("Low level (LLE) or high level (HLE) audio"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, 0 } }; // Gets the command line parameters wxCmdLineParser parser(cmdLineDesc, argc, argv); if (parser.Parse() != 0) { return false; } UseDebugger = parser.Found(wxT("debugger")); UseLogger = parser.Found(wxT("logger")); LoadFile = parser.Found(wxT("exec"), &FileToLoad); BatchMode = parser.Found(wxT("batch")); selectVideoBackend = parser.Found(wxT("video_backend"), &videoBackendName); // TODO: This currently has no effect. Implement or delete. selectAudioEmulation = parser.Found(wxT("audio_emulation"), &audioEmulationName); #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 and translation handlers RegisterMsgAlertHandler(&wxMsgAlert); RegisterStringTranslator(&wxStringTranslator); // "ExtendedTrace" looks freakin dangerous!!! #ifdef _WIN32 EXTENDEDTRACEINITIALIZE("."); SetUnhandledExceptionFilter(&MyUnhandledExceptionFilter); #elif wxUSE_ON_FATAL_EXCEPTION wxHandleFatalExceptions(true); #endif // TODO: if First Boot if (!cpu_info.bSSE2) { 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"); return false; } #ifdef _WIN32 if (!wxSetWorkingDirectory(wxString(File::GetExeDirectory().c_str(), *wxConvCurrent))) { INFO_LOG(CONSOLE, "set working directory failed"); } #else //create all necessary directories in user directory //TODO : detect the revision and upgrade where necessary 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_CONFIG_IDX))) File::CreateFullPath(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_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 LogManager::Init(); SConfig::Init(); VideoBackend::PopulateList(); WiimoteReal::LoadSettings(); if (selectVideoBackend && videoBackendName != wxEmptyString) SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend = std::string(videoBackendName.mb_str()); VideoBackend::ActivateBackend(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend); // Enable the PNG image handler for screenshots wxImage::AddHandler(new wxPNGHandler); SetEnableAlert(SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers); 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; // The following is not needed with X11, where window managers // do not allow windows to be created off the desktop. #ifdef _WIN32 // Out of desktop check HWND hDesktop = GetDesktopWindow(); RECT rc; GetWindowRect(hDesktop, &rc); if (rc.right < x + w || rc.bottom < y + h) x = y = wxDefaultCoord; #elif defined __APPLE__ if (y < 1) y = wxDefaultCoord; #endif main_frame = new CFrame((wxFrame*)NULL, wxID_ANY, wxString::FromAscii(svn_rev_str), wxPoint(x, y), wxSize(w, h), UseDebugger, BatchMode, UseLogger); SetTopWindow(main_frame); main_frame->SetMinSize(wxSize(400, 300)); // 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. m_afterinit = new wxTimer(this, wxID_ANY); m_afterinit->Start(1, wxTIMER_ONE_SHOT); return true; }
void VideoConfig::Load(const char *ini_file) { std::string temp; IniFile iniFile; iniFile.Load(ini_file); iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware iniFile.Get("Settings", "wideScreenHack", &bWidescreenHack, false); iniFile.Get("Settings", "AspectRatio", &iAspectRatio, (int)ASPECT_AUTO); iniFile.Get("Settings", "Crop", &bCrop, false); iniFile.Get("Settings", "UseXFB", &bUseXFB, 0); iniFile.Get("Settings", "UseRealXFB", &bUseRealXFB, 0); iniFile.Get("Settings", "ShowFPS", &bShowFPS, false); // Settings iniFile.Get("Settings", "ShowInputDisplay", &bShowInputDisplay, false); iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false); iniFile.Get("Settings", "OverlayProjStats", &bOverlayProjStats, false); iniFile.Get("Settings", "ShowEFBCopyRegions", &bShowEFBCopyRegions, false); iniFile.Get("Settings", "DLOptimize", &iCompileDLsLevel, 0); iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0); iniFile.Get("Settings", "HiresTextures", &bHiresTextures, 0); iniFile.Get("Settings", "DumpEFBTarget", &bDumpEFBTarget, 0); iniFile.Get("Settings", "DumpFrames", &bDumpFrames, 0); iniFile.Get("Settings", "FreeLook", &bFreeLook, 0); iniFile.Get("Settings", "UseFFV1", &bUseFFV1, 0); iniFile.Get("Settings", "AnaglyphStereo", &bAnaglyphStereo, false); iniFile.Get("Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation, 200); iniFile.Get("Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle, 0); iniFile.Get("Settings", "EnablePixelLighting", &bEnablePixelLighting, 0); iniFile.Get("Settings", "EnablePerPixelDepth", &bEnablePerPixelDepth, 0); iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, 1); iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0); iniFile.Get("Settings", "EFBScale", &iEFBScale, 2); // native iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false); iniFile.Get("Settings", "TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0); iniFile.Get("Settings", "TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0); iniFile.Get("Settings", "WireFrame", &bWireFrame, 0); iniFile.Get("Settings", "DisableLighting", &bDisableLighting, 0); iniFile.Get("Settings", "DisableTexturing", &bDisableTexturing, 0); iniFile.Get("Settings", "DisableFog", &bDisableFog, 0); iniFile.Get("Settings", "EnableOpenCL", &bEnableOpenCL, false); iniFile.Get("Settings", "OMPDecoder", &bOMPDecoder, false); iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0); iniFile.Get("Enhancements", "MaxAnisotropy", &iMaxAnisotropy, 0); // NOTE - this is x in (1 << x) iniFile.Get("Enhancements", "PostProcessingShader", &sPostProcessingShader, ""); iniFile.Get("Enhancements", "Enable3dVision", &b3DVision, false); iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true); iniFile.Get("Hacks", "DlistCachingEnable", &bDlistCachingEnable,false); iniFile.Get("Hacks", "EFBCopyEnable", &bEFBCopyEnable, true); iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bOSDHotKey, 0); iniFile.Get("Hacks", "EFBCopyRAMEnable", &bEFBCopyRAMEnable, true); iniFile.Get("Hacks", "EFBCopyVirtualEnable", &bEFBCopyVirtualEnable, true); iniFile.Get("Hacks", "EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, false); iniFile.Get("Hardware", "Adapter", &iAdapter, 0); // Load common settings iniFile.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); bool bTmp; iniFile.Get("Interface", "UsePanicHandlers", &bTmp, true); SetEnableAlert(bTmp); }
void VideoConfig::Load(const std::string& ini_file) { IniFile iniFile; iniFile.Load(ini_file); IniFile::Section* hardware = iniFile.GetOrCreateSection("Hardware"); hardware->Get("VSync", &bVSync, 0); hardware->Get("Adapter", &iAdapter, 0); IniFile::Section* settings = iniFile.GetOrCreateSection("Settings"); settings->Get("wideScreenHack", &bWidescreenHack, false); settings->Get("AspectRatio", &iAspectRatio, (int)ASPECT_AUTO); settings->Get("Crop", &bCrop, false); settings->Get("UseXFB", &bUseXFB, 0); settings->Get("UseRealXFB", &bUseRealXFB, 0); settings->Get("SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples, 128); settings->Get("ShowFPS", &bShowFPS, false); settings->Get("LogRenderTimeToFile", &bLogRenderTimeToFile, false); settings->Get("OverlayStats", &bOverlayStats, false); settings->Get("OverlayProjStats", &bOverlayProjStats, false); settings->Get("DumpTextures", &bDumpTextures, 0); settings->Get("HiresTextures", &bHiresTextures, 0); settings->Get("ConvertHiresTextures", &bConvertHiresTextures, 0); settings->Get("CacheHiresTextures", &bCacheHiresTextures, 0); settings->Get("DumpEFBTarget", &bDumpEFBTarget, 0); settings->Get("FreeLook", &bFreeLook, 0); settings->Get("UseFFV1", &bUseFFV1, 0); settings->Get("EnablePixelLighting", &bEnablePixelLighting, 0); settings->Get("FastDepthCalc", &bFastDepthCalc, true); settings->Get("MSAA", &iMultisamples, 1); settings->Get("SSAA", &bSSAA, false); settings->Get("EFBScale", &iEFBScale, (int)SCALE_1X); // native settings->Get("TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0); settings->Get("TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0); settings->Get("WireFrame", &bWireFrame, 0); settings->Get("DisableFog", &bDisableFog, 0); settings->Get("EnableShaderDebugging", &bEnableShaderDebugging, false); settings->Get("BorderlessFullscreen", &bBorderlessFullscreen, false); settings->Get("SWZComploc", &bZComploc, true); settings->Get("SWZFreeze", &bZFreeze, true); settings->Get("SWDumpObjects", &bDumpObjects, false); settings->Get("SWDumpTevStages", &bDumpTevStages, false); settings->Get("SWDumpTevTexFetches", &bDumpTevTextureFetches, false); settings->Get("SWDrawStart", &drawStart, 0); settings->Get("SWDrawEnd", &drawEnd, 100000); IniFile::Section* enhancements = iniFile.GetOrCreateSection("Enhancements"); enhancements->Get("ForceFiltering", &bForceFiltering, 0); enhancements->Get("MaxAnisotropy", &iMaxAnisotropy, 0); // NOTE - this is x in (1 << x) enhancements->Get("PostProcessingShader", &sPostProcessingShader, ""); IniFile::Section* stereoscopy = iniFile.GetOrCreateSection("Stereoscopy"); stereoscopy->Get("StereoMode", &iStereoMode, 0); stereoscopy->Get("StereoDepth", &iStereoDepth, 20); stereoscopy->Get("StereoConvergencePercentage", &iStereoConvergencePercentage, 100); stereoscopy->Get("StereoSwapEyes", &bStereoSwapEyes, false); IniFile::Section* hacks = iniFile.GetOrCreateSection("Hacks"); hacks->Get("EFBAccessEnable", &bEFBAccessEnable, true); hacks->Get("BBoxEnable", &bBBoxEnable, false); hacks->Get("ForceProgressive", &bForceProgressive, true); hacks->Get("EFBToTextureEnable", &bSkipEFBCopyToRam, true); hacks->Get("EFBScaledCopy", &bCopyEFBScaled, true); hacks->Get("EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, false); // hacks which are disabled by default iPhackvalue[0] = 0; bPerfQueriesEnable = false; // Load common settings iniFile.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); IniFile::Section* interface = iniFile.GetOrCreateSection("Interface"); bool bTmp; interface->Get("UsePanicHandlers", &bTmp, true); SetEnableAlert(bTmp); // Shader Debugging causes a huge slowdown and it's easy to forget about it // since it's not exposed in the settings dialog. It's only used by // developers, so displaying an obnoxious message avoids some confusion and // is not too annoying/confusing for users. // // XXX(delroth): This is kind of a bad place to put this, but the current // VideoCommon is a mess and we don't have a central initialization // function to do these kind of checks. Instead, the init code is // triplicated for each video backend. if (bEnableShaderDebugging) OSD::AddMessage("Warning: Shader Debugging is enabled, performance will suffer heavily", 15000); VerifyValidity(); }
void InterfaceConfigPane::OnPanicHandlersCheckBoxChanged(wxCommandEvent& event) { SConfig::GetInstance().bUsePanicHandlers = m_panic_handlers_checkbox->IsChecked(); SetEnableAlert(m_panic_handlers_checkbox->IsChecked()); }
bool DolphinApp::OnInit() { InitLanguageSupport(); // Declarations and definitions bool UseDebugger = false; bool UseLogger = false; bool selectVideoBackend = false; bool selectAudioEmulation = false; wxString videoBackendName; wxString audioEmulationName; wxString userPath; #if wxUSE_CMDLINE_PARSER // Parse command lines wxCmdLineEntryDesc cmdLineDesc[] = { { wxCMD_LINE_SWITCH, "h", "help", "Show this help message", wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, { wxCMD_LINE_SWITCH, "d", "debugger", "Opens the debugger", wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_SWITCH, "l", "logger", "Opens the logger", wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_OPTION, "e", "exec", "Loads the specified file (DOL,ELF,GCM,ISO,WAD)", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_SWITCH, "b", "batch", "Exit Dolphin with emulator", wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_OPTION, "V", "video_backend", "Specify a video backend", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_OPTION, "A", "audio_emulation", "Low level (LLE) or high level (HLE) audio", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_OPTION, "m", "movie", "Play a movie file", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_OPTION, "U", "user", "User folder path", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_NONE, nullptr, nullptr, nullptr, wxCMD_LINE_VAL_NONE, 0 } }; // Gets the command line parameters wxCmdLineParser parser(cmdLineDesc, argc, argv); if (parser.Parse() != 0) { return false; } UseDebugger = parser.Found("debugger"); UseLogger = parser.Found("logger"); LoadFile = parser.Found("exec", &FileToLoad); BatchMode = parser.Found("batch"); selectVideoBackend = parser.Found("video_backend", &videoBackendName); selectAudioEmulation = parser.Found("audio_emulation", &audioEmulationName); playMovie = parser.Found("movie", &movieFile); if (parser.Found("user", &userPath)) { File::CreateFullPath(WxStrToStr(userPath) + DIR_SEP); File::GetUserPath(D_USER_IDX, userPath.ToStdString() + DIR_SEP); } #endif // wxUSE_CMDLINE_PARSER // Register message box and translation handlers RegisterMsgAlertHandler(&wxMsgAlert); RegisterStringTranslator(&wxStringTranslator); // "ExtendedTrace" looks freakin' dangerous!!! #ifdef _WIN32 EXTENDEDTRACEINITIALIZE("."); SetUnhandledExceptionFilter(&MyUnhandledExceptionFilter); #elif wxUSE_ON_FATAL_EXCEPTION wxHandleFatalExceptions(true); #endif #ifndef _M_ARM // TODO: if First Boot if (!cpu_info.bSSE2) { 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"); return false; } #endif #ifdef __APPLE__ if (floor(NSAppKitVersionNumber) < NSAppKitVersionNumber10_7) { PanicAlertT("Hi,\n\nDolphin requires Mac OS X 10.7 or greater.\n" "Unfortunately you're running an old version of OS X.\n" "The last Dolphin version to support OS X 10.6 is Dolphin 3.5\n" "Please upgrade to 10.7 or greater to use the newest Dolphin version.\n\n" "Sayonara!\n"); return false; } #endif // Copy initial Wii NAND data from Sys to User. File::CopyDir(File::GetSysDirectory() + WII_USER_DIR DIR_SEP, File::GetUserPath(D_WIIUSER_IDX)); File::CreateFullPath(File::GetUserPath(D_USER_IDX)); File::CreateFullPath(File::GetUserPath(D_CACHE_IDX)); File::CreateFullPath(File::GetUserPath(D_CONFIG_IDX)); File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX)); File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX)); File::CreateFullPath(File::GetUserPath(D_GAMESETTINGS_IDX)); File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX)); File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + USA_DIR DIR_SEP); File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + EUR_DIR DIR_SEP); File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + JAP_DIR DIR_SEP); File::CreateFullPath(File::GetUserPath(D_HIRESTEXTURES_IDX)); File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX)); File::CreateFullPath(File::GetUserPath(D_MAPS_IDX)); File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX)); File::CreateFullPath(File::GetUserPath(D_SHADERS_IDX)); File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX)); File::CreateFullPath(File::GetUserPath(D_THEMES_IDX)); LogManager::Init(); SConfig::Init(); VideoBackend::PopulateList(); WiimoteReal::LoadSettings(); if (selectVideoBackend && videoBackendName != wxEmptyString) SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend = WxStrToStr(videoBackendName); if (selectAudioEmulation) { if (audioEmulationName == "HLE") SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE = true; else if (audioEmulationName == "LLE") SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE = false; } VideoBackend::ActivateBackend(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend); // Enable the PNG image handler for screenshots wxImage::AddHandler(new wxPNGHandler); SetEnableAlert(SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers); 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; #ifdef _WIN32 if (File::Exists("www.dolphin-emulator.com.txt")) { File::Delete("www.dolphin-emulator.com.txt"); MessageBox(nullptr, L"This version of Dolphin was downloaded from a website stealing money from developers of the emulator. Please " L"download Dolphin from the official website instead: http://dolphin-emu.org/", L"Unofficial version detected", MB_OK | MB_ICONWARNING); ShellExecute(nullptr, L"open", L"http://dolphin-emu.org/?ref=badver", nullptr, nullptr, SW_SHOWDEFAULT); exit(0); } #endif // The following is not needed with X11, where window managers // do not allow windows to be created off the desktop. #ifdef _WIN32 // Out of desktop check int leftPos = GetSystemMetrics(SM_XVIRTUALSCREEN); int topPos = GetSystemMetrics(SM_YVIRTUALSCREEN); int width = GetSystemMetrics(SM_CXVIRTUALSCREEN); int height = GetSystemMetrics(SM_CYVIRTUALSCREEN); if ((leftPos + width) < (x + w) || leftPos > x || (topPos + height) < (y + h) || topPos > y) x = y = wxDefaultCoord; #elif defined __APPLE__ if (y < 1) y = wxDefaultCoord; #endif main_frame = new CFrame((wxFrame*)nullptr, wxID_ANY, StrToWxStr(scm_rev_str), wxPoint(x, y), wxSize(w, h), UseDebugger, BatchMode, UseLogger); SetTopWindow(main_frame); main_frame->SetMinSize(wxSize(400, 300)); // 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. m_afterinit = new wxTimer(this, wxID_ANY); m_afterinit->Start(1, wxTIMER_ONE_SHOT); return true; }
void VideoConfig::Load(const char *ini_file) { IniFile iniFile; iniFile.Load(ini_file); iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware iniFile.Get("Settings", "wideScreenHack", &bWidescreenHack, false); iniFile.Get("Settings", "AspectRatio", &iAspectRatio, (int)ASPECT_AUTO); iniFile.Get("Settings", "Crop", &bCrop, false); iniFile.Get("Settings", "UseXFB", &bUseXFB, 0); iniFile.Get("Settings", "UseRealXFB", &bUseRealXFB, 0); iniFile.Get("Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,128); iniFile.Get("Settings", "ShowFPS", &bShowFPS, false); // Settings iniFile.Get("Settings", "LogFPSToFile", &bLogFPSToFile, false); iniFile.Get("Settings", "ShowInputDisplay", &bShowInputDisplay, false); iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false); iniFile.Get("Settings", "OverlayProjStats", &bOverlayProjStats, false); iniFile.Get("Settings", "ShowEFBCopyRegions", &bShowEFBCopyRegions, false); iniFile.Get("Settings", "DLOptimize", &iCompileDLsLevel, 0); iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0); iniFile.Get("Settings", "HiresTextures", &bHiresTextures, 0); iniFile.Get("Settings", "DumpEFBTarget", &bDumpEFBTarget, 0); iniFile.Get("Settings", "DumpFrames", &bDumpFrames, 0); iniFile.Get("Settings", "FreeLook", &bFreeLook, 0); iniFile.Get("Settings", "UseFFV1", &bUseFFV1, 0); iniFile.Get("Settings", "AnaglyphStereo", &bAnaglyphStereo, false); iniFile.Get("Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation, 200); iniFile.Get("Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle, 0); iniFile.Get("Settings", "EnablePixelLighting", &bEnablePixelLighting, 0); iniFile.Get("Settings", "FastDepthCalc", &bFastDepthCalc, true); iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0); iniFile.Get("Settings", "EFBScale", &iEFBScale, (int) SCALE_1X); // native iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false); iniFile.Get("Settings", "TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0); iniFile.Get("Settings", "TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0); iniFile.Get("Settings", "WireFrame", &bWireFrame, 0); iniFile.Get("Settings", "DisableFog", &bDisableFog, 0); iniFile.Get("Settings", "OMPDecoder", &bOMPDecoder, false); iniFile.Get("Settings", "EnableShaderDebugging", &bEnableShaderDebugging, false); iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0); iniFile.Get("Enhancements", "MaxAnisotropy", &iMaxAnisotropy, 0); // NOTE - this is x in (1 << x) iniFile.Get("Enhancements", "PostProcessingShader", &sPostProcessingShader, ""); iniFile.Get("Enhancements", "Enable3dVision", &b3DVision, false); iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true); iniFile.Get("Hacks", "DlistCachingEnable", &bDlistCachingEnable,false); iniFile.Get("Hacks", "EFBCopyEnable", &bEFBCopyEnable, true); iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToTexture, true); iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true); iniFile.Get("Hacks", "EFBCopyCacheEnable", &bEFBCopyCacheEnable, false); iniFile.Get("Hacks", "EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, false); iniFile.Get("Hardware", "Adapter", &iAdapter, 0); // Load common settings iniFile.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); bool bTmp; iniFile.Get("Interface", "UsePanicHandlers", &bTmp, true); SetEnableAlert(bTmp); // Shader Debugging causes a huge slowdown and it's easy to forget about it // since it's not exposed in the settings dialog. It's only used by // developers, so displaying an obnoxious message avoids some confusion and // is not too annoying/confusing for users. // // XXX(delroth): This is kind of a bad place to put this, but the current // VideoCommon is a mess and we don't have a central initialization // function to do these kind of checks. Instead, the init code is // triplicated for each video backend. if (bEnableShaderDebugging) OSD::AddMessage("Warning: Shader Debugging is enabled, performance will suffer heavily", 15000); }
void VideoConfig::Load(const std::string& ini_file) { IniFile iniFile; iniFile.Load(ini_file); IniFile::Section* hardware = iniFile.GetOrCreateSection("Hardware"); hardware->Get("VSync", &bVSync, 0); hardware->Get("Adapter", &iAdapter, 0); IniFile::Section* settings = iniFile.GetOrCreateSection("Settings"); settings->Get("wideScreenHack", &bWidescreenHack, false); settings->Get("AspectRatio", &iAspectRatio, (int)ASPECT_AUTO); settings->Get("Crop", &bCrop, false); settings->Get("UseXFB", &bUseXFB, 0); settings->Get("UseRealXFB", &bUseRealXFB, 0); settings->Get("SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples, 128); settings->Get("ShowFPS", &bShowFPS, false); settings->Get("LogRenderTimeToFile", &bLogRenderTimeToFile, false); settings->Get("ShowInputDisplay", &bShowInputDisplay, false); settings->Get("OverlayStats", &bOverlayStats, false); settings->Get("OverlayProjStats", &bOverlayProjStats, false); settings->Get("ShowEFBCopyRegions", &bShowEFBCopyRegions, false); settings->Get("DumpTextures", &bDumpTextures, 0); settings->Get("DumpVertexLoader", &bDumpVertexLoaders, 0); settings->Get("HiresTextures", &bHiresTextures, 0); settings->Get("HiresMaterialMaps", &bHiresMaterialMaps, 0); settings->Get("ConvertHiresTextures", &bConvertHiresTextures, 0); settings->Get("CacheHiresTextures", &bCacheHiresTextures, 0); settings->Get("CacheHiresTexturesonGPU", &bCacheHiresTexturesGPU, 0); settings->Get("DumpEFBTarget", &bDumpEFBTarget, 0); settings->Get("FreeLook", &bFreeLook, 0); settings->Get("UseFFV1", &bUseFFV1, 0); settings->Get("EnablePixelLighting", &bEnablePixelLighting, 0); settings->Get("ForcePhongShading", &bForcePhongShading, 0); settings->Get("FastDepthCalc", &bFastDepthCalc, true); settings->Get("MSAA", &iMultisampleMode, 0); settings->Get("EFBScale", &iEFBScale, (int)SCALE_1X); // native settings->Get("TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0); settings->Get("TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0); settings->Get("WireFrame", &bWireFrame, 0); settings->Get("DisableFog", &bDisableFog, 0); settings->Get("SSAA", &bSSAA, false); settings->Get("EnableOpenCL", &bEnableOpenCL, false); settings->Get("EnableShaderDebugging", &bEnableShaderDebugging, false); settings->Get("BorderlessFullscreen", &bBorderlessFullscreen, false); IniFile::Section* enhancements = iniFile.GetOrCreateSection("Enhancements"); enhancements->Get("ForceFiltering", &bForceFiltering, 0); enhancements->Get("MaxAnisotropy", &iMaxAnisotropy, 0); // NOTE - this is x in (1 << x) enhancements->Get("PostProcessingShader", &sPostProcessingShader, ""); enhancements->Get("StereoMode", &iStereoMode, 0); enhancements->Get("StereoDepth", &iStereoDepth, 20); enhancements->Get("StereoConvergence", &iStereoConvergence, 20); enhancements->Get("StereoSwapEyes", &bStereoSwapEyes, false); enhancements->Get("UseScalingFilter", &bUseScalingFilter, false); enhancements->Get("TextureScalingType", &iTexScalingType, 0); enhancements->Get("TextureScalingFactor", &iTexScalingFactor, 2); enhancements->Get("UseDePosterize", &bTexDeposterize, false); //currently these settings are not saved in global config, so we could've initialized them directly for (size_t i = 0; i < oStereoPresets.size(); ++i) { enhancements->Get(StringFromFormat("StereoConvergence_%zu", i), &oStereoPresets[i].depth, iStereoConvergence); enhancements->Get(StringFromFormat("StereoDepth_%zu", i), &oStereoPresets[i].convergence, iStereoDepth); } enhancements->Get("StereoActivePreset", &iStereoActivePreset, 0); iStereoConvergence = oStereoPresets[iStereoActivePreset].convergence; iStereoDepth = oStereoPresets[iStereoActivePreset].depth; IniFile::Section* hacks = iniFile.GetOrCreateSection("Hacks"); hacks->Get("EFBAccessEnable", &bEFBAccessEnable, true); hacks->Get("EFBFastAccess", &bEFBFastAccess, false); hacks->Get("ForceProgressive", &bForceProgressive, true); hacks->Get("EFBToTextureEnable", &bSkipEFBCopyToRam, true); hacks->Get("EFBScaledCopy", &bCopyEFBScaled, true); hacks->Get("EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, false); hacks->Get("ForceDualSourceBlend", &bForceDualSourceBlend, false); hacks->Get("FullAsyncShaderCompilation", &bFullAsyncShaderCompilation, false); hacks->Get("WaitForShaderCompilation", &bWaitForShaderCompilation, false); hacks->Get("PredictiveFifo", &bPredictiveFifo, false); hacks->Get("BoundingBoxMode", &iBBoxMode, (int)BBoxMode::BBoxGPU); // hacks which are disabled by default iPhackvalue[0] = 0; bPerfQueriesEnable = false; // Load common settings iniFile.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); IniFile::Section* interface = iniFile.GetOrCreateSection("Interface"); bool bTmp; interface->Get("UsePanicHandlers", &bTmp, true); SetEnableAlert(bTmp); // Shader Debugging causes a huge slowdown and it's easy to forget about it // since it's not exposed in the settings dialog. It's only used by // developers, so displaying an obnoxious message avoids some confusion and // is not too annoying/confusing for users. // // XXX(delroth): This is kind of a bad place to put this, but the current // VideoCommon is a mess and we don't have a central initialization // function to do these kind of checks. Instead, the init code is // triplicated for each video backend. if (bEnableShaderDebugging) OSD::AddMessage("Warning: Shader Debugging is enabled, performance will suffer heavily", 15000); VerifyValidity(); }