Assign Custom Materials to objects without additional materials in Sonic Heroes
From Sonic Retro
Revision as of 08:46, 21 July 2017 by Crazy Muzzarino (talk | contribs)
SCHG: Sonic Heroes |
---|
Main Article |
Mechanic Editing |
DOL Editing |
Model Editing |
Collision Format Model Format |
Level Editing |
Camera Editing |
Particle Editing |
Particle Editing |
Sound Editing |
Music List |
SCHG How-Tos |
Custom Object Material Effect Tutorial |
(Original guide by Muzzarino)
This will teach you how to create injectable assembler codes using Cheat Engine to provide custom materials for an object without additional material parameters that manipulate the appearance to the object(s) operated in their functions in the executable.
Contents
Things you'll need
1. Cheat Engine 2. Sonic Heroes executable
Setting up and using Cheat Engine
You will need to download and install CE from the official Cheat Engine website, then launch it and and attach "Tsonic_win.exe" to the process.
Codes and Operations
Once you have the executable attached to Cheat Engine, open up the memory viewer by clicking on "Memory view", go to beginning RAM address at "00400000", click and hover over the search tab and click on "Find assembley code", type in the call address of "66B4F0" and then click scan. A number of results will be brought up in the assembly scan list, so if you encounter an object that uses this, then place a breakpoint on it. Make sure the function does not have materials in the function or doesn't use it but has them for other sets of the object. If the breakpoint freezes the code, then it should be the object using it. Also, place a nop on it to make sure it disappears and then restore the code to make the model come back to check if it is the correct object to place custom materials onto.
Applying Materials
If you have found an object function without materials (especially the codes with colors applied to them), highlight this opcode "call Tsonic_win.exe+26B4F0" and go to Auto Assembler in the tools menu.
Under the template menu, use the "full injection" assembler template type and then click OK, but do not change the jump address in the box.
Under code, place a material parameter, the type of it and then place the call address function of "Tsonic_win.exe+24C9B0". If a certain material such as blend equation or alpha testing functions cannot be achieved with that address to call, then use "call Tsonic_win.exe+247980" instead.
Custom materials should be placed above call Tsonic_win.exe+26B4F0 and the default materials should be below it. If you add one material, you will need to add an add esp opcode before the model appearance address call and after the end of the code injection otherwise the game will crash. If there is more than one material function in place, you will need calculate how many custom and default material functions then add by 08. Each material function set are three codes which one is the parameter, the type and the call address which works this way:
push materialparamnumber push materialtype call materialfunctionaddress
Examples of how the injectable material operation should be made to work properly:
One custom material:
push 02 push 0B call Tsonic_win.exe+24C9B0 add esp,08 call Tsonic_win.exe+26B4F0 push 06 push 0B call Tsonic_win.exe+24C9B0 add esp,08
Two custom materials:
push 02 push 0A call Tsonic_win.exe+24C9B0 push 02 push 0B call Tsonic_win.exe+24C9B0 add esp,10 call Tsonic_win.exe+26B4F0 push 05 push 0A call Tsonic_win.exe+24C9B0 push 06 push 0B call Tsonic_win.exe+24C9B0 add esp,10
Three custom materials:
push 02 push 0A call Tsonic_win.exe+24C9B0 push 02 push 0B call Tsonic_win.exe+24C9B0 push 01 push 14 call Tsonic_win.exe+24C9B0 add esp,18 call Tsonic_win.exe+26B4F0 push 05 push 0A call Tsonic_win.exe+24C9B0 push 06 push 0B call Tsonic_win.exe+24C9B0 push 02 push 14 call Tsonic_win.exe+24C9B0 add esp,18
If you want to preview it, click and hover the "File" tab, assign it to the cheat engine table and then put an X next to the the auto assembler script on the list. You should see changes like this when done properly:
You can always edit the script by double clicking the <script> text next to the item. If you need to make it easier to recognize which object you applied the injection script at, you can rename "Auto Assembler Script" to a name you can easily get to next time.