LilyPad: Svn release builds now have svn numbers, some configuration load/save/populate code cleanup. Two additional checkboxes that at the moment do absolutely nothing useful, so don't get too excited, probably be quite a while before I get around to hooking everything up...

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@816 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
mattmenke 2009-03-19 06:28:23 +00:00
parent 1f36e97927
commit e172d0e104
6 changed files with 201 additions and 170 deletions

View File

@ -32,6 +32,37 @@ int selected = 0;
HWND hWnds[2][4]; HWND hWnds[2][4];
HWND hWndGeneral = 0; HWND hWndGeneral = 0;
struct GeneralSettingsBool {
wchar_t *name;
unsigned int ControlId;
u8 defaultValue;
};
// Ties together config data structure, config files, and general config
// dialog.
const GeneralSettingsBool BoolOptionsInfo[] = {
{L"Force Cursor Hide", IDC_FORCE_HIDE, 0},
{L"Mouse Unfocus", IDC_MOUSE_UNFOCUS, 1},
{L"Background", IDC_BACKGROUND, 1},
{L"Multiple Bindings", IDC_MULTIPLE_BINDING, 0},
{L"DirectInput Game Devices", IDC_G_DI, 1},
{L"XInput", IDC_G_XI, 1},
{L"Multitap 1", IDC_MULTITAP1, 0},
{L"Multitap 2", IDC_MULTITAP2, 0},
{L"GS Thread Updates", IDC_GS_THREAD_INPUT, 1},
{L"Escape Fullscreen Hack", IDC_ESCAPE_FULLSCREEN_HACK, 1},
{L"Disable Screen Saver", IDC_DISABLE_SCREENSAVER, 1},
{L"Logging", IDC_DEBUG_FILE, 0},
{L"Save State in Title", IDC_SAVE_STATE_TITLE, 1},
{L"GH2", IDC_GH2_HACK, 0},
{L"Vista Volume", IDC_VISTA_VOLUME, 1},
};
void Populate(int port, int slot); void Populate(int port, int slot);
void SetupLogSlider(HWND hWndSlider) { void SetupLogSlider(HWND hWndSlider) {
@ -675,26 +706,16 @@ int SaveSettings(wchar_t *file=0) {
// Just check first, last, and all pad bindings. Should be more than enough. No real need to check // Just check first, last, and all pad bindings. Should be more than enough. No real need to check
// config path. // config path.
int noError = WritePrivateProfileInt(L"General Settings", L"Force Cursor Hide", config.forceHide, file); int noError = 1;
for (int i=0; i<sizeof(BoolOptionsInfo)/sizeof(BoolOptionsInfo[0]); i++) {
noError &= WritePrivateProfileInt(L"General Settings", BoolOptionsInfo[i].name, config.bools[i], file);
}
WritePrivateProfileInt(L"General Settings", L"Close Hacks", config.closeHacks, file); WritePrivateProfileInt(L"General Settings", L"Close Hacks", config.closeHacks, file);
WritePrivateProfileInt(L"General Settings", L"Background", config.background, file);
WritePrivateProfileInt(L"General Settings", L"GS Thread Updates", config.GSThreadUpdates, file);
WritePrivateProfileInt(L"General Settings", L"Escape Fullscreen Hack", config.escapeFullscreenHack, file);
WritePrivateProfileInt(L"General Settings", L"Disable Screen Saver", config.disableScreenSaver, file);
WritePrivateProfileInt(L"General Settings", L"GH2", config.GH2, file);
WritePrivateProfileInt(L"General Settings", L"Mouse Unfocus", config.mouseUnfocus, file);
WritePrivateProfileInt(L"General Settings", L"Logging", config.debug, file);
WritePrivateProfileInt(L"General Settings", L"Keyboard Mode", config.keyboardApi, file); WritePrivateProfileInt(L"General Settings", L"Keyboard Mode", config.keyboardApi, file);
WritePrivateProfileInt(L"General Settings", L"Mouse Mode", config.mouseApi, file); WritePrivateProfileInt(L"General Settings", L"Mouse Mode", config.mouseApi, file);
WritePrivateProfileInt(L"General Settings", L"DirectInput Game Devices", config.gameApis.directInput, file);
WritePrivateProfileInt(L"General Settings", L"XInput", config.gameApis.xInput, file);
WritePrivateProfileInt(L"General Settings", L"Multiple Bindings", config.multipleBinding, file);
WritePrivateProfileInt(L"General Settings", L"Save State in Title", config.saveStateTitle, file);
WritePrivateProfileInt(L"General Settings", L"Vista Volume", config.vistaVolume, file);
WritePrivateProfileInt(L"General Settings", L"Volume", config.volume, file); WritePrivateProfileInt(L"General Settings", L"Volume", config.volume, file);
for (int port=0; port<2; port++) { for (int port=0; port<2; port++) {
@ -790,33 +811,18 @@ int LoadSettings(int force, wchar_t *file) {
} }
} }
config.GSThreadUpdates = GetPrivateProfileBool(L"General Settings", L"GS Thread Updates", 1, file); for (int i=0; i<sizeof(BoolOptionsInfo)/sizeof(BoolOptionsInfo[0]); i++) {
config.bools[i] = GetPrivateProfileBool(L"General Settings", BoolOptionsInfo[i].name, BoolOptionsInfo[i].defaultValue, file);
}
if (!ps2e) config.GSThreadUpdates = 0; if (!ps2e) config.GSThreadUpdates = 0;
config.escapeFullscreenHack = GetPrivateProfileBool(L"General Settings", L"Escape Fullscreen Hack", 1, file);
config.disableScreenSaver = GetPrivateProfileBool(L"General Settings", L"Disable Screen Saver", 0, file);
config.GH2 = GetPrivateProfileBool(L"General Settings", L"GH2", 0, file);
config.mouseUnfocus = GetPrivateProfileBool(L"General Settings", L"Mouse Unfocus", 0, file);
config.background = (u8)GetPrivateProfileIntW(L"General Settings", L"Background", 0, file);
config.closeHacks = (u8)GetPrivateProfileIntW(L"General Settings", L"Close Hacks", 0, file); config.closeHacks = (u8)GetPrivateProfileIntW(L"General Settings", L"Close Hacks", 0, file);
if (config.closeHacks&1) config.closeHacks &= ~2; if (config.closeHacks&1) config.closeHacks &= ~2;
config.debug = GetPrivateProfileBool(L"General Settings", L"Logging", 0, file);
config.multipleBinding = GetPrivateProfileBool(L"General Settings", L"Multiple Bindings", 0, file);
config.forceHide = GetPrivateProfileBool(L"General Settings", L"Force Cursor Hide", 0, file);
config.keyboardApi = (DeviceAPI)GetPrivateProfileIntW(L"General Settings", L"Keyboard Mode", WM, file); config.keyboardApi = (DeviceAPI)GetPrivateProfileIntW(L"General Settings", L"Keyboard Mode", WM, file);
config.mouseApi = (DeviceAPI) GetPrivateProfileIntW(L"General Settings", L"Mouse Mode", 0, file); config.mouseApi = (DeviceAPI) GetPrivateProfileIntW(L"General Settings", L"Mouse Mode", 0, file);
config.gameApis.directInput = GetPrivateProfileBool(L"General Settings", L"DirectInput Game Devices", 1, file);
config.gameApis.xInput = GetPrivateProfileBool(L"General Settings", L"XInput", 1, file);
config.saveStateTitle = GetPrivateProfileBool(L"General Settings", L"Save State in Title", 1, file);
config.vistaVolume = GetPrivateProfileBool(L"General Settings", L"Vista Volume", 1, file);
config.volume = GetPrivateProfileInt(L"General Settings", L"Volume", 100, file); config.volume = GetPrivateProfileInt(L"General Settings", L"Volume", 100, file);
OSVERSIONINFO os; OSVERSIONINFO os;
os.dwOSVersionInfoSize = sizeof(os); os.dwOSVersionInfoSize = sizeof(os);
@ -1506,7 +1512,17 @@ void UpdatePadPages() {
memset(hWnds, 0, sizeof(hWnds)); memset(hWnds, 0, sizeof(hWnds));
int slot = 0; int slot = 0;
for (int port=0; port<2; port++) { for (int port=0; port<2; port++) {
for (int slot=0; slot<4; slot++) {
if (config.padConfigs[port][slot].type == DisabledPad) continue; if (config.padConfigs[port][slot].type == DisabledPad) continue;
wchar_t title[20];
if (!slot) {
wsprintfW(title, L"Pad %i", port+1);
}
else {
if (!config.multitap[port]) continue;
wsprintfW(title, L"Pad %i-%i", port+1, slot+1);
}
PROPSHEETPAGE psp; PROPSHEETPAGE psp;
ZeroMemory(&psp, sizeof(psp)); ZeroMemory(&psp, sizeof(psp));
psp.dwSize = sizeof(psp); psp.dwSize = sizeof(psp);
@ -1514,10 +1530,7 @@ void UpdatePadPages() {
psp.hInstance = hInst; psp.hInstance = hInst;
psp.pfnDlgProc = (DLGPROC) DialogProc; psp.pfnDlgProc = (DLGPROC) DialogProc;
psp.lParam = port | (slot<<1); psp.lParam = port | (slot<<1);
if (port == 0) psp.pszTitle = title;
psp.pszTitle = L"Pad 1";
else
psp.pszTitle = L"Pad 2";
if (config.padConfigs[port][slot].type != GuitarPad) if (config.padConfigs[port][slot].type != GuitarPad)
psp.pszTemplate = MAKEINTRESOURCE(IDD_CONFIG); psp.pszTemplate = MAKEINTRESOURCE(IDD_CONFIG);
else else
@ -1525,6 +1538,7 @@ void UpdatePadPages() {
pages[count] = CreatePropertySheetPage(&psp); pages[count] = CreatePropertySheetPage(&psp);
if (pages[count]) count++; if (pages[count]) count++;
} }
}
while (SendMessage(hWndProp, PSM_INDEXTOPAGE, 1, 0)) { while (SendMessage(hWndProp, PSM_INDEXTOPAGE, 1, 0)) {
PropSheet_RemovePage(hWndProp, 1, 0); PropSheet_RemovePage(hWndProp, 1, 0);
} }
@ -1547,15 +1561,40 @@ HPROPSHEETPAGE CreateGeneralPage() {
return CreatePropertySheetPage(&psp); return CreatePropertySheetPage(&psp);
} }
int ListIndexToPortAndSlot (int index, int *port, int *slot) {
if (index < 0 || index >= 2 + 3*(config.multitap[0]+config.multitap[1])) {
*port = 0;
*slot = 0;
return 0;
}
if (index < 1 + 3*config.multitap[0]) {
*port = 0;
*slot = index;
}
else {
*port = 1;
*slot = index-1-3*config.multitap[0];
}
return 1;
}
void UpdatePadList(HWND hWnd) { void UpdatePadList(HWND hWnd) {
HWND hWndList = GetDlgItem(hWnd, IDC_PAD_LIST); HWND hWndList = GetDlgItem(hWnd, IDC_PAD_LIST);
HWND hWndCombo = GetDlgItem(hWnd, IDC_PAD_TYPE); HWND hWndCombo = GetDlgItem(hWnd, IDC_PAD_TYPE);
HWND hWndAnalog = GetDlgItem(hWnd, IDC_ANALOG_START1); HWND hWndAnalog = GetDlgItem(hWnd, IDC_ANALOG_START1);
int slot = 0; int slot;
int port;
int index = 0; int index = 0;
for (int port=0; port<2; port++) { wchar_t *strings[] = {L"Disabled", L"Dualshock 2", L"Guitar"};
for (port=0; port<2; port++) {
for (slot = 0; slot<4; slot++) {
wchar_t text[100]; wchar_t text[100];
wsprintf(text, L"Pad %i", port); if (!slot)
wsprintf(text, L"Pad %i", port+1);
else {
if (!config.multitap[port]) continue;
wsprintf(text, L"Pad %i-%i", port+1, slot+1);
}
LVITEM item; LVITEM item;
item.iItem = index; item.iItem = index;
item.iSubItem = 0; item.iSubItem = 0;
@ -1569,7 +1608,6 @@ void UpdatePadList(HWND hWnd) {
} }
item.iSubItem = 1; item.iSubItem = 1;
wchar_t *strings[] = {L"Disabled", L"Dualshock 2", L"Guitar"};
if (2 < (unsigned int)config.padConfigs[port][slot].type) config.padConfigs[port][slot].type = Dualshock2Pad; if (2 < (unsigned int)config.padConfigs[port][slot].type) config.padConfigs[port][slot].type = Dualshock2Pad;
item.pszText = strings[config.padConfigs[port][slot].type]; item.pszText = strings[config.padConfigs[port][slot].type];
ListView_SetItem(hWndList, &item); ListView_SetItem(hWndList, &item);
@ -1586,18 +1624,23 @@ void UpdatePadList(HWND hWnd) {
ListView_SetItem(hWndList, &item); ListView_SetItem(hWndList, &item);
index++; index++;
} }
}
while (ListView_DeleteItem(hWndList, index));
int sel = ListView_GetNextItem(hWndList, -1, LVNI_SELECTED); int sel = ListView_GetNextItem(hWndList, -1, LVNI_SELECTED);
EnableWindow(hWndCombo, sel>=0); int enable;
EnableWindow(hWndAnalog, sel>=0); if (!ListIndexToPortAndSlot(sel, &port, &slot)) {
if (sel < 0) { enable = 0;
SendMessage(hWndCombo, CB_SETCURSEL, -1, 0); SendMessage(hWndCombo, CB_SETCURSEL, -1, 0);
CheckDlgButton(hWnd, IDC_ANALOG_START1, BST_UNCHECKED); CheckDlgButton(hWnd, IDC_ANALOG_START1, BST_UNCHECKED);
} }
else { else {
SendMessage(hWndCombo, CB_SETCURSEL, config.padConfigs[sel][0].type, 0); enable = 1;
CheckDlgButton(hWnd, IDC_ANALOG_START1, BST_CHECKED*config.padConfigs[sel][0].autoAnalog); 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, enable);
} }
INT_PTR CALLBACK GeneralDialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM lParam) { INT_PTR CALLBACK GeneralDialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM lParam) {
@ -1632,37 +1675,24 @@ INT_PTR CALLBACK GeneralDialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, L
RefreshEnabledDevicesAndDisplay(0, hWnd, 0); RefreshEnabledDevicesAndDisplay(0, hWnd, 0);
UpdatePadList(hWnd); UpdatePadList(hWnd);
CheckDlgButton(hWnd, IDC_BACKGROUND, BST_CHECKED * config.background); for (int j=0; j<sizeof(BoolOptionsInfo)/sizeof(BoolOptionsInfo[0]); j++) {
CheckDlgButton(hWnd, IDC_FORCE_HIDE, BST_CHECKED * config.forceHide); CheckDlgButton(hWnd, BoolOptionsInfo[j].ControlId, BST_CHECKED * config.bools[j]);
}
CheckDlgButton(hWnd, IDC_CLOSE_HACK1, BST_CHECKED * (config.closeHacks&1)); CheckDlgButton(hWnd, IDC_CLOSE_HACK1, BST_CHECKED * (config.closeHacks&1));
CheckDlgButton(hWnd, IDC_CLOSE_HACK2, BST_CHECKED * ((config.closeHacks&2)>>1)); CheckDlgButton(hWnd, IDC_CLOSE_HACK2, BST_CHECKED * ((config.closeHacks&2)>>1));
CheckDlgButton(hWnd, IDC_CLOSE_HACK3, BST_CHECKED * ((config.closeHacks&4)>>2));
CheckDlgButton(hWnd, IDC_MOUSE_UNFOCUS, BST_CHECKED * config.mouseUnfocus);
CheckDlgButton(hWnd, IDC_GS_THREAD_INPUT, BST_CHECKED * config.GSThreadUpdates);
if (!ps2e) { if (!ps2e) {
EnableWindow(GetDlgItem(hWnd, IDC_GS_THREAD_INPUT), 0); EnableWindow(GetDlgItem(hWnd, IDC_GS_THREAD_INPUT), 0);
} }
CheckDlgButton(hWnd, IDC_ESCAPE_FULLSCREEN_HACK, BST_CHECKED * config.escapeFullscreenHack);
CheckDlgButton(hWnd, IDC_DISABLE_SCREENSAVER, BST_CHECKED * config.disableScreenSaver);
CheckDlgButton(hWnd, IDC_GH2_HACK, BST_CHECKED * config.GH2);
CheckDlgButton(hWnd, IDC_SAVE_STATE_TITLE, BST_CHECKED * config.saveStateTitle);
CheckDlgButton(hWnd, IDC_VISTA_VOLUME, BST_CHECKED * config.vistaVolume);
if (config.osVersion < 6) EnableWindow(GetDlgItem(hWnd, IDC_VISTA_VOLUME), 0); if (config.osVersion < 6) EnableWindow(GetDlgItem(hWnd, IDC_VISTA_VOLUME), 0);
CheckDlgButton(hWnd, IDC_DEBUG_FILE, BST_CHECKED * config.debug);
CheckDlgButton(hWnd, IDC_MULTIPLE_BINDING, BST_CHECKED * config.multipleBinding);
if (config.keyboardApi < 0 || config.keyboardApi > 3) config.keyboardApi = NO_API; if (config.keyboardApi < 0 || config.keyboardApi > 3) config.keyboardApi = NO_API;
CheckRadioButton(hWnd, IDC_KB_DISABLE, IDC_KB_RAW, IDC_KB_DISABLE + config.keyboardApi); CheckRadioButton(hWnd, IDC_KB_DISABLE, IDC_KB_RAW, IDC_KB_DISABLE + config.keyboardApi);
if (config.mouseApi < 0 || config.mouseApi > 3) config.mouseApi = NO_API; if (config.mouseApi < 0 || config.mouseApi > 3) config.mouseApi = NO_API;
CheckRadioButton(hWnd, IDC_M_DISABLE, IDC_M_RAW, IDC_M_DISABLE + config.mouseApi); CheckRadioButton(hWnd, IDC_M_DISABLE, IDC_M_RAW, IDC_M_DISABLE + config.mouseApi);
CheckDlgButton(hWnd, IDC_G_DI, BST_CHECKED * config.gameApis.directInput);
CheckDlgButton(hWnd, IDC_G_XI, BST_CHECKED * config.gameApis.xInput);
if (!InitializeRawInput()) { if (!InitializeRawInput()) {
EnableWindow(GetDlgItem(hWnd, IDC_KB_RAW), 0); EnableWindow(GetDlgItem(hWnd, IDC_KB_RAW), 0);
@ -1678,11 +1708,13 @@ INT_PTR CALLBACK GeneralDialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, L
case WM_COMMAND: case WM_COMMAND:
if (LOWORD(wParam) == IDC_PAD_TYPE) { if (LOWORD(wParam) == IDC_PAD_TYPE) {
if (HIWORD(wParam) == CBN_SELCHANGE) { if (HIWORD(wParam) == CBN_SELCHANGE) {
int pad = ListView_GetNextItem(hWndList, -1, LVNI_SELECTED);
HWND hWndCombo = GetDlgItem(hWnd, IDC_PAD_TYPE); HWND hWndCombo = GetDlgItem(hWnd, IDC_PAD_TYPE);
int index = ListView_GetNextItem(hWndList, -1, LVNI_SELECTED);
int sel = SendMessage(hWndCombo, CB_GETCURSEL, 0, 0); int sel = SendMessage(hWndCombo, CB_GETCURSEL, 0, 0);
if (pad >= 0 && sel >= 0 && sel != config.padConfigs[pad][0].type) { int port, slot;
config.padConfigs[pad][0].type = (PadType)sel; if (sel < 0 || !ListIndexToPortAndSlot(index, &port, &slot)) break;
if (sel != config.padConfigs[port][slot].type) {
config.padConfigs[port][slot].type = (PadType)sel;
UpdatePadList(hWnd); UpdatePadList(hWnd);
UpdatePadPages(); UpdatePadPages();
RefreshEnabledDevicesAndDisplay(0, hWnd, 1); RefreshEnabledDevicesAndDisplay(0, hWnd, 1);
@ -1732,12 +1764,12 @@ INT_PTR CALLBACK GeneralDialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, L
UpdatePadList(hWnd); UpdatePadList(hWnd);
} }
else if (HIWORD(wParam)==BN_CLICKED && LOWORD(wParam) == IDC_ANALOG_START1) { else if (HIWORD(wParam)==BN_CLICKED && LOWORD(wParam) == IDC_ANALOG_START1) {
int pad = ListView_GetNextItem(hWndList, -1, LVNI_SELECTED); int index = ListView_GetNextItem(hWndList, -1, LVNI_SELECTED);
if (pad >= 0) { int port, slot;
config.padConfigs[pad][0].autoAnalog = (IsDlgButtonChecked(hWnd, IDC_ANALOG_START1) == BST_CHECKED); if (!ListIndexToPortAndSlot(index, &port, &slot)) break;
config.padConfigs[port][slot].autoAnalog = (IsDlgButtonChecked(hWnd, IDC_ANALOG_START1) == BST_CHECKED);
PropSheet_Changed(hWndProp, hWnd); PropSheet_Changed(hWndProp, hWnd);
} }
}
else { else {
int t = IDC_CLOSE_HACK1; int t = IDC_CLOSE_HACK1;
int test = LOWORD(wParam); int test = LOWORD(wParam);
@ -1748,28 +1780,18 @@ INT_PTR CALLBACK GeneralDialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, L
CheckDlgButton(hWnd, IDC_CLOSE_HACK1, BST_UNCHECKED); CheckDlgButton(hWnd, IDC_CLOSE_HACK1, BST_UNCHECKED);
} }
config.forceHide = (IsDlgButtonChecked(hWnd, IDC_FORCE_HIDE) == BST_CHECKED); int mtap = config.multitap[0] + 2*config.multitap[1];
config.closeHacks = (IsDlgButtonChecked(hWnd, IDC_CLOSE_HACK1) == BST_CHECKED) |
((IsDlgButtonChecked(hWnd, IDC_CLOSE_HACK2) == BST_CHECKED)<<1) |
((IsDlgButtonChecked(hWnd, IDC_CLOSE_HACK3) == BST_CHECKED)<<2);
config.background = (IsDlgButtonChecked(hWnd, IDC_BACKGROUND) == BST_CHECKED);
config.mouseUnfocus = (IsDlgButtonChecked(hWnd, IDC_MOUSE_UNFOCUS) == BST_CHECKED);
config.GSThreadUpdates = (IsDlgButtonChecked(hWnd, IDC_GS_THREAD_INPUT) == BST_CHECKED); for (int j=0; j<sizeof(BoolOptionsInfo)/sizeof(BoolOptionsInfo[0]); j++) {
config.escapeFullscreenHack = (IsDlgButtonChecked(hWnd, IDC_ESCAPE_FULLSCREEN_HACK) == BST_CHECKED); config.bools[j] = (IsDlgButtonChecked(hWnd, BoolOptionsInfo[j].ControlId) == BST_CHECKED);
config.disableScreenSaver = (IsDlgButtonChecked(hWnd, IDC_DISABLE_SCREENSAVER) == BST_CHECKED);
config.GH2 = (IsDlgButtonChecked(hWnd, IDC_GH2_HACK) == BST_CHECKED);
config.saveStateTitle = (IsDlgButtonChecked(hWnd, IDC_SAVE_STATE_TITLE) == BST_CHECKED);
u8 newVistaVolume = (IsDlgButtonChecked(hWnd, IDC_VISTA_VOLUME) == BST_CHECKED);
if (config.vistaVolume != newVistaVolume) {
config.vistaVolume = newVistaVolume;
SetVolume(100);
} }
config.debug = (IsDlgButtonChecked(hWnd, IDC_DEBUG_FILE) == BST_CHECKED); config.closeHacks = (IsDlgButtonChecked(hWnd, IDC_CLOSE_HACK1) == BST_CHECKED) |
config.multipleBinding = (IsDlgButtonChecked(hWnd, IDC_MULTIPLE_BINDING) == BST_CHECKED); ((IsDlgButtonChecked(hWnd, IDC_CLOSE_HACK2) == BST_CHECKED)<<1);
if (!config.vistaVolume) {
SetVolume(100);
}
for (i=0; i<4; i++) { for (i=0; i<4; i++) {
if (IsDlgButtonChecked(hWnd, IDC_KB_DISABLE+i) == BST_CHECKED) { if (IsDlgButtonChecked(hWnd, IDC_KB_DISABLE+i) == BST_CHECKED) {
@ -1791,11 +1813,10 @@ INT_PTR CALLBACK GeneralDialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, L
config.mouseApi = (DeviceAPI)i; config.mouseApi = (DeviceAPI)i;
} }
} }
config.gameApis.directInput = (IsDlgButtonChecked(hWnd, IDC_G_DI) == BST_CHECKED);
config.gameApis.xInput = (IsDlgButtonChecked(hWnd, IDC_G_XI) == BST_CHECKED);
config.forceHide = (IsDlgButtonChecked(hWnd, IDC_FORCE_HIDE) == BST_CHECKED);
if (mtap != config.multitap[0] + 2*config.multitap[1]) {
UpdatePadPages();
}
RefreshEnabledDevicesAndDisplay(0, hWnd, 1); RefreshEnabledDevicesAndDisplay(0, hWnd, 1);
UpdatePadList(hWnd); UpdatePadList(hWnd);

View File

@ -21,31 +21,41 @@ struct GeneralConfig {
public: public:
PadConfig padConfigs[2][4]; PadConfig padConfigs[2][4];
u8 mouseUnfocus;
u8 disableScreenSaver;
u8 closeHacks; u8 closeHacks;
DeviceAPI keyboardApi; DeviceAPI keyboardApi;
DeviceAPI mouseApi; DeviceAPI mouseApi;
struct {
u8 directInput;
u8 xInput;
} gameApis;
u8 debug;
u8 background;
u8 multipleBinding;
u8 forceHide;
u8 GH2;
// Derived value, calculated by GetInput(). // Derived value, calculated by GetInput().
u8 ignoreKeys; u8 ignoreKeys;
union {
struct {
u8 forceHide;
u8 mouseUnfocus;
u8 background;
u8 multipleBinding;
struct {
u8 directInput;
u8 xInput;
} gameApis;
u8 multitap[2];
u8 GSThreadUpdates; u8 GSThreadUpdates;
u8 escapeFullscreenHack; u8 escapeFullscreenHack;
u8 disableScreenSaver;
u8 debug;
u8 saveStateTitle; u8 saveStateTitle;
u8 GH2;
u8 vistaVolume; u8 vistaVolume;
};
u8 bools[1];
};
int volume; int volume;
// Unlike the others, not a changeable value. // Unlike the others, not a changeable value.

View File

@ -526,6 +526,8 @@ u32 CALLBACK PS2EgetLibVersion2(u32 type) {
void GetNameAndVersionString(wchar_t *out) { void GetNameAndVersionString(wchar_t *out) {
#ifdef _DEBUG #ifdef _DEBUG
wsprintfW(out, L"LilyPad Debug %i.%i.%i (r%i)", (VERSION>>8)&0xFF, VERSION&0xFF, (VERSION>>24)&0xFF, SVN_REV); wsprintfW(out, L"LilyPad Debug %i.%i.%i (r%i)", (VERSION>>8)&0xFF, VERSION&0xFF, (VERSION>>24)&0xFF, SVN_REV);
#elif (_MSC_VER != 1400)
wsprintfW(out, L"LilyPad svn %i.%i.%i (r%i)", (VERSION>>8)&0xFF, VERSION&0xFF, (VERSION>>24)&0xFF, SVN_REV);
#else #else
wsprintfW(out, L"LilyPad %i.%i.%i", (VERSION>>8)&0xFF, VERSION&0xFF, (VERSION>>24)&0xFF, SVN_REV); wsprintfW(out, L"LilyPad %i.%i.%i", (VERSION>>8)&0xFF, VERSION&0xFF, (VERSION>>24)&0xFF, SVN_REV);
#endif #endif
@ -537,6 +539,11 @@ char* CALLBACK PSEgetLibName() {
sprintf(version, "LilyPad Debug (r%i)", SVN_REV); sprintf(version, "LilyPad Debug (r%i)", SVN_REV);
return version; return version;
#else #else
#if (_MSC_VER != 1400)
static char version[50];
sprintf(version, "LilyPad svn (r%i)", SVN_REV);
return version;
#endif
return "LilyPad"; return "LilyPad";
#endif #endif
} }
@ -617,6 +624,11 @@ s32 CALLBACK PADinit(u32 flags) {
query.lastByte = 1; query.lastByte = 1;
query.numBytes = 0; query.numBytes = 0;
ClearKeyQueue();
// Just in case, when resuming emulation.
QueueKeyEvent(VK_SHIFT, KEYRELEASE);
QueueKeyEvent(VK_MENU, KEYRELEASE);
QueueKeyEvent(VK_CONTROL, KEYRELEASE);
return 0; return 0;
} }
@ -1142,21 +1154,6 @@ DWORD WINAPI RenameWindowThreadProc(void *lpParameter) {
return 0; return 0;
} }
// For escape fullscreen hack. This doesn't work when called from another thread, for some reason.
// That includes a new thread, independent of GS and PCSX2 thread, so use this to make sure it's
// called from the right spot.
ExtraWndProcResult KillFullScreenProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *output) {
// Prevent infinite recursion. Could also just remove this function from the list,
// but CONTINUE_BLISSFULLY_AND_RELEASE_PROC is a safer way to do that.
static int inFunction = 0;
if (!inFunction) {
inFunction = 1;
ShowWindow(hWnd, SW_MINIMIZE);
inFunction = 0;
}
return CONTINUE_BLISSFULLY_AND_RELEASE_PROC;
}
keyEvent* CALLBACK PADkeyEvent() { keyEvent* CALLBACK PADkeyEvent() {
if (!config.GSThreadUpdates) { if (!config.GSThreadUpdates) {
Update(2); Update(2);
@ -1172,7 +1169,6 @@ keyEvent* CALLBACK PADkeyEvent() {
QueueKeyEvent(-2, KEYPRESS); QueueKeyEvent(-2, KEYPRESS);
HANDLE hThread = CreateThread(0, 0, MaximizeWindowThreadProc, 0, 0, 0); HANDLE hThread = CreateThread(0, 0, MaximizeWindowThreadProc, 0, 0, 0);
if (hThread) CloseHandle(hThread); if (hThread) CloseHandle(hThread);
//ShowWindowAsync(hWnd, SW_HIDE);
restoreFullScreen = 1; restoreFullScreen = 1;
return 0; return 0;
} }
@ -1190,7 +1186,7 @@ keyEvent* CALLBACK PADkeyEvent() {
saveStateIndex = (saveStateIndex+10)%10; saveStateIndex = (saveStateIndex+10)%10;
if (config.saveStateTitle) { if (config.saveStateTitle) {
// GSDX only checks its window's message queue at certain points or something, so // GSDX only checks its window's message queue at certain points or something, so
// have to do this in another thread to prevent lockup. // have to do this in another thread to prevent deadlock.
HANDLE hThread = CreateThread(0, 0, RenameWindowThreadProc, 0, 0, 0); HANDLE hThread = CreateThread(0, 0, RenameWindowThreadProc, 0, 0, 0);
if (hThread) CloseHandle(hThread); if (hThread) CloseHandle(hThread);
} }

View File

@ -224,10 +224,12 @@ BEGIN
CONTROL "Allow binding multiple PS2 controls to one PC control",IDC_MULTIPLE_BINDING, CONTROL "Allow binding multiple PS2 controls to one PC control",IDC_MULTIPLE_BINDING,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,223,116,182,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,223,116,182,10
GROUPBOX "Pads",IDC_STATIC,7,140,410,67 GROUPBOX "Pads",IDC_STATIC,7,140,410,67
CONTROL "",IDC_PAD_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | WS_TABSTOP,17,152,183,48,WS_EX_CLIENTEDGE CONTROL "Port 1 Multitap",IDC_MULTITAP1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,152,63,10
COMBOBOX IDC_PAD_TYPE,209,153,140,41,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP CONTROL "Port 2 Multitap",IDC_MULTITAP2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,164,63,10
CONTROL "",IDC_PAD_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | WS_TABSTOP,81,152,183,48,WS_EX_CLIENTEDGE
COMBOBOX IDC_PAD_TYPE,270,153,140,41,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
CONTROL "Use analog mode whenever possible",IDC_ANALOG_START1, CONTROL "Use analog mode whenever possible",IDC_ANALOG_START1,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,209,172,132,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,270,170,132,10
GROUPBOX "Device Diagnostics",IDC_STATIC,7,211,201,99 GROUPBOX "Device Diagnostics",IDC_STATIC,7,211,201,99
CONTROL "",IDC_LIST,"SysListView32",LVS_LIST | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_VSCROLL | WS_TABSTOP,15,224,185,61,WS_EX_CLIENTEDGE CONTROL "",IDC_LIST,"SysListView32",LVS_LIST | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_VSCROLL | WS_TABSTOP,15,224,185,61,WS_EX_CLIENTEDGE
PUSHBUTTON "Test Device",ID_TEST,86,289,57,15 PUSHBUTTON "Test Device",ID_TEST,86,289,57,15

View File

@ -80,6 +80,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib setupapi.lib ole32.lib advapi32.lib user32.lib kernel32.lib Comdlg32.lib dinput8.lib dxguid.lib comctl32.lib" AdditionalDependencies="Winmm.lib setupapi.lib ole32.lib advapi32.lib user32.lib kernel32.lib Comdlg32.lib dinput8.lib dxguid.lib comctl32.lib"
OutputFile="..\..\bin\plugins\$(ProjectName).dll"
LinkIncremental="2" LinkIncremental="2"
SuppressStartupBanner="true" SuppressStartupBanner="true"
GenerateManifest="false" GenerateManifest="false"

View File

@ -24,13 +24,14 @@
#define IDC_G_XI 1110 #define IDC_G_XI 1110
#define IDC_G_DI 1111 #define IDC_G_DI 1111
#define IDC_CLOSE_HACK2 1112 #define IDC_CLOSE_HACK2 1112
#define IDC_CLOSE_HACK3 1113
#define IDC_DEBUG_FILE 1114 #define IDC_DEBUG_FILE 1114
#define IDC_GUITAR1 1115 #define IDC_GUITAR1 1115
#define IDC_ANALOG_START1 1117 #define IDC_ANALOG_START1 1117
#define IDC_MULTITAP1 1118
#define IDC_DISABLE_SCREENSAVER 1119 #define IDC_DISABLE_SCREENSAVER 1119
#define IDC_MOUSE_UNFOCUS 1120 #define IDC_MOUSE_UNFOCUS 1120
#define IDC_AXIS_BUTTONS 1121 #define IDC_AXIS_BUTTONS 1121
#define IDC_MULTITAP2 1121
#define IDC_BACKGROUND 1122 #define IDC_BACKGROUND 1122
#define IDC_MULTIPLE_BINDING 1123 #define IDC_MULTIPLE_BINDING 1123
#define IDC_DISABLE_SCREENSAVER2 1124 #define IDC_DISABLE_SCREENSAVER2 1124