Hacking the SNES ROM

Discuss PoP1 for SNES here.
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: May 26th, 2018, 10:25 pm I found two matches on the hex-editor, one in between offsets 0025781 and 0025810, and the other on offset 0026100. ¿Both have to be modified or just one?
I think it's enough to change the first one.
The second occurrence handles the masking of these loose floors. You can change that as well, but I didn't notice any difference.
salvadorc17
Calif
Calif
Posts: 553
Joined: August 27th, 2011, 2:04 am

Re: Hacking the SNES ROM

Post by salvadorc17 »

Good finding here, there is a way to change those loose floor tiles to fall from above and not from below?
User avatar
Shauing
Calif
Calif
Posts: 432
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

David wrote: May 26th, 2018, 10:32 pm
Shauing wrote: May 26th, 2018, 10:25 pm I found two matches on the hex-editor, one in between offsets 0025781 and 0025810, and the other on offset 0026100. ¿Both have to be modified or just one?
I think it's enough to change the first one.
The second occurrence handles the masking of these loose floors. You can change that as well, but I didn't notice any difference.
Yeah, with just changing the first one does the job. If I change just the second one, it does nothing. Thank you! This really helps my mod in being more tricky and look good esthetically as it was bugging me somewhat the "broken-bridge/floor" aspect, though I think an entire room/level looking like that might not look that bad.

I have another question regarding flipped graphics. On the editor they appear as I intend, but in-game some of them do not flip and look wrong. Why does occur this?
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
User avatar
Shauing
Calif
Calif
Posts: 432
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

salvadorc17 wrote: May 26th, 2018, 11:01 pm Good finding here, there is a way to change those loose floor tiles to fall from above and not from below?
Something like this salvador? (click the image)
Loose Up.gif
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: May 26th, 2018, 11:44 pm I have another question regarding flipped graphics. On the editor they appear as I intend, but in-game some of them do not flip and look wrong. Why does occur this?
It seems that only the tiles of Layer 2 can't be flipped, the other layers work fine.
Layer 2 also ignores alternate palettes, as I wrote here: viewtopic.php?p=23713#p23713

Technical details:
Layer 2 is drawn differently from the other layers, because every block needs to overlap the adjacent block to the right.
So the game creates new tiles from the two overlapping blocks' tiles on the fly.
The code that creates these new tiles is not prepared for flipped tiles or alternate palettes, that's why those features won't work on Layer 2.
User avatar
Shauing
Calif
Calif
Posts: 432
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

David wrote: June 2nd, 2018, 12:26 pm
Shauing wrote: May 26th, 2018, 11:44 pm I have another question regarding flipped graphics. On the editor they appear as I intend, but in-game some of them do not flip and look wrong. Why does occur this?
It seems that only the tiles of Layer 2 can't be flipped, the other layers work fine.
Layer 2 also ignores alternate palettes, as I wrote here: viewtopic.php?p=23713#p23713

Technical details:
Layer 2 is drawn differently from the other layers, because every block needs to overlap the adjacent block to the right.
So the game creates new tiles from the two overlapping blocks' tiles on the fly.
The code that creates these new tiles is not prepared for flipped tiles or alternate palettes, that's why those features won't work on Layer 2.
Ouch, I see. I will have to keep that in mind when customizing tiles for Layer 2. Fortunately, I have only applied it on Layer 2 that one time.

There are some other weird-looking moments that happen while playing the mod, but I will write about them possibly in a few days when I will have more free time to do so.
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
salvadorc17
Calif
Calif
Posts: 553
Joined: August 27th, 2011, 2:04 am

Re: Hacking the SNES ROM

Post by salvadorc17 »

Shauing wrote: May 27th, 2018, 12:45 am
Something like this salvador? (click the image)
Yes something similar, thanks for it
User avatar
Shauing
Calif
Calif
Posts: 432
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

David wrote: May 26th, 2018, 9:20 pm
You need to hex-edit the rom for this.
Search: B9 80 E0 F0 06 4A
Replace: B9 80 E0 4A F0 05
Then any loose floor with modifier=1 will look like a regular floor.

Technical details:
Spoiler: show
Here is the relevant part of the disassembly:

Code: Select all

is loose:
00:E4D1: b9 80 e0    LDA $e080,Y ; current room modifiers (w=16,h=5)
00:E4D4: f0 06       BEQ $e4dc
00:E4D6: 4a          LSR
00:E4D7: 29 01       AND #$01
00:E4D9: 18          CLC
00:E4DA: 69 03       ADC #$03
00:E4DC: 4c 0d e6    JMP $e60d ; end of object
In the original code, BEQ jumps if the modifier is 0 (i.e. a regular loose floor that is not shaking).
My hack moves the LSR (bit-shift right) before BEQ, and thus BEQ will jump if (modifier>>1)==0, that is, the modifier is 0 or 1.
David, is it possible to make a loose tile that looks like normal floor to fall faster? Maybe via using another modifier? I can only get it to fall faster by putting a high number on the modifier (i.e. modifier=30), but the floor still looks broken.

I only intend to use this as a visual effect for a specific scene, that is why I wrote such a high number on the modifier, in order to not interfere with the loose tile animation and for the normal use of loose tiles in the game.
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: June 16th, 2018, 2:15 am David, is it possible to make a loose tile that looks like normal floor to fall faster? Maybe via using another modifier? I can only get it to fall faster by putting a high number on the modifier (i.e. modifier=30), but the floor still looks broken.
Here is how to make loose floors with both modifier=0x30 and 0x01 look like a regular floor.
Search: B9 80 E0 F0 06 4A (Same as for the other hack. If you already did the other hack then search for the numbers after "Replace" in the other hack.)
Replace: 20 00 FF 4A F0 05
Then go to 0x7F00 (if your ROM is headerless) or 0x8100 (if your ROM is headered). This area should have zeroes.
Write this there: B9 80 E0 C9 30 D0 02 A9 00 60 -- The 30 in the middle is the custom modifier you want to use. You can change it if you want.
User avatar
Shauing
Calif
Calif
Posts: 432
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

David wrote: June 16th, 2018, 10:28 am
Here is how to make loose floors with both modifier=0x30 and 0x01 look like a regular floor.
Search: B9 80 E0 F0 06 4A (Same as for the other hack. If you already did the other hack then search for the numbers after "Replace" in the other hack.)
Replace: 20 00 FF 4A F0 05
Then go to 0x7F00 (if your ROM is headerless) or 0x8100 (if your ROM is headered). This area should have zeroes.
Write this there: B9 80 E0 C9 30 D0 02 A9 00 60 -- The 30 in the middle is the custom modifier you want to use. You can change it if you want.
Forgot to thank you for this, it worked as I intended.

I have several things in mind that I want to apply (if possible) to my mod, so I figured out to ask you all at once (that I have my mind right now) instead of writing one per message/reply.

1. Change the time limit. I'm debating between 30, 45, 60,75 or 90 minutes; I need to test the time limits and decided which one would be balanced enough.

2. Change the story text on the intro and ending. My mod's story is somewhat different from the original, and the Jaffar scenes from the intro most likely will be omitted as he isn't really part of the story.

3. Change the training level texts (Training 1, 2, 3, 4, 5). I plan to make training levels about several mechanics that are important for this mod and I want to write on those boxes what the training level is about (i.e. ''Loose Tiles'').

4. Jump through mirrors, each one taking 1 HP of damage. I plan to do an entire level where mirrors are constantly used with said functionalities, but I cannot get it to work properly despite using the ''Hacks'' tab; maybe I am missing something, and I have been searching for information here but I have found nothing conclusive. The shadow most likely won't be in the game, but if I change my mind, he might appear and be fought on the same level.

5. Change some of the credits at the end. Probably this isn't going to be possible, but it is just to thank the people who had helped me with this mod.

EXTRA. Is it possible that for certain guards/bosses to utilize some of the Prince graphics? Mainly for those deaths by other types of traps where mostly/all of guards do not have those graphics (like when getting crushed), but also maybe to fight a clone of himself (maybe the Shadow with the Prince graphics).

For now, that's all I have in my mind. Sorry in advance if I am asking too much, but I really want to attempt to do at least one mod, and make it as good as I can with the patience, time and help that I can possibly get.
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: June 23rd, 2018, 11:10 am 2. Change the story text on the intro and ending.
5. Change some of the credits at the end.
These are probably the easiest: Texts are stored in the ROM as plain ASCII. (Well, except in the Japanese version.)
So you can edit them quite easily.
Shauing wrote: June 23rd, 2018, 11:10 am 4. Jump through mirrors, each one taking 1 HP of damage.
I made some attempts here: viewtopic.php?p=17603#p17603
Pr1SnesLevEd contains the last attempt (20 79 CF). I don't know why did I add it if it didn't work...
The second attempt (CE 08 05) is better. But I just can't get the prince to die if he lost the last HP.
User avatar
Shauing
Calif
Calif
Posts: 432
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

David wrote: June 23rd, 2018, 4:42 pm
Shauing wrote: June 23rd, 2018, 11:10 am 2. Change the story text on the intro and ending.
5. Change some of the credits at the end.
These are probably the easiest: Texts are stored in the ROM as plain ASCII. (Well, except in the Japanese version.)
So you can edit them quite easily.
Perhaps I am doing something wrong, but after I edited the text and saved it, the rom (a copy) became corrupted. Is there an specific ASCII text editor that I have to use?
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: Hacking the SNES ROM

Post by Norbert »

Shauing wrote: June 23rd, 2018, 5:47 pmPerhaps I am doing something wrong, but after I edited the text and saved it, the rom (a copy) became corrupted. Is there an specific ASCII text editor that I have to use?
You'll need to use a hex editor, such as wxHexEditor, and then edit the ASCII portion it displays (on the right, after opening the file).
User avatar
Shauing
Calif
Calif
Posts: 432
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

Norbert wrote: June 23rd, 2018, 5:54 pm
Shauing wrote: June 23rd, 2018, 5:47 pmPerhaps I am doing something wrong, but after I edited the text and saved it, the rom (a copy) became corrupted. Is there an specific ASCII text editor that I have to use?
You'll need to use a hex editor, such as wxHexEditor, and then edit the ASCII portion it displays (on the right, after opening the file).
Ah, I see. Is there a way to extend the text tab in that software in order to see what I am writing?

EDIT: I found it. Thank you for helping me!
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: Hacking the SNES ROM

Post by Norbert »

AAAARRRRrrrr!!!!
AAAARRRRrrrr!!!!
pirate.png (17.2 KiB) Viewed 2627 times
(Pirate head taken from this.)
David wrote: June 23rd, 2018, 4:42 pmTexts are stored in the ROM as plain ASCII.
Maybe this has already been discussed somewhere, but where are the "MINUTES LEFT" and "SECONDS LEFT" (and "THE END") texts?
Post Reply