2014-04-12 10:44:38 +00:00
|
|
|
/* LilyPad - Pad plugin for PS2 Emulator
|
|
|
|
* Copyright (C) 2002-2014 PCSX2 Dev Team/ChickenLiver
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with PCSX2. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2010-04-24 21:37:39 +00:00
|
|
|
#pragma once
|
|
|
|
|
2015-01-24 22:10:51 +00:00
|
|
|
#ifdef __linux__
|
|
|
|
// Seriously why there is no standard
|
|
|
|
#include "stdint.h"
|
|
|
|
typedef uint32_t DWORD;
|
|
|
|
typedef uint16_t USHORT;
|
2016-07-28 08:46:40 +00:00
|
|
|
#ifndef __INTEL_COMPILER
|
2015-01-24 22:10:51 +00:00
|
|
|
typedef int64_t __int64;
|
2016-07-28 08:46:40 +00:00
|
|
|
#endif
|
2015-01-24 22:10:51 +00:00
|
|
|
|
|
|
|
#define MAX_PATH (256) // random value
|
|
|
|
|
|
|
|
#include <X11/keysym.h>
|
|
|
|
|
|
|
|
#define VK_SHIFT XK_Shift_L
|
|
|
|
#define VK_LSHIFT XK_Shift_L
|
|
|
|
#define VK_RSHIFT XK_Shift_R
|
|
|
|
#define VK_LMENU XK_Menu
|
|
|
|
#define VK_RMENU XK_Menu
|
|
|
|
#define VK_MENU XK_Menu
|
|
|
|
#define VK_CONTROL XK_Control_L
|
|
|
|
#define VK_TAB XK_Tab
|
|
|
|
#define VK_ESCAPE XK_Escape
|
|
|
|
#define VK_F4 XK_F4
|
|
|
|
|
|
|
|
#include <cwchar>
|
|
|
|
#include <cstdarg>
|
|
|
|
|
|
|
|
template <typename Array>
|
|
|
|
void wsprintfW(Array& buf, const wchar_t *format, ...) {
|
|
|
|
va_list a;
|
|
|
|
va_start(a, format);
|
|
|
|
|
|
|
|
vswprintf(buf, sizeof(buf)/sizeof(buf[0]), format, a);
|
|
|
|
|
|
|
|
va_end(a);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename Array>
|
|
|
|
void wsprintf(Array& buf, const wchar_t *format, ...) {
|
|
|
|
va_list a;
|
|
|
|
va_start(a, format);
|
|
|
|
|
|
|
|
vswprintf(buf, sizeof(buf)/sizeof(buf[0]), format, a);
|
|
|
|
|
|
|
|
va_end(a);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wcsicmp(const wchar_t* w1, const wchar_t* w2) {
|
|
|
|
// I didn't find a way to put ignore case ...
|
|
|
|
return wcscmp(w1, w2);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
static inline unsigned int timeGetTime() {
|
|
|
|
struct timeval now;
|
|
|
|
gettimeofday(&now, NULL);
|
2015-09-11 14:50:02 +00:00
|
|
|
uint64_t ms = (now.tv_usec/1000) + ((uint64_t)now.tv_sec * 1000);
|
2015-01-24 22:10:51 +00:00
|
|
|
return (ms & 0xFFFFFFFF); // MS code is u32 ...
|
|
|
|
}
|
|
|
|
|
2015-01-26 22:45:15 +00:00
|
|
|
#include "Utilities/Dependencies.h"
|
|
|
|
#include "Utilities/StringHelpers.h"
|
|
|
|
#include "Utilities/Path.h"
|
|
|
|
|
2015-01-30 19:44:52 +00:00
|
|
|
#include <X11/Xutil.h>
|
|
|
|
|
|
|
|
extern Display *GSdsp;
|
|
|
|
extern Window GSwin;
|
|
|
|
|
2015-01-24 22:10:51 +00:00
|
|
|
#endif
|
|
|
|
|
2010-04-24 21:37:39 +00:00
|
|
|
#ifndef _CRT_SECURE_NO_DEPRECATE
|
|
|
|
#define _CRT_SECURE_NO_DEPRECATE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
2016-06-05 21:46:53 +00:00
|
|
|
#define EXPORT_C_(type) extern "C" type CALLBACK
|
2010-04-24 21:37:39 +00:00
|
|
|
#else
|
2015-04-17 16:32:39 +00:00
|
|
|
#define EXPORT_C_(type) extern "C" __attribute__((stdcall,externally_visible,visibility("default"))) type CALLBACK
|
2010-04-24 21:37:39 +00:00
|
|
|
#endif
|
|
|
|
|
2015-01-24 22:10:51 +00:00
|
|
|
#ifdef _MSC_VER
|
2016-02-26 11:05:50 +00:00
|
|
|
#define _WIN32_WINNT 0x0600
|
2010-04-24 21:37:39 +00:00
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
#ifdef PCSX2_DEBUG
|
|
|
|
#define _CRTDBG_MAPALLOC
|
|
|
|
#define _CRTDBG_MAP_ALLOC
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <crtdbg.h>
|
|
|
|
#else
|
|
|
|
#include <stdlib.h>
|
|
|
|
#endif
|
|
|
|
|
2015-01-24 22:10:51 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <mutex>
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2010-04-24 21:37:39 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
2015-01-24 22:10:51 +00:00
|
|
|
#ifdef _MSC_VER
|
2010-04-24 21:37:39 +00:00
|
|
|
#include <commctrl.h>
|
|
|
|
// Only needed for DBT_DEVNODES_CHANGED
|
|
|
|
#include <Dbt.h>
|
2015-01-24 22:10:51 +00:00
|
|
|
#endif
|
2010-04-24 21:37:39 +00:00
|
|
|
|
|
|
|
#include "PS2Edefs.h"
|
|
|
|
|
2015-01-24 22:10:51 +00:00
|
|
|
#ifdef _MSC_VER
|
2010-04-24 21:37:39 +00:00
|
|
|
extern HINSTANCE hInst;
|
2015-01-24 22:10:51 +00:00
|
|
|
#endif
|
2010-04-24 21:37:39 +00:00
|
|
|
// Needed for config screen
|
|
|
|
void GetNameAndVersionString(wchar_t *out);
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
unsigned char controllerType;
|
|
|
|
unsigned short buttonStatus;
|
|
|
|
unsigned char rightJoyX, rightJoyY, leftJoyX, leftJoyY;
|
|
|
|
unsigned char moveX, moveY;
|
|
|
|
unsigned char reserved[91];
|
|
|
|
} PadDataS;
|
|
|
|
|
|
|
|
EXPORT_C_(void) PADupdate(int pad);
|
|
|
|
EXPORT_C_(u32) PS2EgetLibType(void);
|
|
|
|
EXPORT_C_(u32) PS2EgetLibVersion2(u32 type);
|
|
|
|
EXPORT_C_(char*) PSEgetLibName();
|
|
|
|
EXPORT_C_(char*) PS2EgetLibName(void);
|
|
|
|
EXPORT_C_(void) PADshutdown();
|
|
|
|
EXPORT_C_(s32) PADinit(u32 flags);
|
|
|
|
EXPORT_C_(s32) PADopen(void *pDsp);
|
|
|
|
EXPORT_C_(void) PADclose();
|
|
|
|
EXPORT_C_(u8) PADstartPoll(int pad);
|
|
|
|
EXPORT_C_(u8) PADpoll(u8 value);
|
|
|
|
EXPORT_C_(u32) PADquery();
|
|
|
|
EXPORT_C_(void) PADabout();
|
|
|
|
EXPORT_C_(s32) PADtest();
|
|
|
|
EXPORT_C_(keyEvent*) PADkeyEvent();
|
|
|
|
EXPORT_C_(u32) PADreadPort1 (PadDataS* pads);
|
|
|
|
EXPORT_C_(u32) PADreadPort2 (PadDataS* pads);
|
|
|
|
EXPORT_C_(u32) PSEgetLibType();
|
|
|
|
EXPORT_C_(u32) PSEgetLibVersion();
|
|
|
|
EXPORT_C_(void) PADconfigure();
|
|
|
|
EXPORT_C_(s32) PADfreeze(int mode, freezeData *data);
|
|
|
|
EXPORT_C_(s32) PADsetSlot(u8 port, u8 slot);
|
|
|
|
EXPORT_C_(s32) PADqueryMtap(u8 port);
|
2015-01-24 22:10:01 +00:00
|
|
|
EXPORT_C_(void) PADsetSettingsDir(const char *dir);
|