MDbtroid - RELEASED!

Got Metroid fanart, fanfiction, music, or any other creative endeavor you want to share? This is the place!

Moderator: Moderators

Infinity's End

User avatar

MDB Staff - Designer
 
Posts: 4884
Joined: 05.05.07 11:04am
Location: Austin, TX

MDbtroid - RELEASED!

Postby Infinity's End » 05.10.10 5:01pm

MDbtroid has been RELEASED! Feel free to use this thread for any feedback or comments on my hack. Thanks for playing! :D

-------

Hey all.
I was just trying to dabble with some Metroid tile editing -- mainly just for fun.
I wanted to focus on editing the title screen so it resembles the real Metroid logo instead of the straight up-and-down version that we got.
We are all familiar with the Japanese version:
Image
And then our version:
Image
So I made my own version, loosely based on the one from MII, and mixing it with the style used in the Japanese M1 title screen:
Image

So here's where my main questions lie:
    How do I do more than just edit the tiles so the graphics look the way I want it to?
    I know I have to edit the tiles eventually, but how do I actually hack the rom so it takes from the NEW tiles instead of just using what's already there?
    What are the best tile editing/NES ROM hacking software apps to use? (or which do you prefer?)

Remember, this is clearly more than just a simple tile edit -- I want to go in there and actually change the graphics of the title screen completely.

Thanks in advance, guys.

PS - if you're going to post something like, "I don't know anything about this," or "I can't help you," please don't bother posting at all.
Image
ImageVisit our DA Gallery! Over 3,100 unique artworks and still growing!

Balkoth

Omega Metroid
 
Posts: 848
Joined: 04.10.10 8:02am
Location: Western New York, USA

Re: Any tile-editor/NES ROM hacker pros out there?

Postby Balkoth » 05.10.10 7:42pm

I can help you.

You can use a Tile Editor utility to find and modify the desired tiles.

There is a great list on Zophar's Domain NES rom graphics hacking section.

I can vouch for this site, for I used to hack Pokemon roms to pieces when I was a kid.
Try the utilities which suit your needs. :)
When somebody tells me he doesn't believe in violence, I punch him in the face to inform him of its existence.

Infinity's End

User avatar

MDB Staff - Designer
 
Posts: 4884
Joined: 05.05.07 11:04am
Location: Austin, TX

Re: Any tile-editor/NES ROM hacker pros out there?

Postby Infinity's End » 05.10.10 7:51pm

Thanks for your response.
I understand I need a Tile Editing application.
I've downloaded and tried to decipher several of them.
What I seemingly CAN'T do with these apps, is completely re-arrange the tiles on the title screen to make them look like whatever I want.

The Metroid title screen uses several of the same tiles. (It was easy to do for a developer and probably took a very short amount of time. That's why the M1 title screen lettering looks so shitty.) These are repeated in certain spots -- the new graphic I am making requires extra bytes of memory that simply editing the tiles will not suffice. Or if there IS an easy way to add more bytes AND rearrange the code/data that the titlescreen uses to draw its graphics, then I am unaware and unsure what to use in this regard.

I have a feeling that I will need to use a combination of Editroid and possibly another tile editing application to get my result. But I have absolutely no idea where to start.
Image
ImageVisit our DA Gallery! Over 3,100 unique artworks and still growing!

Balkoth

Omega Metroid
 
Posts: 848
Joined: 04.10.10 8:02am
Location: Western New York, USA

Re: Any tile-editor/NES ROM hacker pros out there?

Postby Balkoth » 05.10.10 8:09pm

I think I know how to do it now, but it's hard to explain.

I recommend you get a hex editor if you don't have one yet, as they're very important for some rom-hacking projects.
If you know the hex values of the tiles on the original title screen, try opening up your rom in a Hex Editor and searching for some of those hex values from left-to-right.

You can then edit those hex values to match those corresponding to your custom tiles. Of course, this is simply an educated guess.
When somebody tells me he doesn't believe in violence, I punch him in the face to inform him of its existence.

mental

Ridley
 
Posts: 2897
Joined: 07.14.07 8:35pm
Location: The Moon

Re: Any tile-editor/NES ROM hacker pros out there?

Postby mental » 05.10.10 10:02pm

Ok, so ... roughly speaking there are three sorts of data involved here: pattern, name, and attribute. Pattern data are the actual 8x8 pixel tile images. Name data dictate the arrangement of particular patterns onscreen, and attribute data control the base color for every 2x2 group of onscreen tiles.

For this, you mostly need to be concerned with pattern and name data. There are plenty of editors which will let you directly edit pattern data in the ROM; there are fewer special-purpose editors which support editing name data, and name data is harder to locate visually. You'll probably need to look at a disassembly of the game code to find the offsets in the ROM of the title screen name data. I took a preliminary look over the disassembled source posted on the site, but the offset wasn't immediately obvious.

Excluding memory mapper tricks (as done by e.g. SMB3), for backgrounds the NES PPU can only map 256 distinct patterns onscreen at a time. So once you find the block of pattern data used for the title screen (which should be possible visually in a good tile editor), you'll need to figure out how many unused tiles you have to work with.

This means you'll need to figure out what your pattern budget is, and then rework your design accordingly. The NES display is 32x30 tiles large; that translates to 960 tile positions. 256 unique patterns are only just enough to cover a quarter of that area, and you will have to take into account the tiles which are already required for the rest of the title screen. It's been a while since I've looked at the Metroid ROM, but the situation may not be as dire as it could be -- I think the US version has tile data from both the US and Japanese title screens; if they both lie within the same 256-pattern region you may be able to reuse all those patterns. But you'll need to look and see.

Anyway, by contrast, the name data, once you find it, shouldn't be too hard to edit using a general-purpose hex-editor: it's just one byte per tile, where each byte is an index into the pattern table.

Let me know if more detail would help.

Edit: your current design is 26x7, which is 182 tiles. Might end up with enough unused patterns to do it...

Edit 2: I realized how to find the name table data offset without groveling through disassembly. Just find the ROM addresses of the first, say, 8 patterns in the top row of the "METROID" logo, and divide those offsets by 16 (each pattern is 16 bytes long). Then find the difference between those consecutive pattern indices and search the ROM for a sequence of 8 bytes having the same differences. That will locate the start of the name data for the title screen logo, and also let you derive the ROM offset of pattern 0 (which will be at the first name data byte * -16, relative to the address of the first logo pattern you found).
"The world will always be more delicious than it is useful." - Robert Capon

Infinity's End

User avatar

MDB Staff - Designer
 
Posts: 4884
Joined: 05.05.07 11:04am
Location: Austin, TX

Re: Any tile-editor/NES ROM hacker pros out there?

Postby Infinity's End » 05.10.10 10:34pm

Mental -- I cannot express in words how thankful I am for your response. I really, truly appreciate someone like you with some knowledge on the subject.
The graphic I made is exactly the same width and height, pixelwise, as the original Metroid 1 graphic. Like so:
Image

But I am just beginning to figure out the editing of the hex code to get my desired tiles to display properly. It won't be easy.
Unfortunately, Editroid doesn't allow you to go in there and directly edit the title screen to whatever you want -- but seeing as the Metroid source code is now fully documented, that might be a feature the guy could easily implement? :awesome:

I think I should be good as far as staying within the limits of the 256 onscreen tiles. The original title screen graphic uses a very small amount of tiles. So I'll try splitting up my graphic in photoshop and see if anything can be reused...I really doubt the text and other graphics (the Zebes surface and stars) use up 74 unique tiles, but we'll see.

btw-- here's the parts of the source code to be edited:

documented source code wrote:;Writes some blank spaces in row $20A0 (6th row from top).
L842F: .byte $20 ;PPU address high byte.
L8430: .byte $A8 ;PPU address low byte.
L8431: .byte $4F ;PPU string length.
L8432: .byte $FF ;Since RLE bit set, repeat 16 blanks starting at $20A8.

;Writes METROID graphics in row $2100 (9th row from top).
L8433: .byte $21 ;PPU address high byte.
L8434: .byte $03 ;PPU address low byte.
L8435: .byte $1C ;PPU string length.
L8436: .byte $40, $5D, $56, $5D, $43, $40, $5D, $43, $40, $5D, $5D, $43, $40, $5D, $5D, $63
L8446: .byte $62, $5D, $5D, $63, $40, $43, $40, $5D, $5D, $63, $1D, $16

;Writes METROID graphics in row $2120 (10th row from top).
L8452: .byte $21 ;PPU address high byte.
L8453: .byte $23 ;PPU address low byte.
L8454: .byte $1A ;PPU string length.
L8455: .byte $44, $50, $50, $50, $47, $44, $57, $58, $74, $75, $76, $77, $44, $57, $69, $47
L8465: .byte $44, $57, $69, $47, $44, $47, $44, $68, $69, $47

;Writes METROID graphics in row $2140 (11th row from top).
L846F: .byte $21 ;PPU address high byte.
L8470: .byte $43 ;PPU address low byte.
L8471: .byte $1A ;PPU string length.
L8472: .byte $44, $41, $7E, $49, $47, $44, $59, $5A, $78, $79, $7A, $7B, $44, $59, $6D, $70
L8482: .byte $44, $73, $72, $47, $44, $47, $44, $73, $72, $47

;Writes METROID graphics in row $2160 (12th row from top).
L848C: .byte $21 ;PPU address high byte.
L848D: .byte $63 ;PPU address low byte.
L848E: .byte $1A ;PPU string length.
L848F: .byte $44, $42, $7F, $4A, $47, $44, $5B, $5C, $FF, $44, $47, $FF, $44, $5B, $6F, $71
L849F: .byte $44, $45, $46, $47, $44, $47, $44, $45, $46, $47

;Writes METROID graphics in row $2180 (13th row from top).
L84A9: .byte $21 ;PPU address high byte.
L84AA: .byte $83 ;PPU address low byte.
L84AB: .byte $1A ;PPU string length.
L84AC: .byte $44, $47, $FF, $44, $47, $44, $5F, $60, $FF, $44, $47, $FF, $44, $7D, $7C, $47
L84BC: .byte $44, $6A, $6B, $47, $44, $47, $44, $6A, $6B, $47

;Writes METROID graphics in row $21A0 (14th row from top).
L84C6: .byte $21 ;PPU address high byte.
L84C7: .byte $A3 ;PPU address low byte.
L84C8: .byte $1A ;PPU string length.
L84C9: .byte $4C, $4F, $FF, $4C, $4F, $4C, $5E, $4F, $FF, $4C, $4F, $FF, $4C, $4D, $4E, $4F
L84D9: .byte $66, $5E, $5E, $64, $4C, $4F, $4C, $5E, $5E, $64

;Writes METROID graphics in row $21C0 (15th row from top).
L84E3: .byte $21 ;PPU address high byte.
L84E4: .byte $C3 ;PPU address low byte.
L84E5: .byte $1A ;PPU string length.
L84E6: .byte $51, $52, $FF, $51, $52, $51, $61, $52, $FF, $51, $52, $FF, $51, $53, $54, $52
L84F6: .byte $67, $61, $61, $65, $51, $52, $51, $61, $61, $65
Image
ImageVisit our DA Gallery! Over 3,100 unique artworks and still growing!

mental

Ridley
 
Posts: 2897
Joined: 07.14.07 8:35pm
Location: The Moon

Re: Any tile-editor/NES ROM hacker pros out there?

Postby mental » 05.10.10 10:53pm

Oh, awesome, that makes things much easier. Especially since it appears that the name data for the Metroid logo is split up as code, rather than being a single block of data, which would make other methods harder. We can look for these byte sequences in the ROM later.

So, the next step is to have a look at the ROM in Tile Layer Pro or something and find the ROM address of the upper-left corner tile in the logo. According to the annotated disassembly, that's pattern 64 ($40), so the start of the title screen patterns should lie 1024 (64*16) bytes before the ROM address of that particular pattern. Relative to that start address, you'll have any unused (or used by the logo) patterns in the subsequent 2048 bytes to work with.

(It might be worth editing all the apparently available tiles to a distinctive pattern and then playing the ROM, just to make sure you don't see that pattern appear anywhere and that all the patterns which look available really are.)
"The world will always be more delicious than it is useful." - Robert Capon

Infinity's End

User avatar

MDB Staff - Designer
 
Posts: 4884
Joined: 05.05.07 11:04am
Location: Austin, TX

Re: Any tile-editor/NES ROM hacker pros out there?

Postby Infinity's End » 05.10.10 11:42pm

I edited the graphic a little further to maximize any possibility of reused tiles... it's tedious, but pretty fun. Makes me feel like a real 8-bit game artist. :)
Like so:
Image
I've gotten it down to 7 sets of reusable tiles...I don't think there can be any more without seriously reworking the graphic. That leaves 148 more custom tiles. Whew!
Anyway, space doesn't matter to me because I can add bytes of data, right? Or there's extra space in the ROM anyway?

I guess my big question is: is there a way to add bytes of data to the ROM via this IPS patch that the game would ONLY utilize on this title screen and nowhere else in the game? Or am I stuck only working with the graphic data in the game as-is? I've been looking at all the tiles in Tile Layer Pro and a lot of them look like gibberish tiles to me...or are they all being used up?

I think my best bet is to learn from already made hacks (I've learned so much already from them) and go from there. Admittedly, I'm kinda scared to go in there and start editing hex code... -_-; But I know it's going to come down to that eventually.
Image
ImageVisit our DA Gallery! Over 3,100 unique artworks and still growing!

mental

Ridley
 
Posts: 2897
Joined: 07.14.07 8:35pm
Location: The Moon

Re: Any tile-editor/NES ROM hacker pros out there?

Postby mental » 05.11.10 12:02am

So, bad news. I dug into the disassembled source a bit more. The GFXInfo table has it copying 80 tiles (1280 bytes) from the ROM into PPU memory for the title screen/logo, starting at $1400 in the PPU (pattern index 64 in the bg pattern table). So you apparently have (at most) 80 unique patterns to work with. Less than 80 if some of those are also used for the other background elements. It loads another four patterns right after those 80, probably used for some distinct title screen element.

It might be possible to load additional stuff into other parts of the bg pattern table, but it's possible the game code isn't expecting those portions to get overwritten (some of that space, at least, is being used for elements like the font). Also changing the size of the GFXInfo table may have carry-on effects as far as requiring additional modifications to the game code.

Edit: So I had a look in the ROM image itself; The 80 patterns start at $183d0 in the image file (which maps to $8BE0 in the NES's address space). 64 of these patterns are used for the logo (two of those for the TM symbol), and the remaining 16 are used for the background elements. So it looks like you have 62 distinct patterns to work with.

Edit 2: It'd be interesting to work out how many unique tiles are in the Japanese version of the logo; I wonder if they had to work to the same 80-pattern constraint, or whether their tables were set up differently.
"The world will always be more delicious than it is useful." - Robert Capon

Infinity's End

User avatar

MDB Staff - Designer
 
Posts: 4884
Joined: 05.05.07 11:04am
Location: Austin, TX

Re: Any tile-editor/NES ROM hacker pros out there?

Postby Infinity's End » 05.11.10 12:21am

mental wrote:Edit: So I had a look in the ROM image itself; The 80 patterns start at $183d0 in the image file (which maps to $8BE0 in the NES's address space). 64 of these patterns are used for the logo (two of those for the TM symbol), and the remaining 16 are used for the background elements. So it looks like you have 62 distinct patterns to work with.

Shit.

So even if I was to take away the Zebes surface graphic, and use some of those tiles and the TM as well, I still wouldn't have enough? Guess I'll have to redraw the sprite... :(

Edit : looking at the original Japanese graphic for the title screen it uses (i think) around 62 custom patterns. son of a bitch! :P
Edit 2: I'm NOT going to let this minor setback force me to quit. I WILL DO THIS.
Image
ImageVisit our DA Gallery! Over 3,100 unique artworks and still growing!

mental

Ridley
 
Posts: 2897
Joined: 07.14.07 8:35pm
Location: The Moon

Re: Any tile-editor/NES ROM hacker pros out there?

Postby mental » 05.11.10 12:49am

The cheap solution is probably to shrink the logo to 12x5 tiles or 10x6 or so.
"The world will always be more delicious than it is useful." - Robert Capon

Infinity's End

User avatar

MDB Staff - Designer
 
Posts: 4884
Joined: 05.05.07 11:04am
Location: Austin, TX

Re: Any tile-editor/NES ROM hacker pros out there?

Postby Infinity's End » 05.11.10 4:11am

I went back and reworked the logo to much more closely match that of the Japanese logo and based it off its dimensions (192x56):
Image
There is still some editing left to do; I'm not completely satisfied with it. I worked on this very late b/c I had insomnia... so I was very tired and delirious when I made it. I-)


I am pretty sure that if the Japanese logo can be displayed on the title screen, so can this one. I just have to figure out exactly how. I was mistaken what I said before. It's obvious that the Japanese title screen graphic uses more than 60 original tiles.... The graphic itself is 24 patterns by 7 patterns (192x56). The line of code that's completely blank should be able to be filled in with tiles (theoretically). UNLESS they used the space in the original Japanese ROM where the Suitless Samus tiles are... it shows up right below it in TLP.

I hope to talk to the creator of Editroid soon and see how he feels about the subject.

EDIT - I found a copy of the FDS version of Metroid to see if I could gain some insight on how the title screen worked. The results were very interesting:
Image
It's very apparent that there's way more than 60 unique pattern tiles here (my count was 141 if you don't count the placeholder katakana). So how do I take this information and apply it to the US ROM?

EDIT 2 - before I stop for the day, I updated the main title graphic (as seen above). I also colorized the Metroid II titlescreen just for fun. It's 19x5 patterns big.
Image
Maybe since it's much smaller, I should try integrating this graphic to the titlescreen instead just to start out and go from there?

EDIT 3
- without fooling around with code -- I did a very simple hack of the Metroid X title screen... usingi the MII title graphic:
Image
I REFUSE to believe that there is no way around the graphic limitation! There HAS to be a way I can add more patterns to the title screen.... right?!?i For example -- If I was to take the above graphic and make it fill in completely, I would need 6 more unique patterns. That's not too difficult to work with, isn't it? FWIW, the Zebes surface is made up of 15 patterns.
Image
ImageVisit our DA Gallery! Over 3,100 unique artworks and still growing!

Kejardon

Metroid
 
Posts: 94
Joined: 05.08.07 11:27pm

Re: Any tile-editor/NES ROM hacker pros out there?

Postby Kejardon » 05.11.10 7:04pm

(I'm not an NES hacker, why am I doing this???)

It's possible to do pretty much anything realistic, the better question is usually 'How much work will it be?'

The NES version uses a bunch of extra tiles for the password system. As the FDS version uses SRAM, it doesn't need the tiles for the password system.
You might be able to have the game load a different pattern table when you originally start up the game, and then if the player goes to the password screen, load the original pattern table then (or actually a better spot may be the START CONTINUE screen). Off the top of my head, that would be the most effective solution, though it of course requires extra space and most likely a bit of programming.
Alternatively, you may be able to scavenge tiles from the original set of tiles that aren't actually used. This should be able to work without extra space or programming, but I don't know how much you can actually get out of it.

Also, I've learned more about NES graphics in the last hour than I ever knew before. Fun waste of an hour, I guess.

::edit:: I probably should have read the topic more carefully before I posted. I'm not sure what the bottom of the PPU graphics I was looking at a while ago were, but apparently that part of the pattern table isn't even written yet during the title screen.
Soo, it sounds like a semi-easy enlarge-and-move. I don't know how much more difficult that will be on the NES though. I haven't opened the rom in a hex-editor yet.

::edit2:: Wow, the rom really is stuffed full. You'd have to expand the rom I guess to add extra tile information, which will then require some programming. That or optimize other parts of the rom to make room.

Infinity's End

User avatar

MDB Staff - Designer
 
Posts: 4884
Joined: 05.05.07 11:04am
Location: Austin, TX

Re: Any tile-editor/NES ROM hacker pros out there?

Postby Infinity's End » 05.11.10 8:39pm

Hey, Kejardon! Thanks for responding!

Yeah, the patterns in the ROM are really chock-full, but I noticed there is some random katakana in there as placeholder. If I could, just theoretically, replace those patterns with something else, would I then have to program the ROM to take from them? Or how about the pattern table? Would I have to expand upon one of those specific pattern tables to increase the size of the ROM and then how many tiles I can use on the title screen? How does one go about doing that? o_O I know pretty much nothing about Assembly or NES coding...

I also noticed the Suitless Samus sprites appear directly after the title screen patterns, so they probably had to make due with a crappier title screen to clear up enough room for adding the Suitless Samus.

When I first started doing this, I felt like it wasn't that big of a request, but it seems I'm getting a little over my head... x_x

EDIT - Also wanted to mention -- As I'm sure you know, the FDS version does have a name entry (complete with katakana, hiragana, and the english alphabet) since it allowed you to save your game in 3 different slots. So it's possible they used some of the tiles from there for when they created the Password System.
Image
ImageVisit our DA Gallery! Over 3,100 unique artworks and still growing!

Kejardon

Metroid
 
Posts: 94
Joined: 05.08.07 11:27pm

Re: Any tile-editor/NES ROM hacker pros out there?

Postby Kejardon » 05.11.10 8:50pm

Suitless Samus isn't in the Famicom version? I never knew that.
You should be able to replace unused tiles in other graphics and load those graphics as well during the title screen, yes. Half of the PPU looks to be completely unused during the title screen, so there's room to fit it in, it's just a matter of loading it really. I'd have to do some disassembly to see how exactly to do so. What katakana were you planning on overwriting? It'd be best if it were all within 70 tiles, or 0x0700 contiguous bytes (if I counted right)
It's pretty typical to be able to save space with various programming techniques (e.g. I noticed the idle loop has what looks like a completely useless JMP that can simply be deleted and make room for 3 more bytes), so adding in a call to load the second group of tiles may be feasible without doing any ROM expansion.
Eh, why not. I'll take a look at it and see what I find.

::edit:: I found a flaw in fceuxdsp: It doesn't tell you where in the stack you are in its trace ouput. :( Makes it harder for me to go through the code quickly.

::edit2:: Ahahahaha... Metroid has LOADS of bloated code, I mean it even tries to write to SRAM every time you turn the NES on (I'm not an expert on the NES, but I think that does absolutely nothing as Metroid doesn't have SRAM?). It should be a piece of cake to fit in a call to load an extra pattern table. From what I see that'll look something like LDY #$XX : JSR $C7AB, replacing XX with the ID number of the table you want to load. The original title graphics have an ID of 15. Ideally the katakana you overwrite will be loaded to 1900 - 1FFF normally so you can just use the original ID load and not have to mess with anything.
Let's see how these entries work... 7 bytes each entry. The current entries are at C6E0 or... 1C6F0 in the ROM.
0: Which PRG-ROM to get data from (00-07) (Title is 06)
1-2: Location in PRG-ROM to get data from (assumably 8000-BFFF) (Title is 8BE0)
3-4: Location to put data in PPU (0000-1FFF I think) (Title is 1400)
5-6: Size of data transferred in bytes. (Title is 0500)
Entries easy to hijack/overwrite:
5: (06 9EF0 1800 0800) (ROM 1A000 - 1A6FF)
C: (06 B2A0 1900 0090) (ROM 1B2B0 - 1B33F)
D: (05 91B0 1D00 0300) (ROM 151C0 - 154BF)
10: (04 9360 1E00 0200) (ROM 11370 - 1156F)
Last edited by Kejardon on 05.11.10 9:53pm, edited 2 times in total.

Next

Return to Fan Creations

Who is online

Users browsing this forum: No registered users and 4 guests