diff options
author | ShizZy <shizzy@6bit.net> | 2013-10-02 01:09:49 +0200 |
---|---|---|
committer | ShizZy <shizzy@6bit.net> | 2013-10-02 01:09:49 +0200 |
commit | 4c24ea3d88875aff4be4eb128b043f1eaf55d5b4 (patch) | |
tree | decdcfe879edf15ecd4b81aec42e4cbd7878f91b | |
parent | added a message option to Core::Halt function (diff) | |
download | yuzu-4c24ea3d88875aff4be4eb128b043f1eaf55d5b4.tar yuzu-4c24ea3d88875aff4be4eb128b043f1eaf55d5b4.tar.gz yuzu-4c24ea3d88875aff4be4eb128b043f1eaf55d5b4.tar.bz2 yuzu-4c24ea3d88875aff4be4eb128b043f1eaf55d5b4.tar.lz yuzu-4c24ea3d88875aff4be4eb128b043f1eaf55d5b4.tar.xz yuzu-4c24ea3d88875aff4be4eb128b043f1eaf55d5b4.tar.zst yuzu-4c24ea3d88875aff4be4eb128b043f1eaf55d5b4.zip |
-rw-r--r-- | src/core/src/loader.cpp | 39 | ||||
-rw-r--r-- | src/core/src/loader.h | 12 |
2 files changed, 35 insertions, 16 deletions
diff --git a/src/core/src/loader.cpp b/src/core/src/loader.cpp index 44cb92a29..5b746b7eb 100644 --- a/src/core/src/loader.cpp +++ b/src/core/src/loader.cpp @@ -24,19 +24,38 @@ #include "file_util.h" #include "loader.h" +#include "system.h" +#include "file_sys/directory_file_system.h" //////////////////////////////////////////////////////////////////////////////////////////////////// -bool _Load_BIN(std::string &filename) { - File::IOFile f(filename, "rb"); - if (f.IsOpen()) { +bool LoadDirectory(std::string &filename) { + std::string full_path = filename; + std::string path, file, extension; + SplitPath(ReplaceAll(full_path, "\\", "/"), &path, &file, &extension); +#if EMU_PLATFORM == PLATFORM_WINDOWS + path = ReplaceAll(path, "/", "\\"); +#endif + DirectoryFileSystem *fs = new DirectoryFileSystem(&System::g_ctr_file_system, path); + System::g_ctr_file_system.Mount("fs:", fs); + + std::string final_name = "fs:/" + file + extension; + //File::IOFile f(filename, "rb"); + + //if (f.IsOpen()) { // TODO(ShizZy): read here to memory.... - } + //} + ERROR_LOG(TIME, "Unimplemented function!"); return true; } namespace Loader { +bool IsBootableDirectory() { + ERROR_LOG(TIME, "Unimplemented function!"); + return true; +} + /** * Identifies the type of a bootable file * @param filename String filename of bootable file @@ -51,9 +70,11 @@ FileType IdentifyFile(std::string &filename) { std::string extension = filename.size() >= 5 ? filename.substr(filename.size() - 4) : ""; if (File::IsDirectory(filename)) { - return FILETYPE_NORMAL_DIRECTORY; - } else if (!strcasecmp(extension.c_str(),".bin")) { - return FILETYPE_3DS_BIN; + if (IsBootableDirectory()) { + return FILETYPE_CTR_DIRECTORY; + } else { + return FILETYPE_NORMAL_DIRECTORY; + } } else if (!strcasecmp(extension.c_str(),".zip")) { return FILETYPE_ARCHIVE_ZIP; } else if (!strcasecmp(extension.c_str(),".rar")) { @@ -77,10 +98,10 @@ bool LoadFile(std::string &filename, std::string *error_string) { // Note that this can modify filename! switch (IdentifyFile(filename)) { - case FILETYPE_3DS_BIN: + case FILETYPE_CTR_DIRECTORY: { INFO_LOG(LOADER,"File is a BIN !"); - return _Load_BIN(filename); + return LoadDirectory(filename); } case FILETYPE_ERROR: diff --git a/src/core/src/loader.h b/src/core/src/loader.h index 4a0b3cf67..a11d8d596 100644 --- a/src/core/src/loader.h +++ b/src/core/src/loader.h @@ -34,14 +34,12 @@ namespace Loader { enum FileType { FILETYPE_ERROR, - FILETYPE_3DS_CCI, - FILETYPE_3DS_CIA, - FILETYPE_3DS_CXI, + FILETYPE_CTR_CCI, + FILETYPE_CTR_CIA, + FILETYPE_CTR_CXI, + FILETYPE_CTR_ELF, - FILETYPE_3DS_BIN, - FILETYPE_3DS_ELF, - - FILETYPE_CTR_DISC_DIRECTORY, + FILETYPE_CTR_DIRECTORY, FILETYPE_UNKNOWN_BIN, FILETYPE_UNKNOWN_ELF, |