News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Marvelous font hack / rom free space  (Read 5005 times)

tashi

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Marvelous font hack / rom free space
« on: March 15, 2012, 12:41:35 am »
Howdy. I want to translate Marvelous ~ mou hitotsu no takarajima. I played the game a couple months ago, and boy was it fun! I took a crack at hacking it, then, too, and got as far as script dumping / inserting, but got busy with work, etc. Now without a pesky job to slow me down, I wanted to see if I couldn't get a little further.

Marvelous uses a 16x16 2bpp font. It includes ASCII characters so I can easily work on script insertion and mess with a font as a separate issue. The problem is that I can only fit 22 characters per line. Any more and the game crashes angrily. It would be amazing someone could help me somehow hack the font to be 8x16. I can insert my own font if the engine can be converted.

The other issue is that I'm afraid there isn't enough room for a full English script. The script area has around $2000 bytes of blank space after it, so for now I am just carving into that space, but that won't last long. Since there aren't any pointers (on startup, the script area is scanned and a pointer table is built in VRAM), I'm not sure if it would be possible to split text across banks...

Here's an SJIS encoded Marvelous text dump with Atlas commands and the corresponding table file. Typesetting is a slight challenge (formatting with the control codes, and keeping within the character limit). I'm attempting to script something to automate it. In the meantime, I can explain it if anyone cares.

The first game dialogue starts on line 3936 and sort of jumps around.

A teaser image:

Nightcrawler

  • Hero Member
  • *****
  • Posts: 5791
    • View Profile
    • Nightcrawler's Translation Corporation
Re: Marvelous font hack / rom free space
« Reply #1 on: March 15, 2012, 02:53:01 pm »
I thought I was going to help you out as these things are usual somewhat easy. However, Marvelous uses the SA-1 chip and there are several extra considerations as a result. I really don't have time to do it, nor am I sure off-hand which debuggers can provide you with reliable SA-1 BW-RAM data viewing.

So, I'll leave you with this:
That text area is DMA'd each time a character is printed with the following:
DMA[0]: write Mode: 1 0x409000->0x2118 Bytes: 4416 (inc) V-Line:228 VRAM: 6800 (1,0) word
Instructions of interest are at $00/BF87. It will hit a breakpoint on first character print.

The source address $40:9000 is coming from SA-1 BW-RAM. Now, it just so happens the SA-1 allows for bitmap character conversion to SNES VRAM using simultaneous DMA in that BW-RAM. I didn't have time to read through the documentation and check register action to determine if it was in-fact taking advantage of this feature, or simply just doing a standard DMA from SA-1 memory space, which I believe is also allowed.  To make it 8x16, you'll need to find how it gets in that RAM and alter the routine to write the next character earlier (appropriate 8x16 location instead of 16x16). Alternatively, you could attack the tilemap and that might work for you, but you're still using the same amount of VRAM which might still get you. A third option is to see how it draws the characters. Many games separate it into two 8x16 halfs and you can simply disable the second half. I didn't get to check for those possibilities either. Someone else will have to take it from here.  :)

If you don't understand anything I wrote above, you're probably in above your head and you're going to have a heck of a time doing anything in this game that would require code modification (such as this 8x16 conversion). In addition to reading code and debug, you will at least you need to understand the basic SA-1 mapping to know what's going on in the code you debug. I imagine that's why nobody bothered to translate Marvelous yet.  It's a bit more difficult and unpopular than others. Combine the two and you often get an untranslated game. :P
TransCorp - Over 20 years of community dedication.
Dual Orb 2, Wozz, Emerald Dragon, Tenshi No Uta, Glory of Heracles IV SFC/SNES Translations

Vehek

  • Full Member
  • ***
  • Posts: 210
    • View Profile
Re: Marvelous font hack / rom free space
« Reply #2 on: March 15, 2012, 07:40:43 pm »
A third option is to see how it draws the characters. Many games separate it into two 8x16 halfs and you can simply disable the second half. I didn't get to check for those possibilities either. Someone else will have to take it from here.  :)
I think that's how it works in the BS Marvelous games.
Code: (BS Marvelous Time Athletes Week 1) [Select]
$81/B2CA E2 20       SEP #$20
$81/B2CC B7 04       LDA [$04],y
$81/B2CE 0A          ASL A
$81/B2CF A6 94       LDX $94    [$00:0494]
$81/B2D1 9F 01 9C 7E STA $7E9C01,x
$81/B2D5 1A          INC A
$81/B2D6 9F 03 9C 7E STA $7E9C03,x
$81/B2DA B7 04       LDA [$04],y
$81/B2DC 0A          ASL A
$81/B2DD A9 00       LDA #$00
$81/B2DF 69 00       ADC #$00
$81/B2E1 9F 00 9C 7E STA $7E9C00,x
$81/B2E5 9F 02 9C 7E STA $7E9C02,x
$81/B2E9 C2 20       REP #$20
$81/B2EB E6 04       INC $04    [$00:0404]
$81/B2ED D0 07       BNE $07    [$B2F6]
$81/B2F6 E8          INX
$81/B2F7 E8          INX
$81/B2F8 E8          INX
$81/B2F9 E8          INX
$81/B2FA 80 BB       BRA $BB    [$B2B7]
You'll have to find the equivalent routines in Marvelous. What needs to be done is to NOP out two of the INXs, and maybe also the parts which write the second half ($7E9C02,x and $7E9C03,x), There may be other things that need to be changed for it to work perfectly.

svambo

  • Jr. Member
  • **
  • Posts: 25
    • View Profile
Re: Marvelous font hack / rom free space
« Reply #3 on: March 15, 2012, 07:58:47 pm »
You have a PM  ;)

tashi

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Marvelous font hack / rom free space
« Reply #4 on: March 15, 2012, 09:35:17 pm »
Thanks everyone. To my great embarrassment, someone in the IRC chan informed me that the resolution wigs out to 512px wide, so if you are keeping the resolution fixed in your emulator, or I guess on a TV, the 16x16 font is scaled down to 8x16 anyway. Oof. Still, a VWF or something would be nice... but that is WAY over my head and outside my abilities. So I'm not even worried. I'm not even going to consider it until I finish the script.

With the great help from you guys, I am super prepared and able to plow forward in Marvelous! The only thing holding me back at this point is me, so that is great motivation~ Thanks everyone.

*edit: grammar.
« Last Edit: March 17, 2012, 12:00:51 am by tashi »

KiddoCabbusses

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Marvelous font hack / rom free space
« Reply #5 on: March 16, 2012, 02:04:27 am »
Just posting to show my support!
I would like to see both the retail Marvelous and the BS Marvelous series fan translated, so I hope this works out! :)

tashi

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Marvelous font hack / rom free space
« Reply #6 on: March 17, 2012, 12:17:30 am »
Thanks for your support~

Just to give a status update: Today I got 807 of 3075 strings translated and inserted successfully. That's 26%.

I'll post again/edit this when I get to 50%.

And future roadmap: finish tling, play through to fix script / formatting, get playtesters,  ... done!

Gideon Zhi

  • Discord Staff
  • Hero Member
  • *****
  • Posts: 3535
    • View Profile
    • Aeon Genesis
Re: Marvelous font hack / rom free space
« Reply #7 on: March 17, 2012, 01:03:18 am »
And future roadmap: finish tling, play through to fix script / formatting, get playtesters,  ... done!

Hacking the dialog is easy. It's futzing with the menus and interfaces where things tend to devolve into headache-inducing grindfests.

tashi

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Marvelous font hack / rom free space
« Reply #8 on: March 18, 2012, 08:14:03 pm »
Hopefully Marvelous will be an exception to Gideon Zhi's vast experience and it won't take months and months to hack the UI :laugh:

Currently at 1541/3075 lines, which I'm calling halfway. The English script is just about as big as the original Japanese script was already. Feelin' good!

*edit: I've expanded the ROM and moved my English script there. The sailing is smooth! I'm super proud of myself! But really, I couldn't have done it without all the help in this thread and from svambo. Thanks <3
« Last Edit: March 19, 2012, 01:00:35 am by tashi »