Hacking the SNES ROM

Discuss PoP1 for SNES here.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5786
Joined: April 9th, 2009, 10:58 pm

Re: Hacking the SNES ROM

Post by Norbert »

David wrote: June 30th, 2018, 3:51 pmThis is the font used by PoP1 SNES: [...]

The font used for the credits also contains a few special "characters", as you can see here: [...]
I've not seen these before. Not in snes_graphics.zip, at least.
Thanks for the info.
David wrote: June 30th, 2018, 3:59 pmIt's JaffAAAARRRRrrrr! :lol:
:D

Off-topic, about much/many:
Spoiler: show
David wrote: June 30th, 2018, 7:13 pm(In case this has too much results, search instead for AC 2D 05 C0 38 C7 (one result) and AD 4B 05 C9 38 C7 (two results).)
David wrote: June 23rd, 2018, 12:22 pmSomehow I don't seem to remember as much songs from ESC 2015-2018 as from ESC 2011-2014.
(Emphasis mine.) These should be "many".
It's "much" for singular nouns, "many" for plural.
(The "expires much before" also seems off. Probably needs to be "way before" or something similar.)
User avatar
NITM-T
Sultan
Sultan
Posts: 182
Joined: July 29th, 2017, 12:10 am

Re: Hacking the SNES ROM

Post by NITM-T »

David wrote: June 30th, 2018, 4:10 pm
Norbert wrote: June 27th, 2018, 5:03 pm - Time Only Knows by NITM-T(**): Intro, Outro
- The Kingdom of the Dead by NITM-T(**): Intro (partial), Outro, Menus (partial), Various (1 entry)
- The Two Princesses by NITM-T(**): Intro, Credits (I) (1 entry), Menus (partial), Various (2 entries)
[...]
(**) The Portuguese characters aren't displayed properly by apoplexy. Not a big deal.
Do you mean these?
snes_text_pt.png

The "Ì" characters are byte 0xCC. In the game these appear as spaces. I don't know why did NITM-T use these, though.
The box characters are byte 0x0D, that is, newline.
Pretty simple. I don't know how to read HEX. I just copy and paste what you guys post here, as I said before. Then, for those "spaces" I just put them because when I'm typing, I do it on the right side where I can put letters instead try to guess which HEX is for that letter, y'know? Other games aren't not like that. I just don't know how to put accents. I mean, they work on the HEX editor, but the game doesn't show them. I think is because English don't has them or better, maybe is necessary do something with those HEXs or write new ones because there're mods with Portuguese words and they accents thing. I also thought is because our keyboard is different from yours, or course.
Anyway, this is not a problem for me. Since the game works cool, I'm cool :P
David wrote: June 30th, 2018, 4:10 pm Search: A2 78 20 99 E9
Change: 78 to the number of minutes you want (in hex).
That's is great, David! Before, we only had 100, 90, 60, 45 and 30, but with this new hack, is possible to do a new time.

By the way, what Norbert post about my mods, they're from the first versions. Alt versions there're more modifications. But this means nothing, I'm just saying...
May the Moon light your path.
David
The Prince of Persia
The Prince of Persia
Posts: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Norbert wrote: June 30th, 2018, 11:02 pm
David wrote: June 30th, 2018, 3:51 pmThis is the font used by PoP1 SNES: [...]

The font used for the credits also contains a few special "characters", as you can see here: [...]
I've not seen these before. Not in snes_graphics.zip, at least.
Thanks for the info.
The fonts are documented here: http://www.princed.org/wiki/SNES_format ... 0x20000.29
00: menu/intro font tiles (256 uncompressed 2bpp tiles)
This is indeed missing from the ZIP, together with #70 (hitpoint tiles) and #73 (princess room torch tiles).
However, it seems that I have some newer extractor that can extract these.
74: ending font (stored in the same format as level background graphics)
This is included in the ZIP, but the palette is wrong, and the image ended up looking black.
David
The Prince of Persia
The Prince of Persia
Posts: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

NITM-T wrote: July 1st, 2018, 5:46 am That's is great, David! Before, we only had 100, 90, 60, 45 and 30, but with this new hack, is possible to do a new time.
I guess you're referring to this post by Kaslghnoon: viewtopic.php?p=10846#p10846 (search for "Edit time limit:")
I didn't even remember he had a hack for this.

I think his method is better than what I wrote yesterday, because you don't need to change the part that I called "part 3", which is quite nontrivial to do.
That's because Kaslghnoon's hack changes the starting value of the time counter (instead of the ending value).
So the counter will still contain $BEEB when there are 5 minutes left, just like in the original game, and so on.

So, Shauing, I think you should undo part 1 and part 2 if you already did them, and do the following instead:

At 0xEE77 write: A9 00 4C C6 FE
At 0xFEC6 write: 8D 2D 05 A9 00 8D 2E 05 A9 00 4C 7D EE
(I copied these from Kaslghnoon's 0.smc. I hope he won't mind.)

Then calculate the following: (120 - minutes) * 425, and convert it to hex.
The hex number should have four digits. Write the first two digits to 0xFECA and the last two digits to 0xEE78.
(This is how Kaslghnoon made the options in his post. Except that his numbers are off by a few ticks, I don't know why.)
User avatar
Shauing
Calif
Calif
Posts: 435
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

David wrote: June 30th, 2018, 7:13 pm
Part 3: When the game shows time by itself:

Code: Select all

times when time is shown:
01:EA11: WORD $0000,$084d,$109a,$18e7,$2134,$2981,$31ce,$3a1b,$4268,$4ab5,$5302,$5b4f,$639c,$6be9,$7436,$7c83,$84d0,$8d1d,$956a,$9db7,$a604,$ae51,$b69e,$beeb,$c094,$c23d,$c3e6,$c590,$c73d,$ffff
Err, I'm not sure if I want to go into this...
This table basically says that the time is shown every 5 minutes (5*425=$084D) until there are only 5 minutes left (115*425=$BEEB), then every minute, then about one second after time is up ($C73D).
The problem is that since time expires much before the elapsed time counter reaches the original 120 minutes, these values are all off, and the player won't get the warnings in every minute before the time expires.
I don't know if this would be a problem for you.
I think I figured it out on my own. I had to find the offset first (It was a wild guess for me, but I took the 01:E943 of part 1, I checked what offset was and used a decimal to hex converter for 01:EA11 to find it, and sure did: offset 0x59921.
From there I changed the values starting from $8d1d, calculated to get the numbers for the 86 to 90 minutes and a second, and again used the decimal to hex converter, and with that the other values end up as: $8ec6, $906f, $9218, $93c1, $6f95, and the rest as $ffff. (Yes, I swapped the values when I wrote them in the offset). I am thinking though, in order to not waste those spaces, to start the ''time shown every minute'' at the ''10 minutes'' mark.

Checking my post of the hacks I wanted to do for my mod (as of today), I had to do a workaround for the mirror one as, like you said, if the kid jumps through and he is on his last HP, he will continue running; as there is still no hack to kill him if that's the case, I will have to design that level in a way that there would always be something to possibly kill him after every mirror he jumps.

The only thing left for now, is to see if its possible for the guards/bosses to utilize some of the Kid's graphics.
This is mainly for those deaths (by crusher, chomper or guillotine - as all of them seem to be inmune to fire and log -) where they do not have specific graphics if they are killed that way.
Another possible use is for the shadow to use the kid's graphics (and maybe still look transparent), so that he looks more like a clone of the kid.
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
User avatar
Shauing
Calif
Calif
Posts: 435
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

David wrote: July 1st, 2018, 9:55 am
NITM-T wrote: July 1st, 2018, 5:46 am That's is great, David! Before, we only had 100, 90, 60, 45 and 30, but with this new hack, is possible to do a new time.
I guess you're referring to this post by Kaslghnoon: viewtopic.php?p=10846#p10846 (search for "Edit time limit:")
I didn't even remember he had a hack for this.

I think his method is better than what I wrote yesterday, because you don't need to change the part that I called "part 3", which is quite nontrivial to do.
That's because Kaslghnoon's hack changes the starting value of the time counter (instead of the ending value).
So the counter will still contain $BEEB when there are 5 minutes left, just like in the original game, and so on.

So, Shauing, I think you should undo part 1 and part 2 if you already did them, and do the following instead:

At 0xEE77 write: A9 00 4C C6 FE
At 0xFEC6 write: 8D 2D 05 A9 00 8D 2E 05 A9 00 4C 7D EE
(I copied these from Kaslghnoon's 0.smc. I hope he won't mind.)

Then calculate the following: (120 - minutes) * 425, and convert it to hex.
The hex number should have four digits. Write the first two digits to 0xFECA and the last two digits to 0xEE78.
(This is how Kaslghnoon made the options in his post. Except that his numbers are off by a few ticks, I don't know why.)
Haha, I guess I imposed myself on a challenge by doing Part 3 on my own, but turns out there was an easier way; good that I do these on test copies first. I will check this out.
Perhaps Kaslghnoon's hacked ROM has different offsets due to the modifications he did to it.
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: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

NITM-T wrote: July 1st, 2018, 5:46 am Then, for those "spaces" I just put them because when I'm typing, I do it on the right side where I can put letters instead try to guess which HEX is for that letter, y'know? Other games aren't not like that.
Which "other games" do you mean?
NITM-T wrote: July 1st, 2018, 5:46 am I just don't know how to put accents. I mean, they work on the HEX editor, but the game doesn't show them. I think is because English don't has them or better,
That's simply because PoP1 SNES does not have accented letters in its font, see here: viewtopic.php?p=24199#p24199
EDIT: It's possible to edit this font using a tile editor. I'd recommend Tile Layer Pro.
After opening the ROM, select View -> Format -> Game Boy, then Edit -> Goto -> choose Hex, type 20114, click Go!
Now you should see the font, ready for editing.
EDIT: You can also use Tile Molester. (You mentioned it here.) There the menu items are called View -> Codes -> 2bpp planar, and Navigate -> Go To...
NITM-T wrote: July 1st, 2018, 5:46 am because there're mods with Portuguese words and they accents thing.
What mods do you mean?
User avatar
NITM-T
Sultan
Sultan
Posts: 182
Joined: July 29th, 2017, 12:10 am

Re: Hacking the SNES ROM

Post by NITM-T »

David wrote: July 1st, 2018, 9:55 am I guess you're referring to this post by Kaslghnoon: viewtopic.php?p=10846#p10846 (search for "Edit time limit:")
I didn't even remember he had a hack for this.
Yeah. Kaslghnoon left us a great stuff here together with his 0 ROM.
David wrote: July 1st, 2018, 11:46 am Which "other games" do you mean?
I saw a guy translating RPGs games, once. Didn't find them now...
Another game I tried to hack was Super Metroid. With SMILE tool, you can put a new story pretty easy, but to change words like Super Missile and Charge Beam, it's like this:

Image

See? It's not like PoP and you have to put those 28 (blue ones) after each letter. This one I marked is Super Missile. I look the HEXs at left side and put them there on HEX editor. AND, or course, I have they HEXs locations for each item. So, I don't need to do this on PoP. I just press Ctrl + F to find a word and I write a new one. But in case like Training 1, I asked for help because I didn't know where the number HEX location was to erase it. Then, you show me, remember?
David wrote: July 1st, 2018, 9:55 am What mods do you mean?
When I was a kid, there're Super Nintendo and Mega Drive cartridges who were in Portuguese. The main were Soccer games, but I didn't find any now who has a complete translation, but check these ones:

Castlevania: Symphony of the Night. Here we've these words: Mão direita/Mãos vazias (right hand/empty hands), Elmo do Dragão (Dragon Helm), Espada de Jóias (Jewel Sword).

Image

Breath of Fire. Here we've these words: Isto é horrível! (This is horrible!)

Image

Final Fantasy VI. Here we've these words (battle): Então (so/then), não (no/don't/not). For us, we need to know which we have to use in English since we only have "então" and "não" for them.
(Menu): Técnicas (skills), Relíquia (Relic).

Image

MegaMan X. Here we've these words: Especificações (specifications), Cabeça (head), sensível (sensitive).

Image

Terminator 2: Judgment Day. Here we've these words: Amanhã (tomorrow), Começa (starts) in this case: Começa hoje (starts today).

Image

By the way, the word "Especificações" has no "s" after the first "e". I think the person who made it, forgot to put it or something... And the letter "Ç" doesn't exist in the alphabet. It's something we use here for some words. This one is after "L" on keyboard. For USA keyboard is this ";;;;".

These mods can be find here: http://romhackers.org/modules/news/ (It's a site from here, so it's all in Portuguese).
David wrote: July 1st, 2018, 9:55 am That's simply because PoP1 SNES does not have accented letters in its font
So, how about these games I just posted? That's why I said: "maybe is necessary do something with those HEXs or write new ones because there're mods with Portuguese words and they accents thing".

Sorry, I can't explain these things, I just bring what I saw. So, one more time, this is could be like to do new songs that we already talked about. Those guys may have more tools that us. OR, when you say: "PoP1 SNES does not have accented letters in its font...", means that is possible that those ones has?

Since PS3 and X360 Consoles, a lot of games are translated and dubbed here, but big fans of their games, did that first, heh.
David wrote: July 1st, 2018, 9:55 am EDIT: You can also use Tile Molester. (You mentioned it here.) There the menu items are called View -> Codes -> 2bpp planar, and Navigate -> Go To...
EDIT: That's right. But it's not for me hahaha. I mentioned it because Shauing might could try it.
So, like that, they can create new letters and sprites. Then, you guys who understand that tool, could do that.
With your hint, I was possible to see those letters better. With the HEXs, are more easier.
I saw this video once. The guy used for Metroid Fusion:

May the Moon light your path.
David
The Prince of Persia
The Prince of Persia
Posts: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

NITM-T wrote: July 1st, 2018, 1:47 pm Another game I tried to hack was Super Metroid. [...]
See? It's not like PoP and you have to put those 28 (blue ones) after each letter.
So that game uses 2 bytes for each character.
PoP1 for the Genesis does the same: viewtopic.php?p=20008#p20008
NITM-T wrote: July 1st, 2018, 1:47 pm OR, when you say: "PoP1 SNES does not have accented letters in its font...", means that is possible that those ones has?
I think that in the games you showed, the translators added the accented letters to the font.
NITM-T wrote: July 1st, 2018, 1:47 pm With your hint, I was possible to see those letters better. With the HEXs, are more easier.
So, did you try what I wrote about editing the font of PoP1 SNES?
User avatar
NITM-T
Sultan
Sultan
Posts: 182
Joined: July 29th, 2017, 12:10 am

Re: Hacking the SNES ROM

Post by NITM-T »

David wrote: July 7th, 2018, 4:10 pm So that game uses 2 bytes for each character.
PoP1 for the Genesis does the same: viewtopic.php?p=20008#p20008
Yep, that's right. I'm glad that SNES PoP version is easier to do it, I mean, for me, since is my favorite one :P
David wrote: July 7th, 2018, 4:10 pm I think that in the games you showed, the translators added the accented letters to the font.
Uh-huh, that is what I'd said before with those programs.
David wrote: July 7th, 2018, 4:10 pm So, did you try what I wrote about editing the font of PoP1 SNES?
Not yet. If someday I want to make a new mod, I'll try it. Besides, I can tell only with my fingers how many Brazilian players play my mods hahaha. Most of people who play them are from USA and Mexico. So, isn't a big deal. I always want to do a full mod, but is too far to this happens or never...
May the Moon light your path.
User avatar
Shauing
Calif
Calif
Posts: 435
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

I read somewhere in this topic that the kid's palette is loaded in two halves. An idea I had (probably for an alternate palette version of my mod) was to make the kid have the palette like the box art/Genesis.
SNES Box Art Palette Mock-Up.png
SNES Box Art Palette Mock-Up.png (6.94 KiB) Viewed 6397 times
It would be possible that the second half can use either the red or blue palette and vice versa, in case I do use the red or blue palette's first half as well?
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: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: July 14th, 2018, 5:44 pm I read somewhere in this topic that the kid's palette is loaded in two halves.
Do you mean this? viewtopic.php?p=13581#p13581
I think you misunderstood something: It's not the kid's palette that has two halves.
It's the set of the 8 sprite palette slots of the SNES that has two halves, where each half can hold 4 palettes. (And each palette has 16 colors.)
What I wrote there is that the shadow's palette is loaded into a slot in the second half, because only those can be made transparent.
Shauing wrote: July 14th, 2018, 5:44 pm An idea I had (probably for an alternate palette version of my mod) was to make the kid have the palette like the box art/Genesis.

SNES Box Art Palette Mock-Up.png
Do you mean the "PoP2" prince, also known as the "Macintosh" prince? (That's what I see on your screenshot.)
Shauing wrote: July 14th, 2018, 5:44 pm It would be possible that the second half can use either the red or blue palette and vice versa, in case I do use the red or blue palette's first half as well?
Sorry, I don't understand what do you mean.
User avatar
Shauing
Calif
Calif
Posts: 435
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

David wrote: July 14th, 2018, 6:28 pm Do you mean this? viewtopic.php?p=13581#p13581
I think you misunderstood something: It's not the kid's palette that has two halves.
It's the set of the 8 sprite palette slots of the SNES that has two halves, where each half can hold 4 palettes. (And each palette has 16 colors.)
What I wrote there is that the shadow's palette is loaded into a slot in the second half, because only those can be made transparent.
Oh, I see.
David wrote: July 14th, 2018, 6:28 pm Do you mean the "PoP2" prince, also known as the "Macintosh" prince? (That's what I see on your screenshot.)
Yes. The problem is that the pants and turban share the same color.
SNES Box Art Palette In-Game.png
SNES Box Art Palette In-Game.png (6.94 KiB) Viewed 6393 times
David wrote: July 14th, 2018, 6:28 pm Sorry, I don't understand what do you mean.
For example, here I altered the kid's red palette:
Red Palette Altered.png
Red Palette Altered.png (11.14 KiB) Viewed 6393 times
I want to know if it is possible to use the kid's pants and shoes from this altered red palette in conjunction with the clothes and turban from the modified POP2-esque Prince palette, and if it also possible to do it vice versa as well.
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: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: July 14th, 2018, 7:06 pm I want to know if it is possible to use the kid's pants and shoes from this altered red palette in conjunction with the clothes and turban from the modified POP2-esque Prince palette, and if it also possible to do it vice versa as well.
It *might* be possible to use multiple palettes within the same sprite, because what you see as a single sprite on the SNES is actually made from multiple hardware sprites, where each is 16×16 pixels.
Every hardware sprite can use a separate palette.
So we might be able to use a different palette for the piece that contains the prince's turban, for example.

Here is a hack that demonstrates what I mean:
Search: B5 07 29 07 0A
Change to: B5 05 29 07 0A
Alternatively, change to: B5 05 29 0E EA

With this hack, different parts of the prince (and the guards) will appear with different palettes. :)
(This hack tells the game to use the index of the piece/tile as the palette index.)

Now I just need to figure out how to restrict the different palettes to the topmost part, which contains the prince's head. (Or the bottom part, which contains his feet.)
Oh yeah, and I need to limit this effect to the prince. The guards don't need this.


The relevant part of the disassembly:
Spoiler: show

Code: Select all

process tile index:
00:F1F1: b5 05       LDA $05,X
00:F1F3: 29 ff 01    AND #$01ff
00:F1F6: 99 02 00    STA $0002,Y
00:F1F9: e2 20       SEP #$20
process Xpos and Ypos:
00:F1FB: b5 03       LDA $03,X
00:F1FD: eb          XBA
00:F1FE: b5 01       LDA $01,X
00:F200: c2 20       REP #$20
00:F202: 99 00 00    STA $0000,Y
00:F205: e2 20       SEP #$20
process palette:
00:F207: b5 07       LDA $07,X
00:F209: 29 07       AND #$07
00:F20B: 0a          ASL
00:F20C: 19 03 00    ORA $0003,Y
00:F20F: 99 03 00    STA $0003,Y
User avatar
Shauing
Calif
Calif
Posts: 435
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

David wrote: July 15th, 2018, 7:32 pm
It *might* be possible to use multiple palettes within the same sprite, because what you see as a single sprite on the SNES is actually made from multiple hardware sprites, where each is 16×16 pixels.
Every hardware sprite can use a separate palette.
So we might be able to use a different palette for the piece that contains the prince's turban, for example.

Here is a hack that demonstrates what I mean:
Search: B5 07 29 07 0A
Change to: B5 05 29 07 0A
Alternatively, change to: B5 05 29 0E EA

With this hack, different parts of the prince (and the guards) will appear with different palettes. :)
(This hack tells the game to use the index of the piece/tile as the palette index.)

Now I just need to figure out how to restrict the different palettes to the topmost part, which contains the prince's head. (Or the bottom part, which contains his feet.)
Oh yeah, and I need to limit this effect to the prince. The guards don't need this.


The relevant part of the disassembly:
Spoiler: show

Code: Select all

process tile index:
00:F1F1: b5 05       LDA $05,X
00:F1F3: 29 ff 01    AND #$01ff
00:F1F6: 99 02 00    STA $0002,Y
00:F1F9: e2 20       SEP #$20
process Xpos and Ypos:
00:F1FB: b5 03       LDA $03,X
00:F1FD: eb          XBA
00:F1FE: b5 01       LDA $01,X
00:F200: c2 20       REP #$20
00:F202: 99 00 00    STA $0000,Y
00:F205: e2 20       SEP #$20
process palette:
00:F207: b5 07       LDA $07,X
00:F209: 29 07       AND #$07
00:F20B: 0a          ASL
00:F20C: 19 03 00    ORA $0003,Y
00:F20F: 99 03 00    STA $0003,Y
It is interesting to see that many palettes can be used in one sprite.
And yeah, on the second hack for several animations the upper half of the pants swap between red or white, but for some frames it also changes the colors of parts of the head, body or shoes.

It would be interesting if this can be possible for the kid, and probably for the guards as well (if somebody wants to). It could make each mod more unique-in-looks, and less monochrome-y.
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