1 #ifndef _PSEMU_PLUGIN_DEFS_H
2 #define _PSEMU_PLUGIN_DEFS_H
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 // header version
9 #define _PPDK_HEADER_VERSION		3
10 
11 #define PLUGIN_VERSION				1
12 
13 // plugin type returned by PSEgetLibType (types can be merged if plugin is multi type!)
14 #define PSE_LT_CDR					1
15 #define PSE_LT_GPU					2
16 #define PSE_LT_SPU					4
17 #define PSE_LT_PAD					8
18 #define PSE_LT_NET					16
19 #define PSE_LT_SIO1					32
20 
21 // DLL function return codes
22 #define PSE_ERR_SUCCESS				0	// every function in DLL if completed sucessfully should return this value
23 #define PSE_ERR_FATAL				-1	// undefined error but fatal one, that kills all functionality
24 
25 // XXX_Init return values
26 // Those return values apply to all libraries
27 // currently obsolete - preserved for compatibilty
28 
29 #define PSE_INIT_ERR_SUCCESS		0	// initialization went OK
30 #define PSE_INIT_ERR_NOTCONFIGURED	-2	// this driver is not configured
31 #define PSE_INIT_ERR_NOHARDWARE		-3	// this driver can not operate properly on this hardware or hardware is not detected
32 
33 /*         GPU PlugIn          */
34 
35 //  GPU_Test return values
36 
37 // sucess, everything configured, and went OK.
38 #define PSE_GPU_ERR_SUCCESS			0
39 
40 // ERRORS
41 // this error might be returned as critical error but none of below
42 #define PSE_GPU_ERR					-20
43 
44 
45 // this driver is not configured
46 #define PSE_GPU_ERR_NOTCONFIGURED	PSE_GPU_ERR - 1
47 // this driver failed Init
48 #define PSE_GPU_ERR_INIT			PSE_GPU_ERR - 2
49 
50 // WARNINGS
51 // this warning might be returned as undefined warning but allowing driver to continue
52 #define PSE_GPU_WARN				20
53 
54 //  GPU_Query		- will be implemented soon
55 
56 typedef struct
57 {
58 	uint32_t	flags;
59 	uint32_t	status;
60  	void*	window;
61 	unsigned char reserved[100];
62 } gpuQueryS;
63 
64 // gpuQueryS.flags
65 // if driver can operate in both modes it must support GPU_changeMode();
66 #define PSE_GPU_FLAGS_FULLSCREEN		1	// this driver can operate in fullscreen mode
67 #define PSE_GPU_FLAGS_WINDOWED			2	// this driver can operate in windowed mode
68 
69 // gpuQueryS.status
70 #define PSE_GPU_STATUS_WINDOWWRONG	1	// this driver cannot operate in this windowed mode
71 
72 //  GPU_Query	End	- will be implemented in v2
73 
74 
75 /*         CDR PlugIn          */
76 
77 //	CDR_Test return values
78 
79 // sucess, everything configured, and went OK.
80 #define PSE_CDR_ERR_SUCCESS			0
81 
82 // general failure (error undefined)
83 #define PSE_CDR_ERR_FAILURE			-1
84 
85 // ERRORS
86 #define PSE_CDR_ERR -40
87 // this driver is not configured
88 #define PSE_CDR_ERR_NOTCONFIGURED	PSE_CDR_ERR - 0
89 // if this driver is unable to read data from medium
90 #define PSE_CDR_ERR_NOREAD			PSE_CDR_ERR - 1
91 
92 // WARNINGS
93 #define PSE_CDR_WARN 40
94 // if this driver emulates lame mode ie. can read only 2048 tracks and sector header is emulated
95 // this might happen to CDROMS that do not support RAW mode reading - surelly it will kill many games
96 #define PSE_CDR_WARN_LAMECD			PSE_CDR_WARN + 0
97 
98 
99 
100 
101 /*         SPU PlugIn          */
102 
103 // some info retricted (now!)
104 
105 // sucess, everything configured, and went OK.
106 #define PSE_SPU_ERR_SUCCESS 0
107 
108 // ERRORS
109 // this error might be returned as critical error but none of below
110 #define PSE_SPU_ERR					-60
111 
112 // this driver is not configured
113 #define PSE_SPU_ERR_NOTCONFIGURED	PSE_SPU_ERR - 1
114 // this driver failed Init
115 #define PSE_SPU_ERR_INIT			PSE_SPU_ERR - 2
116 
117 
118 // WARNINGS
119 // this warning might be returned as undefined warning but allowing driver to continue
120 #define PSE_SPU_WARN				60
121 
122 
123 
124 
125 /*         PAD PlugIn          */
126 
127 /*
128 
129   functions that must be exported from PAD Plugin
130 
131   long	PADinit(long flags);	// called only once when PSEmu Starts
132   void	PADshutdown(void);		// called when PSEmu exits
133   long	PADopen(PadInitS *);	// called when PSEmu is running program
134   long	PADclose(void);
135   long	PADconfigure(void);
136   void  PADabout(void);
137   long  PADtest(void);			// called from Configure Dialog and after PADopen();
138   long	PADquery(void);
139 
140   unsigned char PADstartPoll(int);
141   unsigned char PADpoll(unsigned char);
142 
143 */
144 
145 // PADquery responses (notice - values ORed)
146 // PSEmu will use them also in PADinit to tell Plugin which Ports will use
147 // notice that PSEmu will call PADinit and PADopen only once when they are from
148 // same plugin
149 
150 // might be used in port 1
151 #define PSE_PAD_USE_PORT1			1
152 // might be used in port 2
153 #define PSE_PAD_USE_PORT2			2
154 
155 
156 
157 // MOUSE SCPH-1030
158 #define PSE_PAD_TYPE_MOUSE			1
159 // NEGCON - 16 button analog controller SLPH-00001
160 #define PSE_PAD_TYPE_NEGCON			2
161 // GUN CONTROLLER - gun controller SLPH-00014 from Konami
162 #define PSE_PAD_TYPE_GUN			3
163 // STANDARD PAD SCPH-1080, SCPH-1150
164 #define PSE_PAD_TYPE_STANDARD		4
165 // ANALOG JOYSTICK SCPH-1110
166 #define PSE_PAD_TYPE_ANALOGJOY		5
167 // GUNCON - gun controller SLPH-00034 from Namco
168 #define PSE_PAD_TYPE_GUNCON			6
169 // ANALOG CONTROLLER SCPH-1150
170 #define PSE_PAD_TYPE_ANALOGPAD		7
171 
172 
173 // sucess, everything configured, and went OK.
174 #define PSE_PAD_ERR_SUCCESS			0
175 // general plugin failure (undefined error)
176 #define PSE_PAD_ERR_FAILURE			-1
177 
178 
179 // ERRORS
180 // this error might be returned as critical error but none of below
181 #define PSE_PAD_ERR					-80
182 // this driver is not configured
183 #define PSE_PAD_ERR_NOTCONFIGURED	PSE_PAD_ERR - 1
184 // this driver failed Init
185 #define PSE_PAD_ERR_INIT			PSE_PAD_ERR - 2
186 
187 
188 // WARNINGS
189 // this warning might be returned as undefined warning but allowing driver to continue
190 #define PSE_PAD_WARN				80
191 
192 
193 typedef struct
194 {
195 	// controler type - fill it withe predefined values above
196 	unsigned char controllerType;
197 
198 	// status of buttons - every controller fills this field
199 	unsigned short buttonStatus;
200 
201 	// for analog pad fill those next 4 bytes
202 	// values are analog in range 0-255 where 127 is center position
203 	unsigned char rightJoyX, rightJoyY, leftJoyX, leftJoyY;
204 
205 	// for mouse fill those next 2 bytes
206 	// values are in range -128 - 127
207 	unsigned char moveX, moveY;
208 
209 	unsigned char reserved[91];
210 
211 } PadDataS;
212 
213 /*         NET PlugIn v2       */
214 /* Added by linuzappz@pcsx.net */
215 
216 /* Modes bits for NETsendData/NETrecvData */
217 #define PSE_NET_BLOCKING	0x00000000
218 #define PSE_NET_NONBLOCKING	0x00000001
219 
220 /* note: unsupported fields should be zeroed.
221 
222 typedef struct {
223 	char EmuName[32];
224 	char CdromID[9];	// ie. 'SCPH12345', no \0 trailing character
225 	char CdromLabel[11];
226 	void *psxMem;
227 	GPUshowScreenPic GPU_showScreenPic;
228 	GPUdisplayText GPU_displayText;
229 	PADsetSensitive PAD_setSensitive;
230 	char GPUpath[256];
231 	char SPUpath[256];
232 	char CDRpath[256];
233 	char MCD1path[256];
234 	char MCD2path[256];
235 	char BIOSpath[256];	// 'HLE' for internal bios
236 	char Unused[1024];
237 } netInfo;
238 
239 */
240 
241 /*
242   basic funcs:
243 
244    long NETopen(HWND hWnd)
245     opens the connection.
246     shall return 0 on success, else -1.
247     -1 is also returned if the user selects offline mode.
248 
249    long NETclose()
250     closes the connection.
251     shall return 0 on success, else -1.
252 
253    void NETpause()
254     this is called when the user paused the emulator.
255 
256    void NETresume()
257     this is called when the user resumed the emulator.
258 
259    long NETqueryPlayer()
260     returns player number
261 
262    long NETsendPadData(void *pData, int Size)
263     this should be called for the first pad only on each side.
264 
265    long NETrecvPadData(void *pData, int Pad)
266     call this for Pad 1/2 to get the data sent by the above func.
267 
268   extended funcs:
269 
270    long NETsendData(void *pData, int Size, int Mode)
271     sends Size bytes from pData to the other side.
272 
273    long NETrecvData(void *pData, int Size, int Mode)
274     receives Size bytes from pData to the other side.
275 
276    void NETsetInfo(netInfo *info);
277     sets the netInfo struct.
278 
279    void NETkeypressed(int key) (linux only)
280     key is a XK_?? (X11) keycode.
281 */
282 
283 #ifdef __cplusplus
284 }
285 #endif
286 #endif // _PSEMU_PLUGIN_DEFS_H
287