summaryrefslogtreecommitdiff
path: root/src/core/loader.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2014-06-16 17:51:04 -0400
committerGravatar bunnei2014-06-16 17:51:04 -0400
commit10ae45b5e7b4d66660803cc5dfe26aa6e1b8843f (patch)
treedb1dec8381b8b1dc2d87654a8cbd07f099a230df /src/core/loader.cpp
parentMerge branch 'threading' of https://github.com/bunnei/citra (diff)
downloadyuzu-10ae45b5e7b4d66660803cc5dfe26aa6e1b8843f.tar.gz
yuzu-10ae45b5e7b4d66660803cc5dfe26aa6e1b8843f.tar.xz
yuzu-10ae45b5e7b4d66660803cc5dfe26aa6e1b8843f.zip
Loader: Removed unused CXI and DAT loading code.
Diffstat (limited to 'src/core/loader.cpp')
-rw-r--r--src/core/loader.cpp76
1 files changed, 0 insertions, 76 deletions
diff --git a/src/core/loader.cpp b/src/core/loader.cpp
index ff1c873bb..c14f2259c 100644
--- a/src/core/loader.cpp
+++ b/src/core/loader.cpp
@@ -8,34 +8,12 @@
8#include "core/loader.h" 8#include "core/loader.h"
9#include "core/system.h" 9#include "core/system.h"
10#include "core/core.h" 10#include "core/core.h"
11#include "core/file_sys/directory_file_system.h"
12#include "core/elf/elf_reader.h" 11#include "core/elf/elf_reader.h"
13#include "core/hle/kernel/kernel.h" 12#include "core/hle/kernel/kernel.h"
14#include "core/mem_map.h" 13#include "core/mem_map.h"
15 14
16//////////////////////////////////////////////////////////////////////////////////////////////////// 15////////////////////////////////////////////////////////////////////////////////////////////////////
17 16
18/// Loads an extracted CXI from a directory
19bool LoadDirectory_CXI(std::string &filename) {
20 std::string full_path = filename;
21 std::string path, file, extension;
22 SplitPath(ReplaceAll(full_path, "\\", "/"), &path, &file, &extension);
23#if EMU_PLATFORM == PLATFORM_WINDOWS
24 path = ReplaceAll(path, "/", "\\");
25#endif
26 DirectoryFileSystem *fs = new DirectoryFileSystem(&System::g_ctr_file_system, path);
27 System::g_ctr_file_system.Mount("fs:", fs);
28
29 std::string final_name = "fs:/" + file + extension;
30 File::IOFile f(filename, "rb");
31
32 if (f.IsOpen()) {
33 // TODO(ShizZy): read here to memory....
34 }
35 ERROR_LOG(TIME, "Unimplemented function!");
36 return true;
37}
38
39/// Loads a CTR ELF file 17/// Loads a CTR ELF file
40bool Load_ELF(std::string &filename) { 18bool Load_ELF(std::string &filename) {
41 std::string full_path = filename; 19 std::string full_path = filename;
@@ -68,54 +46,6 @@ bool Load_ELF(std::string &filename) {
68 return true; 46 return true;
69} 47}
70 48
71/// Loads a Launcher DAT file
72bool Load_DAT(std::string &filename) {
73 std::string full_path = filename;
74 std::string path, file, extension;
75 SplitPath(ReplaceAll(full_path, "\\", "/"), &path, &file, &extension);
76#if EMU_PLATFORM == PLATFORM_WINDOWS
77 path = ReplaceAll(path, "/", "\\");
78#endif
79 File::IOFile f(filename, "rb");
80
81 if (f.IsOpen()) {
82 u64 size = f.GetSize();
83 u8* buffer = new u8[size];
84
85 f.ReadBytes(buffer, size);
86
87 /**
88 * (mattvail) We shouldn't really support this type of file
89 * but for the sake of making it easier... we'll temporarily/hackishly
90 * allow it. No sense in making a proper reader for this.
91 */
92 u32 entry_point = 0x00100000; // write to same entrypoint as elf
93 u32 payload_offset = 0xA150;
94
95 const u8 *src = &buffer[payload_offset];
96 u8 *dst = Memory::GetPointer(entry_point);
97 u32 srcSize = size - payload_offset; //just load everything...
98 u32 *s = (u32*)src;
99 u32 *d = (u32*)dst;
100 for (int j = 0; j < (int)(srcSize + 3) / 4; j++)
101 {
102 *d++ = (*s++);
103 }
104
105 Kernel::LoadExec(entry_point);
106
107
108 delete[] buffer;
109 }
110 else {
111 return false;
112 }
113 f.Close();
114
115 return true;
116}
117
118
119/// Loads a CTR BIN file extracted from an ExeFS 49/// Loads a CTR BIN file extracted from an ExeFS
120bool Load_BIN(std::string &filename) { 50bool Load_BIN(std::string &filename) {
121 std::string full_path = filename; 51 std::string full_path = filename;
@@ -229,12 +159,6 @@ bool LoadFile(std::string &filename, std::string *error_string) {
229 case FILETYPE_CTR_BIN: 159 case FILETYPE_CTR_BIN:
230 return Load_BIN(filename); 160 return Load_BIN(filename);
231 161
232 case FILETYPE_LAUNCHER_DAT:
233 return Load_DAT(filename);
234
235 case FILETYPE_DIRECTORY_CXI:
236 return LoadDirectory_CXI(filename);
237
238 case FILETYPE_ERROR: 162 case FILETYPE_ERROR:
239 ERROR_LOG(LOADER, "Could not read file"); 163 ERROR_LOG(LOADER, "Could not read file");
240 *error_string = "Error reading file"; 164 *error_string = "Error reading file";