diff --git a/OpenParrot/src/Functions/Games/TypeX2/TypeX2Generic.cpp b/OpenParrot/src/Functions/Games/TypeX2/TypeX2Generic.cpp index f14474a..7735d33 100644 --- a/OpenParrot/src/Functions/Games/TypeX2/TypeX2Generic.cpp +++ b/OpenParrot/src/Functions/Games/TypeX2/TypeX2Generic.cpp @@ -1332,6 +1332,13 @@ static InitFunction initFunction([]() // skip dinput devices (TODO: maybe make original Dinput.dll wrapper?) injector::WriteMemory(imageBase + 0xBD1D7, 0xEB, true); } + + if (GameDetect::currentGame == GameID::TroubleWitches) + { + injector::WriteMemoryRaw(imageBase + 0xB2E6C, ".\\Save", 7, true); + injector::WriteMemoryRaw(imageBase + 0xC28B0, ".\\Save\\Config%d.bin", 20, true); + injector::WriteMemoryRaw(imageBase + 0xC28C8, ".\\Save\\Config%04d.bin", 22, true); + } }); #endif #pragma optimize("", on) diff --git a/OpenParrot/src/Functions/WindowedDx8.cpp b/OpenParrot/src/Functions/WindowedDx8.cpp index 28d80e9..0e2fc90 100644 --- a/OpenParrot/src/Functions/WindowedDx8.cpp +++ b/OpenParrot/src/Functions/WindowedDx8.cpp @@ -6,7 +6,7 @@ #include "Utility/GameDetect.h" static bool swShaderHack = false; -static bool windowed = false; +//static bool windowed = false; IDirect3D8*(WINAPI* g_origDirect3DCreate8)(UINT SDKVersion); @@ -28,12 +28,13 @@ static HRESULT(WINAPI* g_oldReset)(IDirect3DDevice8* self, D3DPRESENT_PARAMETERS HRESULT WINAPI ResetWrap(IDirect3DDevice8* self, D3DPRESENT_PARAMETERS* pPresentationParameters) { - if (windowed) + if (ToBool(config["General"]["Windowed"])) { pPresentationParameters->Windowed = TRUE; pPresentationParameters->FullScreen_RefreshRateInHz = 0; pPresentationParameters->BackBufferWidth = 0; pPresentationParameters->BackBufferHeight = 0; + pPresentationParameters->BackBufferFormat = D3DFMT_A8R8G8B8; // TODO: query current desktop format and use it pPresentationParameters->Flags = 0; pPresentationParameters->FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; } @@ -45,12 +46,13 @@ static HRESULT(WINAPI* g_oldCreateDevice)(IDirect3D8* self, UINT Adapter, D3DDEV HRESULT WINAPI CreateDeviceWrap(IDirect3D8* self, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice8** ppReturnedDeviceInterface) { - if (windowed) + if (ToBool(config["General"]["Windowed"])) { pPresentationParameters->Windowed = TRUE; pPresentationParameters->FullScreen_RefreshRateInHz = 0; pPresentationParameters->BackBufferWidth = 0; pPresentationParameters->BackBufferHeight = 0; + pPresentationParameters->BackBufferFormat = D3DFMT_A8R8G8B8; // TODO: query current desktop format and use it pPresentationParameters->Flags = 0; pPresentationParameters->FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; } diff --git a/OpenParrot/src/Functions/WindowedDx9.cpp b/OpenParrot/src/Functions/WindowedDx9.cpp index c9d1e71..7323ac1 100644 --- a/OpenParrot/src/Functions/WindowedDx9.cpp +++ b/OpenParrot/src/Functions/WindowedDx9.cpp @@ -25,8 +25,15 @@ static HRESULT(WINAPI* g_oldReset)(IDirect3DDevice9* self, D3DPRESENT_PARAMETERS HRESULT WINAPI ResetWrap(IDirect3DDevice9* self, D3DPRESENT_PARAMETERS* pPresentationParameters) { - pPresentationParameters->Windowed = TRUE; - pPresentationParameters->FullScreen_RefreshRateInHz = 0; + if (ToBool(config["General"]["Windowed"])) + { + pPresentationParameters->Windowed = TRUE; + pPresentationParameters->FullScreen_RefreshRateInHz = 0; + } + if (GameDetect::currentGame == GameID::TroubleWitches) + { + pPresentationParameters->BackBufferFormat = D3DFMT_A8R8G8B8; // TODO: query current desktop format and use it + } return g_oldReset(self, pPresentationParameters); } @@ -35,8 +42,15 @@ static HRESULT(WINAPI* g_oldCreateDevice)(IDirect3D9* self, UINT Adapter, D3DDEV HRESULT WINAPI CreateDeviceWrap(IDirect3D9* self, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice9** ppReturnedDeviceInterface) { - pPresentationParameters->Windowed = TRUE; - pPresentationParameters->FullScreen_RefreshRateInHz = 0; + if (ToBool(config["General"]["Windowed"])) + { + pPresentationParameters->Windowed = TRUE; + pPresentationParameters->FullScreen_RefreshRateInHz = 0; + } + if (GameDetect::currentGame == GameID::TroubleWitches) + { + pPresentationParameters->BackBufferFormat = D3DFMT_A8R8G8B8; // TODO: query current desktop format and use it + } HRESULT hr = g_oldCreateDevice(self, Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface); @@ -72,6 +86,10 @@ static InitFunction initFunc([]() { if (GameDetect::currentGame == GameID::BG4 || GameDetect::currentGame == GameID::BG4_Eng || GameDetect::currentGame == GameID::JLeague || GameDetect::currentGame == GameID::TER) return; + if (GameDetect::currentGame == GameID::TroubleWitches && !ToBool(config["General"]["Windowed"])) + { + InitD3D9WindowHook(); + } if (ToBool(config["General"]["Windowed"])) { InitD3D9WindowHook();