Move BootManager.cpp to Core since it really doesn't do any wx-specific stuff.

This one is for NaturalViolence, since he was so eager to see it :P

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7152 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX 2011-02-12 21:25:49 +00:00
parent e81ccd7f33
commit bc6f04adae
12 changed files with 57 additions and 237 deletions

View File

@ -1,5 +1,6 @@
set(SRCS Src/ActionReplay.cpp
Src/ARDecrypt.cpp
Src/BootManager.cpp
Src/ConfigManager.cpp
Src/Console.cpp
Src/Core.cpp

View File

@ -198,6 +198,7 @@
<ItemGroup>
<ClCompile Include="Src\ActionReplay.cpp" />
<ClCompile Include="Src\ARDecrypt.cpp" />
<ClCompile Include="Src\BootManager.cpp" />
<ClCompile Include="Src\Boot\Boot.cpp" />
<ClCompile Include="Src\Boot\Boot_BS2Emu.cpp" />
<ClCompile Include="Src\Boot\Boot_DOL.cpp" />
@ -394,6 +395,7 @@
<ItemGroup>
<ClInclude Include="Src\ActionReplay.h" />
<ClInclude Include="Src\ARDecrypt.h" />
<ClInclude Include="Src\BootManager.h" />
<ClInclude Include="Src\Boot\Boot.h" />
<ClInclude Include="Src\Boot\Boot_DOL.h" />
<ClInclude Include="Src\Boot\Boot_ELF.h" />

View File

@ -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

View File

@ -6,6 +6,7 @@ import sys
files = [
"ActionReplay.cpp",
"ARDecrypt.cpp",
"BootManager.cpp",
"ConfigManager.cpp",
"Console.cpp",
"Core.cpp",

View File

@ -1,5 +1,3 @@
set(SRCS Src/BootManager.cpp)
set(LIBS core
lzo2
discio

View File

@ -216,7 +216,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
<ItemGroup>
<ClCompile Include="Src\AboutDolphin.cpp" />
<ClCompile Include="Src\ARCodeAddEdit.cpp" />
<ClCompile Include="Src\BootManager.cpp" />
<ClCompile Include="Src\BreakpointDlg.cpp" />
<ClCompile Include="Src\BreakpointView.cpp" />
<ClCompile Include="Src\BreakpointWindow.cpp" />
@ -279,7 +278,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
<ClInclude Include="resource.h" />
<ClInclude Include="Src\AboutDolphin.h" />
<ClInclude Include="Src\ARCodeAddEdit.h" />
<ClInclude Include="Src\BootManager.h" />
<ClInclude Include="Src\BreakpointDlg.h" />
<ClInclude Include="Src\BreakpointView.h" />
<ClInclude Include="Src\BreakpointWindow.h" />

View File

@ -78,9 +78,6 @@
<ClCompile Include="Src\WiimoteConfigDiag.cpp">
<Filter>GUI</Filter>
</ClCompile>
<ClCompile Include="Src\BootManager.cpp">
<Filter>Misc</Filter>
</ClCompile>
<ClCompile Include="Src\ISOFile.cpp">
<Filter>Misc</Filter>
</ClCompile>
@ -204,9 +201,6 @@
<ClInclude Include="Src\WiimoteConfigDiag.h">
<Filter>GUI</Filter>
</ClInclude>
<ClInclude Include="Src\BootManager.h">
<Filter>Misc</Filter>
</ClInclude>
<ClInclude Include="Src\ISOFile.h">
<Filter>Misc</Filter>
</ClInclude>

View File

@ -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 <string>
#include <vector>
#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

View File

@ -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 <string>
class GameListItem;
namespace BootManager
{
bool BootCore(const std::string& _rFilename);
void Stop();
};
#endif

View File

@ -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)

View File

@ -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()
{

View File

@ -5,7 +5,6 @@ import os
import sys
from SconsTests import utils
files = ['BootManager.cpp']
frameworksflags = []
if not env['HAVE_WX']: