Added auto generation of setting.txt, thanks to Treeki for the base code :D
This commit is contained in:
parent
f2a978e97f
commit
42e8c6c17f
|
@ -26,6 +26,7 @@ set(SRCS Src/ActionReplay.cpp
|
||||||
Src/Boot/Boot_ELF.cpp
|
Src/Boot/Boot_ELF.cpp
|
||||||
Src/Boot/Boot_WiiWAD.cpp
|
Src/Boot/Boot_WiiWAD.cpp
|
||||||
Src/Boot/ElfReader.cpp
|
Src/Boot/ElfReader.cpp
|
||||||
|
Src/Boot/SettingsGenerator.cpp
|
||||||
Src/Debugger/Debugger_SymbolMap.cpp
|
Src/Debugger/Debugger_SymbolMap.cpp
|
||||||
Src/Debugger/Dump.cpp
|
Src/Debugger/Dump.cpp
|
||||||
Src/Debugger/PPCDebugInterface.cpp
|
Src/Debugger/PPCDebugInterface.cpp
|
||||||
|
|
|
@ -203,6 +203,7 @@
|
||||||
<ClCompile Include="Src\Boot\Boot_ELF.cpp" />
|
<ClCompile Include="Src\Boot\Boot_ELF.cpp" />
|
||||||
<ClCompile Include="Src\Boot\Boot_WiiWAD.cpp" />
|
<ClCompile Include="Src\Boot\Boot_WiiWAD.cpp" />
|
||||||
<ClCompile Include="Src\Boot\ElfReader.cpp" />
|
<ClCompile Include="Src\Boot\ElfReader.cpp" />
|
||||||
|
<ClCompile Include="Src\Boot\SettingsGenerator.cpp" />
|
||||||
<ClCompile Include="Src\ConfigManager.cpp" />
|
<ClCompile Include="Src\ConfigManager.cpp" />
|
||||||
<ClCompile Include="Src\Console.cpp" />
|
<ClCompile Include="Src\Console.cpp" />
|
||||||
<ClCompile Include="Src\Core.cpp" />
|
<ClCompile Include="Src\Core.cpp" />
|
||||||
|
@ -407,6 +408,7 @@
|
||||||
<ClInclude Include="Src\Boot\Boot_ELF.h" />
|
<ClInclude Include="Src\Boot\Boot_ELF.h" />
|
||||||
<ClInclude Include="Src\Boot\ElfReader.h" />
|
<ClInclude Include="Src\Boot\ElfReader.h" />
|
||||||
<ClInclude Include="Src\Boot\ElfTypes.h" />
|
<ClInclude Include="Src\Boot\ElfTypes.h" />
|
||||||
|
<ClInclude Include="Src\Boot\SettingsGenerator.h" />
|
||||||
<ClInclude Include="Src\ConfigManager.h" />
|
<ClInclude Include="Src\ConfigManager.h" />
|
||||||
<ClInclude Include="Src\Console.h" />
|
<ClInclude Include="Src\Console.h" />
|
||||||
<ClInclude Include="Src\Core.h" />
|
<ClInclude Include="Src\Core.h" />
|
||||||
|
|
|
@ -559,6 +559,9 @@
|
||||||
<ClCompile Include="Src\HW\GCMemcard.cpp">
|
<ClCompile Include="Src\HW\GCMemcard.cpp">
|
||||||
<Filter>HW %28Flipper/Hollywood%29\GCMemcard</Filter>
|
<Filter>HW %28Flipper/Hollywood%29\GCMemcard</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Src\Boot\SettingsGenerator.cpp">
|
||||||
|
<Filter>Boot</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="Src\ConfigManager.h" />
|
<ClInclude Include="Src\ConfigManager.h" />
|
||||||
|
@ -1042,6 +1045,9 @@
|
||||||
<ClInclude Include="Src\IPC_HLE\fakepoll.h">
|
<ClInclude Include="Src\IPC_HLE\fakepoll.h">
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Src\Boot\SettingsGenerator.h">
|
||||||
|
<Filter>Boot</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="CMakeLists.txt" />
|
<None Include="CMakeLists.txt" />
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "VolumeCreator.h"
|
#include "VolumeCreator.h"
|
||||||
#include "Boot.h"
|
#include "Boot.h"
|
||||||
#include "HLE/HLE.h"
|
#include "HLE/HLE.h"
|
||||||
|
#include "SettingsGenerator.h"
|
||||||
|
|
||||||
void CBoot::RunFunction(u32 _iAddr)
|
void CBoot::RunFunction(u32 _iAddr)
|
||||||
{
|
{
|
||||||
|
@ -181,8 +182,9 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode)
|
||||||
// \title\00000001\00000002\data\setting.txt directly after the read the
|
// \title\00000001\00000002\data\setting.txt directly after the read the
|
||||||
// SYSCONF file. The games also read it to 0x3800, what is a little strange
|
// SYSCONF file. The games also read it to 0x3800, what is a little strange
|
||||||
// however is that it only reads the first 100 bytes of it.
|
// however is that it only reads the first 100 bytes of it.
|
||||||
std::string region_filename,
|
std::string settings_Filename(Common::GetTitleDataPath(TITLEID_SYSMENU) + WII_SETTING);
|
||||||
settings_Filename(Common::GetTitleDataPath(TITLEID_SYSMENU) + WII_SETTING);
|
std::string area, model, code, video, game;
|
||||||
|
|
||||||
|
|
||||||
switch((DiscIO::IVolume::ECountry)_CountryCode)
|
switch((DiscIO::IVolume::ECountry)_CountryCode)
|
||||||
{
|
{
|
||||||
|
@ -190,38 +192,57 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode)
|
||||||
case DiscIO::IVolume::COUNTRY_TAIWAN:
|
case DiscIO::IVolume::COUNTRY_TAIWAN:
|
||||||
// TODO: Determine if Korea / Taiwan have their own specific settings.
|
// TODO: Determine if Korea / Taiwan have their own specific settings.
|
||||||
case DiscIO::IVolume::COUNTRY_JAPAN:
|
case DiscIO::IVolume::COUNTRY_JAPAN:
|
||||||
region_filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_JAP_SETTING;
|
area = "JPN";
|
||||||
|
video = "NTSC";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DiscIO::IVolume::COUNTRY_USA:
|
case DiscIO::IVolume::COUNTRY_USA:
|
||||||
region_filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_USA_SETTING;
|
area = "USA";
|
||||||
|
video = "NTSC";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DiscIO::IVolume::COUNTRY_EUROPE:
|
case DiscIO::IVolume::COUNTRY_EUROPE:
|
||||||
region_filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_EUR_SETTING;
|
area = "EUR";
|
||||||
|
video = "PAL";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// PanicAlertT("SetupWiiMem: Unknown country. Wii boot process will be switched to European settings.");
|
// PanicAlertT("SetupWiiMem: Unknown country. Wii boot process will be switched to European settings.");
|
||||||
region_filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_EUR_SETTING;
|
area = "EUR";
|
||||||
|
video = "PAL";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
model = "RVL-001(" + area + ")";
|
||||||
|
code = "L" + area.substr(0,1);
|
||||||
|
game = area.substr(0,2);
|
||||||
|
|
||||||
|
SettingsGenerator gen;
|
||||||
|
gen.AddSetting("AREA", area.c_str());
|
||||||
|
gen.AddSetting("MODEL", model.c_str());
|
||||||
|
gen.AddSetting("DVD", "0");
|
||||||
|
gen.AddSetting("MPCH", "0x7FFE");
|
||||||
|
gen.AddSetting("CODE", code.c_str());
|
||||||
|
gen.AddSetting("SERNO", "000000000");
|
||||||
|
gen.AddSetting("VIDEO", video.c_str());
|
||||||
|
gen.AddSetting("GAME", game.c_str());
|
||||||
|
|
||||||
|
|
||||||
if (File::Exists(settings_Filename))
|
if (File::Exists(settings_Filename))
|
||||||
{
|
{
|
||||||
File::Delete(settings_Filename);
|
File::Delete(settings_Filename);
|
||||||
}
|
}
|
||||||
File::CreateFullPath(settings_Filename);
|
File::CreateFullPath(settings_Filename);
|
||||||
File::Copy(region_filename, settings_Filename);
|
|
||||||
File::IOFile settingsFile(settings_Filename, "rb");
|
|
||||||
if (!settingsFile)
|
|
||||||
{
|
{
|
||||||
PanicAlertT("SetupWiiMem: Cant find setting file");
|
File::IOFile settingsFileHandle(settings_Filename, "wb");
|
||||||
|
|
||||||
|
if (!settingsFileHandle.WriteBytes(gen.GetData(), SETTINGS_SIZE))
|
||||||
|
{
|
||||||
|
PanicAlertT("SetupWiiMem: Cant create setting file");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Memory::WriteBigEData(gen.GetData(), 0x3800, SETTINGS_SIZE);
|
||||||
settingsFile.ReadBytes(Memory::GetPointer(0x3800), 256);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue