1 /*
2  * PROPRIETARY INFORMATION.  This software is proprietary to POWDER
3  * Development, and is not to be reproduced, transmitted, or disclosed
4  * in any way without written permission.
5  *
6  * Produced by:	Jeff Lait
7  *
8  *      	POWDER Development
9  *
10  * NAME:        hamfake.h ( POWDER Library, C++ )
11  *
12  * COMMENTS:
13  */
14 
15 #ifndef __hamfake__
16 #define __hamfake__
17 
18 #include "../../control.h"
19 
20 //
21 // External Hooks
22 //
23 void hamfake_rebuildScreen();
24 void hamfake_awaitEvent();
25 
26 u16 *hamfake_lockScreen();
27 void hamfake_unlockScreen(u16 *screen);
28 
29 char *hamfake_writeLockSRAM();
30 void hamfake_writeUnlockSRAM(char *);
31 char *hamfake_readLockSRAM();
32 void hamfake_readUnlockSRAM(char *);
33 
34 // Flags that we are done writing to the SRAM.  Allows us to only
35 // write to disk once.
36 void hamfake_endWritingSession();
37 
38 void hamfake_softReset();
39 
40 // Is file system present?
41 bool hamfake_fatvalid();
42 
43 //
44 // Type clones.
45 //
46 struct tile_info
47 {
48     u8		blockid;		// Block address of this tileset.
49 };
50 
51 typedef tile_info *tile_info_ptr;
52 
53 struct map_info
54 {
55     u8		blockid;		// Block address of this map.
56     bool	largemap;
57 };
58 
59 typedef map_info *map_info_ptr;
60 
61 struct bg_info
62 {
63     map_info_ptr	mi;
64     tile_info_ptr	ti;
65 
66     int			scrollx, scrolly;
67 };
68 
69 extern bg_info	ham_bg[];
70 
71 //
72 // Raw data accessors.
73 //
74 int hamfake_isAnyPressed();
75 bool hamfake_isPressed(BUTTONS button);
76 
77 #define F_CTRLINPUT_UP_PRESSED hamfake_isPressed(BUTTON_UP)
78 #define F_CTRLINPUT_DOWN_PRESSED hamfake_isPressed(BUTTON_DOWN)
79 #define F_CTRLINPUT_LEFT_PRESSED hamfake_isPressed(BUTTON_LEFT)
80 #define F_CTRLINPUT_RIGHT_PRESSED hamfake_isPressed(BUTTON_RIGHT)
81 
82 #define F_CTRLINPUT_A_PRESSED hamfake_isPressed(BUTTON_A)
83 #define F_CTRLINPUT_B_PRESSED hamfake_isPressed(BUTTON_B)
84 #define F_CTRLINPUT_R_PRESSED hamfake_isPressed(BUTTON_R)
85 #define F_CTRLINPUT_L_PRESSED hamfake_isPressed(BUTTON_L)
86 
87 #define F_CTRLINPUT_SELECT_PRESSED hamfake_isPressed(BUTTON_SELECT)
88 #define F_CTRLINPUT_START_PRESSED hamfake_isPressed(BUTTON_START)
89 
90 #define R_CTRLINPUT \
91 	hamfake_isAnyPressed()
92 
93 // Gets a new keypress.  Returns 0 if no keypress is ready.
94 // Clears key after getting it.
95 int hamfake_getKeyPress(bool onlyascii);
96 void hamfake_clearKeyboardBuffer();
97 void hamfake_insertKeyPress(int key);
98 
99 void hamfake_setScrollX(int layer, int scroll);
100 void hamfake_setScrollY(int layer, int scroll);
101 
102 #define M_BG0SCRLX_SET(xoff) \
103 	hamfake_setScrollX(0, xoff);
104 #define M_BG0SCRLY_SET(yoff) \
105 	hamfake_setScrollY(0, yoff);
106 #define M_BG1SCRLX_SET(xoff) \
107 	hamfake_setScrollX(1, xoff);
108 #define M_BG1SCRLY_SET(yoff) \
109 	hamfake_setScrollY(1, yoff);
110 #define M_BG2SCRLX_SET(xoff) \
111 	hamfake_setScrollX(2, xoff);
112 #define M_BG2SCRLY_SET(yoff) \
113 	hamfake_setScrollY(2, yoff);
114 #define M_BG3SCRLX_SET(xoff) \
115 	hamfake_setScrollX(3, xoff);
116 #define M_BG3SCRLY_SET(yoff) \
117 	hamfake_setScrollY(3, yoff);
118 
119 //
120 // Cloned Ham functions
121 //
122 
123 void ham_Init();
124 void ham_StartIntHandler(u8 intno, void (*fp)());
125 void ham_SetBgMode(u8 mode);
126 void ham_LoadBGPal(void *vpal, int bytes);
127 map_info_ptr ham_InitMapEmptySet(u8 size, u8 );
128 tile_info_ptr ham_InitTileEmptySet(u16 entries, u8 , u8);
129 void ham_InitBg(int layer, int foo, int bar, int baz);
130 void ham_CreateWin(int wid, int x1, int y1, int x2, int y2, int inside, int outside, int fx);
131 void ham_DeleteWin(int wid);
132 void ham_SetMapTile(int layer, int mx, int my, int tileidx);
133 void ham_ReloadTileGfx(tile_info_ptr tiledata, const u16 *data, int destidx,
134 		  int numtile);
135 
136 #endif
137 
138