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

From Touhou Patch Center
Jump to navigation Jump to search
(File Breakpoints)
 
(fix file_load address)
 
Line 5: Line 5:
In this function, at <code>0x420E05</code> the size of the file to load is passed to <code>LocalAlloc</code>.
In this function, at <code>0x420E05</code> the size of the file to load is passed to <code>LocalAlloc</code>.


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




This is all that is needed to implement file replacement
This is all that is needed to implement file replacement

Latest revision as of 18:28, 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.

0x420E33 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