summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/cfg
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service/cfg')
-rw-r--r--src/core/hle/service/cfg/cfg.cpp716
-rw-r--r--src/core/hle/service/cfg/cfg.h369
-rw-r--r--src/core/hle/service/cfg/cfg_i.cpp64
-rw-r--r--src/core/hle/service/cfg/cfg_i.h22
-rw-r--r--src/core/hle/service/cfg/cfg_nor.cpp23
-rw-r--r--src/core/hle/service/cfg/cfg_nor.h22
-rw-r--r--src/core/hle/service/cfg/cfg_s.cpp41
-rw-r--r--src/core/hle/service/cfg/cfg_s.h22
-rw-r--r--src/core/hle/service/cfg/cfg_u.cpp31
-rw-r--r--src/core/hle/service/cfg/cfg_u.h22
10 files changed, 0 insertions, 1332 deletions
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp
deleted file mode 100644
index f78c25fb2..000000000
--- a/src/core/hle/service/cfg/cfg.cpp
+++ /dev/null
@@ -1,716 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <algorithm>
-#include <array>
-#include <cryptopp/osrng.h>
-#include <cryptopp/sha.h>
-#include "common/file_util.h"
-#include "common/logging/log.h"
-#include "common/string_util.h"
-#include "common/swap.h"
-#include "core/file_sys/archive_systemsavedata.h"
-#include "core/file_sys/errors.h"
-#include "core/file_sys/file_backend.h"
-#include "core/hle/ipc.h"
-#include "core/hle/ipc_helpers.h"
-#include "core/hle/result.h"
-#include "core/hle/service/cfg/cfg.h"
-#include "core/hle/service/cfg/cfg_i.h"
-#include "core/hle/service/cfg/cfg_nor.h"
-#include "core/hle/service/cfg/cfg_s.h"
-#include "core/hle/service/cfg/cfg_u.h"
-#include "core/hle/service/fs/archive.h"
-#include "core/hle/service/service.h"
-#include "core/memory.h"
-#include "core/settings.h"
-
-namespace Service {
-namespace CFG {
-
-/// The maximum number of block entries that can exist in the config file
-static const u32 CONFIG_FILE_MAX_BLOCK_ENTRIES = 1479;
-
-namespace {
-
-/**
- * The header of the config savedata file,
- * contains information about the blocks in the file
- */
-struct SaveFileConfig {
- u16 total_entries; ///< The total number of set entries in the config file
- u16 data_entries_offset; ///< The offset where the data for the blocks start, this is hardcoded
- /// to 0x455C as per hardware
- SaveConfigBlockEntry block_entries[CONFIG_FILE_MAX_BLOCK_ENTRIES]; ///< The block headers, the
- /// maximum possible value is
- /// 1479 as per hardware
- u32 unknown; ///< This field is unknown, possibly padding, 0 has been observed in hardware
-};
-static_assert(sizeof(SaveFileConfig) == 0x455C,
- "SaveFileConfig header must be exactly 0x455C bytes");
-
-enum ConfigBlockID {
- StereoCameraSettingsBlockID = 0x00050005,
- SoundOutputModeBlockID = 0x00070001,
- ConsoleUniqueID1BlockID = 0x00090000,
- ConsoleUniqueID2BlockID = 0x00090001,
- ConsoleUniqueID3BlockID = 0x00090002,
- UsernameBlockID = 0x000A0000,
- BirthdayBlockID = 0x000A0001,
- LanguageBlockID = 0x000A0002,
- CountryInfoBlockID = 0x000B0000,
- CountryNameBlockID = 0x000B0001,
- StateNameBlockID = 0x000B0002,
- EULAVersionBlockID = 0x000D0000,
- ConsoleModelBlockID = 0x000F0004,
-};
-
-struct UsernameBlock {
- char16_t username[10]; ///< Exactly 20 bytes long, padded with zeros at the end if necessary
- u32 zero;
- u32 ng_word;
-};
-static_assert(sizeof(UsernameBlock) == 0x1C, "UsernameBlock must be exactly 0x1C bytes");
-
-struct BirthdayBlock {
- u8 month; ///< The month of the birthday
- u8 day; ///< The day of the birthday
-};
-static_assert(sizeof(BirthdayBlock) == 2, "BirthdayBlock must be exactly 2 bytes");
-
-struct ConsoleModelInfo {
- u8 model; ///< The console model (3DS, 2DS, etc)
- u8 unknown[3]; ///< Unknown data
-};
-static_assert(sizeof(ConsoleModelInfo) == 4, "ConsoleModelInfo must be exactly 4 bytes");
-
-struct ConsoleCountryInfo {
- u8 unknown[3]; ///< Unknown data
- u8 country_code; ///< The country code of the console
-};
-static_assert(sizeof(ConsoleCountryInfo) == 4, "ConsoleCountryInfo must be exactly 4 bytes");
-}
-
-static const ConsoleModelInfo CONSOLE_MODEL = {NINTENDO_3DS_XL, {0, 0, 0}};
-static const u8 CONSOLE_LANGUAGE = LANGUAGE_EN;
-static const UsernameBlock CONSOLE_USERNAME_BLOCK = {u"CITRA", 0, 0};
-static const BirthdayBlock PROFILE_BIRTHDAY = {3, 25}; // March 25th, 2014
-static const u8 SOUND_OUTPUT_MODE = SOUND_SURROUND;
-static const u8 UNITED_STATES_COUNTRY_ID = 49;
-/// TODO(Subv): Find what the other bytes are
-static const ConsoleCountryInfo COUNTRY_INFO = {{0, 0, 0}, UNITED_STATES_COUNTRY_ID};
-
-/**
- * TODO(Subv): Find out what this actually is, these values fix some NaN uniforms in some games,
- * for example Nintendo Zone
- * Thanks Normmatt for providing this information
- */
-static const std::array<float, 8> STEREO_CAMERA_SETTINGS = {
- 62.0f, 289.0f, 76.80000305175781f, 46.08000183105469f,
- 10.0f, 5.0f, 55.58000183105469f, 21.56999969482422f,
-};
-static_assert(sizeof(STEREO_CAMERA_SETTINGS) == 0x20,
- "STEREO_CAMERA_SETTINGS must be exactly 0x20 bytes");
-
-static const u32 CONFIG_SAVEFILE_SIZE = 0x8000;
-static std::array<u8, CONFIG_SAVEFILE_SIZE> cfg_config_file_buffer;
-
-static Service::FS::ArchiveHandle cfg_system_save_data_archive;
-static const std::vector<u8> cfg_system_savedata_id = {
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x01, 0x00,
-};
-
-static u32 preferred_region_code = 0;
-
-void GetCountryCodeString(Service::Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
- u32 country_code_id = cmd_buff[1];
-
- if (country_code_id >= country_codes.size() || 0 == country_codes[country_code_id]) {
- LOG_ERROR(Service_CFG, "requested country code id=%d is invalid", country_code_id);
- cmd_buff[1] = ResultCode(ErrorDescription::NotFound, ErrorModule::Config,
- ErrorSummary::WrongArgument, ErrorLevel::Permanent)
- .raw;
- return;
- }
-
- cmd_buff[1] = 0;
- cmd_buff[2] = country_codes[country_code_id];
-}
-
-void GetCountryCodeID(Service::Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
- u16 country_code = static_cast<u16>(cmd_buff[1]);
- u16 country_code_id = 0;
-
- // The following algorithm will fail if the first country code isn't 0.
- DEBUG_ASSERT(country_codes[0] == 0);
-
- for (u16 id = 0; id < country_codes.size(); ++id) {
- if (country_codes[id] == country_code) {
- country_code_id = id;
- break;
- }
- }
-
- if (0 == country_code_id) {
- LOG_ERROR(Service_CFG, "requested country code name=%c%c is invalid", country_code & 0xff,
- country_code >> 8);
- cmd_buff[1] = ResultCode(ErrorDescription::NotFound, ErrorModule::Config,
- ErrorSummary::WrongArgument, ErrorLevel::Permanent)
- .raw;
- cmd_buff[2] = 0xFFFF;
- return;
- }
-
- cmd_buff[1] = 0;
- cmd_buff[2] = country_code_id;
-}
-
-u32 GetRegionValue() {
- if (Settings::values.region_value == Settings::REGION_VALUE_AUTO_SELECT)
- return preferred_region_code;
-
- return Settings::values.region_value;
-}
-
-void SecureInfoGetRegion(Service::Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
-
- cmd_buff[1] = RESULT_SUCCESS.raw;
- cmd_buff[2] = GetRegionValue();
-}
-
-void GenHashConsoleUnique(Service::Interface* self) {
- IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x03, 1, 0);
- const u32 app_id_salt = rp.Pop<u32>() & 0x000FFFFF;
-
- IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
-
- std::array<u8, 12> buffer;
- const ResultCode result = GetConfigInfoBlock(ConsoleUniqueID2BlockID, 8, 2, buffer.data());
- rb.Push(result);
- if (result.IsSuccess()) {
- std::memcpy(&buffer[8], &app_id_salt, sizeof(u32));
- std::array<u8, CryptoPP::SHA256::DIGESTSIZE> hash;
- CryptoPP::SHA256().CalculateDigest(hash.data(), buffer.data(), sizeof(buffer));
- u32 low, high;
- memcpy(&low, &hash[hash.size() - 8], sizeof(u32));
- memcpy(&high, &hash[hash.size() - 4], sizeof(u32));
- rb.Push(low);
- rb.Push(high);
- } else {
- rb.Push<u32>(0);
- rb.Push<u32>(0);
- }
-
- LOG_DEBUG(Service_CFG, "called app_id_salt=0x%X", app_id_salt);
-}
-
-void GetRegionCanadaUSA(Service::Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
-
- cmd_buff[1] = RESULT_SUCCESS.raw;
-
- u8 canada_or_usa = 1;
- if (canada_or_usa == GetRegionValue()) {
- cmd_buff[2] = 1;
- } else {
- cmd_buff[2] = 0;
- }
-}
-
-void GetSystemModel(Service::Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
- u32 data;
-
- // TODO(Subv): Find out the correct error codes
- cmd_buff[1] =
- Service::CFG::GetConfigInfoBlock(0x000F0004, 4, 0x8, reinterpret_cast<u8*>(&data)).raw;
- cmd_buff[2] = data & 0xFF;
-}
-
-void GetModelNintendo2DS(Service::Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
- u32 data;
-
- // TODO(Subv): Find out the correct error codes
- cmd_buff[1] =
- Service::CFG::GetConfigInfoBlock(0x000F0004, 4, 0x8, reinterpret_cast<u8*>(&data)).raw;
-
- u8 model = data & 0xFF;
- if (model == Service::CFG::NINTENDO_2DS)
- cmd_buff[2] = 0;
- else
- cmd_buff[2] = 1;
-}
-
-void GetConfigInfoBlk2(Service::Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
- u32 size = cmd_buff[1];
- u32 block_id = cmd_buff[2];
- VAddr data_pointer = cmd_buff[4];
-
- if (!Memory::IsValidVirtualAddress(data_pointer)) {
- cmd_buff[1] = -1; // TODO(Subv): Find the right error code
- return;
- }
-
- std::vector<u8> data(size);
- cmd_buff[1] = Service::CFG::GetConfigInfoBlock(block_id, size, 0x2, data.data()).raw;
- Memory::WriteBlock(data_pointer, data.data(), data.size());
-}
-
-void GetConfigInfoBlk8(Service::Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
- u32 size = cmd_buff[1];
- u32 block_id = cmd_buff[2];
- VAddr data_pointer = cmd_buff[4];
-
- if (!Memory::IsValidVirtualAddress(data_pointer)) {
- cmd_buff[1] = -1; // TODO(Subv): Find the right error code
- return;
- }
-
- std::vector<u8> data(size);
- cmd_buff[1] = Service::CFG::GetConfigInfoBlock(block_id, size, 0x8, data.data()).raw;
- Memory::WriteBlock(data_pointer, data.data(), data.size());
-}
-
-void SetConfigInfoBlk4(Service::Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
- u32 block_id = cmd_buff[1];
- u32 size = cmd_buff[2];
- VAddr data_pointer = cmd_buff[4];
-
- if (!Memory::IsValidVirtualAddress(data_pointer)) {
- cmd_buff[1] = -1; // TODO(Subv): Find the right error code
- return;
- }
-
- std::vector<u8> data(size);
- Memory::ReadBlock(data_pointer, data.data(), data.size());
- cmd_buff[1] = Service::CFG::SetConfigInfoBlock(block_id, size, 0x4, data.data()).raw;
-}
-
-void UpdateConfigNANDSavegame(Service::Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
- cmd_buff[1] = Service::CFG::UpdateConfigNANDSavegame().raw;
-}
-
-void FormatConfig(Service::Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
- cmd_buff[1] = Service::CFG::FormatConfig().raw;
-}
-
-static ResultVal<void*> GetConfigInfoBlockPointer(u32 block_id, u32 size, u32 flag) {
- // Read the header
- SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data());
-
- auto itr =
- std::find_if(std::begin(config->block_entries), std::end(config->block_entries),
- [&](const SaveConfigBlockEntry& entry) { return entry.block_id == block_id; });
-
- if (itr == std::end(config->block_entries)) {
- LOG_ERROR(Service_CFG, "Config block 0x%X with flags %u and size %u was not found",
- block_id, flag, size);
- return ResultCode(ErrorDescription::NotFound, ErrorModule::Config,
- ErrorSummary::WrongArgument, ErrorLevel::Permanent);
- }
-
- if ((itr->flags & flag) == 0) {
- LOG_ERROR(Service_CFG, "Invalid flag %u for config block 0x%X with size %u", flag, block_id,
- size);
- return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::Config,
- ErrorSummary::WrongArgument, ErrorLevel::Permanent);
- }
-
- if (itr->size != size) {
- LOG_ERROR(Service_CFG, "Invalid size %u for config block 0x%X with flags %u", size,
- block_id, flag);
- return ResultCode(ErrorDescription::InvalidSize, ErrorModule::Config,
- ErrorSummary::WrongArgument, ErrorLevel::Permanent);
- }
-
- void* pointer;
-
- // The data is located in the block header itself if the size is less than 4 bytes
- if (itr->size <= 4)
- pointer = &itr->offset_or_data;
- else
- pointer = &cfg_config_file_buffer[itr->offset_or_data];
-
- return MakeResult<void*>(pointer);
-}
-
-ResultCode GetConfigInfoBlock(u32 block_id, u32 size, u32 flag, void* output) {
- void* pointer;
- CASCADE_RESULT(pointer, GetConfigInfoBlockPointer(block_id, size, flag));
- memcpy(output, pointer, size);
-
- return RESULT_SUCCESS;
-}
-
-ResultCode SetConfigInfoBlock(u32 block_id, u32 size, u32 flag, const void* input) {
- void* pointer;
- CASCADE_RESULT(pointer, GetConfigInfoBlockPointer(block_id, size, flag));
- memcpy(pointer, input, size);
- return RESULT_SUCCESS;
-}
-
-ResultCode CreateConfigInfoBlk(u32 block_id, u16 size, u16 flags, const void* data) {
- SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data());
- if (config->total_entries >= CONFIG_FILE_MAX_BLOCK_ENTRIES)
- return ResultCode(-1); // TODO(Subv): Find the right error code
-
- // Insert the block header with offset 0 for now
- config->block_entries[config->total_entries] = {block_id, 0, size, flags};
- if (size > 4) {
- u32 offset = config->data_entries_offset;
- // Perform a search to locate the next offset for the new data
- // use the offset and size of the previous block to determine the new position
- for (int i = config->total_entries - 1; i >= 0; --i) {
- // Ignore the blocks that don't have a separate data offset
- if (config->block_entries[i].size > 4) {
- offset = config->block_entries[i].offset_or_data + config->block_entries[i].size;
- break;
- }
- }
-
- config->block_entries[config->total_entries].offset_or_data = offset;
-
- // Write the data at the new offset
- memcpy(&cfg_config_file_buffer[offset], data, size);
- } else {
- // The offset_or_data field in the header contains the data itself if it's 4 bytes or less
- memcpy(&config->block_entries[config->total_entries].offset_or_data, data, size);
- }
-
- ++config->total_entries;
- return RESULT_SUCCESS;
-}
-
-ResultCode DeleteConfigNANDSaveFile() {
- FileSys::Path path("/config");
- return Service::FS::DeleteFileFromArchive(cfg_system_save_data_archive, path);
-}
-
-ResultCode UpdateConfigNANDSavegame() {
- FileSys::Mode mode = {};
- mode.write_flag.Assign(1);
- mode.create_flag.Assign(1);
-
- FileSys::Path path("/config");
-
- auto config_result = Service::FS::OpenFileFromArchive(cfg_system_save_data_archive, path, mode);
- ASSERT_MSG(config_result.Succeeded(), "could not open file");
-
- auto config = std::move(config_result).Unwrap();
- config->backend->Write(0, CONFIG_SAVEFILE_SIZE, 1, cfg_config_file_buffer.data());
-
- return RESULT_SUCCESS;
-}
-
-ResultCode FormatConfig() {
- ResultCode res = DeleteConfigNANDSaveFile();
- // The delete command fails if the file doesn't exist, so we have to check that too
- if (!res.IsSuccess() && res != FileSys::ERROR_FILE_NOT_FOUND) {
- return res;
- }
- // Delete the old data
- cfg_config_file_buffer.fill(0);
- // Create the header
- SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data());
- // This value is hardcoded, taken from 3dbrew, verified by hardware, it's always the same value
- config->data_entries_offset = 0x455C;
-
- // Insert the default blocks
- u8 zero_buffer[0xC0] = {};
-
- // 0x00030001 - Unknown
- res = CreateConfigInfoBlk(0x00030001, 0x8, 0xE, zero_buffer);
- if (!res.IsSuccess())
- return res;
-
- res = CreateConfigInfoBlk(StereoCameraSettingsBlockID, sizeof(STEREO_CAMERA_SETTINGS), 0xE,
- STEREO_CAMERA_SETTINGS.data());
- if (!res.IsSuccess())
- return res;
-
- res = CreateConfigInfoBlk(SoundOutputModeBlockID, sizeof(SOUND_OUTPUT_MODE), 0xE,
- &SOUND_OUTPUT_MODE);
- if (!res.IsSuccess())
- return res;
-
- u32 random_number;
- u64 console_id;
- GenerateConsoleUniqueId(random_number, console_id);
-
- u64_le console_id_le = console_id;
- res = CreateConfigInfoBlk(ConsoleUniqueID1BlockID, sizeof(console_id_le), 0xE, &console_id_le);
- if (!res.IsSuccess())
- return res;
-
- res = CreateConfigInfoBlk(ConsoleUniqueID2BlockID, sizeof(console_id_le), 0xE, &console_id_le);
- if (!res.IsSuccess())
- return res;
-
- u32_le random_number_le = random_number;
- res = CreateConfigInfoBlk(ConsoleUniqueID3BlockID, sizeof(random_number_le), 0xE,
- &random_number_le);
- if (!res.IsSuccess())
- return res;
-
- res = CreateConfigInfoBlk(UsernameBlockID, sizeof(CONSOLE_USERNAME_BLOCK), 0xE,
- &CONSOLE_USERNAME_BLOCK);
- if (!res.IsSuccess())
- return res;
-
- res = CreateConfigInfoBlk(BirthdayBlockID, sizeof(PROFILE_BIRTHDAY), 0xE, &PROFILE_BIRTHDAY);
- if (!res.IsSuccess())
- return res;
-
- res = CreateConfigInfoBlk(LanguageBlockID, sizeof(CONSOLE_LANGUAGE), 0xE, &CONSOLE_LANGUAGE);
- if (!res.IsSuccess())
- return res;
-
- res = CreateConfigInfoBlk(CountryInfoBlockID, sizeof(COUNTRY_INFO), 0xE, &COUNTRY_INFO);
- if (!res.IsSuccess())
- return res;
-
- u16_le country_name_buffer[16][0x40] = {};
- std::u16string region_name = Common::UTF8ToUTF16("Gensokyo");
- for (size_t i = 0; i < 16; ++i) {
- std::copy(region_name.cbegin(), region_name.cend(), country_name_buffer[i]);
- }
- // 0x000B0001 - Localized names for the profile Country
- res = CreateConfigInfoBlk(CountryNameBlockID, sizeof(country_name_buffer), 0xE,
- country_name_buffer);
- if (!res.IsSuccess())
- return res;
- // 0x000B0002 - Localized names for the profile State/Province
- res = CreateConfigInfoBlk(StateNameBlockID, sizeof(country_name_buffer), 0xE,
- country_name_buffer);
- if (!res.IsSuccess())
- return res;
-
- // 0x000B0003 - Unknown, related to country/address (zip code?)
- res = CreateConfigInfoBlk(0x000B0003, 0x4, 0xE, zero_buffer);
- if (!res.IsSuccess())
- return res;
-
- // 0x000C0000 - Unknown
- res = CreateConfigInfoBlk(0x000C0000, 0xC0, 0xE, zero_buffer);
- if (!res.IsSuccess())
- return res;
-
- // 0x000C0001 - Unknown
- res = CreateConfigInfoBlk(0x000C0001, 0x14, 0xE, zero_buffer);
- if (!res.IsSuccess())
- return res;
-
- // 0x000D0000 - Accepted EULA version
- res = CreateConfigInfoBlk(EULAVersionBlockID, 0x4, 0xE, zero_buffer);
- if (!res.IsSuccess())
- return res;
-
- res = CreateConfigInfoBlk(ConsoleModelBlockID, sizeof(CONSOLE_MODEL), 0xC, &CONSOLE_MODEL);
- if (!res.IsSuccess())
- return res;
-
- // 0x00170000 - Unknown
- res = CreateConfigInfoBlk(0x00170000, 0x4, 0xE, zero_buffer);
- if (!res.IsSuccess())
- return res;
-
- // Save the buffer to the file
- res = UpdateConfigNANDSavegame();
- if (!res.IsSuccess())
- return res;
- return RESULT_SUCCESS;
-}
-
-ResultCode LoadConfigNANDSaveFile() {
- // Open the SystemSaveData archive 0x00010017
- FileSys::Path archive_path(cfg_system_savedata_id);
- auto archive_result =
- Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SystemSaveData, archive_path);
-
- // If the archive didn't exist, create the files inside
- if (archive_result.Code() == FileSys::ERR_NOT_FORMATTED) {
- // Format the archive to create the directories
- Service::FS::FormatArchive(Service::FS::ArchiveIdCode::SystemSaveData,
- FileSys::ArchiveFormatInfo(), archive_path);
-
- // Open it again to get a valid archive now that the folder exists
- archive_result =
- Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SystemSaveData, archive_path);
- }
-
- ASSERT_MSG(archive_result.Succeeded(), "Could not open the CFG SystemSaveData archive!");
-
- cfg_system_save_data_archive = *archive_result;
-
- FileSys::Path config_path("/config");
- FileSys::Mode open_mode = {};
- open_mode.read_flag.Assign(1);
-
- auto config_result = Service::FS::OpenFileFromArchive(*archive_result, config_path, open_mode);
-
- // Read the file if it already exists
- if (config_result.Succeeded()) {
- auto config = std::move(config_result).Unwrap();
- config->backend->Read(0, CONFIG_SAVEFILE_SIZE, cfg_config_file_buffer.data());
- return RESULT_SUCCESS;
- }
-
- return FormatConfig();
-}
-
-void Init() {
- AddService(new CFG_I);
- AddService(new CFG_NOR);
- AddService(new CFG_S);
- AddService(new CFG_U);
-
- LoadConfigNANDSaveFile();
-
- preferred_region_code = 0;
-}
-
-void Shutdown() {}
-
-/// Checks if the language is available in the chosen region, and returns a proper one
-static SystemLanguage AdjustLanguageInfoBlock(u32 region, SystemLanguage language) {
- static const std::array<std::vector<SystemLanguage>, 7> region_languages{{
- // JPN
- {LANGUAGE_JP},
- // USA
- {LANGUAGE_EN, LANGUAGE_FR, LANGUAGE_ES, LANGUAGE_PT},
- // EUR
- {LANGUAGE_EN, LANGUAGE_FR, LANGUAGE_DE, LANGUAGE_IT, LANGUAGE_ES, LANGUAGE_NL, LANGUAGE_PT,
- LANGUAGE_RU},
- // AUS
- {LANGUAGE_EN, LANGUAGE_FR, LANGUAGE_DE, LANGUAGE_IT, LANGUAGE_ES, LANGUAGE_NL, LANGUAGE_PT,
- LANGUAGE_RU},
- // CHN
- {LANGUAGE_ZH},
- // KOR
- {LANGUAGE_KO},
- // TWN
- {LANGUAGE_TW},
- }};
- const auto& available = region_languages[region];
- if (std::find(available.begin(), available.end(), language) == available.end()) {
- return available[0];
- }
- return language;
-}
-
-void SetPreferredRegionCode(u32 region_code) {
- preferred_region_code = region_code;
- LOG_INFO(Service_CFG, "Preferred region code set to %u", preferred_region_code);
-
- if (Settings::values.region_value == Settings::REGION_VALUE_AUTO_SELECT) {
- const SystemLanguage current_language = GetSystemLanguage();
- const SystemLanguage adjusted_language =
- AdjustLanguageInfoBlock(region_code, current_language);
- if (current_language != adjusted_language) {
- LOG_WARNING(Service_CFG, "System language %d does not fit the region. Adjusted to %d",
- static_cast<int>(current_language), static_cast<int>(adjusted_language));
- SetSystemLanguage(adjusted_language);
- }
- }
-}
-
-void SetUsername(const std::u16string& name) {
- ASSERT(name.size() <= 10);
- UsernameBlock block{};
- name.copy(block.username, name.size());
- SetConfigInfoBlock(UsernameBlockID, sizeof(block), 4, &block);
-}
-
-std::u16string GetUsername() {
- UsernameBlock block;
- GetConfigInfoBlock(UsernameBlockID, sizeof(block), 8, &block);
-
- // the username string in the block isn't null-terminated,
- // so we need to find the end manually.
- std::u16string username(block.username, ARRAY_SIZE(block.username));
- const size_t pos = username.find(u'\0');
- if (pos != std::u16string::npos)
- username.erase(pos);
- return username;
-}
-
-void SetBirthday(u8 month, u8 day) {
- BirthdayBlock block = {month, day};
- SetConfigInfoBlock(BirthdayBlockID, sizeof(block), 4, &block);
-}
-
-std::tuple<u8, u8> GetBirthday() {
- BirthdayBlock block;
- GetConfigInfoBlock(BirthdayBlockID, sizeof(block), 8, &block);
- return std::make_tuple(block.month, block.day);
-}
-
-void SetSystemLanguage(SystemLanguage language) {
- u8 block = language;
- SetConfigInfoBlock(LanguageBlockID, sizeof(block), 4, &block);
-}
-
-SystemLanguage GetSystemLanguage() {
- u8 block;
- GetConfigInfoBlock(LanguageBlockID, sizeof(block), 8, &block);
- return static_cast<SystemLanguage>(block);
-}
-
-void SetSoundOutputMode(SoundOutputMode mode) {
- u8 block = mode;
- SetConfigInfoBlock(SoundOutputModeBlockID, sizeof(block), 4, &block);
-}
-
-SoundOutputMode GetSoundOutputMode() {
- u8 block;
- GetConfigInfoBlock(SoundOutputModeBlockID, sizeof(block), 8, &block);
- return static_cast<SoundOutputMode>(block);
-}
-
-void GenerateConsoleUniqueId(u32& random_number, u64& console_id) {
- CryptoPP::AutoSeededRandomPool rng;
- random_number = rng.GenerateWord32(0, 0xFFFF);
- u64_le local_friend_code_seed;
- rng.GenerateBlock(reinterpret_cast<CryptoPP::byte*>(&local_friend_code_seed),
- sizeof(local_friend_code_seed));
- console_id = (local_friend_code_seed & 0x3FFFFFFFF) | (static_cast<u64>(random_number) << 48);
-}
-
-ResultCode SetConsoleUniqueId(u32 random_number, u64 console_id) {
- u64_le console_id_le = console_id;
- ResultCode res =
- SetConfigInfoBlock(ConsoleUniqueID1BlockID, sizeof(console_id_le), 0xE, &console_id_le);
- if (!res.IsSuccess())
- return res;
-
- res = SetConfigInfoBlock(ConsoleUniqueID2BlockID, sizeof(console_id_le), 0xE, &console_id_le);
- if (!res.IsSuccess())
- return res;
-
- u32_le random_number_le = random_number;
- res = SetConfigInfoBlock(ConsoleUniqueID3BlockID, sizeof(random_number_le), 0xE,
- &random_number_le);
- if (!res.IsSuccess())
- return res;
-
- return RESULT_SUCCESS;
-}
-
-u64 GetConsoleUniqueId() {
- u64_le console_id_le;
- GetConfigInfoBlock(ConsoleUniqueID2BlockID, sizeof(console_id_le), 0xE, &console_id_le);
- return console_id_le;
-}
-
-} // namespace CFG
-} // namespace Service
diff --git a/src/core/hle/service/cfg/cfg.h b/src/core/hle/service/cfg/cfg.h
deleted file mode 100644
index 282b6936b..000000000
--- a/src/core/hle/service/cfg/cfg.h
+++ /dev/null
@@ -1,369 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <array>
-#include <string>
-#include "common/common_types.h"
-
-union ResultCode;
-
-namespace Service {
-
-class Interface;
-
-namespace CFG {
-
-enum SystemModel {
- NINTENDO_3DS = 0,
- NINTENDO_3DS_XL = 1,
- NEW_NINTENDO_3DS = 2,
- NINTENDO_2DS = 3,
- NEW_NINTENDO_3DS_XL = 4
-};
-
-enum SystemLanguage {
- LANGUAGE_JP = 0,
- LANGUAGE_EN = 1,
- LANGUAGE_FR = 2,
- LANGUAGE_DE = 3,
- LANGUAGE_IT = 4,
- LANGUAGE_ES = 5,
- LANGUAGE_ZH = 6,
- LANGUAGE_KO = 7,
- LANGUAGE_NL = 8,
- LANGUAGE_PT = 9,
- LANGUAGE_RU = 10,
- LANGUAGE_TW = 11
-};
-
-enum SoundOutputMode { SOUND_MONO = 0, SOUND_STEREO = 1, SOUND_SURROUND = 2 };
-
-/// Block header in the config savedata file
-struct SaveConfigBlockEntry {
- u32 block_id; ///< The id of the current block
- u32 offset_or_data; ///< This is the absolute offset to the block data if the size is greater
- /// than 4 bytes, otherwise it contains the data itself
- u16 size; ///< The size of the block
- u16 flags; ///< The flags of the block, possibly used for access control
-};
-
-static constexpr u16 C(const char code[2]) {
- return code[0] | (code[1] << 8);
-}
-
-static const std::array<u16, 187> country_codes = {{
- 0, C("JP"), 0, 0, 0, 0, 0, 0, // 0-7
- C("AI"), C("AG"), C("AR"), C("AW"), C("BS"), C("BB"), C("BZ"), C("BO"), // 8-15
- C("BR"), C("VG"), C("CA"), C("KY"), C("CL"), C("CO"), C("CR"), C("DM"), // 16-23
- C("DO"), C("EC"), C("SV"), C("GF"), C("GD"), C("GP"), C("GT"), C("GY"), // 24-31
- C("HT"), C("HN"), C("JM"), C("MQ"), C("MX"), C("MS"), C("AN"), C("NI"), // 32-39
- C("PA"), C("PY"), C("PE"), C("KN"), C("LC"), C("VC"), C("SR"), C("TT"), // 40-47
- C("TC"), C("US"), C("UY"), C("VI"), C("VE"), 0, 0, 0, // 48-55
- 0, 0, 0, 0, 0, 0, 0, 0, // 56-63
- C("AL"), C("AU"), C("AT"), C("BE"), C("BA"), C("BW"), C("BG"), C("HR"), // 64-71
- C("CY"), C("CZ"), C("DK"), C("EE"), C("FI"), C("FR"), C("DE"), C("GR"), // 72-79
- C("HU"), C("IS"), C("IE"), C("IT"), C("LV"), C("LS"), C("LI"), C("LT"), // 80-87
- C("LU"), C("MK"), C("MT"), C("ME"), C("MZ"), C("NA"), C("NL"), C("NZ"), // 88-95
- C("NO"), C("PL"), C("PT"), C("RO"), C("RU"), C("RS"), C("SK"), C("SI"), // 96-103
- C("ZA"), C("ES"), C("SZ"), C("SE"), C("CH"), C("TR"), C("GB"), C("ZM"), // 104-111
- C("ZW"), C("AZ"), C("MR"), C("ML"), C("NE"), C("TD"), C("SD"), C("ER"), // 112-119
- C("DJ"), C("SO"), C("AD"), C("GI"), C("GG"), C("IM"), C("JE"), C("MC"), // 120-127
- C("TW"), 0, 0, 0, 0, 0, 0, 0, // 128-135
- C("KR"), 0, 0, 0, 0, 0, 0, 0, // 136-143
- C("HK"), C("MO"), 0, 0, 0, 0, 0, 0, // 144-151
- C("ID"), C("SG"), C("TH"), C("PH"), C("MY"), 0, 0, 0, // 152-159
- C("CN"), 0, 0, 0, 0, 0, 0, 0, // 160-167
- C("AE"), C("IN"), C("EG"), C("OM"), C("QA"), C("KW"), C("SA"), C("SY"), // 168-175
- C("BH"), C("JO"), 0, 0, 0, 0, 0, 0, // 176-183
- C("SM"), C("VA"), C("BM"), // 184-186
-}};
-
-/**
- * CFG::GetCountryCodeString service function
- * Inputs:
- * 1 : Country Code ID
- * Outputs:
- * 1 : Result of function, 0 on success, otherwise error code
- * 2 : Country's 2-char string
- */
-void GetCountryCodeString(Service::Interface* self);
-
-/**
- * CFG::GetCountryCodeID service function
- * Inputs:
- * 1 : Country Code 2-char string
- * Outputs:
- * 1 : Result of function, 0 on success, otherwise error code
- * 2 : Country Code ID
- */
-void GetCountryCodeID(Service::Interface* self);
-
-u32 GetRegionValue();
-
-/**
- * CFG::SecureInfoGetRegion service function
- * Inputs:
- * 1 : None
- * Outputs:
- * 0 : Result Header code
- * 1 : Result of function, 0 on success, otherwise error code
- * 2 : Region value loaded from SecureInfo offset 0x100
- */
-void SecureInfoGetRegion(Service::Interface* self);
-
-/**
- * CFG::GenHashConsoleUnique service function
- * Inputs:
- * 1 : 20 bit application ID salt
- * Outputs:
- * 0 : Result Header code
- * 1 : Result of function, 0 on success, otherwise error code
- * 2 : Hash/"ID" lower word
- * 3 : Hash/"ID" upper word
- */
-void GenHashConsoleUnique(Service::Interface* self);
-
-/**
- * CFG::GetRegionCanadaUSA service function
- * Inputs:
- * 1 : None
- * Outputs:
- * 0 : Result Header code
- * 1 : Result of function, 0 on success, otherwise error code
- * 2 : 1 if the system is a Canada or USA model, 0 otherwise
- */
-void GetRegionCanadaUSA(Service::Interface* self);
-
-/**
- * CFG::GetSystemModel service function
- * Inputs:
- * 0 : 0x00050000
- * Outputs:
- * 1 : Result of function, 0 on success, otherwise error code
- * 2 : Model of the console
- */
-void GetSystemModel(Service::Interface* self);
-
-/**
- * CFG::GetModelNintendo2DS service function
- * Inputs:
- * 0 : 0x00060000
- * Outputs:
- * 1 : Result of function, 0 on success, otherwise error code
- * 2 : 0 if the system is a Nintendo 2DS, 1 otherwise
- */
-void GetModelNintendo2DS(Service::Interface* self);
-
-/**
- * CFG::GetConfigInfoBlk2 service function
- * Inputs:
- * 0 : 0x00010082
- * 1 : Size
- * 2 : Block ID
- * 3 : Descriptor for the output buffer
- * 4 : Output buffer pointer
- * Outputs:
- * 1 : Result of function, 0 on success, otherwise error code
- */
-void GetConfigInfoBlk2(Service::Interface* self);
-
-/**
- * CFG::GetConfigInfoBlk8 service function
- * Inputs:
- * 0 : 0x04010082 / 0x08010082
- * 1 : Size
- * 2 : Block ID
- * 3 : Descriptor for the output buffer
- * 4 : Output buffer pointer
- * Outputs:
- * 1 : Result of function, 0 on success, otherwise error code
- */
-void GetConfigInfoBlk8(Service::Interface* self);
-
-/**
- * CFG::SetConfigInfoBlk4 service function
- * Inputs:
- * 0 : 0x04020082 / 0x08020082
- * 1 : Block ID
- * 2 : Size
- * 3 : Descriptor for the output buffer
- * 4 : Output buffer pointer
- * Outputs:
- * 1 : Result of function, 0 on success, otherwise error code
- * Note:
- * The parameters order is different from GetConfigInfoBlk2/8's,
- * where Block ID and Size are switched.
- */
-void SetConfigInfoBlk4(Service::Interface* self);
-
-/**
- * CFG::UpdateConfigNANDSavegame service function
- * Inputs:
- * 0 : 0x04030000 / 0x08030000
- * Outputs:
- * 1 : Result of function, 0 on success, otherwise error code
- */
-void UpdateConfigNANDSavegame(Service::Interface* self);
-
-/**
- * CFG::FormatConfig service function
- * Inputs:
- * 0 : 0x08060000
- * Outputs:
- * 1 : Result of function, 0 on success, otherwise error code
- */
-void FormatConfig(Service::Interface* self);
-
-/**
- * Reads a block with the specified id and flag from the Config savegame buffer
- * and writes the output to output. The input size must match exactly the size of the requested
- * block.
- *
- * @param block_id The id of the block we want to read
- * @param size The size of the block we want to read
- * @param flag The requested block must have this flag set
- * @param output A pointer where we will write the read data
- * @returns ResultCode indicating the result of the operation, 0 on success
- */
-ResultCode GetConfigInfoBlock(u32 block_id, u32 size, u32 flag, void* output);
-
-/**
- * Reads data from input and writes to a block with the specified id and flag
- * in the Config savegame buffer. The input size must match exactly the size of the target block.
- *
- * @param block_id The id of the block we want to write
- * @param size The size of the block we want to write
- * @param flag The target block must have this flag set
- * @param input A pointer where we will read data and write to Config savegame buffer
- * @returns ResultCode indicating the result of the operation, 0 on success
- */
-ResultCode SetConfigInfoBlock(u32 block_id, u32 size, u32 flag, const void* input);
-
-/**
- * Creates a block with the specified id and writes the input data to the cfg savegame buffer in
- * memory. The config savegame file in the filesystem is not updated.
- *
- * @param block_id The id of the block we want to create
- * @param size The size of the block we want to create
- * @param flags The flags of the new block
- * @param data A pointer containing the data we will write to the new block
- * @returns ResultCode indicating the result of the operation, 0 on success
- */
-ResultCode CreateConfigInfoBlk(u32 block_id, u16 size, u16 flags, const void* data);
-
-/**
- * Deletes the config savegame file from the filesystem, the buffer in memory is not affected
- * @returns ResultCode indicating the result of the operation, 0 on success
- */
-ResultCode DeleteConfigNANDSaveFile();
-
-/**
- * Writes the config savegame memory buffer to the config savegame file in the filesystem
- * @returns ResultCode indicating the result of the operation, 0 on success
- */
-ResultCode UpdateConfigNANDSavegame();
-
-/**
- * Re-creates the config savegame file in memory and the filesystem with the default blocks
- * @returns ResultCode indicating the result of the operation, 0 on success
- */
-ResultCode FormatConfig();
-
-/**
- * Open the config savegame file and load it to the memory buffer
- * @returns ResultCode indicating the result of the operation, 0 on success
- */
-ResultCode LoadConfigNANDSaveFile();
-
-/// Initialize the config service
-void Init();
-
-/// Shutdown the config service
-void Shutdown();
-
-/**
- * Set the region code preferred by the game so that CFG will adjust to it when the region setting
- * is auto.
- * @param region_code the preferred region code to set
- */
-void SetPreferredRegionCode(u32 region_code);
-
-// Utilities for frontend to set config data.
-// Note: before calling these functions, LoadConfigNANDSaveFile should be called,
-// and UpdateConfigNANDSavegame should be called after making changes to config data.
-
-/**
- * Sets the username in config savegame.
- * @param name the username to set. The maximum size is 10 in char16_t.
- */
-void SetUsername(const std::u16string& name);
-
-/**
- * Gets the username from config savegame.
- * @returns the username
- */
-std::u16string GetUsername();
-
-/**
- * Sets the profile birthday in config savegame.
- * @param month the month of birthday.
- * @param day the day of the birthday.
- */
-void SetBirthday(u8 month, u8 day);
-
-/**
- * Gets the profile birthday from the config savegame.
- * @returns a tuple of (month, day) of birthday
- */
-std::tuple<u8, u8> GetBirthday();
-
-/**
- * Sets the system language in config savegame.
- * @param language the system language to set.
- */
-void SetSystemLanguage(SystemLanguage language);
-
-/**
- * Gets the system language from config savegame.
- * @returns the system language
- */
-SystemLanguage GetSystemLanguage();
-
-/**
- * Sets the sound output mode in config savegame.
- * @param mode the sound output mode to set
- */
-void SetSoundOutputMode(SoundOutputMode mode);
-
-/**
- * Gets the sound output mode from config savegame.
- * @returns the sound output mode
- */
-SoundOutputMode GetSoundOutputMode();
-
-/**
- * Generates a new random console unique id.
- * @param random_number a random generated 16bit number stored at 0x90002, used for generating the
- * console_id
- * @param console_id the randomly created console id
- */
-void GenerateConsoleUniqueId(u32& random_number, u64& console_id);
-
-/**
- * Sets the random_number and the console unique id in the config savegame.
- * @param random_number the random_number to set
- * @param console_id the console id to set
- */
-ResultCode SetConsoleUniqueId(u32 random_number, u64 console_id);
-
-/**
- * Gets the console unique id from config savegame.
- * @returns the console unique id
- */
-u64 GetConsoleUniqueId();
-
-} // namespace CFG
-} // namespace Service
diff --git a/src/core/hle/service/cfg/cfg_i.cpp b/src/core/hle/service/cfg/cfg_i.cpp
deleted file mode 100644
index e8db0fc42..000000000
--- a/src/core/hle/service/cfg/cfg_i.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include "core/hle/service/cfg/cfg.h"
-#include "core/hle/service/cfg/cfg_i.h"
-
-namespace Service {
-namespace CFG {
-
-const Interface::FunctionInfo FunctionTable[] = {
- // cfg common
- {0x00010082, GetConfigInfoBlk2, "GetConfigInfoBlk2"},
- {0x00020000, SecureInfoGetRegion, "SecureInfoGetRegion"},
- {0x00030040, GenHashConsoleUnique, "GenHashConsoleUnique"},
- {0x00040000, GetRegionCanadaUSA, "GetRegionCanadaUSA"},
- {0x00050000, GetSystemModel, "GetSystemModel"},
- {0x00060000, GetModelNintendo2DS, "GetModelNintendo2DS"},
- {0x00070040, nullptr, "WriteToFirstByteCfgSavegame"},
- {0x00080080, nullptr, "GoThroughTable"},
- {0x00090040, GetCountryCodeString, "GetCountryCodeString"},
- {0x000A0040, GetCountryCodeID, "GetCountryCodeID"},
- {0x000B0000, nullptr, "IsFangateSupported"},
- // cfg:i
- {0x04010082, GetConfigInfoBlk8, "GetConfigInfoBlk8"},
- {0x04020082, SetConfigInfoBlk4, "SetConfigInfoBlk4"},
- {0x04030000, UpdateConfigNANDSavegame, "UpdateConfigNANDSavegame"},
- {0x04040042, nullptr, "GetLocalFriendCodeSeedData"},
- {0x04050000, nullptr, "GetLocalFriendCodeSeed"},
- {0x04060000, SecureInfoGetRegion, "SecureInfoGetRegion"},
- {0x04070000, nullptr, "SecureInfoGetByte101"},
- {0x04080042, nullptr, "SecureInfoGetSerialNo"},
- {0x04090000, nullptr, "UpdateConfigBlk00040003"},
- {0x08010082, GetConfigInfoBlk8, "GetConfigInfoBlk8"},
- {0x08020082, SetConfigInfoBlk4, "SetConfigInfoBlk4"},
- {0x08030000, UpdateConfigNANDSavegame, "UpdateConfigNANDSavegame"},
- {0x080400C2, nullptr, "CreateConfigInfoBlk"},
- {0x08050000, nullptr, "DeleteConfigNANDSavefile"},
- {0x08060000, FormatConfig, "FormatConfig"},
- {0x08080000, nullptr, "UpdateConfigBlk1"},
- {0x08090000, nullptr, "UpdateConfigBlk2"},
- {0x080A0000, nullptr, "UpdateConfigBlk3"},
- {0x080B0082, nullptr, "SetGetLocalFriendCodeSeedData"},
- {0x080C0042, nullptr, "SetLocalFriendCodeSeedSignature"},
- {0x080D0000, nullptr, "DeleteCreateNANDLocalFriendCodeSeed"},
- {0x080E0000, nullptr, "VerifySigLocalFriendCodeSeed"},
- {0x080F0042, nullptr, "GetLocalFriendCodeSeedData"},
- {0x08100000, nullptr, "GetLocalFriendCodeSeed"},
- {0x08110084, nullptr, "SetSecureInfo"},
- {0x08120000, nullptr, "DeleteCreateNANDSecureInfo"},
- {0x08130000, nullptr, "VerifySigSecureInfo"},
- {0x08140042, nullptr, "SecureInfoGetData"},
- {0x08150042, nullptr, "SecureInfoGetSignature"},
- {0x08160000, SecureInfoGetRegion, "SecureInfoGetRegion"},
- {0x08170000, nullptr, "SecureInfoGetByte101"},
- {0x08180042, nullptr, "SecureInfoGetSerialNo"},
-};
-
-CFG_I::CFG_I() {
- Register(FunctionTable);
-}
-
-} // namespace CFG
-} // namespace Service \ No newline at end of file
diff --git a/src/core/hle/service/cfg/cfg_i.h b/src/core/hle/service/cfg/cfg_i.h
deleted file mode 100644
index 8cfd47633..000000000
--- a/src/core/hle/service/cfg/cfg_i.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include "core/hle/service/service.h"
-
-namespace Service {
-namespace CFG {
-
-class CFG_I final : public Interface {
-public:
- CFG_I();
-
- std::string GetPortName() const override {
- return "cfg:i";
- }
-};
-
-} // namespace CFG
-} // namespace Service \ No newline at end of file
diff --git a/src/core/hle/service/cfg/cfg_nor.cpp b/src/core/hle/service/cfg/cfg_nor.cpp
deleted file mode 100644
index 4ce02d115..000000000
--- a/src/core/hle/service/cfg/cfg_nor.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include "core/hle/service/cfg/cfg.h"
-#include "core/hle/service/cfg/cfg_nor.h"
-
-namespace Service {
-namespace CFG {
-
-const Interface::FunctionInfo FunctionTable[] = {
- {0x00010040, nullptr, "Initialize"},
- {0x00020000, nullptr, "Shutdown"},
- {0x00050082, nullptr, "ReadData"},
- {0x00060082, nullptr, "WriteData"},
-};
-
-CFG_NOR::CFG_NOR() {
- Register(FunctionTable);
-}
-
-} // namespace CFG
-} // namespace Service
diff --git a/src/core/hle/service/cfg/cfg_nor.h b/src/core/hle/service/cfg/cfg_nor.h
deleted file mode 100644
index c337718e7..000000000
--- a/src/core/hle/service/cfg/cfg_nor.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include "core/hle/service/service.h"
-
-namespace Service {
-namespace CFG {
-
-class CFG_NOR final : public Interface {
-public:
- CFG_NOR();
-
- std::string GetPortName() const override {
- return "cfg:nor";
- }
-};
-
-} // namespace CFG
-} // namespace Service
diff --git a/src/core/hle/service/cfg/cfg_s.cpp b/src/core/hle/service/cfg/cfg_s.cpp
deleted file mode 100644
index 9386fe33d..000000000
--- a/src/core/hle/service/cfg/cfg_s.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2015 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include "core/hle/service/cfg/cfg.h"
-#include "core/hle/service/cfg/cfg_s.h"
-
-namespace Service {
-namespace CFG {
-
-const Interface::FunctionInfo FunctionTable[] = {
- // cfg common
- {0x00010082, GetConfigInfoBlk2, "GetConfigInfoBlk2"},
- {0x00020000, SecureInfoGetRegion, "SecureInfoGetRegion"},
- {0x00030040, GenHashConsoleUnique, "GenHashConsoleUnique"},
- {0x00040000, GetRegionCanadaUSA, "GetRegionCanadaUSA"},
- {0x00050000, GetSystemModel, "GetSystemModel"},
- {0x00060000, GetModelNintendo2DS, "GetModelNintendo2DS"},
- {0x00070040, nullptr, "WriteToFirstByteCfgSavegame"},
- {0x00080080, nullptr, "GoThroughTable"},
- {0x00090040, GetCountryCodeString, "GetCountryCodeString"},
- {0x000A0040, GetCountryCodeID, "GetCountryCodeID"},
- {0x000B0000, nullptr, "IsFangateSupported"},
- // cfg:s
- {0x04010082, GetConfigInfoBlk8, "GetConfigInfoBlk8"},
- {0x04020082, SetConfigInfoBlk4, "SetConfigInfoBlk4"},
- {0x04030000, UpdateConfigNANDSavegame, "UpdateConfigNANDSavegame"},
- {0x04040042, nullptr, "GetLocalFriendCodeSeedData"},
- {0x04050000, nullptr, "GetLocalFriendCodeSeed"},
- {0x04060000, nullptr, "SecureInfoGetRegion"},
- {0x04070000, nullptr, "SecureInfoGetByte101"},
- {0x04080042, nullptr, "SecureInfoGetSerialNo"},
- {0x04090000, nullptr, "UpdateConfigBlk00040003"},
-};
-
-CFG_S::CFG_S() {
- Register(FunctionTable);
-}
-
-} // namespace CFG
-} // namespace Service
diff --git a/src/core/hle/service/cfg/cfg_s.h b/src/core/hle/service/cfg/cfg_s.h
deleted file mode 100644
index 99fea46ee..000000000
--- a/src/core/hle/service/cfg/cfg_s.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2015 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include "core/hle/service/service.h"
-
-namespace Service {
-namespace CFG {
-
-class CFG_S final : public Interface {
-public:
- CFG_S();
-
- std::string GetPortName() const override {
- return "cfg:s";
- }
-};
-
-} // namespace CFG
-} // namespace Service
diff --git a/src/core/hle/service/cfg/cfg_u.cpp b/src/core/hle/service/cfg/cfg_u.cpp
deleted file mode 100644
index 7b66fee22..000000000
--- a/src/core/hle/service/cfg/cfg_u.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include "core/hle/service/cfg/cfg.h"
-#include "core/hle/service/cfg/cfg_u.h"
-
-namespace Service {
-namespace CFG {
-
-const Interface::FunctionInfo FunctionTable[] = {
- // cfg common
- {0x00010082, GetConfigInfoBlk2, "GetConfigInfoBlk2"},
- {0x00020000, SecureInfoGetRegion, "SecureInfoGetRegion"},
- {0x00030040, GenHashConsoleUnique, "GenHashConsoleUnique"},
- {0x00040000, GetRegionCanadaUSA, "GetRegionCanadaUSA"},
- {0x00050000, GetSystemModel, "GetSystemModel"},
- {0x00060000, GetModelNintendo2DS, "GetModelNintendo2DS"},
- {0x00070040, nullptr, "WriteToFirstByteCfgSavegame"},
- {0x00080080, nullptr, "GoThroughTable"},
- {0x00090040, GetCountryCodeString, "GetCountryCodeString"},
- {0x000A0040, GetCountryCodeID, "GetCountryCodeID"},
- {0x000B0000, nullptr, "IsFangateSupported"},
-};
-
-CFG_U::CFG_U() {
- Register(FunctionTable);
-}
-
-} // namespace CFG
-} // namespace Service
diff --git a/src/core/hle/service/cfg/cfg_u.h b/src/core/hle/service/cfg/cfg_u.h
deleted file mode 100644
index fc7844714..000000000
--- a/src/core/hle/service/cfg/cfg_u.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include "core/hle/service/service.h"
-
-namespace Service {
-namespace CFG {
-
-class CFG_U final : public Interface {
-public:
- CFG_U();
-
- std::string GetPortName() const override {
- return "cfg:u";
- }
-};
-
-} // namespace CFG
-} // namespace Service