VolumeDirectory: allow loading of arbitrary apploader and dol. Code cleaning around the bootup logic.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4668 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-12-10 09:16:10 +00:00
parent d4e35a1a97
commit 805bd8ec28
13 changed files with 268 additions and 114 deletions

View File

@ -160,7 +160,6 @@ bool CBoot::Load_BS2(const std::string& _rBootROMFilename)
// Third boot step after BootManager and Core. See Call schedule in BootManager.cpp
bool CBoot::BootUp()
{
const bool bDebugIsoBootup = false;
SCoreStartupParameter& _StartupPara =
SConfig::GetInstance().m_LocalCoreStartupParameter;
@ -195,30 +194,17 @@ bool CBoot::BootUp()
DVDInterface::SetDiscInside(VolumeHandler::IsValid());
_StartupPara.bWii = VolumeHandler::IsWii();
// HLE BS2 or not
if (_StartupPara.bHLE_BS2)
{
if (!VolumeHandler::IsWii())
EmulatedBS2(bDebugIsoBootup);
else
{
_StartupPara.bWii = true;
EmulatedBS2_Wii(bDebugIsoBootup);
}
EmulatedBS2(_StartupPara.bWii);
}
else
else if (!Load_BS2(_StartupPara.m_strBootROM))
{
// If we can't load the bootrom file we HLE it instead
if (!Load_BS2(_StartupPara.m_strBootROM))
{
if (!VolumeHandler::IsWii())
EmulatedBS2(bDebugIsoBootup);
else
{
_StartupPara.bWii = true;
EmulatedBS2_Wii(bDebugIsoBootup);
}
}
EmulatedBS2(_StartupPara.bWii);
}
/* Try to load the symbol map if there is one, and then scan it for
@ -240,32 +226,37 @@ bool CBoot::BootUp()
if (dolWii != _StartupPara.bWii)
{
PanicAlert("Warning - starting DOL in wrong console mode!");
}
}
// stop apploader from running when the BS2 HLE funcs run
VolumeHandler::SetVolumeName("");
bool BS2Success = false;
if (dolWii)
{
EmulatedBS2_Wii(false);
BS2Success = EmulatedBS2(dolWii);
}
else
else if (!VolumeHandler::IsWii() && !_StartupPara.m_strDefaultGCM.empty())
{
if (!VolumeHandler::IsWii() && !_StartupPara.m_strDefaultGCM.empty())
{
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM.c_str());
EmulatedBS2(false);
}
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM.c_str());
BS2Success = EmulatedBS2(dolWii);
}
if (!_StartupPara.m_strDVDRoot.empty())
{
NOTICE_LOG(BOOT, "Setting DVDRoot %s", _StartupPara.m_strDVDRoot.c_str());
VolumeHandler::SetVolumeDirectory(_StartupPara.m_strDVDRoot, dolWii, _StartupPara.m_strApploader, _StartupPara.m_strFilename);
BS2Success = EmulatedBS2(dolWii);
}
DVDInterface::SetDiscInside(VolumeHandler::IsValid());
CDolLoader dolLoader(_StartupPara.m_strFilename.c_str());
PC = dolLoader.GetEntryPoint();
#ifdef _DEBUG
if (!BS2Success)
{
CDolLoader dolLoader(_StartupPara.m_strFilename.c_str());
PC = dolLoader.GetEntryPoint();
}
if (LoadMapFromFilename(_StartupPara.m_strFilename))
HLE::PatchFunctions();
#endif
}
break;
@ -285,28 +276,26 @@ bool CBoot::BootUp()
if (elfWii != _StartupPara.bWii)
{
PanicAlert("Warning - starting ELF in wrong console mode!");
}
}
// stop apploader from running when the BS2 HLE funcs run
VolumeHandler::SetVolumeName("");
bool BS2Success = false;
if (elfWii)
{
EmulatedBS2_Wii(false);
BS2Success = EmulatedBS2(elfWii);
}
else
else if (!VolumeHandler::IsWii() && !_StartupPara.m_strDefaultGCM.empty())
{
if (!VolumeHandler::IsWii() && !_StartupPara.m_strDefaultGCM.empty())
{
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM.c_str());
EmulatedBS2(false);
}
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM.c_str());
BS2Success = EmulatedBS2(elfWii);
}
// load image or create virtual drive from directory
if (!_StartupPara.m_strDVDRoot.empty()) {
NOTICE_LOG(BOOT, "Setting DVDroot %s", _StartupPara.m_strDefaultGCM.c_str());
NOTICE_LOG(BOOT, "Setting DVDRoot %s", _StartupPara.m_strDVDRoot.c_str());
// TODO: auto-convert elf to dol, so we can load them :)
VolumeHandler::SetVolumeDirectory(_StartupPara.m_strDVDRoot, elfWii);
BS2Success = EmulatedBS2(elfWii);
}
else if (!_StartupPara.m_strDefaultGCM.empty()) {
NOTICE_LOG(BOOT, "Loading default ISO %s", _StartupPara.m_strDefaultGCM.c_str());
@ -317,14 +306,17 @@ bool CBoot::BootUp()
DVDInterface::SetDiscInside(VolumeHandler::IsValid());
Load_FST(elfWii);
Boot_ELF(_StartupPara.m_strFilename.c_str());
if (BS2Success)
{
HLE::PatchFunctions();
}
else // Poor man's bootup
{
Load_FST(elfWii);
Boot_ELF(_StartupPara.m_strFilename.c_str());
}
UpdateDebugger_MapLoaded();
Dolphin_Debugger::AddAutoBreakpoints();
HLE::PatchFunctions();
}
break;

View File

@ -44,8 +44,9 @@ private:
static bool Boot_ELF(const char *filename);
static bool Boot_WiiWAD(const char *filename);
static void EmulatedBS2(bool _bDebug);
static bool EmulatedBS2_Wii(bool _bDebug);
static bool EmulatedBS2_GC();
static bool EmulatedBS2_Wii();
static bool EmulatedBS2(bool _bIsWii);
static bool Load_BS2(const std::string& _rBootROMFilename);
static void Load_FST(bool _bIsWii);

View File

@ -47,7 +47,7 @@ void CBoot::RunFunction(u32 _iAddr)
// GameCube Bootstrap 2 HLE:
// copy the apploader to 0x81200000
// execute the apploader, function by function, using the above utility.
void CBoot::EmulatedBS2(bool _bDebug)
bool CBoot::EmulatedBS2_GC()
{
INFO_LOG(BOOT, "Faking GC BS2...");
@ -87,10 +87,13 @@ void CBoot::EmulatedBS2(bool _bDebug)
// Load Apploader to Memory - The apploader is hardcoded to begin at 0x2440 on the disc,
// but the size can differ between discs. Compare with yagcd chap 13.
u32 iAppLoaderOffset = 0x2440;
u32 iAppLoaderEntry = VolumeHandler::Read32(iAppLoaderOffset + 0x10);
u32 iAppLoaderSize = VolumeHandler::Read32(iAppLoaderOffset + 0x14);
u32 iAppLoaderEntry = VolumeHandler::Read32(iAppLoaderOffset + 0x10);
u32 iAppLoaderSize = VolumeHandler::Read32(iAppLoaderOffset + 0x14) + VolumeHandler::Read32(iAppLoaderOffset + 0x18);
if ((iAppLoaderEntry == (u32)-1) || (iAppLoaderSize == (u32)-1))
return;
{
INFO_LOG(BOOT, "GC BS2: Not running apploader!");
return false;
}
VolumeHandler::ReadToPtr(Memory::GetPointer(0x81200000), iAppLoaderOffset + 0x20, iAppLoaderSize);
// Setup pointers like real BS2 does
@ -161,6 +164,8 @@ void CBoot::EmulatedBS2(bool _bDebug)
// If we have any patches that need to be applied very early, here's a good place
PatchEngine::ApplyFramePatches();
return true;
}
@ -287,7 +292,7 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode)
// Wii Bootstrap 2 HLE:
// copy the apploader to 0x81200000
// execute the apploader
bool CBoot::EmulatedBS2_Wii(bool _bDebug)
bool CBoot::EmulatedBS2_Wii()
{
INFO_LOG(BOOT, "Faking Wii BS2...");
@ -391,3 +396,8 @@ bool CBoot::EmulatedBS2_Wii(bool _bDebug)
return true;
}
bool CBoot::EmulatedBS2(bool _bIsWii)
{
return _bIsWii ? EmulatedBS2_Wii() : EmulatedBS2_GC();
}

View File

@ -102,6 +102,7 @@ void SConfig::SaveSettings()
ini.Set("Core", "LockThreads", m_LocalCoreStartupParameter.bLockThreads);
ini.Set("Core", "DefaultGCM", m_LocalCoreStartupParameter.m_strDefaultGCM);
ini.Set("Core", "DVDRoot", m_LocalCoreStartupParameter.m_strDVDRoot);
ini.Set("Core", "Apploader", m_LocalCoreStartupParameter.m_strApploader);
ini.Set("Core", "OptimizeQuantizers", m_LocalCoreStartupParameter.bOptimizeQuantizers);
ini.Set("Core", "EnableCheats", m_LocalCoreStartupParameter.bEnableCheats);
ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage);
@ -213,6 +214,7 @@ void SConfig::LoadSettings()
ini.Get("Core", "LockThreads", &m_LocalCoreStartupParameter.bLockThreads, false);
ini.Get("Core", "DefaultGCM", &m_LocalCoreStartupParameter.m_strDefaultGCM);
ini.Get("Core", "DVDRoot", &m_LocalCoreStartupParameter.m_strDVDRoot);
ini.Get("Core", "Apploader", &m_LocalCoreStartupParameter.m_strApploader);
ini.Get("Core", "OptimizeQuantizers", &m_LocalCoreStartupParameter.bOptimizeQuantizers, true);
ini.Get("Core", "EnableCheats", &m_LocalCoreStartupParameter.bEnableCheats, false);
ini.Get("Core", "SelectedLanguage", &m_LocalCoreStartupParameter.SelectedLanguage, 0);

View File

@ -110,6 +110,7 @@ struct SCoreStartupParameter
std::string m_strSRAM;
std::string m_strDefaultGCM;
std::string m_strDVDRoot;
std::string m_strApploader;
std::string m_strUniqueID;
std::string m_strName;
std::string m_strGameIni;

View File

@ -53,7 +53,7 @@ bool SetVolumeName(const std::string& _rFullPath)
return g_pVolume != NULL;
}
void SetVolumeDirectory(const std::string& _rFullPath, bool _bIsWii)
void SetVolumeDirectory(const std::string& _rFullPath, bool _bIsWii, const std::string& _rApploader, const std::string& _rDOL)
{
if (g_pVolume)
{
@ -61,7 +61,7 @@ void SetVolumeDirectory(const std::string& _rFullPath, bool _bIsWii)
g_pVolume = NULL;
}
g_pVolume = DiscIO::CreateVolumeFromDirectory(_rFullPath, _bIsWii);
g_pVolume = DiscIO::CreateVolumeFromDirectory(_rFullPath, _bIsWii, _rApploader, _rDOL);
}
u32 Read32(u64 _Offset)

View File

@ -29,7 +29,7 @@ namespace VolumeHandler
{
bool SetVolumeName(const std::string& _rFullPath);
void SetVolumeDirectory(const std::string& _rFullPath, bool _bIsWii);
void SetVolumeDirectory(const std::string& _rFullPath, bool _bIsWii, const std::string& _rApploader = "", const std::string& _rDOL = "");
u32 Read32(u64 _Offset);
bool ReadToPtr(u8* ptr, u64 _dwOffset, u64 _dwLength);

View File

@ -111,10 +111,10 @@ IVolume* CreateVolumeFromFilename(const std::string& _rFilename, u32 _PartitionG
return NULL;
}
IVolume* CreateVolumeFromDirectory(const std::string& _rDirectory, bool _bIsWii)
IVolume* CreateVolumeFromDirectory(const std::string& _rDirectory, bool _bIsWii, const std::string& _rApploader, const std::string& _rDOL)
{
if (CVolumeDirectory::IsValidDirectory(_rDirectory))
return new CVolumeDirectory(_rDirectory, _bIsWii);
return new CVolumeDirectory(_rDirectory, _bIsWii, _rApploader, _rDOL);
return NULL;
}

View File

@ -23,7 +23,7 @@
namespace DiscIO
{
IVolume* CreateVolumeFromFilename(const std::string& _rFilename, u32 _PartitionGroup = 0, u32 _VolumeNum = -1);
IVolume* CreateVolumeFromDirectory(const std::string& _rDirectory, bool _bIsWii);
IVolume* CreateVolumeFromDirectory(const std::string& _rDirectory, bool _bIsWii, const std::string& _rApploader = "", const std::string& _rDOL = "");
bool IsVolumeWiiDisc(const IVolume *_rVolume);
bool IsVolumeWadFile(const IVolume *_rVolume);
} // namespace

View File

@ -25,11 +25,20 @@ namespace DiscIO
static const u8 ENTRY_SIZE = 0x0c;
static const u8 FILE_ENTRY = 0;
static const u8 DIRECTORY_ENTRY = 1;
static const u64 FST_ADDRESS = 0x440;
static const u64 DISKHEADER_ADDRESS = 0;
static const u64 DISKHEADERINFO_ADDRESS = 0x440;
static const u64 APPLOADER_ADDRESS = 0x2440;
static const u32 MAX_NAME_LENGTH = 0x3df;
// relocatable
static u64 FST_ADDRESS = 0x440;
static u64 DOL_ADDRESS = 0;
CVolumeDirectory::CVolumeDirectory(const std::string& _rDirectory, bool _bIsWii)
: m_totalNameSize(0)
CVolumeDirectory::CVolumeDirectory(const std::string& _rDirectory, bool _bIsWii, const std::string& _rApploader, const std::string& _rDOL)
: m_apploaderSize(0)
, m_apploader(NULL)
, m_DOLSize(0)
, m_DOL(NULL)
, m_totalNameSize(0)
, m_dataStartAddress(-1)
, m_fstSize(0)
, m_FSTData(NULL)
@ -51,16 +60,31 @@ CVolumeDirectory::CVolumeDirectory(const std::string& _rDirectory, bool _bIsWii)
SetDiskTypeGC();
}
m_diskHeaderInfo = new SDiskHeaderInfo();
// Don't load the dol if we've no apploader...
if (SetApploader(_rApploader))
SetDOL(_rDOL);
BuildFST();
}
CVolumeDirectory::~CVolumeDirectory()
{
delete m_FSTData;
delete[] m_FSTData;
m_FSTData = NULL;
delete m_diskHeader;
delete[] m_diskHeader;
m_diskHeader = NULL;
delete m_diskHeaderInfo;
m_diskHeaderInfo = NULL;
delete[] m_DOL;
m_DOL = NULL;
delete[] m_apploader;
m_apploader = NULL;
}
bool CVolumeDirectory::IsValidDirectory(const std::string& _rDirectory)
@ -76,14 +100,35 @@ bool CVolumeDirectory::RAWRead( u64 _Offset, u64 _Length, u8* _pBuffer ) const
bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
{
if(_Offset < FST_ADDRESS)
// header
if(_Offset < DISKHEADERINFO_ADDRESS)
{
WriteToBuffer(0, FST_ADDRESS, m_diskHeader, _Offset, _Length, _pBuffer);
WriteToBuffer(DISKHEADER_ADDRESS, DISKHEADERINFO_ADDRESS, m_diskHeader, _Offset, _Length, _pBuffer);
return true;
}
// header info
if(_Offset < APPLOADER_ADDRESS)
{
WriteToBuffer(DISKHEADERINFO_ADDRESS, sizeof(m_diskHeaderInfo), (u8*)m_diskHeaderInfo, _Offset, _Length, _pBuffer);
return true;
}
// apploader
if(_Offset >= APPLOADER_ADDRESS && _Offset <= APPLOADER_ADDRESS + m_apploaderSize)
{
WriteToBuffer(APPLOADER_ADDRESS, m_apploaderSize, m_apploader, _Offset, _Length, _pBuffer);
return true;
}
// dol
if(_Offset >= DOL_ADDRESS && _Offset <= DOL_ADDRESS + m_DOLSize)
{
WriteToBuffer(DOL_ADDRESS, m_DOLSize, m_DOL, _Offset, _Length, _pBuffer);
return true;
}
// fst
if(_Offset < m_dataStartAddress)
{
WriteToBuffer(FST_ADDRESS, m_fstSize, m_FSTData, _Offset, _Length, _pBuffer);
WriteToBuffer(FST_ADDRESS, m_fstSize, m_FSTData, _Offset, _Length, _pBuffer);
return true;
}
if(m_virtualDisk.size() == 0)
@ -257,6 +302,52 @@ void CVolumeDirectory::SetDiskTypeGC()
m_addressShift = 0;
}
bool CVolumeDirectory::SetApploader(const std::string& _rApploader)
{
if (!_rApploader.empty())
{
std::string data;
File::ReadFileToString(false, _rApploader.c_str(), data);
m_apploaderSize = 0x20 + Common::swap32(*(u32*)&data.data()[0x14]) + Common::swap32(*(u32*)&data.data()[0x18]);
if (m_apploaderSize != data.size())
{
PanicAlert("Apploader is the wrong size...is it really an apploader?");
return false;
}
m_apploader = new u8[m_apploaderSize];
copy(data.begin(), data.end(), m_apploader);
// 32byte aligned (plus 0x20 padding)
DOL_ADDRESS = (APPLOADER_ADDRESS + m_apploaderSize + 0x20 + 31) & ~31ULL;
return true;
}
else
{
m_apploaderSize = 0x20;
m_apploader = new u8[m_apploaderSize];
// Make sure BS2 HLE doesn't try to run the apploader
*(u32*)&m_apploader[0x10] = (u32)-1;
return false;
}
}
void CVolumeDirectory::SetDOL(const std::string& _rDOL)
{
if (!_rDOL.empty())
{
std::string data;
File::ReadFileToString(false, _rDOL.c_str(), data);
m_DOLSize = data.size();
m_DOL = new u8[m_DOLSize];
copy(data.begin(), data.end(), m_DOL);
Write32((u32)(DOL_ADDRESS >> m_addressShift), 0x0420, m_diskHeader);
// 32byte aligned (plus 0x20 padding)
FST_ADDRESS = (DOL_ADDRESS + m_DOLSize + 0x20 + 31) & ~31ULL;
}
}
void CVolumeDirectory::BuildFST()
{
if(m_FSTData)

View File

@ -33,75 +33,114 @@ namespace DiscIO
class CVolumeDirectory : public IVolume
{
public:
public:
CVolumeDirectory(const std::string& _rDirectory, bool _bIsWii);
CVolumeDirectory(const std::string& _rDirectory, bool _bIsWii,
const std::string& _rApploader = "", const std::string& _rDOL = "");
~CVolumeDirectory();
~CVolumeDirectory();
static bool IsValidDirectory(const std::string& _rDirectory);
static bool IsValidDirectory(const std::string& _rDirectory);
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const;
bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const;
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const;
bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const;
std::string GetUniqueID() const;
void SetUniqueID(std::string _ID);
std::string GetUniqueID() const;
void SetUniqueID(std::string _ID);
std::string GetMakerID() const;
std::string GetMakerID() const;
std::string GetName() const;
void SetName(std::string);
std::string GetName() const;
void SetName(std::string);
u32 GetFSTSize() const;
u32 GetFSTSize() const;
std::string GetApploaderDate() const;
std::string GetApploaderDate() const;
ECountry GetCountry() const;
ECountry GetCountry() const;
u64 GetSize() const;
u64 GetSize() const;
void BuildFST();
void BuildFST();
private:
static std::string ExtractDirectoryName(const std::string& _rDirectory);
private:
static std::string ExtractDirectoryName(const std::string& _rDirectory);
void SetDiskTypeWii();
void SetDiskTypeGC();
void SetDiskTypeWii();
void SetDiskTypeGC();
// writing to read buffer
void WriteToBuffer(u64 _SrcStartAddress, u64 _SrcLength, u8* _Src,
u64& _Address, u64& _Length, u8*& _pBuffer) const;
bool SetApploader(const std::string& _rApploader);
void PadToAddress(u64 _StartAddress, u64& _Address, u64& _Length, u8*& _pBuffer) const;
void SetDOL(const std::string& _rDOL);
void Write32(u32 data, u32 offset, u8* buffer);
// writing to read buffer
void WriteToBuffer(u64 _SrcStartAddress, u64 _SrcLength, u8* _Src,
u64& _Address, u64& _Length, u8*& _pBuffer) const;
// FST creation
void WriteEntryData(u32& entryOffset, u8 type, u32 nameOffset, u64 dataOffset, u32 length);
void WriteEntryName(u32& nameOffset, const std::string& name);
void WriteEntry(const File::FSTEntry& entry, u32& fstOffset, u32& nameOffset, u64& dataOffset, u32 parentEntryNum);
void PadToAddress(u64 _StartAddress, u64& _Address, u64& _Length, u8*& _pBuffer) const;
// returns number of entries found in _Directory
u32 AddDirectoryEntries(const std::string& _Directory, File::FSTEntry& parentEntry);
void Write32(u32 data, u32 offset, u8* buffer);
std::string m_rootDirectory;
// FST creation
void WriteEntryData(u32& entryOffset, u8 type, u32 nameOffset, u64 dataOffset, u32 length);
void WriteEntryName(u32& nameOffset, const std::string& name);
void WriteEntry(const File::FSTEntry& entry, u32& fstOffset, u32& nameOffset, u64& dataOffset, u32 parentEntryNum);
std::map<u64, std::string> m_virtualDisk;
// returns number of entries found in _Directory
u32 AddDirectoryEntries(const std::string& _Directory, File::FSTEntry& parentEntry);
u32 m_totalNameSize;
std::string m_rootDirectory;
// gc has no shift, wii has 2 bit shift
u32 m_addressShift;
std::map<u64, std::string> m_virtualDisk;
// first address on disk containing file data
u64 m_dataStartAddress;
u32 m_totalNameSize;
u64 m_fstNameOffset;
// gc has no shift, wii has 2 bit shift
u32 m_addressShift;
u64 m_fstSize;
// first address on disk containing file data
u64 m_dataStartAddress;
u8* m_FSTData;
u8* m_diskHeader;
u64 m_fstNameOffset;
u64 m_fstSize;
u8* m_FSTData;
u8* m_diskHeader;
#pragma pack(push, 1)
struct SDiskHeaderInfo
{
u32 debug_mntr_size;
u32 simulated_mem_size;
u32 arg_offset;
u32 debug_flag;
u32 track_location;
u32 track_size;
u32 countrycode;
u32 unknown;
u32 unknown2;
// All the data is byteswapped
SDiskHeaderInfo() {
debug_mntr_size = 0;
simulated_mem_size = 0;
arg_offset = 0;
debug_flag = 0;
track_location = 0;
track_size = 0;
countrycode = 0;
unknown = 0;
unknown2 = 0;
}
};
#pragma pack(pop)
SDiskHeaderInfo* m_diskHeaderInfo;
u64 m_apploaderSize;
u8* m_apploader;
u64 m_DOLSize;
u8* m_DOL;
};
} // namespace

View File

@ -95,6 +95,7 @@ EVT_BUTTON(ID_REMOVEISOPATH, CConfigMain::AddRemoveISOPaths)
EVT_CHECKBOX(ID_RECERSIVEISOPATH, CConfigMain::RecursiveDirectoryChanged)
EVT_FILEPICKER_CHANGED(ID_DEFAULTISO, CConfigMain::DefaultISOChanged)
EVT_DIRPICKER_CHANGED(ID_DVDROOT, CConfigMain::DVDRootChanged)
EVT_FILEPICKER_CHANGED(ID_APPLOADERPATH, CConfigMain::ApploaderPathChanged)
EVT_CHOICE(ID_GRAPHIC_CB, CConfigMain::OnSelectionChanged)
EVT_BUTTON(ID_GRAPHIC_CONFIG, CConfigMain::OnConfig)
@ -525,6 +526,11 @@ void CConfigMain::CreateGUIControls()
DVDRootText = new wxStaticText(PathsPage, ID_DVDROOT_TEXT, wxT("DVD Root:"), wxDefaultPosition, wxDefaultSize);
DVDRoot = new wxDirPickerCtrl(PathsPage, ID_DVDROOT, wxEmptyString, wxT("Choose a DVD root directory:"), wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL);
DVDRoot->SetPath(wxString::FromAscii(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDVDRoot.c_str()));
ApploaderPathText = new wxStaticText(PathsPage, ID_APPLOADERPATH_TEXT, wxT("Apploader:"), wxDefaultPosition, wxDefaultSize);
ApploaderPath = new wxFilePickerCtrl(PathsPage, ID_APPLOADERPATH, wxEmptyString, wxT("Choose file to use as apploader: (applies to discs constructed from directories only)"),
wxString::Format(wxT("apploader (.img)|*.img|All files (%s)|%s"), wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr),
wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN);
ApploaderPath->SetPath(wxString::FromAscii(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strApploader.c_str()));
sPaths = new wxBoxSizer(wxVERTICAL);
@ -544,6 +550,8 @@ void CConfigMain::CreateGUIControls()
sOtherPaths->Add(DefaultISO, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sOtherPaths->Add(DVDRootText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sOtherPaths->Add(DVDRoot, wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sOtherPaths->Add(ApploaderPathText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sOtherPaths->Add(ApploaderPath, wxGBPosition(2, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sPaths->Add(sOtherPaths, 0, wxEXPAND|wxALL, 5);
PathsPage->SetSizer(sPaths);
sPaths->Layout();
@ -931,6 +939,11 @@ void CConfigMain::DVDRootChanged(wxFileDirPickerEvent& WXUNUSED (event))
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDVDRoot = DVDRoot->GetPath().mb_str();
}
void CConfigMain::ApploaderPathChanged(wxFileDirPickerEvent& WXUNUSED (event))
{
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strApploader = ApploaderPath->GetPath().mb_str();
}
// Plugin settings
void CConfigMain::OnSelectionChanged(wxCommandEvent& WXUNUSED (event))

View File

@ -131,6 +131,8 @@ private:
wxFilePickerCtrl* DefaultISO;
wxStaticText* DVDRootText;
wxDirPickerCtrl* DVDRoot;
wxStaticText* ApploaderPathText;
wxFilePickerCtrl* ApploaderPath;
wxStaticText* PADText;
wxButton* PADConfig;
@ -206,6 +208,8 @@ private:
ID_DEFAULTISO,
ID_DVDROOT_TEXT,
ID_DVDROOT,
ID_APPLOADERPATH_TEXT,
ID_APPLOADERPATH,
ID_WIIMOTE_ABOUT,
ID_WIIMOTE_CONFIG,
@ -239,6 +243,7 @@ private:
void AddRemoveISOPaths(wxCommandEvent& event);
void DefaultISOChanged(wxFileDirPickerEvent& event);
void DVDRootChanged(wxFileDirPickerEvent& event);
void ApploaderPathChanged(wxFileDirPickerEvent& WXUNUSED (event));
void FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename);
void CallConfig(wxChoice* _pChoice);