lilypad: Remove psx/ps1 emulator compatibility.

Same as https://github.com/PCSX2/pcsx2/pull/3274
This commit is contained in:
lightningterror 2020-09-03 02:41:45 +02:00
parent 0ce4f7624f
commit 7f57166eea
9 changed files with 25 additions and 123 deletions

View File

@ -51,27 +51,8 @@ void PCSX2_overrideConfig(GeneralConfig &config_in_out)
config_in_out.closeHack = 0; // Cannot function when used by PCSX2
}
// Dialog widgets which should be disabled - mostly matching PCSX2_overrideConfig
const UINT *PCSX2_disabledWidgets()
{
static const UINT disabledWidgets[] = {
IDC_DISABLE_SCREENSAVER,
IDC_ESCAPE_FULLSCREEN_HACK,
IDC_SAVE_STATE_TITLE,
IDC_ANALOG_START1, // start in analog mode - only useful for PS1
IDC_CLOSE_HACK,
0};
return disabledWidgets;
}
GeneralConfig config;
// 1 if running inside a PS2 emulator. Set to 1 on any
// of the PS2-specific functions (PS2EgetLibVersion2, PS2EgetLibType).
// Only affects if I allow read input in GS thread to be set.
// Also disables usage of AutoAnalog mode if in PS2 mode.
u8 ps2e = 0;
HWND hWndProp = 0;
int selected = 0;
@ -107,11 +88,8 @@ const GeneralSettingsBool BoolOptionsInfo[] = {
{L"Multitap 1", IDC_MULTITAP1, 0},
{L"Multitap 2", IDC_MULTITAP2, 0},
{L"Escape Fullscreen Hack", IDC_ESCAPE_FULLSCREEN_HACK, 1}, // Not required for PCSX2
{L"Disable Screen Saver", IDC_DISABLE_SCREENSAVER, 1}, // Not required for PCSX2
{L"Logging", IDC_DEBUG_FILE, 0},
{L"Save State in Title", IDC_SAVE_STATE_TITLE, 0}, // Not required for PCSX2
{L"GH2", IDC_GH2_HACK, 0},
};
@ -891,9 +869,6 @@ int SaveSettings(wchar_t *file = 0)
wchar_t temp[50];
wsprintf(temp, L"Pad %i %i", port, slot);
WritePrivateProfileInt(temp, L"Mode", config.padConfigs[port][slot].type, file);
// PS1 Emu compatibility code, no need to run it on pcsx2.
if (!ps2e)
noError &= WritePrivateProfileInt(temp, L"Auto Analog", config.padConfigs[port][slot].autoAnalog, file);
}
}
@ -1009,9 +984,6 @@ int LoadSettings(int force, wchar_t *file)
wchar_t temp[50];
wsprintf(temp, L"Pad %i %i", port, slot);
config.padConfigs[port][slot].type = (PadType)GetPrivateProfileInt(temp, L"Mode", Dualshock2Pad, file);
// PS1 Emu compatibility code, no need to run it on pcsx2.
if (!ps2e)
config.padConfigs[port][slot].autoAnalog = GetPrivateProfileBool(temp, L"Auto Analog", 0, file);
}
}
@ -1166,8 +1138,7 @@ int LoadSettings(int force, wchar_t *file)
RefreshEnabledDevicesAndDisplay(1);
if (ps2e)
PCSX2_overrideConfig(config);
PCSX2_overrideConfig(config);
return 0;
}
@ -2219,7 +2190,6 @@ void UpdatePadList(HWND hWnd)
recurse = 1;
HWND hWndList = GetDlgItem(hWnd, IDC_PAD_LIST);
HWND hWndCombo = GetDlgItem(hWnd, IDC_PAD_TYPE);
HWND hWndAnalog = GetDlgItem(hWnd, IDC_ANALOG_START1);
int slot;
int port;
int index = 0;
@ -2273,14 +2243,11 @@ void UpdatePadList(HWND hWnd)
if (!ListIndexToPortAndSlot(sel, &port, &slot)) {
enable = 0;
SendMessage(hWndCombo, CB_SETCURSEL, -1, 0);
CheckDlgButton(hWnd, IDC_ANALOG_START1, BST_UNCHECKED);
} else {
enable = 1;
SendMessage(hWndCombo, CB_SETCURSEL, config.padConfigs[port][slot].type, 0);
CheckDlgButton(hWnd, IDC_ANALOG_START1, BST_CHECKED * config.padConfigs[port][slot].autoAnalog);
}
EnableWindow(hWndCombo, enable);
EnableWindow(hWndAnalog, config.padConfigs[port][slot].type == Dualshock2Pad ? enable : 0);
//ListView_SetExtendedListViewStyleEx(hWndList, LVS_EX_DOUBLEBUFFER|LVS_EX_ONECLICKACTIVATE, LVS_EX_DOUBLEBUFFER|LVS_EX_ONECLICKACTIVATE);
recurse = 0;
}
@ -2308,16 +2275,6 @@ INT_PTR CALLBACK GeneralDialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, L
SendMessage(hWndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);
for (int i = 0; i < numPadTypes; i++)
SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)padTypes[i]);
if (ps2e) {
// This disables some widgets which are not required for PCSX2.
// Currently the trigger is that it's in PS2 emulation mode
const UINT *toDisable = PCSX2_disabledWidgets();
while (toDisable && *toDisable) {
ShowWindow(GetDlgItem(hWnd, *toDisable), 0);
toDisable++;
}
}
}
}
UpdatePadPages();
@ -2333,7 +2290,6 @@ INT_PTR CALLBACK GeneralDialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, L
for (int j = 0; j < sizeof(BoolOptionsInfo) / sizeof(BoolOptionsInfo[0]); j++) {
CheckDlgButton(hWnd, BoolOptionsInfo[j].ControlId, BST_CHECKED * config.bools[j]);
}
CheckDlgButton(hWnd, IDC_CLOSE_HACK, BST_CHECKED * config.closeHack);
AddTooltip(IDC_M_WM, hWnd);
AddTooltip(IDC_M_RAW, hWnd);
@ -2345,7 +2301,6 @@ INT_PTR CALLBACK GeneralDialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, L
AddTooltip(IDC_DIAG_LIST, hWnd);
AddTooltip(IDC_G_DI, hWnd);
AddTooltip(IDC_G_XI, hWnd);
AddTooltip(IDC_ANALOG_START1, hWnd);
AddTooltip(ID_RESTORE_DEFAULTS, hWnd);
if (config.keyboardApi < 0 || config.keyboardApi > 3)
@ -2412,13 +2367,6 @@ INT_PTR CALLBACK GeneralDialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, L
}
}
break;
} else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_ANALOG_START1) {
int index = ListView_GetNextItem(hWndList, -1, LVNI_SELECTED);
int port, slot;
if (!ListIndexToPortAndSlot(index, &port, &slot))
break;
config.padConfigs[port][slot].autoAnalog = (IsDlgButtonChecked(hWnd, IDC_ANALOG_START1) == BST_CHECKED);
PropSheet_Changed(hWndProp, hWnd);
} else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == ID_RESTORE_DEFAULTS) {
int msgboxID = MessageBoxA(hWndProp, "This will delete all current settings and revert back to the default settings of LilyPad. Continue?",
"Restore Defaults Confirmation", MB_YESNO | MB_DEFBUTTON2 | MB_ICONEXCLAMATION);
@ -2441,7 +2389,6 @@ INT_PTR CALLBACK GeneralDialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, L
for (int j = 0; j < sizeof(BoolOptionsInfo) / sizeof(BoolOptionsInfo[0]); j++) {
config.bools[j] = (IsDlgButtonChecked(hWnd, BoolOptionsInfo[j].ControlId) == BST_CHECKED);
}
config.closeHack = IsDlgButtonChecked(hWnd, IDC_CLOSE_HACK) == BST_CHECKED;
for (int i = 0; i < 4; i++) {
if (i && IsDlgButtonChecked(hWnd, IDC_KB_DISABLE + i) == BST_CHECKED) {

View File

@ -18,8 +18,6 @@
#ifndef CONFIG_H
#define CONFIG_H
extern u8 ps2e;
extern const wchar_t *padTypes[numPadTypes];
struct PadConfig

View File

@ -158,8 +158,6 @@ PS2EgetLibType(void);
EXPORT_C_(u32)
PS2EgetLibVersion2(u32 type);
EXPORT_C_(char *)
PSEgetLibName();
EXPORT_C_(char *)
PS2EgetLibName(void);
EXPORT_C_(void)
PADshutdown();
@ -185,10 +183,6 @@ 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)

View File

@ -716,13 +716,11 @@ inline void SetVibrate(int port, int slot, int motor, u8 val)
u32 CALLBACK PS2EgetLibType(void)
{
ps2e = 1;
return PS2E_LT_PAD;
}
u32 CALLBACK PS2EgetLibVersion2(u32 type)
{
ps2e = 1;
if (type == PS2E_LT_PAD)
return (PS2E_PAD_VERSION << 16) | VERSION;
return 0;
@ -740,7 +738,7 @@ void GetNameAndVersionString(wchar_t *out)
}
#endif
char *CALLBACK PSEgetLibName()
char *CALLBACK PS2EgetLibName(void)
{
#if defined(PCSX2_DEBUG)
static char version[50];
@ -753,12 +751,6 @@ char *CALLBACK PSEgetLibName()
#endif
}
char *CALLBACK PS2EgetLibName(void)
{
ps2e = 1;
return PSEgetLibName();
}
//void CALLBACK PADgsDriverInfo(GSdriverInfo *info) {
// info=info;
//}
@ -1744,16 +1736,6 @@ u32 CALLBACK PADreadPort2(PadDataS *pads)
return 0;
}
u32 CALLBACK PSEgetLibType()
{
return 8;
}
u32 CALLBACK PSEgetLibVersion()
{
return (VERSION & 0xFFFFFF);
}
s32 CALLBACK PADqueryMtap(u8 port)
{
port--;

View File

@ -2,9 +2,6 @@ EXPORTS
PS2EgetLibType
PS2EgetLibName
PS2EgetLibVersion2
PSEgetLibType
PSEgetLibName
PSEgetLibVersion
PADreadPort1
PADreadPort2
PADinit

View File

@ -467,16 +467,11 @@ BEGIN
CONTROL "Multiple bindings",IDC_MULTIPLE_BINDING, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,176,66,10
CONTROL "",IDC_PAD_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | WS_TABSTOP,81,151,183,48,WS_EX_CLIENTEDGE
COMBOBOX IDC_PAD_TYPE,270,151,140,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Use analog mode if possible",IDC_ANALOG_START1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,270,168,137,10
GROUPBOX "Device Diagnostics",IDC_STATIC,7,207,201,72
CONTROL "",IDC_DIAG_LIST,"SysListView32",LVS_LIST | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_VSCROLL | WS_TABSTOP,14,217,187,57,WS_EX_CLIENTEDGE
GROUPBOX "Hacks and advanced features",IDC_STATIC,216,207,201,46
CONTROL "Enable logging",IDC_DEBUG_FILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,223,217,79,10
CONTROL "Guitar Hero 2 Hack",IDC_GH2_HACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,223,228,79,10
CONTROL "Save state # in title",IDC_SAVE_STATE_TITLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,223,239,79,10
CONTROL "Disable screensaver",IDC_DISABLE_SCREENSAVER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,303,217,79,10
CONTROL "Safe fullscreen exit on escape",IDC_ESCAPE_FULLSCREEN_HACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,303,228,112,10
CONTROL "Exit emulator on window close",IDC_CLOSE_HACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,303,239,112,10
PUSHBUTTON "Restore Defaults",ID_RESTORE_DEFAULTS,219,259,62,15
PUSHBUTTON "Load Bindings",ID_LOAD,287,259,62,15
PUSHBUTTON "Save Bindings",ID_SAVE,355,259,62,15

View File

@ -23,7 +23,6 @@
#include "Linux/ConfigHelper.h"
GeneralConfig config;
u8 ps2e = 0;
#if 0
remove 0x10F0 to compute the cmd value

View File

@ -53,11 +53,6 @@ LPWSTR dialog_message(int ID, bool *updateText)
L"\"Pop'n Music controller\" emulates a PS2 controller used exclusively in the Japanese Pop'n Music series of games.\n\n"
L"\"PS1 Mouse\" emulates the Playstation Mouse. This controller can only be used in a number of PS1 games like \"Command & Conquer: Red Alert\" and \"Myst\".\n\n"
L"\"neGcon\" emulates a controller that can be used in a number of PS1 games and PS2 games like the \"Ridge Racer\" and \"Ace Combat\" series.";
case IDC_ANALOG_START1:
return L"Automatically switch a pad from digital mode to analog mode whenever a pad is set to digital mode, if the pad's mode is not locked."
L"This removes the need for manually enabling analog mode with a press of the analog button for games that support, but do not automatically enable analog mode.\n\n"
L"Note 1: Analog mode enables the analog sticks to function on a DualShock controller, while in digital mode it behaves as an original PlayStation controller.\n\n"
L"Note 2: If analog mode is enabled in a game that does not support it, a game might not recognise a controller is connected.";
case IDC_DIAG_LIST:
return L"Shows a list of currently available input devices.\n\n"
L"Double-click a device in the list or right-click it and select \"Test Device\" to display a continuously updated list of the state of all inputs on the selected device.\n"

View File

@ -9,13 +9,12 @@
#define IDD_CONFIG_GUITAR 0x6A
#define IDD_PROPPAGE_LARGE 0x6B
#define IDC_CURSOR1 0x6C
#define IDC_ESCAPE_FULLSCREEN_HACK 0x6D
#define IDD_DIAG 0x6E
#define IDR_INI1 0x6F
#define IDD_CONFIG_POPN 0x70
#define IDD_CONFIG_PS1_MOUSE 0x71
#define IDD_CONFIG_NEGCON 0x72
#define IDC_VERSION 0x73
#define IDD_DIAG 0x6D
#define IDR_INI1 0x6E
#define IDD_CONFIG_POPN 0x6F
#define IDD_CONFIG_PS1_MOUSE 0x70
#define IDD_CONFIG_NEGCON 0x71
#define IDC_VERSION 0x72
// General tab:
#define IDC_KB_DISABLE 0x44C
#define IDC_KB_DI 0x44D
@ -29,27 +28,23 @@
#define IDC_G_XI 0x455
#define IDC_G_DI 0x456
#define IDC_G_DS3 0x457
#define IDC_CLOSE_HACK 0x458
#define IDC_DEBUG_FILE 0x459
#define IDC_GUITAR1 0x45A
#define IDC_ANALOG_START1 0x45B
#define IDC_MULTITAP1 0x45C
#define IDC_DISABLE_SCREENSAVER 0x45D
#define IDC_MOUSE_UNFOCUS 0x45E
#define IDC_AXIS_BUTTONS 0x45F
#define IDC_MULTITAP2 0x460
#define IDC_BACKGROUND 0x461
#define IDC_MULTIPLE_BINDING 0x462
#define IDC_FORCE_HIDE 0x463
#define IDC_GH2_HACK 0x464
#define IDC_SAVE_STATE_TITLE 0x465
#define IDC_PAD_LIST 0x466
#define IDC_COMBO1 0x467
#define IDC_PAD_TYPE 0x468
#define IDC_DIAG_LIST 0x469
#define ID_SAVE 0x46A
#define ID_LOAD 0x46B
#define ID_RESTORE_DEFAULTS 0x46C
#define IDC_DEBUG_FILE 0x458
#define IDC_GUITAR1 0x459
#define IDC_MULTITAP1 0x45A
#define IDC_MOUSE_UNFOCUS 0x45B
#define IDC_AXIS_BUTTONS 0x45C
#define IDC_MULTITAP2 0x45D
#define IDC_BACKGROUND 0x45E
#define IDC_MULTIPLE_BINDING 0x45F
#define IDC_FORCE_HIDE 0x460
#define IDC_GH2_HACK 0x461
#define IDC_PAD_LIST 0x462
#define IDC_COMBO1 0x463
#define IDC_PAD_TYPE 0x464
#define IDC_DIAG_LIST 0x465
#define ID_SAVE 0x466
#define ID_LOAD 0x467
#define ID_RESTORE_DEFAULTS 0x468
// Pad tabs:
#define IDC_BINDINGS_LIST 0xF00
// Pad Input configuration: