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