summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/file_util.cpp2
-rw-r--r--src/core/file_sys/disk_archive.cpp6
-rw-r--r--src/core/hle/service/cfg/cfg.cpp20
3 files changed, 22 insertions, 6 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index 052c0ecd6..c3061479a 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -457,7 +457,7 @@ bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string &directo
457 if (virtual_name == "." || virtual_name == "..") 457 if (virtual_name == "." || virtual_name == "..")
458 continue; 458 continue;
459 459
460 unsigned ret_entries; 460 unsigned ret_entries = 0;
461 if (!callback(&ret_entries, directory, virtual_name)) { 461 if (!callback(&ret_entries, directory, virtual_name)) {
462 callback_error = true; 462 callback_error = true;
463 break; 463 break;
diff --git a/src/core/file_sys/disk_archive.cpp b/src/core/file_sys/disk_archive.cpp
index 0ba502200..a51416774 100644
--- a/src/core/file_sys/disk_archive.cpp
+++ b/src/core/file_sys/disk_archive.cpp
@@ -139,7 +139,7 @@ bool DiskFile::Close() const {
139 139
140//////////////////////////////////////////////////////////////////////////////////////////////////// 140////////////////////////////////////////////////////////////////////////////////////////////////////
141 141
142DiskDirectory::DiskDirectory(const DiskArchive& archive, const Path& path) { 142DiskDirectory::DiskDirectory(const DiskArchive& archive, const Path& path) : directory() {
143 // TODO(Link Mauve): normalize path into an absolute path without "..", it can currently bypass 143 // TODO(Link Mauve): normalize path into an absolute path without "..", it can currently bypass
144 // the root directory we set while opening the archive. 144 // the root directory we set while opening the archive.
145 // For example, opening /../../usr/bin can give the emulated program your installed programs. 145 // For example, opening /../../usr/bin can give the emulated program your installed programs.
@@ -149,7 +149,9 @@ DiskDirectory::DiskDirectory(const DiskArchive& archive, const Path& path) {
149bool DiskDirectory::Open() { 149bool DiskDirectory::Open() {
150 if (!FileUtil::IsDirectory(path)) 150 if (!FileUtil::IsDirectory(path))
151 return false; 151 return false;
152 FileUtil::ScanDirectoryTree(path, directory); 152 unsigned size = FileUtil::ScanDirectoryTree(path, directory);
153 directory.size = size;
154 directory.isDirectory = true;
153 children_iterator = directory.children.begin(); 155 children_iterator = directory.children.begin();
154 return true; 156 return true;
155} 157}
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp
index 7556aa6a5..4c82a58e4 100644
--- a/src/core/hle/service/cfg/cfg.cpp
+++ b/src/core/hle/service/cfg/cfg.cpp
@@ -4,9 +4,10 @@
4 4
5#include <algorithm> 5#include <algorithm>
6 6
7#include "common/file_util.h"
7#include "common/logging/log.h" 8#include "common/logging/log.h"
8#include "common/string_util.h" 9#include "common/string_util.h"
9#include "common/file_util.h" 10#include "common/swap.h"
10 11
11#include "core/file_sys/archive_systemsavedata.h" 12#include "core/file_sys/archive_systemsavedata.h"
12#include "core/file_sys/file_backend.h" 13#include "core/file_sys/file_backend.h"
@@ -334,6 +335,18 @@ ResultCode FormatConfig() {
334 res = CreateConfigInfoBlk(0x000A0000, sizeof(CONSOLE_USERNAME_BLOCK), 0xE, &CONSOLE_USERNAME_BLOCK); 335 res = CreateConfigInfoBlk(0x000A0000, sizeof(CONSOLE_USERNAME_BLOCK), 0xE, &CONSOLE_USERNAME_BLOCK);
335 if (!res.IsSuccess()) return res; 336 if (!res.IsSuccess()) return res;
336 337
338 // 0x000A0000 - Profile username
339 struct {
340 u16_le username[10];
341 u8 unused[4];
342 u32_le wordfilter_version; // Unused by Citra
343 } profile_username = {};
344
345 std::u16string username_string = Common::UTF8ToUTF16("Citra");
346 std::copy(username_string.cbegin(), username_string.cend(), profile_username.username);
347 res = CreateConfigInfoBlk(0x000A0000, sizeof(profile_username), 0xE, &profile_username);
348 if (!res.IsSuccess()) return res;
349
337 // 0x000A0001 - Profile birthday 350 // 0x000A0001 - Profile birthday
338 const u8 profile_birthday[2] = {3, 25}; // March 25th, 2014 351 const u8 profile_birthday[2] = {3, 25}; // March 25th, 2014
339 res = CreateConfigInfoBlk(0x000A0001, sizeof(profile_birthday), 0xE, profile_birthday); 352 res = CreateConfigInfoBlk(0x000A0001, sizeof(profile_birthday), 0xE, profile_birthday);
@@ -344,9 +357,10 @@ ResultCode FormatConfig() {
344 res = CreateConfigInfoBlk(0x000B0000, sizeof(COUNTRY_INFO), 0xE, &COUNTRY_INFO); 357 res = CreateConfigInfoBlk(0x000B0000, sizeof(COUNTRY_INFO), 0xE, &COUNTRY_INFO);
345 if (!res.IsSuccess()) return res; 358 if (!res.IsSuccess()) return res;
346 359
347 char16_t country_name_buffer[16][0x40] = {}; 360 u16_le country_name_buffer[16][0x40] = {};
361 std::u16string region_name = Common::UTF8ToUTF16("Gensokyo");
348 for (size_t i = 0; i < 16; ++i) { 362 for (size_t i = 0; i < 16; ++i) {
349 Common::UTF8ToUTF16("Gensokyo").copy(country_name_buffer[i], 0x40); 363 std::copy(region_name.cbegin(), region_name.cend(), country_name_buffer[i]);
350 } 364 }
351 // 0x000B0001 - Localized names for the profile Country 365 // 0x000B0001 - Localized names for the profile Country
352 res = CreateConfigInfoBlk(0x000B0001, sizeof(country_name_buffer), 0xE, country_name_buffer); 366 res = CreateConfigInfoBlk(0x000B0001, sizeof(country_name_buffer), 0xE, country_name_buffer);