Register - Login
Views: 87349138
Main - Memberlist - Active users - Calendar - Wiki - IRC Chat - Online users
Ranks - Rules/FAQ - JCS - Stats - Latest Posts - Color Chart - Smilies
11-19-17 12:14:59 PM

Jul - Game Research/Hacking/Modding - Help with Princess Maker 2 script extraction? New poll - New thread - New reply
Next newer thread | Next older thread
shicky256
Random nobody
Level: 4


Posts: 1/6
EXP: 212
For next: 67

Since: 04-24-17


Since last post: 204 days
Last activity: 156 days

Posted on 04-24-17 07:31:30 PM (last edited by shicky256 at 04-24-17 08:22:16 PM) Link | Quote
I've always liked the game Princess Maker 2 due to its large amount of possible outcomes and interesting gameplay. However, it hasn't gotten an official release until last year on Steam and that version has a translation that's extremely inferior to the one from the original unfinished leaked translation by SoftEgg (kinda makes sense since the new translation's being done by Koreans who are translating the game from Japanese to English). Because of this, I'd like to inject the good translation into the Steam remake since it has nicer graphics.
Actually injecting text into the remake is easy, since the script is just stored in the executable in plain text. However, the "extracting the script from the old version" part is a lot harder. The DOS version stores its data in ".lbx" files which are pretty much just every file in a certain category stored in one file with the hex offsets listed in the end. After this, the text files are still compressed or something. I tried identifying them with TriD and it said they were "ttcomp" files, but I tried decompressing them both with an old version of PKzip and UNP 4.11 (some kind of multi-extractor program for DOS) and didn't get anywhere.
After some more digging around in the game files, I found that the "ROOT.LBX" file contained a few DOS executables, which gave me some garbled text when I ran them. I assumed that they needed some sort of font installed so I ended up installing DOS/V in a virtual machine only to find that the text was only "Princess Maker 2" in Japanese as opposed to some kind of assistance. Because of this, I have no idea what any of them do, except they're called DSKTOOL.COM, ENDING.COM, MUSYAE.COM, and NAMEIN.COM. They do seem to modify the "file edited" date of whatever file you pass as a parameter, so they probably do something compression related.
At this point, I emailed the guy who did the translation in some kind of "hail mary". While he did reply, he said he forgot a lot of stuff since it had been 20 years since he'd done the translation, but the text is probably compressed and in Shift-JIS format.

I'm kind of at a dead end. To help whoever feels like giving it a shot, here's an archive of all the text I've extracted from the game, the files I've extracted them from in case I've gotten that part wrong, and a copy of PCEm with DOS/V preinstalled. You'll have to edit the hard drive location in the PCEm Disc menu, but besides that everything should be ready to go.
https://drive.google.com/open?id=0B_F1gyHiB4fdbDhiQUtpbFBOSVk
shicky256
Random nobody
Level: 4


Posts: 2/6
EXP: 212
For next: 67

Since: 04-24-17


Since last post: 204 days
Last activity: 156 days

Posted on 04-26-17 10:02:16 PM Link | Quote
From poking around in a hex editor looking for strings, it looks like MUSYAE.COM handles RPG map viewing (the adventure sections play like a JRPG), and NAMEIN.COM handles name entry when you're creating a new file. I'm assuming that ENDING.COM handles viewing of endings. Still no idea what DSKTOOL.COM handles, it doesn't have any useful strings.
brian151
Banned
The administration (as well as a few users) have decided that you're creepy/weird enough that it's time to activate the sploded clause.
Laters.


Level: NaN


Posts: 140/-249
EXP: NaN
For next: 0

Since: 08-09-16
From: USA

Since last post: 108 days
Last activity: 81 days

Posted on 04-26-17 10:54:41 PM Link | Quote
sometimes you have to make assumptions from the naming of the files

So, look:
"namein" : name input
"ending" : something to do with ending
now, your last one is "DSKTOOL"
This means one of two things:
Disk Tool (most likely)
Desktop Tool (somewhat very doubtful)

So, it's probably something to do with the disk (CD-ROM disk, I'm guessing)
What? hard to say...
A game of that era might do a few things as far as disk is concerned

Sorry I don't have much more than an "educated guess" , but I hope it's of some use?
divingkataetheweirdo

Lantern Ghost
TCRF Super Editor
Level: 52


Posts: 708/772
EXP: 1034388
For next: 49452

Since: 07-09-11


Since last post: 16 hours
Last activity: 10 hours

Posted on 04-26-17 11:36:38 PM Link | Quote
There's this antiquated editor here to look inside LBX files, but it's programmed for the PC-98. It's more likely they're LZH files or files similar in nature. Worst case scenario, you can use DOSBox and a debugger that can read DOSBox's RAM as the game is running.
shicky256
Random nobody
Level: 4


Posts: 3/6
EXP: 212
For next: 67

Since: 04-24-17


Since last post: 204 days
Last activity: 156 days

Posted on 04-27-17 03:36:30 PM Link | Quote
Opening the lbx files isn't the problem, the problem is the script compression (if you download the archive I put in the OP, it has all the decompressed files there already). Looking at the file headers, they all seem to be the bytes "01 04", which would indicate that they're compressed with PKWare's Data Compression Library, but there don't seem to be any ready to use decompressors for DCL.
Joe
Common spammer
🗿
Level: 104


Posts: 3274/3289
EXP: 11570037
For next: 292089

Since: 08-02-07
From: Pororoca

Since last post: 6 days
Last activity: 6 min.

Posted on 04-27-17 03:59:12 PM Link | Quote
Originally posted by divingkataetheweirdo
There's this antiquated editor here to look inside LBX files, but it's programmed for the PC-98.

That tool uses only DOS API calls, so it works in ordinary PC DOS. Unfortunately, the compression is not part of the LBX file format, so it doesn't decompress the text.

Originally posted by divingkataetheweirdo
It's more likely they're LZH files or files similar in nature.

In the text files, the values 0x22, 0x4C, 0x6C, 0xA2, 0xCC, and 0xEC tend to appear a lot more often than other values. Whatever it is, it doesn't look like LZH.

Originally posted by shicky256
Looking at the file headers, they all seem to be the bytes "01 04", which would indicate that they're compressed with PKWare's Data Compression Library, but there don't seem to be any ready to use decompressors for DCL.

I found one hiding in zlib. It says the files are invalid. They're probably not DCL.
shicky256
Random nobody
Level: 4


Posts: 4/6
EXP: 212
For next: 67

Since: 04-24-17


Since last post: 204 days
Last activity: 156 days

Posted on 04-27-17 06:00:39 PM (last edited by shicky256 at 04-27-17 06:19:31 PM) Link | Quote
I found some LBX documentation here. If you want to do things the script kiddie way like I did, you can just use Game Extractor. Of course, I extracted literally every file so there's not much else you can do. Anyway, I got around to using DOSBox's memory viewer on the game. Turns out the dialogue's written in some weird scripting language. Here's a snippet:

TXT("I'm confident that I'm the best there is when it comes to ")..."the art of the sword."..GOTO KAIWA_RET............*SENSHI_KOUGEKI..TXOPEN(3)..IF ( V_KOUGEKI < 30 )...TXGIRL(11).....TXT("I'm afraid I'm kind of weak. I need to build up some ")..."more muscle."...GOTO KAIWA_RET..IF ( V_KOUGEKI < 60 )...TXGIRL(9).....TXT("Wouldn't it help me in fighting if I used better weapons ")..."instead of just my own strength?"...GOTO KAIWA_RET..IF ( V_KOUGEKI < 90 )...TXGIRL(11).....TXT("I'm glad that my combat attack strength is up, but I'm a ")..."little embarrassed at looking so muscle-bound."...GOTO KAIWA_RET..IF ( V_KOUGEKI >= 90 )...TXGIRL(1).......TXT("I've become pretty powerful. I can just crush people's ")..."flimsy armor."..GOTO KAIWA_RET............*SENSHI_BOUGYO..TXOPEN(3)..IF ( V_BOUGYO < 30 )...TXGIRL(0).....TXT("Armor will protect me when I'm fighting? I'd like to get ")..."some good armor..."...GOTO KAIWA_RET..IF ( V_BOUGYO < 60 )...TXGIRL(0).....TXT("I wonder if people who fight without armor have really ")..."tough skin?"...GOTO KAIWA_RET..IF ( V_BOUGYO < 90 )...TXGIRL(1)....."Thanks to the armor you bought me, I can fight without getting hurt."...GOTO KAIWA_RET..IF ( V_BOUGYO >= 90 )...TXGIRL(14)....."I'm so good at defending myself, I feel like I'm invincible!"..GOTO KAIWA_RET
brian151
Banned
The administration (as well as a few users) have decided that you're creepy/weird enough that it's time to activate the sploded clause.
Laters.


Level: NaN


Posts: 141/-249
EXP: NaN
For next: 0

Since: 08-09-16
From: USA

Since last post: 108 days
Last activity: 81 days

Posted on 04-28-17 04:32:38 AM Link | Quote
Originally posted by shicky256
I found some LBX documentation here. If you want to do things the script kiddie way like I did, you can just use Game Extractor. Of course, I extracted literally every file so there's not much else you can do. Anyway, I got around to using DOSBox's memory viewer on the game. Turns out the dialogue's written in some weird scripting language. Here's a snippet:

TXT("I'm confident that I'm the best there is when it comes to ")..."the art of the sword."..GOTO KAIWA_RET............*SENSHI_KOUGEKI..TXOPEN(3)..IF ( V_KOUGEKI < 30 )...TXGIRL(11).....TXT("I'm afraid I'm kind of weak. I need to build up some ")..."more muscle."...GOTO KAIWA_RET..IF ( V_KOUGEKI < 60 )...TXGIRL(9).....TXT("Wouldn't it help me in fighting if I used better weapons ")..."instead of just my own strength?"...GOTO KAIWA_RET..IF ( V_KOUGEKI < 90 )...TXGIRL(11).....TXT("I'm glad that my combat attack strength is up, but I'm a ")..."little embarrassed at looking so muscle-bound."...GOTO KAIWA_RET..IF ( V_KOUGEKI >= 90 )...TXGIRL(1).......TXT("I've become pretty powerful. I can just crush people's ")..."flimsy armor."..GOTO KAIWA_RET............*SENSHI_BOUGYO..TXOPEN(3)..IF ( V_BOUGYO < 30 )...TXGIRL(0).....TXT("Armor will protect me when I'm fighting? I'd like to get ")..."some good armor..."...GOTO KAIWA_RET..IF ( V_BOUGYO < 60 )...TXGIRL(0).....TXT("I wonder if people who fight without armor have really ")..."tough skin?"...GOTO KAIWA_RET..IF ( V_BOUGYO < 90 )...TXGIRL(1)....."Thanks to the armor you bought me, I can fight without getting hurt."...GOTO KAIWA_RET..IF ( V_BOUGYO >= 90 )...TXGIRL(14)....."I'm so good at defending myself, I feel like I'm invincible!"..GOTO KAIWA_RET


Can we see that scripting format in like, its raw form without the ... 's everywhere?
might make it just a tad easier to read.

although it looks to me this is just a bunch of if/goto statements depending on some conditions to advance/choose dialogue.
shicky256
Random nobody
Level: 4


Posts: 5/6
EXP: 212
For next: 67

Since: 04-24-17


Since last post: 204 days
Last activity: 156 days

Posted on 04-28-17 04:01:55 PM (last edited by shicky256 at 04-28-17 04:08:33 PM) Link | Quote
Sure, here's a bit more. Last time, I made the mistake of copying stuff out of the hex editor instead of making a new file.

IF ( FLG_START_MODE = 2 )
SLCPOS(6,WIDSTRATLOCX,WIDSTRATLOCY)

SLCTX("Begin a new game,Restore saved game,Quit")
IF ( ISLCT=1 )
C1 = 3
LOAD("SCNSYUGO")
IF ( ISLCT=2 )
TIMER1(30)
WAIT1
FFDISK(4)
IF ( AX=1 )
EFC(7)
GRPCLS
TXOPEN(1)
EFC(0)


"Return to DOS?"
SLCTX("Yes,No")
IF ( ISLCT=0 )
MUSIC(2)
EFC(1)
GRPCLS
END
TXCLOSE(1)
GOTO RESTART
GRPCLS
TXOPEN(1)
MUSIC(2)
EFC(0)

"Remove the disk before turning off the power."
@P@P@P@P@P@P@P@P@P


It's nothing that would prevent me from using the script (the variables even help me understand what goes where), I just found it interesting. From an interview I just read I guess it's called "PM-BASIC", so it's probably custom.
brian151
Banned
The administration (as well as a few users) have decided that you're creepy/weird enough that it's time to activate the sploded clause.
Laters.


Level: NaN


Posts: 143/-249
EXP: NaN
For next: 0

Since: 08-09-16
From: USA

Since last post: 108 days
Last activity: 81 days

Posted on 04-28-17 09:26:51 PM Link | Quote
Interesting
well, good luck with all that, looks to be quite a project.

You figure out anything else about those executables?
shicky256
Random nobody
Level: 4


Posts: 6/6
EXP: 212
For next: 67

Since: 04-24-17


Since last post: 204 days
Last activity: 156 days

Posted on 04-28-17 10:38:09 PM Link | Quote
Originally posted by ihadtnowegtum
You figure out anything else about those executables?

From looking at the text files extracted from memory, it looks like the Princess Maker 2 program itself is some sort of BASIC interpreter, and the files are "programs" that run different sections of the game. This helps me figure out what the executables do since they're called within those text files. This makes TriD's other file signature diagnosis of "Commodore PET BASIC file" seem a bit more reasonable. For example, DSKTOOL.COM is called from the game save/load tool, so it presumably has something to do with filesystem access:

PARC(1,"DSKTOOL.COM",1,0)
START_SYUGOSEI
C1 = 2
C2 = 3
LOAD("PARAINIT")

One annoying thing is that some variables are written in english (like URA_MOTHER_LOVE), but others are harder to understand, like B_KANJUSEI. The translator guy mentioned that he messed with the actual BASIC code as little as possible since he didn't want to screw anything up, so it makes sense that some stuff's untranslated but doesn't make my job any easier.
brian151
Banned
The administration (as well as a few users) have decided that you're creepy/weird enough that it's time to activate the sploded clause.
Laters.


Level: NaN


Posts: 145/-249
EXP: NaN
For next: 0

Since: 08-09-16
From: USA

Since last post: 108 days
Last activity: 81 days

Posted on 04-29-17 04:38:34 AM Link | Quote
This would make sense.
I've often wondered how to make a complete game (or most of it) in a scripting language (excluding the ones that natively support this, more or less) Obviously, it's been done before, but that doesn't mean it's easy, by any means.

Yeah, the variables being in another language isn't fun... and re-naming them probably wouldn't help much unless you were to discern what they even mean. Even then, how to edit all of them would be a task in and of itself, most likely.

Again, good luck.
I recall seeing the ripped sprites from this game on TSR a while back, hence only reason I even know slightly about this game, or bothered to check the thread.
Keitaro

Fire Snake
LOVELY ARRANGEMENT. VOLCANO BAKEMEAT
Level: 66


Posts: 1189/1190
EXP: 2378708
For next: 83143

Since: 09-09-08
From: California

Since last post: 74 days
Last activity: 12 days

Posted on 09-06-17 06:32:55 AM Link | Quote
bit of a bump, but I'm actually IRL acquaintances with the owner of SoftEgg---perhaps I could see if he'd be of any assistance in this?
Next newer thread | Next older thread
Jul - Game Research/Hacking/Modding - Help with Princess Maker 2 script extraction? New poll - New thread - New reply




Rusted Logic

Acmlmboard - commit 2f1bc75 [2017-08-27]
©2000-2017 Acmlm, Xkeeper, Inuyasha, et al.

29 database queries, 5 query cache hits.
Query execution time: 0.148172 seconds
Script execution time: 0.013186 seconds
Total render time: 0.161357 seconds