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

@ -288,16 +288,20 @@ bool Emulator::loadROM(const std::filesystem::path& path) {
if (extension == ".elf" || extension == ".axf")
return loadELF(path);
else if (extension == ".3ds")
return loadNCSD(path);
return loadNCSD(path, ROMType::NCSD);
else if (extension == ".cxi")
return loadNCSD(path, ROMType::CXI);
else {
printf("Unknown file type\n");
return false;
}
}
bool Emulator::loadNCSD(const std::filesystem::path& path) {
romType = ROMType::NCSD;
std::optional<NCSD> opt = memory.loadNCSD(aesEngine, path);
// Used for loading both CXI and NCSD files since they are both so similar and use the same interface
// (We promote CXI files to NCSD internally for ease)
bool Emulator::loadNCSD(const std::filesystem::path& path, ROMType type) {
romType = type;
std::optional<NCSD> opt = (type == ROMType::NCSD) ? memory.loadNCSD(aesEngine, path) : memory.loadCXI(aesEngine, path);
if (!opt.has_value()) {
return false;