Monday 4 December 2017

So close!

5,284 scripts now compile to correct size :)
Only 1 script left that doesn't!

This one is going to take a lot of work though by the look :/

New version 0.3 available here: Version 0.3

Saturday 2 December 2017

Almost there

Good progress still being made with 5,267 scripts compiling to the same byte size and only 18 failing now.
These failures are down to bad code in the original source which I need to recreate to get a solid baseline for any changes.

New version 0.2 available here: Version 0.2

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
Updated version here: Version 0.2

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!

Wednesday 29 November 2017

Decompiler rewrite progress

A move of PCs meant that I stupidly lost a chunk of the work I did on the decompiler a couple of years back so I'm having to rewrite it.

Progress is going well and I've covered most of the 'easier' decompilation now which means that 2/3 of the binary scripts decompile to source and then recompile to the same binary as extracted from the game.

Here's an example of how the decompiled source looks atm.

Compared to the debug source files extracted from the xbox version this obviously doesn't have any of the comments or helpfully named variables.
I'm using the c# Roslyn compiler functionality as the source syntax is near enough c# which should mean I can work out some better variable names once everything decompiles correctly.

I am finding bugs in the binary code which atm I'm working around and recreating in the new source
so that I can get a baseline match. Also there are some scripts only on the PC version and differences  from the xbox code which makes things harder but I can deal with those later.

I've switch from Eclipse as a script platform to visual studio code which I'll put details up about later.

Sunday 26 November 2017

1.6 with shader changes

As part of the push to get everything shared I've added the shader fixes from Guzz to the patcher and released as version 1.6 here.

More details on the DCoTEPatch page.

Friday 24 November 2017

That is not dead which can eternal lie

Despite good intentions real life stuff is always getting in the way and I keep having to stop working on this project. It's never good to see that the thing you wanted to help out with was from a comment two years ago...where the heck did that time go!!!

Due to renewed interest from the GOG release I'm picking this up again and trying to get all my tools and code uploaded at a minimum. Most of the tools binaries were up already and some of the source. The main omission was the decompiler as it could decompile the majority of code but anywhere that functions were called within if statements, for example, it didn't work.

There is interest in the textures and the possibility of a hires set and though that is a massive undertaking it's something I'd like to see. Looking back my previous tests suggested that it was possible using the tools I've written in that the larger textures would be loaded. However I realise that I didn't really check that they were properly rendered in a higher resolution. Something to check now.

The fixed shaders for the blue light bug is definitely something I want to add in to the patch to help people get those applied and stop having to use the workaround method.

So the plan is upload code, upload decompiler, document how to roundtrip the textures out and back in again, add shader fix to patch. But, and it is a big but, I'm not sure I have time to complete the compiler so it may be down to someone else to do that.

Saturday 18 November 2017

GOG version of DCOTE

It looks like the GOG version of DCOTE has fixed shaders for the blue light problem.
I've checked and they match the ones from here:

There are also changes to the main exe but nothing in the xml area.