~ The Homeland Project ~

Find all your GameCube topics here
User avatar
jaytheham
Posts: 8
Joined: Thu Jun 30, 2011 3:57 am

Re: ~ The Homeland Project ~

Postby jaytheham » Sat Oct 15, 2011 12:21 pm

Not sure how much luck you'd have trying to get rid of the "garbage" in the files. A large part of it does... well something, not sure what. Might be better to write an extractor/inserter to output a plain text file from a Candy file and then merge the translated equivalent back in.


Here's the code for the all.bin extractor:

Code: Select all

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;

namespace Homeland_all.bin_extractor
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] droppedFiles = Environment.GetCommandLineArgs();

            //string[] droppedFiles = new string[3];
            //droppedFiles[0] = "hash";
            //droppedFiles[1] = "C:\\Documents and Settings\\Jay\\Data Log\\Games\\Hacking\\NGC\\Tools\\Homeland\\all\\all.bin";
            //droppedFiles[2] = "C:\\Documents and Settings\\Jay\\Data Log\\Games\\Hacking\\NGC\\Tools\\Homeland\\all\\Start.dol";

            if ((droppedFiles.Length == 1) | (droppedFiles.Length == 0))
            {
                Console.WriteLine("2011 Jay Harland / JaytheHam");
                Console.WriteLine("Homeland for Gamecube\n");
                Console.WriteLine("Extracts all the \"CNDY\" files from \"all.bin\" data archive");
                Console.WriteLine("Usage: allbinext.exe all.bin Start.dol");

                Console.Read();
                return;
            }

            Console.WriteLine(droppedFiles[1]);

            FileStream allBin = new FileStream(droppedFiles[1], FileMode.Open);
            FileStream startDol = new FileStream(droppedFiles[2], FileMode.Open);

            int curFileOffset = 0;
            int nextFileOffset = 1;
            int fileSize = 0;

            int filesDone = 0;

            startDol.Position = 0xE22D4;
            byte[] tempWord = new byte[4];

            while (nextFileOffset != 0)
            {

                startDol.Read(tempWord, 0, 4);
                curFileOffset = (int)((tempWord[0] << 24) +
                    (tempWord[1] << 16) +
                    (tempWord[2] << 8) +
                    tempWord[3]);


                startDol.Read(tempWord, 0, 4);
                nextFileOffset = (int)((tempWord[0] << 24) +
                    (tempWord[1] << 16) +
                    (tempWord[2] << 8) +
                    tempWord[3]);


                startDol.Position -= 4;

                fileSize = nextFileOffset - curFileOffset;

                byte[] output = new byte[fileSize];

                allBin.Read(output, 0, fileSize);

                //Only extract "CNDY" Files, they seem to be the text ones
                if (output[0] == 0x43 & output[1] == 0x4E & output[2] == 0x44 & output[3] == 0x59)
                {

                    FileStream writeFile = new FileStream(droppedFiles[1] + "_" + curFileOffset.ToString(), FileMode.Create);
                    writeFile.Write(output, 0, fileSize);
                    writeFile.Close();

                    filesDone++;

                    if (filesDone % 500 == 0)
                    {
                        Console.WriteLine(filesDone.ToString() + " files done, at: " + nextFileOffset.ToString());
                    }
                }

            }

        }
    }
}

HomelandReloaded

Re: ~ The Homeland Project ~

Postby HomelandReloaded » Sat Oct 15, 2011 12:22 pm

Thanks Jay! I hadn't figured out the structure of start.dol but I don't need to now I've got your utility.

I've been looking at some of the other files in the meantime and I'm fairly sure that netcfg.dol is dedicated to configuring the network settings (which are stored in a file on the memory card). I think it is the only place where kanji text appears to the player. It also contains the equivalent english text which gets displayed if you use a Freeloader. This probably means that the app is not stored in the hardware as had been supposed (quite reasonably) by the consolesonline man.

Looking inside server.rel I'd say it's the program that's loaded when the game is being played in gamemaster mode and the console is being used as the server. I would hazard a guess therefore that client.rel is the corresponding client mode (or normal online mode), and alone.rel is the normal offline stand-alone mode. Here I am just guessing atm because I haven't looked at them yet.

User avatar
emu_kidid
Site Admin
Posts: 4208
Joined: Mon Mar 29, 2010 10:06 am
Location: Australia
Contact:

Re: ~ The Homeland Project ~

Postby emu_kidid » Sat Oct 15, 2011 1:03 pm

.rel format files are usually loaded from another base .dol, so yeah, your assumptions are correct :)
Image

User avatar
liquitt
Posts: 1747
Joined: Thu Apr 01, 2010 5:43 am
Location: neverland
Contact:

Re: ~ The Homeland Project ~

Postby liquitt » Sun Oct 16, 2011 11:04 am

thanks jay!
please search before you ask - a lot has been discussed already!
(or use google with "site:gc-forever.com *term*")
http://is.gd/MDmZcr

we also have a wiki filled with knowledge
http://is.gd/dX58Rm

HomelandReloaded

Re: ~ The Homeland Project ~

Postby HomelandReloaded » Fri Oct 21, 2011 7:18 pm

I finally got the Dolphin emulator to run, and the sound and graphics are just like the real thing (apart from the font which is a bit skinny). However, I can't get beyond the "Please wait a moment" しばらくおまちください screen in the game where it is reading from the disc. Probably need to get it configured properly (I know the game, but this tech stuff is new). Jay, did you reconstruct the iso file after editing the text strings, or did you edit the iso file directly?

User avatar
jaytheham
Posts: 8
Joined: Thu Jun 30, 2011 3:57 am

Re: ~ The Homeland Project ~

Postby jaytheham » Fri Oct 21, 2011 10:36 pm

I just inserted the edited files back into the iso, no rebuilding.
If the Please wait a moment part you're talking about is after you choose a game file from the menu and attempt to start it, yea that seems to be a problem with Dolphin, just keep trying to load a game and it will eventually work maybe once out of every 5 attempts.

HomelandReloaded

Re: ~ The Homeland Project ~

Postby HomelandReloaded » Tue Nov 08, 2011 8:42 pm

I am still trying to get a PPC disassembler for this - the IDA Pro one is very expensive and the free trial does not support PPC, so I can't take a chance on it. In the meantime I have been going through the files looking for text strings. The vast majority are for an adventure commonly known as "The story of 100 years ago", but a new player doesn't get to this adventure for a while. I think it's best to start with the text in Start.dol because this has all the basic stuff like items and spells. Without a disassembler I cannot tell whether it is safe to repointer the text strings; this means it is necessary to specify the max length for each translated string. Translators are probably going to need a list of all the character names, place names, items, etc. because many of these are real words in Japanese and could be confusing (especially since all the in-game text is in kana). For example, キロ is a location, but it might be translated as 'kilometer' by someone unfamiliar with the game. There may be no way to locate all the text strings automatically (still not sure about this), so it may be a slow job to get all the text extracted. By the way, has anyone checked out the legal implications of doing this? I'm quite sure Chunsoft will never release an English version of the game because it is obsolete (though it could appear on the Wii Shop channel in Japanese) and would have to be adapted for western religious sensitivities, but I've read somewhere that a copyright owner also owns the right to translate a work even if they don't translate it.

User avatar
liquitt
Posts: 1747
Joined: Thu Apr 01, 2010 5:43 am
Location: neverland
Contact:

Re: ~ The Homeland Project ~

Postby liquitt » Wed Nov 09, 2011 7:17 am

okay so the next big thing on your side is disassemble the DOLs?

what you say about the town names etc. is definetly true. actually a translator was asking for a list of special names before ;)
i might see if i can get this somewhere...
please search before you ask - a lot has been discussed already!
(or use google with "site:gc-forever.com *term*")
http://is.gd/MDmZcr

we also have a wiki filled with knowledge
http://is.gd/dX58Rm

User avatar
andzlay
Posts: 422
Joined: Thu Jul 08, 2010 12:53 am
Location: Germany

Re: ~ The Homeland Project ~

Postby andzlay » Wed Nov 09, 2011 8:53 am

@HomelandReloaded: I guess there should be no problem if you don't publish the whole .iso/.dol file (that would be definitely a copyright infringement), but an IPS patch everyone could apply to his/her dump of the game.
Atleast you don't publish a copyrighted game.

Dragoon
Posts: 323
Joined: Thu Jan 27, 2011 1:01 pm

Re: ~ The Homeland Project ~

Postby Dragoon » Wed Nov 09, 2011 8:52 pm

@HomalandReloaded: you may find this site very usefull, as it includes a DOL plugin for a IDA and a standalone ppc disassembler.
Image

HomelandReloaded

Re: ~ The Homeland Project ~

Postby HomelandReloaded » Wed Nov 09, 2011 9:49 pm

@andzlay: Thanks, I hadn't thought of that.

@liquitt: The next step is to get a disassembler working; I've downloaded some source code for one but I haven't managed to compile it yet. I have an idea how to do the text insertion, but it's going to be a long job identifying all the addresses and string lengths. The game is really big and the text is scattered all over. Btw I think you'll find lists of all the special names on the Puutan blog - many of the pages are difficult to find through the menu but you can access them by incrementing the blog entry numbers in the url.

@Dragoon: Thanks, that's a super site. The gekko plug-in for IDA requires a paid version of IDA which costs too much (GPB 850) and it might not work with the latest version (can't test it with the free trial 'lite' version).

shuffle2
Posts: 14
Joined: Thu Feb 03, 2011 2:18 am

Re: ~ The Homeland Project ~

Postby shuffle2 » Tue Nov 29, 2011 7:15 pm

HomelandReloaded wrote:I finally got the Dolphin emulator to run, and the sound and graphics are just like the real thing (apart from the font which is a bit skinny). However, I can't get beyond the "Please wait a moment" しばらくおまちください screen in the game where it is reading from the disc. Probably need to get it configured properly (I know the game, but this tech stuff is new). Jay, did you reconstruct the iso file after editing the text strings, or did you edit the iso file directly?


jaytheham wrote:I just inserted the edited files back into the iso, no rebuilding.
If the Please wait a moment part you're talking about is after you choose a game file from the menu and attempt to start it, yea that seems to be a problem with Dolphin, just keep trying to load a game and it will eventually work maybe once out of every 5 attempts.


By the way, you can extract the entire disc with dolphin and the main dol, then set "DVD Root" in dolphin options to the directory which contains the extracted files, and load the main dol into dolphin. This allows you to modify the files more easily.

Also, I don't remember having any problems with reading from disc, is this still happening?

I just browsed over the thread, it seems like the strings are stored very plainly in a file? Perhaps you could just provide a list of all the strings to a translator?

I can't read Japanese, and would love to see this translation be done :)

HomelandReloaded

Re: ~ The Homeland Project ~

Postby HomelandReloaded » Wed Nov 30, 2011 7:34 pm

Hi shuffle2,

The text strings are scattered throughout the code, though in some cases they are grouped in tables.
There are thousands of them, so it will probably have to be done by someone with access to IDA Pro
and a custom Shift-JIS plug-in. I have considered writing a program to find all the strings, but
there is no reliable way to distinguish junk characters and code from game text. Shift-JIS is also a
difficult encoding to work with. The following example is a nice clean example of a zero-terminated
text string with embedded newline characters (0A hex) and a few single-byte ASCII equivalents:

マッチングサーバーに接続しています(Bボタンで中止)
通信中は本体の電源を切らないでください。
不特定多数の方が参加するネットワークプレイでは
マナーと節度をもってお遊びください。
当社は通信プレイによる直接的・間接的損害について
いかなる責任も負いません。

Where it gets more difficult is where the speech is distorted and special characters are included (in
some cases SJIS characters have even been redefined with non-standard symbols):

‥‥スル‥‥メーゾ‥‥▼

Then there are all kinds of monster noises:

ぬんッ‥ ちっ!

And some text that takes parameters:

%sのマスコットのつくりかたを おぼえた。

And code that is not in the game:

Hdefault.ame onLeavePlayer(
) ファーストプレイ
default.ame onSearch(

And other stuff that is used in the text-entry panel.

I gave up trying to get Dolphin to work with Homeland, but I'm sure it's just a matter of configuration so I'll come back to it some time. It's a really impressive piece of software and it would be needed for testing edits.

User avatar
liquitt
Posts: 1747
Joined: Thu Apr 01, 2010 5:43 am
Location: neverland
Contact:

Re: ~ The Homeland Project ~

Postby liquitt » Wed Nov 30, 2011 7:45 pm

sooo...just an idea: what if we had text from the game in japanese....could we search for it in the files?
please search before you ask - a lot has been discussed already!
(or use google with "site:gc-forever.com *term*")
http://is.gd/MDmZcr

we also have a wiki filled with knowledge
http://is.gd/dX58Rm

User avatar
megalomaniac
Posts: 2479
Joined: Sun Aug 21, 2011 5:33 am
Location: Drunk in Texas
Contact:

Re: ~ The Homeland Project ~

Postby megalomaniac » Wed Nov 30, 2011 10:01 pm

IDA Pro huh??

;)
emu_kidid wrote: beer is like WD40 for megalomaniac's brain, gets the gears moving

>>> BadAssConsoles.com <<<

Image Image Image

shuffle2
Posts: 14
Joined: Thu Feb 03, 2011 2:18 am

Re: ~ The Homeland Project ~

Postby shuffle2 » Thu Dec 01, 2011 6:24 am

HomelandReloaded: have you considered looking for the function which writes these strings to the screen/formats them?

Also, fun fact - I'm pretty sure that most if not all of the actual font textures being used are fetched from the bootrom (this was one of the games I used to make sure the ntsc-j setting in dolphin was working correctly). This hopefully means that it is rather straightforward to find all the strings which will actually be displayed onscreen by indexing into said textures.

What I was saying was, once you have found all these strings, it would probably be better to provide list of offsets and strings (and max length, it sounds like?) to a translator, instead of expecting a translator to trudge through IDA :)

HomelandReloaded

Re: ~ The Homeland Project ~

Postby HomelandReloaded » Thu Dec 01, 2011 7:02 am

Hi shuffle2,

I think I understand now; I didn't know it was possible to intercept the strings that are displayed. I'm not quite up to that technical level yet and it would take weeks of playing to see all or most of the game text (fun, though :) ). I was actually thinking that a hacker could locate all the strings using IDA and give the details to a translator in the format you described: (file?), offset, max length, text. Then another program could insert the translated text.

I agree with you about the fonts being in the ROM; it would explain why they don't display on a non-Japanese console with freeloader.

shuffle2
Posts: 14
Joined: Thu Feb 03, 2011 2:18 am

Re: ~ The Homeland Project ~

Postby shuffle2 » Thu Dec 01, 2011 7:43 am

btw, you can solder up the ntsc-u/j switch and fix that :)
http://www.oratan.com/projects/gcn_mod.html something like this.

User avatar
liquitt
Posts: 1747
Joined: Thu Apr 01, 2010 5:43 am
Location: neverland
Contact:

Re: ~ The Homeland Project ~

Postby liquitt » Thu Dec 01, 2011 7:45 am

thats an interesting fact. i will take a look at it from that point of view!
please search before you ask - a lot has been discussed already!
(or use google with "site:gc-forever.com *term*")
http://is.gd/MDmZcr

we also have a wiki filled with knowledge
http://is.gd/dX58Rm

HomelandReloaded

Re: ~ The Homeland Project ~

Postby HomelandReloaded » Sat Dec 03, 2011 9:31 am

Here's something to use for a proof of concept:

start.rel 00014894 47 おとこのこと おんなのこ。どちらではじめますか?
start.rel 000148C4 25 なまえを つけてください。
start.rel 000148E0 60 メモリーカードに すでにある おなじなまえは つけられません。
start.rel 00014920 36 このなまえで ぼうけんを はじめます。
start.rel 00014948 59 メモリーカードに あたらしい ぼうけんのきろくを つくります。
start.rel 00014A98 19 %03dじかん %02dふん
start.rel 00014CD4 20 スロットAをしらべる
start.rel 00014CEC 30 メモリーカードをへんしゅうする
start.rel 00014D0C 30 メモリーカードなしで はじめる
start.rel 00014D3C 32 データをけしてもよろしいですか?
start.rel 00014D60 42 ほんとうにデータをけしてもよろしいですか?
start.rel 00014E68 32 データをけしてもよろしいですか?
start.rel 00014E8C 42 ほんとうにデータをけしてもよろしいですか?
start.rel 00014EE8 38 メモリーカードの読み込みに失敗しました
start.rel 00015128 14 プレイじかん:
start.rel 00015380 4 ぶき
start.rel 00015388 4 たて
start.rel 00015390 6 こもの
start.rel 00015398 16 けいけん%Dをえた
start.rel 000153AC 17 はじめから あそぶ
start.rel 000153C0 12 ネットワーク
start.rel 000153D0 14 ネットせってい
start.rel 000153E0 14 せつぞくテスト
start.rel 000153F0 16 せいさくスタッフ
start.rel 00015404 51 ネットせっていがめんにうつります。<LF>よろしいですか?

It's all the text I can find in the start.rel file, but I'm not sure if all the text is used in the game. There should be tabs between the columns, which are: FILENAME; OFFSET; LENGTH; TEXT. This a fairly small file, but separating the non-text from the text was more time-consuming than I expected.

HomelandReloaded

Re: ~ The Homeland Project ~

Postby HomelandReloaded » Fri Mar 23, 2012 4:29 am

shuffle2 wrote:I'm pretty sure that most if not all of the actual font textures being used are fetched from the bootrom (this was one of the games I used to make sure the ntsc-j setting in dolphin was working correctly). This hopefully means that it is rather straightforward to find all the strings which will actually be displayed onscreen by indexing into said textures.
I'm not sure I understand this. Supposing that the texture png file was GHEJ91_3569b979_6.png - what would that tell me?

toastwithjam
Posts: 6
Joined: Thu Apr 12, 2012 1:56 am

Re: ~ The Homeland Project ~

Postby toastwithjam » Thu Apr 12, 2012 2:07 am

Hey,
I came upon this today as I was looking to see if anyone had made a translated game script, and I must say it made me quite happy to see other people who think highly of this game!

I wish you well in your efforts and hope that you are able to see the project through!!!

HomelandReloaded

Re: ~ The Homeland Project ~

Postby HomelandReloaded » Thu Apr 12, 2012 4:27 pm

It is nice to see that others appreciate the game too - it looks deceptively simple and cute but it is really a huge and complex game full of little mysteries.

Unfortunately there seems to be little interest in participating in this project though, and it is a formidable task to due the enormous number of text strings scattered throughout the code instead of being stored in a table. I am still tinkering with it and my objective is to achieve a limited translation which can be booted on a Japanese Cube so that it can be played online because that is where the lasting appeal is. It is necessary to be able to identify items in the game quickly in order not to hold up other players (it is a turn-based game). Offline it is not so important.

I have gathered all the bits I need to install a drive-replacement chip in my Gundam Cube with the bad drive, but I'm not sure if my soldering skills are good enougn so I'll wait till I have more time.

I am also toying with loading the game from an iso file on a Japanese Cube by using a region-free Action Replay to boot SD Media Launcher, and then using this to boot the new Swiss which then loads the game. So far, the game starts OK but when it next tries to read from the "disc" it hangs. I think I may be doing something wrong at the patching stage and I don't understand this process yet. It's a sort of background activity though.

User avatar
emu_kidid
Site Admin
Posts: 4208
Joined: Mon Mar 29, 2010 10:06 am
Location: Australia
Contact:

Re: ~ The Homeland Project ~

Postby emu_kidid » Thu Apr 12, 2012 11:39 pm

I'll try to get it working in Swiss better but why not use Dolphin? that way you could even debug every string that attempts to be drawn to screen so you can trace it's origin (similar to what shuffle2 suggested).
Image

HomelandReloaded

Re: ~ The Homeland Project ~

Postby HomelandReloaded » Fri Apr 13, 2012 4:21 am

@emu_kidid, thanks for your post. The reason I am not using Dolphin is because it does not emulate the BBA as far as I know, but I do use it sometimes to look at the code. The only problem is I don't quite understand how to locate the origin of text strings.


Return to “GameCube”

Who is online

Users browsing this forum: No registered users and 5 guests