(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
04-29-24 05:18 PM
0 users currently in ROM Hacking.
Acmlm's Board - I3 Archive - ROM Hacking - Question about an encoded (?) font New poll | |
Add to favorites | Next newer thread | Next older thread
User Post
RyogaMasaki
Newcomer


 





Since: 01-16-06
From: Orlando, FL

Last post: 6661 days
Last view: 6661 days
Posted on 01-28-06 10:41 PM Link | Quote
I'd like to translate Super Gussun Oyoyo 2 for SNES, mainly just as a learning experience before I move on to larger games. However.. the main text font is a little strangely encoded. The fonts are 16x16 1bpp in game, however, they are stored as 8x16 2bpp in the rom.


Apparently, it stores the left side is stored as one pallette entry, the right as another, and overlapping pixels as a third. I'm guessing it reads the left entry + overlapped for the left side, and right entry + overlapped for the right side. Erm. Those were probably very un-technical terms, I apologize.

Is this a common compression scheme, and is there any easy way to edit this to, say, insert an english font? Or will I have to convert the font by hand and insert it? Or am I completely wrong here? =P Any help would be appreciated. I'm just a translator, hacking isn't my forte.
(the full font is here if anyone is interested)


(edited by RyogaMasaki on 01-28-06 09:43 PM)
(edited by RyogaMasaki on 01-28-06 11:28 PM)
Apophis

Ropa








Since: 11-17-05

Last post: 6280 days
Last view: 6279 days
Skype
Posted on 01-28-06 11:17 PM Link | Quote
Did you try viewing them in 1bpp? TLP, tile molester, etc. have that option


(edited by Apofisu on 01-28-06 10:18 PM)
MathOnNapkins

1100

In SPC700 HELL


 





Since: 11-18-05

Last post: 6280 days
Last view: 6279 days
Posted on 01-29-06 09:41 AM Link | Quote
No, he's right. I just downloaded the rom, looked at it, and 1bpp didn't do the trick. I mean, obviously there is enough space in in a 2bpp tile for two 1bpp tiles. The particular graphic you showed a picture of is at $86360 for reference purposes. (The "a" in Japanese hiragana)

What you will have to do is write a program that will take the 2bpp encoded tiles and expand them into 1bpp tiles. Then after you edit them in a tile editor the program will have to reformat the tiles in the encoded manner and store them back into to the rom. This is by no means difficult and you should be able to find someone competent enough to do it, if you're not willing to do it yourself.

The other option is to change how the game handles and loads the fonts via an asm hack, and that is likely way more technical than programming a quick app in C++ or VB. As for the commonality of this scheme, I really don't know, but it seems like a decent idea if you were starving for space in your rom. However, from a cursory glance of the rom in a hex editor, there appears to be ample free space, so I don't really understand why they chose to do that.
RyogaMasaki
Newcomer


 





Since: 01-16-06
From: Orlando, FL

Last post: 6661 days
Last view: 6661 days
Posted on 01-29-06 02:14 PM Link | Quote
Ahh, thanks for the help. I wanted to be sure there wasn't some application out there already that could deal with this before I do something more complicated. Well, I suppose I could write something in VB to deal with it (I already wrote a small text dumper a while ago, so this shouldn't be TOO hard). Or just use that font compression bypass tutorial on Zophar's. I dunno. Anyway, thanks for the help. =)
Dragonsbrethren

440








Since: 12-01-05
From: New Jersey

Last post: 6467 days
Last view: 6467 days
Posted on 01-30-06 08:21 AM Link | Quote
Reminds me of FF3us/FF6's fonts.

By the way, it's sort of on the same subject, there's a tile editor that allows you to change the size of the tiles, I cannot remember the name, I need it to edit fonts for a project I might pick up.
Heian-794

Red Paratroopa


 





Since: 01-02-06

Last post: 6280 days
Last view: 6315 days
Posted on 01-31-06 05:24 PM Link | Quote
Super Gussun Oyoyo is a classic!

Anxiously awaiting your translation, Ryoga.

(Which reminds me... I need to make some progress on that Chrono Trigger script I'm working on for Zeality...)
Cellar Dweller +

Red Koopa









Since: 11-18-05
From: Arkansas

Last post: 6289 days
Last view: 6280 days
Posted on 01-31-06 06:05 PM Link | Quote
I'm no tile editing expert, but it looks like a linear 16x16 1bpp bitmap. I do not have the ROM (or have a tile editor handy) so I have not tested it myself.

Have you tried to dump the font with FEIDIAN?

http://feidian.sourceforge.net/
FreeDOS +

Giant Red Koopa
Legion: freedos = fritos








Since: 11-17-05
From: Seattle

Last post: 6279 days
Last view: 6279 days
Posted on 01-31-06 06:09 PM Link | Quote
holy crap FEIDIAN is awesome, especially for the fact that it's done in PHP
neotransotaku

Sledge Brother
Liberated from school...until MLK day








Since: 11-17-05
From: In Hearst Field Annex...

Last post: 6282 days
Last view: 6279 days
Posted on 01-31-06 06:15 PM Link | Quote
oh dang, this revolutionizes game tile editing, assuming the tiles are uncompressed of course... I think i'll be using this now...
MathOnNapkins

1100

In SPC700 HELL


 





Since: 11-18-05

Last post: 6280 days
Last view: 6279 days
Posted on 01-31-06 06:38 PM Link | Quote
Hrm... well that sounds like it might work, after reading the description. And I should correct my previous statement. I meant that each 2bpp encoded tile should be split up into two 2bpp tiles , BUT are only limited to 2 colors instead of 4. I think the tile editors can't show these specific ones b/c the format is wrong. I mean, 1bpp/2bpp/4bpp only denote color depth. They don't actually denote how the bits are arranged to create the effect of an image.

If FEIDIAN can't do it the procedure would be something like this for SNES 2bpp graphics:

A 2bpp tile is arranged in 2 byte chunks for each row. The first 2 byte chunk is for the top 8 pixel row. The second is for the next row down, and so on. So each 2bpp tile is 16 bytes long. Example:

FF 00 | FF 00 | 00 FF | 00 FF | FF FF | 0F FF | F0 FF | 07 F7

Now let's say each 2 byte chunk is called XX YY. The bits of XX form the first part (1's place) of the color index for each pixel on the line, going from left to right. The bits of YY form the 2's place of the respective color index.

So if you look at the last line in the above sequence (07 F7), the color indexes going from left to right are: {2, 2, 2, 2, 0, 3, 3, 3}

You can put these bytes into a hex editor, save it as a file, then load up with YY-CHR and see that it is how I say.

Okay, so to split it into two 2bpp tiles, we simply take one of the two byte chunks from each line and fill the other with zeroes. In our example the first 2bpp tile would be:

FF 00 | FF 00 | 00 00 | 00 00 | FF 00 | 0F 00 | F0 00 | 07 00

The second 2bpp tile would be:

00 00 | 00 00 | FF 00 | FF 00 | FF 00 | FF 00 | FF 00 | F7 00

Notice how if you ignore the second byte of each chunk in these two new tiles, you can see how I got these.

So... it would be convenient to make a program that does this split, then you edit in a tile editor the tiles the way you want them to be. Then have the same program recompress the tiles after you're done. I'm sure you can see how to pack them back together.

EDIT: Tested the method out in TLP and it worked seamlessly.


(edited by MathOnNapkins on 01-31-06 05:39 PM)
(edited by MathOnNapkins on 01-31-06 05:45 PM)
RyogaMasaki
Newcomer


 





Since: 01-16-06
From: Orlando, FL

Last post: 6661 days
Last view: 6661 days
Posted on 01-31-06 06:48 PM Link | Quote
Well, I decided to take the hard route and do an ASM hack. A few days later, I (more or less) have it:


Actually, the game deals with the font in a rather smart way. It makes two copies of each tile and masks either the low or high byte (the appropriate bitplane) with FF, so only 1bpp is actually read. Pretty smart. Anyway, I NOP'd the functions to make the right-side copy and the rest of the functions that display it. Since the fonts are now effectively 8x16, I can just put a normal font table where the old 'compressed' one was. (Although it'll still be using 2bpp for what is now really a 1bpp font... a real cartridge programmer would kill me for the waste of space! =P)

The only problem left is finding how to space it properly for 8x16. As you can see, it's spacing it for 16x16 still, heh. Well, with luck, maybe. As it is now, it's acceptable I think, if a little annoying to read.

Now to translate! Thanks for all the help to everyone. =)

EDIT: Er, if you're wondering why Gussun's graphic is aligned to the top there, don't worry, it's not a bug. Something I did while testing, I need to remod a clean rom before actually doing further work, hehe.

EDIT2:
Originally posted by Heian-794
Super Gussun Oyoyo is a classic!

Anxiously awaiting your translation, Ryoga.

(Which reminds me... I need to make some progress on that Chrono Trigger script I'm working on for Zeality...)


Hahaha, yeah, this and the CT script are my big projects right now. I suppose I should get back to work on that too. :o

EDIT3:

So, as you can see, I need to solve that spacing problem pretty badly now. =P I think I have an idea how to fix it. Correctly reducing it to 8x16 should give me alot more space too (44 bytes is not enough to write 'Gussun has left for his long awaited holiday in the southern islands'). I'll keep you posted, I guess.
----------------------------------------------------------
EDIT4:
(sorry to keep editing, but the board won't let me reply again for 5 hours, and I really need to get some sleep before work =P)
Ok, now I'm thoroughly stumped!

I've managed to get it this far:


Everything is working, except...
What it appears to be doing is rendering double what it should be from vram. When it renders the line each time as each character is displayed, it pulls double what it should from vram (i.e., if it's 2 characters [16 bytes] it'll pull 4 instead) which results in the junk you see here. Everything is loaded into vram fine, but unfortunately I don't know enough about how the SNES works to know exactly how it's pulling it from vram and rendering it to screen.

I'd post a rom/ips patch, but I don't know how that goes over here, rule-wise. If anyone wants to help though I'll gladly send a copy of what I have. Thanks a bunch~


(edited by RyogaMasaki on 01-31-06 05:52 PM)
(edited by RyogaMasaki on 01-31-06 05:54 PM)
(edited by RyogaMasaki on 02-01-06 05:45 AM)
(edited by RyogaMasaki on 02-01-06 11:57 AM)
RyogaMasaki
Newcomer


 





Since: 01-16-06
From: Orlando, FL

Last post: 6661 days
Last view: 6661 days
Posted on 02-02-06 10:43 AM Link | Quote
Well!


It all relied on the horiz counter at 7e0a84 (it was being bit shifted one too many times). However, that also broke the upper tiles, but I'm guess that's because 0a84 was shared also in vertical positioning, which means I'll just have it write it's own horiz counter somewhere else. Hopefully not too much longer till I have it completely working.
Zachio

Knuckle Joe








Since: 11-19-05
From: Q forever

Last post: 6312 days
Last view: 6311 days
Posted on 02-02-06 04:17 PM Link | Quote
Originally posted by RyogaMasaki

I'd post a rom/ips patch, but I don't know how that goes over here, rule-wise. If anyone wants to help though I'll gladly send a copy of what I have. Thanks a bunch~


an IPS Patch is fine, but a ROM isn't.
MathOnNapkins

1100

In SPC700 HELL


 





Since: 11-18-05

Last post: 6280 days
Last view: 6279 days
Posted on 02-03-06 02:32 AM Link | Quote
An Ips patch is only safe here if it doesn't contain copyrighted material, however.
Add to favorites | Next newer thread | Next older thread
Acmlm's Board - I3 Archive - ROM Hacking - Question about an encoded (?) font |


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.020 seconds; used 420.97 kB (max 530.74 kB)