summaryrefslogtreecommitdiff
path: root/includes/mips.h
blob: b0409eaaf31f1072ddba6be740b14c593a1be6c9 (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
#ifndef __MIPS_H__
#define __MIPS_H__
#include <Exceptions.h>
#include <generic.h>
#include <Handle.h>

class mips : public Base {
  public:
    Uint8 Read8(Uint32);
    Uint16 Read16(Uint32);
    Uint32 Read32(Uint32);
    void Write8(Uint32, Uint8);
    void Write16(Uint32, Uint16);
    void Write32(Uint32, Uint32);
    void unpatch8(Uint32);
    void unpatch16(Uint32);
    void unpatch32(Uint32);
    bool IsPatched(Uint32);
    void LoadEXE(Handle *);
    void SaveEXE(Handle *);
    Uint32 GetPC();
  private:
    void patch(Uint32, int);
    void unpatch(Uint32, int);
    Uint8 psyqhead[0x800];
    Uint8 plainmemory[0x200000];
    Uint8 patches[0x200000];
    Uint8 patchesmap[0x200000 / 8];
    Uint32 paddr, psize, startpc;
    
    struct psyq {
	Uint8 id[8];
	Uint32 text, data, pc0, gp0, t_addr, t_size;
	Uint32 d_addr, d_size, b_addr, b_size, s_addr, s_size;
	Uint32 sp, fp, gp, ra, s0;
    };
};

#endif