Advertisement
Tornamic

Untitled

Jan 7th, 2025
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. const char aScriptDir[] = "CoopAndreas";
  2. const char aScriptPath[] = "CoopAndreas\\main.scm";
  3. const char aImgPath[] = "CoopAndreas\\script.img";
  4.  
  5. uintptr_t CStreaming__AddImageToList_ptr = 0x0;
  6. uint32_t CStreaming__AddImageToList_Hook(const char* fileName, bool notPlayerFile)
  7. {
  8.     if (strncmp(fileName, "DATA\\SCRIPT\\SCRIPT.IMG", 22) == 0)
  9.     {
  10.         fileName = aImgPath;
  11.     }
  12.  
  13.     return plugin::CallAndReturnDyn<uint32_t>(CStreaming__AddImageToList_ptr, fileName, notPlayerFile);
  14. }
  15.  
  16. void PatchSCM()
  17. {
  18.     // use our main.scm
  19.     patch::SetPointer(0x468EB5 + 1, (void*)aScriptDir);
  20.     patch::SetPointer(0x489A45 + 1, (void*)aScriptPath);
  21.  
  22.     // hook script.img loading
  23.     CStreaming__AddImageToList_ptr = injector::GetBranchDestination(0x5B915B).as_int();
  24.     patch::RedirectCall(0x5B915B, CStreaming__AddImageToList_Hook);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement