Skip to content

Commit

Permalink
Fixed not being able to strafe above 100 fps
Browse files Browse the repository at this point in the history
  • Loading branch information
Whitetiger committed Apr 13, 2014
1 parent 5ad7c26 commit 399fafa
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
2 changes: 1 addition & 1 deletion crashes/crashes/main.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once

#define VERSION 1.9
#define VERSION 2.0

void DownloadUpdate(char* url);
40 changes: 33 additions & 7 deletions crashes/crashes/quickload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <fstream>
#include "memory.h"
#include "quickload.h"
#include "multiplayer_hooksystem.h"

void ShowRaster_Prox();
void StartGame_Prox();
Expand All @@ -24,21 +25,34 @@ int iAlreadyPatched = 2;
DWORD GetModuleBaseAddress(char* module) {
return (DWORD)GetModuleHandle (module);
}
DWORD addr = -1;
void __declspec(naked) FPSStrafeHook() {
_asm pushad

void disableFPSLock() {
DWORD dwSAMPBase = GetModuleBaseAddress("samp.dll");

addr = (DWORD)GetModuleHandle("samp") + 0x65275;

if(*(BYTE*)0xBA6794 == 0) {
_asm popad
_asm jmp addr
}

addr = (DWORD)GetModuleHandle("samp") + 0x652A1;

_asm popad
_asm jmp addr
}
bool quickLoadPatches( )
{
unsigned long dwValue;

DWORD dwSAMPBase = GetModuleBaseAddress("samp.dll");
DWORD dwConnectDelay, dwFPSSleep;
DWORD dwConnectDelay, dwFPSSleep[3];

if(*(int*)(dwSAMPBase + 0x2AE035) == 3000) { // 0.3z R1
dwConnectDelay = dwSAMPBase + 0x2AE035;
dwFPSSleep = dwSAMPBase + 0x653E2;
dwFPSSleep[0] = dwSAMPBase + 0x6526C;
dwFPSSleep[1] = dwSAMPBase + 0x653E0;
dwFPSSleep[2] = dwSAMPBase + 0x6527A;
} else if(*(int*)(dwSAMPBase + 0x244A7E) == 3000) { // 0.3x-R2-pre-release 2
dwConnectDelay = dwSAMPBase + 0x244A7E;
} else if(*(int*)(dwSAMPBase + 0x295074) == 3000) { // 0.3x-R2-pre-release 1
Expand All @@ -58,8 +72,18 @@ bool quickLoadPatches( )

if ( dwFPSSleep != NULL ) {
// Disable the 100FPS Lock
VirtualProtect((LPVOID)dwFPSSleep, 4, PAGE_EXECUTE_READWRITE, &oldProt);
memcpy((void*)dwFPSSleep, "\x90\x90\x90\x90\x90\x90\x90", 7);
VirtualProtect((LPVOID)dwFPSSleep[0], 7, PAGE_EXECUTE_READWRITE, &oldProt);
HookInstall(dwFPSSleep[0], (DWORD)FPSStrafeHook, 7);

VirtualProtect((LPVOID)dwFPSSleep[1], 4, PAGE_EXECUTE_READWRITE, &oldProt);

MemPut <BYTE> (dwFPSSleep[1], 0x6A);
MemPut <BYTE> (dwFPSSleep[1] + 0x2, 0x0);
MemPut <BYTE> (dwFPSSleep[1] + 0x4, 0x90);

VirtualProtect((LPVOID)dwFPSSleep[2], 5, PAGE_EXECUTE_READWRITE, &oldProt);
memcpy((void*)dwFPSSleep[2], "\x90\x90\x90\x90\x90", 5);

}


Expand Down Expand Up @@ -159,6 +183,8 @@ void __declspec(naked) ShowRaster_Prox()
}
}



void __declspec(naked) StartGame_Prox()
{
if (GetModuleHandle("samp"))
Expand Down

0 comments on commit 399fafa

Please sign in to comment.