Thursday 30 November 2017

DCoTETools preview release

The tools for scripting are now at a point where they are worth sharing :)
And luckily they work with all versions of the game.

Script wise 4,985 scripts compile to the same size as the original scripts which is a good sign they are probably correct.  There are some complex reasons why a lot are not binary identical but I should be able to work around that later.  There are 300 scripts remaining that won't fully decompile yet but I'm working on that also.

So the bottom line is whilst you can read the extracted script sources, make changes and rebuild them into .bat files you cannot run against those new .bat files ... yet (see note at bottom)!

You can download the tools here dcotetools.zip
Updated version here: Version 0.2 dcotetools.zip

To see them working:

Extract the zip file into the Scripts directory of your install.
This will be something like "C:\Program Files\Bethesda Softworks\Call Of Cthulhu DCoTE\Scripts\"
That directory will contain several .bat files which are the squashed binary script files.

Open a command prompt at that location and then start by executing:
SucUnbatch.exe . bin list
This will extract the individual compiled scripts out into the bin directory and puts the list of which scripts go into which .bat files into the list directory.

Next we need to decompile the binary scripts into source:
SucDecompiler.exe bin src
This will decompile the binary scripts in bin into the src directory.

You can go and look at the scripts in src and maybe try and find some bugs :)

To recompile any changes that you make use:
SucCompiler.exe src newbin
This will recompile the source files into binary files in the newbin directory.

Finally to squash the binary scripts back into .bat files:
SucBatch.exe newbin list newbat
This will use the files in the list directory to squash the correct newly built binaries into the newbat directory.

You should now have a new set of matching .bat files in the newbat directory.

And at some point soon you could replace your original .bat files with these and play with the changes you have made.

Once I've got everything decompiling correctly I'll put together a package using visual studio code and the tools to allow you to change a file, have it compile on save and rebuild your batch files to allow quick testing of code changes.

If you were to change one of the scripts that currently does decompile correctly you could take the newly compiled .bin file from newbin, merge it with the original unbatched .bin files in bin and then use the batch tool to create new .bat files that contained that change.
So, for example, copy the files from bin into testbin, copy your new bin file from newbin into testbin, run:
SucBatch.exe testbin list testbat
That would more than likely work!

1 comment: