mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-03 20:54:28 +00:00
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_WiiWAD.cpp
|
||||
Src/Boot/ElfReader.cpp
|
||||
Src/Boot/SettingsGenerator.cpp
|
||||
Src/Debugger/Debugger_SymbolMap.cpp
|
||||
Src/Debugger/Dump.cpp
|
||||
Src/Debugger/PPCDebugInterface.cpp
|
||||
|
@ -203,6 +203,7 @@
|
||||
<ClCompile Include="Src\Boot\Boot_ELF.cpp" />
|
||||
<ClCompile Include="Src\Boot\Boot_WiiWAD.cpp" />
|
||||
<ClCompile Include="Src\Boot\ElfReader.cpp" />
|
||||
<ClCompile Include="Src\Boot\SettingsGenerator.cpp" />
|
||||
<ClCompile Include="Src\ConfigManager.cpp" />
|
||||
<ClCompile Include="Src\Console.cpp" />
|
||||
<ClCompile Include="Src\Core.cpp" />
|
||||
@ -407,6 +408,7 @@
|
||||
<ClInclude Include="Src\Boot\Boot_ELF.h" />
|
||||
<ClInclude Include="Src\Boot\ElfReader.h" />
|
||||
<ClInclude Include="Src\Boot\ElfTypes.h" />
|
||||
<ClInclude Include="Src\Boot\SettingsGenerator.h" />
|
||||
<ClInclude Include="Src\ConfigManager.h" />
|
||||
<ClInclude Include="Src\Console.h" />
|
||||
<ClInclude Include="Src\Core.h" />
|
||||
|
@ -559,6 +559,9 @@
|
||||
<ClCompile Include="Src\HW\GCMemcard.cpp">
|
||||
<Filter>HW %28Flipper/Hollywood%29\GCMemcard</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Src\Boot\SettingsGenerator.cpp">
|
||||
<Filter>Boot</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Src\ConfigManager.h" />
|
||||
@ -1033,15 +1036,18 @@
|
||||
<Filter>FifoPlayer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Src\Movie.h" />
|
||||
<ClInclude Include="Src\HW\GCMemcard.h">
|
||||
<Filter>HW %28Flipper/Hollywood%29\GCMemcard</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Src\HW\GCMemcard.h">
|
||||
<Filter>HW %28Flipper/Hollywood%29\GCMemcard</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Src\IPC_HLE\WII_IPC_HLE_Device_net_ssl.h">
|
||||
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Src\IPC_HLE\fakepoll.h">
|
||||
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Src\Boot\SettingsGenerator.h">
|
||||
<Filter>Boot</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="CMakeLists.txt" />
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "VolumeCreator.h"
|
||||
#include "Boot.h"
|
||||
#include "HLE/HLE.h"
|
||||
#include "SettingsGenerator.h"
|
||||
|
||||
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
|
||||
// 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.
|
||||
std::string region_filename,
|
||||
settings_Filename(Common::GetTitleDataPath(TITLEID_SYSMENU) + WII_SETTING);
|
||||
std::string settings_Filename(Common::GetTitleDataPath(TITLEID_SYSMENU) + WII_SETTING);
|
||||
std::string area, model, code, video, game;
|
||||
|
||||
|
||||
switch((DiscIO::IVolume::ECountry)_CountryCode)
|
||||
{
|
||||
@ -190,38 +192,57 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode)
|
||||
case DiscIO::IVolume::COUNTRY_TAIWAN:
|
||||
// TODO: Determine if Korea / Taiwan have their own specific settings.
|
||||
case DiscIO::IVolume::COUNTRY_JAPAN:
|
||||
region_filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_JAP_SETTING;
|
||||
area = "JPN";
|
||||
video = "NTSC";
|
||||
break;
|
||||
|
||||
case DiscIO::IVolume::COUNTRY_USA:
|
||||
region_filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_USA_SETTING;
|
||||
area = "USA";
|
||||
video = "NTSC";
|
||||
break;
|
||||
|
||||
case DiscIO::IVolume::COUNTRY_EUROPE:
|
||||
region_filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_EUR_SETTING;
|
||||
area = "EUR";
|
||||
video = "PAL";
|
||||
break;
|
||||
|
||||
default:
|
||||
// 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;
|
||||
}
|
||||
|
||||
{
|
||||
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))
|
||||
{
|
||||
File::Delete(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;
|
||||
}
|
||||
|
||||
settingsFile.ReadBytes(Memory::GetPointer(0x3800), 256);
|
||||
Memory::WriteBigEData(gen.GetData(), 0x3800, SETTINGS_SIZE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user