1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-23 04:12:02 +00:00

stratosphere: migrate result headers to libstrat

This commit is contained in:
Michael Scire 2019-03-28 14:23:34 -07:00
parent 23424629c9
commit 2678735f73
14 changed files with 18 additions and 126 deletions

View file

@ -16,7 +16,7 @@
#include <cstring> #include <cstring>
#include <cstdlib> #include <cstdlib>
#include <switch.h> #include <switch.h>
#include "fs_results.hpp"
#include "fs_dir_utils.hpp" #include "fs_dir_utils.hpp"
#include "fs_ifile.hpp" #include "fs_ifile.hpp"

View file

@ -18,8 +18,6 @@
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include "fs_results.hpp"
enum FsIDirectoryCmd : u32 { enum FsIDirectoryCmd : u32 {
FsIDirectoryCmd_Read = 0, FsIDirectoryCmd_Read = 0,
FsIDirectoryCmd_GetEntryCount = 1, FsIDirectoryCmd_GetEntryCount = 1,

View file

@ -18,7 +18,6 @@
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include "fs_results.hpp"
#include "fs_shim.h" #include "fs_shim.h"
enum FsIFileCmd : u32 { enum FsIFileCmd : u32 {

View file

@ -20,7 +20,6 @@
#include "../utils.hpp" #include "../utils.hpp"
#include "fs_results.hpp"
#include "fs_filesystem_types.hpp" #include "fs_filesystem_types.hpp"
#include "fs_path_utils.hpp" #include "fs_path_utils.hpp"

View file

@ -19,8 +19,6 @@
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include "fs_shim.h" #include "fs_shim.h"
#include "fs_results.hpp"
#include "../debug.hpp" #include "../debug.hpp"
enum FsIStorageCmd : u32 { enum FsIStorageCmd : u32 {

View file

@ -16,8 +16,9 @@
#include <cstring> #include <cstring>
#include <cstdlib> #include <cstdlib>
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp>
#include "fs_path_utils.hpp" #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) { Result FsPathUtils::VerifyPath(const char *path, size_t max_path_len, size_t max_name_len) {
const char *cur = path; const char *cur = path;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <switch.h>
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);

View file

@ -17,8 +17,6 @@
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include "fs_results.hpp"
#include "fsmitm_layeredrom.hpp" #include "fsmitm_layeredrom.hpp"
#include "../utils.hpp" #include "../utils.hpp"
#include "../debug.hpp" #include "../debug.hpp"

View file

@ -140,20 +140,20 @@ void CrashReport::HandleAttachProcess(DebugEventInfo &d) {
void CrashReport::HandleException(DebugEventInfo &d) { void CrashReport::HandleException(DebugEventInfo &d) {
switch (d.info.exception.type) { switch (d.info.exception.type) {
case DebugExceptionType::UndefinedInstruction: case DebugExceptionType::UndefinedInstruction:
this->result = (Result)CrashReportResult::UndefinedInstruction; this->result = ResultCreportUndefinedInstruction;
break; break;
case DebugExceptionType::InstructionAbort: case DebugExceptionType::InstructionAbort:
this->result = (Result)CrashReportResult::InstructionAbort; this->result = ResultCreportInstructionAbort;
d.info.exception.specific.raw = 0; d.info.exception.specific.raw = 0;
break; break;
case DebugExceptionType::DataAbort: case DebugExceptionType::DataAbort:
this->result = (Result)CrashReportResult::DataAbort; this->result = ResultCreportDataAbort;
break; break;
case DebugExceptionType::AlignmentFault: case DebugExceptionType::AlignmentFault:
this->result = (Result)CrashReportResult::AlignmentFault; this->result = ResultCreportAlignmentFault;
break; break;
case DebugExceptionType::UserBreak: case DebugExceptionType::UserBreak:
this->result = (Result)CrashReportResult::UserBreak; this->result = ResultCreportUserBreak;
/* Try to parse out the user break result. */ /* Try to parse out the user break result. */
if (kernelAbove500()) { if (kernelAbove500()) {
Result user_result = 0; Result user_result = 0;
@ -167,10 +167,10 @@ void CrashReport::HandleException(DebugEventInfo &d) {
} }
break; break;
case DebugExceptionType::BadSvc: case DebugExceptionType::BadSvc:
this->result = (Result)CrashReportResult::BadSvc; this->result = ResultCreportBadSvc;
break; break;
case DebugExceptionType::UnknownNine: case DebugExceptionType::SystemMemoryError:
this->result = (Result)CrashReportResult::UnknownNine; this->result = ResultCreportSystemMemoryError;
d.info.exception.specific.raw = 0; d.info.exception.specific.raw = 0;
break; break;
case DebugExceptionType::DebuggerAttached: case DebugExceptionType::DebuggerAttached:

View file

@ -17,31 +17,18 @@
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp>
#include <cstdio> #include <cstdio>
#include "creport_debug_types.hpp" #include "creport_debug_types.hpp"
#include "creport_thread_info.hpp" #include "creport_thread_info.hpp"
#include "creport_code_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 { class CrashReport {
private: private:
Handle debug_handle = INVALID_HANDLE; Handle debug_handle = INVALID_HANDLE;
bool has_extra_info; bool has_extra_info;
Result result = static_cast<Result>(CrashReportResult::IncompleteReport); Result result = ResultCreportIncompleteReport;
/* Attach Process Info. */ /* Attach Process Info. */
AttachProcessInfo process_info{}; AttachProcessInfo process_info{};
@ -73,7 +60,7 @@ class CrashReport {
} }
bool WasSuccessful() { bool WasSuccessful() {
return this->result != (Result)CrashReportResult::IncompleteReport; return this->result != ResultCreportIncompleteReport;
} }
bool OpenProcess(u64 pid) { bool OpenProcess(u64 pid) {

View file

@ -49,7 +49,7 @@ enum class DebugExceptionType : u32 {
UserBreak = 6, UserBreak = 6,
DebuggerBreak = 7, DebuggerBreak = 7,
BadSvc = 8, BadSvc = 8,
UnknownNine = 9, SystemMemoryError = 9,
}; };
static inline const char *GetDebugExceptionTypeStr(DebugExceptionType type) { static inline const char *GetDebugExceptionTypeStr(DebugExceptionType type) {
@ -72,8 +72,8 @@ static inline const char *GetDebugExceptionTypeStr(DebugExceptionType type) {
return "Debugger Break"; return "Debugger Break";
case DebugExceptionType::BadSvc: case DebugExceptionType::BadSvc:
return "Bad Svc"; return "Bad Svc";
case DebugExceptionType::UnknownNine: case DebugExceptionType::SystemMemoryError:
return "Unknown Nine"; return "System Memory Error";
default: default:
return "Unknown"; return "Unknown";
} }

View file

@ -18,8 +18,6 @@
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include "dmnt_results.hpp"
struct MemoryRegionExtents { struct MemoryRegionExtents {
u64 base; u64 base;
u64 size; u64 size;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <switch.h>
#include <stratosphere.hpp>
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);

@ -1 +1 @@
Subproject commit 31c1dc1a825dae11e5ae3424728c8fe411e42142 Subproject commit ea5c0f0174df284c92893561611ea3bb92d31038