Introduction [Cover Page]

Translhextion 1.6c

Translhextion © Brian Bennewitz [Januschan] 2000

HTML Help File by David Silva García [Kitsune Sniper]


Translhextion Disclaimer

Translhextion and its documentation are supplied as-is. The author offers no warranty of any kind. Translhextion does not promise and is not guaranteed to do anything for anybody and if there is something it doesn't do for you and your kin that you think it should it probably just doesn't like you. Further, the author accepts no liability for any loss or damage incurred by its use. No product support will be given for Translhextion. The author accepts no commitment or liability to address any problems that may be encountered in using Translhextion. Translhextion is, however, under development and the author is willing to receive reports about any bugs or deficiencies according to the guidelines specified under the topic "Contacting the Author".

© Brian Bennewitz 2000


What's New?

Whats New in 1.6c?

- Bug fixes. Lots of them.
- The documentation has been updated.
- Final version by the original author. The sources to the main program and help files are now freely available; please read the source's license for further details.


Introduction

Introduction to Translhextion 1.6c

What is Translhextion?

Translhextion is a binary file editor and translation tool for 32-bit Windows (Windows 95, Windows 98, Windows NT, Windows 2000).

Features:

- Long filename support
- Windows Explorer Context Menu integration
- Can be used as "Send to"-Target
- Drag-and-drop opening of files by dragging them into the window
- Automatically adjusts bytes displayed per hexdump line to window width
- Fully customizable including font size, character set (ANSI or OEM), and color settings for text and background
- Both Intel & Motorola binary formats supported
- Editable file size limited only by available system memory
- Small program footprint (around 200K)
- 100% FREE!

Editing Features:
- Directly enter hex values or text in main window (overwrite or insert)
- Cut, copy, & paste binary and text values
- Search for any combination of text and binary values forward or backward
- Insert, overwrite, or append bytes in a file
- Instant jumps to a particular offset
- Set bookmarks to easily access offsets
- Load files partially
- Save parts of files
- Bit manipulation
- Export as hexdump to file or clipboard
- Compare files
- Special byte-code syntax for describing byte, word, longword, float and double binary values in text form to use with find and paste functions
- Apply binary templates for structured information
- Read-only mode
- Changed bytes are displayed in a different user-selectable color for easier viewing
- Highlight specific bytes in a different, user-selectable color for easier viewing
- File offsets can be displayed in standard hex/decimal, HiROM SNES, or LoROM SNES formats

Translation Features:
- Standard "Thingy" translation table compatibility
- 1-byte, 2-byte, & 3-byte "Thingy" table tokens are supported
- View file as ASCII or using a "Thingy" table
- View Hiragana & Katakana Japanese text directly using a "Thingy" table
- Directly edit a script using "Thingy" tables in-program
- Search or replace using "Thingy" tables
- Relative search, save search results, generate "Thingy" tables from results
- Convert "Thingy" tables to and from Shift-JIS, EUC-JIS, & Romaji
- Script dumping to file or to the screen using "Thingy" tables
- Script replacement using "Thingy" tables
- Automatic movement of Japanese punctuation
- Clean-dump-mode for printable scripts
- Script file tile-byte optimization using DTE, MTE, multi-byte values, & "Thingy" tables
- Special "separated-byte" script format for easy translation

© Brian Bennewitz 2000


Using And Distributing Translhextion

Copyright and Permission notice

Copyright © 1999,2000,2001 Brian Bennewitz

All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, provided that the above
copyright notice(s) and this permission notice appear in all copies of
the Software and that both the above copyright notice(s) and this
permission notice appear in supporting documentation.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Except as contained in this notice, the name of a copyright holder
shall not be used in advertising or otherwise to promote the sale, use
or other dealings in this Software without prior written authorization
of the copyright holder.

If you are going to update the program, the help file, the font (Januschan
Jome Regular) and the original license must be included with it. The icon is
owned by Square Soft and the name Januschan is trademarked. Hence, if you
try to make money with this program, Square may take action against you. So
please do not try to do anything of the sort.

Instructions to compile the program and suggestions for improving it are
included in the source documentation.

© Brian Bennewitz 2000


Known Bugs

- Increasing the number of bytes displayed per line (when automatic is disabled) beyond 30 causes Translhextion to behave erratically on some systems
- Windows 2000 sometimes won't display the Thingy IME window but you can still use it even though you can't see it. To fix this, close any open windows that have "topmost" priority since the IME is system modal
- Trying to insert a script beyond the end of the file is not currently possible, the script gets truncated at the last byte whether it is done being inserted or not
- Tables with lines ending in carriage return characters produce bizarre negative effects
- There are a few selection redraw bugs


In the future

Here is a list of features that I'm definitely planning to include in an upcoming release:

- More versatile Relative Search including relative replace
- Buffered input/output to increase speed
- Data analysis for increased speed


Can you help?

If there are experts out there who can give me information about the following topics in a format that I can understand it would be much appreciated. I will use any information about these topics to add features to Translhextion. If you are such an expert, please contact me. (Contacting the Author)

I would appreciate a brief lesson on pointer calculation from a binary perspective (geared towards SNES roms rather than another kind if it helps). I know what pointers are; I just don't understand what this feature of Thingy DOES exactly and how I can implement a similar feature.

Pointer calculations
in addition to script insertions, you can insert updated pointer tables as
well. first, make your insert bookmark and have that all set up. Next, you
need to add another line in your table file that looks like this:

&CE804h-200h

Thingy includes support for two types of pointers: standard pointers and
relative pointers.

For standard pointers:
The first address is the beginning location of your table file. The second
address is the size of the header (For NES games this is 10h, for SNES games this is 200h.)

For relative pointers:
Same as standard pointers except make the header size 0.
I'd like to implement more tile formats and dimensions in Infontile but I need more documentation on how they are stored. If you have documentation or knowledge about these formats and are willing to help in this area I would appreciate it.

I'd like some information about converting between standard hex addresses and various types of rom addresses

If anyone has info about SNES rom expansion and header editing, I would gladly accept information about that as well.


Contacting the Author

Guidelines:

I am a student and as such I don't have much free time to be trying to sort through thousands of e-mails a day. As much as I would love to hear that my program is being appreciated I simply cannot have every single user sending me e-mail. With that in mind, here is what I request:

You can send me e-mail if:

- You have any comments on Translhextion. Unfortunately, as of version 1.6c, there is no support for any bugs the program may have.

- You desire an interview for publication or employment.

- I know you by name.

Please send e-mail to me at:
bennewit@cs.uiuc.edu

Homepage
The final version of the program and source code is hosted at Kitsune Sniper's webpage: http://vice.parodius.com/


Acknowledgments

Special Thanks to:

Necrosaro - The creator of the original Thingy. I could never get Thingy to work for me so I was inspired to write my own. I actually started out by looking at Thingy's source code but I didn't get very far because it was a little messy. But there is still a big thanks for pioneering this wonderful idea. In addition, thanks is due for detailed explanations about Thingy's functionality.

Raihan Kibria - (rkibria@hrz1.hrz.tu-darmstadt.de) I used many of his dialog resources in Translhextion as well as his original byte-code syntax and Template features. He was one of the primary inspirations behind this project.
(http://www.tu-darmstadt.de/~rkibria)

Richard Bush - The creator of SearchR2, a relative search engine. This program was the first time I'd ever heard of "relative search" and so, even though I am implementing it very differently, big thanks here.

CecilE2233 - This is the person who got me started on emulation way back in 1996. Though I am probably not remembered, I will never forget. I can't thank them enough though.

Zophar - The mind behind the incredible "Zophar's Domain" (http://www.zophar.net) which has been my mecca since it began in 1997.

Naflign - Thanks goes out to Naflign for walking me through a tutorial on Japanese punctuation and for testing a number of different features for me.

Kitsune Sniper [David Silva García] - (kitsune@terra.com) The HTML engineer of this help file who generously offered to rewrite my documentation in HTML by hand. Thanks goes to Kitsune for making this help file a work of art.
(http://vice.parodius.com)

ABBA - I coded Translhextion in its entirety while listening to the ABBA Gold CD. Without them you wouldn't be reading this : )

And many other people who will be listed here when I think of them...


Frequently Asked Questions

The following should no longer be applicable:

Q: Why does Translhextion freeze up when I dump/replace/optimize large scripts?

A: It doesn't really freeze!! Task Manager may say "Not responding" but unless Translhextion actually crashed violently it hasn't stopped ticking. Any operation that uses the table heavily can be VERY time consuming depending on your machine and the size of the scripts. One of the features I plan to add soon is a progress indicator for these operations so that the program doesn't appear to be frozen. The best solution for the time being is just to wait :)

Q: Why does Translhextion freeze up when I perform a relative search?

A: It doesn't really freeze!! Task Manager may say "Not responding" but unless Translhextion actually crashed violently it hasn't stopped ticking. Search relative uses a complex algorithm to ensure accuracy and so it can take some time. One of the features I plan to add soon is a progress indicator for this operation so that the program doesn't appear to be frozen. The best solution for the time being is just to wait :)


History of Changes

Whats New in 1.6b?

- Unreleased version.

Whats New in 1.6?

- Added the ability to do search for a hex string as an alternative to text using the standard "Find" command
- Added the option to reset the change color of changed bytes to the default byte color upon saving the file

    + This option is now the default though you can change it as desired

- Added 2-byte functionality to the ' ^ ' table extension which you can use to highlight specific bytes in a user-selectable highlight color
    + Syntax is as follows: ^xx
    + Alternatively, for 2-byte values the syntax is: ^xxxx

- Added the option to view hex offsets in SNES HiROM and LoROM formats

    + When in a SNES hex mode, all hex inputs will be interpreted in that format
      ~ This includes boomarks and script dump marks added manually or by tables

- Removed the need to "activate" Thingy Tables, now they are active when they are loaded
- Now the ascii for DTE values is displayed in a different, user-selectable color so they are easy to see
- Improved the speed of loading a file
- Changed Automatic Bytes Per Line setting to be turned off when first entering Thingy View
- Changed "Color Settings" dialog to accommodate new colors
- Fixed the window resizing crashing bug
- Fixed a problem with partial open that incorrectly displayed the number of changed bytes when saving
- Fixed the problem where highlighting didn't get removed when a new table was loaded
- A number of aesthetic changes have been made
- The documentation has been updated to reflect new changes

What's New in 1.5?

- By request, a new feature called "Thingy IME" allows you to directly enter dynamically table-encoded text into a file

    + Now you don't have to dump a script to a file or to the screen to edit it
    + You can enter text in insert or overwrite modes
    + Text you enter is encoded on the fly as you type it
    + Load and activate a table and press <ENTER> and you're ready to go
- After dumping a Japanese script you will now be given the option to merge punctuation characters with the characters they modify which produces a more Thingy-like script
- By request, added the ability to hide/show the hex pane for easy script viewing
    + This mode does not allow editing
- Now any bytes that get changed are displayed in a different, user-selectable color so they are easy to see
- Extended Thingy Table functionality with ' ^ ' which you can use to highlight specific bytes in a user-selectable highlight color
    + Syntax is as follows: ^xx
- Changed "Color Settings" dialog to accommodate new colors
- Fixed a majority of the selection color bugs
    + Selected text color now works as it should
- Translhextion will now attempt to automatically install the included Japanese font when it runs for the first time
- A number of aesthetic changes have been made
- The documentation has not only been updated but is now in HTML Help format thanks to Kitsune Sniper

What's New in 1.4?
NOTE: The included font must be installed in the system font directory (usually C:\WINDOWS\FONTS or C:\WINNT\FONTS) for most of the new features to work.

- Added a custom-made Japanese font which displays Hiragana and Katakana characters in "Thingy view"

    + both Shift-JIS and EUC-JIS table files are supported by this feature
    + single Japanese characters (2 bytes) or pairs of Japanese characters (4 bytes) will display correctly
- Added table conversion between Shift-JIS and EUC-JIS
    + tables can also be converted to and from Romaji but there are some bugs here still
    + the loaded table is dynamically converted, saved, and reloaded so backup your table files
- Changed the behavior of the "Copy" command when "Thingy view" is enabled to copy the script data to the clipboard instead of the ascii data
    + new line characters don't seem to paste correctly in notepad and other windows programs though it looks fine when saved and viewed in DOS edit

- Added speed hack that speeds up non-japanese script manipulations
    + automatically assumes ">" if no ! or @ characters are indicated which avoids unnecessary punctuation-movement calculation
- Fixed a major bug where "Save" didn't work at all though "Save as" worked fine
- Fixed a crash bug that occurred when scrolling down to last byte when in "Thingy view"
- Fixed a bug in Value Scan Relative that caused it to stop working after searching once and then changing the search string
- A number of aesthetic changes have been made
- The documentation has been updated

What's New in 1.3?

- Changed script output format
    + When separated-byte format is disabled, the output no longer has MTE & multi-byte values enclosed yielding a much cleaner script (only numeric & unknown values are enclosed)
    + A second newline is output after an endstring token yielding a slightly cleaner script
    + These features break backwards compatibility with previously dumped scripts so don't replace a script dumped with an older version with this version
    + This also means that you need to manually enter two newlines after an endstring token when writing scripts now
- Removed "Normal Compression" from the script optimization feature which now uses maximum compression all the time to achieve the best results (averages about a 40% reduction in # of bytes from a non-byte-separated script)
- Added progress bars in many places
    + Now you will KNOW it isn't frozen during dumps/replacements/optimizations & relative searches

- Added a new feature called "Value Scan Relative" which is actually a modified version of the original (1.0) relative search engine which can be used to search using non-western alphabets (which the new engine cannot do)
    + The new feature allows you to search the whole file using a sequence of decimal, hex, or character values
    + It allows you to have byte-wildcards
    + You can save the same data about the results to a file
    + Use "Search Relative" & "Scan Relative" for finding western-alphabet (arabic) strings containing a mixture of [A-Z] [a-z] [1-9] because it searches using the relationships in the arabic alphabet
    + Use "Value Scan Relative" to find relative results based on offsets (which is why you shouldn't mix case with this engine for the arabic alphabet at least) in any alphabet
- Added the ability to select a certain number of bytes to "Select Block" in addition to the existing offset range selection
- Add/Remove/Clear bookmarks now all save changes to the loaded table
- Added ability to enable clean dumping (#), & change the status of punctuation movement (>) to the Table Toolbar
    + Changes are saved to the loaded table
- Implemented another speed hack in the dumper which is a significant speed increase for large scripts
- Fixed a bug in the table-handling code which caused certain tokens not to load
- Fixed a bug in the script-dump-bookmark feature that made only one of the bookmarks work at a time
- A number of aesthetic changes have been made
- The documentation has been updated

What's New in 1.2?

Thingy table compatibility enhanced dramatically:

- Linked values ( $xx=## ) have been implemented and tested up to value 99
    + you can have as many as you want
- Japanese punctuation movement has been implemented in the style of Thingy
    + now !xx, @xx, and > are all supported within tables
    + punctuation movement is supported in both the dumper & the reinserter
      ~ if it was switched during a dump it will be switched back during a replace
    + much thanks to Necrosaro & Naflign for walking me through this
- Now # is supported as well for dumping truly clean scripts!
- Thingy-view is now nearly identical to the way Thingy views files

The table-handling code has been tweaked resulting in the following features:
- 2 & 3-byte values are now supported unlike when I said they were but they really weren't
    + this includes the endstring & newline tokens
    + this has been tested this time
    + it has NOT been tested on Dakuten/Handakuten values though they should work too
- Translhextion shouldn't crash anymore if a file is opened as a table and is not a table
- Bookmarks added during program operation are now automatically saved to the loaded table file if a table file is loaded
- A new encoding option has been added to the "Optimize Script" function
    + choose between normal (old-style) or maximum compression (new!)
      ~ normal compression still just optimizes a script using DTE only
      ~ maximum compression will optimize a script using DTE, MTE, & multi-byte values!!!!!!
        - unfortunately, this can be slow at times
    ~ maximum compression can be used to make a "clean-dumped" script (#) reinsertable
      - (except of course for any numeric values that got stripped)
- Fixed a large number of table-loading bugs which were the cause of frustration for many
    + if you're table has a carriage return at the end of each line you will still have problems
- Fixed a bug in the dumper which probably never affected anyone but you never know
- Added another speed-hack in the dumper/reinserter which yields more speed Yay! (not very dramatic this time)

The following has also been changed:
- A new feature called "Relative Scan" has been implemented
    + the old style of saving relative search results to a file has been removed
    + now relative search is just for finding and selecting values
    + relative scan will relative search the whole document
      ~ you can view the offsets, & relative offsets of the search immediately
      ~ you can then choose to save the results to a file
      ~ you can also generate a skeletal Thingy table from the relative offsets of a found sequence

- A new feature has been added which notifies you before saving if the file's size has changed
    + it tells you by how many bytes the file has changed +/-

- A number of small bugs have been fixed here and there especially in the relative search algorithm
- A number of aesthetic changes have been made
- The documentation has been updated

What's New in 1.1

The table-handling code has been re-engineered resulting in the following features:
- Script dumping/replacing/optimizing is MUCH MUCH FASTER!!!! We're talking multiple orders of magnitude here
- Option to view file as literal ascii OR as equivalent table values (in the style of Thingy & Thingy32) thanks to table speed increase
- Table values can be up to 3-bytes (though only 2-byte values have been thoroughly tested) except for newline and endstring values which can be up to 2-bytes

- "Table Active" has been moved to a floating tool bar along with the Thingy-style view option

The search relative code has been rewritten to be much more versatile:
- It is no longer limited to search strings of a single case
- It is no longer limited to ONLY alphabetic OR numeric search strings
- Any of the following characters may be used in any combination in a search string [A - Z],
[a - z], and [1 - 9]. Any other character is treated as a byte-wildcard!

- An option has been added to search the remainder of the open file and save the results to a separate file with all sorts of useful information a la SearchR
- Unfortunately this makes the relative searching process slower : (

The following has also been changed:
- An Intelligent Right-Click menu has been added which allows the following operations only when appropriate:
    + Cut
    + Copy
    + Paste
    + Paste preview
    + Dump Script
    + Replace Script
    + Hexdump
    + Jump to
    + Select All
- The documentation has been updated
- Other numerous small bugs have been fixed


Translhextion's Main Window

The window's title shows the name of the currently loaded file in square brackets, with an asterisk on it's right side if the file has been changed. If a file is loaded, you will find something like this in the window's client area:

000000 23 42 34 53 56 45 76 45 #B4SVEvE
000008 64 56 0a bc 0a 35 c0 08 dV...5..
000010 06 be 09 07 bb 07 00 00 ........
000018 00 00 00 00 00 00 07 __ .......

On the far left are the offsets of the first byte in the line in hexadecimal notation. You can choose the offset length with the Options/Preferences command. Then come the actual byte values, with vertical separating lines after every fourth byte in the line. You can choose the number of bytes to display per line with the Options/Preferences, and also, if it should be automatically adjusted to the window width. To the far right are the character representations of these values, with dotted lines on the left and right of this section. You can choose the character set for these representations as well as the font size with the Options/Preferences command. As you can see, the first byte of the second line of the sample hexdump has the hexadecimal value 64 and the corresponding character is a lower case "d". The position after the last byte of the file is marked with a double underscore "__" in the byte section.

Blinking in the window somewhere is a rectangular caret, if the window is enabled. If it is in the byte section, then it stands on either of the two nibbles (half-bytes). If it is in the character section, then it stands on one character corresponding with one byte. In either case the corresponding other representation is shown inverted in the other section.
On the bottom of the window is the status bar, which displays additional information. In the first section of the status bar you can find the current offset of the byte which the caret is marking in hexadecimal and decimal notation. After that come the bits of the current byte. Also in this section, on the right side, is something like this:

Unsigned: B:35,W:16931,L:1395933731
These are the values of the byte (B:), the word (W:) and the longword (L:) value starting at this offset in decimal notation. These are computed depending on the setting for signed or unsigned values (Choose with command Options/Preferences) and on the binary mode setting, either Little-endian (Intel format) or Big-endian (Motorola format). Choose with command Options/Binary mode.
In the second section of the status bar are indicators for:

- character set: "ANSI" or "OEM".
- entering mode: "OVR" for overwriting or "INS" for inserting on keyboard input. If Translhextion is in read-only mode, then there will be a "READ" here.
- binary mode: "L" for Little-endian or "B" for Big-endian.
In the third section the file size in bytes is displayed.
The window also has a vertical and a horizontal scrollbar, which can be used to scroll the view. They don't change the caret position.

Moving the caret in the file

You can move the caret with the arrow keys. Press TAB to toggle the editing mode between byte and character editing.You can also jump to any position by choosing the Offset/Jump to... command and entering an offset, like "125", which will set the caret position to offset 125 decimal. For relative jumps in the file, for example if you want to go to an offset 150 bytes after the current one, you have to start with "+" as the first character and follow this with either a decimal number or a hex number starting with "x". So to jump 150 bytes forward you have to enter "+150" or "+x96" in hex notation. For backward relative jumps start with "-" (minus) as the first character. To jump directly to the end of the file press Ctrl+End, for the beginning Ctrl+Home.

Translhextion can find text and binary values in a file. Choose Search/Find to do this. In the dialog you can choose if the case of the text parts of the find string are to be ignored and the find direction. To encode binary values, Translhextion uses a special byte-code syntax developed by Raihan Kibria.

Example:
Here is the find string.<bd:0>FloatValue<fl:-14.56>
This will cause Translhextion to search for a string "Here is the find string." followed by a zero-byte, then the text "FloatValue" and a 4-byte float with the value -14.56.

Note that coded binary values will also be transformed by the "match case" option of the Find command, so if you search for a byte with the hex value of 0x41 (this is the upper-case letter "A") with the match-case option disabled, then Translhextion will also find bytes with the hex value 0x61 (the lower-case letter "a"). Therefore you should always search for discrete binary values with case-matching enabled or you might not get correct results.
Please see Using the special syntax for further information.

The Search/Find next and Search/Find previous commands find the next or previous occurrence of the find string last entered in the Find-dialog, with the match-case option enabled or disabled as chosen in it.
By positioning the mouse cursor on a byte or a character and pressing the left mouse button you can also set the caret position.
You can also move in the file by choosing one of the bookmarks in the "Bookmarks" menu section. The caret will be set to that offset immediately.

Editing the file

There are several ways to edit the data in the file. But you will only be able be to change the file in any way if the Read-only mode is disabled. To enable or disable the read-only mode choose the File/Read-only on/off command. If the read-only mode is enabled, there will be "READ" written in the status bar and the menu item will be checked.

Using the keyboard
For overwriting data the overwriting entering mode must be enabled, that means, the status bar must show "OVR" somewhere. Toggle the entering mode with the Insert-key on the keyboard or choosing Insert/Toggle keyboard insert/overwrite mode . You can overwrite the data in the bytes section by moving the cursor to the appropriate position and pressing any of the hexadecimal digits 0-9 and a-f on the keyboard. The nibble the caret is marking currently will be set to that value and the caret will then go on to the next nibble. If the caret is in the bytes section, pressing any alphanumeric key will set the current byte (that which the caret is marking) to that value, and the caret will go on to the next byte.

For inserting data the status bar must show "INS" somewhere. Entering data now will insert a byte at the current position.


Special Byte-code Syntax

Byte-, word- and longword data can be encoded as follows:

    <{Size}{Numeral system}:{Value}>
    Size:
    b for byte-size (8 bit) value.
    w for word-size (16 bit) value.
    l for longword-size (32 bit) value.

    Numeral System:
    d for decimal system.
    h for hexadecimal system.

    For floating point values set Size and Numeral system to:
    "fl" is for float values.
    "do" is for double values.

    Value:
    Enter the value of the datum after the colon.

Examples:
<bd:-15> means byte-size datum with decimal value -15.
<wh:23f0> means word-size datum with hexadecimal value 23f0.
<ld:1234567890> means longword-size datum with decimal value 1234567890.
<fl:2.5> means float-size datum with value 2.5.
<do:1.8e7> means double-size datum with value 1.8 * 10^7.

Note: If you want to find or paste a valid special syntax string like <bd:0> as text, then prefix a \ to <. This will turn < into a normal character. Copying a < in the file will insert the \ automatically.

Backslashes ("\") in the file are copied and encoded as double backslashes ("\\").

Data ranges and sizes:
Integers:
Byte:
signed from –128 to 127

unsigned from 0 to 255

Word (2 bytes):
signed from –32,768 to 32,767

unsigned from 0 to 65,535

Longword (4 bytes):
signed from –2,147,483,648 to 2,147,483,647

unsigned from 0 to 4,294,967,295

Floating point types:
Float (4 bytes):
range 3.4E +/- 38 (7 digits)

Double (8 bytes):
range 1.7E +/- 308 (15 digits)

Byte-code syntax developed by Raihan Kibria.


Binary file primer

What are binary files?
All the files on your computer, programs as well as documents, are really large "lists" of numbers. Imagine a numbered list like this one:
0) 24
1) 33
2) 9
3) 0
4) 115
The numbering starts at zero. At each list index there is a number, for example the number 9 is at index "2". The index is usually called "offset". Translhextion displays the current offset in the lower left corner of it's window. Large files contain many numbers, small files not so many. The numbers in the list can have a value between 0 and 255, for a special reason: Each number is a "byte".

What are bits and bytes?
"Bit" is an abbreviation for "BInary digiT". It can have a value of either 0 or 1. One bit alone is not very useful, because already the number 2 can not be described with it. So you take many bits to describe large numbers. This is how it works:
The normal decimal system you know, with digits from 0 to 9, describes numbers larger than 9 by arranging several digits in such a way that each position in the number means something different.

For example the number "245" means really "2 times 100 + 4 times 10 + 5 times 1". The further left a digit's position in the number, the higher a value it contributes to the number. Every time you go one step left in the number, you multiply the digit there with 1, 10, 100, 1000 and so on and add that value to what you already have. The values you have to multiply the digit *with* can be obtained if you start out with 1 on the far right, then multiply with 10 every time you go left. So you get to multiply with 1, then with 1*10=10, then with 10*10=100, then 10*100=1000 and so on. This is our "base 10" number system.

Now the *binary system* is a "base 2"-system. A binary number might looks like this: 1011
This is not "one thousand and eleven", as it would be in the decimal system. In the decimal system we multiplied the digits at the various positions with a 1, 10, 10*10=100, 10*100=1000 and so on, but this time, in the binary system (also known as "dual system"), we multiply with 1, 2, 2*2=4, 2*4=8, 2*8=16 and so on, starting at the right and doing with a "2" what we did with a "10" before. So the value of the binary number above is "1 times 1 +1 times 2 + 0 times 4 + 1 times 8", giving us the number "11" in our decimal system.

Computers use bits to calculate everything, because they can be modeled as "current on" or "current off" easily. With a packet of 4 bits (called a "nibble") you can describe the numbers from 0 to 15. A packet of 8 bits is called a "byte", and *these* are what the file contains. Each byte can describe a number from 0 to 255.
So, a file is a list (or "array") of "bytes", with each byte at a certain index or "offset". These bytes are what Translhextion displays in the middle of the screen, but in yet another different number system: the "hexadecimal" system, which is a system with the base 16. So there are 16 digits, the normal ones from 0 to 9, and additionally the letters "a" through "f" with following values:

a = 10
b = 11
c = 12
d = 13
e = 14
f = 15
So the "hex" (short for "hexadecimal") number "f14a" means: "10 times 1 + 4 times 16 + 1 time 16*16(=256) + 15 times 16*256(=4096)", giving a value of 61770 in decimal. The point of using hex numbers is that values of up to 255 (maximum value of a byte) can be described by employing up to 2 hexadecimal digits, which gives a neat and ordered output on hex editors such as Translhextion.
On the right side of the Translhextion window there are "normal" letters, punctuation symbols and so on. This is because each byte can be seen as an index to a symbol in a "character set". This means that the computer stores for example the letter "a" as a number with the value 97 ("61" in hex notation), the comma "," as a number 44 and so on. So if you write a text on the computer and save it to disk, then the file will contain a number of bytes, each byte signifying a letter, other symbol, or a special code number for "End of line" or "Tabulator" and such. But there are several character sets in use (for example Windows uses either the ANSI or the OEM character set): In one character set the number 97 might mean the letter "a", but in another it could be used for the apostrophe.

Primer provided by Raihan Kibria


Text Encoding

Every computer ever made has had some method of displaying and encoding text. A computer doesn't recognize the letter 'A' in its microprocessor; everything within the computer is dealt with using hexadecimal bytes like 00, F1, and AC. In order for the computer to be able to translate these hexadecimal numbers into letters and numbers that you and I read, a conversion table is used. There will usually be 255 possible entries within a table since bytes only go up to FF (255 in decimal numbers). But, usually only about 1/2 of them are used, since alphabets hardly take up 255 slots. For IBM compatible computers, the table standard has been known as 'ASCII'.

Within the ASCII table, hexadecimal number $41 (hexadecimal numbers are usually denoted with a $ in front of them) represents the letter 'A'. From then on, $42 stands for 'B', $43 for 'C', etc... up to 'Z'. The lower case letters start at $61 ($61 for 'a'). Also, the characters '0..9' are represented by $30 to $39. The other bytes consist of less common characters such as the 1/2 symbol (½), the copyright symbol (©), and the asterisk (*). Also, some of them are used for control codes like $07, which is reserved for the system beep you hear when you turn on your computer.

Not all computers use the ASCII standard. The Macintosh does not use the ASCII standard, and neither do gaming consoles.

Certain platforms, after encoding the alphabet, numbers, and punctuation use what is left of the 255 possible table entries as DTE (Dual Tile Encoding) and MTE (Multiple Tile Encoding) values.


Thingy Tables

Most of the following is an excerpt from the Thingy98 readme. Comments are made regarding what is supported by Translhextion and what is not. Such comments are written following a '//'

ABOUT THE .TBL FILES
~~~~~~~~~~~~~~~~~~~~
The TBL files are alot alike the Xlate and Hexpose table files, but not
the same. Hey, thingy tables are standard now. If you don't like it, tough.
You can make as many lines as you want, in this format:

80=0
9A= this
5F=ed
30= t
0400=Cecil
Ah, important part...there are some "special" values that are common in some
games, and some special modifiers to make your script dumps special-like.

*xx = Newline Value (you can have up to 2 i think)
//only one at a time is supported, the hex can be up to three bytes long if needed

/xx = End String Value (you can have up to 2 i think)
//only one at a time is supported, the hex can be up to three bytes long if needed

$xx=x = "Linked" values(?)
    Specifying $02=x then automatically displays the <$xx> value of x characters after it. So putting in $02=1 would display: <$02><$xx> where xx is the hex value of the next 1 char.

//an unlimited number of these is supported but the value must be <= 99

!xx = Dakuten Value
//only one at a time is supported, the hex can be up to three bytes long if needed

@xx = Handakuten Value
//only one at a time is supported, the hex can be up to three bytes long if needed

> =
    Tells script dumper to look for Dakuten/Handakuten value AFTER
    the char it modifies, not before.
    i.e. to search for [wa"taleølelk] normally would produce:
    [wa(t")ale(lø)elk].
    If you use the > option in your TBL file, it would produce:
    [w(a")tal(eø)lelk].

//supported

# =
    Doesn't print ANY <$xx> commands. Make your scripts look clean!
    Taking out the <END>s are easy, just replace them with blank in DOS Edit.
//supported, though it is unwise to try and replace a script dumped in this mode

^xx = Highlight Byte

//this is a Translhextion extension of Thingy Table functionality
//the specified byte will be displayed in the highlight color
//an unlimited number of these is supported though only single bytes are allowed

BOOKMARKS
Bookmarks are helpful when you want to save a ROM address so you can go back to it later.
You can make bookmarks by directly editing the table file.
The bookmark will look like this:

(80600h)Text Block 1

The number is the address, text is the description.

//table bookmarks are loaded to the bookmarks menu automatically when a table is loaded
//any bookmarks added during program operation are saved to the table file
//any bookmarks removed during program operation are removed from the table file

SCRIPT DUMPING
If you are thinking of dumping something more than once, i would suggest
making a script dump bookmark.
A script dump bookmark will look like this:

[80600h-8D600h]Dialogue Block 1

the first number is the beginning, the second number is the end, and the text
is the name.

//script dump bookmarks are loaded to the script menu automatically when a table is loaded

SCRIPT INSERTION
Add a "insert bookmark" line to your .tbl file. Example:

{80600h-FF4dump.txt}Dialogue Block 1
^^^^^^ The address to insert the script to.
^^^^^^^^^^^ The filename to get the script from.
^^^^^^^^^^^^^^^^ Description of the "insert bookmark".

//insert bookmarks are NOT supported because you can make a regular bookmark and insert
//from there

Pointer calculations

in addition to script insertions, you can insert updated pointer tables as
well. first, make your insert bookmark and have that all set up. Next, you
need to add another line in your table file that looks like this:

&CE804h-200h

Thingy includes support for two types of pointers: standard pointers and
relative pointers.

For standard pointers:
The first address is the beginning location of your table file. The second
address is the size of the header (For NES games this is 10h, for SNES games
this is 200h.)

For relative pointers:
Same as standard pointers except make the header size 0.

//no part of this is supported because I don't understand it but I'd love to implement it.
//If you know about this, refer to Can you help?


DTE (Dual Tile Encoding)

Certain platforms, after encoding the alphabet, numbers, and punctuation as single tiles, use what is left of their 255 possible character table entries as DTE (Dual Tile Encoding) and MTE (Multiple Tile Encoding) values.

In the case of DTE this means that some of the remaining hex values are assigned common "dual-tiles".

Example:

In Final Fantasy 2 (US) the following hex values are SOME of the dual-tiles representing common character pairs.

HEX TILE
... ...
8C  th
8D  he
8F  ou
92  er
93  in
... ...
If DTE is used extensively, it makes determining the encoding table very difficult because guesses would have to be made about how DTE is used.


MTE (Multiple Tile Encoding)

Certain platforms, after encoding the alphabet, numbers, and punctuation as single tiles, use what is left of their 255 possible character table entries as DTE (Dual Tile Encoding) and MTE (Multiple Tile Encoding) values.

In the case of MTE this means that some of the remaining hex values are assigned common "multiple-tiles". This can mean that one byte can represent an entire word or that two or more bytes together can represent an entire word (multi-byte values).

Example:

In Final Fantasy 2 (US) the following hex values are SOME of the multiple-tiles (in this case, multi-byte values) representing common names.

HEX    TILE
...    ...
04 00  Cecil
04 01  Kain
04 02  Rydia
04 03  Tellah
...    ...
If MTE and multi-byte values are used extensively, it makes determining the encoding table very difficult because guesses would have to be made about how they are used.


Separated-byte Format

I developed this format as a way of dumping a script leaving a clear indication of how many bytes I had to work with during the translation process. Basically, scripts dumped in this format have single-byte DTE (Dual Tile Encoding) and multiple-byte MTE (Multiple Tile Encoding) values enclosed in ' { ' and ' } ' which I call byte-literals.
NOTE: ONLY CHARACTER PAIRS THAT ALREADY EXIST AS DUAL-TILES IN THE EDITING FILE CAN BE INCLUDED IN THE TABLE AND PLACED BETWEEN BRACKETS AS A BYTE-LITERAL. YOU CANNOT MAKE UP YOU'RE OWN DTE VALUES WITHOUT DOING GRAPHICS AND/OR ASSEMBLY CODE EDITING. THE SAME HOLDS TRUE FOR MTE VALUES.

The output looks like this:

C{re}w:Cap{ta}{in} {Cecil},
{ w}{e }{ar}{e }ab{ou}t{ t}o{ a}rri{ve}!
{Cecil}:G{oo}d.{END}

C{re}w:{Wh}y{ a}r{e }w{e }{ro}bb{in}g
{ c}{ry}{st}{al}{s }f{ro}m {in}{no}c{en}t
{ p}eop{le}?
C{re}w:T{ha}t'{s }{ou}{r }d{ut}y.
C{re}w:Do{ w}{e }{re}{al}l{y }{ha}v{e }{to}
k{ee}p{ d}o{in}g{ t}h{is}?{END}

C{re}w:Cap{ta}{in}!
C{re}w:W{e }c{an}'{t }{st}{an}{d }do{in}g
{ t}h{is}{ a}nymo{re}!

Each byte is clearly identifiable. A character literal or newline literal that is one byte is displayed normally, a DTE value is displayed between brackets and represents one byte, an end block literal is displayed between brackets, and multi-byte values like "Cecil" in this case (which is 2-bytes) are also in brackets. If the number of replacemement bytes is crucial, and it often is, this format makes it easy to keep track of the number of bytes you have to work with. If the text you are editing is going to remain very similar to what it already is, this format is best. This format is also faster to replace.

When this format is not enabled the same output looks like this:

Crew:Captain Cecil,
we are about to arrive!
Cecil:Good.{END}

Crew:Why are we robbing
crystals from innocent
people?
Crew:That's our duty.
Crew:Do we really have to
keep doing this?{END}

Crew:Captain!
Crew:We can't stand doing
this anymore!

This format is easier to read but if it is replaced without using the optimization feature (Script/Optimize Script...) then each character literal will be one byte. Most often, that is not desirable. As you can see, an end block literal is still displayed between brackets. Any numerical values or unknown values will also be displayed in brackets. If you are writing a script which needs to occupy as few bytes as possible, it is best to dump to this format, then write the script, and finally use the optimization feature (Script/Optimize Script...) to crunch the number of bytes down.


Character charts

The ASCII character set

The ANSI character set:

The OEM character set:


Creating new files (command File/New)

If Translhextion is started without parameters or with a nonexistent filename as parameter, then it starts with a new, empty file that is untitled. If a file is already loaded, then choose File/New from the menu. If a file is already loaded and it has been changed, then you will be prompted if you want to lose the changes.


Opening files (command File/Open...)

If Translhextion is started with command line parameters, then the whole string following the program name is considered to be the name of the file to open.

Examples:
Translhextion filename.dat opens the file called "filename.dat"
Translhextion a file-name.dat opens the file called "a file-name.dat"
Note: In the Options/Preferences menu you can choose to associate Translhextion with a Windows Explorer Context menu and simply right click to open files in Translhextion. Also, if you put a link to Translhextion.exe into the "SendTo"-Folder in your main Windows directory then you can open any file from the Explorer with Translhextion by choosing Translhextion from the "Send To"-item in the file's context menu.

You can also choose File/Open from the menu. If a file is already loaded and it has been changed, then you will be prompted if you want to lose the changes.

A file can also be dragged (for instance from the Windows Explorer window) into Translhextion's window to open it. If several files were dragged, then only the first one will be opened.


Opening files partially (command File/Open partially...)

If you want to edit a very large file and it's not necessary to load all of it into memory, choose this command. First you will have to choose the file you want to open in a File-Open-dialog. Then you must enter the offset from which the file will be loaded and how many bytes to load, or you can check the "Open partially from end of file"-radio button if you want to load data from the end of the file.

Translhextion will now be in partially-opened-mode, which means that whenever you choose the File/Save, the data will be written back to the position they were loaded from. This mode is indicated by a letter "P" in the window title after the file name.


Reverting to the saved file (command File/Revert)

When you have made changes to a file and want to change it back and cannot remember the exact bytes in the file then this command will do it for you.


Close (command File/Close)

This command closes the current file. If the current file has been changed, then you will be prompted if you want to lose the changes.


Saving files (command File/Save)

To save the current file choose File/Save from the menu. You will be notified if the file size has changed before saving.


Saving files (command File/Save as...)

If the file has never been saved before, then you have choose File/Save as to name the file.


Read-only on/off (command File/Read-only on/off)

You will only be able be to change the current file if the Read-only mode is disabled. To enable or disable the read-only mode choose the File/Read-only on/off command. If the read-only mode is enabled, there will be "READ" written in the status bar and the menu item will be checked.


Recent Files (command File/Recent Files)

This sub-menu provides access to a list of the files most recently edited by Translhextion. You can use this to open a file in the list it by clicking on it.


Exit (command File/Exit)

This command closes Translhextion. If the current file has been changed, then you will be prompted if you want to lose the changes.


Properties... (command File/Current File/Properties...)

This command displays information about the currently loaded file. You can choose to copy this information to the clipboard if desired.


Deleting the current file (command File/Current File/Delete)

This deletes the file currently opened in the editor and closes it. This requires a double confirmation because it could be disastrous.


Apply template... (command File/Current File/Apply template...)

Use this command to apply a binary template on the file. A binary template consists of a text file with the extension "tpl" that contains a number of variable type+name combinations, such as this:

BYTE filetype
WORD version
DWORD filelength
This sample template file named "sample.tpl" is included in the Translhextion directory. When the command is chosen from the menu you will be prompted to choose the template file you want to apply. Translhextion will then load that file and use the code in it to give you a structured "interpretation" of the data in the currently loaded file, starting at the current byte. The result will be displayed in the edit-box of a dialogue, from where you can copy the result to the clipboard if necessary. The result looks like this:

File: C:\Data\test.dat
Template file: C:\Translhextion\sample.tpl
Applied at offset: 15

BYTE filetype = 66 (signed) = 66 (unsigned) = 0x42 = 'B'
WORD version = 30285 (signed) = 30285 (unsigned) = 0x764d
DWORD filelength = 8 (signed) = 8 (unsigned) = 0x8

-> Length of template = 7 bytes.

Following variable types are recognized: (recognition is case-sensitive, so "byte" is not recognized as type "BYTE")
- a byte-size value: "BYTE", "char".
- a word-size value: "WORD", "short".
- a longword-size value: "DWORD", "int", "long", "LONG".
- a float value: "float".
- a double value: "double".
The File/Open in text editor command:
This function attempts to call an external text editing program with the current file as argument. Default editor is the Windows Notepad. You can choose the editor in the Options/Preferences... dialogue.

Template feature developed by Raihan Kibria


Open in text editor (command File/Current File/Open in text editor)

This command opens the current file in the text editor specified in Options/Preferences.... If no text editor has been specified, this command opens the current file in Windows Notepad.


Cut (command Selection/Cut)

This command is used to remove bytes from the file. These bytes can either be copied to the clipboard (as text with special Byte-code syntax for non-character bytes) or just deleted. In the dialog you can choose the start offset where the cutting begins (the byte at that offset is the first to be cut), how many bytes to cut (specify either the offset of the last byte to cut or the number of bytes including the first byte to be cut, and check the appropriate radio button). If the data should be cut to the clipboard, check the checkbox on the bottom of the dialog box.

If the command is chosen without a selection, then the values in the dialog will be set so that the byte at the current offset will be cut.


Copy (command Selection/Copy)

This command is used to copy bytes from the file to the clipboard. It is similar to the Selection/Cut command, only the data will only be copied, not removed. If "Thingy view" is enabled, this command will copy the script data rather than the usual ascii data.


Paste (command Selection/Paste)

This either inserts or overwrites data from the clipboard starting at the current offset. Choose a radio button for the writing mode wished for. You can also choose how many times the current data is written.

If "Paste coded binary values as text" is unchecked, all data in the clipboard is considered to contain special byte-code syntax, so <ld:150> will not be written as the text "<ld:150>" but as a longword value of 150. Check the checkbox if you want to paste as text. The binary mode (Little or Big-endian) and character set (ANSI or OEM) is used as set in the options.


Paste preview (command Selection/Paste preview)

This either inserts or overwrites data starting at the current offset. Choose a radio button for the writing mode wished for. The big edit-box is initialised with the current text content of the clipboard. Since Edit-boxes can not hold very large amounts of data (around 64K), please use Selection/Paste to paste such large blocks of memory. You can also choose how many times the current data is written.

If "Paste coded binary values as text" is unchecked, all data in the edit-box is considered to contain special syntax, so <ld:150> will not be written as the text "<ld:150>" but as a longword value of 150. Check the checkbox if you want to paste as text. The binary mode (Little or Big-endian) and character set (ANSI or OEM) is used as set in the options.


Delete (command Selection/Delete)

This command calls the same dialog as the Selection/Cut command, only with the "cut to clipboard" checkbox already disabled.


Select All (command Select All)

This command selects all the bytes in the current file.


Select block... (command Selection/Select block...)

With this you can explicitely choose what block of data is to be selected, by specifying start and either the end offset of the block or the number of bytes to select.


Exporting the file as a hexdump text (command Selection/Export as hexdump)

This command is used if you need the hexdump of the file in plain text form, for example if you need to insert it in a word processor document. You can either put the hexdump into the clipboard or into a file, which you will have to choose. The start line of the hexdump has to be specified (in hexadecimal notation without prefix), which you can find on the left side of the window, for example 23c or 134. You must also specify the end line. The values in the dialog will be initialized so that the whole file will be dumped, if there is nothing selected, or they will be such that the current selection will be dumped.


Saving selections (command Selection/Save selection as...)

To save the current selection to a file choose "Selection/Save selection as..." from the menu.


Jump to... (command Offset/Jump to...)

This command will move the caret to the specified offset and scroll so that the offset is in view.


Get floating point value (command Offset/Get floating point value)

This command displays the floating point value of the current byte.


Manipulate bits (command Offset/Manipulate bits)

If you need to manipulate individual bits in a byte, then go to this byte with the caret and choose the command. Check the appropriate check boxes for the bits and select OK. The boxes are initialized with the current value.


Compare from current offset... (command Offset/Compare from current offset...)

If you need to compare two files then load one into Translhextion and choose this command. You will first be prompted to choose the file to compare with. Choose a file and then the OK button. Comparison will occur from the current caret offset.
If the chosen file matches the data in the loaded file from the current offset, you will be prompted so. Otherwise you will get a list of areas of difference to choose from. Areas of difference are ranges of bytes which are different in the files. For example:

File 1: 00 01 02 03 04 (loaded file)
File 2: 00 ff ff 03 04

In this case you will get one area of difference 2 bytes in size from offset 1 to 2. These offsets are measured relative to the current caret position. When you choose an area of difference then it will be selected and displayed in the main window.

The Offset/Get floating point value command:
This will show you the floating point values starting at the current caret position.

The File/Current File/Properties... command:
Choose this to get the filename, path and size of the current file, and also the total number of lines of the hexdump.


Toggle hex/character editing (command Insert/Toggle hex/character editing)

This command toggles whether keyboard input will be interpreted as entering the nibbles of hex values or entering the hex value of the actual character key pressed.


Toggle keyboard insert/overwrite mode (command Insert/Toggle keyboard insert/overwrite mode)

This command toggles whether keyboard input will be inserted between bytes at the caret or if it will overwrite bytes at the caret.

For overwriting data the overwriting entering mode must be enabled, that means, the status bar must show "OVR" somewhere. Toggle the entering mode with the Insert-key on the keyboard or choosing Insert/Toggle keyboard insert/overwrite mode . You can overwrite the data in the bytes section by moving the cursor to the appropriate position and pressing any of the hexadecimal digits 0-9 and a-f on the keyboard. The nibble the caret is marking currently will be set to that value and the caret will then go on to the next nibble. If the caret is in the bytes section, pressing any alphanumeric key will set the current byte (that which the caret is marking) to that value, and the caret will go on to the next byte.

For inserting data the status bar must show "INS" somewhere. Entering data now will insert a byte at the current position.


Insert decimal value... (command Insert/Insert decimal value...)

With this you can overwrite data with an integer value of either byte, word or longword size. The start offset is initialized with the current offset, in hexadecimal notation. Note that if you change the start offset, use hexadecimal notation and prefix with "x". You can also choose the number of times to overwrite or insert and the size of the value. The values are initialized with the current offset, the value of the current offset, byte size and 1 time.


Insert bytes at end... (command Insert/Insert bytes at end...)

This command appends a number of zero-bytes to the file.


Insert file... (command Insert/Insert file...)

This inserts the requested file between the current byte and previous one.


Find (command Search/Find)

Translhextion can find text and binary values in a file. In the Find dialog you can choose if the case of the text parts of the find string are to be ignored and the find direction. You can choose to search for a literal hex string such as the following:
"07AB1CF5"

You can do this by choosing to search for hex instead of text. To encode binary values in the same string as text values, Translhextion uses a special byte-code syntax developed by Raihan Kibria.

Example:

Here is the find string.<bd:0>FloatValue<fl:-14.56>

This will cause Translhextion to search for a string "Here is the find string." followed by a zero-byte, then the text "FloatValue" and a 4-byte float with the value -14.56.

Note that coded binary values will also be transformed by the "match case" option of the Find command, so if you search for a byte with the hex value of 0x41 (this is the upper-case letter "A") with the match-case option disabled, then Translhextion will also find bytes with the hex value 0x61 (the lower-case letter "a"). Therefore you should always search for discrete binary values with case-matching enabled or you might not get correct results.

Please see Using the special syntax for further information.


Find using table... (command Search/Find using table...)

Translhextion can use standard Thingy Tables to find encoded text in a file. In the dialog you can choose whether you want to "Optimize" the bytes of the find string (see below) and you can select the search direction.

NOTE: Because of the nature of Thingy Tables, all searches using tables are CASE SENSITIVE.

What is the difference between enabling and disabling "Optimize bytes"?

The answer to this question requires a good understanding of Thingy tables and DTE (Dual Tile Encoding). You may also want to read about MTE (Multiple Tile Encoding). The answer, in short, is as follows:

NOTE: In the following explanation, where braces ' { ' and ' } ' are used they represent the default value of the separated-byte left enclosure & right enclosure characters which can be specified in Options/Preferences... You must use the characters specified in this setting while using any table-related command!

"Optimize bytes" disabled:

The search string is parsed through the Thingy table with each byte translated literally. Each character literal is translated into its equivalent character literal in the table without considering DTE, MTE, or multi-byte values and each byte literal of the form {XX} is translated into it's equivalent multi-character-byte literal using DTE and MTE.

Example:

If I want to search for "Crystal" in Final Fantasy 2 (US), it happens to be encoded in two forms, the first with all character literals (7-bytes) and the second using DTE (4-bytes). As you can see, byte-literals must be used to find the DTE version of "Crystal".

FIND STRING | STRING FOUND | BYTES
Crystal | "Crystal" | 7-bytes
C{ry}{st}{al} | "Crystal" | 4-bytes

If, however, I want to search for "Crew" instead, it cannot be found using this setting without typing in byte-literals because the only encoding of it uses DTE (3-bytes).

FIND STRING | STRING FOUND | BYTES
Crew | N/A | 0-bytes
C{re}w | "Crew" | 3-bytes

Finally, if I want to find an MTE value such as "Cecil" I MUST enter the byte-literal to find it.

FIND STRING | STRING FOUND | BYTES
Cecil | N/A | 0-bytes
{Cecil} | "Cecil" | 2-bytes

"Optimize bytes" enabled:

The search string is parsed through the Thingy table and DTE, MTE, & multi-byte replacements are made where possible. DTE, MTE, & multi-byte byte-literals CAN still be used if desired.

Example:

If I want to search for "Crystal" in Final Fantasy 2 (US), it happens to be encoded in two forms, the first with all character literals (7-bytes) and the second using DTE (4-bytes). In this case, the DTE version is found with or without typing in byte-literals.

FIND STRING | STRING FOUND | BYTES
Crystal | "Crystal" | 4-bytes
C{ry}{st}{al} | "Crystal" | 4-bytes

*NOTE: This setting CANNOT be used to find the 7-byte version of "Crystal" at all which is why the other setting is available.

If, however, I want to search for "Crew" (DTE, 3-bytes) instead, it be found with or without typing in byte-literals using this setting.

FIND STRING | STRING FOUND | BYTES
Crew | "Crew" | 3-bytes
C{re}w | "Crew" | 3-bytes

Finally, if I want to find an MTE value such as "Cecil" I can enter the byte-literal to find it or I can just search for the string itself.
FIND STRING | STRING FOUND | BYTES
Cecil | "Cecil" | 2-bytes
{Cecil} | "Cecil" | 2-bytes

The reason "Optimize bytes" is recommended is because *MOST* game data is usually optimized using DTE, MTE, & multi-byte values if they are present at all. This means that most of the time you are looking for a string that is fewer bytes than the number of characters you typed. The only time this setting isn't useful is when the string you are searching for COULD have used DTE, MTE, or a multi-byte value but didn't.


Find next (command Search/Find next)

This command looks for the next occurrence of the last find string that was specified. The command will find the next occurrence of the find string using whichever search type you last chose. This means that it will repeat a vanilla "Find" or a "Find using table..." or a "Relative search".


Find previous (command Search/Find previous)

This command looks for the previous occurrence of the last find string that was specified. The command will find the previous occurrence of the find string using whichever search type you last chose. This means that it will repeat a vanilla "Find" or a "Find using table..." or a "Relative search".


Replace (command Search/Replace)

Translhextion can find text and binary values in a file and replace them with other text and binary values you specify. In the Replace dialog you can choose if the case of the text parts of the find string are to be ignored and the find/replace direction. To encode binary values, Translhextion uses a special byte-code syntax developed by Raihan Kibria.

In addition to replacing individual values, you can replace all occurrences prior to or following the current selection by choosing the appropriate button under "Replace all..."

Example:
Here is the find string.<bd:0>FloatValue<fl:-14.56>
This will cause Translhextion to search for a string "Here is the find string." followed by a zero-byte, then the text "FloatValue" and a 4-byte float with the value -14.56.

Note that coded binary values will also be transformed by the "match case" option of the Find command, so if you search for a byte with the hex value of 0x41 (this is the upper-case letter "A") with the match-case option disabled, then Translhextion will also find bytes with the hex value 0x61 (the lower-case letter "a"). Therefore you should always search for discrete binary values with case-matching enabled or you might not get correct results.

This example applies to the replace string as well.

Please see Using the special syntax for further information.


Replace using table... (command Search/Replace using table...)

Translhextion can use standard Thingy Tables to find and replace encoded text in a file. In the dialog you can choose whether you want to "Optimize" the bytes of the find and replace strings (see below) and you can select the search and replace directions.

NOTE: Because of the nature of Thingy Tables, all searches using tables are CASE SENSITIVE.

In addition to replacing individual values, you can replace all occurrences prior to or following the current selection by choosing the appropriate button under "Replace all..."

What is the difference between enabling and disabling "Optimize bytes"?

The answer to this question requires a good understanding of Thingy tables and DTE (Dual Tile Encoding). You may also want to read about MTE (Multiple Tile Encoding). The answer, in short, is as follows:

NOTE: In the following explanation, where braces ' { ' and ' } ' are used they represent the default value of the separated-byte left enclosure & right enclosure characters which can be specified in Options/Preferences... You must use the characters specified in this setting while using any table-related command!

"Optimize bytes" disabled:

The search and replace strings are parsed through the Thingy table with each byte translated literally. Each character literal is translated into its equivalent character literal in the table without considering DTE, MTE, or multi-byte values and each byte literal of the form {XX} is translated into it's equivalent multi-character-byte literal using DTE and MTE.

Example:

If I want to search for or replace "Crystal" in Final Fantasy 2 (US), it happens to be encoded in two forms, the first with all character literals (7-bytes) and the second using DTE (4-bytes). As you can see, byte-literals must be used to find and replace the DTE version of "Crystal".
FIND STRING | STRING FOUND | BYTES
Crystal | "Crystal" | 7-bytes
C{ry}{st}{al} | "Crystal" | 4-bytes

REPLACE STRING | STRING REPLACED | BYTES
Crystal | "Crystal" | 7-bytes
C{ry}{st}{al} | "Crystal" | 4-bytes

Lets say I want to search for or replace "Crew" instead. It cannot be found using this setting without typing in byte-literals because the only encoding of it uses DTE (3-bytes). Because of this, without using byte-literals, a 4-byte version would be replaced if "Crew" was entered as the replace string.
FIND STRING | STRING FOUND | BYTES
Crew | N/A | 0-bytes
C{re}w | "Crew" | 3-bytes

REPLACE STRING | STRING REPLACED | BYTES
Crew | "Crew" | 4-bytes
C{re}w | "Crew" | 3-bytes

Finally, if I want to find an MTE value such as "Cecil" I MUST enter the byte-literal to find it. If a byte-literal is not used in the replace string then each character literal is translated and used instead.
FIND STRING | STRING FOUND | BYTES
Cecil | N/A | 0-bytes
{Cecil} | "Cecil" | 2-bytes

REPLACE STRING | STRING REPLACED | BYTES
Cecil | "Cecil" | 5-bytes
{Cecil} | "Cecil" | 2-bytes

"Optimize bytes" enabled:

The search and replace strings are parsed through the Thingy table and DTE, MTE, & multi-byte replacements are made where possible. DTE, MTE, & multi-byte byte-literals CAN still be used if desired.

Example:

If I want to search for or replace "Crystal" in Final Fantasy 2 (US), it happens to be encoded in two forms, the first with all character literals (7-bytes) and the second using DTE (4-bytes). In this case, the DTE version is found or replaced with or without typing in byte-literals.
FIND STRING | STRING FOUND | BYTES
Crystal | "Crystal" | 4-bytes
C{ry}{st}{al} | "Crystal" | 4-bytes

REPLACE STRING | STRING REPLACED | BYTES
Crystal | "Crystal" | 4-bytes
C{ry}{st}{al} | "Crystal" | 4-bytes

*NOTE: This setting CANNOT be used to find or replace the 7-byte version of "Crystal" at all which is why the other setting is available.

Lets say I want to search for or replace "Crew" (DTE, 3-bytes) instead. It be found or replaced with or without typing in byte-literals using this setting.
FIND STRING | STRING FOUND | BYTES
Crew | "Crew" | 3-bytes
C{re}w | "Crew" | 3-bytes

REPLACE STRING | STRING REPLACED | BYTES
Crew | "Crew" | 3-bytes
C{re}w | "Crew" | 3-bytes

Finally, if I want to find an MTE value such as "Cecil" I can enter the byte-literal to find it or I can just search for the string itself. The same holds true for the replace string.
FIND STRING | STRING FOUND | BYTES
Cecil | "Cecil" | 2-bytes
{Cecil} | "Cecil" | 2-bytes

REPLACE STRING | STRING REPLACED | BYTES
Cecil | "Cecil" | 2-bytes
{Cecil} | "Cecil" | 2-bytes

The reason "Optimize bytes" is recommended is because *MOST* game data is usually optimized using DTE, MTE, & multi-byte values if they are present at all. This means that most of the time you are looking for a string that is fewer bytes than the number of characters you typed. This also means that most of the time you want to replace data in the fewest possible bytes (DTE, MTE, MBV) as well. The only time this setting isn't useful is when the string you are searching for COULD have used DTE, MTE, or a multi-byte value but didn't OR you specifically don't want to you apply DTE, MTE, or multi-byte values to your replace string even though you can.


Search Relative... (command Search/Search Relative...)

In short, search for a find string relatively in a file. The dialog allows you to choose whether you want to search for the next instance in a specific direction. You may search for strings containing the characters (A - Z), (a - z), and (1 - 9). Any other character in the find string is treated as a byte-wildcard. Please not this is only useful for finding strings using the western alphabet (arabic alphabet).

If I want to search for string but I don't have a table for the file's text encoding then I have to search for it relatively. This works only if the string does not make use of DTE. Please note that the reason DTE (Dual Tile Encoding) is considered to be a pain among table makers is because you cannot easily search for strings relatively if they use DTE. MTE (Multiple Tile Encoding) is hated even more. In addition, it must be noted that just because a string was found in the file matching your search string it does not necessarily mean that it IS in fact equal to the search string. It just means that the found string's characters are RELATED to each other in exactly the same way as the search string's characters are RELATED to each other.

This works best when there are at least 2 of each type of character (I.E. if there is one lower case letter in the string, adding a few more would work better. The same goes for upper case & for numbers)

Example
SEARCH FOR | POSSIBLE RESULTS
"Chocobo" | "Chocobo", "Zhocobo", "4hocobo", "Qipdpcp", etc.
"Cho*o*o" | "Chocobo", "Cho o o", "ChoZoZo", "QipQpQp", etc.
"I am here" | "I am here", "ILamLhere", "Zeamqhere", "QQbnQifsf", etc.
"uR8tE5" | "uR8tE5", "vS9uF6", etc.

You may wonder why you would get a result like "Qipdpcp" when searching for "Chocobo". The answer to this is that the letters in "Qipdpcp" are related in the same way as the letters in "Chocobo". This illustrates why relative search is not an exact science. The likelihood of someone choosing to encode (or encoding by accident) "Qipdpcp" AND "Chocobo" in the same file is not great but it is something to be aware of. The shorter the search string and the more common the letter combinations the more likely it is that you're results will not be what you want.

Technique Explanation:

You may wish to read about "Text Encoding" before you read this.

What relative search does is it will take a word you give it that you know is going to
appear somewhere in your file, and searches for words of the same length whose characters are related in same way (by the same offsets) as the characters in the search string. It searches by assuming that if the letter A is for example entry $00, then B must be entry $01, and so on. It uses the offset between each character in a string as the comparison. For example, the difference in the offset between A and B is almost always 1. So, if we searched for "ABBA" then we would find all words whose characters have offsets matching (1,0,1) as "ABBA" does. This can turn up a number of inaccurate matches if a short string with common letters is used.


Scan Relative... (command Search/Scan Relative...)

Search for all instances of a find string relatively in a file. The dialog allows you to choose whether you want to search for the next instance in a specific direction. You may search for strings containing the characters (A - Z), (a - z), and (1 - 9). Any other character in the find string is treated as a byte-wildcard. You can save results to a file from this dialog. You can also generate a skeletal "Thingy" Table from the relative offsets of one of the resulting found sequences. If the search string contained only lowercase letters the table would only contain (a - z). If uppercase and numbers where in the search string then they too would be in the resulting table. Please not this is only useful for finding strings using the western alphabet (arabic alphabet).

If I want to search for string but I don't have a table for the file's text encoding then I have to search for it relatively. This works only if the string does not make use of DTE. Please note that the reason DTE (Dual Tile Encoding) is considered to be a pain among table makers is because you cannot easily search for strings relatively if they use DTE. MTE (Multiple Tile Encoding) is hated even more. In addition, it must be noted that just because a string was found in the file matching your search string it does not necessarily mean that it IS in fact equal to the search string. It just means that the found string's characters are RELATED to each other in exactly the same way as the search string's characters are RELATED to each other.

This works best when there are at least 2 of each type of character (I.E. if there is one lower case letter in the string, adding a few more would work better. The same goes for upper case & for numbers)

Example
SEARCH FOR | POSSIBLE RESULTS
"Chocobo" | "Chocobo", "Zhocobo", "4hocobo", "Qipdpcp", etc.
"Cho*o*o" | "Chocobo", "Cho o o", "ChoZoZo", "QipQpQp", etc.
"I am here" | "I am here", "ILamLhere", "Zeamqhere", "QQbnQifsf", etc.
"uR8tE5" | "uR8tE5", "vS9uF6", etc.

You may wonder why you would get a result like "Qipdpcp" when searching for "Chocobo". The answer to this is that the letters in "Qipdpcp" are related in the same way as the letters in "Chocobo". This illustrates why relative search is not an exact science. The likelihood of someone choosing to encode (or encoding by accident) "Qipdpcp" AND "Chocobo" in the same file is not great but it is something to be aware of. The shorter the search string and the more common the letter combinations the more likely it is that you're results will not be what you want.

Technique Explanation:

You may wish to read about "Text Encoding" before you read this.

What relative search does is it will take a word you give it that you know is going to
appear somewhere in your file, and searches for words of the same length whose characters are related in same way (by the same offsets) as the characters in the search string. It searches by assuming that if the letter A is for example entry $00, then B must be entry $01, and so on. It uses the offset between each character in a string as the comparison. For example, the difference in the offset between A and B is almost always 1. So, if we searched for "ABBA" then we would find all words whose characters have offsets matching (1,0,1) as "ABBA" does. This can turn up a number of inaccurate matches if a short string with common letters is used.


Value Scan Relative... (command Search/Value Scan Relative...)

Search for sequences that match a list of relative offsets in a file. The dialog allows you to define a sequence of relative offsets by entering decimal, hex, or ascii values as well as byte-wildcards. The dialog also allows you to choose whether you want to search for the next instance in a specific direction. This feature is best put to use on non-western alphabets** or for searching for abstract data like pointers. You can save results to a file from this dialog.

If I want to search for string but I don't have a table for the file's text encoding then I have to search for it relatively. This works only if the string does not make use of DTE. Please note that the reason DTE (Dual Tile Encoding) is considered to be a pain among table makers is because you cannot easily search for strings relatively if they use DTE. MTE (Multiple Tile Encoding) is hated even more. In addition, it must be noted that just because a string was found in the file matching your search string it does not necessarily mean that it IS in fact equal to the search string. It just means that the found string's characters are RELATED to each other in exactly the same way as the search string's characters are RELATED to each other.

Technique Explanation:

You may wish to read about "Text Encoding" before you read this.

What relative search does is it will take a word you give it that you know is going to
appear somewhere in your file, and searches for words of the same length whose characters are related in same way (by the same offsets) as the characters in the search string. It searches by assuming that if the letter A is for example entry $00, then B must be entry $01, and so on. It uses the offset between each character in a string as the comparison. For example, the difference in the offset between A and B is almost always 1. So, if we searched for "ABBA" then we would find all words whose characters have offsets matching (1,0,1) as "ABBA" does. This can turn up a number of inaccurate matches if a short string with common letters is used.

**It can be used to search for strings using the western-alphabet but only strings completely composed of either all uppercase, all lowercase, or all numbers will produce good results.


Add bookmark... (command Bookmarks/Add bookmark...)

Choose this to add a bookmark to the bookmark list. The offset will be interpreted as a different value dependent upon the Options/Offset Mode setting. The offset of the bookmark will be set to the current position initially. You can also add a description for the bookmark that will also appear in the menu. Bookmarks added in this way are automatically saved into the loaded table if a table is loaded.


Remove bookmark... (command Bookmarks/Remove bookmark...)

Choose this to remove a bookmark from the bookmark list. You will be presented with a list of the bookmarks and have to choose the one to remove. Bookmarks removed in this way are automatically removed from the loaded table if a table is loaded.


Clear all bookmarks (command Bookmarks/Clear all bookmarks)

Deletes all bookmarks. Bookmarks cleared in this way are automatically cleared from the loaded table if a table is loaded.


Bookmarks (command Bookmarks/Bookmarks)

These menu items allow you to jump to the location of the bookmark instantaneously by clicking on them.


Open Thingy table... (command Script/Open Thingy table...)

Translhextion's translation functions try to maintain compatibility with standard Thingy Tables. This command allows you to load a table file into memory so that you can use Translhextion's other translation functions. Only one table may be loaded at a time and you must choose to activate the table in the "Script" menu if you want to use it.


Recent Tables (command Script/Recent Tables)

This sub-menu provides access to a list of the table files most recently loaded by Translhextion. You can use this to open a table file in the list it by clicking on it.


Convert Table... (command Script/Convert Table...)

This command will present the option to convert the loaded, active table to/from the Shift-JIS, EUC-JIS and Romaji encodings. This conversion is instantaneous and saves/reloads the open table dynamically so back up your table.


Dump Script... (command Script/Dump Script...)

This command is used to dump bytes from the file, parse them through a Thingy Table, and export them as a readable script. These bytes can either be exported to the screen (dialog) or to a file. In the dialog you can choose the start offset where the dumping begins (the byte at that offset is the first to be dumped) and how many bytes to dump (specify either the offset of the last byte to dump or the number of bytes including the first byte to be dump, and check the appropriate radio button).

If the command is chosen without a selection, then the values in the dialog will be set so that the byte at the current offset will be cut.

You have the option of dumping a script using "Separated-byte Format" (If you read nothing else in this help file, go read about this) or as vanilla text as desired. When replacing scripts, it is important to check appropriately whether this format was used or not on the script file to be replaced. If Separated-byte Format was used, the same left enclosure & right enclosure characters that were used in the dumping of the script MUST be specified (this can be done in Options/Preferences...).

If your script has Dakuten or Handakuten characters in it a prompt will ask if you would like to merge them with the characters they modify. This procedure creates the script in the same way that Thingy does. Choosing this method means the script will lose its punctuation if you attempt to re-insert it without making changes to it. Choosing no to this option will create a script that can be re-inserted but punctuation characters will be separate from the characters they modify.

If you chose to dump the script to the screen then another dialog will appear allowing you to view, edit, and reinsert (optional) the script. It should be noted that as of this release there is no "optimization" of the script when it is reinserted and so DTE (Dual Tile Encoding) is not used even where possible. If you choose to reinsert a script from this dialog you will be warned if the number of bytes to be reinserted is different from the number dumped. Currently there is no "true" insertion from this dialog, only overwriting so you can choose to have excess bytes overwrite existing values or you can truncate the inserted script.


Replace Script... (command Script/Replace Script...)

This command is used to replace a script in the form of bytes to the current file. In the dialog you can choose the start offset where the replacing begins (the byte at that offset is the first to be replaced). You can also choose the offset where the replacing should end or you can keep replacing until the end of the script is reached.

If the command is chosen without a selection, then the values in the dialog will be set so that the byte at the current offset will be replaced.

You have the option of dumping a script using "Separated-byte Format" (If you read nothing else in this help file, go read about this) or as vanilla text as desired. When replacing scripts, it is important to check appropriately whether this format was used or not on the script file to be replaced. If Separated-byte Format was used, the same left enclosure & right enclosure characters that were used in the dumping of the script MUST be specified (this can be done in Options/Preferences...).

You can also choose whether you want to pad remaining bytes in the range specified with '00' if the script file has been completely replaced before the end of the range has been reached.

Before replacing a script, you may want to use "Script/Optimize Script..." to make the best use of your bytes. After this function has been used, the script has the same property as if you had dumped the script with Separated-byte Format enabled.


Optimize Script... (command Script/Optimize Script...)

This command parses a script file through a Thingy Table making the best possible use of DTE (Dual Tile Encoding), MTE (Multiple Tile Encoding) and multi-byte values for the words in the script. It outputs another script file in "Separated-byte Format" that, if DTE, MTE, or multi-byte values are available and applicable, should take up less bytes when reinserted into a file.

This can be used to convert a script that is not in Separated-byte Format to one that is.


Script Dump Bookmarks (command Script/Script Dump Bookmarks)

These sub-menu items allow you to dump common script locations in a file automatically by clicking on them. Adding bookmarks to this list requires editing your Thingy Table
file.


Find using table... (command Script/Find using table...)

Translhextion can use standard Thingy Tables to find encoded text in a file. In the dialog you can choose whether you want to "Optimize" the bytes of the find string (see below) and you can select the search direction.

NOTE: Because of the nature of Thingy Tables, all searches using tables are CASE SENSITIVE.

What is the difference between enabling and disabling "Optimize bytes"?

The answer to this question requires a good understanding of Thingy tables and DTE (Dual Tile Encoding). You may also want to read about MTE (Multiple Tile Encoding). The answer, in short, is as follows:

NOTE: In the following explanation, where braces ' { ' and ' } ' are used they represent the default value of the separated-byte left enclosure & right enclosure characters which can be specified in Options/Preferences... You must use the characters specified in this setting while using any table-related command!

"Optimize bytes" disabled:

The search string is parsed through the Thingy table with each byte translated literally. Each character literal is translated into its equivalent character literal in the table without considering DTE, MTE, or multi-byte values and each byte literal of the form {XX} is translated into it's equivalent multi-character-byte literal using DTE and MTE.

Example:

If I want to search for "Crystal" in Final Fantasy 2 (US), it happens to be encoded in two forms, the first with all character literals (7-bytes) and the second using DTE (4-bytes). As you can see, byte-literals must be used to find the DTE version of "Crystal".
FIND STRING | STRING FOUND | BYTES
Crystal | "Crystal" | 7-bytes
C{ry}{st}{al} | "Crystal" | 4-bytes

If, however, I want to search for "Crew" instead, it cannot be found using this setting without typing in byte-literals because the only encoding of it uses DTE (3-bytes).
FIND STRING | STRING FOUND | BYTES
Crew | N/A | 0-bytes
C{re}w | "Crew" | 3-bytes

Finally, if I want to find an MTE value such as "Cecil" I MUST enter the byte-literal to find it.
FIND STRING | STRING FOUND | BYTES
Cecil | N/A | 0-bytes
{Cecil} | "Cecil" | 2-bytes

"Optimize bytes" enabled:

The search string is parsed through the Thingy table and DTE, MTE, & multi-byte replacements are made where possible. DTE, MTE, & multi-byte byte-literals CAN still be used if desired.

Example:

If I want to search for "Crystal" in Final Fantasy 2 (US), it happens to be encoded in two forms, the first with all character literals (7-bytes) and the second using DTE (4-bytes). In this case, the DTE version is found with or without typing in byte-literals.
FIND STRING | STRING FOUND | BYTES
Crystal | "Crystal" | 4-bytes
C{ry}{st}{al} | "Crystal" | 4-bytes

*NOTE: This setting CANNOT be used to find the 7-byte version of "Crystal" at all which is why the other setting is available.

If, however, I want to search for "Crew" (DTE, 3-bytes) instead, it be found with or without typing in byte-literals using this setting.
FIND STRING | STRING FOUND | BYTES
Crew | "Crew" | 3-bytes
C{re}w | "Crew" | 3-bytes

Finally, if I want to find an MTE value such as "Cecil" I can enter the byte-literal to find it or I can just search for the string itself.
FIND STRING | STRING FOUND | BYTES
Cecil | "Cecil" | 2-bytes
{Cecil} | "Cecil" | 2-bytes

The reason "Optimize bytes" is recommended is because *MOST* game data is usually optimized using DTE, MTE, & multi-byte values if they are present at all. This means that most of the time you are looking for a string that is fewer bytes than the number of characters you typed. The only time this setting isn't useful is when the string you are searching for COULD have used DTE, MTE, or a multi-byte value but didn't.


Replace using table... (command Script/Replace using table...)

Translhextion can use standard Thingy Tables to find and replace encoded text in a file. In the dialog you can choose whether you want to "Optimize" the bytes of the find and replace strings (see below) and you can select the search and replace directions.

NOTE: Because of the nature of Thingy Tables, all searches using tables are CASE SENSITIVE.

In addition to replacing individual values, you can replace all occurrences prior to or following the current selection by choosing the appropriate button under "Replace all..."

What is the difference between enabling and disabling "Optimize bytes"?

The answer to this question requires a good understanding of Thingy tables and DTE (Dual Tile Encoding). You may also want to read about MTE (Multiple Tile Encoding). The answer, in short, is as follows:

NOTE: In the following explanation, where braces ' { ' and ' } ' are used they represent the default value of the separated-byte left enclosure & right enclosure characters which can be specified in Options/Preferences... You must use the characters specified in this setting while using any table-related command!

"Optimize bytes" disabled:

The search and replace strings are parsed through the Thingy table with each byte translated literally. Each character literal is translated into its equivalent character literal in the table without considering DTE, MTE, or multi-byte values and each byte literal of the form {X} is translated into it's equivalent multi-character-byte literal using DTE and MTE.

Example:

If I want to search for or replace "Crystal" in Final Fantasy 2 (US), it happens to be encoded in two forms, the first with all character literals (7-bytes) and the second using DTE (4-bytes). As you can see, byte-literals must be used to find and replace the DTE version of "Crystal".

FIND STRING | STRING FOUND | BYTES
Crystal | "Crystal" | 7-bytes
C{ry}{st}{al} | "Crystal" | 4-bytes

REPLACE STRING | STRING FOUND | BYTES
Crystal | "Crystal" | 7-bytes
C{ry}{st}{al} | "Crystal" | 4-bytes

Lets say I want to search for or replace "Crew" instead. It cannot be found using this setting without typing in byte-literals because the only encoding of it uses DTE (3-bytes). Because of this, without using byte-literals, a 4-byte version would be replaced if "Crew" was entered as the replace string.
FIND STRING | STRING FOUND | BYTES
Crew | N/A | 0-bytes
C{re}w | "Crew" | 3-bytes

REPLACE STRING | STRING FOUND | BYTES
Crew | "Crew" | 4-bytes
C{re}w | "Crew" | 3-bytes

Finally, if I want to find an MTE value such as "Cecil" I MUST enter the byte-literal to find it. If a byte-literal is not used in the replace string then each character literal is translated and used instead.

FIND STRING | STRING FOUND | BYTES
Cecil | N/A | 0-bytes
{Cecil} | "Cecil" | 2-bytes

REPLACE STRING | STRING FOUND | BYTES
Cecil | "Cecil" | 5-bytes
{Cecil} | "Cecil" | 2-bytes

"Optimize bytes" enabled:

The search and replace strings are parsed through the Thingy table and DTE, MTE, & multi-byte replacements are made where possible. DTE, MTE, & multi-byte byte-literals CAN still be used if desired.

Example:

If I want to search for or replace "Crystal" in Final Fantasy 2 (US), it happens to be encoded in two forms, the first with all character literals (7-bytes) and the second using DTE (4-bytes). In this case, the DTE version is found or replaced with or without typing in byte-literals.
FIND STRING | STRING FOUND | BYTES
Crystal | "Crystal" | 4-bytes
C{ry}{st}{al} | "Crystal" | 4-bytes

REPLACE STRING | STRING FOUND | BYTES
Crystal | "Crystal" | 4-bytes
C{ry}{st}{al} | "Crystal" | 4-bytes

*NOTE: This setting CANNOT be used to find or replace the 7-byte version of "Crystal" at all which is why the other setting is available.

Lets say I want to search for or replace "Crew" (DTE, 3-bytes) instead. It be found or replaced with or without typing in byte-literals using this setting.
FIND STRING | STRING FOUND | BYTES
Crew | "Crew" | 3-bytes
C{re}w | "Crew" | 3-bytes

REPLACE STRING | STRING FOUND | BYTES
Crew | "Crew" | 3-bytes
C{re}w | "Crew" | 3-bytes

Finally, if I want to find an MTE value such as "Cecil" I can enter the byte-literal to find it or I can just search for the string itself. The same holds true for the replace string.
FIND STRING | STRING FOUND | BYTES
Cecil | "Cecil" | 2-bytes
{Cecil} | "Cecil" | 2-bytes

REPLACE STRING | STRING FOUND | BYTES
"Cecil" | "Cecil" | 2-bytes
{Cecil} | "Cecil" | 2-bytes

The reason "Optimize bytes" is recommended is because *MOST* game data is usually optimized using DTE, MTE, & multi-byte values if they are present at all. This means that most of the time you are looking for a string that is fewer bytes than the number of characters you typed. This also means that most of the time you want to replace data in the fewest possible bytes (DTE, MTE, MBV) as well. The only time this setting isn't useful is when the string you are searching for COULD have used DTE, MTE, or a multi-byte value but didn't OR you specifically don't want to you apply DTE, MTE, or multi-byte values to your replace string even though you can.


Thingy View Active

This command enables or disables the option to view the open file as it would appear if dumped using a table instead of displaying the literal ascii values. This is the view used by Thingy & Thingy32 all the time.


Japanese

This command enables or disables the Japanese font which displays Hiragana and Katakana characters instead of their ascii equivalents when "Thingy view" is enabled. If the correct encoding of the loaded table is not selected, the output will not be accurate.

Shift-JIS
This option specifies that the table will be interpreted using Shift-JIS format when displaying Japanese characters.

EUC-JIS
This option specifies that the table will be interpreted using EUC-JIS format when displaying Japanese characters.


#

This enables/disables "clean-dump" mode in the loaded table. This setting is saved to the loaded table when it is changed.


>

This toggles the state of the punctuation moving mode in the loaded table. This setting is saved to the loaded table when it is changed.


Direct Script Editing

Thingy IME - Direct Script Editing

To directly edit a the script within a file make sure you have a table file loaded and that read-only mode is disabled. Place the cursor on the byte where you'd like to start editing, use the <INS> button to select the desired mode (either insert or overwrite), and press <ENTER>. The Thingy IME window will appear. Start typing. Your keystrokes will be encoded using the loaded table as you type. Every 100 bytes the IME window will update the file with your string and return to the IME window to allow you to keep typing. You can stop editing by pressing <ENTER> again (this will update the file with whatever is in the edit-box and close the IME window). If you accidentally open the IME window and don't want to edit the script just press <ENTER> when the edit box is empty and the IME will close.


Preferences... (command Options/Preferences...)

Here you can choose:
- To automatically adjust the number of bytes per line of hexdump or specify a value if Auto is disabled
- The number of digits for the offset length
- How to display the values at the caret position (signed or unsigned integer values)
- The character set used in displaying and writing characters (ANSI - Windows, or OEM - DOS)
- The font size in points
- The left enclosure & right enclosure (**) for Separated-byte Format as well as if the format should be used as the default for dump/replace operations

- If read-only mode should be automatically set after opening files
- To integrate/uninstall Translhextion into the Windows Explorer Context menu
- The name of the text editor that will be called by the Edit/Open in text editor command.
- The name of the Internet browser that will be called in the About dialog

(**) - These enclosure characters MUST be uniformly used during script operations. I.E. if you dump a script with one set of enclosure characters you must also replace that script using the same set!!!!


Color settings... (command Options/Color settings...)

Here you can choose the color for:

- Most text in the main window
- Even column hex
- Odd column hex
- Text background
- Selected text (not functioning properly just now)
- Selection background
- Altered bytes
- Highlighted bytes
- Bookmarks
- Separators

You can also choose to revert to the default color scheme.


Binary mode (command Options/Binary mode)

What kind of byte order to use: Either Little-endian, as used in Intel-computers or Big-endian, used for example in computers with a Motorola processor.
The difference between these modes is thus: Consider a longword, which is 4 bytes (named A to D) long.

Longword in processor register = ABCD.
The least significant bit, which has the value 1, is found in byte "D". In a processor register the longword is ordered in this way. If this value is written to a position in memory, then by Intel convention the longword is written in this way, with the growing offsets to the right:

Longword in memory = DCBA.
That is, the bytes making up the longword are written in reverse order as they are found in a processor register.

This means that a file written by a Big-endian machine will contain wrong longword and word values if read by a Little-endian machine without conversion.


Offset mode (command Options/Offset mode)

Here you can choose:
- To display the current file offset in either standard hex/decimal, LoROM SNES, or HiROM SNES offset formats
- The custom offset for the SNES header (typically 512 bytes)


Toggle Hex Pane (command View/Toggle Hex Pane)

This command hides/shows the hex portion of the window so that the ascii/script can be viewed more easily. While this view is enabled, clicking in the hex pane is disabled.


Left (command View/Left)

This command scrolls the window left.


Right (command View/Right)

This command scrolls the window Right.


Up (command View/Up)

This command scrolls the window up.


Down (command View/Down)

This command scrolls the window down.


Top (command View/Top)

This command scrolls the window to the start of the file.


Bottom (command View/Bottom)

This command scrolls the window to the end of the file.


Jump to... (command View/Jump to...)

This command will move the caret to the specified offset and scroll so that the offset is in view.


Help topics

Help topics... (command Help/Help topics...)

You ARE reading this aren't you?


About Translhextion

About Translhextion (command Help/About Translhextion)

See About Translhextion 1.6c


Fill selection with... (command Selection/Fill selection with...)

First select some of the bytes in a file then open the Fill selection with dialog from the edit menu or using Ctrl + Shift + F.
First decide if you want to enter the bytes in yourself - this is useful for small numbers of bytes and if so select Input from the combo box and enter the bytes below it.

Otherwise you may want to fill the selection with a file by selecting File from the combo box and browsing to a file (It MUST exist - this is why only browsing is allowed).

Note that if the selection is larger than the file or the hex string you entered the selection will be filled with multiple copies of your string/file and if it is smaller only a part of the string will be entered into the selection.
Note also that an odd number of hex digits will result in the first nibble of the last byte being the last hex digit entered.

e.g. "ffa" —> "ff af fa …" —> "ÿ¯ú…"
(This doesn’t apply to files as partial bytes cannot be present in files)
Then select the type of assignment operator you want to use -

= - regular assign
|= - perform a bitwise or with the current byte and then assign
&= - perform a bitwise and with the current byte and then assign
^= - perform a bitwise xor with the current byte and then assign
Below are the

File\Input Bit OpenFile Bit |= &= ^=
0 0 0 0 0
0 1 1 0 1
1 0 1 0 1
1 1 1 1 0