diff options
Diffstat (limited to 'src')
36 files changed, 334 insertions, 167 deletions
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index 40e40f192..b12369136 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <string> | 5 | #include <string> |
| 6 | #include <thread> | 6 | #include <thread> |
| 7 | #include <iostream> | 7 | #include <iostream> |
| 8 | #include <memory> | ||
| 8 | 9 | ||
| 9 | // This needs to be included before getopt.h because the latter #defines symbols used by it | 10 | // This needs to be included before getopt.h because the latter #defines symbols used by it |
| 10 | #include "common/microprofile.h" | 11 | #include "common/microprofile.h" |
| @@ -19,7 +20,6 @@ | |||
| 19 | #include "common/logging/log.h" | 20 | #include "common/logging/log.h" |
| 20 | #include "common/logging/backend.h" | 21 | #include "common/logging/backend.h" |
| 21 | #include "common/logging/filter.h" | 22 | #include "common/logging/filter.h" |
| 22 | #include "common/make_unique.h" | ||
| 23 | #include "common/scope_exit.h" | 23 | #include "common/scope_exit.h" |
| 24 | 24 | ||
| 25 | #include "core/settings.h" | 25 | #include "core/settings.h" |
| @@ -79,7 +79,7 @@ int main(int argc, char **argv) { | |||
| 79 | GDBStub::ToggleServer(Settings::values.use_gdbstub); | 79 | GDBStub::ToggleServer(Settings::values.use_gdbstub); |
| 80 | GDBStub::SetServerPort(static_cast<u32>(Settings::values.gdbstub_port)); | 80 | GDBStub::SetServerPort(static_cast<u32>(Settings::values.gdbstub_port)); |
| 81 | 81 | ||
| 82 | std::unique_ptr<EmuWindow_SDL2> emu_window = Common::make_unique<EmuWindow_SDL2>(); | 82 | std::unique_ptr<EmuWindow_SDL2> emu_window = std::make_unique<EmuWindow_SDL2>(); |
| 83 | 83 | ||
| 84 | VideoCore::g_hw_renderer_enabled = Settings::values.use_hw_renderer; | 84 | VideoCore::g_hw_renderer_enabled = Settings::values.use_hw_renderer; |
| 85 | VideoCore::g_shader_jit_enabled = Settings::values.use_shader_jit; | 85 | VideoCore::g_shader_jit_enabled = Settings::values.use_shader_jit; |
diff --git a/src/citra/config.cpp b/src/citra/config.cpp index 9034b188e..6b6617352 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <memory> | ||
| 6 | |||
| 5 | #include <inih/cpp/INIReader.h> | 7 | #include <inih/cpp/INIReader.h> |
| 6 | 8 | ||
| 7 | #include <SDL.h> | 9 | #include <SDL.h> |
| @@ -10,7 +12,6 @@ | |||
| 10 | 12 | ||
| 11 | #include "common/file_util.h" | 13 | #include "common/file_util.h" |
| 12 | #include "common/logging/log.h" | 14 | #include "common/logging/log.h" |
| 13 | #include "common/make_unique.h" | ||
| 14 | 15 | ||
| 15 | #include "core/settings.h" | 16 | #include "core/settings.h" |
| 16 | 17 | ||
| @@ -19,7 +20,7 @@ | |||
| 19 | Config::Config() { | 20 | Config::Config() { |
| 20 | // TODO: Don't hardcode the path; let the frontend decide where to put the config files. | 21 | // TODO: Don't hardcode the path; let the frontend decide where to put the config files. |
| 21 | sdl2_config_loc = FileUtil::GetUserPath(D_CONFIG_IDX) + "sdl2-config.ini"; | 22 | sdl2_config_loc = FileUtil::GetUserPath(D_CONFIG_IDX) + "sdl2-config.ini"; |
| 22 | sdl2_config = Common::make_unique<INIReader>(sdl2_config_loc); | 23 | sdl2_config = std::make_unique<INIReader>(sdl2_config_loc); |
| 23 | 24 | ||
| 24 | Reload(); | 25 | Reload(); |
| 25 | } | 26 | } |
| @@ -31,7 +32,7 @@ bool Config::LoadINI(const std::string& default_contents, bool retry) { | |||
| 31 | LOG_WARNING(Config, "Failed to load %s. Creating file from defaults...", location); | 32 | LOG_WARNING(Config, "Failed to load %s. Creating file from defaults...", location); |
| 32 | FileUtil::CreateFullPath(location); | 33 | FileUtil::CreateFullPath(location); |
| 33 | FileUtil::WriteStringToFile(true, default_contents, location); | 34 | FileUtil::WriteStringToFile(true, default_contents, location); |
| 34 | sdl2_config = Common::make_unique<INIReader>(location); // Reopen file | 35 | sdl2_config = std::make_unique<INIReader>(location); // Reopen file |
| 35 | 36 | ||
| 36 | return LoadINI(default_contents, false); | 37 | return LoadINI(default_contents, false); |
| 37 | } | 38 | } |
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp index d1a19ade9..8e247ff5c 100644 --- a/src/citra_qt/config.cpp +++ b/src/citra_qt/config.cpp | |||
| @@ -16,7 +16,7 @@ Config::Config() { | |||
| 16 | // TODO: Don't hardcode the path; let the frontend decide where to put the config files. | 16 | // TODO: Don't hardcode the path; let the frontend decide where to put the config files. |
| 17 | qt_config_loc = FileUtil::GetUserPath(D_CONFIG_IDX) + "qt-config.ini"; | 17 | qt_config_loc = FileUtil::GetUserPath(D_CONFIG_IDX) + "qt-config.ini"; |
| 18 | FileUtil::CreateFullPath(qt_config_loc); | 18 | FileUtil::CreateFullPath(qt_config_loc); |
| 19 | qt_config = new QSettings(QString::fromLocal8Bit(qt_config_loc.c_str()), QSettings::IniFormat); | 19 | qt_config = new QSettings(QString::fromStdString(qt_config_loc), QSettings::IniFormat); |
| 20 | 20 | ||
| 21 | Reload(); | 21 | Reload(); |
| 22 | } | 22 | } |
diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp index a0b216b0a..ffcab1f03 100644 --- a/src/citra_qt/game_list.cpp +++ b/src/citra_qt/game_list.cpp | |||
| @@ -66,7 +66,7 @@ void GameList::ValidateEntry(const QModelIndex& item) | |||
| 66 | 66 | ||
| 67 | if (file_path.isEmpty()) | 67 | if (file_path.isEmpty()) |
| 68 | return; | 68 | return; |
| 69 | std::string std_file_path(file_path.toLocal8Bit()); | 69 | std::string std_file_path(file_path.toStdString()); |
| 70 | if (!FileUtil::Exists(std_file_path) || FileUtil::IsDirectory(std_file_path)) | 70 | if (!FileUtil::Exists(std_file_path) || FileUtil::IsDirectory(std_file_path)) |
| 71 | return; | 71 | return; |
| 72 | emit GameChosen(file_path); | 72 | emit GameChosen(file_path); |
| @@ -148,7 +148,7 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, bool d | |||
| 148 | 148 | ||
| 149 | emit EntryReady({ | 149 | emit EntryReady({ |
| 150 | new GameListItem(QString::fromStdString(Loader::GetFileTypeString(filetype))), | 150 | new GameListItem(QString::fromStdString(Loader::GetFileTypeString(filetype))), |
| 151 | new GameListItemPath(QString::fromLocal8Bit(physical_name.c_str())), | 151 | new GameListItemPath(QString::fromStdString(physical_name)), |
| 152 | new GameListItemSize(FileUtil::GetSize(physical_name)), | 152 | new GameListItemSize(FileUtil::GetSize(physical_name)), |
| 153 | }); | 153 | }); |
| 154 | } | 154 | } |
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 32cceaf7e..ca0ae6f7b 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <clocale> | 5 | #include <clocale> |
| 6 | #include <memory> | ||
| 6 | #include <thread> | 7 | #include <thread> |
| 7 | 8 | ||
| 8 | #include <QDesktopWidget> | 9 | #include <QDesktopWidget> |
| @@ -30,7 +31,6 @@ | |||
| 30 | #include "citra_qt/debugger/ramview.h" | 31 | #include "citra_qt/debugger/ramview.h" |
| 31 | #include "citra_qt/debugger/registers.h" | 32 | #include "citra_qt/debugger/registers.h" |
| 32 | 33 | ||
| 33 | #include "common/make_unique.h" | ||
| 34 | #include "common/microprofile.h" | 34 | #include "common/microprofile.h" |
| 35 | #include "common/platform.h" | 35 | #include "common/platform.h" |
| 36 | #include "common/scm_rev.h" | 36 | #include "common/scm_rev.h" |
| @@ -319,7 +319,7 @@ void GMainWindow::BootGame(const std::string& filename) { | |||
| 319 | return; | 319 | return; |
| 320 | 320 | ||
| 321 | // Create and start the emulation thread | 321 | // Create and start the emulation thread |
| 322 | emu_thread = Common::make_unique<EmuThread>(render_window); | 322 | emu_thread = std::make_unique<EmuThread>(render_window); |
| 323 | emit EmulationStarting(emu_thread.get()); | 323 | emit EmulationStarting(emu_thread.get()); |
| 324 | render_window->moveContext(); | 324 | render_window->moveContext(); |
| 325 | emu_thread->start(); | 325 | emu_thread->start(); |
| @@ -417,7 +417,7 @@ void GMainWindow::UpdateRecentFiles() { | |||
| 417 | } | 417 | } |
| 418 | 418 | ||
| 419 | void GMainWindow::OnGameListLoadFile(QString game_path) { | 419 | void GMainWindow::OnGameListLoadFile(QString game_path) { |
| 420 | BootGame(game_path.toLocal8Bit().data()); | 420 | BootGame(game_path.toStdString()); |
| 421 | } | 421 | } |
| 422 | 422 | ||
| 423 | void GMainWindow::OnMenuLoadFile() { | 423 | void GMainWindow::OnMenuLoadFile() { |
| @@ -428,7 +428,7 @@ void GMainWindow::OnMenuLoadFile() { | |||
| 428 | if (!filename.isEmpty()) { | 428 | if (!filename.isEmpty()) { |
| 429 | settings.setValue("romsPath", QFileInfo(filename).path()); | 429 | settings.setValue("romsPath", QFileInfo(filename).path()); |
| 430 | 430 | ||
| 431 | BootGame(filename.toLocal8Bit().data()); | 431 | BootGame(filename.toStdString()); |
| 432 | } | 432 | } |
| 433 | } | 433 | } |
| 434 | 434 | ||
| @@ -440,7 +440,7 @@ void GMainWindow::OnMenuLoadSymbolMap() { | |||
| 440 | if (!filename.isEmpty()) { | 440 | if (!filename.isEmpty()) { |
| 441 | settings.setValue("symbolsPath", QFileInfo(filename).path()); | 441 | settings.setValue("symbolsPath", QFileInfo(filename).path()); |
| 442 | 442 | ||
| 443 | LoadSymbolMap(filename.toLocal8Bit().data()); | 443 | LoadSymbolMap(filename.toStdString()); |
| 444 | } | 444 | } |
| 445 | } | 445 | } |
| 446 | 446 | ||
| @@ -461,7 +461,7 @@ void GMainWindow::OnMenuRecentFile() { | |||
| 461 | QString filename = action->data().toString(); | 461 | QString filename = action->data().toString(); |
| 462 | QFileInfo file_info(filename); | 462 | QFileInfo file_info(filename); |
| 463 | if (file_info.exists()) { | 463 | if (file_info.exists()) { |
| 464 | BootGame(filename.toLocal8Bit().data()); | 464 | BootGame(filename.toStdString()); |
| 465 | } else { | 465 | } else { |
| 466 | // Display an error message and remove the file from the list. | 466 | // Display an error message and remove the file from the list. |
| 467 | QMessageBox::information(this, tr("File not found"), tr("File \"%1\" not found").arg(filename)); | 467 | QMessageBox::information(this, tr("File not found"), tr("File \"%1\" not found").arg(filename)); |
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 1c9be718f..c839ce173 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -42,7 +42,6 @@ set(HEADERS | |||
| 42 | logging/filter.h | 42 | logging/filter.h |
| 43 | logging/log.h | 43 | logging/log.h |
| 44 | logging/backend.h | 44 | logging/backend.h |
| 45 | make_unique.h | ||
| 46 | math_util.h | 45 | math_util.h |
| 47 | memory_util.h | 46 | memory_util.h |
| 48 | microprofile.h | 47 | microprofile.h |
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index c3061479a..9ada09f8a 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp | |||
| @@ -85,7 +85,7 @@ bool Exists(const std::string &filename) | |||
| 85 | StripTailDirSlashes(copy); | 85 | StripTailDirSlashes(copy); |
| 86 | 86 | ||
| 87 | #ifdef _WIN32 | 87 | #ifdef _WIN32 |
| 88 | int result = _tstat64(Common::UTF8ToTStr(copy).c_str(), &file_info); | 88 | int result = _wstat64(Common::UTF8ToUTF16W(copy).c_str(), &file_info); |
| 89 | #else | 89 | #else |
| 90 | int result = stat64(copy.c_str(), &file_info); | 90 | int result = stat64(copy.c_str(), &file_info); |
| 91 | #endif | 91 | #endif |
| @@ -102,7 +102,7 @@ bool IsDirectory(const std::string &filename) | |||
| 102 | StripTailDirSlashes(copy); | 102 | StripTailDirSlashes(copy); |
| 103 | 103 | ||
| 104 | #ifdef _WIN32 | 104 | #ifdef _WIN32 |
| 105 | int result = _tstat64(Common::UTF8ToTStr(copy).c_str(), &file_info); | 105 | int result = _wstat64(Common::UTF8ToUTF16W(copy).c_str(), &file_info); |
| 106 | #else | 106 | #else |
| 107 | int result = stat64(copy.c_str(), &file_info); | 107 | int result = stat64(copy.c_str(), &file_info); |
| 108 | #endif | 108 | #endif |
| @@ -138,7 +138,7 @@ bool Delete(const std::string &filename) | |||
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | #ifdef _WIN32 | 140 | #ifdef _WIN32 |
| 141 | if (!DeleteFile(Common::UTF8ToTStr(filename).c_str())) | 141 | if (!DeleteFileW(Common::UTF8ToUTF16W(filename).c_str())) |
| 142 | { | 142 | { |
| 143 | LOG_ERROR(Common_Filesystem, "DeleteFile failed on %s: %s", | 143 | LOG_ERROR(Common_Filesystem, "DeleteFile failed on %s: %s", |
| 144 | filename.c_str(), GetLastErrorMsg()); | 144 | filename.c_str(), GetLastErrorMsg()); |
| @@ -160,7 +160,7 @@ bool CreateDir(const std::string &path) | |||
| 160 | { | 160 | { |
| 161 | LOG_TRACE(Common_Filesystem, "directory %s", path.c_str()); | 161 | LOG_TRACE(Common_Filesystem, "directory %s", path.c_str()); |
| 162 | #ifdef _WIN32 | 162 | #ifdef _WIN32 |
| 163 | if (::CreateDirectory(Common::UTF8ToTStr(path).c_str(), nullptr)) | 163 | if (::CreateDirectoryW(Common::UTF8ToUTF16W(path).c_str(), nullptr)) |
| 164 | return true; | 164 | return true; |
| 165 | DWORD error = GetLastError(); | 165 | DWORD error = GetLastError(); |
| 166 | if (error == ERROR_ALREADY_EXISTS) | 166 | if (error == ERROR_ALREADY_EXISTS) |
| @@ -241,7 +241,7 @@ bool DeleteDir(const std::string &filename) | |||
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | #ifdef _WIN32 | 243 | #ifdef _WIN32 |
| 244 | if (::RemoveDirectory(Common::UTF8ToTStr(filename).c_str())) | 244 | if (::RemoveDirectoryW(Common::UTF8ToUTF16W(filename).c_str())) |
| 245 | return true; | 245 | return true; |
| 246 | #else | 246 | #else |
| 247 | if (rmdir(filename.c_str()) == 0) | 247 | if (rmdir(filename.c_str()) == 0) |
| @@ -257,8 +257,13 @@ bool Rename(const std::string &srcFilename, const std::string &destFilename) | |||
| 257 | { | 257 | { |
| 258 | LOG_TRACE(Common_Filesystem, "%s --> %s", | 258 | LOG_TRACE(Common_Filesystem, "%s --> %s", |
| 259 | srcFilename.c_str(), destFilename.c_str()); | 259 | srcFilename.c_str(), destFilename.c_str()); |
| 260 | #ifdef _WIN32 | ||
| 261 | if (_wrename(Common::UTF8ToUTF16W(srcFilename).c_str(), Common::UTF8ToUTF16W(destFilename).c_str()) == 0) | ||
| 262 | return true; | ||
| 263 | #else | ||
| 260 | if (rename(srcFilename.c_str(), destFilename.c_str()) == 0) | 264 | if (rename(srcFilename.c_str(), destFilename.c_str()) == 0) |
| 261 | return true; | 265 | return true; |
| 266 | #endif | ||
| 262 | LOG_ERROR(Common_Filesystem, "failed %s --> %s: %s", | 267 | LOG_ERROR(Common_Filesystem, "failed %s --> %s: %s", |
| 263 | srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); | 268 | srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); |
| 264 | return false; | 269 | return false; |
| @@ -270,7 +275,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) | |||
| 270 | LOG_TRACE(Common_Filesystem, "%s --> %s", | 275 | LOG_TRACE(Common_Filesystem, "%s --> %s", |
| 271 | srcFilename.c_str(), destFilename.c_str()); | 276 | srcFilename.c_str(), destFilename.c_str()); |
| 272 | #ifdef _WIN32 | 277 | #ifdef _WIN32 |
| 273 | if (CopyFile(Common::UTF8ToTStr(srcFilename).c_str(), Common::UTF8ToTStr(destFilename).c_str(), FALSE)) | 278 | if (CopyFileW(Common::UTF8ToUTF16W(srcFilename).c_str(), Common::UTF8ToUTF16W(destFilename).c_str(), FALSE)) |
| 274 | return true; | 279 | return true; |
| 275 | 280 | ||
| 276 | LOG_ERROR(Common_Filesystem, "failed %s --> %s: %s", | 281 | LOG_ERROR(Common_Filesystem, "failed %s --> %s: %s", |
| @@ -358,7 +363,7 @@ u64 GetSize(const std::string &filename) | |||
| 358 | 363 | ||
| 359 | struct stat64 buf; | 364 | struct stat64 buf; |
| 360 | #ifdef _WIN32 | 365 | #ifdef _WIN32 |
| 361 | if (_tstat64(Common::UTF8ToTStr(filename).c_str(), &buf) == 0) | 366 | if (_wstat64(Common::UTF8ToUTF16W(filename).c_str(), &buf) == 0) |
| 362 | #else | 367 | #else |
| 363 | if (stat64(filename.c_str(), &buf) == 0) | 368 | if (stat64(filename.c_str(), &buf) == 0) |
| 364 | #endif | 369 | #endif |
| @@ -432,16 +437,16 @@ bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string &directo | |||
| 432 | 437 | ||
| 433 | #ifdef _WIN32 | 438 | #ifdef _WIN32 |
| 434 | // Find the first file in the directory. | 439 | // Find the first file in the directory. |
| 435 | WIN32_FIND_DATA ffd; | 440 | WIN32_FIND_DATAW ffd; |
| 436 | 441 | ||
| 437 | HANDLE handle_find = FindFirstFile(Common::UTF8ToTStr(directory + "\\*").c_str(), &ffd); | 442 | HANDLE handle_find = FindFirstFileW(Common::UTF8ToUTF16W(directory + "\\*").c_str(), &ffd); |
| 438 | if (handle_find == INVALID_HANDLE_VALUE) { | 443 | if (handle_find == INVALID_HANDLE_VALUE) { |
| 439 | FindClose(handle_find); | 444 | FindClose(handle_find); |
| 440 | return false; | 445 | return false; |
| 441 | } | 446 | } |
| 442 | // windows loop | 447 | // windows loop |
| 443 | do { | 448 | do { |
| 444 | const std::string virtual_name(Common::TStrToUTF8(ffd.cFileName)); | 449 | const std::string virtual_name(Common::UTF16ToUTF8(ffd.cFileName)); |
| 445 | #else | 450 | #else |
| 446 | struct dirent dirent, *result = nullptr; | 451 | struct dirent dirent, *result = nullptr; |
| 447 | 452 | ||
| @@ -465,7 +470,7 @@ bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string &directo | |||
| 465 | found_entries += ret_entries; | 470 | found_entries += ret_entries; |
| 466 | 471 | ||
| 467 | #ifdef _WIN32 | 472 | #ifdef _WIN32 |
| 468 | } while (FindNextFile(handle_find, &ffd) != 0); | 473 | } while (FindNextFileW(handle_find, &ffd) != 0); |
| 469 | FindClose(handle_find); | 474 | FindClose(handle_find); |
| 470 | #else | 475 | #else |
| 471 | } | 476 | } |
| @@ -572,15 +577,23 @@ void CopyDir(const std::string &source_path, const std::string &dest_path) | |||
| 572 | // Returns the current directory | 577 | // Returns the current directory |
| 573 | std::string GetCurrentDir() | 578 | std::string GetCurrentDir() |
| 574 | { | 579 | { |
| 575 | char *dir; | ||
| 576 | // Get the current working directory (getcwd uses malloc) | 580 | // Get the current working directory (getcwd uses malloc) |
| 581 | #ifdef _WIN32 | ||
| 582 | wchar_t *dir; | ||
| 583 | if (!(dir = _wgetcwd(nullptr, 0))) { | ||
| 584 | #else | ||
| 585 | char *dir; | ||
| 577 | if (!(dir = getcwd(nullptr, 0))) { | 586 | if (!(dir = getcwd(nullptr, 0))) { |
| 578 | 587 | #endif | |
| 579 | LOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: %s", | 588 | LOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: %s", |
| 580 | GetLastErrorMsg()); | 589 | GetLastErrorMsg()); |
| 581 | return nullptr; | 590 | return nullptr; |
| 582 | } | 591 | } |
| 592 | #ifdef _WIN32 | ||
| 593 | std::string strDir = Common::UTF16ToUTF8(dir); | ||
| 594 | #else | ||
| 583 | std::string strDir = dir; | 595 | std::string strDir = dir; |
| 596 | #endif | ||
| 584 | free(dir); | 597 | free(dir); |
| 585 | return strDir; | 598 | return strDir; |
| 586 | } | 599 | } |
| @@ -588,7 +601,11 @@ std::string GetCurrentDir() | |||
| 588 | // Sets the current directory to the given directory | 601 | // Sets the current directory to the given directory |
| 589 | bool SetCurrentDir(const std::string &directory) | 602 | bool SetCurrentDir(const std::string &directory) |
| 590 | { | 603 | { |
| 604 | #ifdef _WIN32 | ||
| 605 | return _wchdir(Common::UTF8ToUTF16W(directory).c_str()) == 0; | ||
| 606 | #else | ||
| 591 | return chdir(directory.c_str()) == 0; | 607 | return chdir(directory.c_str()) == 0; |
| 608 | #endif | ||
| 592 | } | 609 | } |
| 593 | 610 | ||
| 594 | #if defined(__APPLE__) | 611 | #if defined(__APPLE__) |
| @@ -613,9 +630,9 @@ std::string& GetExeDirectory() | |||
| 613 | static std::string exe_path; | 630 | static std::string exe_path; |
| 614 | if (exe_path.empty()) | 631 | if (exe_path.empty()) |
| 615 | { | 632 | { |
| 616 | TCHAR tchar_exe_path[2048]; | 633 | wchar_t wchar_exe_path[2048]; |
| 617 | GetModuleFileName(nullptr, tchar_exe_path, 2048); | 634 | GetModuleFileNameW(nullptr, wchar_exe_path, 2048); |
| 618 | exe_path = Common::TStrToUTF8(tchar_exe_path); | 635 | exe_path = Common::UTF16ToUTF8(wchar_exe_path); |
| 619 | exe_path = exe_path.substr(0, exe_path.find_last_of('\\')); | 636 | exe_path = exe_path.substr(0, exe_path.find_last_of('\\')); |
| 620 | } | 637 | } |
| 621 | return exe_path; | 638 | return exe_path; |
| @@ -900,7 +917,7 @@ bool IOFile::Open(const std::string& filename, const char openmode[]) | |||
| 900 | { | 917 | { |
| 901 | Close(); | 918 | Close(); |
| 902 | #ifdef _WIN32 | 919 | #ifdef _WIN32 |
| 903 | _tfopen_s(&m_file, Common::UTF8ToTStr(filename).c_str(), Common::UTF8ToTStr(openmode).c_str()); | 920 | _wfopen_s(&m_file, Common::UTF8ToUTF16W(filename).c_str(), Common::UTF8ToUTF16W(openmode).c_str()); |
| 904 | #else | 921 | #else |
| 905 | m_file = fopen(filename.c_str(), openmode); | 922 | m_file = fopen(filename.c_str(), openmode); |
| 906 | #endif | 923 | #endif |
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index cfbfbc2a7..3d39f94d5 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp | |||
| @@ -34,6 +34,7 @@ namespace Log { | |||
| 34 | SUB(Kernel, SVC) \ | 34 | SUB(Kernel, SVC) \ |
| 35 | CLS(Service) \ | 35 | CLS(Service) \ |
| 36 | SUB(Service, SRV) \ | 36 | SUB(Service, SRV) \ |
| 37 | SUB(Service, FRD) \ | ||
| 37 | SUB(Service, FS) \ | 38 | SUB(Service, FS) \ |
| 38 | SUB(Service, ERR) \ | 39 | SUB(Service, ERR) \ |
| 39 | SUB(Service, APT) \ | 40 | SUB(Service, APT) \ |
diff --git a/src/common/logging/log.h b/src/common/logging/log.h index 4f6856f3d..b8eede3b8 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h | |||
| @@ -49,6 +49,7 @@ enum class Class : ClassType { | |||
| 49 | Service, ///< HLE implementation of system services. Each major service | 49 | Service, ///< HLE implementation of system services. Each major service |
| 50 | /// should have its own subclass. | 50 | /// should have its own subclass. |
| 51 | Service_SRV, ///< The SRV (Service Directory) implementation | 51 | Service_SRV, ///< The SRV (Service Directory) implementation |
| 52 | Service_FRD, ///< The FRD (Friends) service | ||
| 52 | Service_FS, ///< The FS (Filesystem) service implementation | 53 | Service_FS, ///< The FS (Filesystem) service implementation |
| 53 | Service_ERR, ///< The ERR (Error) port implementation | 54 | Service_ERR, ///< The ERR (Error) port implementation |
| 54 | Service_APT, ///< The APT (Applets) service | 55 | Service_APT, ///< The APT (Applets) service |
diff --git a/src/common/make_unique.h b/src/common/make_unique.h deleted file mode 100644 index f6e7f017c..000000000 --- a/src/common/make_unique.h +++ /dev/null | |||
| @@ -1,17 +0,0 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <algorithm> | ||
| 8 | #include <memory> | ||
| 9 | |||
| 10 | namespace Common { | ||
| 11 | |||
| 12 | template <typename T, typename... Args> | ||
| 13 | std::unique_ptr<T> make_unique(Args&&... args) { | ||
| 14 | return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); | ||
| 15 | } | ||
| 16 | |||
| 17 | } // namespace | ||
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 6d6fc591f..f0aa072db 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp | |||
| @@ -320,27 +320,27 @@ std::u16string UTF8ToUTF16(const std::string& input) | |||
| 320 | #endif | 320 | #endif |
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | static std::string UTF16ToUTF8(const std::wstring& input) | 323 | static std::wstring CPToUTF16(u32 code_page, const std::string& input) |
| 324 | { | 324 | { |
| 325 | auto const size = WideCharToMultiByte(CP_UTF8, 0, input.data(), static_cast<int>(input.size()), nullptr, 0, nullptr, nullptr); | 325 | auto const size = MultiByteToWideChar(code_page, 0, input.data(), static_cast<int>(input.size()), nullptr, 0); |
| 326 | 326 | ||
| 327 | std::string output; | 327 | std::wstring output; |
| 328 | output.resize(size); | 328 | output.resize(size); |
| 329 | 329 | ||
| 330 | if (size == 0 || size != WideCharToMultiByte(CP_UTF8, 0, input.data(), static_cast<int>(input.size()), &output[0], static_cast<int>(output.size()), nullptr, nullptr)) | 330 | if (size == 0 || size != MultiByteToWideChar(code_page, 0, input.data(), static_cast<int>(input.size()), &output[0], static_cast<int>(output.size()))) |
| 331 | output.clear(); | 331 | output.clear(); |
| 332 | 332 | ||
| 333 | return output; | 333 | return output; |
| 334 | } | 334 | } |
| 335 | 335 | ||
| 336 | static std::wstring CPToUTF16(u32 code_page, const std::string& input) | 336 | std::string UTF16ToUTF8(const std::wstring& input) |
| 337 | { | 337 | { |
| 338 | auto const size = MultiByteToWideChar(code_page, 0, input.data(), static_cast<int>(input.size()), nullptr, 0); | 338 | auto const size = WideCharToMultiByte(CP_UTF8, 0, input.data(), static_cast<int>(input.size()), nullptr, 0, nullptr, nullptr); |
| 339 | 339 | ||
| 340 | std::wstring output; | 340 | std::string output; |
| 341 | output.resize(size); | 341 | output.resize(size); |
| 342 | 342 | ||
| 343 | if (size == 0 || size != MultiByteToWideChar(code_page, 0, input.data(), static_cast<int>(input.size()), &output[0], static_cast<int>(output.size()))) | 343 | if (size == 0 || size != WideCharToMultiByte(CP_UTF8, 0, input.data(), static_cast<int>(input.size()), &output[0], static_cast<int>(output.size()), nullptr, nullptr)) |
| 344 | output.clear(); | 344 | output.clear(); |
| 345 | 345 | ||
| 346 | return output; | 346 | return output; |
diff --git a/src/common/string_util.h b/src/common/string_util.h index c5c474c6f..89d9f133e 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h | |||
| @@ -95,7 +95,7 @@ std::string CP1252ToUTF8(const std::string& str); | |||
| 95 | std::string SHIFTJISToUTF8(const std::string& str); | 95 | std::string SHIFTJISToUTF8(const std::string& str); |
| 96 | 96 | ||
| 97 | #ifdef _WIN32 | 97 | #ifdef _WIN32 |
| 98 | 98 | std::string UTF16ToUTF8(const std::wstring& input); | |
| 99 | std::wstring UTF8ToUTF16W(const std::string& str); | 99 | std::wstring UTF8ToUTF16W(const std::string& str); |
| 100 | 100 | ||
| 101 | #ifdef _UNICODE | 101 | #ifdef _UNICODE |
diff --git a/src/core/arm/dyncom/arm_dyncom.cpp b/src/core/arm/dyncom/arm_dyncom.cpp index f3be2c857..947f5094b 100644 --- a/src/core/arm/dyncom/arm_dyncom.cpp +++ b/src/core/arm/dyncom/arm_dyncom.cpp | |||
| @@ -3,8 +3,7 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <cstring> | 5 | #include <cstring> |
| 6 | 6 | #include <memory> | |
| 7 | #include "common/make_unique.h" | ||
| 8 | 7 | ||
| 9 | #include "core/arm/skyeye_common/armstate.h" | 8 | #include "core/arm/skyeye_common/armstate.h" |
| 10 | #include "core/arm/skyeye_common/armsupp.h" | 9 | #include "core/arm/skyeye_common/armsupp.h" |
| @@ -18,7 +17,7 @@ | |||
| 18 | #include "core/core_timing.h" | 17 | #include "core/core_timing.h" |
| 19 | 18 | ||
| 20 | ARM_DynCom::ARM_DynCom(PrivilegeMode initial_mode) { | 19 | ARM_DynCom::ARM_DynCom(PrivilegeMode initial_mode) { |
| 21 | state = Common::make_unique<ARMul_State>(initial_mode); | 20 | state = std::make_unique<ARMul_State>(initial_mode); |
| 22 | } | 21 | } |
| 23 | 22 | ||
| 24 | ARM_DynCom::~ARM_DynCom() { | 23 | ARM_DynCom::~ARM_DynCom() { |
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index 9ed61947e..a6faf42b9 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp | |||
| @@ -3955,9 +3955,7 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) { | |||
| 3955 | if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) { | 3955 | if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) { |
| 3956 | add_inst* const inst_cream = (add_inst*)inst_base->component; | 3956 | add_inst* const inst_cream = (add_inst*)inst_base->component; |
| 3957 | 3957 | ||
| 3958 | u32 rn_val = RN; | 3958 | u32 rn_val = CHECK_READ_REG15_WA(cpu, inst_cream->Rn); |
| 3959 | if (inst_cream->Rn == 15) | ||
| 3960 | rn_val += 2 * cpu->GetInstructionSize(); | ||
| 3961 | 3959 | ||
| 3962 | bool carry; | 3960 | bool carry; |
| 3963 | bool overflow; | 3961 | bool overflow; |
| @@ -6167,9 +6165,7 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) { | |||
| 6167 | if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) { | 6165 | if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) { |
| 6168 | sub_inst* const inst_cream = (sub_inst*)inst_base->component; | 6166 | sub_inst* const inst_cream = (sub_inst*)inst_base->component; |
| 6169 | 6167 | ||
| 6170 | u32 rn_val = RN; | 6168 | u32 rn_val = CHECK_READ_REG15_WA(cpu, inst_cream->Rn); |
| 6171 | if (inst_cream->Rn == 15) | ||
| 6172 | rn_val += 2 * cpu->GetInstructionSize(); | ||
| 6173 | 6169 | ||
| 6174 | bool carry; | 6170 | bool carry; |
| 6175 | bool overflow; | 6171 | bool overflow; |
diff --git a/src/core/core.cpp b/src/core/core.cpp index 84d6c392e..3bb843aab 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #include <memory> | 5 | #include <memory> |
| 6 | 6 | ||
| 7 | #include "common/make_unique.h" | ||
| 8 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 9 | 8 | ||
| 10 | #include "core/core.h" | 9 | #include "core/core.h" |
| @@ -74,8 +73,8 @@ void Stop() { | |||
| 74 | 73 | ||
| 75 | /// Initialize the core | 74 | /// Initialize the core |
| 76 | void Init() { | 75 | void Init() { |
| 77 | g_sys_core = Common::make_unique<ARM_DynCom>(USER32MODE); | 76 | g_sys_core = std::make_unique<ARM_DynCom>(USER32MODE); |
| 78 | g_app_core = Common::make_unique<ARM_DynCom>(USER32MODE); | 77 | g_app_core = std::make_unique<ARM_DynCom>(USER32MODE); |
| 79 | 78 | ||
| 80 | LOG_DEBUG(Core, "Initialized OK"); | 79 | LOG_DEBUG(Core, "Initialized OK"); |
| 81 | } | 80 | } |
diff --git a/src/core/file_sys/archive_extsavedata.cpp b/src/core/file_sys/archive_extsavedata.cpp index 961264fe5..1d9eaefcb 100644 --- a/src/core/file_sys/archive_extsavedata.cpp +++ b/src/core/file_sys/archive_extsavedata.cpp | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <memory> | ||
| 6 | #include <vector> | 7 | #include <vector> |
| 7 | 8 | ||
| 8 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 9 | #include "common/file_util.h" | 10 | #include "common/file_util.h" |
| 10 | #include "common/logging/log.h" | 11 | #include "common/logging/log.h" |
| 11 | #include "common/make_unique.h" | ||
| 12 | #include "common/string_util.h" | 12 | #include "common/string_util.h" |
| 13 | 13 | ||
| 14 | #include "core/file_sys/archive_extsavedata.h" | 14 | #include "core/file_sys/archive_extsavedata.h" |
| @@ -84,7 +84,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_ExtSaveData::Open(cons | |||
| 84 | ErrorSummary::InvalidState, ErrorLevel::Status); | 84 | ErrorSummary::InvalidState, ErrorLevel::Status); |
| 85 | } | 85 | } |
| 86 | } | 86 | } |
| 87 | auto archive = Common::make_unique<DiskArchive>(fullpath); | 87 | auto archive = std::make_unique<DiskArchive>(fullpath); |
| 88 | return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive)); | 88 | return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive)); |
| 89 | } | 89 | } |
| 90 | 90 | ||
diff --git a/src/core/file_sys/archive_romfs.cpp b/src/core/file_sys/archive_romfs.cpp index a9a29ebde..38828b546 100644 --- a/src/core/file_sys/archive_romfs.cpp +++ b/src/core/file_sys/archive_romfs.cpp | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | 7 | ||
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "common/logging/log.h" | 9 | #include "common/logging/log.h" |
| 10 | #include "common/make_unique.h" | ||
| 11 | 10 | ||
| 12 | #include "core/file_sys/archive_romfs.h" | 11 | #include "core/file_sys/archive_romfs.h" |
| 13 | #include "core/file_sys/ivfc_archive.h" | 12 | #include "core/file_sys/ivfc_archive.h" |
| @@ -25,7 +24,7 @@ ArchiveFactory_RomFS::ArchiveFactory_RomFS(Loader::AppLoader& app_loader) { | |||
| 25 | } | 24 | } |
| 26 | 25 | ||
| 27 | ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_RomFS::Open(const Path& path) { | 26 | ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_RomFS::Open(const Path& path) { |
| 28 | auto archive = Common::make_unique<IVFCArchive>(romfs_file, data_offset, data_size); | 27 | auto archive = std::make_unique<IVFCArchive>(romfs_file, data_offset, data_size); |
| 29 | return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive)); | 28 | return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive)); |
| 30 | } | 29 | } |
| 31 | 30 | ||
diff --git a/src/core/file_sys/archive_savedata.cpp b/src/core/file_sys/archive_savedata.cpp index fe020d21c..fd5711e14 100644 --- a/src/core/file_sys/archive_savedata.cpp +++ b/src/core/file_sys/archive_savedata.cpp | |||
| @@ -3,11 +3,11 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <memory> | ||
| 6 | 7 | ||
| 7 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 8 | #include "common/file_util.h" | 9 | #include "common/file_util.h" |
| 9 | #include "common/logging/log.h" | 10 | #include "common/logging/log.h" |
| 10 | #include "common/make_unique.h" | ||
| 11 | #include "common/string_util.h" | 11 | #include "common/string_util.h" |
| 12 | 12 | ||
| 13 | #include "core/file_sys/archive_savedata.h" | 13 | #include "core/file_sys/archive_savedata.h" |
| @@ -53,7 +53,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveData::Open(const P | |||
| 53 | ErrorSummary::InvalidState, ErrorLevel::Status); | 53 | ErrorSummary::InvalidState, ErrorLevel::Status); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | auto archive = Common::make_unique<DiskArchive>(std::move(concrete_mount_point)); | 56 | auto archive = std::make_unique<DiskArchive>(std::move(concrete_mount_point)); |
| 57 | return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive)); | 57 | return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive)); |
| 58 | } | 58 | } |
| 59 | 59 | ||
diff --git a/src/core/file_sys/archive_savedatacheck.cpp b/src/core/file_sys/archive_savedatacheck.cpp index 3db11c500..9f65e5455 100644 --- a/src/core/file_sys/archive_savedatacheck.cpp +++ b/src/core/file_sys/archive_savedatacheck.cpp | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <memory> | ||
| 6 | #include <vector> | 7 | #include <vector> |
| 7 | 8 | ||
| 8 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 9 | #include "common/file_util.h" | 10 | #include "common/file_util.h" |
| 10 | #include "common/logging/log.h" | 11 | #include "common/logging/log.h" |
| 11 | #include "common/make_unique.h" | ||
| 12 | #include "common/string_util.h" | 12 | #include "common/string_util.h" |
| 13 | 13 | ||
| 14 | #include "core/file_sys/archive_savedatacheck.h" | 14 | #include "core/file_sys/archive_savedatacheck.h" |
| @@ -44,7 +44,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveDataCheck::Open(co | |||
| 44 | } | 44 | } |
| 45 | auto size = file->GetSize(); | 45 | auto size = file->GetSize(); |
| 46 | 46 | ||
| 47 | auto archive = Common::make_unique<IVFCArchive>(file, 0, size); | 47 | auto archive = std::make_unique<IVFCArchive>(file, 0, size); |
| 48 | return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive)); | 48 | return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive)); |
| 49 | } | 49 | } |
| 50 | 50 | ||
diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp index 657221cbf..9b218af58 100644 --- a/src/core/file_sys/archive_sdmc.cpp +++ b/src/core/file_sys/archive_sdmc.cpp | |||
| @@ -3,10 +3,10 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <memory> | ||
| 6 | 7 | ||
| 7 | #include "common/file_util.h" | 8 | #include "common/file_util.h" |
| 8 | #include "common/logging/log.h" | 9 | #include "common/logging/log.h" |
| 9 | #include "common/make_unique.h" | ||
| 10 | 10 | ||
| 11 | #include "core/file_sys/archive_sdmc.h" | 11 | #include "core/file_sys/archive_sdmc.h" |
| 12 | #include "core/file_sys/disk_archive.h" | 12 | #include "core/file_sys/disk_archive.h" |
| @@ -36,7 +36,7 @@ bool ArchiveFactory_SDMC::Initialize() { | |||
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SDMC::Open(const Path& path) { | 38 | ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SDMC::Open(const Path& path) { |
| 39 | auto archive = Common::make_unique<DiskArchive>(sdmc_directory); | 39 | auto archive = std::make_unique<DiskArchive>(sdmc_directory); |
| 40 | return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive)); | 40 | return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive)); |
| 41 | } | 41 | } |
| 42 | 42 | ||
diff --git a/src/core/file_sys/archive_systemsavedata.cpp b/src/core/file_sys/archive_systemsavedata.cpp index e1780de2f..1bcc228a1 100644 --- a/src/core/file_sys/archive_systemsavedata.cpp +++ b/src/core/file_sys/archive_systemsavedata.cpp | |||
| @@ -3,11 +3,11 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <memory> | ||
| 6 | #include <vector> | 7 | #include <vector> |
| 7 | 8 | ||
| 8 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 9 | #include "common/file_util.h" | 10 | #include "common/file_util.h" |
| 10 | #include "common/make_unique.h" | ||
| 11 | #include "common/string_util.h" | 11 | #include "common/string_util.h" |
| 12 | 12 | ||
| 13 | #include "core/file_sys/archive_systemsavedata.h" | 13 | #include "core/file_sys/archive_systemsavedata.h" |
| @@ -59,7 +59,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SystemSaveData::Open(c | |||
| 59 | return ResultCode(ErrorDescription::FS_NotFormatted, ErrorModule::FS, | 59 | return ResultCode(ErrorDescription::FS_NotFormatted, ErrorModule::FS, |
| 60 | ErrorSummary::InvalidState, ErrorLevel::Status); | 60 | ErrorSummary::InvalidState, ErrorLevel::Status); |
| 61 | } | 61 | } |
| 62 | auto archive = Common::make_unique<DiskArchive>(fullpath); | 62 | auto archive = std::make_unique<DiskArchive>(fullpath); |
| 63 | return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive)); | 63 | return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive)); |
| 64 | } | 64 | } |
| 65 | 65 | ||
diff --git a/src/core/file_sys/disk_archive.cpp b/src/core/file_sys/disk_archive.cpp index 8e4ea01c5..489cc96fb 100644 --- a/src/core/file_sys/disk_archive.cpp +++ b/src/core/file_sys/disk_archive.cpp | |||
| @@ -4,11 +4,11 @@ | |||
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <cstdio> | 6 | #include <cstdio> |
| 7 | #include <memory> | ||
| 7 | 8 | ||
| 8 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 9 | #include "common/file_util.h" | 10 | #include "common/file_util.h" |
| 10 | #include "common/logging/log.h" | 11 | #include "common/logging/log.h" |
| 11 | #include "common/make_unique.h" | ||
| 12 | 12 | ||
| 13 | #include "core/file_sys/disk_archive.h" | 13 | #include "core/file_sys/disk_archive.h" |
| 14 | 14 | ||
| @@ -19,7 +19,7 @@ namespace FileSys { | |||
| 19 | 19 | ||
| 20 | ResultVal<std::unique_ptr<FileBackend>> DiskArchive::OpenFile(const Path& path, const Mode mode) const { | 20 | ResultVal<std::unique_ptr<FileBackend>> DiskArchive::OpenFile(const Path& path, const Mode mode) const { |
| 21 | LOG_DEBUG(Service_FS, "called path=%s mode=%01X", path.DebugStr().c_str(), mode.hex); | 21 | LOG_DEBUG(Service_FS, "called path=%s mode=%01X", path.DebugStr().c_str(), mode.hex); |
| 22 | auto file = Common::make_unique<DiskFile>(*this, path, mode); | 22 | auto file = std::make_unique<DiskFile>(*this, path, mode); |
| 23 | ResultCode result = file->Open(); | 23 | ResultCode result = file->Open(); |
| 24 | if (result.IsError()) | 24 | if (result.IsError()) |
| 25 | return result; | 25 | return result; |
| @@ -83,7 +83,7 @@ bool DiskArchive::RenameDirectory(const Path& src_path, const Path& dest_path) c | |||
| 83 | 83 | ||
| 84 | std::unique_ptr<DirectoryBackend> DiskArchive::OpenDirectory(const Path& path) const { | 84 | std::unique_ptr<DirectoryBackend> DiskArchive::OpenDirectory(const Path& path) const { |
| 85 | LOG_DEBUG(Service_FS, "called path=%s", path.DebugStr().c_str()); | 85 | LOG_DEBUG(Service_FS, "called path=%s", path.DebugStr().c_str()); |
| 86 | auto directory = Common::make_unique<DiskDirectory>(*this, path); | 86 | auto directory = std::make_unique<DiskDirectory>(*this, path); |
| 87 | if (!directory->Open()) | 87 | if (!directory->Open()) |
| 88 | return nullptr; | 88 | return nullptr; |
| 89 | return std::move(directory); | 89 | return std::move(directory); |
| @@ -132,7 +132,7 @@ ResultCode DiskFile::Open() { | |||
| 132 | // Open the file in binary mode, to avoid problems with CR/LF on Windows systems | 132 | // Open the file in binary mode, to avoid problems with CR/LF on Windows systems |
| 133 | mode_string += "b"; | 133 | mode_string += "b"; |
| 134 | 134 | ||
| 135 | file = Common::make_unique<FileUtil::IOFile>(path, mode_string.c_str()); | 135 | file = std::make_unique<FileUtil::IOFile>(path, mode_string.c_str()); |
| 136 | if (file->IsOpen()) | 136 | if (file->IsOpen()) |
| 137 | return RESULT_SUCCESS; | 137 | return RESULT_SUCCESS; |
| 138 | return ResultCode(ErrorDescription::FS_NotFound, ErrorModule::FS, ErrorSummary::NotFound, ErrorLevel::Status); | 138 | return ResultCode(ErrorDescription::FS_NotFound, ErrorModule::FS, ErrorSummary::NotFound, ErrorLevel::Status); |
diff --git a/src/core/file_sys/ivfc_archive.cpp b/src/core/file_sys/ivfc_archive.cpp index a8e9a72ef..c61791ef7 100644 --- a/src/core/file_sys/ivfc_archive.cpp +++ b/src/core/file_sys/ivfc_archive.cpp | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | 7 | ||
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "common/logging/log.h" | 9 | #include "common/logging/log.h" |
| 10 | #include "common/make_unique.h" | ||
| 11 | 10 | ||
| 12 | #include "core/file_sys/ivfc_archive.h" | 11 | #include "core/file_sys/ivfc_archive.h" |
| 13 | 12 | ||
| @@ -21,7 +20,7 @@ std::string IVFCArchive::GetName() const { | |||
| 21 | } | 20 | } |
| 22 | 21 | ||
| 23 | ResultVal<std::unique_ptr<FileBackend>> IVFCArchive::OpenFile(const Path& path, const Mode mode) const { | 22 | ResultVal<std::unique_ptr<FileBackend>> IVFCArchive::OpenFile(const Path& path, const Mode mode) const { |
| 24 | return MakeResult<std::unique_ptr<FileBackend>>(Common::make_unique<IVFCFile>(romfs_file, data_offset, data_size)); | 23 | return MakeResult<std::unique_ptr<FileBackend>>(std::make_unique<IVFCFile>(romfs_file, data_offset, data_size)); |
| 25 | } | 24 | } |
| 26 | 25 | ||
| 27 | ResultCode IVFCArchive::DeleteFile(const Path& path) const { | 26 | ResultCode IVFCArchive::DeleteFile(const Path& path) const { |
| @@ -58,7 +57,7 @@ bool IVFCArchive::RenameDirectory(const Path& src_path, const Path& dest_path) c | |||
| 58 | } | 57 | } |
| 59 | 58 | ||
| 60 | std::unique_ptr<DirectoryBackend> IVFCArchive::OpenDirectory(const Path& path) const { | 59 | std::unique_ptr<DirectoryBackend> IVFCArchive::OpenDirectory(const Path& path) const { |
| 61 | return Common::make_unique<IVFCDirectory>(); | 60 | return std::make_unique<IVFCDirectory>(); |
| 62 | } | 61 | } |
| 63 | 62 | ||
| 64 | u64 IVFCArchive::GetFreeBytes() const { | 63 | u64 IVFCArchive::GetFreeBytes() const { |
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index 24b266eae..0546f6e16 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp | |||
| @@ -2,10 +2,11 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <memory> | ||
| 6 | |||
| 5 | #include "common/assert.h" | 7 | #include "common/assert.h" |
| 6 | #include "common/common_funcs.h" | 8 | #include "common/common_funcs.h" |
| 7 | #include "common/logging/log.h" | 9 | #include "common/logging/log.h" |
| 8 | #include "common/make_unique.h" | ||
| 9 | 10 | ||
| 10 | #include "core/hle/kernel/memory.h" | 11 | #include "core/hle/kernel/memory.h" |
| 11 | #include "core/hle/kernel/process.h" | 12 | #include "core/hle/kernel/process.h" |
diff --git a/src/core/hle/service/frd/frd.cpp b/src/core/hle/service/frd/frd.cpp index c13ffd9d2..15d604bb6 100644 --- a/src/core/hle/service/frd/frd.cpp +++ b/src/core/hle/service/frd/frd.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/string_util.h" | ||
| 6 | |||
| 5 | #include "core/hle/service/service.h" | 7 | #include "core/hle/service/service.h" |
| 6 | #include "core/hle/service/frd/frd.h" | 8 | #include "core/hle/service/frd/frd.h" |
| 7 | #include "core/hle/service/frd/frd_a.h" | 9 | #include "core/hle/service/frd/frd_a.h" |
| @@ -10,6 +12,95 @@ | |||
| 10 | namespace Service { | 12 | namespace Service { |
| 11 | namespace FRD { | 13 | namespace FRD { |
| 12 | 14 | ||
| 15 | static FriendKey my_friend_key = {0, 0, 0ull}; | ||
| 16 | static MyPresence my_presence = {}; | ||
| 17 | |||
| 18 | void GetMyPresence(Service::Interface* self) { | ||
| 19 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 20 | |||
| 21 | u32 shifted_out_size = cmd_buff[64]; | ||
| 22 | u32 my_presence_addr = cmd_buff[65]; | ||
| 23 | |||
| 24 | ASSERT(shifted_out_size == ((sizeof(MyPresence) << 14) | 2)); | ||
| 25 | |||
| 26 | Memory::WriteBlock(my_presence_addr, reinterpret_cast<const u8*>(&my_presence), sizeof(MyPresence)); | ||
| 27 | |||
| 28 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 29 | |||
| 30 | LOG_WARNING(Service_FRD, "(STUBBED) called"); | ||
| 31 | } | ||
| 32 | |||
| 33 | void GetFriendKeyList(Service::Interface* self) { | ||
| 34 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 35 | |||
| 36 | u32 unknown = cmd_buff[1]; | ||
| 37 | u32 frd_count = cmd_buff[2]; | ||
| 38 | u32 frd_key_addr = cmd_buff[65]; | ||
| 39 | |||
| 40 | FriendKey zero_key = {}; | ||
| 41 | for (u32 i = 0; i < frd_count; ++i) { | ||
| 42 | Memory::WriteBlock(frd_key_addr + i * sizeof(FriendKey), | ||
| 43 | reinterpret_cast<const u8*>(&zero_key), sizeof(FriendKey)); | ||
| 44 | } | ||
| 45 | |||
| 46 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 47 | cmd_buff[2] = 0; // 0 friends | ||
| 48 | LOG_WARNING(Service_FRD, "(STUBBED) called, unknown=%d, frd_count=%d, frd_key_addr=0x%08X", | ||
| 49 | unknown, frd_count, frd_key_addr); | ||
| 50 | } | ||
| 51 | |||
| 52 | void GetFriendProfile(Service::Interface* self) { | ||
| 53 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 54 | |||
| 55 | u32 count = cmd_buff[1]; | ||
| 56 | u32 frd_key_addr = cmd_buff[3]; | ||
| 57 | u32 profiles_addr = cmd_buff[65]; | ||
| 58 | |||
| 59 | Profile zero_profile = {}; | ||
| 60 | for (u32 i = 0; i < count; ++i) { | ||
| 61 | Memory::WriteBlock(profiles_addr + i * sizeof(Profile), | ||
| 62 | reinterpret_cast<const u8*>(&zero_profile), sizeof(Profile)); | ||
| 63 | } | ||
| 64 | |||
| 65 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 66 | LOG_WARNING(Service_FRD, "(STUBBED) called, count=%d, frd_key_addr=0x%08X, profiles_addr=0x%08X", | ||
| 67 | count, frd_key_addr, profiles_addr); | ||
| 68 | } | ||
| 69 | |||
| 70 | void GetFriendAttributeFlags(Service::Interface* self) { | ||
| 71 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 72 | |||
| 73 | u32 count = cmd_buff[1]; | ||
| 74 | u32 frd_key_addr = cmd_buff[3]; | ||
| 75 | u32 attr_flags_addr = cmd_buff[65]; | ||
| 76 | |||
| 77 | for (u32 i = 0; i < count; ++i) { | ||
| 78 | //TODO:(mailwl) figure out AttributeFlag size and zero all buffer. Assume 1 byte | ||
| 79 | Memory::Write8(attr_flags_addr + i, 0); | ||
| 80 | } | ||
| 81 | |||
| 82 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 83 | LOG_WARNING(Service_FRD, "(STUBBED) called, count=%d, frd_key_addr=0x%08X, attr_flags_addr=0x%08X", | ||
| 84 | count, frd_key_addr, attr_flags_addr); | ||
| 85 | } | ||
| 86 | |||
| 87 | void GetMyFriendKey(Service::Interface* self) { | ||
| 88 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 89 | |||
| 90 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 91 | Memory::WriteBlock(cmd_buff[2], reinterpret_cast<const u8*>(&my_friend_key), sizeof(FriendKey)); | ||
| 92 | LOG_WARNING(Service_FRD, "(STUBBED) called"); | ||
| 93 | } | ||
| 94 | |||
| 95 | void GetMyScreenName(Service::Interface* self) { | ||
| 96 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 97 | |||
| 98 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 99 | // TODO: (mailwl) get the name from config | ||
| 100 | Common::UTF8ToUTF16("Citra").copy(reinterpret_cast<char16_t*>(&cmd_buff[2]), 11); | ||
| 101 | LOG_WARNING(Service_FRD, "(STUBBED) called"); | ||
| 102 | } | ||
| 103 | |||
| 13 | void Init() { | 104 | void Init() { |
| 14 | using namespace Kernel; | 105 | using namespace Kernel; |
| 15 | 106 | ||
diff --git a/src/core/hle/service/frd/frd.h b/src/core/hle/service/frd/frd.h index f9f88b444..c8283a7f3 100644 --- a/src/core/hle/service/frd/frd.h +++ b/src/core/hle/service/frd/frd.h | |||
| @@ -4,9 +4,97 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "common/common_types.h" | ||
| 8 | |||
| 7 | namespace Service { | 9 | namespace Service { |
| 10 | |||
| 11 | class Interface; | ||
| 12 | |||
| 8 | namespace FRD { | 13 | namespace FRD { |
| 9 | 14 | ||
| 15 | struct FriendKey { | ||
| 16 | u32 friend_id; | ||
| 17 | u32 unknown; | ||
| 18 | u64 friend_code; | ||
| 19 | }; | ||
| 20 | |||
| 21 | struct MyPresence { | ||
| 22 | u8 unknown[0x12C]; | ||
| 23 | }; | ||
| 24 | |||
| 25 | struct Profile { | ||
| 26 | u8 region; | ||
| 27 | u8 country; | ||
| 28 | u8 area; | ||
| 29 | u8 language; | ||
| 30 | u32 unknown; | ||
| 31 | }; | ||
| 32 | |||
| 33 | /** | ||
| 34 | * FRD::GetMyPresence service function | ||
| 35 | * Inputs: | ||
| 36 | * 64 : sizeof (MyPresence) << 14 | 2 | ||
| 37 | * 65 : Address of MyPresence structure | ||
| 38 | * Outputs: | ||
| 39 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 40 | */ | ||
| 41 | void GetMyPresence(Service::Interface* self); | ||
| 42 | |||
| 43 | /** | ||
| 44 | * FRD::GetFriendKeyList service function | ||
| 45 | * Inputs: | ||
| 46 | * 1 : Unknown | ||
| 47 | * 2 : Max friends count | ||
| 48 | * 65 : Address of FriendKey List | ||
| 49 | * Outputs: | ||
| 50 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 51 | * 2 : FriendKey count filled | ||
| 52 | */ | ||
| 53 | void GetFriendKeyList(Service::Interface* self); | ||
| 54 | |||
| 55 | /** | ||
| 56 | * FRD::GetFriendProfile service function | ||
| 57 | * Inputs: | ||
| 58 | * 1 : Friends count | ||
| 59 | * 2 : Friends count << 18 | 2 | ||
| 60 | * 3 : Address of FriendKey List | ||
| 61 | * 64 : (count * sizeof (Profile)) << 10 | 2 | ||
| 62 | * 65 : Address of Profiles List | ||
| 63 | * Outputs: | ||
| 64 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 65 | */ | ||
| 66 | void GetFriendProfile(Service::Interface* self); | ||
| 67 | |||
| 68 | /** | ||
| 69 | * FRD::GetFriendAttributeFlags service function | ||
| 70 | * Inputs: | ||
| 71 | * 1 : Friends count | ||
| 72 | * 2 : Friends count << 18 | 2 | ||
| 73 | * 3 : Address of FriendKey List | ||
| 74 | * 65 : Address of AttributeFlags | ||
| 75 | * Outputs: | ||
| 76 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 77 | */ | ||
| 78 | void GetFriendAttributeFlags(Service::Interface* self); | ||
| 79 | |||
| 80 | /** | ||
| 81 | * FRD::GetMyFriendKey service function | ||
| 82 | * Inputs: | ||
| 83 | * none | ||
| 84 | * Outputs: | ||
| 85 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 86 | * 2-5 : FriendKey | ||
| 87 | */ | ||
| 88 | void GetMyFriendKey(Service::Interface* self); | ||
| 89 | |||
| 90 | /** | ||
| 91 | * FRD::GetMyScreenName service function | ||
| 92 | * Outputs: | ||
| 93 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 94 | * 2 : UTF16 encoded name (max 11 symbols) | ||
| 95 | */ | ||
| 96 | void GetMyScreenName(Service::Interface* self); | ||
| 97 | |||
| 10 | /// Initialize FRD service(s) | 98 | /// Initialize FRD service(s) |
| 11 | void Init(); | 99 | void Init(); |
| 12 | 100 | ||
diff --git a/src/core/hle/service/frd/frd_u.cpp b/src/core/hle/service/frd/frd_u.cpp index 2c6885377..db8666416 100644 --- a/src/core/hle/service/frd/frd_u.cpp +++ b/src/core/hle/service/frd/frd_u.cpp | |||
| @@ -2,65 +2,66 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/hle/service/frd/frd.h" | ||
| 5 | #include "core/hle/service/frd/frd_u.h" | 6 | #include "core/hle/service/frd/frd_u.h" |
| 6 | 7 | ||
| 7 | namespace Service { | 8 | namespace Service { |
| 8 | namespace FRD { | 9 | namespace FRD { |
| 9 | 10 | ||
| 10 | const Interface::FunctionInfo FunctionTable[] = { | 11 | const Interface::FunctionInfo FunctionTable[] = { |
| 11 | {0x00010000, nullptr, "HasLoggedIn"}, | 12 | {0x00010000, nullptr, "HasLoggedIn"}, |
| 12 | {0x00020000, nullptr, "IsOnline"}, | 13 | {0x00020000, nullptr, "IsOnline"}, |
| 13 | {0x00030000, nullptr, "Login"}, | 14 | {0x00030000, nullptr, "Login"}, |
| 14 | {0x00040000, nullptr, "Logout"}, | 15 | {0x00040000, nullptr, "Logout"}, |
| 15 | {0x00050000, nullptr, "GetMyFriendKey"}, | 16 | {0x00050000, GetMyFriendKey, "GetMyFriendKey"}, |
| 16 | {0x00060000, nullptr, "GetMyPreference"}, | 17 | {0x00060000, nullptr, "GetMyPreference"}, |
| 17 | {0x00070000, nullptr, "GetMyProfile"}, | 18 | {0x00070000, nullptr, "GetMyProfile"}, |
| 18 | {0x00080000, nullptr, "GetMyPresence"}, | 19 | {0x00080000, GetMyPresence, "GetMyPresence"}, |
| 19 | {0x00090000, nullptr, "GetMyScreenName"}, | 20 | {0x00090000, GetMyScreenName, "GetMyScreenName"}, |
| 20 | {0x000A0000, nullptr, "GetMyMii"}, | 21 | {0x000A0000, nullptr, "GetMyMii"}, |
| 21 | {0x000B0000, nullptr, "GetMyLocalAccountId"}, | 22 | {0x000B0000, nullptr, "GetMyLocalAccountId"}, |
| 22 | {0x000C0000, nullptr, "GetMyPlayingGame"}, | 23 | {0x000C0000, nullptr, "GetMyPlayingGame"}, |
| 23 | {0x000D0000, nullptr, "GetMyFavoriteGame"}, | 24 | {0x000D0000, nullptr, "GetMyFavoriteGame"}, |
| 24 | {0x000E0000, nullptr, "GetMyNcPrincipalId"}, | 25 | {0x000E0000, nullptr, "GetMyNcPrincipalId"}, |
| 25 | {0x000F0000, nullptr, "GetMyComment"}, | 26 | {0x000F0000, nullptr, "GetMyComment"}, |
| 26 | {0x00100040, nullptr, "GetMyPassword"}, | 27 | {0x00100040, nullptr, "GetMyPassword"}, |
| 27 | {0x00110080, nullptr, "GetFriendKeyList"}, | 28 | {0x00110080, GetFriendKeyList, "GetFriendKeyList"}, |
| 28 | {0x00120042, nullptr, "GetFriendPresence"}, | 29 | {0x00120042, nullptr, "GetFriendPresence"}, |
| 29 | {0x00130142, nullptr, "GetFriendScreenName"}, | 30 | {0x00130142, nullptr, "GetFriendScreenName"}, |
| 30 | {0x00140044, nullptr, "GetFriendMii"}, | 31 | {0x00140044, nullptr, "GetFriendMii"}, |
| 31 | {0x00150042, nullptr, "GetFriendProfile"}, | 32 | {0x00150042, GetFriendProfile, "GetFriendProfile"}, |
| 32 | {0x00160042, nullptr, "GetFriendRelationship"}, | 33 | {0x00160042, nullptr, "GetFriendRelationship"}, |
| 33 | {0x00170042, nullptr, "GetFriendAttributeFlags"}, | 34 | {0x00170042, GetFriendAttributeFlags, "GetFriendAttributeFlags"}, |
| 34 | {0x00180044, nullptr, "GetFriendPlayingGame"}, | 35 | {0x00180044, nullptr, "GetFriendPlayingGame"}, |
| 35 | {0x00190042, nullptr, "GetFriendFavoriteGame"}, | 36 | {0x00190042, nullptr, "GetFriendFavoriteGame"}, |
| 36 | {0x001A00C4, nullptr, "GetFriendInfo"}, | 37 | {0x001A00C4, nullptr, "GetFriendInfo"}, |
| 37 | {0x001B0080, nullptr, "IsIncludedInFriendList"}, | 38 | {0x001B0080, nullptr, "IsIncludedInFriendList"}, |
| 38 | {0x001C0042, nullptr, "UnscrambleLocalFriendCode"}, | 39 | {0x001C0042, nullptr, "UnscrambleLocalFriendCode"}, |
| 39 | {0x001D0002, nullptr, "UpdateGameModeDescription"}, | 40 | {0x001D0002, nullptr, "UpdateGameModeDescription"}, |
| 40 | {0x001E02C2, nullptr, "UpdateGameMode"}, | 41 | {0x001E02C2, nullptr, "UpdateGameMode"}, |
| 41 | {0x001F0042, nullptr, "SendInvitation"}, | 42 | {0x001F0042, nullptr, "SendInvitation"}, |
| 42 | {0x00200002, nullptr, "AttachToEventNotification"}, | 43 | {0x00200002, nullptr, "AttachToEventNotification"}, |
| 43 | {0x00210040, nullptr, "SetNotificationMask"}, | 44 | {0x00210040, nullptr, "SetNotificationMask"}, |
| 44 | {0x00220040, nullptr, "GetEventNotification"}, | 45 | {0x00220040, nullptr, "GetEventNotification"}, |
| 45 | {0x00230000, nullptr, "GetLastResponseResult"}, | 46 | {0x00230000, nullptr, "GetLastResponseResult"}, |
| 46 | {0x00240040, nullptr, "PrincipalIdToFriendCode"}, | 47 | {0x00240040, nullptr, "PrincipalIdToFriendCode"}, |
| 47 | {0x00250080, nullptr, "FriendCodeToPrincipalId"}, | 48 | {0x00250080, nullptr, "FriendCodeToPrincipalId"}, |
| 48 | {0x00260080, nullptr, "IsValidFriendCode"}, | 49 | {0x00260080, nullptr, "IsValidFriendCode"}, |
| 49 | {0x00270040, nullptr, "ResultToErrorCode"}, | 50 | {0x00270040, nullptr, "ResultToErrorCode"}, |
| 50 | {0x00280244, nullptr, "RequestGameAuthentication"}, | 51 | {0x00280244, nullptr, "RequestGameAuthentication"}, |
| 51 | {0x00290000, nullptr, "GetGameAuthenticationData"}, | 52 | {0x00290000, nullptr, "GetGameAuthenticationData"}, |
| 52 | {0x002A0204, nullptr, "RequestServiceLocator"}, | 53 | {0x002A0204, nullptr, "RequestServiceLocator"}, |
| 53 | {0x002B0000, nullptr, "GetServiceLocatorData"}, | 54 | {0x002B0000, nullptr, "GetServiceLocatorData"}, |
| 54 | {0x002C0002, nullptr, "DetectNatProperties"}, | 55 | {0x002C0002, nullptr, "DetectNatProperties"}, |
| 55 | {0x002D0000, nullptr, "GetNatProperties"}, | 56 | {0x002D0000, nullptr, "GetNatProperties"}, |
| 56 | {0x002E0000, nullptr, "GetServerTimeInterval"}, | 57 | {0x002E0000, nullptr, "GetServerTimeInterval"}, |
| 57 | {0x002F0040, nullptr, "AllowHalfAwake"}, | 58 | {0x002F0040, nullptr, "AllowHalfAwake"}, |
| 58 | {0x00300000, nullptr, "GetServerTypes"}, | 59 | {0x00300000, nullptr, "GetServerTypes"}, |
| 59 | {0x00310082, nullptr, "GetFriendComment"}, | 60 | {0x00310082, nullptr, "GetFriendComment"}, |
| 60 | {0x00320042, nullptr, "SetClientSdkVersion"}, | 61 | {0x00320042, nullptr, "SetClientSdkVersion"}, |
| 61 | {0x00330000, nullptr, "GetMyApproachContext"}, | 62 | {0x00330000, nullptr, "GetMyApproachContext"}, |
| 62 | {0x00340046, nullptr, "AddFriendWithApproach"}, | 63 | {0x00340046, nullptr, "AddFriendWithApproach"}, |
| 63 | {0x00350082, nullptr, "DecryptApproachContext"}, | 64 | {0x00350082, nullptr, "DecryptApproachContext"}, |
| 64 | }; | 65 | }; |
| 65 | 66 | ||
| 66 | FRD_U_Interface::FRD_U_Interface() { | 67 | FRD_U_Interface::FRD_U_Interface() { |
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 590697e76..e9588cb72 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp | |||
| @@ -15,7 +15,6 @@ | |||
| 15 | #include "common/common_types.h" | 15 | #include "common/common_types.h" |
| 16 | #include "common/file_util.h" | 16 | #include "common/file_util.h" |
| 17 | #include "common/logging/log.h" | 17 | #include "common/logging/log.h" |
| 18 | #include "common/make_unique.h" | ||
| 19 | 18 | ||
| 20 | #include "core/file_sys/archive_backend.h" | 19 | #include "core/file_sys/archive_backend.h" |
| 21 | #include "core/file_sys/archive_extsavedata.h" | 20 | #include "core/file_sys/archive_extsavedata.h" |
| @@ -521,23 +520,23 @@ void ArchiveInit() { | |||
| 521 | 520 | ||
| 522 | std::string sdmc_directory = FileUtil::GetUserPath(D_SDMC_IDX); | 521 | std::string sdmc_directory = FileUtil::GetUserPath(D_SDMC_IDX); |
| 523 | std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX); | 522 | std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX); |
| 524 | auto sdmc_factory = Common::make_unique<FileSys::ArchiveFactory_SDMC>(sdmc_directory); | 523 | auto sdmc_factory = std::make_unique<FileSys::ArchiveFactory_SDMC>(sdmc_directory); |
| 525 | if (sdmc_factory->Initialize()) | 524 | if (sdmc_factory->Initialize()) |
| 526 | RegisterArchiveType(std::move(sdmc_factory), ArchiveIdCode::SDMC); | 525 | RegisterArchiveType(std::move(sdmc_factory), ArchiveIdCode::SDMC); |
| 527 | else | 526 | else |
| 528 | LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str()); | 527 | LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str()); |
| 529 | 528 | ||
| 530 | // Create the SaveData archive | 529 | // Create the SaveData archive |
| 531 | auto savedata_factory = Common::make_unique<FileSys::ArchiveFactory_SaveData>(sdmc_directory); | 530 | auto savedata_factory = std::make_unique<FileSys::ArchiveFactory_SaveData>(sdmc_directory); |
| 532 | RegisterArchiveType(std::move(savedata_factory), ArchiveIdCode::SaveData); | 531 | RegisterArchiveType(std::move(savedata_factory), ArchiveIdCode::SaveData); |
| 533 | 532 | ||
| 534 | auto extsavedata_factory = Common::make_unique<FileSys::ArchiveFactory_ExtSaveData>(sdmc_directory, false); | 533 | auto extsavedata_factory = std::make_unique<FileSys::ArchiveFactory_ExtSaveData>(sdmc_directory, false); |
| 535 | if (extsavedata_factory->Initialize()) | 534 | if (extsavedata_factory->Initialize()) |
| 536 | RegisterArchiveType(std::move(extsavedata_factory), ArchiveIdCode::ExtSaveData); | 535 | RegisterArchiveType(std::move(extsavedata_factory), ArchiveIdCode::ExtSaveData); |
| 537 | else | 536 | else |
| 538 | LOG_ERROR(Service_FS, "Can't instantiate ExtSaveData archive with path %s", extsavedata_factory->GetMountPoint().c_str()); | 537 | LOG_ERROR(Service_FS, "Can't instantiate ExtSaveData archive with path %s", extsavedata_factory->GetMountPoint().c_str()); |
| 539 | 538 | ||
| 540 | auto sharedextsavedata_factory = Common::make_unique<FileSys::ArchiveFactory_ExtSaveData>(nand_directory, true); | 539 | auto sharedextsavedata_factory = std::make_unique<FileSys::ArchiveFactory_ExtSaveData>(nand_directory, true); |
| 541 | if (sharedextsavedata_factory->Initialize()) | 540 | if (sharedextsavedata_factory->Initialize()) |
| 542 | RegisterArchiveType(std::move(sharedextsavedata_factory), ArchiveIdCode::SharedExtSaveData); | 541 | RegisterArchiveType(std::move(sharedextsavedata_factory), ArchiveIdCode::SharedExtSaveData); |
| 543 | else | 542 | else |
| @@ -545,10 +544,10 @@ void ArchiveInit() { | |||
| 545 | sharedextsavedata_factory->GetMountPoint().c_str()); | 544 | sharedextsavedata_factory->GetMountPoint().c_str()); |
| 546 | 545 | ||
| 547 | // Create the SaveDataCheck archive, basically a small variation of the RomFS archive | 546 | // Create the SaveDataCheck archive, basically a small variation of the RomFS archive |
| 548 | auto savedatacheck_factory = Common::make_unique<FileSys::ArchiveFactory_SaveDataCheck>(nand_directory); | 547 | auto savedatacheck_factory = std::make_unique<FileSys::ArchiveFactory_SaveDataCheck>(nand_directory); |
| 549 | RegisterArchiveType(std::move(savedatacheck_factory), ArchiveIdCode::SaveDataCheck); | 548 | RegisterArchiveType(std::move(savedatacheck_factory), ArchiveIdCode::SaveDataCheck); |
| 550 | 549 | ||
| 551 | auto systemsavedata_factory = Common::make_unique<FileSys::ArchiveFactory_SystemSaveData>(nand_directory); | 550 | auto systemsavedata_factory = std::make_unique<FileSys::ArchiveFactory_SystemSaveData>(nand_directory); |
| 552 | RegisterArchiveType(std::move(systemsavedata_factory), ArchiveIdCode::SystemSaveData); | 551 | RegisterArchiveType(std::move(systemsavedata_factory), ArchiveIdCode::SystemSaveData); |
| 553 | } | 552 | } |
| 554 | 553 | ||
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 7844d2330..0fe3a4d7a 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -71,9 +71,8 @@ ResultVal<bool> Interface::SyncRequest() { | |||
| 71 | // TODO(bunnei): Hack - ignore error | 71 | // TODO(bunnei): Hack - ignore error |
| 72 | cmd_buff[1] = 0; | 72 | cmd_buff[1] = 0; |
| 73 | return MakeResult<bool>(false); | 73 | return MakeResult<bool>(false); |
| 74 | } else { | ||
| 75 | LOG_TRACE(Service, "%s", MakeFunctionString(itr->second.name, GetPortName().c_str(), cmd_buff).c_str()); | ||
| 76 | } | 74 | } |
| 75 | LOG_TRACE(Service, "%s", MakeFunctionString(itr->second.name, GetPortName().c_str(), cmd_buff).c_str()); | ||
| 77 | 76 | ||
| 78 | itr->second.func(this); | 77 | itr->second.func(this); |
| 79 | 78 | ||
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index b1907cd55..886501c41 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | #include <string> | 6 | #include <string> |
| 7 | 7 | ||
| 8 | #include "common/logging/log.h" | 8 | #include "common/logging/log.h" |
| 9 | #include "common/make_unique.h" | ||
| 10 | #include "common/string_util.h" | 9 | #include "common/string_util.h" |
| 11 | 10 | ||
| 12 | #include "core/file_sys/archive_romfs.h" | 11 | #include "core/file_sys/archive_romfs.h" |
| @@ -120,7 +119,7 @@ ResultStatus LoadFile(const std::string& filename) { | |||
| 120 | AppLoader_THREEDSX app_loader(std::move(file), filename_filename, filename); | 119 | AppLoader_THREEDSX app_loader(std::move(file), filename_filename, filename); |
| 121 | // Load application and RomFS | 120 | // Load application and RomFS |
| 122 | if (ResultStatus::Success == app_loader.Load()) { | 121 | if (ResultStatus::Success == app_loader.Load()) { |
| 123 | Service::FS::RegisterArchiveType(Common::make_unique<FileSys::ArchiveFactory_RomFS>(app_loader), Service::FS::ArchiveIdCode::RomFS); | 122 | Service::FS::RegisterArchiveType(std::make_unique<FileSys::ArchiveFactory_RomFS>(app_loader), Service::FS::ArchiveIdCode::RomFS); |
| 124 | return ResultStatus::Success; | 123 | return ResultStatus::Success; |
| 125 | } | 124 | } |
| 126 | break; | 125 | break; |
| @@ -139,7 +138,7 @@ ResultStatus LoadFile(const std::string& filename) { | |||
| 139 | // Load application and RomFS | 138 | // Load application and RomFS |
| 140 | ResultStatus result = app_loader.Load(); | 139 | ResultStatus result = app_loader.Load(); |
| 141 | if (ResultStatus::Success == result) { | 140 | if (ResultStatus::Success == result) { |
| 142 | Service::FS::RegisterArchiveType(Common::make_unique<FileSys::ArchiveFactory_RomFS>(app_loader), Service::FS::ArchiveIdCode::RomFS); | 141 | Service::FS::RegisterArchiveType(std::make_unique<FileSys::ArchiveFactory_RomFS>(app_loader), Service::FS::ArchiveIdCode::RomFS); |
| 143 | } | 142 | } |
| 144 | return result; | 143 | return result; |
| 145 | } | 144 | } |
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index 93f21bec2..e63cab33f 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | 8 | ||
| 9 | #include "common/logging/log.h" | 9 | #include "common/logging/log.h" |
| 10 | #include "common/make_unique.h" | ||
| 11 | #include "common/string_util.h" | 10 | #include "common/string_util.h" |
| 12 | #include "common/swap.h" | 11 | #include "common/swap.h" |
| 13 | 12 | ||
diff --git a/src/video_core/renderer_base.cpp b/src/video_core/renderer_base.cpp index 6467ff723..101f84eb9 100644 --- a/src/video_core/renderer_base.cpp +++ b/src/video_core/renderer_base.cpp | |||
| @@ -4,8 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #include <memory> | 5 | #include <memory> |
| 6 | 6 | ||
| 7 | #include "common/make_unique.h" | ||
| 8 | |||
| 9 | #include "core/settings.h" | 7 | #include "core/settings.h" |
| 10 | 8 | ||
| 11 | #include "video_core/renderer_base.h" | 9 | #include "video_core/renderer_base.h" |
| @@ -19,9 +17,9 @@ void RendererBase::RefreshRasterizerSetting() { | |||
| 19 | opengl_rasterizer_active = hw_renderer_enabled; | 17 | opengl_rasterizer_active = hw_renderer_enabled; |
| 20 | 18 | ||
| 21 | if (hw_renderer_enabled) { | 19 | if (hw_renderer_enabled) { |
| 22 | rasterizer = Common::make_unique<RasterizerOpenGL>(); | 20 | rasterizer = std::make_unique<RasterizerOpenGL>(); |
| 23 | } else { | 21 | } else { |
| 24 | rasterizer = Common::make_unique<VideoCore::SWRasterizer>(); | 22 | rasterizer = std::make_unique<VideoCore::SWRasterizer>(); |
| 25 | } | 23 | } |
| 26 | rasterizer->InitObjects(); | 24 | rasterizer->InitObjects(); |
| 27 | rasterizer->Reset(); | 25 | rasterizer->Reset(); |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 21ad9ee77..cc6b3aeab 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -9,7 +9,6 @@ | |||
| 9 | 9 | ||
| 10 | #include "common/color.h" | 10 | #include "common/color.h" |
| 11 | #include "common/file_util.h" | 11 | #include "common/file_util.h" |
| 12 | #include "common/make_unique.h" | ||
| 13 | #include "common/math_util.h" | 12 | #include "common/math_util.h" |
| 14 | #include "common/microprofile.h" | 13 | #include "common/microprofile.h" |
| 15 | #include "common/profiler.h" | 14 | #include "common/profiler.h" |
| @@ -677,7 +676,7 @@ void RasterizerOpenGL::ReconfigureDepthTexture(DepthTextureInfo& texture, Pica:: | |||
| 677 | 676 | ||
| 678 | void RasterizerOpenGL::SetShader() { | 677 | void RasterizerOpenGL::SetShader() { |
| 679 | PicaShaderConfig config = PicaShaderConfig::CurrentConfig(); | 678 | PicaShaderConfig config = PicaShaderConfig::CurrentConfig(); |
| 680 | std::unique_ptr<PicaShader> shader = Common::make_unique<PicaShader>(); | 679 | std::unique_ptr<PicaShader> shader = std::make_unique<PicaShader>(); |
| 681 | 680 | ||
| 682 | // Find (or generate) the GLSL shader for the current TEV state | 681 | // Find (or generate) the GLSL shader for the current TEV state |
| 683 | auto cached_shader = shader_cache.find(config); | 682 | auto cached_shader = shader_cache.find(config); |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index a9ad46fe0..1323c12e4 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -2,8 +2,9 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <memory> | ||
| 6 | |||
| 5 | #include "common/hash.h" | 7 | #include "common/hash.h" |
| 6 | #include "common/make_unique.h" | ||
| 7 | #include "common/math_util.h" | 8 | #include "common/math_util.h" |
| 8 | #include "common/microprofile.h" | 9 | #include "common/microprofile.h" |
| 9 | #include "common/vector_math.h" | 10 | #include "common/vector_math.h" |
| @@ -29,7 +30,7 @@ void RasterizerCacheOpenGL::LoadAndBindTexture(OpenGLState &state, unsigned text | |||
| 29 | } else { | 30 | } else { |
| 30 | MICROPROFILE_SCOPE(OpenGL_TextureUpload); | 31 | MICROPROFILE_SCOPE(OpenGL_TextureUpload); |
| 31 | 32 | ||
| 32 | std::unique_ptr<CachedTexture> new_texture = Common::make_unique<CachedTexture>(); | 33 | std::unique_ptr<CachedTexture> new_texture = std::make_unique<CachedTexture>(); |
| 33 | 34 | ||
| 34 | new_texture->texture.Create(); | 35 | new_texture->texture.Create(); |
| 35 | state.texture_units[texture_unit].texture_2d = new_texture->texture.handle; | 36 | state.texture_units[texture_unit].texture_2d = new_texture->texture.handle; |
diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp index eb1db0778..78d295c76 100644 --- a/src/video_core/shader/shader.cpp +++ b/src/video_core/shader/shader.cpp | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | #include <boost/range/algorithm/fill.hpp> | 8 | #include <boost/range/algorithm/fill.hpp> |
| 9 | 9 | ||
| 10 | #include "common/hash.h" | 10 | #include "common/hash.h" |
| 11 | #include "common/make_unique.h" | ||
| 12 | #include "common/microprofile.h" | 11 | #include "common/microprofile.h" |
| 13 | #include "common/profiler.h" | 12 | #include "common/profiler.h" |
| 14 | 13 | ||
diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index ee5e50df1..256899c89 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | #include <memory> | 5 | #include <memory> |
| 6 | 6 | ||
| 7 | #include "common/emu_window.h" | 7 | #include "common/emu_window.h" |
| 8 | #include "common/make_unique.h" | ||
| 9 | #include "common/logging/log.h" | 8 | #include "common/logging/log.h" |
| 10 | 9 | ||
| 11 | #include "core/core.h" | 10 | #include "core/core.h" |
| @@ -32,7 +31,7 @@ bool Init(EmuWindow* emu_window) { | |||
| 32 | Pica::Init(); | 31 | Pica::Init(); |
| 33 | 32 | ||
| 34 | g_emu_window = emu_window; | 33 | g_emu_window = emu_window; |
| 35 | g_renderer = Common::make_unique<RendererOpenGL>(); | 34 | g_renderer = std::make_unique<RendererOpenGL>(); |
| 36 | g_renderer->SetWindow(g_emu_window); | 35 | g_renderer->SetWindow(g_emu_window); |
| 37 | if (g_renderer->Init()) { | 36 | if (g_renderer->Init()) { |
| 38 | LOG_DEBUG(Render, "initialized OK"); | 37 | LOG_DEBUG(Render, "initialized OK"); |