Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

Finding/Opening Text Files in Games

Joined
Dec 18, 2022
Messages
1,770
Location
Vareš
Codex+ Now Streaming! Enjoy the Revolution! Another revolution around the sun that is.
With no experience dealing with any of this stuff, I'm trying to locate where the game I want to translate stores text and what I need before I start.

I've currently located a few things that might contain this (again, I don't know anything):
woc shit.png

The files in "Dialogs" are .dlg while the files in "Scripts" are .lua

If I migrate to the folder called "Data" which isn't within "gamedata" I get the same thing:
woc shit 2.png


I opened the file called "texts" from the first screenshot and it has a mix of German & English despite no language settings or Englisher dialogue/text in game game which makes it even more confusing to me:
woc shit 3.png


I'll have to translate from the Russian version I found online which is something I'll have to deal with after I figure out what the fuck I'm doing in the first place. Can someone point me in a direction to finding something that will help me through the process? A general guide, video, anything? I'm very aware I probably have a stupid amount of learning to do before I even attempt this.
 
Joined
Jan 21, 2023
Messages
3,160
My guess is that you'll need a code editor to read these properly. Chances are, they're some sort of dictionary being read by code. Try using Notepad ++, and leave it as your default text editor. It has some built in code editing stuff that you can definitely use as an absolute beginner.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,333
You are trying to translate from russian pirate copy of a game you found on the internet? Or what is the problem here? Does the game have an actual english version?
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,333
What am I supposed to decipher from that page? It's some kind of game, that's probably something we know. Why are we trying to translate it, can't the authors of the game do it?
 
Joined
Dec 18, 2022
Messages
1,770
Location
Vareš
Codex+ Now Streaming! Enjoy the Revolution! Another revolution around the sun that is.
What am I supposed to decipher from that page? It's some kind of game, that's probably something we know. Why are we trying to translate it, can't the authors of the game do it?
If theres any resources someone can point me to for learning how to deal with this shit on my own, like I said.

The game was made over 10 years ago by a defunct company which I'm 99% sure never released in English, or if it did an English version is lost to time. Oroject manager himself told me he doesnt think it was released in english. The only ones I have are German, russian and French.
 

Grauken

Gourd vibes only
Patron
Joined
Mar 22, 2013
Messages
12,803
from https://gbatemp.net/threads/translating-pc-games.190500/

I would throw my hat into the ring (I tend to be about the challenge rather the result) but PC games bring a whole different line of thought and toolsets to the consoles, I should not imagine it will be locked down or otherwise compressed or obscured that much but some games are. As has been hinted few people really go in for PC game translation from a hacker side of things (devs will tend to release an editor, some source code, SDK or have the text in plain files at some point) and even if they do it will not be anywhere near as in depth as the hacks you see on consoles (there was a project to improve one of the knights of the old republic games a while back, having a look and comparing it to consoles the techniques and self imposed limits of the project were truly basic).

Still
open files viewer (can be used to see what files are loaded and what process they are tied to, meant for problem solving really but for reverse engineering it is great):
http://www.nirsoft.net/utils/opened_files_view.html
Poke around the site as well, used properly many of those tools are amazing hacking tools.

HXD or X ways forensics (ram viewer and editor, can be tied to a given process too):
http://mh-nexus.de/en/hxd/
http://www.x-ways.net/forensics/index-m.html

Following this we are rapidly heading into the realms of "proper" reverse engineering, decompilers for most languages exist (looking at many recent games I see many scripting languages which is nice for you) at varying levels of quality and file format specific stuff (be it game: http://wiki.xentax.com/index.php/Game_File_Format_Central or regular DLL viewer: http://www.ucware.com/apev/index.htm ) but you are rapidly heading into assembly territory.
Trouble is by the time you get here you are likely to find yourself with guides/tools aimed at defeating copy protection or up against the copy protection itself and neither are going to help you a great deal.

Where your text will be, same idea as the consoles and DS in that it could be in a file or could be in the binary. After this you have slight tweaks on the consoles tools in terms of text viewers and editors (most games will use windows apis to display text so it could well be shiftJIS or something nice).
 

Modron

Arcane
Joined
May 5, 2012
Messages
10,058
What am I supposed to decipher from that page? It's some kind of game, that's probably something we know. Why are we trying to translate it, can't the authors of the game do it?
If you could read English you would see that it wasn't released in English. I was showing you how to find the answers to your question.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,333
Oroject manager himself told me he doesnt think it was released in english.
If you are in contact to the developers you can just ask about the text file structure. Why do you ask on a random forum, it's way harder for someone else to figure out the data of that game.
 

ds

Cipher
Patron
Joined
Jul 17, 2013
Messages
1,376
Location
here
The actual text strings in your texts.dat screenshot look like UTF-16 (hence every other byte is "empty") prefixed by a 4? byte little endian length - e.g. "En csak veletlenul epp erre jartam." is 36 characters long and $ is ASCII the byte value 36. The runs of alternating printable and non-printable characters could be UTF-16 encoding of Cyrillic (high byte is 4 for most characters) or some other non-ASCII script.The keys before (e.g. DLG_SG_GODRIC_057) the text could be nul-terminated - should be easy to tell when viewed in a proper hex editor. Before the keys there looks to be another 4 byte integer, perhaps a language ID. There might also some kind of index into all of this - otherwise why would the order be all random.

So I got curious and downloaded the German version from your sig. It doesn't have a gamedata directory (or at least the installer I extracted doesn't) but it does have a similar texts.dat in the Data directory. The format is really simple - one 4 byte little endian integer header has the number of entries and then for each entry is a 4-byte value (no idea what it means but its not unique and doesn't determine language) followed by a NUL-terminated key followed by a 4-byte code unit count (including any terminating NUL character) followed by the UTF-16 encoded value. A simple python script to decode it:

Python:
with open('texts.dat', 'rb') as file:
	count = int.from_bytes(file.read(4), 'little')
	for i in range(count):
		mistery = int.from_bytes(file.read(4), 'little')
		key = ''.join(iter(lambda: file.read(1).decode('windows-1252'), '\x00'))
		len = int.from_bytes(file.read(4), 'little')
		value = file.read(len * 2).decode('utf-16')
		escaped = value.replace('\\', '\\\\').replace('\r', '\\r').replace('\n', '\\n')
		if escaped[-1:] == '\x00':
			escaped = escaped[:-1]
		else:
			escaped = escaped + '\\'
		print( f'{key} {mistery} = {escaped}' )
	assert(file.read(1) == b'')

The German version also has English and Hungarian strings but from what I can tell they are just leftover untranslated garbage that is probably not even used.
 
Last edited:

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Back
Top Bottom