Implement plugin loader Mode3 mem strategy (#7)

This commit is contained in:
PabloMK7 2024-03-05 14:06:50 +01:00 committed by GitHub
parent f5316532e6
commit c710c0009f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 61 additions and 12 deletions

View file

@ -117,6 +117,14 @@ public:
return std::make_pair(0x2, ResultStatus::Success);
}
/**
* Forces the application memory mode to the specified value,
* overriding the memory mode specified in the metadata.
*/
void SetKernelMemoryModeOverride(Kernel::MemoryMode mem_override) {
memory_mode_override = mem_override;
}
/**
* Loads the memory mode that this application needs.
* This function defaults to Dev1 (96MB allocated to the application) if it can't read the
@ -124,6 +132,9 @@ public:
* @returns A pair with the optional memory mode, and the status.
*/
virtual std::pair<std::optional<Kernel::MemoryMode>, ResultStatus> LoadKernelMemoryMode() {
if (memory_mode_override.has_value()) {
return std::make_pair(*memory_mode_override, ResultStatus::Success);
}
// 96MB allocated to the application.
return std::make_pair(Kernel::MemoryMode::Dev1, ResultStatus::Success);
}
@ -257,6 +268,7 @@ protected:
Core::System& system;
FileUtil::IOFile file;
bool is_loaded = false;
std::optional<Kernel::MemoryMode> memory_mode_override = std::nullopt;
};
/**