summaryrefslogtreecommitdiff
path: root/src/wiiu/wiiu.cpp
blob: 742be0c052e10a301617f45c25de2830eccb3a92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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
};