0% found this document useful (0 votes)
24 views

Guide

The document discusses steps to decrypt and modify Spider-Man 2 game files to allow the game to run on PC by hooking functions, patching code, and replacing PS5 shader and texture assets. Key functions to hook include Material::Initialize, MaterialTemplate::Initialize, and hkSerialize::inplaceLoad::toVar. The game also requires patching FreePhysicsSystem and FreeInPlacePhysicsData functions. Replacing shaders and textures from the Wolverine PC build can then allow textures and graphics to work.

Uploaded by

somya.anime.007
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Guide

The document discusses steps to decrypt and modify Spider-Man 2 game files to allow the game to run on PC by hooking functions, patching code, and replacing PS5 shader and texture assets. Key functions to hook include Material::Initialize, MaterialTemplate::Initialize, and hkSerialize::inplaceLoad::toVar. The game also requires patching FreePhysicsSystem and FreeInPlacePhysicsData functions. Replacing shaders and textures from the Wolverine PC build can then allow textures and graphics to work.

Uploaded by

somya.anime.007
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

DISCLAIMER: I will not be sharing ANY of the leaked files or any of the game assets, you will

have to source them yourself. As for id-daemon’s tools, they will be posted when he wants to.
His texture deswizzler tool is only in early stage, so far about 95% of textures work properly, at
least their higher MIPs. It will be improved later.
You will first need to get access to the decrypted PKG files.
Assets in this game each have a unique 64 bit asset ID which the game uses to load/reference
other assets. The asset names are not necessary for loading, however they are stored in the
“dag”/”dagstr” files.
The asset archives are in the “d” folder. A “toc” file is the root directory, which contains
information about the different assets in the game, in which archive they are stored, what their
version hash is, etc. Any changes/additions to assets need to be reflected in this file, in order for
it to be loaded in the game. (Game code can be patched to run it, if that is what you want to do)
The binaries themselves, you will find in the leak (Hint: Release folder). Important file needed to
run the game is the “pkg_settings.set” file, which is a simple text file and contains settings for
the engine and the game. This can be found in the PKG files, or can be constructed from the
source files.
Game needs to be launched with “-archive toc” command. Upon first launch, you will see the
game crashes with an error related to some mission code. With a debugger, you can skip past
these errors (for now), and you will see that the game does not launch, as it is trying to use
compiled shaders that are not in a format it expects. This is where you will need to do the first
bit of function hooking.
To understand everything, you should have all the source files, and be able to read through
them and understand what is happening.
Find the function Material::Initialize in Engine.dll, hook it and return the original function
with a nullptr for the data_file parameter. Do the same for MaterialTemplate::Initialize.
Finding this function may prove difficult, as the pdb for it won’t load correctly and a lot of the
functions will not be named. For this, you can use another Engine.dll (the one with i34.exe
works), and then crossreference the function from that dll to find the offset/binary pattern in
the i30 Engine.dll.
Hooking these functions will load the game in default shaders with default textures (white).
You will see that the game will now load (debugger still needs to be present, however you can
patch out that function as well if you don’t want to use a debugger every time), however,
collisions/physics will not work. This is because when compiling the collision data, Havok has an
ability to compile to a platform target, so it can load the data quicker and more efficiently.
Trying to use this data on a different platform with the same load method will cause errors, and
just not work.
Fortunately, Havok allows loading these files the usual slow way. There are multiple ways to go
about this. If you have the Havok SDK, look up Inplace Loading vs Normal Loading. You will need
to find the hkSerialize::inplaceLoad::toVar function also in Engine.dll. Hook the function,
and create a hkSerialize::Load object (it is 56 bytes, you can allocate that many bytes and call
the constructor). On that object, call hkSerialize::Load::toVar instead, and return the value
from that. Then delete the allocated bytes and call the destructor too.
You will also need to patch a few other game functions, namely FreePhysicsSystem and
FreeInPlacePhysicsData. Debugging will be required, as with anything.

These steps will allow you to launch and play with default white textures.
After you have the game running, making shaders/textures work is just a usual modding task,
similar to SM1 modding. You need to replace PS5 shader assets with PC shaders from Wolverine
build (/built/windows folder). Since not all of them work with SM2, you can either substitute
one wolverine shader for all of SM2 shaders, or make some individual replacements. To do this,
you need to add shader asset to archives, and modify TOC accordingly. If you only mod one or
several assets, this can even be done manually with hex editor, no need for any mod tools.
Or if you prefer that, you can do this with code. Modify hooked functions
(Material::Initialize, MaterialTemplate::Initialize) to load shaders/materials the way
you like it.
And then you will have the game working with textures.

You might also like