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