Decompiling Challenge Scripts

Kays

Active member
Elder
Joined
Mar 10, 2003
Messages
2,923
Yes it does seem redundant. So I had to try it in game and it actually does work.  :shocked

So, that's it then?

One thing I would like to get is either a list of the corrections or a listing of the statements etc so the documentaton can be corrected.

Thanks :)
 

Keshire

New member
Joined
May 24, 2007
Messages
28
Kays said:
One thing I would like to get is either a list of the corrections or a listing of the statements etc so the documentaton can be corrected.

Was planning on adding it all to the wiki when I got time.

edit: Removed the duplicates and fixed some Lionhead typos. The typos helped get rid of a few Unknown calls.

call||file||script
Code:
engcall  7h	 SirenSpell.txt             //SirenSpell(EnemyWonder,Siren)
			VolcanoSpell.txt        //VolcanoSpell(EnemyWonder,Volcano)
			EarthquakeSpell.txt //EarthquakeSpell(EnemyWonder,Earthquake)
			HurricaneSpell.txt    //HurricaneSpell(Hurricane)

engcall  8Ch	Possibly CS block
engcall  98h	Possibly CS block
engcall  2B9h	Land4UndeadLegion.txt   //GL_GhostSuccessOutro
engcall  317h	Possibly CS block
engcall  32Ah	Possibly CS block
engcall  3F5h	Reminders.txt          //StandardReminder(AdvisorSpeak)
engcall  2Eh	Reminders.txt           //StandardBanter(AdvisorGroupID)
engcall  Dh	Land3PaternitySuit.txt    //PS_Hearts(House)
 

Hunter

New member
Joined
May 28, 2007
Messages
6
I'm about 1/3 of the way on the decompiler.  So it pretty much rests on me getting my lazy butt to work.  Should have something within a week or so.
 

Keshire

New member
Joined
May 24, 2007
Messages
28
I was on vacation. And my time at home will be a little tight since my wife is pregnant with our second.  :yourock:
 

Kain

New member
Joined
Jun 27, 2007
Messages
13
hi! i just want to ask how the work is going on  :blush
and if you are still working on this since your wife is pregnant (congratulation again)
 

Kain

New member
Joined
Jun 27, 2007
Messages
13
one question to Kays:

How much of this Stuff did you understand and is it possible that you will continue working on this?

regards,
Kain
 

Kays

Active member
Elder
Joined
Mar 10, 2003
Messages
2,923
Sorry, but this sort of stuff is way beyond me.
 

Daxter_06

New member
Joined
May 9, 2006
Messages
458
I take it that neither Hunter or Keshire have been here for a while. Without them or their source code there is no way that anyone will be able to continue on this.
 

Keshire

New member
Joined
May 24, 2007
Messages
28
Daxter said:
I take it that neither Hunter or Keshire have been here for a while. Without them or their source code there is no way that anyone will be able to continue on this.

Aye. Sorry about that. I got sucked into other things. I'll see about getting the source code.
 

Keshire

New member
Joined
May 24, 2007
Messages
28
Source Code
http://rapidshare.com/files/217302169/CHLDecompiler.zip.html

Remember this outputs the scripts in assembly. But someone with more time should be able to complete this project fairly easily. I'll look for a spreadsheet that has all the identified engine calls in it. But I've also probably listed them through out the thread.
 

Kain

New member
Joined
Jun 27, 2007
Messages
13
haha youre the best keshire, always available for the community, even more then a year later
 

ego533

New member
Joined
May 10, 2011
Messages
91
  The source is no longer available at the Rapidshare link. Does anyone have this available for download?

-ego533

 

Matt

Administrator
Staff member
Joined
Aug 28, 2005
Messages
199
Working on a low level dissembler. I know I'm almost 7 years late with this stuff but hey maybe we can get this game popular again.

Here's some documentation on the file format I've been reverse engineering for the past few days:
http://handsomematt.co.uk/bwdocs/fileformat/chl/general

It'd be really great if some of you guys were still around to get in touch, you can either:
tweet me: @_HandsomeMatt
email me: [email protected]
find me on steam: handsome-matt
or send me a pm here
 

Willy

Administrator
Elder
Joined
Jul 27, 2011
Messages
130
I've read through what you have written.
You talked about an integer at the beginning which = 12, I think it could mean 1.2 as in the 1.2 patch.

I am not sure what the unknown section is though. I was thinking it could be for the wait command. But if it only gets set to 1 then, it must be for something. I can look into it tomorrow, see what I come up with.

Also I'd be very happy to help. But I don't have much time to spare these days.

What are you using to look into the chl files? I used a Hex Reader program when I was looking into this a while back.
 

Matt

Administrator
Staff member
Joined
Aug 28, 2005
Messages
199
Combination of a hex reader, some C++ and a little guesswork.
 

SkelApe

New member
Elder
Joined
Nov 10, 2007
Messages
650
I swear this stuff used to be on Planet B&W. :suspect Of particular interest to me was the line
It's new in Black and White 2 challenge files
 

Matt

Administrator
Staff member
Joined
Aug 28, 2005
Messages
199
The instruction sets were the only thing I could find documented through an archive of an old page Keshire posted. Everything else related to this subject are just dead links so I've had to start investigating the file format from scratch.

I finished up the instruction sets page and have started identifying the engine calls. I'm still considering the feasibility of a tool that decompiles straight into Lionhead's pseudo scripting language. But an assembler and disassembler for LHVM files is definitely possible ( so modifying parts of the original scripts or merging stuff from original scripts into your own scripts will be possible ).[br][br]Added: [time]1392979069[/time]Anyone wanting to know progress:

kTzFWA9.png


I've started documenting the engine calls now: http://handsomematt.co.uk/bwdocs/fileformat/chl/enginecalls
So far I've only got 3.1 done, and have written a quick program that translates assembly engine calls into something somewhat relating to Lionhead's pseudo scripting language.
 

Willy

Administrator
Elder
Joined
Jul 27, 2011
Messages
130
I took a look at the beginning of the global variables in the chl file
They do go in order with how they are declared in a script.
I as see lots of LHVMA as well
I noticed that when an array is declared the LHVMA word tells how many of the array there is
ex:
I declare
Sports[6]
In the chl file it reads as
Sports.LHVMA.LHVMA.LHVMA.LHVMA.LHVMA.

Also For the function section
You have the in the table
Function name     String
Source                  String
Unknown             Int32          After the first function it is 02 then it counts up after each function
Unknown             Int32           This is always 16 for some reason

Also after each function (not counting the first function listed) a number shows up
For a script I made there is a total of 616 instructions.
After the second function the number 239(Base 16)
After the third function the number is 24E(Base 16)
The last function number is 25E(Base 16)

The first function has 569 instructions,
The number 239 in decimal is 569

The second function has 21 instructions
Which 24E = 590 = 569 + 21

The number must be the instruction the function it starts at



 
Top