summaryrefslogtreecommitdiff
path: root/src/wiiu/wiiu.cpp
diff options
context:
space:
mode:
authoraerosoul94 <aerosoul94@hotmail.com>2017-04-09 00:35:32 -0500
committeraerosoul94 <aerosoul94@hotmail.com>2017-04-09 00:35:32 -0500
commit592b0484b9c1e943093dd93b720428ebfaa116d2 (patch)
treeecc226844a4131c67f720b74471eb097bd9f8926 /src/wiiu/wiiu.cpp
parent991de71c144a0d2b70034593b03b6b93a96a0791 (diff)
Add Wii U RPX/RPL loader src. Some bug fixes.
Diffstat (limited to 'src/wiiu/wiiu.cpp')
-rw-r--r--src/wiiu/wiiu.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/wiiu/wiiu.cpp b/src/wiiu/wiiu.cpp
new file mode 100644
index 0000000..742be0c
--- /dev/null
+++ b/src/wiiu/wiiu.cpp
@@ -0,0 +1,49 @@
+#include "elf_reader.h"
+#include "cafe_loader.h"
+
+#include <idaldr.h>
+
+static int idaapi
+ accept_file(linput_t *li, char fileformatname[MAX_FILE_FORMAT_NAME], int n)
+{
+ if ( n > 0 )
+ return 0;
+
+ elf_reader<elf32> elf(li);
+
+ if (elf.verifyHeader()) {
+ if (elf.type() == ELF_FILETYPE_CAFE_RPL) {
+ set_processor_type("ppc", SETPROC_ALL);
+
+ qsnprintf(fileformatname, MAX_FILE_FORMAT_NAME, "WII U RPX/RPL");
+ return ACCEPT_FIRST | 1;
+ }
+ }
+
+ return 0;
+}
+
+static void idaapi
+ load_file(linput_t *li, ushort neflags, const char *fileformatname)
+{
+ elf_reader<elf32> elf(li); elf.read();
+
+ ea_t relocAddr = 0;
+ if (neflags & NEF_MAN) {
+ askaddr(&relocAddr, "Please specify a relocation address base.");
+ }
+
+ cafe_loader ldr(&elf); ldr.apply();
+}
+
+__declspec(dllexport)
+loader_t LDSC =
+{
+ IDP_INTERFACE_VERSION,
+ 0,
+ accept_file,
+ load_file,
+ NULL,
+ NULL,
+ NULL
+}; \ No newline at end of file