OpenKh

This is a centralized place for the documentation and other discoveries about the internal working of Kingdom Hearts games.

View on GitHub

OpenKh Tool Documentation - KH2 Text Editor

Welcome to the official OpenKh tool documentation! This document assumes you are already familiar with either compiling or acquiring the released version of the KH2 Text Editor bundled with OpenKH and have a dumped copy of the ISO. If you have neither, you can download the release builds of OpenKH here and then dump your ISO using this tutorial.

This document will focus on teaching you how to use the first fully functional text editor for KH2.

Opening Notes

If you are editing msg/* for the PS2 version of KH2, you must reference only the miscellaneous icons and the PS2 version buttons.

If you are editing msg/* for the PC HD re-release of the game, you may freely reference any and all tables, but please only utilize the Dynamic Button Icons rather than static button prompts.

First and foremost, one you have opened the program, you need to open both the fontimage.bar and fontinfo.bar files (located in ./KH2/msg/jp). To get these, you must extract your game with the help of our ImgIdx CLI tool. If you need help, with this step, here is another document to get you started. When ready, open your files, like so:

Afterwards, open the desired .bar file containing the text in question that you would like to edit. These can be located at ./KH2/msg/jp, just like the fontimage and fontinfo files. For this example, we’ll go with sys.bar, which contains all frequently referenced, important, and miscellaneous text, such as menus.

Basic Text Editing

Now that we’ve got our sys.bar open, let’s say we want to edit some of the Command Menu text. It should be easy enough. Let’s change its text output from the classic “Attack” to something more fierce, like “Slash”.

There is a search bar at yor disposal in the bottom left which will greatly help you narrow down your search for specific strings of text! As long as you know what it is your looking for, type in a keyword or phrase and the editor will narrow down the selection for you. This way, you don’t have to browse for text by string numbers or approximate by hand where they’re located sequentially in the file. Once we’ve changed all of our basic single line text, such as “Attack”, “Magic”, and whatnot, let’s save the file to a new location so we don’t accidentaly overwrite the original.

After saving, we can finally patch in our simple edit to see if the changes are reflected in-game!

Uh-oh! Some of our changed text is going a little too far and is popping out of the text box. We’ll fix that and do some other neat adjustments in the next section!

Advanced Text Editing

Before we get started, here’s just how fancy text editing can get with this powerful tool!

As far as we know, this is just the tip of the iceberg. There are many more powerful functions built into this very tool, and the best part is it’s utilizing functions in the game engine itself! There’s a somewhat lengthy list of commands that can be called for various purposes, from width-scaling to forcing specific colors and transparency, and more! We’ll now be going over how exactly to utilize these string maps we have at our disposal.

For now, let’s list all the primary functions you will be likely to use, their type indicator, and detail exactly what they do:

Type Human-Readable Format Description
03 {:reset} Resets all text afterwards to be argument-less.
07 {:color #RRGGBBAA} Forces all text after this argument to appear as the specified color in Hex. An AA value higher than 80 (default) will make your text appear bold, while values lower than 80 will make it appear less bold. The default color value for most text in the game is #F0F0F080.
09 {:icon icon-name} Displays the named icon within the text string. A list of all icons resides at the end of this document.
0A {:scale Value} Forces all text after this argument to scale proportionately to the original size. (16 is normal.)
0B {:width Value} Forces all text after this argument to scale only in width, leaving height untouched. (100 is normal, 72 for 16:9 widescreen fixed.)
10 {:clear} Makes all text after this argument null, meaning it does not show, regardless of what you type. (There is probably no real pracical use for this function, but it is there nonetheless.)
11 {:position X,Y} Relocates text’s (X,Y) pixel coordinates from the origin point on screen. (Text is rendered on a 2D screen buffer approximately the size of 512x416. Because of this, you will likely never want to use values higher than X:512, X:-512, Y:416, or Y:-416.)

While there are more types, as of writing these are probably the only arguments you will ever likely need to use. They should have all of your bases covered. With that, let’s see what exactly your typed out text might look like in the editor after you make some adjustments. For this example, we’ll be looking at the (overly complicated) “Transformations” text that replaced “Drive”. While the example itself is a ridiculous setup and you would never use the tool like this practically, we’ll fix its width spacing anyway, just to show how to alleviate this problem.

{:width 50}{:color #75FFFFFF}T{:color #FF75FFFF}r{:color #FFFF75FF}a{:color #C3FFFFFF}n{:color #FFC3FFFF}s{:color #FFFFC3FF}f{:color #00C3FFFF}o{:color #FF00C3FF}r{:color #FF00C3FF}m{:color #C3FF00FF}a{:color #C325FFFF}t{:color #FFC325FF}i{:color #25FFC3FF}o{:color #C325FFFF}n{:color #FFFFFFFF}s

It’s certainly not practical to make your text look like this, but it’s cool nonetheless that we can do such a thing! It really doesn’t get any simpler than this. To start, I needed to determine that all the text should scale in width proportionately, so I made sure to place my {:width 50} argument at the very beginning so I didn’t have to do it for every individual letter, as the arguments apply to everything that come after it. Placing something like {:width 80} halfway through the text would’ve made the second half much wider than the {:width 50} half. So you can mix and match your arguments as you please, though again, you will likely never need to do such a thing.

In addition to the aforementioned arguments, certain special characters such as Roman numberals can be called at any point by using arguments such as {I}, {III}, {XIII}, and so forth.

Let’s test some more arguments for various texts in our sys.bar.

Line Number Original Text New Text
480 Attack {:color 952121FF}Slash
481 Magic {:color 214D95FF}Mana
482 Items {:width 64}{:color 219542FF}Consumables
483 Drive {:width 50}{:color 218995FF}Transformations
14133 Kingdom Hearts {:icon form}{:color D3D971FF}Classic Menu{:icon form}
14135 Keep the look of the original command menu. {:scale 24}{:color D3D971FF}Use this if you prefer the classic Command Menu.

And how it all appears in-game:

Closing Notes

Now that you’ve got a pretty good idea of how the text works, feel free to experiment and see what all you can come up with! As mentioned earlier, there are more arguments that can be used, but for the sake of preventing this documentation from being too complicated, for now it’s just covering the core functions that the majority of people will use.

Glossary of Icons

As a farewell, here’s a list of all the {:icon} arguments you can use to spice up your text as you see fit!

Miscellaneous Icons (All Versions)

Icon-Name Icon
ability-equip image
ability-unequip image
accessory image
ai-mode-frequent image
ai-mode-moderate image
ai-mode-rare image
ai-settings image
armor image
auto-equip image
exclamation-mark image
form image
gem-blazing image
gem-bright image
gem-dark image
gem-dense image
gem-energy image
gem-frost image
gem-lightning image
gem-lucid image
gem-mythril image
gem-orichalcum image
gem-power image
gem-serenity image
gem-twilight image
gumi-block image
gumi-blueprint image
gumi-brush image
gumi-gear image
gumi-ship image
item-consumable image
item-key image
item-tent image
magic image
magic-nocharge image
material image
party image
question-mark image
rank-a image
rank-b image
rank-c image
rank-s image
remembrance image
tranquil image
weapon-keyblade image
weapon-keyblade-equip image
weapon-shield image
weapon-shield-equip image
weapon-staff image
weapon-staff-equip image

PS2 Version Button Icons

Button-Name Icon
button-circle image
button-cross image
button-dpad image
button-l1 image
button-l2 image
button-r1 image
button-r2 image
button-select image
button-square image
button-start image
button-triangle image

The HD Collection (the PC port specifically) repurposes both used and unused PS2 button icons and adds in brand new ones for its multiple supported control options.

Below is a list of each icon name sorted by button/controller type.

Xbox Button Icons

Button-Name Icon
button-cross image
button-circle image
button-square image
button-triangle image
button-select image
button-start image
button-l1 image
button-l2 image
weapon-keyblade-equip image
button-r1 image
button-r2 image
weapon-staff-equip image
xb-analog image
form image
xb-left-analog-up image
xb-left-analog-down image
xb-left-analog-left image
xb-left-analog-right image
weapon-shield-equip image
xb-right-analog-up image
xb-right-analog-down image
xb-right-analog-left image
xb-right-analog-right image
button-dpad image
xb-dpad-up image
xb-dpad-down image
xb-dpad-left image
xb-dpad-right image
xb-dpad-updown image
xb-dpad-leftright image

PlayStation Button Icons

Button-Name Icon
ps-cross image
ps-circle image
ps-square image
ps-triangle image
ps-touchpad image
ps-options image
ps-l1 image
ps-l2 image
ps-r3 image
ps-r1 image
ps-r2 image
ps-l3 image
ps-analog image
ps-analog-left image
ps-left-analog-up image
ps-left-analog-down image
ps-left-analog-left image
ps-left-analog-right image
ps-analog-right image
ps-right-analog-up image
ps-right-analog-down image
ps-right-analog-left image
ps-right-analog-right image
ps-dpad image
ps-dpad-up image
ps-dpad-down image
ps-dpad-left image
ps-dpad-right image
ps-dpad-updown image
ps-dpad-leftright image

Generic Button Icons

Button-Name Icon
gen-1 image
gen-2 image
gen-3 image
gen-4 image
gen-r1 image
gen-r2 image
gen-l1 image
gen-l2 image
gen-select image
gen-start image

Keyboard and Mouse Icons

Key-Name Icon
kb-a image
kb-b image
kb-c image
kb-d image
kb-e image
kb-f image
kb-g image
kb-h image
kb-i image
kb-j image
kb-k image
kb-l image
kb-m image
kb-n image
kb-o image
kb-p image
kb-q image
kb-r image
kb-s image
kb-t image
kb-u image
kb-v image
kb-w image
kb-x image
kb-y image
kb-z image
kb-left-shift image
kb-right-shift image
kb-left-ctrl image
kb-right-crtl image
kb-left-alt image
kb-right-alt image
kb-enter image
kb-backspace image
kb-space image
kb-esc image
kb-insert image
kb-delete image
kb-1 image
kb-2 image
kb-3 image
kb-4 image
kb-5 image
kb-6 image
kb-7 image
kb-8 image
kb-9 image
kb-0 image
kb-numpad-1 image
kb-numpad-2 image
kb-numpad-3 image
kb-numpad-4 image
kb-numpad-5 image
kb-numpad-6 image
kb-numpad-7 image
kb-numpad-8 image
kb-numpad-9 image
kb-numpad-0 image
kb-numpad-divide image
kb-numpad-multiply image
kb-numpad-minus image
kb-numpad-plus image
kb-numpad-period image
kb-up image
kb-down image
kb-left image
kb-right image
kb-f1 image
kb-f2 image
kb-f3 image
kb-f4 image
kb-f5 image
kb-f6 image
kb-f7 image
kb-f8 image
kb-f9 image
kb-f10 image
kb-f11 image
kb-f12 image
mouse-left-click image
mouse-right-click image
mouse-middle-click image
mouse-extra-click1 image
mouse-extra-click2 image
mouse-up image
mouse-down image
mouse-left image
mouse-right image
mouse-scroll-up image
mouse-scroll-down image
mouse-neutral image
hash image

Dynamic Button Icons

This final table of icons doesn’t have a static image to plug into your edited text, but instead changes what they look like based on the current active controller the player has selected.

For example dynamic-cross will look like the Playstation input while using a Playstation controller and dynamically change to the Xbox input if the cotroller was changed to an Xbox controller during gameplay.

dynamic-circle-jp and dynamic-cross-jp are used in place of dynamic-cross and dynamic-circle, respectively, if the user changed their settings to swap the confirm/cancel input.

As a result of this information and how the PC port handles these dynamic texts, the user should ALWAYS use these icons in place of static ones used above.

Dynamic-Button-Name PS Icon XB Icon Generic Icon
dynamic-cross image image image
dynamic-circle-jp image image image
dynamic-circle image image image
dynamic-cross-jp image image image
dynamic-square image image image
dynamic-triangle image image image
dynamic-select image image image
dynamic-start image image image
dynamic-l1 image image image
dynamic-l2 image image image
dynamic-l3 image image  
dynamic-r1 image image image
dynamic-r2 image image image
dynamic-r3 image image  
dynamic-analog image image  
dynamic-left-analog image image  
dynamic-left-analog-up image image  
dynamic-left-analog-down image image  
dynamic-left-analog-left image image  
dynamic-left-analog-right image image  
dynamic-right-analog image image  
dynamic-right-analog-up image image  
dynamic-right-analog-down image image  
dynamic-right-analog-left image image  
dynamic-right-analog-right image image  
dynamic-dpad image image  
dynamic-dpad-up image image  
dynamic-dpad-down image image  
dynamic-dpad-left image image  
dynamic-dpad-right image image  
dynamic-dpad-up-down image image  
dynamic-dpad-left-right image image  

Character table of international version

Some characters are difficult to type.

In this case, use UnsupportedCmdModel {:unk HEX} to represent special symbols.

This is the list of characters:

Pseudo code Character Unicode
{:unk 20} U+2B1B
{:unk 21} U+FF10
{:unk 22} U+FF11
{:unk 23} U+FF12
{:unk 24} U+FF13
{:unk 25} U+FF14
{:unk 26} U+FF15
{:unk 27} U+FF16
{:unk 28} U+FF17
{:unk 29} U+FF18
{:unk 2a} U+FF19
{:unk 2b} + U+002B
{:unk 2c} U+2212
{:unk 2d} U+2093
{:unk 2e} A U+0041
{:unk 2f} B U+0042
{:unk 30} C U+0043
{:unk 31} D U+0044
{:unk 32} E U+0045
{:unk 33} F U+0046
{:unk 34} G U+0047
{:unk 35} H U+0048
{:unk 36} I U+0049
{:unk 37} J U+004A
{:unk 38} K U+004B
{:unk 39} L U+004C
{:unk 3a} M U+004D
{:unk 3b} N U+004E
{:unk 3c} O U+004F
{:unk 3d} P U+0050
{:unk 3e} Q U+0051
{:unk 3f} R U+0052
{:unk 40} S U+0053
{:unk 41} T U+0054
{:unk 42} U U+0055
{:unk 43} V U+0056
{:unk 44} W U+0057
{:unk 45} X U+0058
{:unk 46} Y U+0059
{:unk 47} Z U+005A
{:unk 48} ! U+0021
{:unk 49} ? U+003F
{:unk 4a} % U+0025
{:unk 4b} / U+002F
{:unk 4c} U+203B
{:unk 4d} U+3001
{:unk 4e} U+3002
{:unk 4f} . U+002E
{:unk 50} , U+002C
{:unk 51} ; U+003B
{:unk 52} : U+003A
{:unk 53} U+2026
{:unk 54} - U+002D
{:unk 55} U+2013
{:unk 56} U+301C
{:unk 57} ' U+0027
{:unk 5a} ( U+0028
{:unk 5b} ) U+0029
{:unk 5c} U+300C
{:unk 5d} U+300D
{:unk 5e} U+300E
{:unk 5f} U+300F
{:unk 60} U+201C
{:unk 61} U+201D
{:unk 62} [ U+005B
{:unk 63} ] U+005D
{:unk 64} < U+003C
{:unk 65} > U+003E
{:unk 66} - U+002D
{:unk 67} U+2013
{:unk 68} U+2937
{:unk 69} U+2669
{:unk 6a} U+21FE
{:unk 6b} U+21FD
{:unk 6c} U+25EF
{:unk 6d} U+2715
{:unk 74} I U+0049
{:unk 75} II  
{:unk 76} III  
{:unk 77} IV  
{:unk 78} V U+0056
{:unk 79} VI  
{:unk 7a} VII  
{:unk 7b} VIII  
{:unk 7c} IX  
{:unk 7d} X U+0058
{:unk 7e} XIII  
{:unk 7f} α U+03B1
{:unk 80} β U+03B2
{:unk 81} γ U+03B3
{:unk 82} U+2B51
{:unk 83} U+2B52
{:unk 84} XI  
{:unk 85} XII  
{:unk 86} & U+0026
{:unk 87} # U+0023
{:unk 88} ® U+00AE
{:unk 89} U+25B4
{:unk 8a} U+25BE
{:unk 8b} U+25B8
{:unk 8c} U+25C2
{:unk 8d} ° U+00B0
{:unk 8e} U+266A
{:unk 90} 0 U+0030
{:unk 91} 1 U+0031
{:unk 92} 2 U+0032
{:unk 93} 3 U+0033
{:unk 94} 4 U+0034
{:unk 95} 5 U+0035
{:unk 96} 6 U+0036
{:unk 97} 7 U+0037
{:unk 98} 8 U+0038
{:unk 99} 9 U+0039
{:unk 9a} a U+0061
{:unk 9b} b U+0062
{:unk 9c} c U+0063
{:unk 9d} d U+0064
{:unk 9e} e U+0065
{:unk 9f} f U+0066
{:unk a0} g U+0067
{:unk a1} h U+0068
{:unk a2} i U+0069
{:unk a3} j U+006A
{:unk a4} k U+006B
{:unk a5} l U+006C
{:unk a6} m U+006D
{:unk a7} n U+006E
{:unk a8} o U+006F
{:unk a9} p U+0070
{:unk aa} q U+0071
{:unk ab} r U+0072
{:unk ac} s U+0073
{:unk ad} t U+0074
{:unk ae} u U+0075
{:unk af} v U+0076
{:unk b0} w U+0077
{:unk b1} x U+0078
{:unk b2} y U+0079
{:unk b3} z U+007A
{:unk b4} Æ U+00C6
{:unk b5} æ U+00E6
{:unk b6} ß U+00DF
{:unk b7} à U+00E0
{:unk b8} á U+00E1
{:unk b9} â U+00E2
{:unk ba} ä U+00E4
{:unk bb} è U+00E8
{:unk bc} é U+00E9
{:unk bd} ê U+00EA
{:unk be} ë U+00EB
{:unk bf} ì U+00EC
{:unk c0} í U+00ED
{:unk c1} î U+00EE
{:unk c2} ï U+00EF
{:unk c3} ñ U+00F1
{:unk c4} ò U+00F2
{:unk c5} ó U+00F3
{:unk c6} ô U+00F4
{:unk c7} ö U+00F6
{:unk c8} ù U+00F9
{:unk c9} ú U+00FA
{:unk ca} û U+00FB
{:unk cb} ü U+00FC
{:unk cc} º U+00BA
{:unk cd} U+2014
{:unk ce} » U+00BB
{:unk cf} « U+00AB
{:unk d0} À U+00C0
{:unk d1} Á U+00C1
{:unk d2} Â U+00C2
{:unk d3} Ä U+00C4
{:unk d4} È U+00C8
{:unk d5} É U+00C9
{:unk d6} Ê U+00CA
{:unk d7} Ë U+00CB
{:unk d8} Ì U+00CC
{:unk d9} Í U+00CD
{:unk da} Î U+00CE
{:unk db} Ï U+00CF
{:unk dc} Ñ U+00D1
{:unk dd} Ò U+00D2
{:unk de} Ó U+00D3
{:unk df} Ô U+00D4
{:unk e0} Ö U+00D6
{:unk e1} Ù U+00D9
{:unk e2} Ú U+00DA
{:unk e3} Û U+00DB
{:unk e4} Ü U+00DC
{:unk e5} ¡ U+00A1
{:unk e6} ¿ U+00BF
{:unk e7} Ç U+00C7
{:unk e8} ç U+00E7
{:unk e9} U+201B
{:unk ea} U+2019
{:unk eb} ` U+0060
{:unk ec} ´ U+00B4
{:unk ed} " U+0022
{:unk ee} ' U+0027
{:unk ef} U+2605
{:unk f0} U+2606
{:unk f1} U+25A0
{:unk f2} U+25A1
{:unk f3} U+25B2
{:unk f4} U+25B3
{:unk f5} U+25CF
{:unk f6} U+25CB
{:unk f7} U+266A
{:unk f8} U+266B
{:unk f9} U+2192
{:unk fa} U+2190
{:unk fb} U+2191
{:unk fc} U+2193
{:unk fd} U+30FB
{:unk fe} U+2764