loader: Use result definitions instead of magic numbers

This commit is contained in:
Michael Scire 2019-03-28 15:06:50 -07:00
parent 2678735f73
commit db19fa0f7f
12 changed files with 96 additions and 92 deletions

View file

@ -16,6 +16,7 @@
#pragma once
#include <switch.h>
#include <stratosphere.hpp>
class MapUtils {
public:
@ -103,7 +104,7 @@ struct MappedCodeMemory {
Result Open(Handle process_h, bool is_64_bit_address_space, u64 address, u64 size) {
Result rc;
if (this->IsActive()) {
return 0x19009;
return ResultLoaderInternalError;
}
this->process_handle = process_h;
@ -119,7 +120,7 @@ struct MappedCodeMemory {
Result OpenAtAddress(Handle process_h, u64 address, u64 size, u64 target_code_memory_address) {
Result rc;
if (this->IsActive()) {
return 0x19009;
return ResultLoaderInternalError;
}
this->process_handle = process_h;
this->base_address = address;
@ -137,7 +138,7 @@ struct MappedCodeMemory {
Result rc;
u64 try_address;
if (this->IsMapped()) {
return 0x19009;
return ResultLoaderInternalError;
}
if (R_FAILED(rc = MapUtils::LocateSpaceForMap(&try_address, size))) {
return rc;