Merge pull request #6830 from lioncash/namespace
SettingsHandler: Namespace code under the Common namespace
This commit is contained in:
commit
36adf76f4a
|
@ -4,24 +4,18 @@
|
|||
|
||||
// Thanks to Treeki for writing the original class - 29/01/2012
|
||||
|
||||
#include "Common/SettingsHandler.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
#include <sys/timeb.h>
|
||||
#endif
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/SettingsHandler.h"
|
||||
#include "Common/Timer.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
SettingsHandler::SettingsHandler()
|
||||
{
|
||||
Reset();
|
||||
|
@ -37,7 +31,7 @@ const SettingsHandler::Buffer& SettingsHandler::GetBytes() const
|
|||
return m_buffer;
|
||||
}
|
||||
|
||||
void SettingsHandler::SetBytes(SettingsHandler::Buffer&& buffer)
|
||||
void SettingsHandler::SetBytes(Buffer&& buffer)
|
||||
{
|
||||
Reset();
|
||||
m_buffer = std::move(buffer);
|
||||
|
@ -134,3 +128,4 @@ std::string SettingsHandler::GenerateSerialNumber()
|
|||
stream << std::put_time(std::localtime(&t), "%j%H%M%S");
|
||||
return stream.str();
|
||||
}
|
||||
} // namespace Common
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
class SettingsHandler
|
||||
{
|
||||
public:
|
||||
|
@ -42,3 +44,4 @@ private:
|
|||
u32 m_position, m_key;
|
||||
std::string decoded;
|
||||
};
|
||||
} // namespace Common
|
||||
|
|
|
@ -223,7 +223,7 @@ bool CBoot::SetupWiiMemory()
|
|||
auto entryPos = region_settings.find(SConfig::GetInstance().m_region);
|
||||
const RegionSetting& region_setting = entryPos->second;
|
||||
|
||||
SettingsHandler gen;
|
||||
Common::SettingsHandler gen;
|
||||
std::string serno;
|
||||
CreateSystemMenuTitleDirs();
|
||||
const std::string settings_file_path(Common::GetTitleDataPath(Titles::SYSTEM_MENU) +
|
||||
|
@ -231,7 +231,7 @@ bool CBoot::SetupWiiMemory()
|
|||
|
||||
const auto fs = IOS::HLE::GetIOS()->GetFS();
|
||||
{
|
||||
SettingsHandler::Buffer data;
|
||||
Common::SettingsHandler::Buffer data;
|
||||
const auto file = fs->OpenFile(IOS::SYSMENU_UID, IOS::SYSMENU_GID, settings_file_path,
|
||||
IOS::HLE::FS::Mode::Read);
|
||||
if (file && file->Read(data.data(), data.size()))
|
||||
|
@ -248,7 +248,7 @@ bool CBoot::SetupWiiMemory()
|
|||
if (Core::WantsDeterminism())
|
||||
serno = "123456789";
|
||||
else
|
||||
serno = SettingsHandler::GenerateSerialNumber();
|
||||
serno = Common::SettingsHandler::GenerateSerialNumber();
|
||||
INFO_LOG(BOOT, "No previous serial number found, generated one instead: %s", serno.c_str());
|
||||
}
|
||||
else
|
||||
|
|
|
@ -92,10 +92,10 @@ IPCCommandResult NetKDRequest::IOCtl(const IOCtlRequest& request)
|
|||
const auto fs = m_ios.GetFS();
|
||||
if (const auto file = fs->OpenFile(PID_KD, PID_KD, settings_file_path, FS::Mode::Read))
|
||||
{
|
||||
SettingsHandler::Buffer data;
|
||||
Common::SettingsHandler::Buffer data;
|
||||
if (file->Read(data.data(), data.size()))
|
||||
{
|
||||
const SettingsHandler gen{std::move(data)};
|
||||
const Common::SettingsHandler gen{std::move(data)};
|
||||
area = gen.GetValue("AREA");
|
||||
model = gen.GetValue("MODEL");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue