diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 7211dd8776..7ac38e3eee 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -1,5 +1,6 @@ set(SRCS Src/ActionReplay.cpp Src/ARDecrypt.cpp + Src/BootManager.cpp Src/ConfigManager.cpp Src/Console.cpp Src/Core.cpp diff --git a/Source/Core/Core/Core.vcxproj b/Source/Core/Core/Core.vcxproj index 9f8a7d97b8..bfb0ec3184 100644 --- a/Source/Core/Core/Core.vcxproj +++ b/Source/Core/Core/Core.vcxproj @@ -198,6 +198,7 @@ + @@ -394,6 +395,7 @@ + diff --git a/Source/Core/Core/Src/Host.h b/Source/Core/Core/Src/Host.h index 029afd2a80..76c6b32f9f 100644 --- a/Source/Core/Core/Src/Host.h +++ b/Source/Core/Core/Src/Host.h @@ -44,6 +44,7 @@ void Host_Message(int Id); void Host_NotifyMapLoaded(); void Host_RefreshDSPDebuggerWindow(); void Host_RequestRenderWindowSize(int width, int height); +void Host_SetStartupDebuggingParameters(); void Host_SetWaitCursor(bool enable); void Host_SetWiiMoteConnectionState(int _State); void Host_ShowJitResults(unsigned int address); @@ -55,4 +56,8 @@ void Host_UpdateMainFrame(); void Host_UpdateStatusBar(const char* _pText, int Filed = 0); void Host_UpdateTitle(const char* title); +// TODO (neobrain): Remove these from host! +void* Host_GetInstance(); +void* Host_GetRenderHandle(); + #endif diff --git a/Source/Core/Core/Src/SConscript b/Source/Core/Core/Src/SConscript index 75cdfc565e..6fe7fd339f 100644 --- a/Source/Core/Core/Src/SConscript +++ b/Source/Core/Core/Src/SConscript @@ -6,6 +6,7 @@ import sys files = [ "ActionReplay.cpp", "ARDecrypt.cpp", + "BootManager.cpp", "ConfigManager.cpp", "Console.cpp", "Core.cpp", diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index 0bdc56829f..49ee511ad3 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -1,5 +1,3 @@ -set(SRCS Src/BootManager.cpp) - set(LIBS core lzo2 discio diff --git a/Source/Core/DolphinWX/Dolphin.vcxproj b/Source/Core/DolphinWX/Dolphin.vcxproj index 349b8c8bfc..4b27dfe11b 100644 --- a/Source/Core/DolphinWX/Dolphin.vcxproj +++ b/Source/Core/DolphinWX/Dolphin.vcxproj @@ -216,7 +216,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e / - @@ -279,7 +278,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e / - diff --git a/Source/Core/DolphinWX/Dolphin.vcxproj.filters b/Source/Core/DolphinWX/Dolphin.vcxproj.filters index 5ae6e302bc..82fd37431a 100644 --- a/Source/Core/DolphinWX/Dolphin.vcxproj.filters +++ b/Source/Core/DolphinWX/Dolphin.vcxproj.filters @@ -78,9 +78,6 @@ GUI - - Misc - Misc @@ -204,9 +201,6 @@ GUI - - Misc - Misc diff --git a/Source/Core/DolphinWX/Src/BootManager.cpp b/Source/Core/DolphinWX/Src/BootManager.cpp deleted file mode 100644 index b18ed8e578..0000000000 --- a/Source/Core/DolphinWX/Src/BootManager.cpp +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (C) 2003 Dolphin Project. - -// 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/ - -// File description -// ------------- -// Purpose of this file: Collect boot settings for Core::Init() - -// Call sequence: This file has one of the first function called when a game is booted, -// the boot sequence in the code is: - -// DolphinWX: GameListCtrl.cpp OnActivated -// BootManager.cpp BootCore -// Core Core.cpp Init Thread creation -// EmuThread Calls CBoot::BootUp -// Boot.cpp CBoot::BootUp() -// CBoot::EmulatedBS2_Wii() / GC() or Load_BS2() - - -// Includes -// ---------------- -#include -#include - -#include "Common.h" -#include "IniFile.h" -#include "BootManager.h" -#include "ISOFile.h" -#include "Volume.h" -#include "VolumeCreator.h" -#include "ConfigManager.h" -#include "SysConf.h" -#include "Core.h" -#if defined(HAVE_WX) && HAVE_WX - #include "Globals.h" - #include "ConfigMain.h" - #include "Frame.h" - #include "CodeWindow.h" - #include "Setup.h" -#endif - - -#if defined(HAVE_WX) && HAVE_WX -extern CFrame* main_frame; -#endif - -namespace BootManager -{ -#ifdef _WIN32 - extern "C" HINSTANCE wxGetInstance(); -#endif - -// TODO this is an ugly hack which allows us to restore values trampled by per-game settings -// Apply fire liberally -struct ConfigCache -{ - bool valid, bCPUThread, bSkipIdle, bEnableFPRF, bMMU, bMMUBAT, - bVBeam, bFastDiscSpeed, bMergeBlocks, bDSPHLE; - int iTLBHack; -}; -static ConfigCache config_cache; - -// Boot the ISO or file -bool BootCore(const std::string& _rFilename) -{ - SCoreStartupParameter& StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter; - - // Use custom settings for debugging mode - #if defined(HAVE_WX) && HAVE_WX - 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(); - } - StartUp.bEnableDebugging = main_frame->g_pCodeWindow ? true : false; // RUNNING_DEBUG - #endif - - StartUp.m_BootType = SCoreStartupParameter::BOOT_ISO; - StartUp.m_strFilename = _rFilename; - SConfig::GetInstance().m_LastFilename = _rFilename; - StartUp.bRunCompareClient = false; - StartUp.bRunCompareServer = false; - - #ifdef _WIN32 - StartUp.hInstance = wxGetInstance(); - #ifdef _M_X64 - StartUp.bUseFastMem = true; - #endif - #endif - - // If for example the ISO file is bad we return here - if (!StartUp.AutoSetup(SCoreStartupParameter::BOOT_DEFAULT)) return false; - - // Load game specific settings - IniFile game_ini; - std::string unique_id = StartUp.GetUniqueID(); - StartUp.m_strGameIni = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + unique_id + ".ini"; - if (unique_id.size() == 6 && game_ini.Load(StartUp.m_strGameIni.c_str())) - { - config_cache.valid = true; - config_cache.bCPUThread = StartUp.bCPUThread; - config_cache.bSkipIdle = StartUp.bSkipIdle; - config_cache.bEnableFPRF = StartUp.bEnableFPRF; - config_cache.bMMU = StartUp.bMMU; - config_cache.bMMUBAT = StartUp.bMMUBAT; - config_cache.iTLBHack = StartUp.iTLBHack; - config_cache.bVBeam = StartUp.bVBeam; - config_cache.bFastDiscSpeed = StartUp.bFastDiscSpeed; - config_cache.bMergeBlocks = StartUp.bMergeBlocks; - config_cache.bDSPHLE = StartUp.bDSPHLE; - - // General settings - game_ini.Get("Core", "CPUThread", &StartUp.bCPUThread, StartUp.bCPUThread); - game_ini.Get("Core", "SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle); - game_ini.Get("Core", "EnableFPRF", &StartUp.bEnableFPRF, StartUp.bEnableFPRF); - game_ini.Get("Core", "MMU", &StartUp.bMMU, StartUp.bMMU); - game_ini.Get("Core", "BAT", &StartUp.bMMUBAT, StartUp.bMMUBAT); - game_ini.Get("Core", "TLBHack", &StartUp.iTLBHack, StartUp.iTLBHack); - game_ini.Get("Core", "VBeam", &StartUp.bVBeam, StartUp.bVBeam); - game_ini.Get("Core", "FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed); - game_ini.Get("Core", "BlockMerging", &StartUp.bMergeBlocks, StartUp.bMergeBlocks); - game_ini.Get("Core", "DSPHLE", &StartUp.bDSPHLE, StartUp.bDSPHLE); - - // Wii settings - if (StartUp.bWii) - { - // Flush possible changes to SYSCONF to file - SConfig::GetInstance().m_SYSCONF->Save(); - } - } - - // Run the game -#if defined(HAVE_WX) && HAVE_WX - if(main_frame) - { - // Save the window handle of the eventual parent to the rendering window - StartUp.hMainWindow = main_frame->GetRenderHandle(); - } -#endif - // Init the core - if (!Core::Init()) - { - PanicAlertT("Couldn't init the core.\nCheck your configuration."); - return false; - } - -#if defined(HAVE_WX) && HAVE_WX - // Boot to pause or not - Core::SetState((main_frame->g_pCodeWindow && StartUp.bBootToPause) ? Core::CORE_PAUSE : Core::CORE_RUN); -#else - Core::SetState(Core::CORE_RUN); -#endif - - return true; -} - -void Stop() -{ - Core::Stop(); - - SCoreStartupParameter& StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter; - - if (config_cache.valid) - { - config_cache.valid = false; - StartUp.bCPUThread = config_cache.bCPUThread; - StartUp.bSkipIdle = config_cache.bSkipIdle; - StartUp.bEnableFPRF = config_cache.bEnableFPRF; - StartUp.bMMU = config_cache.bMMU; - StartUp.bMMUBAT = config_cache.bMMUBAT; - StartUp.iTLBHack = config_cache.iTLBHack; - StartUp.bVBeam = config_cache.bVBeam; - StartUp.bFastDiscSpeed = config_cache.bFastDiscSpeed; - StartUp.bMergeBlocks = config_cache.bMergeBlocks; - StartUp.bDSPHLE = config_cache.bDSPHLE; - } -} - -} // namespace diff --git a/Source/Core/DolphinWX/Src/BootManager.h b/Source/Core/DolphinWX/Src/BootManager.h deleted file mode 100644 index c688dd3994..0000000000 --- a/Source/Core/DolphinWX/Src/BootManager.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2003 Dolphin Project. - -// 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/ - -#ifndef _BOOTMANAGER_H -#define _BOOTMANAGER_H - -#include - -class GameListItem; - -namespace BootManager -{ -bool BootCore(const std::string& _rFilename); - -void Stop(); -}; - -#endif diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 1c5b214df9..6d61931d38 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -492,6 +492,24 @@ void Host_Message(int Id) main_frame->GetEventHandler()->AddPendingEvent(event); } +#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(); +} + // OK, this thread boundary is DANGEROUS on linux // wxPostEvent / wxAddPendingEvent is the solution. void Host_NotifyMapLoaded() @@ -591,6 +609,23 @@ void Host_RequestRenderWindowSize(int width, int height) main_frame->GetEventHandler()->AddPendingEvent(event); } +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 +} + void Host_SetWaitCursor(bool enable) { if (enable) diff --git a/Source/Core/DolphinWX/Src/MainNoGUI.cpp b/Source/Core/DolphinWX/Src/MainNoGUI.cpp index 33c8d1d81d..26879dc305 100644 --- a/Source/Core/DolphinWX/Src/MainNoGUI.cpp +++ b/Source/Core/DolphinWX/Src/MainNoGUI.cpp @@ -64,6 +64,13 @@ void Host_Message(int Id) } } +void* Host_GetRenderHandle() +{ + return NULL; +} + +void* Host_GetInstance() { return NULL; } + void Host_UpdateTitle(const char* title){}; void Host_UpdateLogDisplay(){} @@ -91,6 +98,12 @@ void Host_GetRenderWindowSize(int& x, int& y, int& width, int& height) } void Host_RequestRenderWindowSize(int width, int height) {} +void Host_SetStartupDebuggingParameters() +{ + SCoreStartupParameter& StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter; + StartUp.bEnableDebugging = false; + StartUp.bBootToPause = false; +} bool Host_RendererHasFocus() { diff --git a/Source/Core/DolphinWX/Src/SConscript b/Source/Core/DolphinWX/Src/SConscript index a059030f56..5d4271f70b 100644 --- a/Source/Core/DolphinWX/Src/SConscript +++ b/Source/Core/DolphinWX/Src/SConscript @@ -5,7 +5,6 @@ import os import sys from SconsTests import utils -files = ['BootManager.cpp'] frameworksflags = [] if not env['HAVE_WX']: