(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
05-16-24 10:06 PM
0 users currently in ROM Hacking.
Acmlm's Board - I3 Archive - ROM Hacking - Question about an encoded (?) font
  
User name:
Password:
Reply:
 
Options: - -
Quik-Attach:
Preview for more options

Max size 1.00 MB, types: png, gif, jpg, txt, zip, rar, tar, gz, 7z, ace, mp3, ogg, mid, ips, bz2, lzh, psd

UserPost
MathOnNapkins
Posts: 210/1106
An Ips patch is only safe here if it doesn't contain copyrighted material, however.
Zachio
Posts: 52/595
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.
RyogaMasaki
Posts: 9/9
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.
RyogaMasaki
Posts: 8/9
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~
MathOnNapkins
Posts: 200/1106
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.
neotransotaku
Posts: 619/1860
oh dang, this revolutionizes game tile editing, assuming the tiles are uncompressed of course... I think i'll be using this now...
FreeDOS +
Posts: 231/1312
holy crap FEIDIAN is awesome, especially for the fact that it's done in PHP
Cellar Dweller +
Posts: 38/138
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/
Heian-794
Posts: 35/160
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...)
Dragonsbrethren
Posts: 73/442
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.
RyogaMasaki
Posts: 5/9
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. =)
MathOnNapkins
Posts: 189/1106
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.
Apophis
Posts: 264/734
Did you try viewing them in 1bpp? TLP, tile molester, etc. have that option
RyogaMasaki
Posts: 4/9
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)
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.005 seconds; used 367.10 kB (max 423.79 kB)