1
0
mirror of synced 2024-11-14 23:07:36 +01:00

- TTX fixes

- Fixes D:\ issues (game not starting from D:\, saving files on D:\, not starting without D:\)
- Fix windowed mode in couple of games (so window doesn't just sit in top-left corner)
- Add configurable IP to Chase HQ2, Wacky Races, Valve Limit R, Battle Gear 4, Battle Gear 4 Tuned (LAN play)
This commit is contained in:
Nezarn 2020-12-12 17:20:39 +01:00
parent 971b13439b
commit 396c6bcff3
5 changed files with 879 additions and 234 deletions

File diff suppressed because it is too large Load Diff

View File

@ -104,8 +104,16 @@ HWND WINAPI CreateWindowExAHk(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWind
{
dwStyle = g_windowStyle;
}
if (lpWindowName == NULL)
{
lpWindowName = lpClassName;
dwStyle = g_windowStyle;
}
// Make window pos centered
g_x = (GetSystemMetrics(SM_CXSCREEN) - nWidth) / 2;
g_y = (GetSystemMetrics(SM_CYSCREEN) - nHeight) / 2;
HWND thisWindow = CreateWindowExA(dwExStyle, lpClassName, lpWindowName, dwStyle, g_x, g_y, g_width, g_height, hWndParent, hMenu, hInstance, lpParam);
HWND thisWindow = CreateWindowExA(dwExStyle, lpClassName, lpWindowName, dwStyle, g_x, g_y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
if (lpWindowName)
{
@ -120,12 +128,32 @@ HWND WINAPI CreateWindowExWHk(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWi
#ifdef _DEBUG
info(true, "CreateWindowExWHk called");
#endif
// Calculate window pos centered
g_x = (GetSystemMetrics(SM_CXSCREEN) - nWidth) / 2;
g_y = (GetSystemMetrics(SM_CYSCREEN) - nHeight) / 2;
if (GameDetect::currentGame == GameID::SF4 && x != 0 && y != 0)
{
dwStyle = g_windowStyle;
return CreateWindowExW(dwExStyle, lpClassName, L"OpenParrot - Street Fighter IV", dwStyle, x, y, 1280, 720, hWndParent, hMenu, hInstance, lpParam);
}
else if (GameDetect::currentGame == GameID::SF4 && x == 0 && y == 0)
{
return CreateWindowExW(dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
}
if (lpWindowName)
{
dwStyle = g_windowStyle;
}
if (lpWindowName == NULL)
{
lpWindowName = lpClassName;
dwStyle = g_windowStyle;
}
HWND thisWindow = CreateWindowExW(dwExStyle, lpClassName, lpWindowName, dwStyle, g_x, g_y, g_width, g_height, hWndParent, hMenu, hInstance, lpParam);
HWND thisWindow = CreateWindowExW(dwExStyle, lpClassName, lpWindowName, dwStyle, g_x, g_y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
if (lpWindowName)
{
@ -145,15 +173,34 @@ BOOL WINAPI AdjustWindowRectHk(LPRECT lpRect, DWORD dwStyle, BOOL bMenu)
return AdjustWindowRect(lpRect, dwStyle, bMenu);
}
BOOL WINAPI AdjustWindowRectExHk(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle)
{
#ifdef _DEBUG
info(true, "AdjustWindowRectExHk called");
#endif
dwStyle = g_windowStyle;
dwExStyle = 0;
return AdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle);
}
BOOL WINAPI SetWindowPosHk(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags)
{
#ifdef _DEBUG
info(true, "SetWindowPosHk called");
#endif
// Make window pos centered
int xPos = (GetSystemMetrics(SM_CXSCREEN) - cx) / 2;
int yPos = (GetSystemMetrics(SM_CYSCREEN) - cy) / 2;
if (hwndWindowA == hWnd || hwndWindowW == hWnd)
{
X = g_x;
Y = g_y;
X = xPos;
Y = yPos;
}
if (hWndInsertAfter == HWND_TOPMOST)
{
hWndInsertAfter = HWND_TOP;
}
return SetWindowPos(hWnd, hWndInsertAfter, X, Y, cx, cy, uFlags);
@ -169,11 +216,26 @@ LONG __stdcall ChangeDisplaySettingsHk(DEVMODEA *lpDevMode, DWORD dwFlags)
return ChangeDisplaySettingsA(lpDevMode, dwFlags);
}
LONG __stdcall ChangeDisplaySettingsExWHk(LPCWSTR lpszDeviceName, DEVMODEW* lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam)
{
#ifdef _DEBUG
info(true, "ChangeDisplaySettingsExWHk called");
#endif
lpDevMode = NULL; // retain original changes instead of applying modified values
return ChangeDisplaySettingsExW(lpszDeviceName, lpDevMode, hwnd, dwflags, lParam);
}
BOOL WINAPI UpdateWindowHk(HWND hWnd)
{
return true;
}
BOOL WINAPI ClipCursorHk(const RECT* lpRect)
{
return false;
}
void init_windowHooks(windowHooks* data)
{
g_windowStyle = WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
@ -199,6 +261,11 @@ void init_windowHooks(windowHooks* data)
*(BOOL*)data->adjustWindowRect = (BOOL)AdjustWindowRectHk;
}
if (data->adjustWindowRectEx != NULL)
{
*(BOOL*)data->adjustWindowRectEx = (BOOL)AdjustWindowRectExHk;
}
if (data->setWindowPos != NULL)
{
*(BOOL*)data->setWindowPos = (BOOL)SetWindowPosHk;
@ -209,10 +276,20 @@ void init_windowHooks(windowHooks* data)
*(LONG*)data->changeDisplaySettings = (LONG)ChangeDisplaySettingsHk;
}
if (data->changeDisplaySettingsExW != NULL)
{
*(LONG*)data->changeDisplaySettingsExW = (LONG)ChangeDisplaySettingsExWHk;
}
if (data->updateWindow != NULL)
{
*(BOOL*)data->updateWindow = (BOOL)UpdateWindowHk;
}
if (data->clipCursor != NULL)
{
*(BOOL*)data->clipCursor = (BOOL)ClipCursorHk;
}
}
/* END WINDOW HOOKS */

View File

@ -8,9 +8,12 @@ struct windowHooks
int createWindowExA;
int createWindowExW;
int adjustWindowRect;
int adjustWindowRectEx;
int setWindowPos;
int changeDisplaySettings;
int changeDisplaySettingsExW;
int updateWindow;
int clipCursor;
};
void init_windowHooks(windowHooks* data);

View File

@ -518,7 +518,7 @@ void GameDetect::DetectCurrentGame()
isNesica = true;
break;
case 0x1046a695: //Spica Adventure for NXL (honestly no difference i can find from OG version, X2 emu works fine for it)
currentGame = GameID::SpicaAdventure;
currentGame = GameID::SpicaAdventureNXL;
X2Type = X2Type::Generic;
break;
case 0xbd516d7b: // KOFXIII Climax

View File

@ -91,5 +91,6 @@ enum class GameID
Exception,
KOF2002,
BlazBlueCF201,
SpicaAdventureNXL,
LinuxEmulation
};