The unofficial Guide to creating Merpmod based patchesIntroductionThere has been a lot of requests for MerpMod (MM) 32bit speed density mod to be ported over to an individuals’ vehicle where a patch has not yet been made, or alternatively there are others who are seeking information to carry out the porting themselves. I’ve taken some time while recovering from an accident (don’t worry, not in a car, I'm fine) to collect the information that could potentially guide you through this journey. The information consists of existing information available throughout the forums along with pointers from my own experiences.
Target AudienceThis documentation is simply intended for those who are looking to port their own versions of MM.
It assumes the reader has had previous experience or at least an understanding of the tuning process, particularly using ECUFlash, and understands the purpose of the modifications. It also assumes the reader has an understanding in the disassembly of ROMs, as this guide will not explain the disassembly process or the intricate uses of the software packages mentioned. Links to useful information will be provided for those wanting further reading.
This documentation
does not, however, guarantee that the reader will in fact successfully build and apply a patch and all steps will be carried out at the reader's own risk.
The information provided, as mentioned above, does contain personal advice and clarification or correction is more than welcome from others where appropriate.Software/Hardware requiredHEW -
viewtopic.php?f=25&t=7680IDA -
https://www.hex-rays.com/products/ida/Sharptune -
https://github.com/Merp/SharpTuneECUFlash -
https://www.tactrix.com/index.php?optio ... blog&id=36Initial setupFollow the installation process for IDA and HEW
Folder structureCreate a new folder that will house all your working files. This can be anywhere and called anything. Eg. “32bit Speed Density”
Create a new folder inside this and call it “MerpMod”. Download or clone the project files from your preferred flavour of MM (AijMod for this example)
Here. Place the project files in the folder you have just created.
Download SharpTune and place SharpTune.exe inside the same folder as above.
Go back to your top level and create a new folder called “SubaruDefs”
*. Download and place the ECUFlash and RomRaider definition folders inside the SubaruDefs folder. We will talk about which definitions later.
Go back to your top level and create a new folder called “SubaruRoms”
* inside this, create another folder called “OEM”
*. You will place the original image for the vehicle you are patching inside this folder. You can find most OEM ROMs here. This should also be in the
.bin format.
*These folders must be named as described.At this point your folder structure should look something like this.
Code:
32bit Speed Density
- MerpMod
SharpTune.exe
MerpMod.hws
- SubaruDefs <<---- Point Sharptune to this directory prior to building
- RomRaider
- EcuFlash
- SubaruRoms
- OEM
Locating required addressesOpen the MerpMod.hws file within your MerpMod folder.
In the HEW file explorer, open the header file that has all the known addresses needed for the patch. eg. A8DH202X.h
Open the header file that relates to your ROM.
Click
Window > Tile Vertically to have the windows sit side by side.
Work your way through the reference file copying the variables over to your own one by one, each time removing the address to make sure you don’t accidentally use it.
Open two instances of IDA, one with your OEM ROM and one matching the file you are using as reference above.
Using IDAGo through each address listed in the reference image and find the occurance in your own. Note down the new address in your .h file.
Building your first patchIn your MerpMod folder, run SharpTune.exe and point the definition location to the SubaruDefs folder holding both the RomRaider and ECUFlash definitions. You will need to make sure the definitions you are using match the version of MM you are trying to build.
In HEW, click
Setup > Customize > Placeholders.
Double click the TARGETROM placeholder and replace the CAL ID with yours. Click OK.
Depending on the version of MM you are building, you will need to set the build configuration to either Gratis, Flash or Switch. You can set this either using the dropdown menu near the top of your working windows, or by clicking
Build > Build Configurations and selecting your build under “Current Configuration”.
To determine what build you will be using, refer to the documentation.
You may need to update your .h file to reflect the build config you are using. This is normally the first #include and following #define’s.
Back in HEW, press F7 or
Build > Build to build your patch.
If the build process is successful, sharptune should open the donation page and then proceed to ask you which ecu defs and logger defs you wish to use. This will then create the new definitions.
A successful build should have applied the patch and removed the patch without error along with successfully creating the definitions.
If the definition process has errors but the patching process was successful, you can manually make the definitions later, however if you have any other errors or warnings present, you should go back through the logs and determine what these are. This guide will not provide advice as to how to correct any warnings or errors as it could be one of many things and should be checked thoroughly by yourself.
Applying your first patch
In your MerpMod folder, open
MerpMod > TestRom. Here you will find your built patch file for the last successful build you have completed. Copy the .patch file to your mod location that SharpTune is currently referencing.
Open SharpTune.exe, open your OEM ROM file and you should then see your patch under the “Mods” tab. Click your mod in particular and click the “Apply Mod” button. Again you should see no errors in the log window.
Opening your first patchIn ECUFlash set your metadata directory to the "ECUFlash" folder that is in your SubaruDefs folder. The build process should have created a new folder within standard called "MerpMod". Within that the folder named after the build config you used (gratis, flash, switch) inside the appropriate folder will be the definition for your new ROM that includes all the new tables. If this doesn’t exist, double check the build logs in HEW to see if the definitions were successfully created. Otherwise you may need to create the definition by hand, copying an existing definition and finding the locations once again for the new tables that were injected into the ROM.
Open your patched ROM in ECUFlash and if your definitions are set up correctly/the ROM is patched correctly you should receive a checksum error. Click “Yes” and then save.
At this point you will need to go through each table one by one and make sure all the values are displayed correctly and are present. If any look incorrect, your definitions are likely incorrect, or potentially you have the wrong addresses entered in your .h file prior to building.
Double check everything!If you are confident that everything looks right, you can begin adjusting the tables where necessary.
THESE NEW TABLES ARE NOT BASE TABLES AND MUST BE TUNED/CHECKED BEFORE USE!Testing your first patch**ATTENTION** At this point it’s all you! The above steps are all very important, however they are carried out in a safe environment where the undo button is readily available. The following steps could either result in a car with some extra features or a very expensive lawn ornament. If you do not feel comfortable with the changes you are making, if you are unsure as to what you are actually doing, or if you have received any errors or warnings along the way that you have ignored,
STOP NOW. Otherwise, this is the fun part...
When you are completely confident in the changes you have made. Use the test write feature to apply your patched ROM to your vehicle. If all looks correct, continue with the actual writing process. If you receive any errors, stop. If anything else goes wrong, you will need to deal with any issues accordingly.
If the write is successful you can set up your logger with the logger definitions that were created and monitor your changes.
From here on, it’s the same process as any other time, monitor, drive, log, make changes.
Changelog
30/1/21 - Corrections and clarifications to the use of SharpTunes definition directory selection
7/1/21 - Updated links to prerequisites. Corrections and clarifications to folder structure
9/2/20 - Initial Post
To Do: Attach pdf/doc version with screenshots
Add thank yous
Coffee