Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

Kingdom Hearts .ctd and .ctdl files

Featured Replies

  • Author
  • Localization

GrzybDev, posted Thu Apr 15, 2021 6:06 pm (63393)


Hello everyone,

As you may or may not know i've created tool for extracting locale files from Kingdom Hearts 1.5 2.5/2.8 into "translatable" format (.po).

It seems that format they're using (.ctdl, but my script wrongly saves it as .ctd (it's just takes magic value and save it as extension - works in most cases :)) have 3 "variations", i successfully can extract strings from 2 "variations" (more details below), but have problem with 3rd one.

Details on how i read and named first variation:
Code:
int magicValue = 0x44545340; # Always "@CTD"
int unknown1 = 503; # Some kind of indicator (strings with that are saved in UTF-16)
int unknown2;
short unknown3;

short loc_count, addr_offset, padding, hash_offset, padding, data_offset;

struct addr_block {
   short[loc_count] loc_id, set_id, offset, unknown;
}

struct hash_block {
   string[loc_count] # Hash, 32 bytes (0x20 bytes)
}

struct data_block {
   string[loc_count] # Double null terminated UTF-16 encoded
}


Second "variation":
Code:
int magicValue = 0x44545340; # Always "@CTD"
int unknown1; # If this value is not 503, strings are utf-8
int unknown2;
short unknown3;

short loc_count, addr_offset, padding, hash_offset, padding, data_offset;

struct addr_block {
   short[loc_count] loc_id, set_id, offset, unknown;
   int unknown2;
}

struct hash_block {
   string[loc_count] # Hash, 32 bytes (0x20 bytes)
}

struct data_block {
   string[loc_count] # Null terminated UTF-8 encoded
}


As you can see, these two variants are relatively similar. But third variant is an exception. And it really confuses me.

I attached all variations,
Can someone help with "documenting" the third variation (also, if someone have better idea what "unknown" values in my structs are)

Thanks in advance
  • Author
  • Localization

gameside, posted Sat Apr 17, 2021 4:36 pm (63414)


so far, I don't know much about unknown block yet
Code:
// Header
   4 - Magic
   2 - number of unknown blocks
   2 - number of strings
   4 - offset to offset table
   4 - offset to string table
   
// For each unknown block
   48 - unknown, need to check it later
   
// For each string
   4 - offset of string (start from zero, (offset to string index offset of string = actual offset))

X - String null-terminated
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.