1 /***************************************************************************
4 begin : Sat Jan 31 2004
5 copyright : (C) 2004 by Pete Bernert
6 email : BlackDove@addcom.de
7 ***************************************************************************/
8 /***************************************************************************
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. *
16 ***************************************************************************/
20 #include "externals.h"
22 // --------------------------------------------------- //
23 // - psx gpu plugin interface prototypes-------------- //
24 // --------------------------------------------------- //
26 long GPUopen(unsigned long *disp, const char *CapText, const char *CfgFile);
28 void CALLBACK GPUdisplayText(char * pText);
29 void CALLBACK GPUdisplayFlags(uint32_t dwFlags);
30 void CALLBACK GPUmakeSnapshot(void);
31 long CALLBACK GPUinit();
32 long CALLBACK GPUclose();
33 long CALLBACK GPUshutdown();
34 void CALLBACK GPUcursor(int iPlayer,int x,int y);
35 void CALLBACK GPUupdateLace(void);
36 uint32_t CALLBACK GPUreadStatus(void);
37 void CALLBACK GPUwriteStatus(uint32_t gdata);
38 void CALLBACK GPUreadDataMem(uint32_t * pMem, int iSize);
39 uint32_t CALLBACK GPUreadData(void);
40 void CALLBACK GPUwriteDataMem(uint32_t * pMem, int iSize);
41 void CALLBACK GPUwriteData(uint32_t gdata);
42 void CALLBACK GPUsetMode(uint32_t gdata);
43 long CALLBACK GPUgetMode(void);
44 long CALLBACK GPUdmaChain(uint32_t * baseAddrL, uint32_t addr);
45 long CALLBACK GPUconfigure(void);
46 void CALLBACK GPUabout(void);
47 long CALLBACK GPUtest(void);
48 long CALLBACK GPUfreeze(uint32_t ulGetFreezeData,void * pF);
49 void CALLBACK GPUgetScreenPic(unsigned char * pMem);
50 void CALLBACK GPUshowScreenPic(unsigned char * pMem);
52 void CALLBACK GPUkeypressed(int keycode);
55 // --------------------------------------------------- //
56 // - zn gpu interface -------------------------------- //
57 // --------------------------------------------------- //
59 uint32_t dwGPUVersion=0;
61 int iGPUHeightMask=511;
65 // --------------------------------------------------- //
66 // --------------------------------------------------- //
67 // --------------------------------------------------- //
69 typedef struct GPUOTAG
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
79 // --------------------------------------------------- //
80 // --------------------------------------------------- //
81 // --------------------------------------------------- //
83 void CALLBACK ZN_GPUdisplayFlags(uint32_t dwFlags)
85 GPUdisplayFlags(dwFlags);
88 // --------------------------------------------------- //
90 void CALLBACK ZN_GPUmakeSnapshot(void)
95 // --------------------------------------------------- //
97 long CALLBACK ZN_GPUinit()
98 { // we always set the vram size to 2MB, if the ZN interface is used
105 // --------------------------------------------------- //
107 long CALLBACK ZN_GPUopen(void * vcfg)
109 GPUConfiguration_t * cfg=(GPUConfiguration_t *)vcfg;
113 if(cfg->Version!=1) return -1;
115 lret = GPUopen(&cfg->hWnd, cfg->GameName, cfg->CfgFile);
119 if(!lstrcmp(cfg->GameName,"kikaioh") ||
120 !lstrcmp(cfg->GameName,"sr2j") ||
121 !lstrcmp(cfg->GameName,"rvschool_a"))
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
131 dwGPUVersion=cfg->GPUVersion;
136 // --------------------------------------------------- //
138 long CALLBACK ZN_GPUclose()
143 // --------------------------------------------------- //
145 long CALLBACK ZN_GPUshutdown()
147 return GPUshutdown();
150 // --------------------------------------------------- //
152 void CALLBACK ZN_GPUupdateLace(void)
157 // --------------------------------------------------- //
159 uint32_t CALLBACK ZN_GPUreadStatus(void)
161 return GPUreadStatus();
164 // --------------------------------------------------- //
166 void CALLBACK ZN_GPUwriteStatus(uint32_t gdata)
168 GPUwriteStatus(gdata);
171 // --------------------------------------------------- //
173 long CALLBACK ZN_GPUdmaSliceOut(uint32_t *baseAddrL, uint32_t addr, uint32_t iSize)
175 GPUreadDataMem(baseAddrL+addr,iSize);
179 // --------------------------------------------------- //
181 uint32_t CALLBACK ZN_GPUreadData(void)
183 return GPUreadData();
186 // --------------------------------------------------- //
188 void CALLBACK ZN_GPUsetMode(uint32_t gdata)
193 // --------------------------------------------------- //
195 long CALLBACK ZN_GPUgetMode(void)
200 // --------------------------------------------------- //
202 long CALLBACK ZN_GPUdmaSliceIn(uint32_t *baseAddrL, uint32_t addr, uint32_t iSize)
204 GPUwriteDataMem(baseAddrL+addr,iSize);
207 // --------------------------------------------------- //
209 void CALLBACK ZN_GPUwriteData(uint32_t gdata)
211 GPUwriteDataMem(&gdata,1);
214 // --------------------------------------------------- //
216 long CALLBACK ZN_GPUdmaChain(uint32_t * baseAddrL, uint32_t addr)
218 return GPUdmaChain(baseAddrL,addr);
221 // --------------------------------------------------- //
223 long CALLBACK ZN_GPUtest(void)
228 // --------------------------------------------------- //
230 long CALLBACK ZN_GPUfreeze(uint32_t ulGetFreezeData,void * pF)
232 return GPUfreeze(ulGetFreezeData,pF);
235 // --------------------------------------------------- //
237 void CALLBACK ZN_GPUgetScreenPic(unsigned char * pMem)
239 GPUgetScreenPic(pMem);
242 // --------------------------------------------------- //
244 void CALLBACK ZN_GPUshowScreenPic(unsigned char * pMem)
246 GPUshowScreenPic(pMem);
249 // --------------------------------------------------- //
251 void CALLBACK ZN_GPUkeypressed(int keycode)
253 GPUkeypressed(keycode);