fix cutscene playback in some games
This commit is contained in:
parent
0100459248
commit
f3e69355e5
5 changed files with 44 additions and 5 deletions
|
@ -1,10 +1,8 @@
|
|||
#ifndef HOOK_H
|
||||
#define HOOK_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
#define HOOK_SKIP_2 0x00000001l
|
||||
#define HOOK_LOCAL_ONLY 0x00000002l
|
||||
|
||||
|
@ -59,6 +57,8 @@ typedef HMODULE(WINAPI* LOADLIBRARYEXWPROC)(LPCWSTR, HANDLE, DWORD);
|
|||
typedef FARPROC(WINAPI* GETPROCADDRESSPROC)(HMODULE, LPCSTR);
|
||||
typedef BOOL(WINAPI* GETDISKFREESPACEAPROC)(LPCSTR, LPDWORD, LPDWORD, LPDWORD, LPDWORD);
|
||||
typedef HRESULT(WINAPI* COCREATEINSTANCEPROC)(REFCLSID, LPUNKNOWN, DWORD, REFIID, LPVOID*);
|
||||
typedef MCIERROR(WINAPI* MCISENDCOMMANDAPROC)(MCIDEVICEID, UINT, DWORD_PTR, DWORD_PTR);
|
||||
|
||||
typedef LPTOP_LEVEL_EXCEPTION_FILTER(WINAPI* SETUNHANDLEDEXCEPTIONFILTERPROC)(LPTOP_LEVEL_EXCEPTION_FILTER);
|
||||
|
||||
extern GETCURSORPOSPROC real_GetCursorPos;
|
||||
|
@ -102,6 +102,7 @@ extern LOADLIBRARYEXWPROC real_LoadLibraryExW;
|
|||
extern GETPROCADDRESSPROC real_GetProcAddress;
|
||||
extern GETDISKFREESPACEAPROC real_GetDiskFreeSpaceA;
|
||||
extern COCREATEINSTANCEPROC real_CoCreateInstance;
|
||||
extern MCISENDCOMMANDAPROC real_mciSendCommandA;
|
||||
extern SETUNHANDLEDEXCEPTIONFILTERPROC real_SetUnhandledExceptionFilter;
|
||||
|
||||
extern BOOL g_hook_active;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef WINAPI_HOOKS_H
|
||||
#define WINAPI_HOOKS_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
@ -66,6 +65,8 @@ HWND WINAPI fake_CreateWindowExA(
|
|||
HRESULT WINAPI fake_CoCreateInstance(
|
||||
REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID* ppv);
|
||||
|
||||
MCIERROR WINAPI fake_mciSendCommandA(MCIDEVICEID IDDevice, UINT uMsg, DWORD_PTR fdwCommand, DWORD_PTR dwParam);
|
||||
|
||||
LPTOP_LEVEL_EXCEPTION_FILTER WINAPI fake_SetUnhandledExceptionFilter(
|
||||
LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter);
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include <windows.h>
|
||||
#include <initguid.h>
|
||||
#include "IDirectDraw.h"
|
||||
#include "IDirect3D.h"
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <psapi.h>
|
||||
|
@ -57,6 +56,7 @@ LOADLIBRARYEXWPROC real_LoadLibraryExW = LoadLibraryExW;
|
|||
GETPROCADDRESSPROC real_GetProcAddress = GetProcAddress;
|
||||
GETDISKFREESPACEAPROC real_GetDiskFreeSpaceA = GetDiskFreeSpaceA;
|
||||
COCREATEINSTANCEPROC real_CoCreateInstance = CoCreateInstance;
|
||||
MCISENDCOMMANDAPROC real_mciSendCommandA = mciSendCommandA;
|
||||
SETUNHANDLEDEXCEPTIONFILTERPROC real_SetUnhandledExceptionFilter = SetUnhandledExceptionFilter;
|
||||
|
||||
HOOKLIST g_hook_hooklist[] =
|
||||
|
@ -101,6 +101,13 @@ HOOKLIST g_hook_hooklist[] =
|
|||
{ "CoCreateInstance", (PROC)fake_CoCreateInstance, (PROC*)&real_CoCreateInstance, HOOK_SKIP_2 },
|
||||
{ "", NULL, NULL, 0 }
|
||||
}
|
||||
},
|
||||
{
|
||||
"winmm.dll",
|
||||
{
|
||||
{ "mciSendCommandA", (PROC)fake_mciSendCommandA, (PROC*)&real_mciSendCommandA, HOOK_SKIP_2 },
|
||||
{ "", NULL, NULL, 0 }
|
||||
}
|
||||
},
|
||||
{
|
||||
"dinput.dll",
|
||||
|
|
|
@ -1324,7 +1324,36 @@ HRESULT WINAPI fake_CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD
|
|||
}
|
||||
}
|
||||
|
||||
return real_CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv);
|
||||
/* These dlls must be hooked for cutscene uscaling and windowed mode */
|
||||
HMODULE quartz_dll = GetModuleHandleA("quartz");
|
||||
HMODULE msvfw32_dll = GetModuleHandleA("msvfw32");
|
||||
|
||||
HRESULT result = real_CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv);
|
||||
|
||||
if ((!quartz_dll && GetModuleHandleA("quartz")) ||
|
||||
(!msvfw32_dll && GetModuleHandleA("msvfw32")))
|
||||
{
|
||||
hook_init(FALSE);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
MCIERROR WINAPI fake_mciSendCommandA(MCIDEVICEID IDDevice, UINT uMsg, DWORD_PTR fdwCommand, DWORD_PTR dwParam)
|
||||
{
|
||||
/* These dlls must be hooked for cutscene uscaling and windowed mode */
|
||||
HMODULE quartz_dll = GetModuleHandleA("quartz");
|
||||
HMODULE msvfw32_dll = GetModuleHandleA("msvfw32");
|
||||
|
||||
MCIERROR result = real_mciSendCommandA(IDDevice, uMsg, fdwCommand, dwParam);
|
||||
|
||||
if ((!quartz_dll && GetModuleHandleA("quartz")) ||
|
||||
(!msvfw32_dll && GetModuleHandleA("msvfw32")))
|
||||
{
|
||||
hook_init(FALSE);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
LPTOP_LEVEL_EXCEPTION_FILTER WINAPI fake_SetUnhandledExceptionFilter(
|
||||
|
|
Loading…
Reference in a new issue