Skip to content

Instantly share code, notes, and snippets.

@snightshade
Last active August 16, 2024 01:04
Show Gist options
  • Save snightshade/cc3c074e95f5e189e3c15090411118cd to your computer and use it in GitHub Desktop.
Save snightshade/cc3c074e95f5e189e3c15090411118cd to your computer and use it in GitHub Desktop.
F/SN Remastered Parallels crash fix PoC; not final
#define WIN32_LEAN_AND_MEAN
#include<Windows.h>
#include<stdlib.h>
#include<stdio.h>
#include<stdint.h>
// Fate/stay night REMASTERED Parallels crash bug fix
// 2024 Nightshade System (lostkagamine)
char* Address_Array(uint64_t addr)
{
char* mem = (char*)malloc(0x8);
int i = 0;
for (uint64_t t = 0xff; i < 8; t <<= 8)
{
char byte = (addr & t) >> (i * 8);
mem[i] = byte;
i++;
}
return mem;
}
void Blade_PatchMemory()
{
uint64_t base = (uint64_t)GetModuleHandle(NULL);
void* page = VirtualAlloc(NULL,
0x10,
MEM_COMMIT | MEM_RESERVE,
PAGE_EXECUTE_READWRITE);
if (page == 0) TerminateProcess((HANDLE)base, 1);
*(char*)page = 0xc3; // ret
uint64_t addr = base + 0xbfd370; // glClearTexImage
char* addrToPage = Address_Array((uint64_t)page);
memcpy((void*)addr, addrToPage, 0x8);
char* buf = (char*)malloc(8000);
sprintf(buf, "Patched glClearTexImage successfully! Page is at 0x%llx.", (uint64_t)page);
MessageBoxA(NULL, buf, "blade_fix", MB_ICONINFORMATION | MB_OK);
free(buf);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment