mirror of
https://github.com/PabloMK7/citra.git
synced 2025-09-10 04:40:05 +00:00
Add Artic Base support
This commit is contained in:
parent
b5126f979c
commit
78c48a46e0
77 changed files with 5467 additions and 501 deletions
|
@ -9,6 +9,7 @@
|
|||
#include "core/core.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/loader/3dsx.h"
|
||||
#include "core/loader/artic.h"
|
||||
#include "core/loader/elf.h"
|
||||
#include "core/loader/ncch.h"
|
||||
|
||||
|
@ -74,6 +75,8 @@ const char* GetFileTypeString(FileType type) {
|
|||
return "ELF";
|
||||
case FileType::THREEDSX:
|
||||
return "3DSX";
|
||||
case FileType::ARTIC:
|
||||
return "ARTIC";
|
||||
case FileType::Error:
|
||||
case FileType::Unknown:
|
||||
break;
|
||||
|
@ -108,12 +111,39 @@ static std::unique_ptr<AppLoader> GetFileLoader(Core::System& system, FileUtil::
|
|||
case FileType::CCI:
|
||||
return std::make_unique<AppLoader_NCCH>(system, std::move(file), filepath);
|
||||
|
||||
case FileType::ARTIC: {
|
||||
auto strToUInt = [](const std::string& str) -> int {
|
||||
char* pEnd = NULL;
|
||||
unsigned long ul = ::strtoul(str.c_str(), &pEnd, 10);
|
||||
if (*pEnd)
|
||||
return -1;
|
||||
return static_cast<int>(ul);
|
||||
};
|
||||
|
||||
u16 port = 5543;
|
||||
std::string server_addr = filename;
|
||||
auto pos = server_addr.find(":");
|
||||
if (pos != server_addr.npos) {
|
||||
int newVal = strToUInt(server_addr.substr(pos + 1));
|
||||
if (newVal >= 0 && newVal <= 0xFFFF) {
|
||||
port = static_cast<u16>(newVal);
|
||||
server_addr = server_addr.substr(0, pos);
|
||||
}
|
||||
}
|
||||
return std::make_unique<Apploader_Artic>(system, server_addr, port);
|
||||
}
|
||||
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<AppLoader> GetLoader(const std::string& filename) {
|
||||
if (filename.starts_with("articbase://")) {
|
||||
return GetFileLoader(Core::System::GetInstance(), FileUtil::IOFile(), FileType::ARTIC,
|
||||
filename.substr(12), "");
|
||||
}
|
||||
|
||||
FileUtil::IOFile file(filename, "rb");
|
||||
if (!file.IsOpen()) {
|
||||
LOG_ERROR(Loader, "Failed to load file {}", filename);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue