From 2678735f73767987fef313f1acf94f3e4336ee42 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Thu, 28 Mar 2019 14:23:34 -0700 Subject: [PATCH] stratosphere: migrate result headers to libstrat --- .../ams_mitm/source/fs_mitm/fs_dir_utils.cpp | 2 +- .../ams_mitm/source/fs_mitm/fs_idirectory.hpp | 2 - .../ams_mitm/source/fs_mitm/fs_ifile.hpp | 1 - .../source/fs_mitm/fs_ifilesystem.hpp | 1 - .../ams_mitm/source/fs_mitm/fs_istorage.hpp | 2 - .../ams_mitm/source/fs_mitm/fs_path_utils.cpp | 3 +- .../ams_mitm/source/fs_mitm/fs_results.hpp | 47 ------------------- .../source/fs_mitm/fsmitm_layeredrom.cpp | 2 - .../creport/source/creport_crash_report.cpp | 16 +++---- .../creport/source/creport_crash_report.hpp | 19 ++------ .../creport/source/creport_debug_types.hpp | 6 +-- stratosphere/dmnt/source/dmnt_cheat_types.hpp | 2 - stratosphere/dmnt/source/dmnt_results.hpp | 39 --------------- stratosphere/libstratosphere | 2 +- 14 files changed, 18 insertions(+), 126 deletions(-) delete mode 100644 stratosphere/ams_mitm/source/fs_mitm/fs_results.hpp delete mode 100644 stratosphere/dmnt/source/dmnt_results.hpp diff --git a/stratosphere/ams_mitm/source/fs_mitm/fs_dir_utils.cpp b/stratosphere/ams_mitm/source/fs_mitm/fs_dir_utils.cpp index 5401329d9..a59d31fb4 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_dir_utils.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fs_dir_utils.cpp @@ -16,7 +16,7 @@ #include #include #include -#include "fs_results.hpp" + #include "fs_dir_utils.hpp" #include "fs_ifile.hpp" diff --git a/stratosphere/ams_mitm/source/fs_mitm/fs_idirectory.hpp b/stratosphere/ams_mitm/source/fs_mitm/fs_idirectory.hpp index c141fa3d1..98f009329 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_idirectory.hpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fs_idirectory.hpp @@ -18,8 +18,6 @@ #include #include -#include "fs_results.hpp" - enum FsIDirectoryCmd : u32 { FsIDirectoryCmd_Read = 0, FsIDirectoryCmd_GetEntryCount = 1, diff --git a/stratosphere/ams_mitm/source/fs_mitm/fs_ifile.hpp b/stratosphere/ams_mitm/source/fs_mitm/fs_ifile.hpp index 9f7cb17d2..1e1e26ab2 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_ifile.hpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fs_ifile.hpp @@ -18,7 +18,6 @@ #include #include -#include "fs_results.hpp" #include "fs_shim.h" enum FsIFileCmd : u32 { diff --git a/stratosphere/ams_mitm/source/fs_mitm/fs_ifilesystem.hpp b/stratosphere/ams_mitm/source/fs_mitm/fs_ifilesystem.hpp index 4e176302a..eb8d250a8 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_ifilesystem.hpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fs_ifilesystem.hpp @@ -20,7 +20,6 @@ #include "../utils.hpp" -#include "fs_results.hpp" #include "fs_filesystem_types.hpp" #include "fs_path_utils.hpp" diff --git a/stratosphere/ams_mitm/source/fs_mitm/fs_istorage.hpp b/stratosphere/ams_mitm/source/fs_mitm/fs_istorage.hpp index be019ae12..ace095de5 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_istorage.hpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fs_istorage.hpp @@ -19,8 +19,6 @@ #include #include "fs_shim.h" -#include "fs_results.hpp" - #include "../debug.hpp" enum FsIStorageCmd : u32 { diff --git a/stratosphere/ams_mitm/source/fs_mitm/fs_path_utils.cpp b/stratosphere/ams_mitm/source/fs_mitm/fs_path_utils.cpp index d4e6f26ea..1bd2b3597 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_path_utils.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fs_path_utils.cpp @@ -16,8 +16,9 @@ #include #include #include +#include + #include "fs_path_utils.hpp" -#include "fs_results.hpp" Result FsPathUtils::VerifyPath(const char *path, size_t max_path_len, size_t max_name_len) { const char *cur = path; diff --git a/stratosphere/ams_mitm/source/fs_mitm/fs_results.hpp b/stratosphere/ams_mitm/source/fs_mitm/fs_results.hpp deleted file mode 100644 index 3bcf5d50a..000000000 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_results.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2018 Atmosphère-NX - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once -#include - -static constexpr u32 Module_Fs = 2; - -static constexpr Result ResultFsPathNotFound = MAKERESULT(Module_Fs, 1); -static constexpr Result ResultFsPathAlreadyExists = MAKERESULT(Module_Fs, 2); - -static constexpr Result ResultFsTargetLocked = MAKERESULT(Module_Fs, 7); -static constexpr Result ResultFsDirectoryNotEmpty = MAKERESULT(Module_Fs, 8); - -static constexpr Result ResultFsNotImplemented = MAKERESULT(Module_Fs, 3001); -static constexpr Result ResultFsOutOfRange = MAKERESULT(Module_Fs, 3005); - -static constexpr Result ResultFsAllocationFailureInDirectorySaveDataFileSystem = MAKERESULT(Module_Fs, 3321); -static constexpr Result ResultFsAllocationFailureInSubDirectoryFileSystem = MAKERESULT(Module_Fs, 3355); - -static constexpr Result ResultFsPreconditionViolation = MAKERESULT(Module_Fs, 6000); -static constexpr Result ResultFsInvalidArgument = MAKERESULT(Module_Fs, 6001); -static constexpr Result ResultFsInvalidPath = MAKERESULT(Module_Fs, 6002); -static constexpr Result ResultFsTooLongPath = MAKERESULT(Module_Fs, 6003); -static constexpr Result ResultFsInvalidCharacter = MAKERESULT(Module_Fs, 6004); -static constexpr Result ResultFsInvalidPathFormat = MAKERESULT(Module_Fs, 6005); -static constexpr Result ResultFsDirectoryUnobtainable = MAKERESULT(Module_Fs, 6006); -static constexpr Result ResultFsNotNormalized = MAKERESULT(Module_Fs, 6007); - -static constexpr Result ResultFsInvalidOffset = MAKERESULT(Module_Fs, 6061); -static constexpr Result ResultFsInvalidSize = MAKERESULT(Module_Fs, 6062); -static constexpr Result ResultFsNullptrArgument = MAKERESULT(Module_Fs, 6063); - -static constexpr Result ResultFsUnsupportedOperation = MAKERESULT(Module_Fs, 6300); diff --git a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_layeredrom.cpp b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_layeredrom.cpp index a82c733de..044e742e7 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_layeredrom.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_layeredrom.cpp @@ -17,8 +17,6 @@ #include #include -#include "fs_results.hpp" - #include "fsmitm_layeredrom.hpp" #include "../utils.hpp" #include "../debug.hpp" diff --git a/stratosphere/creport/source/creport_crash_report.cpp b/stratosphere/creport/source/creport_crash_report.cpp index d202dff08..22441b7d3 100644 --- a/stratosphere/creport/source/creport_crash_report.cpp +++ b/stratosphere/creport/source/creport_crash_report.cpp @@ -140,20 +140,20 @@ void CrashReport::HandleAttachProcess(DebugEventInfo &d) { void CrashReport::HandleException(DebugEventInfo &d) { switch (d.info.exception.type) { case DebugExceptionType::UndefinedInstruction: - this->result = (Result)CrashReportResult::UndefinedInstruction; + this->result = ResultCreportUndefinedInstruction; break; case DebugExceptionType::InstructionAbort: - this->result = (Result)CrashReportResult::InstructionAbort; + this->result = ResultCreportInstructionAbort; d.info.exception.specific.raw = 0; break; case DebugExceptionType::DataAbort: - this->result = (Result)CrashReportResult::DataAbort; + this->result = ResultCreportDataAbort; break; case DebugExceptionType::AlignmentFault: - this->result = (Result)CrashReportResult::AlignmentFault; + this->result = ResultCreportAlignmentFault; break; case DebugExceptionType::UserBreak: - this->result = (Result)CrashReportResult::UserBreak; + this->result = ResultCreportUserBreak; /* Try to parse out the user break result. */ if (kernelAbove500()) { Result user_result = 0; @@ -167,10 +167,10 @@ void CrashReport::HandleException(DebugEventInfo &d) { } break; case DebugExceptionType::BadSvc: - this->result = (Result)CrashReportResult::BadSvc; + this->result = ResultCreportBadSvc; break; - case DebugExceptionType::UnknownNine: - this->result = (Result)CrashReportResult::UnknownNine; + case DebugExceptionType::SystemMemoryError: + this->result = ResultCreportSystemMemoryError; d.info.exception.specific.raw = 0; break; case DebugExceptionType::DebuggerAttached: diff --git a/stratosphere/creport/source/creport_crash_report.hpp b/stratosphere/creport/source/creport_crash_report.hpp index 38aa28568..0e9bcf52c 100644 --- a/stratosphere/creport/source/creport_crash_report.hpp +++ b/stratosphere/creport/source/creport_crash_report.hpp @@ -17,31 +17,18 @@ #pragma once #include +#include #include #include "creport_debug_types.hpp" #include "creport_thread_info.hpp" #include "creport_code_info.hpp" -enum class CrashReportResult : Result { - UndefinedInstruction = 0x00A8, - InstructionAbort = 0x02A8, - DataAbort = 0x04A8, - AlignmentFault = 0x06A8, - DebuggerAttached = 0x08A8, - BreakPoint = 0x0AA8, - UserBreak = 0x0CA8, - DebuggerBreak = 0x0EA8, - BadSvc = 0x10A8, - UnknownNine = 0x12A8, - IncompleteReport = 0xC6A8, -}; - class CrashReport { private: Handle debug_handle = INVALID_HANDLE; bool has_extra_info; - Result result = static_cast(CrashReportResult::IncompleteReport); + Result result = ResultCreportIncompleteReport; /* Attach Process Info. */ AttachProcessInfo process_info{}; @@ -73,7 +60,7 @@ class CrashReport { } bool WasSuccessful() { - return this->result != (Result)CrashReportResult::IncompleteReport; + return this->result != ResultCreportIncompleteReport; } bool OpenProcess(u64 pid) { diff --git a/stratosphere/creport/source/creport_debug_types.hpp b/stratosphere/creport/source/creport_debug_types.hpp index 4c2544b27..31bdbfd83 100644 --- a/stratosphere/creport/source/creport_debug_types.hpp +++ b/stratosphere/creport/source/creport_debug_types.hpp @@ -49,7 +49,7 @@ enum class DebugExceptionType : u32 { UserBreak = 6, DebuggerBreak = 7, BadSvc = 8, - UnknownNine = 9, + SystemMemoryError = 9, }; static inline const char *GetDebugExceptionTypeStr(DebugExceptionType type) { @@ -72,8 +72,8 @@ static inline const char *GetDebugExceptionTypeStr(DebugExceptionType type) { return "Debugger Break"; case DebugExceptionType::BadSvc: return "Bad Svc"; - case DebugExceptionType::UnknownNine: - return "Unknown Nine"; + case DebugExceptionType::SystemMemoryError: + return "System Memory Error"; default: return "Unknown"; } diff --git a/stratosphere/dmnt/source/dmnt_cheat_types.hpp b/stratosphere/dmnt/source/dmnt_cheat_types.hpp index 830777c86..0e9c2d0d2 100644 --- a/stratosphere/dmnt/source/dmnt_cheat_types.hpp +++ b/stratosphere/dmnt/source/dmnt_cheat_types.hpp @@ -18,8 +18,6 @@ #include #include -#include "dmnt_results.hpp" - struct MemoryRegionExtents { u64 base; u64 size; diff --git a/stratosphere/dmnt/source/dmnt_results.hpp b/stratosphere/dmnt/source/dmnt_results.hpp deleted file mode 100644 index 35dd907f3..000000000 --- a/stratosphere/dmnt/source/dmnt_results.hpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2018 Atmosphère-NX - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once -#include -#include - -static constexpr u32 Module_Dmnt = 13; - -static constexpr Result ResultDmntUnknown = MAKERESULT(Module_Dmnt, 1); -static constexpr Result ResultDmntDebuggingDisabled = MAKERESULT(Module_Dmnt, 2); - -static constexpr Result ResultDmntCheatNotAttached = MAKERESULT(Module_Dmnt, 6500); -static constexpr Result ResultDmntCheatNullBuffer = MAKERESULT(Module_Dmnt, 6501); -static constexpr Result ResultDmntCheatInvalidBuffer = MAKERESULT(Module_Dmnt, 6502); -static constexpr Result ResultDmntCheatUnknownChtId = MAKERESULT(Module_Dmnt, 6503); -static constexpr Result ResultDmntCheatOutOfCheats = MAKERESULT(Module_Dmnt, 6504); -static constexpr Result ResultDmntCheatInvalidCheat = MAKERESULT(Module_Dmnt, 6505); -static constexpr Result ResultDmntCheatCannotDisableMasterCheat = MAKERESULT(Module_Dmnt, 6505); - -static constexpr Result ResultDmntCheatInvalidFreezeWidth = MAKERESULT(Module_Dmnt, 6600); -static constexpr Result ResultDmntCheatAddressAlreadyFrozen = MAKERESULT(Module_Dmnt, 6601); -static constexpr Result ResultDmntCheatAddressNotFrozen = MAKERESULT(Module_Dmnt, 6602); -static constexpr Result ResultDmntCheatTooManyFrozenAddresses = MAKERESULT(Module_Dmnt, 6603); - -static constexpr Result ResultDmntCheatVmInvalidCondDepth = MAKERESULT(Module_Dmnt, 6700); \ No newline at end of file diff --git a/stratosphere/libstratosphere b/stratosphere/libstratosphere index 31c1dc1a8..ea5c0f017 160000 --- a/stratosphere/libstratosphere +++ b/stratosphere/libstratosphere @@ -1 +1 @@ -Subproject commit 31c1dc1a825dae11e5ae3424728c8fe411e42142 +Subproject commit ea5c0f0174df284c92893561611ea3bb92d31038