forked from PlexaryDamato/nrage-input
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathGBCart.h
81 lines (74 loc) · 2.35 KB
/
GBCart.h
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef _GBCART_H_
#define _GBCART_H_
#include <windows.h>
#include <time.h>
typedef struct _gbCartRTC {
UINT mapperSeconds;
UINT mapperMinutes;
UINT mapperHours;
UINT mapperDays;
UINT mapperControl;
UINT mapperLSeconds;
UINT mapperLMinutes;
UINT mapperLHours;
UINT mapperLDays;
UINT mapperLControl;
time_t mapperLastTime;
} gbCartRTC, *lpgbCartRTC;
typedef struct _GBCART
{
unsigned int iCurrentRomBankNo;
unsigned int iCurrentRamBankNo;
int iCartType;
bool bHasRam;
bool bHasBattery;
bool bHasTimer;
bool bHasRumble;
bool bRamEnableState;
bool bMBC1RAMbanking; // if false, use 2 magic bits for Most Significant Bits of ROM banking (default); if true, use the 2 magic bits for RAM banking
unsigned int iNumRomBanks;
unsigned int iNumRamBanks;
BYTE TimerData[5];
BYTE LatchedTimerData[5];
time_t timerLastUpdate;
bool TimerDataLatched;
HANDLE hRomFile; // a file mapping handle
HANDLE hRamFile; // a file mapping handle, must be NULL if malloc'd ram is being used instead of a valid memory mapped file
LPTSTR sGoombaRamPath; // (TCHAR) path to the Goomba / Goomba Color file that the RAM was loaded from, must be NULL if Goomba is not being used
unsigned int iGoombaRamSize; // size of uncompressed GB/GBC RAM loaded from Goomba file
char GoombaHeaderTitle[16]; // (ASCII) title field of the Goomba header that should be replaced upon saving
LPCBYTE RomData; // max [0x200 * 0x4000];
LPBYTE RamData; // max [0x10 * 0x2000];
bool (*ptrfnReadCart)(_GBCART * Cart, WORD dwAddress, BYTE *Data); // ReadCart handler
bool (*ptrfnWriteCart)(_GBCART * Cart, WORD dwAddress, BYTE *Data); // WriteCart handler
} GBCART, *LPGBCART;
bool LoadCart(LPGBCART Cart, LPCTSTR RomFile, LPCTSTR RamFile, LPCTSTR TdfFile);
// bool ReadCart(LPGBCART Cart, WORD dwAddress, BYTE *Data);
// bool WriteCart(LPGBCART Cart, WORD dwAddress, BYTE *Data);
bool SaveCart(LPGBCART Cart, LPTSTR SaveFile, LPTSTR TimeFile);
bool UnloadCart(LPGBCART Cart);
/*
iCartType values:
0 = no MBC
1 = MBC1
2 = MBC2
3 = MMMO1
4 = MBC3
5 = MBC5
6 = Pocket Camera
7 = TAMA 5
8 = HuC 3
9 = HuC 1
Note, that 6 and up are not implemented yet.
*/
#define GB_NORM 0x00
#define GB_MBC1 0x01
#define GB_MBC2 0x02
#define GB_MMMO1 0x03
#define GB_MBC3 0x04
#define GB_MBC5 0x05
#define GB_CAMERA 0x06
#define GB_TAMA5 0x07
#define GB_HUC3 0x08
#define GB_HUC1 0x09
#endif // #ifndef _GBCART_H_