Misc tweaks

This commit is contained in:
Vauff 2023-10-03 19:45:05 -04:00
parent d3747829aa
commit 504f653c74
2 changed files with 7 additions and 7 deletions

3
.gitattributes vendored Normal file
View file

@ -0,0 +1,3 @@
AMBuilder linguist-generated=true
AMBuildScript linguist-generated=true
PackageScript linguist-generated=true

View file

@ -91,19 +91,16 @@ bool MovementUnlocker::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxl
return false; return false;
} }
#ifdef _WIN32
SourceHook::SetMemAccess((void*)pPatchAddress, PatchLen, SH_MEM_READ | SH_MEM_WRITE | SH_MEM_EXEC);
*(unsigned char*)(pPatchAddress) = ((unsigned char*)"\xEB")[0];
SourceHook::SetMemAccess((void*)pPatchAddress, PatchLen, SH_MEM_READ | SH_MEM_EXEC);
#elif __linux__
SourceHook::SetMemAccess((void*)pPatchAddress, PatchLen, SH_MEM_READ | SH_MEM_WRITE | SH_MEM_EXEC); SourceHook::SetMemAccess((void*)pPatchAddress, PatchLen, SH_MEM_READ | SH_MEM_WRITE | SH_MEM_EXEC);
#ifdef _WIN32
*(unsigned char*)(pPatchAddress) = ((unsigned char*)"\xEB")[0];
#elif __linux__
for (int i = 0; i < PatchLen; i++) for (int i = 0; i < PatchLen; i++)
*(unsigned char*)(pPatchAddress + i) = ((unsigned char*)"\x90")[0]; *(unsigned char*)(pPatchAddress + i) = ((unsigned char*)"\x90")[0];
SourceHook::SetMemAccess((void*)pPatchAddress, PatchLen, SH_MEM_READ | SH_MEM_EXEC);
#endif #endif
SourceHook::SetMemAccess((void*)pPatchAddress, PatchLen, SH_MEM_READ | SH_MEM_EXEC);
META_CONPRINTF( "[Movement Unlocker] Successfully patched Movement Unlocker!\n" ); META_CONPRINTF( "[Movement Unlocker] Successfully patched Movement Unlocker!\n" );
return true; return true;