Author Topic: Cyber Knight translation  (Read 10371 times)

megatron-uk

  • Full Member
  • ***
  • Posts: 219
Re: Cyber Knight translation
« Reply #180 on: October 24, 2016, 07:10:17 AM »


I know why I'm confused.

The pointer index table is little endian. I was reading it as big endian.

I couldn't work out where you were getting the pointer $4085 from, since my last pointer was $4000. But of course it's not, and the second byte isn't a counter at all.

SO where I thought the 0x0A table (which is 0A 0B 40 FD 54 6F 6A 29 6C C1 75 00)...

0x0A (asset bank id)
0x0B (table pointer size)
40 FD (pointer)
54 6F (pointer)
... and so on.

it's actually (yes, you can slap me now):
0x0A (asset bank id)
40 0B (pointer)
54 FD (pointer)
... etc.

I'll go sit in the corner now.  :oops:

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: Cyber Knight translation
« Reply #181 on: October 24, 2016, 08:49:24 AM »
I'll go sit in the corner now.  :oops:

Hahaha ... nope, now you'll be too busy working on it all to take time off and sit in the corner!  :wink:

It's a very easy mistake to make, don't worry about it.

Once you've got the translation fixed up, it'll all be about the presentation.

Please, please, please consider customizing the font a bit.  :pray:

Lower-case descenders that appear completely above the baseline just make my eyes bleed!  ](*,)

If you can't afford the extra lines to drop those descenders, then you might want to consider changing the lower-case part of the font into small-caps instead (which also gives you the excuse to put crossbars on the "i" and "l" so that they don't look so thin and out-of-place next to the other fixed-width letters).

Or not ... just an IMHO.  8-[

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: Cyber Knight translation
« Reply #182 on: October 24, 2016, 11:05:13 AM »
Once you've got the translation fixed up, it'll all be about the presentation.

Please, please, please consider customizing the font a bit.  :pray:

Lower-case descenders that appear completely above the baseline just make my eyes bleed!  ](*,)

OK, a quick look at the game (I'd never seen if before yesterday), shows that all the text is done as 8x8 background tiles, and not dynamically drawn into sprites.

That means no VWF, but, on the positive side, every piece of text, and box, that I've seen is spaced to allow for 16-pixel-high Kanji.

So once the game is 100% translated, and the Japanese font is no longer needed, it should be possible to modify both the font and the display code so that all of the english text is drawn as 2 8x8 tiles ... allowing for real descenders, and a slightly taller font, all without screwing up the overall look.

Since there's also the whole Kanji font bank in there that's permanently loaded as well, that space could potentially be used to make custom bitmaps for some of the game's options, making those look even prettier.

Oh, and just for giggles, I checked, and it looks like there is a permanent "black" in the text palette, so it would be possible to add a drop-shadow to the text, even though it doesn't strictly need one!

Finally ... there's a ton of unused space in the permanent gamecode banks (bank $00 and $01) to actually implement any code hacks.

ccovell

  • Hero Member
  • *****
  • Posts: 2245
Re: Cyber Knight translation
« Reply #183 on: October 24, 2016, 12:13:56 PM »
Elmer: programmer by day, typeface fetishist by night.  :)

Black Tiger

  • Hero Member
  • *****
  • Posts: 11242
Re: Cyber Knight translation
« Reply #184 on: October 24, 2016, 12:26:47 PM »
Programming isn't the only thing he's a "pro" at. :)
http://www.superpcenginegrafx.net/forum

Active and drama free PC Engine forum

esteban

  • Hero Member
  • *****
  • Posts: 24063
Re: Cyber Knight translation
« Reply #185 on: October 24, 2016, 01:53:23 PM »
Elmer: programmer by day, typeface fetishist by night.  :)

Hahahhhahah.

It is so true, and it is so awesome.

  |    | 

megatron-uk

  • Full Member
  • ***
  • Posts: 219
Re: Cyber Knight translation
« Reply #186 on: October 25, 2016, 04:46:11 AM »
Right, so it looks like all of the assets in banks 0x0A, 0x0C and 0x0E are script. They also coincide with my extracted text regions, so that's great. I can use these new accurate locations to extract the sections in more detail.

Here are the sections so far:

Bank 0x0C
Code: [Select]
Bank: 0xc
---> Contains 12 asset pointers
---> Region 0x18000 - 0x1bfff
---> Starting asset chunk (0x1) located at: 0x18019
---> Finding next asset sequence
-----> 0x1: 0x18019 - 0x18462 [1097 bytes]
-----> 0x3: 0x18462 - 0x18c61 [2047 bytes]
-----> 0x5: 0x18c61 - 0x19147 [1254 bytes]
-----> 0x7: 0x19147 - 0x19927 [2016 bytes]
-----> 0x9: 0x19927 - 0x19c16 [751 bytes]
-----> 0xb: 0x19c16 - 0x1a34b [1845 bytes]
-----> 0xd: 0x1a34b - 0x1ae17 [2764 bytes]
-----> 0xf: 0x1ae17 - 0x1aea2 [139 bytes]
-----> 0x11: 0x1aea2 - 0x1b1d5 [819 bytes]
-----> 0x13: 0x1b1d5 - 0x1b5d8 [1027 bytes]
-----> 0x15: 0x1b5d8 - 0x1b8ce [758 bytes]
-----> 0x17: 0x1b8ce - 0x1bfff [1841 bytes]

Bank 0x0A
Code: [Select]
Bank: 0xa
---> Contains 5 asset pointers
---> Region 0x14000 - 0x17fff
---> Starting asset chunk (0x1) located at: 0x1400b
---> Finding next asset sequence
-----> 0x1: 0x1400b - 0x154fd [5362 bytes]
-----> 0x3: 0x154fd - 0x16a6f [5490 bytes]
-----> 0x9: 0x175c1 - 0x17fff [2622 bytes]
-----> 0x5: 0x16a6f - 0x16c29 [442 bytes]
-----> 0x7: 0x16c29 - 0x175c1 [2456 bytes]

Bank 0x0E
Code: [Select]
Bank: 0xe
---> Contains 8 asset pointers
---> Region 0x1c000 - 0x1ffff
---> Starting asset chunk (0x1) located at: 0x1c011
---> Finding next asset sequence
-----> 0x1: 0x1c011 - 0x1cb4c [2875 bytes]
-----> 0x3: 0x1cb4c - 0x1ceed [929 bytes]
-----> 0x5: 0x1ceed - 0x1d373 [1158 bytes]
-----> 0x7: 0x1d373 - 0x1d5b2 [575 bytes]
-----> 0x9: 0x1d5b2 - 0x1dc86 [1748 bytes]
-----> 0xb: 0x1dc86 - 0x1ebff [3961 bytes]
-----> 0xd: 0x1ebff - 0x1f0ec [1261 bytes]
-----> 0xf: 0x1f0ec - 0x1ffff [3859 bytes]


With bank 0x14 there only appear to be two script assets. Identified by asset index 0x79 and 0x83. Though only 0x83 is referenced by the main asset table in bank 0x01.

0x83: 0x28085 - 0x288e4 [2143 bytes]
0x79: 0x288e4 - 0x2aa15 [8497 bytes]

I've taken the end address of each chunk to be the start address of the next chunk in ram, so these are the maximum sizes of those asset chunks. You can see that 0x79 runs on from 0x83, so one thing I need to find out is how the script in that section is addressed, when asset 0x79 is not directly referenced in the main bank 0x01 offset pointer table, only 0x83 is for bank 0x14.

megatron-uk

  • Full Member
  • ***
  • Posts: 219
Re: Cyber Knight translation
« Reply #187 on: October 25, 2016, 04:53:20 AM »
So to clarify, every single asset chunk in bank 0x0A, 0x0C and 0x0E is directly accessed by the offset pointers in the bank 0x01 table:

Asset bank load table
Quote
0e 0e 0e 0e 0e 0e 0c 0e
0e 00 00 00 00 00 00 00
14 0a 0a 0a 0a 0a 0c 0c
0c 0c 0c 0c 0c 0c 0c 0c
0c

Asset index chunk offset table
Quote
01 03 05 07 09 0b 17 0d
0f 00 00 00 00 00 00 00
83 01 03 05 07 09 01 03
05 07 09 0b 0d 0f 11 13
15

Each asset bank has a corresponding index offset in the second table. No asset index is without an entry, apart from asset bank 0x14, which only has one index offset: 0x83.

It looks like from index 0x83 (0x28085) until the end of the chunk 0x79 (0x2aa15) is one contiguous script chunk. This looks to be remarkably similar to my existing extractions, which have grabbed text in that region from 0x28086 up to 0x2a930.
« Last Edit: October 25, 2016, 04:58:33 AM by megatron-uk »

megatron-uk

  • Full Member
  • ***
  • Posts: 219
Re: Cyber Knight translation
« Reply #188 on: October 25, 2016, 05:24:06 AM »
Argh, ignore my 0x79 asset chunk comments. It's transcription error - I wrote 0x288E4 instead of 0x2B8E4 as the physical ROM address.

That makes things simpler; just one script location (pointed to by 0x83) in that bank now. Albeit with 10 KBytes of text data....

megatron-uk

  • Full Member
  • ***
  • Posts: 219
Re: Cyber Knight translation
« Reply #189 on: October 25, 2016, 05:30:50 AM »
Since the asset pointed at by 0x83 is the story main script for the game, it should be possible to relocate that one asset to a new bank, to give me another 60% of space to expand it (from ~10KB of Japanese dialogue to 16KB of English to fill the new bank).

That's going to be a massive help.

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: Cyber Knight translation
« Reply #190 on: October 25, 2016, 06:14:55 AM »
Elmer: programmer by day, typeface fetishist by night.  :)

A man's got to have his passions!  :wink:

Do I get a superhero name to go with it?  :-k


Since the asset pointed at by 0x83 is the story main script for the game, it should be possible to relocate that one asset to a new bank, to give me another 60% of space to expand it (from ~10KB of Japanese dialogue to 16KB of English to fill the new bank).

That's going to be a massive help.

You've got it beaten now!  :D

<EDIT>

You don't even need to expand the ROM at all ... I just can't believe how much unused space there is in there!!!  :shock:

You've got a completely free 16KB region in the ROM at offset $50000-$53fff (bank $28).

You've also got over 8KB free in the 16KB asset-block at bank $08 where you could rewrite the block to add some new asset chunks into it.
« Last Edit: October 25, 2016, 07:00:05 AM by elmer »

megatron-uk

  • Full Member
  • ***
  • Posts: 219
Re: Cyber Knight translation
« Reply #191 on: October 25, 2016, 09:24:33 AM »
Just made a new commit to github with a Python based extractor tool (extractAssets.py) that outputs one data file per asset chunk. It saves to ./assets/raw by default.

Files are named as ASSETBANK.ASSETCHUNK.dat.

e.g.

0x14.0x83.dat

Now need to write something to load each data file, split the script into strings and then pass back through my translation table that I used earlier. Hopefully have something working for that tomorrow.

There are 26 script asset chunks, allocating a new 16KB bank for each would increase the size of the ROM by 420KB, which, although wasteful, would mean each block of text would have more than enough space to be fully expanded, without worrying whether each of the assets would fit back in to a single bank.

The main story script asset chunk will probably need the most space for expansion, but I had to make savings here and there in a lot of other places, so this would help with those sections, too.

ccovell

  • Hero Member
  • *****
  • Posts: 2245
Re: Cyber Knight translation
« Reply #192 on: October 25, 2016, 11:46:25 AM »
Elmer: programmer by day, typeface fetishist by night.  :)

A man's got to have his passions!  :wink:

Do I get a superhero name to go with it?  :-k

"The Masked Descender!"

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: Cyber Knight translation
« Reply #193 on: October 26, 2016, 03:57:23 AM »
"The Masked Descender!"

Hahaha ... I like it!  :lol:

I'll have to think up a Halloween costume to go with it.  :-k

Necromancer

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 21366
Re: Cyber Knight translation
« Reply #194 on: October 26, 2016, 04:31:21 AM »
"Wait... that's not a serif.  Dammit, elmer, zip up!"
U.S. Collection: 97% complete    155/159 titles