Hacking the SNES ROM

Discuss PoP1 for SNES here.
User avatar
Iso
Sheikh
Sheikh
Posts: 48
Joined: January 15th, 2010, 11:34 pm

Re: Hacking the SNES ROM

Post by Iso »

Kaslghnoon wrote:As of right now, your ROM is more than 1,048,576 bytes because byte(s) have been added between x8000-x1ffff.
Is this caused by hex editing exclusively or could it be a result of adding tiles with the graphics editor? Could over-writing pre-existing tiles instead of making brand new ones help?
Kaslghnoon
Sultan
Sultan
Posts: 153
Joined: February 27th, 2010, 8:35 pm
Location: United States

Re: Hacking the SNES ROM

Post by Kaslghnoon »

Iso wrote:
Kaslghnoon wrote:As of right now, your ROM is more than 1,048,576 bytes because byte(s) have been added between x8000-x1ffff.
Is this caused by hex editing exclusively or could it be a result of adding tiles with the graphics editor? Could over-writing pre-existing tiles instead of making brand new ones help?
First, x20000.smc was corrupted, the rest were good. No extra byte was inserted by mistake. Bytes can be inserted in Translhextion when you accidently hit the 'Insert' key on the keyboard toggling between 'Override' and 'Insert' mode. This information can be viewed at the status bar of Translhextion (at the bottom bar it's the second status from the right showing either "ANSI/OVR/L" or "ANSI/INS/L"). But I confirm that this corruption was not hex-editing related. It was Pr1SnesLevEd related. The corruption covered all offsets between xADF3C-xAE6AE, far away from the range covered in this topic.

Second, major data truncation had occurred to the first resource table. But this was not an internal fault of Pr1SnesLevEd, but rather the usage of its current version. I will address the proper usage of Pr1SnesLevEd's graphic editor in its topic so proper compression can be achieved without data loss.
User avatar
spartacus735
Wise Scribe
Wise Scribe
Posts: 217
Joined: November 20th, 2011, 12:41 pm
Location: France

Re: Hacking the SNES ROM

Post by spartacus735 »

Hey , I have some questions

1 - How to change the passwords of the game ? (such as "quiet level")

2 - How to remove the drive / video from the beginning (and the end) just to get the text from the beginning and change just to get "princed.org," myname "" name of mod "(as" quiet level ")

Thx
>>>>>>>>>>>>>>>>>>>> http://www.youtube.com/user/spartacus735 <<<<<<<<<<<<<<<<<<<< the channel of prince of persia snes mod
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 »

spartacus735 wrote:1 - How to change the passwords of the game ? (such as "quiet level")
x15698 to x1569D: cheat password
x1571C to x1576E: letters on the password screen, with spaces between them, as they will appear on the screen
x15783 to x157A6: letters on the password screen, without any spaces
x15E38 to x15E57: letters used for making passwords
x15FF2 to x15FF8: default password
spartacus735 wrote:2 - How to remove the drive / video from the beginning (and the end) just to get the text from the beginning and change just to get "princed.org," myname "" name of mod "(as" quiet level ")
x18458 to x184BB: the first intro text
x184B6 to x18525: the second intro text

EDIT: All offsets in this post are for the headered rom.
Last edited by David on July 19th, 2013, 11:25 am, edited 1 time in total.
User avatar
spartacus735
Wise Scribe
Wise Scribe
Posts: 217
Joined: November 20th, 2011, 12:41 pm
Location: France

Re: Hacking the SNES ROM

Post by spartacus735 »

thx David !

I have another question, the shadow of the game is transparent. I wonder if it is possible to recover this effect and add a guard or prince

Image
>>>>>>>>>>>>>>>>>>>> http://www.youtube.com/user/spartacus735 <<<<<<<<<<<<<<<<<<<< the channel of prince of persia snes mod
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'm not sure what do you mean by "recover".
Do you want to make the shadow non-transparent?
Or do you want to make someone else transparent?
User avatar
spartacus735
Wise Scribe
Wise Scribe
Posts: 217
Joined: November 20th, 2011, 12:41 pm
Location: France

Re: Hacking the SNES ROM

Post by spartacus735 »

I want to make someone else transparent ( prince )
>>>>>>>>>>>>>>>>>>>> http://www.youtube.com/user/spartacus735 <<<<<<<<<<<<<<<<<<<< the channel of prince of persia snes mod
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 »

Making the prince transparent is not so easy.
The sprite palette entries are used like this:
0x80..0x8F: kid
0x90..0x9F: sword
0xA0..0xAF: flame
0xB0..0xBF: potion
0xC0..0xCF: green kid (slow fall)
0xD0..0xDF: guard/shadow
0xE0..0xEF: not used
0xF0..0xFF: not used
Of these, only the second half (0xC0..0xFF) can be made transparent.
This results in a bug: If there is a shadow in the room, and the prince is blue (because he drank a slow fall potion), then he will be transparent.

One way to make the prince always transparent would be to modify the game to always use a palette from the second half for the kid, and always enable transparency.
Another change should be made to disable transparency for guards. Perhaps move the guard palette to 0x80..0x8F, which became unused.

I already found the code that loads the palettes:

Code: Select all

00:F3C3: 08          PHP
00:F3C4: 8b          PHB
00:F3C5: c2 10       REP #$10
00:F3C7: e2 20       SEP #$20
00:F3C9: 22 de 99 00 JSR $00:99de
00:F3CD: a9 00       LDA #$00
00:F3CF: 22 22 9a 00 JSR $00:9a22
00:F3D3: 8f 66 02 00 STA $00:0266
00:F3D7: 20 4c f5    JSR $f54c
level 10,11,12 (red prince):
00:F3DA: af 79 05 00 LDA $00:0579 ; current level
00:F3DE: 38          SEC
00:F3DF: e9 09       SBC #$09 ; from level 10
00:F3E1: c9 03       CMP #$03 ; 3 levels
00:F3E3: 90 05       BCC $f3ea
00:F3E5: a2 00 00    LDX #$0000 ;normal kid
00:F3E8: 80 03       BRA $f3ed

00:F3EA: a2 01 00    LDX #$0001 ;red kid
00:F3ED: 20 73 f5    JSR $f573 ; load palette?
00:F3F0: 20 8c f5    JSR $f58c
00:F3F3: a9 00       LDA #$00
00:F3F5: 22 22 9a 00 JSR $00:9a22
00:F3F9: 8f 68 02 00 STA $00:0268
00:F3FD: 20 4c f5    JSR $f54c
00:F400: a2 16 00    LDX #$0016 ;sword
00:F403: 20 73 f5    JSR $f573 ; load palette?
00:F406: 20 8c f5    JSR $f58c
00:F409: a9 00       LDA #$00
00:F40B: 22 22 9a 00 JSR $00:9a22
00:F40F: 8f 69 02 00 STA $00:0269
00:F413: 20 4c f5    JSR $f54c
00:F416: a2 17 00    LDX #$0017 ;flame
00:F419: 20 73 f5    JSR $f573 ; load palette?
00:F41C: 20 8c f5    JSR $f58c
00:F41F: a9 00       LDA #$00
00:F421: 22 22 9a 00 JSR $00:9a22
00:F425: 8f 6a 02 00 STA $00:026a
00:F429: 20 4c f5    JSR $f54c
00:F42C: a2 18 00    LDX #$0018 ;potion
00:F42F: 20 73 f5    JSR $f573 ; load palette?
00:F432: 20 8c f5    JSR $f58c
00:F435: a9 00       LDA #$00
00:F437: 22 22 9a 00 JSR $00:9a22
00:F43B: 8f 6f 02 00 STA $00:026f
00:F43F: 20 4c f5    JSR $f54c
00:F442: a2 02 00    LDX #$0002 ;slowfall kid
00:F445: 20 73 f5    JSR $f573 ; load palette?
00:F448: 20 8c f5    JSR $f58c
00:F44B: a9 ff       LDA #$ff
00:F44D: 8f 67 02 00 STA $00:0267
00:F451: 8f 6b 02 00 STA $00:026b
00:F455: 8f 6e 02 00 STA $00:026e
00:F459: 8f 70 02 00 STA $00:0270
And the code that sets the transparency:

Code: Select all

level 5 check something:
00:F4D9: ad 79 05    LDA $0579 ; current level
00:F4DC: c9 04       CMP #$04 ;level 5
00:F4DE: d0 07       BNE $f4e7
00:F4E0: ad 06 05    LDA $0506 ; shown room
00:F4E3: c9 0f       CMP #$0f ; room 15
00:F4E5: f0 05       BEQ $f4ec ; transparency on
shadow is transparent:
00:F4E7: e0 06 00    CPX #$0006 ; guard type = shadow
00:F4EA: d0 16       BNE $f502 ; transparency off
transparency on:
00:F4EC: a9 17       LDA #$17
00:F4EE: 8d 2c 21    STA $212c
00:F4F1: a9 07       LDA #$07
00:F4F3: 8d 2d 21    STA $212d
00:F4F6: a9 02       LDA #$02
00:F4F8: 8d 30 21    STA $2130
00:F4FB: a9 10       LDA #$10
00:F4FD: 8d 31 21    STA $2131
00:F500: 80 14       BRA $f516

transparency off:
00:F502: a9 17       LDA #$17
00:F504: 8d 2c 21    STA $212c
00:F507: a9 00       LDA #$00
00:F509: 8d 2d 21    STA $212d
00:F50C: a9 02       LDA #$02
00:F50E: 8d 30 21    STA $2130
00:F511: a9 00       LDA #$00
00:F513: 8d 31 21    STA $2131
EDIT:
I found out that the $9a22 subroutine uses the value of A to determine which half of the palettes to use.
$00 means any, $01 means the first, $02 means the second. (See the LDA #$00 lines in the first code-box?)

Here is the first version of the hack:
x73CE to $02 (from $00) (load kid palette to second half)
x7436 to $02 (from $00) (load blue kid palette to second half)
x74EA to $EA $EA (from $D0 $16) (always enable transparency)
Note that the shadow will lose its transparency. I want to fix this.
User avatar
spartacus735
Wise Scribe
Wise Scribe
Posts: 217
Joined: November 20th, 2011, 12:41 pm
Location: France

Re: Hacking the SNES ROM

Post by spartacus735 »

:O it's hard !

OMG x) How you can find that ? with translextion ?

EDIT :

Work perfectly , thank a lot you're the best with kasl !

Image
>>>>>>>>>>>>>>>>>>>> http://www.youtube.com/user/spartacus735 <<<<<<<<<<<<<<<<<<<< the channel of prince of persia snes mod
2233
Efendi
Efendi
Posts: 17
Joined: March 25th, 2014, 3:07 pm

Re: Hacking the SNES ROM

Post by 2233 »

Yo say hex values $? How to make example $CC?
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Hacking the SNES ROM

Post by Norbert »

2233 wrote:Yo say hex values $? How to make example $CC?
I think you are wondering how to hex edit?
Maybe this answers your question: viewtopic.php?f=76&t=3382
2233
Efendi
Efendi
Posts: 17
Joined: March 25th, 2014, 3:07 pm

Re: Hacking the SNES ROM

Post by 2233 »

not that,i wanna remove hot effect in my rom, i make offset x4Def CC, nothing changed.
Kaslghnoon
Sultan
Sultan
Posts: 153
Joined: February 27th, 2010, 8:35 pm
Location: United States

Re: Hacking the SNES ROM

Post by Kaslghnoon »

2233 wrote:not that,i wanna remove hot effect in my rom, i make offset x4Def CC, nothing changed.
First, undo the change you made: Set x4DEF back to $00, then remove the header from your ROM before making more changes:
1) Open your mod with Translhextion
2) Ctrl+g on the keyboard
3) Enter x1ff
4) Ctrl+Shift+Home on the keyboard (highlights x0 to x1FF)
5) Delete, then Enter on the keyboard (removes the header)
6) Save

Your ROM is safe for editing. x4DEF to $CC and other simple hacks should work now.
2233
Efendi
Efendi
Posts: 17
Joined: March 25th, 2014, 3:07 pm

Re: Hacking the SNES ROM

Post by 2233 »

Yeah,it worked. Thanks
salvadorc17
Calif
Calif
Posts: 553
Joined: August 27th, 2011, 2:04 am

Re: Hacking the SNES ROM

Post by salvadorc17 »

Any way to mod hacking the prince sprite colors...
Post Reply