Improved mouse pos fix

This commit is contained in:
Silent 2014-09-16 16:47:25 +02:00
parent 048999d74a
commit 94637d52f9
2 changed files with 24 additions and 5 deletions

View File

@ -77,7 +77,7 @@
<MinimumRequiredVersion>5.0</MinimumRequiredVersion> <MinimumRequiredVersion>5.0</MinimumRequiredVersion>
<EntryPointSymbol> <EntryPointSymbol>
</EntryPointSymbol> </EntryPointSymbol>
<AdditionalDependencies>Winmm.lib</AdditionalDependencies> <AdditionalDependencies>Winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
<PostBuildEvent> <PostBuildEvent>
<Command>copy /y "$(TargetPath)" "D:\gry\Steam\steamapps\common\Grand Theft Auto 3\SilentPatchIII.asi"</Command> <Command>copy /y "$(TargetPath)" "D:\gry\Steam\steamapps\common\Grand Theft Auto 3\SilentPatchIII.asi"</Command>
@ -108,7 +108,7 @@
<MinimumRequiredVersion>5.0</MinimumRequiredVersion> <MinimumRequiredVersion>5.0</MinimumRequiredVersion>
<EntryPointSymbol> <EntryPointSymbol>
</EntryPointSymbol> </EntryPointSymbol>
<AdditionalDependencies>Winmm.lib</AdditionalDependencies> <AdditionalDependencies>Winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
<PostBuildEvent> <PostBuildEvent>
<Command>copy /y "$(TargetPath)" "D:\gry\Steam\steamapps\common\Grand Theft Auto 3\SilentPatchIII.asi"</Command> <Command>copy /y "$(TargetPath)" "D:\gry\Steam\steamapps\common\Grand Theft Auto 3\SilentPatchIII.asi"</Command>

View File

@ -3,6 +3,20 @@
#include "General.h" #include "General.h"
#include "Timer.h" #include "Timer.h"
struct PsGlobalType
{
HWND window;
DWORD instance;
DWORD fullscreen;
DWORD lastMousePos_X;
DWORD lastMousePos_Y;
DWORD unk;
DWORD diInterface;
DWORD diMouse;
void* diDevice1;
void* diDevice2;
};
struct RsGlobalType struct RsGlobalType
{ {
const char* AppName; const char* AppName;
@ -11,12 +25,14 @@ struct RsGlobalType
signed int MaximumHeight; signed int MaximumHeight;
unsigned int frameLimit; unsigned int frameLimit;
BOOL quit; BOOL quit;
void* ps; PsGlobalType* ps;
void* keyboard; void* keyboard;
void* mouse; void* mouse;
void* pad; void* pad;
}; };
struct RwV2d struct RwV2d
{ {
float x; /**< X value*/ float x; /**< X value*/
@ -87,8 +103,11 @@ static void (* const ConstructRenderList)() = AddressByVersion<void(*)()>(0x4A76
static void (* const RsMouseSetPos)(RwV2d*) = AddressByVersion<void(*)(RwV2d*)>(0x580D20, 0x581070, 0x580F70); static void (* const RsMouseSetPos)(RwV2d*) = AddressByVersion<void(*)(RwV2d*)>(0x580D20, 0x581070, 0x580F70);
void ResetMousePos() void ResetMousePos()
{ {
if ( RsGlobal->ps->window == GetFocus() )
{
RwV2d vecPos = { RsGlobal->MaximumWidth * 0.5f, RsGlobal->MaximumHeight * 0.5f }; RwV2d vecPos = { RsGlobal->MaximumWidth * 0.5f, RsGlobal->MaximumHeight * 0.5f };
RsMouseSetPos(&vecPos); RsMouseSetPos(&vecPos);
}
ConstructRenderList(); ConstructRenderList();
} }