2009-09-12 10:09:59 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
2010-05-03 14:08:02 +00:00
|
|
|
* Copyright (C) 2002-2010 PCSX2 Dev Team
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-09-12 10:09:59 +00:00
|
|
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
2009-02-09 21:15:56 +00:00
|
|
|
*
|
2009-09-12 10:09:59 +00:00
|
|
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
2009-03-15 09:30:31 +00:00
|
|
|
*
|
2009-09-12 10:09:59 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
2009-02-09 21:15:56 +00:00
|
|
|
*/
|
2010-04-25 00:31:27 +00:00
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
#ifndef __PS2EDEFS_H__
|
|
|
|
#define __PS2EDEFS_H__
|
|
|
|
|
|
|
|
/*
|
|
|
|
* PS2E Definitions v0.6.2 (beta)
|
|
|
|
*
|
|
|
|
* Author: linuzappz@hotmail.com
|
|
|
|
* shadowpcsx2@yahoo.gr
|
|
|
|
* florinsasu@hotmail.com
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2009-03-15 09:30:31 +00:00
|
|
|
Notes:
|
2009-02-09 21:15:56 +00:00
|
|
|
* Since this is still beta things may change.
|
|
|
|
|
|
|
|
* OSflags:
|
2014-08-03 18:11:22 +00:00
|
|
|
__linux__ (linux OS)
|
2009-02-09 21:15:56 +00:00
|
|
|
_WIN32 (win32 OS)
|
|
|
|
|
|
|
|
* common return values (for ie. GSinit):
|
|
|
|
0 - success
|
|
|
|
-1 - error
|
|
|
|
|
|
|
|
* reserved keys:
|
|
|
|
F1 to F10 are reserved for the emulator
|
|
|
|
|
2009-03-15 09:30:31 +00:00
|
|
|
* plugins should NOT change the current
|
2009-02-09 21:15:56 +00:00
|
|
|
working directory.
|
|
|
|
(on win32, add flag OFN_NOCHANGEDIR for
|
|
|
|
GetOpenFileName)
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2009-04-29 11:47:05 +00:00
|
|
|
#include "Pcsx2Defs.h"
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2009-12-22 03:15:30 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// freeze modes:
|
2016-11-12 15:28:37 +00:00
|
|
|
#define FREEZE_LOAD 0
|
|
|
|
#define FREEZE_SAVE 1
|
|
|
|
#define FREEZE_SIZE 2
|
2009-12-22 03:15:30 +00:00
|
|
|
|
|
|
|
// event values:
|
2016-11-12 15:28:37 +00:00
|
|
|
#define KEYPRESS 1
|
|
|
|
#define KEYRELEASE 2
|
2009-12-22 03:15:30 +00:00
|
|
|
|
2016-11-12 15:28:37 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int size;
|
|
|
|
s8 *data;
|
2009-12-22 03:15:30 +00:00
|
|
|
} freezeData;
|
|
|
|
|
2016-11-12 15:28:37 +00:00
|
|
|
typedef struct _keyEvent
|
|
|
|
{
|
|
|
|
u32 key;
|
|
|
|
u32 evt;
|
2009-12-22 03:15:30 +00:00
|
|
|
} keyEvent;
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
// PS2EgetLibType returns (may be OR'd)
|
2016-11-12 15:28:37 +00:00
|
|
|
#define PS2E_LT_GS 0x01
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
// PS2EgetLibVersion2 (high 16 bits)
|
2016-11-12 15:28:37 +00:00
|
|
|
#define PS2E_GS_VERSION 0x0006
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
// key values:
|
|
|
|
/* key values must be OS dependant:
|
|
|
|
win32: the VK_XXX will be used (WinUser)
|
|
|
|
linux: the XK_XXX will be used (XFree86)
|
|
|
|
*/
|
|
|
|
|
|
|
|
// for 64bit compilers
|
2016-11-12 15:28:37 +00:00
|
|
|
typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8) ? 1 : -1];
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* GS plugin API */
|
|
|
|
|
|
|
|
// if this file is included with this define
|
|
|
|
// the next api will not be skipped by the compiler
|
2016-03-30 07:47:27 +00:00
|
|
|
#if defined(GSdefs) || defined(BUILTIN_GS_PLUGIN)
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
// basic funcs
|
|
|
|
|
2016-11-12 15:28:37 +00:00
|
|
|
s32 CALLBACK GSinit();
|
|
|
|
s32 CALLBACK GSopen(void *pDsp, const char *Title, int multithread);
|
2009-02-09 21:15:56 +00:00
|
|
|
void CALLBACK GSclose();
|
|
|
|
void CALLBACK GSshutdown();
|
2016-11-12 15:28:37 +00:00
|
|
|
void CALLBACK GSsetSettingsDir(const char *dir);
|
|
|
|
void CALLBACK GSsetLogDir(const char *dir);
|
2009-12-19 18:30:56 +00:00
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
void CALLBACK GSvsync(int field);
|
2010-07-19 15:49:30 +00:00
|
|
|
void CALLBACK GSgifTransfer(const u32 *pMem, u32 addr);
|
2009-02-09 21:15:56 +00:00
|
|
|
void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr);
|
|
|
|
void CALLBACK GSgifTransfer2(u32 *pMem, u32 size);
|
|
|
|
void CALLBACK GSgifTransfer3(u32 *pMem, u32 size);
|
2016-11-12 15:28:37 +00:00
|
|
|
void CALLBACK GSgetLastTag(u64 *ptag); // returns the last tag processed (64 bits)
|
2009-02-09 21:15:56 +00:00
|
|
|
void CALLBACK GSgifSoftReset(u32 mask);
|
|
|
|
void CALLBACK GSreadFIFO(u64 *mem);
|
2014-05-02 21:03:02 +00:00
|
|
|
void CALLBACK GSinitReadFIFO(u64 *mem);
|
2009-02-09 21:15:56 +00:00
|
|
|
void CALLBACK GSreadFIFO2(u64 *mem, int qwc);
|
2014-05-02 21:03:02 +00:00
|
|
|
void CALLBACK GSinitReadFIFO2(u64 *mem, int qwc);
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
// extended funcs
|
|
|
|
|
|
|
|
// GSkeyEvent gets called when there is a keyEvent from the PAD plugin
|
|
|
|
void CALLBACK GSkeyEvent(keyEvent *ev);
|
2016-11-12 15:28:37 +00:00
|
|
|
void CALLBACK GSchangeSaveState(int, const char *filename);
|
2009-02-09 21:15:56 +00:00
|
|
|
void CALLBACK GSmakeSnapshot(char *path);
|
2016-11-12 15:28:37 +00:00
|
|
|
void CALLBACK GSmakeSnapshot2(char *pathname, int *snapdone, int savejpg);
|
2009-02-09 21:15:56 +00:00
|
|
|
void CALLBACK GSirqCallback(void (*callback)());
|
2016-11-12 15:28:37 +00:00
|
|
|
void CALLBACK GSsetBaseMem(void *);
|
2009-02-09 21:15:56 +00:00
|
|
|
void CALLBACK GSsetGameCRC(int crc, int gameoptions);
|
|
|
|
|
|
|
|
// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done
|
|
|
|
void CALLBACK GSsetFrameSkip(int frameskip);
|
|
|
|
|
2020-09-21 04:26:02 +00:00
|
|
|
// Starts recording GS frame data
|
2021-02-23 04:29:34 +00:00
|
|
|
// returns true if successful
|
|
|
|
bool CALLBACK GSsetupRecording(std::string& filename);
|
2020-09-21 04:26:02 +00:00
|
|
|
|
|
|
|
// Stops recording GS frame data
|
|
|
|
void CALLBACK GSendRecording();
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
void CALLBACK GSreset();
|
2010-12-03 21:18:29 +00:00
|
|
|
//deprecated: GSgetTitleInfo was used in PCSX2 but no plugin supported it prior to r4070:
|
|
|
|
//void CALLBACK GSgetTitleInfo( char dest[128] );
|
2016-11-12 15:28:37 +00:00
|
|
|
void CALLBACK GSgetTitleInfo2(char *dest, size_t length);
|
2009-02-09 21:15:56 +00:00
|
|
|
void CALLBACK GSwriteCSR(u32 value);
|
2016-11-12 15:28:37 +00:00
|
|
|
s32 CALLBACK GSfreeze(int mode, freezeData *data);
|
2009-02-09 21:15:56 +00:00
|
|
|
void CALLBACK GSconfigure();
|
|
|
|
void CALLBACK GSabout();
|
2016-11-12 15:28:37 +00:00
|
|
|
s32 CALLBACK GStest();
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// might be useful for emulators
|
|
|
|
#ifdef PLUGINtypedefs
|
|
|
|
|
2016-11-12 15:28:37 +00:00
|
|
|
typedef u32(CALLBACK *_PS2EgetLibType)(void);
|
|
|
|
typedef u32(CALLBACK *_PS2EgetLibVersion2)(u32 type);
|
|
|
|
typedef char *(CALLBACK *_PS2EgetLibName)(void);
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
// GS
|
|
|
|
// NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs
|
|
|
|
// If you want to use them, need to save and restore current ones
|
2016-09-18 20:44:10 +00:00
|
|
|
typedef void(CALLBACK *_GSosdLog)(const char *utf8, u32 color);
|
|
|
|
typedef void(CALLBACK *_GSosdMonitor)(const char *key, const char *value, u32 color);
|
2016-11-12 15:28:37 +00:00
|
|
|
typedef s32(CALLBACK *_GSopen)(void *pDsp, const char *Title, int multithread);
|
|
|
|
typedef s32(CALLBACK *_GSopen2)(void *pDsp, u32 flags);
|
|
|
|
typedef void(CALLBACK *_GSvsync)(int field);
|
|
|
|
typedef void(CALLBACK *_GSgifTransfer)(const u32 *pMem, u32 size);
|
|
|
|
typedef void(CALLBACK *_GSgifTransfer1)(u32 *pMem, u32 addr);
|
|
|
|
typedef void(CALLBACK *_GSgifTransfer2)(u32 *pMem, u32 size);
|
|
|
|
typedef void(CALLBACK *_GSgifTransfer3)(u32 *pMem, u32 size);
|
|
|
|
typedef void(CALLBACK *_GSgifSoftReset)(u32 mask);
|
|
|
|
typedef void(CALLBACK *_GSreadFIFO)(u64 *pMem);
|
|
|
|
typedef void(CALLBACK *_GSreadFIFO2)(u64 *pMem, int qwc);
|
|
|
|
typedef void(CALLBACK *_GSinitReadFIFO)(u64 *pMem);
|
|
|
|
typedef void(CALLBACK *_GSinitReadFIFO2)(u64 *pMem, int qwc);
|
|
|
|
|
|
|
|
typedef void(CALLBACK *_GSchangeSaveState)(int, const char *filename);
|
|
|
|
typedef void(CALLBACK *_GSgetTitleInfo2)(char *dest, size_t length);
|
|
|
|
typedef void(CALLBACK *_GSirqCallback)(void (*callback)());
|
|
|
|
typedef void(CALLBACK *_GSsetBaseMem)(void *);
|
|
|
|
typedef void(CALLBACK *_GSsetGameCRC)(int, int);
|
|
|
|
typedef void(CALLBACK *_GSsetFrameSkip)(int frameskip);
|
|
|
|
typedef void(CALLBACK *_GSsetVsync)(int enabled);
|
|
|
|
typedef void(CALLBACK *_GSsetExclusive)(int isExclusive);
|
2021-02-23 04:29:34 +00:00
|
|
|
typedef bool(CALLBACK* _GSsetupRecording)(std::string&);
|
2020-09-21 04:26:02 +00:00
|
|
|
typedef void(CALLBACK* _GSendRecording)();
|
2016-11-12 15:28:37 +00:00
|
|
|
typedef void(CALLBACK *_GSreset)();
|
|
|
|
typedef void(CALLBACK *_GSwriteCSR)(u32 value);
|
2020-09-23 21:27:39 +00:00
|
|
|
typedef bool(CALLBACK *_GSmakeSnapshot)(const char *path);
|
2016-11-12 15:28:37 +00:00
|
|
|
typedef void(CALLBACK *_GSmakeSnapshot2)(const char *path, int *, int);
|
2009-08-02 16:48:03 +00:00
|
|
|
|
2020-11-02 13:53:01 +00:00
|
|
|
#endif
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
#ifdef PLUGINfuncs
|
|
|
|
|
|
|
|
// GS
|
2016-03-30 07:47:27 +00:00
|
|
|
#ifndef BUILTIN_GS_PLUGIN
|
2016-09-18 20:44:10 +00:00
|
|
|
extern _GSosdLog GSosdLog;
|
|
|
|
extern _GSosdMonitor GSosdMonitor;
|
2016-11-12 15:28:37 +00:00
|
|
|
extern _GSopen GSopen;
|
|
|
|
extern _GSopen2 GSopen2;
|
|
|
|
extern _GSvsync GSvsync;
|
|
|
|
extern _GSgifTransfer GSgifTransfer;
|
|
|
|
extern _GSgifTransfer1 GSgifTransfer1;
|
|
|
|
extern _GSgifTransfer2 GSgifTransfer2;
|
|
|
|
extern _GSgifTransfer3 GSgifTransfer3;
|
|
|
|
extern _GSgifSoftReset GSgifSoftReset;
|
|
|
|
extern _GSreadFIFO GSreadFIFO;
|
|
|
|
extern _GSinitReadFIFO GSinitReadFIFO;
|
|
|
|
extern _GSreadFIFO2 GSreadFIFO2;
|
|
|
|
extern _GSinitReadFIFO2 GSinitReadFIFO2;
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
extern _GSchangeSaveState GSchangeSaveState;
|
2016-11-12 15:28:37 +00:00
|
|
|
extern _GSgetTitleInfo2 GSgetTitleInfo2;
|
|
|
|
extern _GSmakeSnapshot GSmakeSnapshot;
|
|
|
|
extern _GSmakeSnapshot2 GSmakeSnapshot2;
|
|
|
|
extern _GSirqCallback GSirqCallback;
|
|
|
|
extern _GSsetBaseMem GSsetBaseMem;
|
|
|
|
extern _GSsetGameCRC GSsetGameCRC;
|
|
|
|
extern _GSsetFrameSkip GSsetFrameSkip;
|
|
|
|
extern _GSsetVsync GSsetVsync;
|
|
|
|
extern _GSsetupRecording GSsetupRecording;
|
2020-09-21 04:26:02 +00:00
|
|
|
extern _GSendRecording GSendRecording;
|
2016-11-12 15:28:37 +00:00
|
|
|
extern _GSreset GSreset;
|
|
|
|
extern _GSwriteCSR GSwriteCSR;
|
2016-03-30 07:47:27 +00:00
|
|
|
#endif
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2016-11-12 15:28:37 +00:00
|
|
|
} // End extern "C"
|
2009-02-09 21:15:56 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __PS2EDEFS_H__ */
|