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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
|
/***************************************************************************
zn.c - description
-------------------
begin : Sat Jan 31 2004
copyright : (C) 2004 by Pete Bernert
email : BlackDove@addcom.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. See also the license.txt file for *
* additional informations. *
* *
***************************************************************************/
#define _IN_ZN
#include "externals.h"
// --------------------------------------------------- //
// - psx gpu plugin interface prototypes-------------- //
// --------------------------------------------------- //
long GPUopen(unsigned long *disp, const char *CapText, const char *CfgFile);
void CALLBACK GPUdisplayText(char * pText);
void CALLBACK GPUdisplayFlags(uint32_t dwFlags);
void CALLBACK GPUmakeSnapshot(void);
long CALLBACK GPUinit();
long CALLBACK GPUclose();
long CALLBACK GPUshutdown();
void CALLBACK GPUcursor(int iPlayer,int x,int y);
void CALLBACK GPUupdateLace(void);
uint32_t CALLBACK GPUreadStatus(void);
void CALLBACK GPUwriteStatus(uint32_t gdata);
void CALLBACK GPUreadDataMem(uint32_t * pMem, int iSize);
uint32_t CALLBACK GPUreadData(void);
void CALLBACK GPUwriteDataMem(uint32_t * pMem, int iSize);
void CALLBACK GPUwriteData(uint32_t gdata);
void CALLBACK GPUsetMode(uint32_t gdata);
long CALLBACK GPUgetMode(void);
long CALLBACK GPUdmaChain(uint32_t * baseAddrL, uint32_t addr);
long CALLBACK GPUconfigure(void);
void CALLBACK GPUabout(void);
long CALLBACK GPUtest(void);
long CALLBACK GPUfreeze(uint32_t ulGetFreezeData,void * pF);
void CALLBACK GPUgetScreenPic(unsigned char * pMem);
void CALLBACK GPUshowScreenPic(unsigned char * pMem);
void CALLBACK GPUkeypressed(int keycode);
// --------------------------------------------------- //
// - zn gpu interface -------------------------------- //
// --------------------------------------------------- //
uint32_t dwGPUVersion=0;
int iGPUHeight=512;
int iGPUHeightMask=511;
int GlobalTextIL=0;
int iTileCheat=0;
// --------------------------------------------------- //
// --------------------------------------------------- //
// --------------------------------------------------- //
typedef struct GPUOTAG
{
uint32_t Version; // Version of structure - currently 1
long hWnd; // Window handle
uint32_t ScreenRotation; // 0 = 0CW, 1 = 90CW, 2 = 180CW, 3 = 270CW = 90CCW
uint32_t GPUVersion; // 0 = a, 1 = b, 2 = c
const char* GameName; // NULL terminated string
const char* CfgFile; // NULL terminated string
} GPUConfiguration_t;
// --------------------------------------------------- //
// --------------------------------------------------- //
// --------------------------------------------------- //
void CALLBACK ZN_GPUdisplayFlags(uint32_t dwFlags)
{
GPUdisplayFlags(dwFlags);
}
// --------------------------------------------------- //
void CALLBACK ZN_GPUmakeSnapshot(void)
{
GPUmakeSnapshot();
}
// --------------------------------------------------- //
long CALLBACK ZN_GPUinit()
{ // we always set the vram size to 2MB, if the ZN interface is used
iGPUHeight=1024;
iGPUHeightMask=1023;
return GPUinit();
}
// --------------------------------------------------- //
long CALLBACK ZN_GPUopen(void * vcfg)
{
GPUConfiguration_t * cfg=(GPUConfiguration_t *)vcfg;
long lret;
if(!cfg) return -1;
if(cfg->Version!=1) return -1;
lret = GPUopen(&cfg->hWnd, cfg->GameName, cfg->CfgFile);
/*
if(!lstrcmp(cfg->GameName,"kikaioh") ||
!lstrcmp(cfg->GameName,"sr2j") ||
!lstrcmp(cfg->GameName,"rvschool_a"))
iTileCheat=1;
*/
// some ZN games seem to erase the cluts with a 'white' TileS... strange..
// I've added a cheat to avoid this issue. We can set it globally (for
// all ZiNc games) without much risk
iTileCheat=1;
dwGPUVersion=cfg->GPUVersion;
return lret;
}
// --------------------------------------------------- //
long CALLBACK ZN_GPUclose()
{
return GPUclose();
}
// --------------------------------------------------- //
long CALLBACK ZN_GPUshutdown()
{
return GPUshutdown();
}
// --------------------------------------------------- //
void CALLBACK ZN_GPUupdateLace(void)
{
GPUupdateLace();
}
// --------------------------------------------------- //
uint32_t CALLBACK ZN_GPUreadStatus(void)
{
return GPUreadStatus();
}
// --------------------------------------------------- //
void CALLBACK ZN_GPUwriteStatus(uint32_t gdata)
{
GPUwriteStatus(gdata);
}
// --------------------------------------------------- //
long CALLBACK ZN_GPUdmaSliceOut(uint32_t *baseAddrL, uint32_t addr, uint32_t iSize)
{
GPUreadDataMem(baseAddrL+addr,iSize);
return 0;
}
// --------------------------------------------------- //
uint32_t CALLBACK ZN_GPUreadData(void)
{
return GPUreadData();
}
// --------------------------------------------------- //
void CALLBACK ZN_GPUsetMode(uint32_t gdata)
{
GPUsetMode(gdata);
}
// --------------------------------------------------- //
long CALLBACK ZN_GPUgetMode(void)
{
return GPUgetMode();
}
// --------------------------------------------------- //
long CALLBACK ZN_GPUdmaSliceIn(uint32_t *baseAddrL, uint32_t addr, uint32_t iSize)
{
GPUwriteDataMem(baseAddrL+addr,iSize);
return 0;
}
// --------------------------------------------------- //
void CALLBACK ZN_GPUwriteData(uint32_t gdata)
{
GPUwriteDataMem(&gdata,1);
}
// --------------------------------------------------- //
long CALLBACK ZN_GPUdmaChain(uint32_t * baseAddrL, uint32_t addr)
{
return GPUdmaChain(baseAddrL,addr);
}
// --------------------------------------------------- //
long CALLBACK ZN_GPUtest(void)
{
return GPUtest();
}
// --------------------------------------------------- //
long CALLBACK ZN_GPUfreeze(uint32_t ulGetFreezeData,void * pF)
{
return GPUfreeze(ulGetFreezeData,pF);
}
// --------------------------------------------------- //
void CALLBACK ZN_GPUgetScreenPic(unsigned char * pMem)
{
GPUgetScreenPic(pMem);
}
// --------------------------------------------------- //
void CALLBACK ZN_GPUshowScreenPic(unsigned char * pMem)
{
GPUshowScreenPic(pMem);
}
// --------------------------------------------------- //
void CALLBACK ZN_GPUkeypressed(int keycode)
{
GPUkeypressed(keycode);
}
|