Hacking the SNES ROM

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

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: June 13th, 2020, 3:14 am Nice, and interesting; it makes me wonder also why the Shadow is a regular guard for that specific event in the SNES version?
Maybe because it was possible to place him there using this way?

I mean two things:

1. He doesn't come from offscreen or a mirror, as on levels 5, 7, 15; or like Jaffar on levels 13 and 15.
He starts at a location within the room, like the regular guards, so the he can be placed using the same method.

2. In the SNES version, any type of guard can be placed on any level.
So it's possible to place a Shadow in addition the fat guard and the two regular guards on level 9.
In contrast, in the DOS version, regular guards can have only a single type per level, and only their colors can be varied.
And even if the guard type is set to Shadow, regularly placed guards will look like the prince and not the Shadow.

By the way, in the SNES version, the level 3 skeleton is also placed in the room as a regular guard.

Shauing wrote: June 13th, 2020, 3:14 am How can I make passwords invalid if time is above 90 minutes? I think the hack you gave me for the 30th port invalidates passwords when time is above 60 minutes.
Yes, that hack is here: viewtopic.php?p=27112#p27112 (bottom of the post)
I've briefly mentioned there which part determines the maximum allowed time, though maybe it was hard to understand.

At 0x15A79 write: 4C D0 FF
At 0x17FD0 write: 20 14 DB C2 20 AD 60 0E C9 xx xx E2 20 90 03 4C 7C DA 4C 9D DA

Where xx xx is: (120-minutes)*425, converted into hex, and the two bytes swapped.
For 90 minutes it's: (120-90)*425 = 12750 = 0x31CE, so those two bytes should be CE 31.

This is the same number you need to calculate for the hack which changes the starting time.

Details:

Code: Select all

At 0x15A79 (02:DA79) write:
4C D0 FF  JMP $FFD0

At 0x17FD0 (02:FFD0) write:
20 14 DB  JSR $DB14 ; read time from password
C2 20     REP #$20 ; 16-bit acc
AD 60 0E  LDA $0E60
C9 xx xx  CMP #$xxxx ; =(120-minutes)*425
E2 20     SEP #$20 ; 8-bit acc
90 03     BCC :invalid
4C 7C DA  JMP $DA7C
          :invalid
4C 9D DA  JMP $DA9D
User avatar
Shauing
Calif
Calif
Posts: 431
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

Spoiler: show
David wrote: June 13th, 2020, 5:42 pm
Maybe because it was possible to place him there using this way?

I mean two things:

1. He doesn't come from offscreen or a mirror, as on levels 5, 7, 15; or like Jaffar on levels 13 and 15.
He starts at a location within the room, like the regular guards, so the he can be placed using the same method.

2. In the SNES version, any type of guard can be placed on any level.
So it's possible to place a Shadow in addition the fat guard and the two regular guards on level 9.
In contrast, in the DOS version, regular guards can have only a single type per level, and only their colors can be varied.
And even if the guard type is set to Shadow, regularly placed guards will look like the prince and not the Shadow.

By the way, in the SNES version, the level 3 skeleton is also placed in the room as a regular guard.
Yeah, I think it makes some sense. That's also why the special color value goes unused on SNES?
You're right, skeleton is also a guard.
Spoiler: show
David wrote: June 13th, 2020, 5:42 pm
Shauing wrote: June 13th, 2020, 3:14 am How can I make passwords invalid if time is above 90 minutes? I think the hack you gave me for the 30th port invalidates passwords when time is above 60 minutes.
Yes, that hack is here: viewtopic.php?p=27112#p27112 (bottom of the post)
I've briefly mentioned there which part determines the maximum allowed time, though maybe it was hard to understand.

At 0x15A79 write: 4C D0 FF
At 0x17FD0 write: 20 14 DB C2 20 AD 60 0E C9 xx xx E2 20 90 03 4C 7C DA 4C 9D DA

Where xx xx is: (120-minutes)*425, converted into hex, and the two bytes swapped.
For 90 minutes it's: (120-90)*425 = 12750 = 0x31CE, so those two bytes should be CE 31.

This is the same number you need to calculate for the hack which changes the starting time.

Details:

Code: Select all

At 0x15A79 (02:DA79) write:
4C D0 FF  JMP $FFD0

At 0x17FD0 (02:FFD0) write:
20 14 DB  JSR $DB14 ; read time from password
C2 20     REP #$20 ; 16-bit acc
AD 60 0E  LDA $0E60
C9 xx xx  CMP #$xxxx ; =(120-minutes)*425
E2 20     SEP #$20 ; 8-bit acc
90 03     BCC :invalid
4C 7C DA  JMP $DA7C
          :invalid
4C 9D DA  JMP $DA9D
This didn't work. Even as earlier as beating Level 1 in one second gives an invalid password.
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: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: June 3rd, 2020, 5:25 am 5. On DOS, the level end door of Level 13 opens when the Prince goes back to the room where said door is located after killing Jaffar; it does not open when Jaffar is killed.
In the DOS version, the game doesn't check the room: The exit opens if you enter *any* room from the right (after Jaffar died).
This first version of hack recreates this, the second version checks the room.

Without checking the room number:
At 0x8291 write: 20 20 FD
At 0xFD20 write: AD 79 05 C9 0C D0 0E AD C1 04 F0 09 A9 06 A2 02 A0 0D 4C 2B AE 60

With checking the room number:
At 0x8291 write: 20 20 FD
At 0xFD20 write: AD 79 05 C9 0C D0 15 AD 06 05 C9 07 D0 0E AD C1 04 F0 09 A9 06 A2 02 A0 0D 4C 2B AE 60

Don't forget to disable the guard trigger for Jaffar in the hacks window as well.

Details:

Code: Select all

Without checking the room number:

At 0x8291 write:
20 20 FD  JSR $FD20

At 0xFD20 write:
AD 79 05  LDA $0579 ; current level
C9 0C     CMP #$0C ; level 13
D0 0E     BNE :1
AD C1 04  LDA $04C1 ; exit open / special event flag
F0 09     BEQ :1
A9 06     LDA #$06 ; room 6
A2 02     LDX #$02 ; permanent open
A0 0D     LDY #$0D ; tile 13
4C 2B AE  JMP $AE2B ; open door, A=room, X=type, Y=pos
          :1
60        RTS

With checking the room number:

At 0x8291 write:
20 20 FD  JSR $FD20

At 0xFD20 write:
AD 79 05  LDA $0579 ; current level
C9 0C     CMP #$0C ; level 13
D0 15     BNE :1
AD 06 05  LDA $0506 ; shown room ; VisScrn
C9 07     CMP #$07 ; room 7 (which you're leaving)
D0 0E     BNE :1
AD C1 04  LDA $04C1 ; exit open / special event flag
F0 09     BEQ :1
A9 06     LDA #$06 ; room 6
A2 02     LDX #$02 ; permanent open
A0 0D     LDY #$0D ; tile 13
4C 2B AE  JMP $AE2B ; open door, A=room, X=type, Y=pos
          :1
60        RTS
Shauing wrote: June 3rd, 2020, 5:25 am 6. When the Prince or the guard dies on the demo level, the DOS version doesn't play music.
In the mod it's played; and, if the prince died, the music is even interrupted.
Part 1: Play no music if the prince dies on the demo level:
At 0xF367 write: 20 10 FD
At 0xFD10 write: AD 79 05 C9 15 F0 03 20 2F F4 60

Part 2: Play no music if the guard dies on the demo level:
At 0xE1A0 write: 20 00 FD EA EA
At 0xFD00 write: AD 84 04 C9 01 F0 05 AD 79 05 C9 15 60

Details:

Code: Select all

Part 1: Play no music if the prince dies on the demo level:

At 0xF367 write:
20 10 FD  JSR $FD10

At 0xFD10 write:
AD 79 05  LDA $0579 ; current level
C9 15     CMP #$15 ; demo level
F0 03     BEQ :1
20 2F F4  JSR $F42F ; death music ; deathsong
          :1
60        RTS

Part 2: Play no music if the guard dies on the demo level:

At 0xE1A0 write:
20 00 FD  JSR $FD00
EA        NOP
EA        NOP

At 0xFD00 write:
AD 84 04  LDA $0484 ; Shad.chtype ; ShadID
C9 01     CMP #$01
F0 05     BEQ :1
AD 79 05  LDA $0579 ; current level
C9 15     CMP #$15 ; demo level
          :1
60        RTS
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: June 13th, 2020, 8:13 pm This didn't work. Even as earlier as beating Level 1 in one second gives an invalid password.
What is the password you got?
I'd like to see what does the SNES Password Analyser show for Elapsed time.

And this question might be silly, but did you change the starting time to 90 minutes as well in the same ROM?
User avatar
Shauing
Calif
Calif
Posts: 431
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

David wrote: June 14th, 2020, 7:38 pm
Shauing wrote: June 13th, 2020, 8:13 pm This didn't work. Even as earlier as beating Level 1 in one second gives an invalid password.
What is the password you got?
I'd like to see what does the SNES Password Analyser show for Elapsed time.

And this question might be silly, but did you change the starting time to 90 minutes as well in the same ROM?
ICEUAQE.
Remember that the password letters and letters ordering have been changed.
And yes, I did. You can check the rom from the links or PoPOT.org to check the alphabet and letters order.
NOTE: On the rom, although the hack is there (with the wrong timing as it didn't work anyway), it is not activated.
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: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: June 14th, 2020, 7:52 pm ICEUAQE.
Remember that the password letters and letters ordering have been changed.
And yes, I did. You can check the rom from the links or PoPOT.org to check the alphabet and letters order.
NOTE: On the rom, although the hack is there (with the wrong timing as it didn't work anyway), it is not activated.
Ah, now I know what's the problem!
In The Queen Of Light you used this older hack to change the amount starting time, not this newer one.

With the older hack, the elapsed time counter still starts from 0.
This means that:
1. The elapsed time counter reaches 12750 (which is the number in the non-working hack) when 90-30=60 minutes are left, not when 120-30=90 minutes are left.
2. It's not even possible to make a password (for this mod) with more than 90 minutes left.
Therefore you don't need to make such passwords invalid.

Sorry about the confusion.
For some reason I was not testing on The Queen Of Light, but on a minimally modified original ROM, to which I applied the newer starting time hack.
User avatar
Shauing
Calif
Calif
Posts: 431
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

David wrote: June 14th, 2020, 9:16 pm
Ah, now I know what's the problem!
In The Queen Of Light you used this older hack to change the amount starting time, not this newer one.

With the older hack, the elapsed time counter still starts from 0.
This means that:
1. The elapsed time counter reaches 12750 (which is the number in the non-working hack) when 90-30=60 minutes are left, not when 120-30=90 minutes are left.
2. It's not even possible to make a password (for this mod) with more than 90 minutes left.
Therefore you don't need to make such passwords invalid.

Sorry about the confusion.
For some reason I was not testing on The Queen Of Light, but on a minimally modified original ROM, to which I applied the newer starting time hack.
Ah, that explains it. Still, the password given when you die but before restarting the level is still accessible; it sends you to Level 20 with your current health. That's why I wanted to make the passwords when time is bigger than 90 minutes invalid.

Adding a small hack for the 30th along the other three remaining: On DOS, the level end music starts when the Prince starts going up the stairs, but on SNES it starts after the animation and sound steps are over. Can this be changed?

Any findings on the hacks for the third mod?
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
realXCV
Beylerbey
Beylerbey
Posts: 72
Joined: November 4th, 2011, 12:04 am
Location: Right here
Contact:

Re: Hacking the SNES ROM

Post by realXCV »

Shauing wrote: June 19th, 2020, 11:36 pm Adding a small hack for the 30th along the other three remaining: On DOS, the level end music starts when the Prince starts going up the stairs, but on SNES it starts after the animation and sound steps are over. Can this be changed?
Most of the ports including the original Apple II version also play the end level music after the animation is done.

It could be possible to change it by altering the function that emits the footsteps sounds (starts at 01:966B) but then you also would have to check the existing animations to be sure you don't trigger the end level music too soon while doing things like running or jumping.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: June 19th, 2020, 11:36 pm On DOS, the level end music starts when the Prince starts going up the stairs, but on SNES it starts after the animation and sound steps are over. Can this be changed?
Use level ending music instead of one of the footsteps in the "gone upstairs" sequence:
At 0x1749B write: F1 F6
If this is too early, you can use one of these later offsets instead: 0x174A1, 0x174A8, 0x174B0.

Remove the level ending music from its original place in the "gone upstairs" sequence:
At 0x174CB write: F6

Don't stop the prince while the level ending music is playing:
At 0xFF96 write: A2 00
(This changes part of an earlier hack.)
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: June 13th, 2020, 3:14 am - Change ''Level xx'' to a level name like I did on the ''Training Levels'' for The Queen Of Light but for all 27 levels (this includes Jaffar, Demo and Training Levels)
(I tried to do this myself, but the hack is slightly longer so it would lead to crashes or softlocks at the menu if quitting the game before the level prompt disappears and only works for Levels 1-20).
I tried to make a hack for this, but I ran into the same crash problem as you!

Then I got the idea to see what happens in the original game if I end the game while the level number is shown.
The game displays "LEVEL I5" for a brief moment before the screen goes dark!

So it seems the game tries to show an invalid level number in that moment.
My solution is to check if the level number falls into the 0..26 range.

Another thing I changed, compared to the original hack which gives names to Training levels, is the possible offsets of level names.
The original hack takes the names from bank 01, the 0x08000..0x0FFFF range, in which 0x0FA60..0x0FFFF (1440 bytes) are empty.
If we put names for 27 levels (32*27=864 bytes) there, then I think that too little space is left for other hacks you might want to use.
So this hack takes names from bank 03, the 0x18000..0x1FFFF range, in which 0x1C5C0..0x1FFFF (14912 bytes) are empty.

Here is the hack:
At 0xCA3B write: AD 79 05 C9 1B 90 01 60 A9 01 8D 93 05 8B A9 03 48 AB AD 79 05 08 C2 20 29 FF 00 0A 0A 0A 0A 0A 69 xx xx 48 F4 56 08 20 A0 CB 68 68 28 AB AD 56 08 D0 01 60 4C 36 CB
Where "xx xx" is the offset of the first level name within 0x1C5C0..0x1FFFF (without the leading 1 of course, and byte-swapped).
The names of the levels have to be 32 (0x20) bytes from each other, as in the original hack.
So if you start the name of level 1 at 0x1C5C0, then the name of level 2 should start at 0x1C5E0, and so on.

Details:

Code: Select all

At 0xCA3B write:
AD 79 05  LDA $0579 ; current level
C9 1B     CMP #$1B ; 27
90 01     BCC :ok ; level < 27 is ok
60        RTS
         :ok
A9 01     LDA #$01
8D 93 05  STA $0593 ; status text row
8B        PHB ; save data bank
A9 03     LDA #$03 ; bank of level names table
48        PHA
AB        PLB ; set data bank to 03
AD 79 05  LDA $0579 ; current level
08        PHP
C2 20     REP #$20 ; 16-bit accumulator
29 FF 00  AND #$00FF
0A        ASL ;*2
0A        ASL ;*4
0A        ASL ;*8
0A        ASL ;*16
0A        ASL ;*32 ; level names must be 32 bytes apart
69 ?? ??  ADC #$???? ; address of level names table
48        PHA
F4 56 08  PEA $0856 ; buffer for strings
20 A0 CB  JSR $CBA0 ; copy zero-terminated string (strcpy)
68        PLA
68        PLA
28        PLP ; restore accumulator size
AB        PLB ; restore data bank
AD 56 08  LDA $0856 ; check if the name is not empty
D0 01     BNE :ok2 ; if it is empty then don't show anything, because displaying an empty text crashes the game
60        RTS
         :ok2
4C 36 CB  JMP $CB36 ; show status text
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

I have already sent the following hack to Shauing in PM.
He wrote I can post it in the forum as well, so now it's available for everyone.

This hack fixes the various glitches which may occur when you select "END GAME".

First, about why the glitch happens.
If you choose "END GAME", the game just sets a special value which means the game should return to the menu.
(Specifically, it writes #$FE to RAM address $0579, which usually stores the number of the current level.)
After this, the game still draws the sprites and other things, and only then does it check if it needs to return to the menu.

My solution is this: Check for the special value right after the menu was closed, and if it's there then skip everything and return straight to the main menu.

At 0xEEE3 write: 20 B0 FD (Maybe write the same at 0xEF35 and 0xEF3E too?)
At 0xFDB0 write: 20 45 BE AD 79 05 C9 FE F0 01 60 68 68 60

Disassembly of the new code (and some of the existing code):

Code: Select all

At 0xEEE3 write:
20 B0 FD  JSR $FDB0
(Maybe at 0xEF35 and 0xEF3E too?)

We overwrite this code:
01:EEE3: 20 45 be    JSR $be45 ; check paused and menu
and optionally these:
01:EF35: 20 45 be    JSR $be45 ; check paused and menu
01:EF3E: 20 45 be    JSR $be45 ; check paused and menu

At 0xFDB0 write:
20 45 BE  JSR $BE45 ; check paused and menu
AD 79 05  LDA $0579 ; current level
C9 FE     CMP #$FE ; special value indicating the we should return to the menu
F0 01     BEQ :1
60        RTS ; if it's not there: return normally
          :1 ; if it's there:
68        PLA ; pop return address off the stack (2 bytes)
68        PLA
60        RTS ; return to where the caller would return at 01:EF55

"GAME END" does this:
00:901C: a9 fe       LDA #$fe
00:901E: 8d 79 05    STA $0579 ; current level
00:9021: 60          RTS
User avatar
Shauing
Calif
Calif
Posts: 431
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

Spoiler: show
David wrote: June 20th, 2020, 3:29 pm
Shauing wrote: June 19th, 2020, 11:36 pm On DOS, the level end music starts when the Prince starts going up the stairs, but on SNES it starts after the animation and sound steps are over. Can this be changed?
Use level ending music instead of one of the footsteps in the "gone upstairs" sequence:
At 0x1749B write: F1 F6
If this is too early, you can use one of these later offsets instead: 0x174A1, 0x174A8, 0x174B0.

Remove the level ending music from its original place in the "gone upstairs" sequence:
At 0x174CB write: F6

Don't stop the prince while the level ending music is playing:
At 0xFF96 write: A2 00
(This changes part of an earlier hack.)
Spoiler: show
David wrote: June 21st, 2020, 12:23 pm
Shauing wrote: June 13th, 2020, 3:14 am - Change ''Level xx'' to a level name like I did on the ''Training Levels'' for The Queen Of Light but for all 27 levels (this includes Jaffar, Demo and Training Levels)
(I tried to do this myself, but the hack is slightly longer so it would lead to crashes or softlocks at the menu if quitting the game before the level prompt disappears and only works for Levels 1-20).
I tried to make a hack for this, but I ran into the same crash problem as you!

Then I got the idea to see what happens in the original game if I end the game while the level number is shown.
The game displays "LEVEL I5" for a brief moment before the screen goes dark!

So it seems the game tries to show an invalid level number in that moment.
My solution is to check if the level number falls into the 0..26 range.

Another thing I changed, compared to the original hack which gives names to Training levels, is the possible offsets of level names.
The original hack takes the names from bank 01, the 0x08000..0x0FFFF range, in which 0x0FA60..0x0FFFF (1440 bytes) are empty.
If we put names for 27 levels (32*27=864 bytes) there, then I think that too little space is left for other hacks you might want to use.
So this hack takes names from bank 03, the 0x18000..0x1FFFF range, in which 0x1C5C0..0x1FFFF (14912 bytes) are empty.

Here is the hack:
At 0xCA3B write: AD 79 05 C9 1B 90 01 60 A9 01 8D 93 05 8B A9 03 48 AB AD 79 05 08 C2 20 29 FF 00 0A 0A 0A 0A 0A 69 xx xx 48 F4 56 08 20 A0 CB 68 68 28 AB AD 56 08 D0 01 60 4C 36 CB
Where "xx xx" is the offset of the first level name within 0x1C5C0..0x1FFFF (without the leading 1 of course, and byte-swapped).
The names of the levels have to be 32 (0x20) bytes from each other, as in the original hack.
So if you start the name of level 1 at 0x1C5C0, then the name of level 2 should start at 0x1C5E0, and so on.

Details:

Code: Select all

At 0xCA3B write:
AD 79 05  LDA $0579 ; current level
C9 1B     CMP #$1B ; 27
90 01     BCC :ok ; level < 27 is ok
60        RTS
         :ok
A9 01     LDA #$01
8D 93 05  STA $0593 ; status text row
8B        PHB ; save data bank
A9 03     LDA #$03 ; bank of level names table
48        PHA
AB        PLB ; set data bank to 03
AD 79 05  LDA $0579 ; current level
08        PHP
C2 20     REP #$20 ; 16-bit accumulator
29 FF 00  AND #$00FF
0A        ASL ;*2
0A        ASL ;*4
0A        ASL ;*8
0A        ASL ;*16
0A        ASL ;*32 ; level names must be 32 bytes apart
69 ?? ??  ADC #$???? ; address of level names table
48        PHA
F4 56 08  PEA $0856 ; buffer for strings
20 A0 CB  JSR $CBA0 ; copy zero-terminated string (strcpy)
68        PLA
68        PLA
28        PLP ; restore accumulator size
AB        PLB ; restore data bank
AD 56 08  LDA $0856 ; check if the name is not empty
D0 01     BNE :ok2 ; if it is empty then don't show anything, because displaying an empty text crashes the game
60        RTS
         :ok2
4C 36 CB  JMP $CB36 ; show status text
Sweet, sweet. And not showing anything if there's no text, cool. This makes me think of something I was curious. I recall that Layer 2 cannot flip tiles or use alternate palettes. Can at least the alternate palettes be used (I remember Level 15 uses two different palettes)?
I'm also thinking, if loose tile sprites can be changed like we did on the 30th anniversary port, can floors/walls/other background/foreground elements from another level can be swapped? Let's say, the walls of the brown dungeon swapped with the ones of the blue dungeon? Or some cave tiles from the blue dungeon be swapped with columns of the green palace?
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: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: June 13th, 2020, 3:14 am - Remove the Level number on the pause menu.
At 0x0F2F write: EA EA EA
At 0x10B1 overwrite the "LV" and "00" with spaces.

Now the time looks awkwardly off-center.
Move it left by two character places:
At 0x1088 write: A9 01
At 0x10B1 move the "TIME" and "---:--" texts accordingly.

Details:

Code: Select all

The first hack changes this part:
00:8F2F: 20 22 90    JSR $9022 ; display level number (status) ; <-- overwrite this with NOPs
00:8F32: 20 79 90    JSR $9079 ; display remaining time (status)
00:8F35: 20 a1 90    JSR $90a1

The second hack changes this part:
00:9083: a9 01       LDA #$01 ; control code for positioning text
00:9085: 8d 56 08    STA $0856 ; buffer for strings
00:9088: a9 03       LDA #$03 ; column ; <-- change to 01
00:908A: 8d 57 08    STA $0857 ; buffer for strings +1
00:908D: a9 02       LDA #$02 ; row
00:908F: 8d 58 08    STA $0858 ; buffer for strings +2
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: June 21st, 2020, 6:44 pm I recall that Layer 2 cannot flip tiles or use alternate palettes. Can at least the alternate palettes be used (I remember Level 15 uses two different palettes)?
While Level 15 has a few blue rooms in addition to the many green ones, the green and blue colors of Layer 2 are within the same 16-color palette.
The green and the blue floors are made using different tiles, which look similar but use different colors (different palette indices within the same palette).
You can see this in the palette editor and the graphics editor in Pr1SnesLevEd.
Shauing wrote: June 21st, 2020, 6:44 pm I'm also thinking, if loose tile sprites can be changed like we did on the 30th anniversary port,
What do you mean?
Shauing wrote: June 21st, 2020, 6:44 pm can floors/walls/other background/foreground elements from another level can be swapped? Let's say, the walls of the brown dungeon swapped with the ones of the blue dungeon? Or some cave tiles from the blue dungeon be swapped with columns of the green palace?
For that we would need a program which can edit the graphics tiles within the "Environments" resources.
So, sorry, but this is not possible with the currently existing tools.
User avatar
Shauing
Calif
Calif
Posts: 431
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

David wrote: June 28th, 2020, 11:03 am While Level 15 has a few blue rooms in addition to the many green ones, the green and blue colors of Layer 2 are within the same 16-color palette.
The green and the blue floors are made using different tiles, which look similar but use different colors (different palette indices within the same palette).
You can see this in the palette editor and the graphics editor in Pr1SnesLevEd.
Oh, that's right.
David wrote: June 28th, 2020, 11:03 am
Shauing wrote: June 21st, 2020, 6:44 pm I'm also thinking, if loose tile sprites can be changed like we did on the 30th anniversary port,
What do you mean?
I confused myself, I meant that we changed the transparent/shadow floor tile sprite with a normal floor tile sprite.
David wrote: June 28th, 2020, 11:03 am
Shauing wrote: June 21st, 2020, 6:44 pm can floors/walls/other background/foreground elements from another level can be swapped? Let's say, the walls of the brown dungeon swapped with the ones of the blue dungeon? Or some cave tiles from the blue dungeon be swapped with columns of the green palace?
For that we would need a program which can edit the graphics tiles within the "Environments" resources.
So, sorry, but this is not possible with the currently existing tools.
Ah, so doing it via hex-editing isn't possible? I recall one door sprite on The Quiet Levels being swapped with another door sprite from a different level.

In any case, we might now focus on the hack of multiple special exits in all four directions and see if levels can have different start points depending of the exit path that is taken, perhaps similar to the checkpoint system that restores you to some part of the level after crossing a specific room, in this case it could be a specific room and/or exit from a different level, and perhaps passwords can use the unused checkpoint flag, if the coding for it is complete/wasn't left unfinished.
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
Post Reply