Maidens of the Kaleidoscope

~Hakurei Shrine~ => Rika and Nitori's Garage Experiments => Touhou Projects => Topic started by: MrBigz on January 09, 2011, 12:16:34 AM

Title: CTC Translation
Post by: MrBigz on January 09, 2011, 12:16:34 AM
I've been thinking about doing an english patch for Concealed the Conclusion. I've already skimmed through this thread: http://www.shrinemaiden.org/forum/index.php?topic=239.0  (If there's any other info on peoples progress with this It'd be nice to know)

The character dialogue is easy, I might be able to circumvent the character limit, we'll see. I already semi-found out how to edit in the spellcard names, as well as menus and stage names. Is there anyone else who wants to help?

Edit: Also responded and had a look at this talk page on the wiki: http://en.touhouwiki.net/wiki/Talk:Concealed_the_Conclusion:_Translation
Title: Re: CTC Translation
Post by: Paper Conan on January 09, 2011, 01:05:48 AM
Please do it   :o
If you do then I'll be more than glad to give you my babies.
Title: Re: CTC Translation
Post by: KuraiShoka on January 09, 2011, 01:58:17 AM
YES. DO IT

How can I help? I would love to help out with this  :D
Title: Re: CTC Translation
Post by: MrBigz on January 09, 2011, 02:09:04 AM
Do you know anything about coding at all? :O

One thing I need right now is for people to skim through the coding in the files to find certain things. WE CAN DO ETT!
Title: Re: CTC Translation
Post by: KuraiShoka on January 09, 2011, 02:21:22 AM
Do you know anything about coding at all? :O

One thing I need right now is for people to skim through the coding in the files to find certain things. WE CAN DO ETT!

What coding are we talking about? I know Danmakufu language and Danmakufu language only :V
Title: Re: CTC Translation
Post by: MrBigz on January 09, 2011, 02:30:12 AM
That might help. I'm talking C, that's what the .dnh files are coded with, or something similar.

For anyone reading, and I posted this on the talk page in the link, I found out how a lot of the text is displayed. Similar to how projectiles are displayed in the official touhou games, there's some font images in one of the directories, which contains all japanese characters. So the game calls the image, and displays a small section of that image for each letter. I'm 99.9% sure this is how it works, since I tested it by erasing the characters, which took out most of the text other than dialogue. SO, what we need to find is the calls for that image for each spellcard, level description, menus, etc. Then we just have to replace the old font with a new english font and change the calls to open the right letters.

So if anyone can look through some dnh files they think might contain those calls, that'd be great! =)

Some hints: I'm pretty sure the dnh file will have a #include for the font files. It should have #include_function lib\THCCL\IMAGE\index.dnh near the top. One set of files which could have something are the files under script/thc/INCLUDE/BOSS which has some of the coding for the bosses. One of the functions is DrawSpellBG, which could have something to do with it. These are the kinda things you have to look at and try to figure out if they use those font images. Tell me if you guys find anything!


Edit: Also, AND THIS WOULD REALLY HELP, if there's anyone who knows Japanese, the coding has A LOT of comments on the side which could REALLY help because it probably explains what everything does. So if anyone can do that, that would be awsumm.
Title: Re: CTC Translation
Post by: KuraiShoka on January 09, 2011, 03:02:28 AM
Yeah, Danmakufu language is heavily based off of C/C++ from what I understand.

Anyways, I'm pretty sure you're only half right. It does grab text based on text images, but Danmakufu makes Events (the part where the two characters talk) based on what you tell it to write. Example:
DrawText(stuff, stuff, BLAH!);
And then once you call the event script in the game, the character will say "BLAH!"

Once again, I'm not 100% sure about this, feel free to correct me/slap me upside the head for questioning you  :V
Title: Re: CTC Translation
Post by: MrBigz on January 09, 2011, 03:24:02 AM
Yeah, I mentioned before that the dialogue was the easy part.


And it looks like I already found one of the files that calls the text. It's called TT.dnh, in the DATA folder under FONTS. I just changed some values and got this:

http://img84.imageshack.us/img84/9852/ctc.png

Edit: That file is DEFINITELY what controls the rest of the text. I was able to change the names of spellcards too. It references to the dat files though. Either I work around it somehow, or decode the dat files. If they can't be decoded, one very good idea I have is to make brand new dat files and change the calls to call those dat files.
Title: Re: CTC Translation
Post by: Furienify on January 09, 2011, 04:03:06 AM
Okay, wow, I don't think anyone's gotten that far.

How did you manage to access the .dnh files? I don't think anyone's been able to do that before, unless I'm thinking of the .DAT files.

If you've managed to change spellcard texts in-game you're more or less set. Dialogue is easy to replace, all that would be left is endings/menus.
Title: Re: CTC Translation
Post by: MrBigz on January 09, 2011, 04:09:23 AM
No, the dnh files are the easy ones. The dats are encoded. All I did was change how the informations in the dat files was displayed (which takes the text from the font images). I'm gonna try to decode the dats first, and then if that fails, try to alter the code and make a new dat to call a new english image font (which the program hopefully won't reject D:)


Also, for those who might look, it seems all functions with "CUTIN" in the name are what "cut" out the character from the font image. cutin.dnh looks like the main function for doing this. Font.dnh is also very important for this; it's the bitmap font library for all the text displayed ingame.
Title: Re: CTC Translation
Post by: KuraiShoka on January 09, 2011, 04:24:28 AM
Ok, I'm starting to remember from a while back when I was tinkering with CtC's dnh scripts. I saw that the script file that is the menu does some things called Effect Objects. Effect Objects, if I can recall correctly, are pretty much images appearing in the game, but not interfering with it. So pretty much what we need to do is find that script, and change/add where it grabs it's images from.

I'm not experienced enough with Danmakufu, so you should look for a better scripter to help you with the last part.
Title: Re: CTC Translation
Post by: Furienify on January 09, 2011, 04:35:50 AM
Speaking of cutins, if you ever find the sfx in the .dats for the CtC spellcard cutins/declarations I will love you forever.
Title: Re: CTC Translation
Post by: KuraiShoka on January 09, 2011, 04:43:15 AM
Speaking of cutins, if you ever find the sfx in the .dats for the CtC spellcard cutins/declarations I will love you forever.

Aren't the Cutin declaration sound effects the same as regular danmakufu's?
If anything, the sound effect made when the boss is defeated is different. It's "enep01.wav" which is inside "lib/THCCL/SE"
Title: Re: CTC Translation
Post by: MrBigz on January 09, 2011, 04:57:49 AM
Yeah, the spell declaration was like the only sound I couldn't find, weird..  :/


Kurai, I have a question. If you were to go about making a spellcard, how would you implement showing the name when the spellcard comes up?

Also, I'm disassembling the .exe, hopefully I can find some info on the dat file compression algorithms, or otherwise, in there.

Edit: Actually, I just realized, since CtC is technically not a "part" of danmakufu, then one of the dnh files should have an alghorithm for those dat files. Hell, isn't dnh just a script file for it? So it's just another game that was created with it, just that it's by the author him/herself?
Title: Re: CTC Translation
Post by: KuraiShoka on January 09, 2011, 05:05:44 AM
You would call the cutin function.

CutIn( KOUMA/YOUMU, Name of Spell Card, CutIn Image, left boundary, top boundary, right boundary, bottom boundary);
You would select the way the CutIn image is displayed using KOUMA to make it EoSD-styled or YOUMU to make it PCB-styled.

 The second variable is the name of the spellcard, but exactly how the CutIn fuction processes it is weird. For example, many english-speaking Danmakufu users use "A"\""B"\" where A would be something like Example Sign, and B would be Example. That would end up making
Example Sign "Example".

Then you select the image which will be used for the CutIn, and select the boundaries of the image (in case that the image you want to be used for the CutIn is sharing a .png file with another image).
Title: Re: CTC Translation
Post by: MrBigz on January 09, 2011, 05:16:27 AM
So basically you would cut out A and B from an image, right? Would you create that image yourself? Or how would you know that you picked the right boundaries to get the right letters?
Title: Re: CTC Translation
Post by: KuraiShoka on January 09, 2011, 05:26:41 AM
Well I was just using A and B as an example. So if I said "Time Sign"\""Za Warudo"\" , the title of the spellcard would come out as Time Sign "Za Warudo"

For selecting the boundaries, simply go to paint, open the image you want to use, and move your cursor around. You'll see that it gives coordinates.

|------|
|------|
|---A-|
|------|

If you were looking to get the coordinates for the A, you would first find the point that is the farthest to whatever side you need, use the X coordinate for it, and put that in for the boundary you need. However, I'm not sure if you use the X or Y coordinates for what sides, Check on the Danmakufu wiki for that.

If you were talking about implementing letters as an image (like menu options), you'd have to use effect objects which I myself can't comprehend. If that is what you meant, talk to a more experienced scripter  :V
Title: Re: CTC Translation
Post by: MrBigz on January 09, 2011, 05:30:38 AM
Oh you mean by coordinates, where the spellcard will be displayed on the screen? So if you wanted to display the spellcard the way you were saying it, you would just type in the name normally, and then put coordinates for where it will show up on the screen?
Title: Re: CTC Translation
Post by: KuraiShoka on January 09, 2011, 05:42:52 AM
Eh...no
If you look at a typical spellcard in EoSD or PCB, you see that an image of the boss passes by the screen. The coordinates are on the actual .png file to find the image. Whatever is inside those coordinates will be what passes on the screen when the spellcard is activated.
Title: Re: CTC Translation
Post by: MrBigz on January 09, 2011, 05:53:15 AM
I see, but my question was, what about the spellcard name? Does that work the same way? Or do you simply type in the name and it'll show up?
Title: Re: CTC Translation
Post by: KuraiShoka on January 09, 2011, 05:58:28 AM
Sorry, I misunderstood  :derp:

Anyways, you simply type the name in the second parameter using the method I told you "___"\""____"\" and it will show up properly.
Title: Re: CTC Translation
Post by: MrBigz on January 09, 2011, 06:04:05 AM
Ah. So I'm guessing CtC uses effect objects for that text. Well, maybe? Hmm...
Title: Re: CTC Translation
Post by: KuraiShoka on January 09, 2011, 06:13:48 AM
Actually, if I'm not mistaken, effect objects are only used in the menu, which is already in english.
Dialouge used regular text.
Spellcard names use regular text.

You might not need to comprehend Effect Objects for translating the game :D!!!!!!
Title: Re: CTC Translation
Post by: MrBigz on January 09, 2011, 06:34:55 AM
We shall see D:  Now I need sleep TO REGENERATE MY BRAIN CELLS!
Title: Re: CTC Translation
Post by: Prime 2.0 on January 09, 2011, 06:10:44 PM
It seems you've kicked up more fervor for a CtC English in the day this topic has been up than in the months that I was working on dialogue transcriptions and asking for missing translations. :parsee:

I certainly won't hold something stupid like that against you though, I'm on board with this all the way, especially now that we can do up more than just dialogue.
Title: Re: CTC Translation
Post by: MrBigz on January 09, 2011, 08:16:29 PM
I'm sorry D::

Of course a lot of the credit goes to the wiki and to you for the inital dialogue and such. <33

Right now, the easier thing to do seems to be to alter the code itself. I've tried a few decoding algorithms (such as LZW) but to no avail. What we can do is, identify the cutins that display the text based off of the dat files, and alter them to display our own text, maybe through a new set of dat files that we create ourselves. We'll leave the originals there for whatever other purposes they have.

I still think opening that dat file should be much easier than it seems. I can easily produce errors that actually DISPLAY code from inside the dat file, so I know that it is in fact encrypted and not full of images or anything.

http://img717.imageshack.us/img717/5928/ctcmenu.png

So far I've been able to alter the code effectively, done things such as changing the version number of the game and such.

http://img560.imageshack.us/img560/9018/ctcc.png
Title: Re: CTC Translation
Post by: Prime 2.0 on January 09, 2011, 10:08:47 PM
Oh wait, hold up; you're working with version 1? You need to get your install updated to 2.01 before you get invested into anything; we don't know how much will be made incompatible, and version 2 fixes way too much for us to just disregard it.
Title: Re: CTC Translation
Post by: MrBigz on January 09, 2011, 10:26:15 PM
Thanks for the heads up, I just installed the patch. Silly me D:
Title: Re: CTC Translation
Post by: KuraiShoka on January 09, 2011, 11:33:40 PM
First of all, how do you know what version you have?
Second, I think I might have a lower version, where can I get the patch and how can I install it  :derp:
Title: Re: CTC Translation
Post by: MrBigz on January 09, 2011, 11:54:11 PM
When you pick it at the main menu it says R2.01 or whatever version. The patch is on the main site: http://danmaq.com/products/apps/dnh/thc/

Edit: Hey Furienify, were you looking for this?

http://img694.imageshack.us/img694/9318/ctca.png

It's inside th_dnh.dat, or at least that specific reference is in there, and that file is probably encoded the same way as the other dats. Kill 2 yukkuri's with 1 stone? hmmhmmhmm

Editedit: Anyone have any knowledge of zlib? If so can you try the inflate function (decompression) on the dat files?
Title: Re: CTC Translation
Post by: MrBigz on January 11, 2011, 06:20:04 PM
Okay, so. This is the heirarchy of how spellcard text and such is displayed. The dat files, called TTH_MENU, TTH_SPELL, etc. contain the object data for the text, since all those text are 3D objects. These object ID's are called in a file called TT.dnh to display the text. Since I still haven't found a way to decrypt the dat files, but I know at this point it's just object data (and probably other stuff), I'm going to make a new dat file with new object effect functions to call a new font image. I'm pretty sure this should work without any problems, and I've looked at the EO tutorials and it seems pretty simple. I'm gonna test it on the menu to see if it works. If it does, MISSION ACCOMPLISHED and it'll just be a matter of time!
Title: Re: CTC Translation
Post by: KuraiShoka on January 11, 2011, 09:18:26 PM
When you pick it at the main menu it says R2.01 or whatever version. The patch is on the main site: http://danmaq.com/products/apps/dnh/thc/

K, I downloaded it, where do I extract it? Inside the main danmakufu folder or inside the script folder?
Title: Re: CTC Translation
Post by: MrBigz on January 12, 2011, 02:13:37 AM
Run it, and when you browse for the path, go to the first folder with th_dnh and MANUAL.

Also, here you go Furienify:  http://www.mediafire.com/?5fr355v980kaqp3     :3    LOVE ME FOREVAR!

Actually, thank the creator of the dat unpacker in this thread though: http://www.shrinemaiden.org/forum/index.php?topic=4731.0

This site seemed to have info on those dat files, but it's down..... http://net-glyph.org/~litaoyu/3p1c/temp/dir_m_full.txt
Title: Re: CTC Translation
Post by: trancehime on January 12, 2011, 03:44:32 AM
I am capable of doing translation.

I am quite busy at the moment so I won't be able to dedicate a lot of time to things, but if there are some urgent messages that need clarification or translation, I am at least willing to clear those up.
Title: Re: CTC Translation
Post by: MrBigz on January 18, 2011, 06:42:44 PM
Okay, thanks! There's nothing too serious at the moment, but I'll let you know if I need your help.
Title: Re: CTC Translation
Post by: MrBigz on February 02, 2011, 11:56:40 AM
No luck on cracking that dat so far. School started so I'll be pretty busy until April. Do you guys think we should make a partial translation at least? Just with dialogue? If anything it might attract more people to help.
Title: Re: CTC Translation
Post by: Prime 2.0 on February 03, 2011, 11:15:25 PM
No luck on cracking that dat so far. School started so I'll be pretty busy until April. Do you guys think we should make a partial translation at least? Just with dialogue? If anything it might attract more people to help.

The original plan way back when was just to release a dialogue patch, yeah, but since we have the ability to change menu text, I think we should do some work there as well before making a release; for that matter, work still needs to be done to make the current transcriptions not horrible; nevermind how to deal with the last line in stage 6 which is so long that no translation can reasonably fit there with remotely the same meaning.
Title: Re: CTC Translation
Post by: MrBigz on February 03, 2011, 11:24:05 PM
Hm...well I'll take a look into that then.
Title: Re: CTC Translation
Post by: Mimachiro on February 05, 2011, 05:26:46 AM
The length of the translations isn't really an issue for the dialog; if you know danmakufu syntax, you can make a new page in the game. I was thinking of trying to make a dialog patch myself, though I end up pressed for time. I had a similar issue come up before with another game I was making a translation for; I just learned the syntax to avoid having to compress the dialog.
Title: Re: CTC Translation
Post by: Prime 2.0 on February 05, 2011, 11:08:33 AM
The length of the translations isn't really an issue for the dialog; if you know danmakufu syntax, you can make a new page in the game. I was thinking of trying to make a dialog patch myself, though I end up pressed for time. I had a similar issue come up before with another game I was making a translation for; I just learned the syntax to avoid having to compress the dialog.
One, replay compatibility.
Two,
(http://img121.imageshack.us/img121/8123/fbossline.png)
Sorry, there isn't an easy way out here.  :V


It's not as if anyone altering the text wouldn't know how anyways, simply having more characters than Danmakufu allows for a textbox will put it in a new box automatically. Many lines cannot be delivered effectively across multiple boxes, and we have to have the same number of them as the untranslated game or else we break it. What we need is a way to replace the default dialogue system completely without breaking replays so that we can have more space per dialogue box. Even in the current one, there is plenty of unused space that stays that way because Danmakufu uses a character limit per line.
Title: Re: CTC Translation
Post by: MrBigz on February 07, 2011, 02:19:00 PM
Question: Is the character limit a global variable? Meaning, does it apply to all danmakufu scripts?
Title: Re: CTC Translation
Post by: Prime 2.0 on February 07, 2011, 08:30:44 PM
Question: Is the character limit a global variable? Meaning, does it apply to all danmakufu scripts?

I believe so, since we're dealing with the built-in dialogue system. The only way around it that I can figure would be to script an alternative to it that somehow stays exactly in step with the original.