diff options
| author | Matthew Parlane <parlane@gmail.com> | 2017-01-13 09:39:33 +1300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-13 09:39:33 +1300 |
| commit | cc513783899f84dd7dcfaa037c7f100b1a67eccd (patch) | |
| tree | 0cdcc2d10c1e080dc99d982434e38b5df1903442 /Source/Core/Common | |
| parent | d346d4ced163502be4d308a6ce8573814454c11c (diff) | |
| parent | 64101137cd6e507942364fb7e446692d69277341 (diff) | |
Merge pull request #4621 from leoetlino/default-sysconf
Remove pre-generated SYSCONF
Diffstat (limited to 'Source/Core/Common')
| -rw-r--r-- | Source/Core/Common/NandPaths.cpp | 41 | ||||
| -rw-r--r-- | Source/Core/Common/NandPaths.h | 4 | ||||
| -rw-r--r-- | Source/Core/Common/SysConf.cpp | 39 | ||||
| -rw-r--r-- | Source/Core/Common/SysConf.h | 7 |
4 files changed, 26 insertions, 65 deletions
diff --git a/Source/Core/Common/NandPaths.cpp b/Source/Core/Common/NandPaths.cpp index 60cb49fa26..99c75f01f8 100644 --- a/Source/Core/Common/NandPaths.cpp +++ b/Source/Core/Common/NandPaths.cpp @@ -20,46 +20,7 @@ namespace Common { -static std::string s_temp_wii_root; - -void InitializeWiiRoot(bool use_dummy) -{ - ShutdownWiiRoot(); - if (use_dummy) - { - s_temp_wii_root = File::CreateTempDir(); - if (s_temp_wii_root.empty()) - { - ERROR_LOG(WII_IPC_FILEIO, "Could not create temporary directory"); - return; - } - File::CopyDir(File::GetSysDirectory() + WII_USER_DIR, s_temp_wii_root); - WARN_LOG(WII_IPC_FILEIO, "Using temporary directory %s for minimal Wii FS", - s_temp_wii_root.c_str()); - static bool s_registered; - if (!s_registered) - { - s_registered = true; - atexit(ShutdownWiiRoot); - } - File::SetUserPath(D_SESSION_WIIROOT_IDX, s_temp_wii_root); - } - else - { - File::SetUserPath(D_SESSION_WIIROOT_IDX, File::GetUserPath(D_WIIROOT_IDX)); - } -} - -void ShutdownWiiRoot() -{ - if (!s_temp_wii_root.empty()) - { - File::DeleteDirRecursively(s_temp_wii_root); - s_temp_wii_root.clear(); - } -} - -static std::string RootUserPath(FromWhichRoot from) +std::string RootUserPath(FromWhichRoot from) { int idx = from == FROM_CONFIGURED_ROOT ? D_WIIROOT_IDX : D_SESSION_WIIROOT_IDX; return File::GetUserPath(idx); diff --git a/Source/Core/Common/NandPaths.h b/Source/Core/Common/NandPaths.h index ab15d6f049..c5a3234e8c 100644 --- a/Source/Core/Common/NandPaths.h +++ b/Source/Core/Common/NandPaths.h @@ -15,15 +15,13 @@ static const std::string TITLEID_SYSMENU_STRING = "0000000100000002"; namespace Common { -void InitializeWiiRoot(bool use_temporary); -void ShutdownWiiRoot(); - enum FromWhichRoot { FROM_CONFIGURED_ROOT, // not related to currently running game - use D_WIIROOT_IDX FROM_SESSION_ROOT, // request from currently running game - use D_SESSION_WIIROOT_IDX }; +std::string RootUserPath(FromWhichRoot from); std::string GetTicketFileName(u64 _titleID, FromWhichRoot from); std::string GetTMDFileName(u64 _titleID, FromWhichRoot from); std::string GetTitleDataPath(u64 _titleID, FromWhichRoot from); diff --git a/Source/Core/Common/SysConf.cpp b/Source/Core/Common/SysConf.cpp index 3b2ab36694..e8f8fb3cef 100644 --- a/Source/Core/Common/SysConf.cpp +++ b/Source/Core/Common/SysConf.cpp @@ -17,9 +17,9 @@ #include "Core/Movie.h" -SysConf::SysConf() +SysConf::SysConf(const Common::FromWhichRoot root_type) { - UpdateLocation(); + UpdateLocation(root_type); } SysConf::~SysConf() @@ -50,6 +50,7 @@ bool SysConf::LoadFromFile(const std::string& filename) { File::CreateFullPath(filename); GenerateSysConf(); + ApplySettingsFromMovie(); return true; } @@ -61,12 +62,10 @@ bool SysConf::LoadFromFile(const std::string& filename) SYSCONF_SIZE, size)) { GenerateSysConf(); + ApplySettingsFromMovie(); return true; } - else - { - return false; - } + return false; } File::IOFile f(filename, "rb"); @@ -76,13 +75,7 @@ bool SysConf::LoadFromFile(const std::string& filename) { m_Filename = filename; m_IsValid = true; - // Apply Wii settings from normal SYSCONF on Movie recording/playback - if (Movie::IsRecordingInput() || Movie::IsPlayingInput()) - { - SetData("IPL.LNG", Movie::GetLanguage()); - SetData("IPL.E60", Movie::IsPAL60()); - SetData("IPL.PGS", Movie::IsProgressive()); - } + ApplySettingsFromMovie(); return true; } } @@ -90,6 +83,17 @@ bool SysConf::LoadFromFile(const std::string& filename) return false; } +// Apply Wii settings from normal SYSCONF on Movie recording/playback +void SysConf::ApplySettingsFromMovie() +{ + if (!Movie::IsMovieActive()) + return; + + SetData("IPL.LNG", Movie::GetLanguage()); + SetData("IPL.E60", Movie::IsPAL60()); + SetData("IPL.PGS", Movie::IsProgressive()); +} + bool SysConf::LoadFromFileInternal(File::IOFile&& file) { // Fill in infos @@ -420,7 +424,7 @@ bool SysConf::Save() return SaveToFile(m_Filename); } -void SysConf::UpdateLocation() +void SysConf::UpdateLocation(const Common::FromWhichRoot root_type) { // if the old Wii User dir had a sysconf file save any settings that have been changed to it if (m_IsValid) @@ -429,11 +433,8 @@ void SysConf::UpdateLocation() // Clear the old filename and set the default filename to the new user path // So that it can be generated if the file does not exist in the new location m_Filename.clear(); - // Note: We don't use the dummy Wii root here (if in use) because this is - // all tied up with the configuration code. In the future this should - // probably just be synced with the other settings. - m_FilenameDefault = - File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP WII_SYSCONF_DIR DIR_SEP WII_SYSCONF; + // In the future the SYSCONF should probably just be synced with the other settings. + m_FilenameDefault = Common::RootUserPath(root_type) + DIR_SEP WII_SYSCONF_DIR DIR_SEP WII_SYSCONF; Reload(); } diff --git a/Source/Core/Common/SysConf.h b/Source/Core/Common/SysConf.h index 97b3a98232..5eaed702d7 100644 --- a/Source/Core/Common/SysConf.h +++ b/Source/Core/Common/SysConf.h @@ -13,6 +13,7 @@ #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "Common/MsgHandler.h" +#include "Common/NandPaths.h" namespace File { @@ -79,7 +80,7 @@ struct SSysConfEntry class SysConf { public: - SysConf(); + SysConf(Common::FromWhichRoot root_type); ~SysConf(); bool IsValid() { return m_IsValid; } @@ -176,13 +177,13 @@ public: bool SaveToFile(const std::string& filename); bool LoadFromFile(const std::string& filename); bool Reload(); - // This function is used when the NAND root is changed - void UpdateLocation(); + void UpdateLocation(Common::FromWhichRoot root_type); private: bool LoadFromFileInternal(File::IOFile&& file); void GenerateSysConf(); void Clear(); + void ApplySettingsFromMovie(); std::string m_Filename; std::string m_FilenameDefault; |
