IlDivinoGlade

GTA V PS4 - 1.56 - Create Vehicle Online Patch

Mar 6th, 2026 (edited)
161
0
Never
9
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.57 KB | None | 0 0
  1. // ── Patch backup/restore ──────────────────────────────────────────────────────
  2.  
  3. struct PatchEntry {
  4.     uintptr_t addr;
  5.     uint8_t   original[8];
  6.     uint8_t   patched[8];
  7.     size_t    size;
  8.     bool      applied;
  9. };
  10.  
  11. static PatchEntry g_patches[] = {
  12.     {
  13.         /* CreateVehicle network branch */
  14.         GTA_BASE + 0xAF3A2F,
  15.         { 0x75, 0x0E },   // original: jnz short loc_AF3A3F
  16.         { 0xEB, 0x0E },   // patched:  jmp short loc_AF3A3F
  17.         2, false
  18.     },
  19.    
  20. };
  21.  
  22. static constexpr int PATCH_COUNT = sizeof(g_patches) / sizeof(g_patches[0]);
  23.  
  24.  
  25. static void ApplyPatch(PatchEntry& p) {
  26.     if (p.applied) return;
  27.     sceKernelMprotect((void*)p.addr, p.size, VM_PROT_ALL);
  28.     memcpy((void*)p.addr, p.patched, p.size);
  29.     p.applied = true;
  30.     final_printf("[PATCH] Applied @ 0x%lx (%zu bytes)\n", p.addr, p.size);
  31. }
  32.  
  33.  
  34. static void RestorePatch(PatchEntry& p) {
  35.     if (!p.applied) return;
  36.     sceKernelMprotect((void*)p.addr, p.size, VM_PROT_ALL);
  37.     memcpy((void*)p.addr, p.original, p.size);
  38.     p.applied = false;
  39.     final_printf("[PATCH] Restored @ 0x%lx (%zu bytes)\n", p.addr, p.size);
  40. }
  41.  
  42.  
  43. void InstallAllPatches() {
  44.     for (int i = 0; i < PATCH_COUNT; i++)
  45.         ApplyPatch(g_patches[i]);
  46.     final_printf("[PATCH] All patches installed.\n");
  47. }
  48.  
  49.  
  50. void RestoreAllPatches() {
  51.     for (int i = 0; i < PATCH_COUNT; i++)
  52.         RestorePatch(g_patches[i]);
  53.     final_printf("[PATCH] All patches restored.\n");
  54. }
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
Add Comment
Please, Sign In to add comment