ROM Hack Delving into Iron Master: The Legendary Blacksmith

Gryphon93

Well-Known Member
OP
Member
Joined
Nov 30, 2008
Messages
145
Trophies
0
XP
252
Country
Last update: 14/01/2013
Introduction
I have been interested in this game ever since the first time I saw it. Unfortunately the game was never released in English (even though they worked on it), which means I haven't been able to enjoy it. I've been waiting for a translation of the game, and I've seen it in the official Translation Request-thread, but, as far as I know, no one is, or has been, working on it. That leads me to why I started this thread.

I wanted to help out a little. I don't understand a word Japanese, but I've been coding for a few years now. I've started to look into the game and tried to figure out various things about it. I've made some progress, which I'll discuss a little bit later, but first I would like to stress that this is NOT a translation project. That would be impossible, because as I mentioned earlier, I don't underestand Japanese. I want to help out and provide tools, if I can.

Progress
locstr.bin
Alright, now to something more interesting, namely what I've done so far. I've looked into how the game encodes and stores its text. Firstly, the game uses UTF-16LE (little-endian), which I found out when I was looking through one of the NFTR-files. Secondly, the game stores non-dialog text in a file called locstr.bin, which uses a really simple format:
Code:
Offset        Size        Value          Description
----------------------------------------------------
0x0000          4        0x309          Number of strings
0x0004          4        0x1850        Offset to string-data
 
Offsets relative to the string-data-offset comes next:
  -            4          -          String number
  -            4          -          String offset
 
And lastly, the string-data (null-terminated strings) at the end:
0x1850          -            -          String-data
Note: Null-terminated refers to '\u0000' in this case, not '\0' (remember, the game uses UTF-16)

I've created a simple tool in Ruby that can dump all the strings in a simple text file and also "parse" the file back to the locstr.bin-format. In the text-file the strings are encoded in UTF-8, which is a bit simpler for most text-editors to work with. When the text files is made back into a locstr-file, the strings are again coded in UTF-16LE.

To test whether locstr.bin is used by the game (and not just left there by the developers), I dumped the strings, added a symbol to the text shown in the menu-buttons (title screen), turned the text file back into a locstr-file and put it in the game. When I started the game I saw that the symbol I added showed up in the buttons, which confirmed that the game uses locstr.bin. (See screenshots further down.)

String formatting
Something I found interesting about the strings is that they seem to be printf format strings, or at least something very similar. Here are some examples from locstr.bin:
Code:
HP  : %d/%d
%s's Room
Lv %d
{0}に護衛の任務を頼む。{1}までの契約。契約金 {2}Gを支払う。

Another interesting note about the strings is that the length doesn't really matter (as far as I know) since all strings are relative to the string-data-offset. This can bee seen in the screenshots below. This means that no pointers have to be changed manually in order to get the game to print the whole string. However, I'm pretty sure the game won't automatically make the string fit into e.g. the dialog box, i.e. by "splitting" the string and letting the player progress by pressing A, or some other button. (I'll try to clarify what I mean later on, if anyone finds it hard to understand).

dlgidx.bin
This file contains the information about each dialog entry in dlgcmd.bin.

Note: I'm aware that the descriptions aren't very clear. I'll most likely rewrite them once I've completed the documentation of dlgcmd.bin.

Code:
Size      Value        Description
-----------------------------------
2        0x00E9        Number of entries (NoE)
 
Entry structure (repeated NoE times)
-----------------------------------
4        0x0000D429    Dialog entry ID
4        0xB9CD0200    Offset to dialog entry in dlgcmd.bin
4        0x38000000    Dialog entry header size
4        0xF1CD0200    Offset to dialog entry body
4        0x1C030000    Dialog entry length

dlgcmd.bin
This file contains all the dialogs in the game. Each dialog entry can have one ore more sub-dialogs. The amount of sub-dialogs in a dialog entry is specified in it's header.

[EDIT: I've removed the documentation on the dlgcmd-format for now. I'm planning on uploading it on GitHub instead. The old one was wrong in many ways, which is why it's no reason to keep it here.]

My dlgcmd tool is not available on GitHub. You'll find a link to the repository further down in the "Resources" section.
The next step
There are several other things I would like to look into, other than improving the tool I've already made. For example, I would like to look into dlgidx.bin and dlgcmd.bin, since I think they may contain something interesting. (Judging from the file names they seem to contain Dialog IDs and Dialog Commands respectively, but I may be totally wrong about that).
I'm currently working on both dlgidx.bin and dlgcmd.bin. Hopefully the documentation will be finished soon.

As for this thread, I'll probably move the documentation to GitHub instead of having them in this post. If I do that the post will be more clean and easier to read.
Resources
I keep my tools in a GitHub-repository. If you're interested you can find the repository here: IronMaster

Screenshots
locstr.bin
65cxfc.png
4sefjs.png
1628gt0.png
104hrif.png
eqr1jd.png
25spxev.png

Dialogue changes
3446neu.png
2psfxtt.png
2whi1k7.png
11btcpc.png
24vkv2o.png
344wqb8.png
mtnf3c.png
beinp2.png
9u3loo.png
Closing words
I would love to hear your thoughts. I don't know if anyone, except from me, is interested in an English translation of the game. I really like trying to figure out how the game works and how the files are formatted. If there's anyone who've already done all this work already, please tell me so that I don't go reinventing the wheel.

Updates
26/11/2012 - Add link to GitHub-repository
28/11/2012 - Add some information about dlgidx.bin and dlgcmd.bin
12/01/2013 - Add some screenshots to show how things are progressing. Remove dlgcmd documentation, since it's old and totally wrong.
14/01/2013 - Tool for dlgcmd/dlgidx is now available from the GitHub repository.
 

Frank Cadena

Well-Known Member
Member
Joined
Sep 13, 2009
Messages
317
Trophies
0
XP
123
Country
I saw that there were screenshots that were in English and I found out that the US release was cancelled so those screenshots forever taunts anyone who wanted the game in English. How does the game play? Is it any good?
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
The game has certainly been on my radar since I saw it appear on the release lists however long ago and actually looks to be a fairly interesting, if complex, game to boot, although I do note I really like trade type games ( http://gbatemp.net/threads/any-addictive-trading-game-similar-to-uncharted-waters.221086/ ). I can try to be available to help it with a few things although I have too much going on to be joining a project right now, not to mention you seem to have a lot of it under control.

Ruby as a ROM hacking language.... can't say I have ever seen that before. I certainly can't see anything inherently wrong with it as opposed to say trying to code a similar tool in matlab or something though.

Also never sweat making a thread around here saying "I pulled apart this game and look what I found" and if you have a tool you made so much the better; as far as this section goes if it is not a news thread I estimate most of my threads are me messing around with games, formats or pondering things not directly related to any project and a good chunk of my posts are quite similar. I can fairly safely say I am not alone in doing that sort of thing either, moreover if all anybody ever sees is someone swoop in, detail a complex format, laugh at the mistakes the developer made and go back to figuring out how to optimise another game at ASM level then nobody new will ever see how many stuff can actually be done with the kind of skills you can pick up in your spare time over the course of a couple of weeks.
 
  • Like
Reactions: Phoenix Goddess

Gryphon93

Well-Known Member
OP
Member
Joined
Nov 30, 2008
Messages
145
Trophies
0
XP
252
Country
Thanks for your responses!

The game has certainly been on my radar since I saw it appear on the release lists however long ago and actually looks to be a fairly interesting, if complex, game to boot, although I do note I really like trade type games ( http://gbatemp.net/threads/any-addictive-trading-game-similar-to-uncharted-waters.221086/ ). I can try to be available to help it with a few things although I have too much going on to be joining a project right now, not to mention you seem to have a lot of it under control.

Ruby as a ROM hacking language.... can't say I have ever seen that before. I certainly can't see anything inherently wrong with it as opposed to say trying to code a similar tool in matlab or something though.

I also like trade type games, and I think Iron Master might be a pretty good game of that genre. I hope someone will translate it someday, that's why I want to help out by providing tools, if I can.

I'm using Ruby since I'm learning it. I've only written a few programs in Ruby and have never really learnt it, but this is one attempt to learn the language better. I think scripting languages, like Ruby, are quite nice when working with ROM hacking. Why? Well, simply because you can make changes really fast and you don't have to wait for the program to compile each and every time you make a small change. Also, some of the more low-level stuff is handled already, so I don't have to bother about it (like easily switching between different encodings, like I do when dealing with locstr.bin)
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
Having a project like this you want to do is usually a great way to get to grips with a language (indeed you have probably taught yourself how to manipulate binary data and fiddle with other formats and libraries, even if it is just the standard one, which is a good chunk of programming) and you certainly don't have to sell any of us on scripting languages for this sort of thing. Granted most went for visual basic and nowadays probably go for python but it is not like ruby is an obscure language nobody has ever heard of.
 

Gryphon93

Well-Known Member
OP
Member
Joined
Nov 30, 2008
Messages
145
Trophies
0
XP
252
Country
I've updated the first post with some more information regarding dlgidx.bin and dlgcmd.bin. I'm done with the specification for dlgidx.bin, but the descriptions for the spec. are not very clear at the moment. I hope I'll be done with the specification for dlgcmd.bin pretty soon as well. Most things regarding dlgcmd.bin are done, but I've to dig a bit more in some places to really get it right.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
More info is always good- I forgot to mention though if you decide editing a file is not getting it done there is also a Korean version you can try comparing to see what has changed and try to infer some things from that.
 

Gryphon93

Well-Known Member
OP
Member
Joined
Nov 30, 2008
Messages
145
Trophies
0
XP
252
Country
I know about the Korean version, but I'm not sure if I want to download it. The problem right now is to figure out how the sub-dialog section in the dialog entry header really is formatted. It seems to have different structures in some cases, but that's just because I haven't figured out the exact format yet.
 

tina

New Member
Newbie
Joined
Dec 9, 2012
Messages
2
Trophies
0
Age
43
XP
52
Country
United States
Hey there Gryphon, just chiming in to let you know that yes, there are people interested in seeing this translation. This is pretty much the only blacksmith game out there, once people know about it and that there's a translated version they'll be cheching it out.

Don't give up!
 

Auryn

Well-Known Member
Member
Joined
Jul 21, 2011
Messages
559
Trophies
1
Age
51
XP
706
Country
Swaziland
So the movie here below is from the cancelled english release??


Anyway good work Gryphon93
How much story is actually in the game??
 

Gryphon93

Well-Known Member
OP
Member
Joined
Nov 30, 2008
Messages
145
Trophies
0
XP
252
Country
Hey there Gryphon, just chiming in to let you know that yes, there are people interested in seeing this translation. This is pretty much the only blacksmith game out there, once people know about it and that there's a translated version they'll be cheching it out.

Don't give up!
How much story is actually in the game??

Thanks for your responses!

To answer your question, Auryn, I have to admit that I don't know exactly how much story there is. What I can tell you though, is that there are 233 dialogs (or actually dialog "entries") in the game. There's of course more text in the game than that. The first file I looked into, the locstr.bin-file, contains a lot of "static" text (like the text on the buttons in menus and so on). There are even more files that contains object descriptions and such things, but I haven't looked much into them at the moment.

I haven't updated this thread in a while since my exams are just around the corner. My last exam for the year will be on Thursday, and after I'll hopefully be able to continue! It's quite exciting working on this project. I'm not all done with the dlgcmd.bin specification yet, but there are just a few things left to figure out, as far as I can remember. I've progressed quite a lot since last update though.
 

Zapek

New Member
Newbie
Joined
Jul 8, 2009
Messages
3
Trophies
0
XP
73
Country
Poland
I don't know if my question isn't stupid or something, but could you upload texts/story of the game in some easily accessible text format? I'm not techy enough to extract them myself :(
I'm learning japanese and am playing this game right now - translating while playing. If I had access to whole text in one file I could both play it more easily (input that text into my language learning tools) and actually write down my translation - it could serve as a base and alpha version of the translation.
I don't know if it's possible/easily doable but if it is then thank you in advance :)
 

Gryphon93

Well-Known Member
OP
Member
Joined
Nov 30, 2008
Messages
145
Trophies
0
XP
252
Country
I don't know if my question isn't stupid or something, but could you upload texts/story of the game in some easily accessible text format? I'm not techy enough to extract them myself :(
I'm learning japanese and am playing this game right now - translating while playing. If I had access to whole text in one file I could both play it more easily (input that text into my language learning tools) and actually write down my translation - it could serve as a base and alpha version of the translation.
I don't know if it's possible/easily doable but if it is then thank you in advance :)

It's nice that you're interested in translating. My plan is to make my tools export the text in JSON-format. Why? Well, simply because it's rather easy to change in a regular text editor and most programming languages have native support or libraries for reading/writing JSON (Ruby supports it natively)*. It would be pretty easy to make an "editor" in HTML/Javascript as well, which means it would be cross-platform and very portable.

I worked quite a lot on the documentation of the dlgcmd.bin-file the week before Christmas, and I'm almost done implementing my tools as well. I'll try to complete the current implementations of my tools and upload them on GitHub soon enough.

*[EDIT] Sorry, I was wrong there; It's a RubyGem.
 

Gryphon93

Well-Known Member
OP
Member
Joined
Nov 30, 2008
Messages
145
Trophies
0
XP
252
Country
Alright, I've decided that I better update this thread before someone thinks that I've abandoned the project. I've been working quite a bit on the tools (reimplementing some parts, bug fixing, json import/export), but I've also begun to look into the structure of the database files (used for NPCs, Town data, Items, etc.). I've yet to upload anything to GitHub, which is pretty bad from my side. I should've uploaded things a long time ago, but for some reason I haven't.

Anyways, I've added a few new screenshots to the first post to show my progress. My intention was to make a short video demonstrating the changes, but it didn't work out as I wanted, so I just went with screenshots. The point is to show that the dialogue has been changed and that I'm able to change the data in the database files (through a hex-editor at the moment, but the format is simple, so making a tool for it would not take long.) The only thing I changed in the database file was the name of the assistant, Hellen. It's now in english instead of japanese.

I think that wraps up this post. I'll try to clean up my code and comment it properly in the days to come.
 

Zapek

New Member
Newbie
Joined
Jul 8, 2009
Messages
3
Trophies
0
XP
73
Country
Poland
It's nice to hear that you're working on it, thank you for that :) I'm looking forward to progress towards any tools for non-coding/non-programming translators hehe :P
 

Gryphon93

Well-Known Member
OP
Member
Joined
Nov 30, 2008
Messages
145
Trophies
0
XP
252
Country
Ok, I decided to upload my tool for dlgcmd-/dlgidx-files before cleaning and commenting everything. It puts my mind to rest, since I don't like having stuff lying around. You can get the tool from GitHub (link in first post). Just download the whole repository (ZIP, tar.gz, ...) or clone it using git. You (obviously) need Ruby to run the program. I use the latest version, 1.9.3, but it should work with all 1.9.x versions, I think (I haven't tested myself). Anyways, just get the latest version and it should work. I suggest you use rvm, it's great.

If you by chance don't get json included with your Ruby installation (it's a RubyGem after all), then you can find instructions on how to get it from here: http://flori.github.com/json/
 

tina

New Member
Newbie
Joined
Dec 9, 2012
Messages
2
Trophies
0
Age
43
XP
52
Country
United States
Alright thats great to hear! You seem to have gotten access to the dialog, main menu and some of the trailer screens, huge leap! Is there a lot left that you need to figure out as well?
 

Gryphon93

Well-Known Member
OP
Member
Joined
Nov 30, 2008
Messages
145
Trophies
0
XP
252
Country
Alright thats great to hear! You seem to have gotten access to the dialog, main menu and some of the trailer screens, huge leap! Is there a lot left that you need to figure out as well?
As far as I know, the only tool I have left to create is one for the database files. I think that will take care of all the remaining text parts of the game (that is, all the text in the game except from the text in some images). I've figured out pretty much everything I need to know about the database files to make the text editable (not all the other stuff in there though, because I don't know what all of the data is yet). Of course, I can't say for sure that I won't run into some special case regarding the database files, but from what I've seen thus far, all the database files follow pretty much the same format (I've only seen differences in header size for now).
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Black_Manta_8bit @ Black_Manta_8bit: hey