User:32th System/Seihou 1 thcrap support progress: Difference between revisions

From Touhou Patch Center
Jump to navigation Jump to search
(File Breakpoints)
(No difference)

Revision as of 16:03, 29 September 2019

File breakpoints

At 0x420DF0 the function that I will call arc_load is located. It takes a pointer to a structure of which the first member is the FILE* stream for the archive file to use as the first parameter and the file ID as the second parameter. (file names don't exist in SG archives, you can only determine the type of file by header). The way a file stream can be mapped to a file name is by injecting code into fopen that stores the FILE* stream return value at a location thcrap can easily access.

In this function, at 0x420E05 the size of the file to load is passed to LocalAlloc.

0x420E25 calls the function I will call file_load. It will load a file into a buffer specified by the first parameter


This is all that is needed to implement file replacement