Hacking the SNES ROM

Discuss PoP1 for SNES here.
Post Reply
Kaslghnoon
Sultan
Sultan
Posts: 153
Joined: February 27th, 2010, 8:35 pm
Location: United States

Hacking the SNES ROM

Post by Kaslghnoon »

  • Level id's:

    Level 1 = $00
    Level 2 = $01
    Level 3 = $02
    Level 4 = $03
    Level 5 = $04
    Level 6 = $05
    Level 7 = $06
    Level 8 = $07
    Level 9 = $08
    Level 10 = $09
    Level 11 = $0A
    Level 12 = $0B
    Level 13 = $0C
    Level 14 = $0D
    Level 15 = $0E
    Level 16 = $0F
    Level 17 = $10
    Level 18 = $11
    Level 19 = $12
    Level 20 = $13
    Jaffar = $14
    Demo = $15
    Training 1 = $16
    Training 2 = $17
    Training 3 = $18
    Training 4 = $19
    Training 5 = $1A


    • Guard id's:

      Dead purple = $00
      Skel = $01
      Brown skel = $02
      Golden skel = $03
      Girl = $04
      Fat = $05
      Shadow = $06
      Green = $07
      Greenish blue = $08
      Blue = $09
      Red = $0A
      Purple = $0B
      Blueface = $0C
      Red knight = $0D
      Blue knight = $0E
      Monster = $0F
      Jaffar = $10


      • Object id's:

        loose = $02
        open = $04
        close = $05
        door = $06
        ld end = $07
        mirror = $08
        skel = $09
        sword = $0A
        0Btorch = $0B
        chomper = $0C
        guillotine = $0D
        spike = $0E
        crusher = $10
        heal potion = $12
        life potion = $13
        hurt potion = $14
        upside down potion = $15
        slow fall potion = $16
        debris = $17
        door top = $18
        fire = $19
        potion of warp = $1A
        1Bdown only = $1B
        kill potion = $1C
        1Dtorch = $1D
        log = $1E
        stars = $20
        21torch = $21
        22torch = $22
        teleport = $23
        ld begin = $24
        lava = $27
        skel cont = $28
        skull? = $29
        >>> = $2A
        <<< = $2B


        • Room id's:

          Room 0 = $00
          Room 1 = $01
          Room 2 = $02
          Room 3 = $03
          Room 4 = $04
          Room 5 = $05
          Room 6 = $06
          Room 7 = $07
          Room 8 = $08
          Room 9 = $09
          Room 10 = $0A
          Room 11 = $0B
          Room 12 = $0C
          Room 13 = $0D
          Room 14 = $0E
          Room 15 = $0F
          Room 16 = $10
          Room 17 = $11
          Room 18 = $12
          Room 19 = $13
          Room 20 = $14
          Room 21 = $15
          Room 22 = $16
          Room 23 = $17


          • Tile id's:

            Tile 0 = $00
            Tile 1 = $01
            Tile 2 = $02
            Tile 3 = $03
            Tile 4 = $04
            Tile 5 = $05
            Tile 6 = $06
            Tile 7 = $07
            Tile 8 = $08
            Tile 9 = $09
            Tile 10 = $0A
            Tile 11 = $0B
            Tile 12 = $0C
            Tile 13 = $0D
            Tile 14 = $0E
            Tile 15 = $0F
            Tile 16 = $10
            Tile 17 = $11
            Tile 18 = $12
            Tile 19 = $13
            Tile 20 = $14
            Tile 21 = $15
            Tile 22 = $16
            Tile 23 = $17
            Tile 24 = $18
            Tile 25 = $19
            Tile 26 = $1A
            Tile 27 = $1B
            Tile 28 = $1C
            Tile 29 = $1D


            • Music track id's (Konami versions only)

              $00 = Konami sound
              $01 = Levels 1-3
              $02 = Levels 4-6
              $03 = Levels 7-9
              $04 = Level 10
              $05 = Levels 11,12
              $06 = Levels 13-15
              $07 = Levels 16,18
              $08 = Level 17
              $09 = Level 19
              $0A = Level 20
              $0B = Monster battle
              $0C = Guard battle
              $0D = Boss battle
              $0E = Jaffar battle
              $0F = Title screen
              $10 = Menu
              $11 = Princess
              $12 = Ending
              $13 = Memories
              $14 = Credits
              $15 = Death (2)
              $16 = Death
              $17 = Sword pickup
              $18 = Life potion
              $19 = Girl, shadow intro
              $1A = (unused?)
              $1B = Exit opened
              $1C = Level clear
              $1D = Guard defeated
              $1E = Jaffar intro
              $1F = Heal potion
              $20 = Too late
              $21 = Boss intro


              • Gate action list:

                $00 = Instant silent open (Triggered gate will permanently open quickly without making the normal sound)
                $01 = Regular temporary open
                $02 = Permanent open
                $03 = Close
                -----------------------------------------------------
                Note:
                • is only accurate for gates.
                  -----------------------------------------------------


                  • Row id's:

                    $00 = Tiles 0-9
                    $01 = Tiles 10-19
                    $02 = Tiles 20-29


                    • Column id's:

                      $00 = Tiles 0,10,20
                      $01 = Tiles 01,11,21
                      $02 = Tiles 02,12,22
                      $03 = Tiles 03,13,23
                      $04 = Tiles 04,14,24
                      $05 = Tiles 05,15,25
                      $06 = Tiles 06,16,26
                      $07 = Tiles 07,17,27
                      $08 = Tiles 08,18,28
                      $09 = Tiles 09,19,29



                      ==========================================================================
                      Note: Numbers preceded with 'x' are offsets, preceded with '$' are values.
                      ==========================================================================

                      Introduction:

                      Hex editing is the process of modifying any computer file via a hex editor. The process is often referred to as "hacking". To hack you need a hex editor. There are many hex editing programs to choose from and a simple google search will confirm that. The program I use to do hex editing is called Translhextion. Translhextion is an old open source hex editor that was released back in the early 2000's. The reason I still use Translhextion today is simply because I've grown accustumed to it. Download Translhextion: http://www.zophar.net/download_file/2779


                      Hexadecimal numbers:

                      Hex editors deal with hexadecimal numbers. To learn about hexadecimal vs. decimal, a quick Google search for "hexadecimal" will do.

                      --------------------------------------------------------------------------

                      The SNES Prince of Persia ROM:

                      There are 3 versions of the ROM:
                      1) U.S NTSC Super Nintendo (Konami)
                      2) European PAL Super Nintendo (Konami)
                      3) Japanese NTSC Super Famicom (Masaya)
                      The only version that I have hacked so far is the U.S version.

                      Download a headerless ROM of the U.S Konami version to perform the upcoming simple hex modifications:
                      http://www.mediafire.com/?yumba2flkc34far

                      --------------------------------------------------------------------------

                      Simple hacking:

                      If you are using Translhextion, to quickly jump to an offset, press Ctrl+g, enter the number preceded with an 'x'. Do not forget the 'x' or this won't work.

                      Tip: To locate offsets easier, resize the hex editor window in a way that displays only two colums: The column on the left shows offsets, column on the right shows values.

                      Image

                      Starting level = x19C3A
                      If you want "GAME START" to start from a specific level (other than level 1), modify this offset. Refer to [LIST 1] to enter a value. Note that "CONTINUE" will still start from level 1 even after the change. To erase that BRNGBB9 (level 1 password), set all these offsets to $00:
                      x15DF2, x15DF3, x15DF4, x15DF5, x15DF6, x15DF7, x15DF8

                      "TRAINING" starting level = x11AC (Refer to [LIST 1] to edit which level "TRAINING" will begin with.)

                      Starting health points = xED4B
                      Change $03 and Prince will have a different number of bottles on "GAME START" and "TRAINING".

                      ---

                      Hacking level specific events:


                      Level 1: No sword before pickup, gate closes in entry room

                      -Have sword: xEE0D to $01
                      -Disable closing gate at level 1 start: xEEC7 to $D0

                      -

                      Level 3: (Skeletons, checkpoint, running entry after checkpoint)

                      -Skeletons don't rise until Prince is on tiles 2 or 3, room 13 skeleton is inactive before exit is open.
                      xCDB8 = Level where all this occurs (refer to [LIST 1])
                      xCDBF = Room number where the inactive skeleton awakes after exit is open (Refer to [LIST 4])
                      xCDCB and xCDCF = Tiles that Prince must be on for skeletons to rise. (Refer to [LIST 5])

                      -Disable the level 3 skeleton stipulations: xCDB8 to $CC

                      Disable checkpoint: xDF1C to $CC
                      Disable running entry after checkpoint: xE05D to $CC

                      -

                      Level 5: Mirror and shadow

                      -After exit is open, mirror appears at room 15, tile 5.

                      -To have the mirror appear in room 15 of a different level after exit is open, apply the same value [LIST 1] to all these offsets: x74DD, x75BD, x8456, x8BF1, x9A7D, xE39A

                      -Disable mirror placement:
                      x74DD to $CC
                      x75BD to $CC
                      x8456 to $CC
                      x8BF1 to $CC
                      x9A7D to $CC
                      xE39A to $CC

                      -Room x845D [LIST 4] is linked to the right of the mirror room. After passing through room x845D [LIST 4], the mirror intro music plays as Prince enters room 15 from the right.

                      -Disable the mirror intro music: x8456 to $CC

                      -Make the shadow stand still after coming out of mirror: x8BF1 to $CC

                      -Edit the location of mirror placement:
                      1) Assign new position:
                      x74E4, x75C5, x8C05, x9A84, xE39E = Room [LIST 4] (Change all offsets to the same room id.)
                      xE3A0 = Column [LIST 9]
                      xE3A2 = Row [LIST 8]
                      2) Make these offset changes:
                      x9A87 to $4C
                      x9A88 to $90
                      x9A89 to $9A
                      3) Verify that room x845D [LIST 4] is linked to the left of the mirror placement room.

                      -Have another object appear instead of mirror: xE3A7 [LIST 3]

                      -Opening exit closes gate:
                      In level xD328 [LIST 1], when exit is opened, close the gate located in room xD338 [LIST 4], tile xD33D [LIST 5].

                      -

                      Level 6: Checkpoint and running entry
                      -Disable checkpoint: xDF23 to $CC
                      -Disable running entry after checkpoint: xE061 to $CC

                      -

                      Level 7: Shadow steal
                      x872B = Level where shadow steal occurs [LIST 1]
                      x8C44 = Room where shadow steal occurs [LIST 4]
                      x77CE = Level where shadow shape and palette is applied [LIST 1]
                      x75DB = Room where shadow shape and palette is applied [LIST 4]

                      -Disable shadow steal:
                      x872B to $CC
                      x77CE to $CC

                      -

                      Level 9: Checkpoint and running entry
                      -Disable checkpoint: xDF2A to $CC
                      -Disable running entry after checkpoint: xE065 to $CC

                      -

                      Level 10: Falling entry, hot effect, red Prince, skeleton palette swap
                      -Apply these to a different level [LIST 1] or set their values to $CC to disable them:
                      xE070 = Falling entry
                      x4DEF = Hot effect
                      x73E0 = Red Prince
                      x74A9 = Skeleton palette swap

                      -Red Prince coding summary:
                      Starting from level x73E0 [LIST 1], apply palette x73EB to Prince for a total of x73E2 levels.

                      -Palette swap coding summary:
                      In level x74A9 [LIST 1] apply palette x74B8 to guard whose id is greater than or equal to x74AE and is less than x74B3 [LIST 2].

                      -

                      Level 13: After exit is open, Jaffar and mouse appear in room 16
                      -To have Jaffar and mouse appear in room 16 of a different level after exit is open, enter the same value [LIST 1] for all these offsets: x75E9, x8E3D, xBB57, xF183, xF5EA, xF8DF

                      -Disable Jaffar and mouse:
                      x75E9 to $CC
                      x8E3D to $CC
                      xBB57 to $CC
                      xF183 to $CC
                      xF5EA to $CC
                      xF8DF to $CC

                      -Disable Jaffar appearance and have only mouse show up:
                      x75E9 to $CC
                      xD190 to $4C
                      xD191 to $9D
                      xD192 to $D1
                      xD1A3 to $01
                      xF8FB to $F2

                      -Disable mouse appearance:
                      xF183 to $CC
                      xF5EA to $CC

                      -Edit what tile Jaffar remotely triggers:
                      x8ED7 = Room [LIST 4]
                      x8EDC = Tile [LIST 5]
                      x8EE1 = Action [LIST 7]

                      -Special open button coding summary:
                      After the exit is open in level xD397 [LIST 1], have the open button in room xD39E [LIST 4] to permanently open the gate that it triggers.

                      -

                      Level 15: Gates open permanently, Jaffar, Shadow
                      -All open buttons in level xD3AA open gates permanently.

                      -Loose tiles, buttons, and debris in level xF921 [LIST 1], rooms xF928 and xF92C [LIST 4] appear checkered blue instead of green.
                      Disable the blue: xF921 to $CC

                      -Disable Jaffar and Shadow appearances:
                      x83F2 to $CC
                      x86A9 to $CC

                      -To have the level 15 Jaffar and Shadow appearances in a different level: Set x83F2, x86A9, x8BFD, x8E41, xCC74, xCFB1, xD75F, and xE3B0 all to the same values [LIST 1].

                      -Disable shadow appearance: x86BC to $CC

                      -Jaffar appearance applies action x8424 [LIST 7] to the gate located at room x841A [LIST 4], tile x841F [LIST 5].

                      -

                      Level 16: Checkpoint and running entry
                      -Disable checkpoint: xDF31 to $CC
                      -Disable running entry after checkpoint: xE069 to $CC

                      -

                      Level 17: Running entry, monster
                      -Apply running entry to another level: xE278 [LIST 1]
                      -Disable running entry: xE278 to $CC
                      -Disable falling skulls during monster battle: x13F17 to $CC
                      -Palette of falling skulls = x7662

                      -Monster appearance applies action x8E17 [LIST 7] to the gate located at room x8E0D [LIST 4], tile x8E12 [LIST 5].

                      -

                      Level 18: Checkpoint
                      -Disable checkpoint: xDF35 to $CC

                      -

                      Level 19: Checkpoint, bosses
                      -Disable checkpoint: xDF39 to $CC

                      -Bosses entering room 7: (refer to [LIST 2] to edit bosses)
                      1) x12F0A
                      2) x12F0B
                      3) x12F0C
                      4) x12F0D
                      5) x12F0E

                      -Disable running into the boss room: x822E to $CC

                      -In level x11372 [LIST 1], room x11379 [LIST 4], the regular battle music track will play regardless of which guard Prince fights.

                      -

                      Level 20: Timer stops, Jaffar

                      -Game timer is stopped from this level and onward: xE9C2 [LIST 1].
                      -Jaffar is waiting for Prince in level x8750 [LIST 1], room x875A [LIST 4].
                      -Disable Jaffar: x8750 to $CC

                      -

                      Jaffar level: Don't display completion time, Jaffar
                      -Don't display completion time starting level xFA1A [LIST 1].
                      -Don't announce level number on level xEE3F [LIST 1].
                      -Jaffar has x8675 health points before sword fighting.
                      -Battle music is disabled in level x1136E [LIST 1].


                      ---

                      Special exits:

                      -Edit level 9 exit: Level x834D [LIST 1], room x8354 [LIST 4], exit down
                      -Edit level 15 exit: Level x82DF [LIST 1], room x82DF [LIST 4], exit left
                      -Edit level 16 exit: Level x82E5 [LIST 1], room x82EC [LIST 4], exit left
                      -Edit level 17 exit: Level x82F0 [LIST 1], room x82F7 [LIST 4], exit left
                      -Edit level 20 exit: Level x8306 [LIST 1], room x830D [LIST 4], exit left

                      ---

                      Guard trigger events:

                      1)
                      xADB9 = Level (level where event happens) [LIST 1]
                      xADC0 = Guard (guard type whose defeat triggers event) [LIST 2]
                      xADC4 = Room (room where a tile is triggered after guard defeat) [LIST 4]
                      xADC6 = Action (whether a gate opens or closes) [LIST 7]
                      xADC8 = Tile (tile that is being triggered) [LIST 5]

                      2)
                      xADCC = Level
                      xADD3 = Guard
                      xADD7 = Room
                      xADD9 = Action
                      xADDB = Tile

                      3)
                      xADDF = Level
                      xADE6 = Guard
                      xADEA = Room
                      xADEC = Action
                      xADEE = Tile

                      4)
                      xADF2 = Level
                      xADF9 = Guard
                      xADFD = Room
                      xADFF = Action
                      xAE01 = Tile

                      5)
                      xAE05 = Level
                      xAE0C = Guard
                      xAE10 = Room
                      xAE12 = Action
                      xAE14 = Tile

                      6)
                      xAE18 = Level
                      xAE1F = Guard
                      xAE23 = Room
                      xAE25 = Action
                      xAE27 = Tile


                      -Coding summary of a typical event (event 1 for example) is as follows:
                      At level xADB9 [LIST 1], after guard xADC0 [LIST 2] is defeated, apply action xADC6 [LIST 7] to the object at room xADC4 [LIST 4], tile xADC8 [LIST 5].

                      ---

                      Guards with boss introductions:
                      -Refer to [LIST 2] to choose which guards have introductions (Prince startle + intro music)

                      1) x8A5A (Default: Fat)
                      2) x8A5E (Default: Red Knight)
                      3) x8A62 (Default: Blue Knight)


                      Cut scenes:
                      These are the princess waiting scenes in between levels. Refer to [LIST 1] to edit the levels that follow these scenes. To disable a cut scene, set its value to $CC.

                      1) xF79F (Default: Shown before level 2)
                      2) xF7A3 (Default: Shown before level 4)
                      3) xF7A7 (Default: Shown before level 7)
                      4) xF7AB (Default: Shown before level 9)
                      5) xF7AF (Default: Shown before level 13)
                      6) xF7B3 (Default: Shown before level 14)
                      7) xF7B7 (Default: Shown before level 16)
                      8) xF7BB (Default: Shown before level 20)

                      ---

                      Music tracks:
                      Refer to [LIST 6] to edit what track plays:

                      Title screen = x1964B
                      Menu = x19C24
                      Regular battle = x113B6
                      Boss battle = x113C1
                      Politician and knights intro = x8B43
                      Female guard intro = x8AB8
                      Mirror intro (level 5) = x846B
                      Shadow intro (level 9) = x871F
                      Jaffar intro (level 13) = xD191
                      Jaffar intro (level 15) = x8413
                      Shadow intro (level 15) = x86CA
                      Level 19 boss room intro = x8343
                      Heal potion = xD034
                      Life potion = xD04F
                      Slow fall potion = xD05D
                      Exit open = xD9E1
                      Level cleared = x9EFB
                      Princess = x14D18
                      Ending = x1AC5B
                      Memories = x11454
                      Credits = x1B45C

                      ---

                      Unsorted hacks:

                      -Change regular Prince palette: x73E6

                      -Change red Prince palette: x73EB

                      -Change slow fall Prince palette: x7443

                      -Make demo level playable:
                      xA0A2 to $CC
                      xE835 to $CC

                      -Modify demo level purple guard skill: x92D1

                      -Apply modified purple guard skill to a different level: x92CD [LIST 1]

                      -Apply demo level's muted battle music to another level: x113DB [LIST 1]

                      -Remove all guards except Jaffar: x8A1B to $02

                      -Convert NTSC to PAL: x7FD9 to $02

                      -Disable battle music:
                      x1136B to $32
                      x1136E to $01

                      -Disable reflection on mirror: xD0E6 to $CC

                      -Guard xCEE4 [LIST 2] has female voice.

                      -These 3 guards have a deeper voice: [LIST 2]
                      1) xCEF4 (Default: Fat)
                      2) xCEF8 (Default: Red Knight)
                      3) xCEFC (Default: Blue Knight)

                      -This guard has a deeper echoed voice: [LIST 2]
                      xCF00 (Default: Jaffar)

                      -Skip Konami and title screens: x1801C to $01

                      -Skip Konami screen:
                      x1802A to $EA
                      x1802B to $EA
                      x1802C to $EA

                      -Skip Demo gameplay:
                      x1803F to $EA
                      x18040 to $EA
                      x18041 to $EA

                      -Skip ending:
                      x1ABB2 to $EA
                      x1ABB3 to $EA
                      x1ABB4 to $EA

                      -Skip memory scenes:
                      x1ABB5 to $EA
                      x1ABB6 to $EA
                      x1ABB7 to $EA

                      -Potion of Warp:
                      x856E = Prince will be taken to this room [LIST 4]
                      x8573 = Direction Prince will be facing ($FF = left, $00 = right)
                      x8578 = Prince will be placed on this column [LIST 9]
                      x8786 = Prince will be placed on this row [LIST 8]

                      -Drinking kill potion beats level:
                      xD096 to $0B
                      xD09A to $EE
                      xD09B to $44
                      xD09C to $05

                      -Drinking kill potion beats level but reduces a life from Prince:
                      xD095 to $CE
                      xD096 to $0A
                      xD097 to $05
                      xD098 to $EE
                      xD099 to $44
                      xD09A to $05
                      xD09B to $EA
                      xD09C to $EA

                      -Drinking kill potion makes present-room guard fall asleep:
                      xD096 to $01
                      xD097 to $8D
                      xD098 to $86
                      xD099 to $04
                      xD09A to $EA
                      xD09B to $EA
                      xD09C to $EA

                      -Drinking kill potion restarts timer: (120 minutes remaining)
                      xD096 to $00
                      xD097 to $8D
                      xD098 to $2D
                      xD099 to $05
                      xD09A to $8D
                      xD09B to $2E
                      xD09C to $05

                      -Drinking kill potion sends Prince to Training 1:
                      xD096 to $16
                      xD097 to $8D
                      xD098 to $44
                      xD099 to $05
                      xD09A to $EA
                      xD09B to $EA
                      xD09C to $EA

                      -Drinking kill potion removes sword from Prince:
                      xD096 to $10
                      xD09A to $CE
                      xD09B to $32
                      xD09C to $05

                      -Drinking kill potion turns guard to the left
                      xD096 to $FF
                      xD097 to $8D
                      xD098 to $7A
                      xD099 to $04
                      xD09A to $EA
                      xD09B to $EA
                      xD09C to $EA

                      -Drinking kill potion turns guard to the right
                      xD096 to $00
                      xD097 to $8D
                      xD098 to $7A
                      xD099 to $04
                      xD09A to $EA
                      xD09B to $EA
                      xD09C to $EA

                      -Kill potion looks like heal potion: x5238 to $0B

                      -Kill potion looks like hurt potion: x5238 to $04

                      -The slow fall potion is effective for this amount of time xD064 ($00 - $FF)


                      ==============================================================================================


                      Advanced hacking:

                      To exploit the following hacks, you need to download a hacked version of the ROM. Almost all of the simple hacks previously mentioned will still work on the hacked version. Since I do not have time to show every byte of assembly hacking, you will have to observe the newly added offsets and study 6502 basics on your own (if you are interested, that is). This hacked version is created by me. Some of the modifications done on the hack were already used in The Quiet Levels, such as: Uniform guards, level-specific guard skills, chomper speed, and trigger potion.

                      Download the hacked version:
                      http://www.freewebs.com/kaslghnoon/0.smc

                      ---

                      Edit time limit:

                      100 minutes:
                      xEE78 to $35
                      xFECA to $21

                      90 minutes:
                      xEE78 to $C8
                      xFECA to $31

                      60 minutes:
                      xEE78 to $95
                      xFECA to $63

                      45 minutes:
                      xEE78 to $84
                      xFECA to $7C

                      30 minutes:
                      xEE78 to $65
                      xFECA to $95

                      Revert back to 120 minutes time:
                      xEE78 to $00
                      xFECA to $00

                      ---

                      Uniform guards:

                      By manipulating the skeleton palette swap used in level 10, I have coded 14 occurrences where you can apply to a different palette to: A guard, several guards, or all guards in a particular level.

                      1) Level = x74A9, Starting guard = x74AE, End guard = x74B3, Palette = x74B8
                      2) Level = x7AA8, Starting guard = x79C7, End guard = x79CC, Palette = x79D1
                      3) Level = x7AAD, Starting guard = x79D8, End guard = x79DD, Palette = x79E2
                      4) Level = x7AB2, Starting guard = x79E9, End guard = x79EE, Palette = x79F3
                      5) Level = x7AB7, Starting guard = x79FA, End guard = x79FF, Palette = x7A04
                      6) Level = x7ABC, Starting guard = x7A0B, End guard = x7A10, Palette = x7A15
                      7) Level = x7AC1, Starting guard = x7A1C, End guard = x7A21, Palette = x7A26
                      8) Level = x7AC6, Starting guard = x7A2D, End guard = x7A32, Palette = x7A37
                      9) Level = x7ACB, Starting guard = x7A3E, End guard = x7A43, Palette = x7A48
                      10) Level = x7AD0, Starting guard = x7A4F, End guard = x7A54, Palette = x7A59
                      11) Level = x7AD5, Starting guard = x7A60, End guard = x7A65, Palette = x7A6A
                      12) Level = x7ADA, Starting guard = x7A71, End guard = x7A76, Palette = x7A7B
                      13) Level = x7ADF, Starting guard = x7A82, End guard = x7A87, Palette = x7A8C
                      14) Level = x7AE4, Starting guard = x7A93, End guard = x7A98, Palette = x7A9D

                      Level = Level where palette swap occurs [LIST 1]
                      Starting guard = Apply palette swap starting from this guard [LIST 2].
                      End guard = Exclude this guard and all guards with greater id's from palette swap [LIST 2].
                      Palette = This palette will be applied.

                      Sample coding summary of this hack: (using number 2 as an example)
                      In level x7AA8 [LIST 1] apply palette x79D1 to guard whose id is greater than or equal to x79C7 [LIST 2], and is less than x79CC [LIST 2].

                      Note: The SNES level editor will not show these palette swaps.

                      ---

                      Level-specific guard skills:

                      If you want all the guards in a specific level to have a skill type of your choosing, use this hack.

                      1) Level xFA62 [LIST1], Guard skill = xFA82
                      2) Level xFA66 [LIST1], Guard skill = xFA8C
                      3) Level xFA6A [LIST1], Guard skill = xFA96
                      4) Level xFA6E [LIST1], Guard skill = xFAA0
                      5) Level xFA72 [LIST1], Guard skill = xFAAA
                      6) Level xFA76 [LIST1], Guard skill = xFAB4

                      For guard skill, try values starting with $00 and decide which value fits the level.

                      ---

                      Special open buttons that open gates open permanently:

                      1) Level xD3AA [LIST1], all rooms (original level 15)
                      2) Level xFABF [LIST1], all rooms
                      3) Level xFAC3 [LIST1], all rooms
                      4) Level xFAC7 [LIST1], all rooms
                      5) Level xFACB [LIST1], all rooms
                      6) Level xFACF [LIST1], all rooms
                      7) Level xFAD3 [LIST1], room 20
                      8) Level xFAD7 [LIST1], room 20
                      9) Level xFADB [LIST1], rooms 20 and 21
                      10) Level xFADF [LIST1], rooms 20 and 21
                      11) Level xFAE3 [LIST1], rooms 20 and 21
                      12) Level xFAE7 [LIST1], rooms 20, 21, and 22
                      13) Level xFAEB [LIST1], rooms 20, 21, and 22
                      14) Level xFAEF [LIST1], rooms 20, 21, and 22

                      For hacks 7-14, place the special trigger in the rooms specified, not the gate being triggered. This is not a gate hack, it's an open button hack.

                      ---

                      Red Prince expanded:

                      Instead of the choice of only one set of consecutive levels for red Prince, you now have 5 choices:

                      1) Starting level x73E0 [LIST 1] for a total of x73E2 levels (original level 10-12)
                      2) Starting level x7B43 [LIST 1] for a total of x7B45 levels
                      3) Starting level x7B4E [LIST 1] for a total of x7B50 levels
                      4) Starting level x7B59 [LIST 1] for a total of x7B5B levels
                      5) Starting level x7B64 [LIST 1] for a total of x7B66 levels

                      ---

                      Apply the heat effect of level 10 to more levels:

                      1) Level x4DEF [LIST 1] (original level 10)
                      2) Level x7B7B [LIST 1]
                      3) Level x7B7F [LIST 1]
                      4) Level x7B83 [LIST 1]
                      5) Level x7B87 [LIST 1]

                      ---

                      More "no-sword" levels in addition to level 1:

                      1) Level xFB40 [LIST 1]
                      2) Level xFB44 [LIST 1]
                      3) Level xFB48 [LIST 1]
                      4) Level xFB4C [LIST 1]
                      5) Level xFB50 [LIST 1]

                      ---

                      Battle music will be disabled in these levels:

                      1) Level x1136E [LIST 1] (original Jaffar level)
                      2) Level x17A0A [LIST 1]
                      3) Level x17A0E [LIST 1]
                      4) Level x17A12 [LIST 1]
                      5) Level x17A16 [LIST 1]
                      6) Level x17A1A [LIST 1]
                      7) Level x17A1E [LIST 1]
                      8) Level x17A22 [LIST 1]
                      9) Level x17A26 [LIST 1]
                      10) Level x17A2A [LIST 1]
                      11) Level x17A2E [LIST 1]

                      ---

                      Level-specific chomper speed:

                      1) Chomper speed is slower in these two levels: xFB65 and xFB69 [LIST 1].
                      2) Chomper speed is faster in these two levels: xFB6D and xFB71 [LIST 1].
                      3) Chomper speed is deadly in these two levels: xFB75 and xFB79 [LIST 1].

                      ---

                      10 more guard trigger events:

                      The guard trigger events on the original ROM do not allow two guard trigger events in the same level. So I have added more events and coded them in a way that allows multiple guard trigger events in one level. To enable more than one guard trigger event in a level, simply use the same level id for two or more events.


                      1)
                      xFBCB = Level (level where event happens) [LIST 1]
                      xFC2E = Guard (guard type whose defeat triggers event) [LIST 2]
                      xFC3A = Room (room where a tile is triggered after guard defeat) [LIST 4]
                      xFC3C = Action (whether a gate opens or closes) [LIST 7]
                      xFC3E = Tile (tile that is being triggered) [LIST 5]

                      2)
                      xFBCF = Level
                      xFC46 = Guard
                      xFC52 = Room
                      xFC54 = Action
                      xFC56 = Tile

                      3)
                      xFBD3 = Level
                      xFC5E = Guard
                      xFC6A = Room
                      xFC6C = Action
                      xFC6E = Tile

                      4)
                      xFBD7 = Level
                      xFC76 = Guard
                      xFC82 = Room
                      xFC84 = Action
                      xFC86 = Tile

                      5)
                      xFBDB = Level
                      xFC8E = Guard
                      xFC9A = Room
                      xFC9C = Action
                      xFC9E = Tile

                      6)
                      xFBDF = Level
                      xFCA6 = Guard
                      xFCB2 = Room
                      xFCB4 = Action
                      xFCB6 = Tile

                      7)
                      xFBE3 = Level
                      xFCBE = Guard
                      xFCCA = Room
                      xFCCC = Action
                      xFCCE = Tile

                      8)
                      xFBE7 = Level
                      xFCD6 = Guard
                      xFCE2 = Room
                      xFCE4 = Action
                      xFCE6 = Tile

                      9)
                      xFBEB = Level
                      xFCEE = Guard
                      xFCFA = Room
                      xFCFC = Action
                      xFCFE = Tile

                      10)
                      xFBEF = Level
                      xFD06 = Guard
                      xFD0F = Room
                      xFD11 = Action
                      xFD13 = Tile


                      Hack within a hack: Link two or more guard trigger events

                      If you want to utilize two or more guard trigger events to occur in the same level and after defeating the same guard, you can do what I call: "Hack the hack". By doing this you can set occurrences such as: Defeating one guard opens a gate and closes another at the same time, defeating one guard opens two or more gates...etc

                      Link event 1 to event 2: xFC3F to $20
                      Link event 2 to event 3: xFC57 to $20
                      Link event 3 to event 4: xFC6F to $20
                      Link event 4 to event 5: xFC87 to $20
                      Link event 5 to event 6: xFC9F to $20
                      Link event 6 to event 7: xFCB7 to $20
                      Link event 7 to event 8: xFCCF to $20
                      Link event 8 to event 9: xFCE7 to $20
                      Link event 9 to event 10: xFCFF to $20

                      ---

                      Guard skill modifier:

                      This hack can somewhat compensate for the inferiority that SNES PoP1 has compared to DOS in term of guard skills. You can apply multiple skill changes in one level.

                      1) In level x7B99 [LIST 1], apply skill x7C68 to the x7C5C guard [LIST 2].
                      2) In level x7B9D [LIST 1], apply skill x7C7F to the x7C73 guard [LIST 2].
                      3) In level x7BA1 [LIST 1], apply skill x7C96 to the x7C8A guard [LIST 2].
                      4) In level x7BA5 [LIST 1], apply skill x7CAD to the x7CA1 guard [LIST 2].
                      5) In level x7BA9 [LIST 1], apply skill x7CC4 to the x7CB8 guard [LIST 2].
                      6) In level x7BAD [LIST 1], apply skill x7CDB to the x7CCF guard [LIST 2].
                      7) In level x7BB1 [LIST 1], apply skill x7CF2 to the x7CE6 guard [LIST 2].
                      8) In level x7BB5 [LIST 1], apply skill x7D09 to the x7CFD guard [LIST 2].
                      9) In level x7BB9 [LIST 1], apply skill x7D20 to the x7D14 guard [LIST 2].
                      10) In level x7BBD [LIST 1], apply skill x7D34 to the x7D2B guard [LIST 2].
                      11) In level x7BF9 [LIST 1], apply skill x7D4B to the x7D3F guard [LIST 2].
                      12) In level x7BFD [LIST 1], apply skill x7D62 to the x7D56 guard [LIST 2].
                      13) In level x7C01 [LIST 1], apply skill x7D79 to the x7D6D guard [LIST 2].
                      14) In level x7C05 [LIST 1], apply skill x7D90 to the x7D84 guard [LIST 2].
                      15) In level x7C09 [LIST 1], apply skill x7DA7 to the x7D9B guard [LIST 2].
                      16) In level x7C0D [LIST 1], apply skill x7DBE to the x7DB2 guard [LIST 2].
                      17) In level x7C11 [LIST 1], apply skill x7DD5 to the x7DC9 guard [LIST 2].
                      18) In level x7C15 [LIST 1], apply skill x7DEC to the x7DE0 guard [LIST 2].
                      19) In level x7C19 [LIST 1], apply skill x7E03 to the x7DF7 guard [LIST 2].
                      20) In level x7C1D [LIST 1], apply skill x7E17 to the x7E0E guard [LIST 2].

                      ---

                      Trigger potion:

                      Some mods of the DOS PoP1 have this potion, and that gave me the idea to enable it on the SNES ROM. I have inserted occurrences where the blue poison (hurt potion) can behave as a trigger potion which can open/close a gate, open exit, or trigger any object.

                      1) In level xFD1B [LIST 1], drinking hurt potion in room xFDA4 [LIST 4] applies action xFDAF [LIST 7] to object located at room xFDAD [LIST 4], tile xFDB1 [LIST 5].
                      2) In level xFD1F [LIST 1], drinking hurt potion in room xFDB9 [LIST 4] applies action xFDC4 [LIST 7] to object located at room xFDC2 [LIST 4], tile xFDC6 [LIST 5].
                      3) In level xFD23 [LIST 1], drinking hurt potion in room xFDCE [LIST 4] applies action xFDD9 [LIST 7] to object located at room xFDD7 [LIST 4], tile xFDDB [LIST 5].
                      4) In level xFD27 [LIST 1], drinking hurt potion in room xFDE3 [LIST 4] applies action xFDEE [LIST 7] to object located at room xFDEC [LIST 4], tile xFDF0 [LIST 5].
                      5) In level xFD2B [LIST 1], drinking hurt potion in room xFDF8 [LIST 4] applies action xFE03 [LIST 7] to object located at room xFE01 [LIST 4], tile xFE05 [LIST 5].
                      6) In level xFD2F [LIST 1], drinking hurt potion in room xFE0D [LIST 4] applies action xFE18 [LIST 7] to object located at room xFE16 [LIST 4], tile xFE1A [LIST 5].
                      7) In level xFD33 [LIST 1], drinking hurt potion in room xFE22 [LIST 4] applies action xFE2D [LIST 7] to object located at room xFE2B [LIST 4], tile xFE2F [LIST 5].
                      8) In level xFD37 [LIST 1], drinking hurt potion in room xFE37 [LIST 4] applies action xFE42 [LIST 7] to object located at room xFE40 [LIST 4], tile xFE44 [LIST 5].
                      9) In level xFD3B [LIST 1], drinking hurt potion in room xFE4C [LIST 4] applies action xFE57 [LIST 7] to object located at room xFE55 [LIST 4], tile xFE59 [LIST 5].
                      10) In level xFD3F [LIST 1], drinking hurt potion in room xFE61 [LIST 4] applies action xFE6C [LIST 7] to object located at room xFE6A [LIST 4], tile xFE6E [LIST 5].
                      11) In level xFD43 [LIST 1], drinking hurt potion in room xFE76 [LIST 4] applies action xFE81 [LIST 7] to object located at room xFE7F [LIST 4], tile xFE83 [LIST 5].
                      12) In level xFD47 [LIST 1], drinking hurt potion in room xFE8B [LIST 4] applies action xFE96 [LIST 7] to object located at room xFE94 [LIST 4], tile xFE98 [LIST 5].
                      13) In level xFD4B [LIST 1], drinking hurt potion in room xFEA0 [LIST 4] applies action xFEAB [LIST 7] to object located at room xFEA9 [LIST 4], tile xFEAD [LIST 5].
                      14) In level xFD4F [LIST 1], drinking hurt potion in room xFEB5 [LIST 4] applies action xFEC0 [LIST 7] to object located at room xFEBE [LIST 4], tile xFEC2 [LIST 5].


                      For multiple trigger events:

                      Link 1 to 2: xFDB2 to $20
                      Link 2 to 3: xFDC7 to $20
                      Link 3 to 4: xFDDC to $20
                      Link 4 to 5: xFDF1 to $20
                      Link 5 to 6: xFE06 to $20
                      Link 6 to 7: xFE1B to $20
                      Link 7 to 8: xFE30 to $20
                      Link 8 to 9: xFE45 to $20
                      Link 9 to 10: xFE5A to $20
                      Link 10 to 11: xFE6F to $20
                      Link 11 to 12: xFE84 to $20
                      Link 12 to 13: xFE99 to $20
                      Link 13 to 14: xFEAE to $20

                      ---

                      End game after completing a level:

                      Let $y = id of the last level of the mod [LIST 1]. Make these offset changes:

                      xE9C2 to $y
                      xEE3F to $y
                      xEF7A to $y+1
                      xFA1A to $y+1
                      xFFED to $y

                      Utilize level 20's special exit to complete the new last level by entering the princess room, as seen in the original ROM.
                      -Edit level 20 exit: Level x8306 [LIST 1], room x830D [LIST 4], exit left

                      ==============================================================================================

                      To do list:

                      1) Figure out how to increase time limit.
                      2) Find out details on hacking checkpoints and two-part levels.
                      3) Edit what occurs during shadow steal.
                      4) Edit what occurs during the original level 15 Jaffar and shadow appearances.
                      5) Find out more information about level 17 and the monster.
                      6) Find out details on room 7 in level 19.
                      7) Figure out how to break level barriers to have a total of 27 levels.

                      ==============================================================================================
User avatar
starwindz
Sultan
Sultan
Posts: 133
Joined: March 8th, 2009, 4:48 pm

Re: Hacking the SNES ROM

Post by starwindz »

Great technical information! I appreciate your splendid work and it will be also very helpful for PC-to-SNES level conversion. Thank you very much. :)
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 »

thank you! highly complementary with "pr1snesleved!"
>>>>>>>>>>>>>>>>>>>> http://www.youtube.com/user/spartacus735 <<<<<<<<<<<<<<<<<<<< the channel of prince of persia snes mod
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 »

Kaslghnoon, I'm assuming this research was all done by you?
I would like to add more events to the Modding Timeline I'm working on and I think a lot of information about the SNES research and hacking is still missing.
If anyone has any suggestions/additions/corrections for the timeline, please let me know.
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 »

Kaslghnoon wrote:Download a headerless ROM of the U.S Konami version to perform the upcoming simple hex modifications:
http://www.mediafire.com/?yumba2flkc34far
That file has been removed from MediaFire.
All the SNES roms (US, EU, JP; headerless versions) are available here:
http://www.popot.org/get_the_games.php?game=1_SNES
Kaslghnoon
Sultan
Sultan
Posts: 153
Joined: February 27th, 2010, 8:35 pm
Location: United States

Re: Hacking the SNES ROM

Post by Kaslghnoon »

Norbert wrote:Kaslghnoon, I'm assuming this research was all done by you?
I would like to add more events to the Modding Timeline I'm working on and I think a lot of information about the SNES research and hacking is still missing.
If anyone has any suggestions/additions/corrections for the timeline, please let me know.
Yes, all done by me, but inspired by David. Had it not been for the development of Pr1SnesLevEd, I wouldn't have gone far beyond interpreting a few Game Genie codes.
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 »

Kaslghnoon wrote:Yes, all done by me, but inspired by David.
So that first post... 14 November 2011 was when you first published all that? That's a lot of information.
If it is, I will add "Kaslghnoon about hacking the SNES ROM" to the timeline at 14 November 2011, with - when the circle/text is clicked - a link to this thread.
Again, if anyone (David, you, whoever) has any concrete suggestions/additions/corrections for the timeline, please let me know.
(Note to self: include more information about this and this.)

For DOS, we have this awesome document.
Maybe you and David could put together some kind of document like that, because right now all the information about SNES seems to be scattered around a bit.
Other informative posts by David, for example, are located here.
A first document could just be something simple, maybe copy-paste whatever information is already available.
Give it some headers here and there, a proper lay-out (maybe add a table of contents). It's easy to have all the information in one place.
Then you and David can add your names in a credits section, so it's clear who did the work; maybe mention who did what.
All that would also make it easy for me, Jalal and others to add the document to our websites.
Kaslghnoon
Sultan
Sultan
Posts: 153
Joined: February 27th, 2010, 8:35 pm
Location: United States

Re: Hacking the SNES ROM

Post by Kaslghnoon »

Norbert wrote:So that first post... 14 November 2011 was when you first published all that? That's a lot of information.
Correct. I published this on 11-14-2011. It was first saved in a text file which I had been editing over the course of a few weeks. Once I was done with the text I opened this topic and pasted everything. It was edited probably once or twice before starwindz posted. Since I'm not a moderator, editing it would show and I wanted to avoid that confusion.
I still have the original text file saying it was last modified: Sunday, November 13, 2011, 6:04:36 PM.
Norbert wrote:For DOS, we have this awesome document.
Maybe you and David could put together some kind of document like that, because right now all the information about SNES seems to be scattered around a bit.
Other informative posts by David, for example, are located here.
A first document could just be something simple, maybe copy-paste whatever information is already available.
Give it some headers here and there, a proper lay-out (maybe add a table of contents). It's easy to have all the information in one place.
Then you and David can add your names in a credits section, so it's clear who did the work; maybe mention who did what.
All that would also make it easy for me, Jalal and others to add the document to our websites.
I don't know about David but I am a novice when it comes to fabricating a document on the caliber of "Prince of Persia Specifications of File Formats". With my current schedule, I am sorry to say that it might take a while. The only thing I can do at this point is add it to my temporarily-abandoned "To do list". :(

My interest is still there but the free time is not...
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 »

Kaslghnoon wrote:My interest is still there but the free time is not...
Life pulled a poirot on you. :P
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 »

Kaslghnoon wrote:For DOS, we have this awesome document.
Maybe you and David could put together some kind of document like that, because right now all the information about SNES seems to be scattered around a bit.
I've started to make a documentation about SNES formats. Currently the information about levels is mostly complete, everything else is practically not described yet.
I've attached it to this post.
Attachments
snes_formats_doc.zip
Incomplete documentation about SNES formats
(3.86 KiB) Downloaded 627 times
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 think the document I uploaded above would be at a better place at the Princed Wiki, so people don't have to download it to read it, and I could edit it easier.

I already have one thing to add, see here: viewtopic.php?p=11996#p11996
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 »

David wrote:I think the document I uploaded above would be at a better place at the Princed Wiki, so people don't have to download it to read it, and I could edit it easier.

I already have one thing to add, see here: viewtopic.php?p=11996#p11996
http://www.princed.org/w/index.php?title=SNES_format
(May need some reformatting here and there.)
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 »

From viewtopic.php?p=12873#p12873:
Iso wrote:Also, is there (or will there be) any way to make the prince start swordless in each level?

Code: Select all

01/EE07: AD 79 05     LDA $0579 ; current level
01/EE0A: D0 04        BNE $EE10 ; 0 means level 1
01/EE0C: A9 00        LDA #$00 ; don't have
01/EE0E: 80 02        BRA $EE12 ; else
01/EE10: A9 01        LDA #$01 ; have
01/EE12: 8D 32 05     STA $0532 ; possession of sword
To start without sword on all levels: xEE11 to $00
(Note: there is already a hack for having sword on all levels, it also modifies this part.)
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 »

From viewtopic.php?p=6431#p6431:
David wrote:
Iso wrote:Question though, is it possible to make loose tiles fall passed torches? Seems they disappear on impact.
If a loose floor falls into an object which has no floor attribute (or has wall attribute), the loose floor disappears (except if that object is a loose floor). So sorry, it isn't possible.
Actually, it's possible with this hack.
The relevant part of the code: (comments by me)

Code: Select all

01/D5D3: 20 FE AE    JSR $AEFE ; read object and flags of the tile where the current loose floor is
01/D5D6: 8D FE 07    STA $07FE
01/D5D9: C9 00       CMP #$00  ; check flags: not floor and not wall
01/D5DB: D0 12       BNE $D5EF ; if flags are different from 0: break the loose floor
01/D5DD: EB          XBA       ; if flags are 0, take a look at the object
01/D5DE: C9 00       CMP #$00  ; empty
01/D5E0: F0 35       BEQ $D617 ; if yes, let it fall through
01/D5E2: C9 1B       CMP #$1B  ; down only
01/D5E4: F0 31       BEQ $D617 ; if yes, let it fall through
01/D5E6: C9 02       CMP #$02  ; loose
01/D5E8: D0 05       BNE $D5EF ; if no, break the loose floor
01/D5EA: 20 28 D6    JSR $D628 ; if yes, make the other loose floor fall
01/D5ED: 80 28       BRA $D617
To allow loose floors to fall through floorless objects: xD5E9 to $2D (from $05)
User avatar
Iso
Sheikh
Sheikh
Posts: 48
Joined: January 15th, 2010, 11:34 pm

Re: Hacking the SNES ROM

Post by Iso »

Thank you Kaslghnoon and David again for all your hard work, you guys are awesome.

I have a question though about changing the Potion of Warp location. I can edit the room, column, and the facing direction without issues, but the game crashes if I try to change the row. In List 8 it says the values for the rows are 00/01/02, but the default value under the row id is 42. Any idea how to fix this?

Edit: I should mention I'm using the hacked rom.
Post Reply