Add CXI ROM support

Co-Authored-By: Kelpsy <138107494+Kelpsyberry@users.noreply.github.com>
This commit is contained in:
wheremyfoodat 2023-07-06 16:21:26 +03:00
parent 4e5eb884ed
commit 187feb5772
4 changed files with 118 additions and 54 deletions

View file

@ -13,7 +13,7 @@
#include "memory.hpp"
#include "gl_state.hpp"
enum class ROMType { None, ELF, NCSD };
enum class ROMType { None, ELF, NCSD, CXI };
class Emulator {
CPU cpu;
@ -54,7 +54,7 @@ class Emulator {
void runFrame();
bool loadROM(const std::filesystem::path& path);
bool loadNCSD(const std::filesystem::path& path);
bool loadNCSD(const std::filesystem::path& path, ROMType type);
bool loadELF(const std::filesystem::path& path);
bool loadELF(std::ifstream& file);
void initGraphicsContext();

View file

@ -150,7 +150,10 @@ public:
void* getReadPointer(u32 address);
void* getWritePointer(u32 address);
std::optional<u32> loadELF(std::ifstream& file);
std::optional<NCSD> loadNCSD(Crypto::AESEngine &aesEngine, const std::filesystem::path& path);
std::optional<NCSD> loadNCSD(Crypto::AESEngine& aesEngine, const std::filesystem::path& path);
std::optional<NCSD> loadCXI(Crypto::AESEngine& aesEngine, const std::filesystem::path& path);
bool mapCXI(NCSD& ncsd, NCCH& cxi);
u8 read8(u32 vaddr);
u16 read16(u32 vaddr);