Hacking How do I patch a psx iso with a gameshark code?

Nikokaro

Lost philosopher... searching for a way out...
OP
Member
Joined
Feb 3, 2020
Messages
2,185
Trophies
1
Location
Nautilus (under) Lake Como, Italy 🇮🇹
XP
6,756
Country
Italy
Could someone explain to me how to patch a psx iso with a Game Shark cheat code so that the game will be permanently modified? I would then have to convert it to eboot to play it on my PSP, which as you know does not support cheat codes for psx eboots.
More specifically, I would like to play Mille Miglia, a racing game with vintage cars and circuits with beautiful Italian landscapes, but of an absurd and intolerable difficulty. It is literally impossible, even at the easy level: do you think I am exaggerating? Am I perhaps inept? Well, try it to believe me!
Those damn programmers must have forgotten to test it before releasing it.
This is coming from an expert in racing games, and psx GT/GT2 in particular. I would like to patch one of these cheat codes, mainly the one for super acceleration:
https://www.google.com/url?sa=t&sou...IQFnoECAcQAQ&usg=AOvVaw1AxLT-nlsWgMDuSe1TGKZp
Is anyone kind enough to help me, and make my dream of finally being able to enjoy this game come true? Thank you.
 

esmith13

Well-Known Member
Member
Joined
Aug 19, 2006
Messages
581
Trophies
1
Age
48
Location
South Jersey
XP
2,016
Country
United States
Game Shark codes edit the memory of an in-progress game. Modifying a PS1 ISO to in effect have that cheat built in would involve modifying the original game code to produce the wanted effect in the first place, whereas the Game Shark code just alters the data in memory. You would have to figure out what part of the game code relates to the memory space the code changes and then disassemble the code to change how it works and rebuild everything.

To put it bluntly, I would think if someone were capable of doing what you ask (it is possible to do, in general) they would have to have enough skills that they wouldn't have needed to ask how to do it. (I sure as hell don't the skills)

What I'm trying to say is, I don't believe it's something you can have a step-by-step written out for you about, without someone first actually doing it themselves to be able to list the specific steps. The concept may be the same for every game/cheat code combination but the full list of exact steps will differ from game to game and code to code.

Basically you question should really be: "Does anyone have the skills to do this for me and what would you want in return for doing the work?"

Not trying to rain on your parade, just trying to point you in the direction you need to be and help what little I can with your question.


Now, all that said, have you tried using the psp cheat code plugins? There are versions for both PSP and for PS1 on PSP games.
FOr PSP games you use: cwcheat.prx & cheat.db
For PS1 on PSP you use: cwcheatpops.prx & cheatpops.db

Maybe that will get you where you need to be if you haven't tried it already...
 
Last edited by esmith13,
  • Like
Reactions: Nikokaro

Nikokaro

Lost philosopher... searching for a way out...
OP
Member
Joined
Feb 3, 2020
Messages
2,185
Trophies
1
Location
Nautilus (under) Lake Como, Italy 🇮🇹
XP
6,756
Country
Italy
I didn't think it was so complicated!
Unfortunately, you can't even find save files for this title online, which is saying something (given the difficulty of this game).
I didn't know there was a cheat code plugin for PSP that worked with eboots. Do you happen to know where I can find that version? Thanks again.
 

esmith13

Well-Known Member
Member
Joined
Aug 19, 2006
Messages
581
Trophies
1
Age
48
Location
South Jersey
XP
2,016
Country
United States
  • Love
Reactions: Nikokaro

Nikokaro

Lost philosopher... searching for a way out...
OP
Member
Joined
Feb 3, 2020
Messages
2,185
Trophies
1
Location
Nautilus (under) Lake Como, Italy 🇮🇹
XP
6,756
Country
Italy
I already know that trying to figure out how this plugin works will give me a big headache. 😫 However, I'm hoping someone will suggest an easier solution, like applying an existing trainer patch that I missed, or provide me (in PM) with the link to the already modified iso (very unlikely and maybe illicit?). Anyway, I will try your way. I am in your debt, american buddy. 😉
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,348
Country
United Kingdom
To the best of my knowledge (which is about a year out of date as far as visiting fancy PS1 emulation/cheat making/ROM hacking places) then there is no such tool. There could be (if the GBA and DS have such things in GBAATM and DSATM among others, did see a proof of concept/way way way early N64 take as well a couple of years back, then it stands to reason the PS1 could) but no.

Your best bet outside of going manual ( https://gbatemp.net/threads/crackers-ds-trainer-maker-tutorial.44410/ is for the DS but the principles apply everywhere) is to hope the cheat tickles the binary inside the memory* and can convert accordingly. Acceleration cheat could well be that, certainly more likely than ye boring and basic infinite turbo/score/lowest clock/potions/mana/health/money type things, though I have not checked.
Annoyingly then acceleration, unless it is a parameter within the game**, is not amenable to some of the more basic tweaks -- for infinite lives then finding what does a subtract to the lives counter and changing it to an add can often be a way to achieve a hardpatched cheat. Instead you are probably going to want to find speed or acceleration and tweak that into something else, which potentially also troubles other aspects, and it might well go better if you understand what its calculation is where the basic infinite blah does not necessarily need that.

*2X CD read speed even without having to seek is hideously slow, to that end most things based on something that is not a cartridge (pre DS anyway) will copy the binary to memory and run it from that. Accordingly this opens up the binary to be fiddled with.

**do find where the cheat aims for in memory during runtime ( https://doc.kodewerx.org/hacking_psx.html http://problemkaputt.de/psx-spx.htm#cheatdevices if you need a hand decoding PS1 cheats), copy that data (obviously don't have the cheat active or a savestate from it loaded) and search the ROM for it -- if you can edit the vehicle stats to have crazy acceleration then that is another path.
 
  • Like
  • Wow
Reactions: swosho and Nikokaro

Nikokaro

Lost philosopher... searching for a way out...
OP
Member
Joined
Feb 3, 2020
Messages
2,185
Trophies
1
Location
Nautilus (under) Lake Como, Italy 🇮🇹
XP
6,756
Country
Italy
@FAST6191 , thank you for your intervention and thorough response, but I am afraid you demand too much from a poor clueless person like me. 😒I thought everything was much more simple and straightforward, accessible to a layman, technically illiterate, like yours truly (often a victim of headaches from excessive technicalities 😅).
Perhaps someone, seized with pity and compassion, will provide me with a ready-made trainer patch on a silver plate, sparing me unnecessary suffering. 😋
 

vstar950

Well-Known Member
Member
Joined
Jun 28, 2018
Messages
273
Trophies
0
Age
123
XP
1,118
Country
United States
I will look around. I have found some tools online that patch gameshark codes into game roms. I know there is one for Nintendo 64 but that is more work than what I would like to do. I think there's also one for PlayStation and for the other consoles as well.
 

SylverReZ

The planet is fine. The people are crazy.
Member
GBAtemp Patron
Joined
Sep 13, 2022
Messages
7,220
Trophies
3
Location
The Wired
Website
m4x1mumrez87.neocities.org
XP
22,113
Country
United Kingdom
It's super easy. Load up the game executable in "IDA" (since IDA has PS1 executable support), locate the address of the cheat code then change the bytes at that location - make sure it is reversed/inverted since the PS1 is little endian. Then, you can use "CDmage" to replace the executable with the modifed one in your CD image.
Post automatically merged:

Creating cheat codes also isn't that difficult at all. You can use an emulator such as "BizHawk" or "DuckStation" as those have a built-in memory scanner.
 
Last edited by SylverReZ,
  • Like
Reactions: swosho and Nikokaro

master801

Well-Known Member
Member
Joined
Feb 24, 2011
Messages
1,135
Trophies
1
XP
2,481
Country
United States
This will help you decipher (PlayStation) GameShark codes: https://gamehacking.org/faqs/hackv500c.html#playstation_code_types

Supercharger-Boost (Press X & Up) D01F4CB8 00001040 801F4598 00000190 D01F4CB8 00001040 801F4E28 000009CA
Decoding the GameShark code, I can see it doing a few things.

Address 0x1F4CB8 returns a 16-bit (2 bytes) value where something (not exactly sure what - maybe PS1 native address?) returns the currently held controls. Basically when d-pad up and X is pressed (and held), it'll return 0x1040 - a combination of the 2 inputs.

Then address 0x801F4598 is a 16-bit (2 bytes) something-value relating to vehicle speed (maybe acceleration??), and is set to 0x0190 when 0x1F4CB8 is 0x1040.

Address 0x801F4E28 is another 16-bit (2 bytes) something-value relating to vehicle speed (????) again, and is set to 0x09CA when 0x1F4CB8 is 0x1040.

I'm not entirely sure how GameShark works, but according to DuckStation, the code activates every frame end.

Funnily enough, when sitting at the starting line before the race starts, the boost can be used and you'll be boosted hitting the walls and eventually go out of bounds.

From my short play test, one of the biggest issues with this GameShark code seems to be how it never properly decelerates unless the player (vehicle) hits a wall.

I recommend using this modding toolchain to create a trainer, since it seems to just inject code. https://github.com/mateusfavarin/psx-modding-toolchain
 

Unicorngoulash

New Member
Newbie
Joined
Oct 7, 2022
Messages
1
Trophies
0
Age
32
Location
Lalaland
XP
20
Country
Netherlands
Thanks to everyone who gave me suggestions about this, but in the end I resorted to the simplest and most convenient solution of using CWCHEAT on PSP for PSX eboots as well.
The codes need to be of the assembly kind and will most likely be stored on the PSX.EXE or SLUS/SLES/SLPM file which are pretty much the same. Then when you have the assembly code you open that file in HxD and calculate the Gameshark code and subtract 800F8000 to find the byte array

Lets say the code is
80051234 0003
80051236 2402

80051234 - 8000F800 = 41A34

Code on SLUS
Address: 0x41A34 = 02 24 03 00

However if it is not on the SLUS/PSX.EXE it could be on individual files that usually temporarily store it on the stack 801XXXXX

Lets say you have a code like this stored on a bin
8015FFFF 0001

You open the bin and most of the time it is in the location that is stated without the 801 so 5FFFF
0x5FFFF = 00 01

Most assembly codes are stored as 4 bytes but broken up into 2 bytes using gameshark codes so that is something to take note of
The important thing is extracting the files using something like CdMage and also use it to rebuild the disc image with in order to not corrupt it. In most cases editing the disc image directly will work, however this is not the right way as any accurate emulator like Mednafen for example will try to correct the disc image if it was not edited correctly
 
Last edited by Unicorngoulash,
  • Wow
Reactions: Nikokaro

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Xdqwerty @ Xdqwerty:
    Although tomorrow is Labor Day which means I won't go to class which means I'll sleep well.
  • BakerMan @ BakerMan:
    is labor day different in venezuela than in america, or did time skip that far?
  • K3Nv2 @ K3Nv2:
    It must be the 1st already
  • BakerMan @ BakerMan:
    1st of what?
  • BakerMan @ BakerMan:
    may?
  • K3Nv2 @ K3Nv2:
    Oh yeah it's in September
  • Xdqwerty @ Xdqwerty:
    @BakerMan, yea i think its different
  • BakerMan @ BakerMan:
    ok, because here it's in september, right before the fuckin school year starts
  • Xdqwerty @ Xdqwerty:
    good night
  • BakerMan @ BakerMan:
    as to you
  • K3Nv2 @ K3Nv2:
    How do you know if the night will be good when you're asleep
  • BakerMan @ BakerMan:
    because i didn't say i was asleep
  • BakerMan @ BakerMan:
    i said i was sleeping...
  • BakerMan @ BakerMan:
    sleeping with uremum
  • K3Nv2 @ K3Nv2:
    Even my mum slept on that uremum
  • TwoSpikedHands @ TwoSpikedHands:
    yall im torn... ive been hacking away at tales of phantasia GBA (the USA version) and have so many documents of reverse engineering i've done
  • TwoSpikedHands @ TwoSpikedHands:
    I just found out that the EU version is better in literally every way, better sound quality, better lighting, and there's even a patch someone made to make the text look nicer
  • TwoSpikedHands @ TwoSpikedHands:
    Do I restart now using what i've learned on the EU version since it's a better overall experience? or do I continue with the US version since that is what ive been using, and if someone decides to play my hack, it would most likely be that version?
  • Sicklyboy @ Sicklyboy:
    @TwoSpikedHands, I'll preface this with the fact that I know nothing about the game, but, I think it depends on what your goals are. Are you trying to make a definitive version of the game? You may want to refocus your efforts on the EU version then. Or, are you trying to make a better US version? In which case, the only way to make a better US version is to keep on plugging away at that one ;)
  • Sicklyboy @ Sicklyboy:
    I'm not familiar with the technicalities of the differences between the two versions, but I'm wondering if at least some of those differences are things that you could port over to the US version in your patch without having to include copyrighted assets from the EU version
  • TwoSpikedHands @ TwoSpikedHands:
    @Sicklyboy I am wanting to fully change the game and bend it to my will lol. I would like to eventually have the ability to add more characters, enemies, even have a completely different story if i wanted. I already have the ability to change the tilemaps in the US version, so I can basically make my own map and warp to it in game - so I'm pretty far into it!
    TwoSpikedHands @ TwoSpikedHands: @Sicklyboy I am wanting to fully change the game and bend it to my will lol. I would like to...