Page 1 of 1

Need documentation for runecl.

Posted: Mon Dec 11, 2017 1:12 am
by Yukiko
I am trying to help my son with a problem. He is working on a project to help another shard and they are missing some SRC files for their shard. It was suggested by a Core developer that we try runecl, using switch -v, for a clue as to what those scripts do so my son can try to recreate them as SRC files. He was having problems with runecl. As that shard is running an earlier version of the Core I decided to see if I could get runecl to work on a compiled file from the Distro under the current Core. My thoughts were that perhaps his version of runecl was bugged. I could not get runecl to execute properly. As you can see from the output below one error is that it cannot find module uo.
Here is what I entered at the command line and the corresponding output from runecl:

Code: Select all

D:\DistroDev2\scripts>runecl -v D:\DistroDev2\scripts\misc\logon.ecl
EScript Executor v1.12
Copyright (C) 1993-2016 Eric N. Swanson

WARNING: D:\DistroDev2\scripts\misc\logon.ecl: Unable to find module uo
Assertion Failed: prog_ok_, executor.cpp, line 3448
failed to open logfile log/start.log

##########################################################
Current StackBackTrace
(function-name not available) - 0x140087957
  (filename not available)
(function-name not available) - 0x1400856af
  (filename not available)
(function-name not available) - 0x14006be3a
  (filename not available)
(function-name not available) - 0x14006b992
  (filename not available)
(function-name not available) - 0x1400495bd
  (filename not available)
(function-name not available) - 0x1400399f3
  (filename not available)
(function-name not available) - 0x1400395a0
  (filename not available)
(function-name not available) - 0x140038cdf
  (filename not available)
(function-name not available) - 0x140083328
  (filename not available)
(function-name not available) - 0x14003a413
  (filename not available)
(function-name not available) - 0x14008df39
  (filename not available)
BaseThreadInitThunk - 0x7ffe55bc1fe4
  (filename not available)
RtlUserThreadStart - 0x7ffe5845ef91
  (filename not available)
##########################################################
getaddrinfo() failed for "polserver.com" due to "Either the application has not called WSAStartup, or WSAStartup failed. "(code: 10093)
This is using the latest Core build.
If I am doing something wrong PLEASE tell me.

Re: Need documentation for runecl.

Posted: Mon Dec 11, 2017 2:10 am
by bodom
Some time ago, I wrote an escript decompiler.

Basically, it takes and .ecl and gives you back and .src and .inc (doing some guessing for the .inc part).

Bad news is that it was meant for POL093, so it will not work on POL099, good news is that to make it work, you should only need to remap tokens in bytecode (since during the years, somebody instead of adding new tokens at the end, inserted them in the middle, shifting everything up/down): that should be doable in a few hours of Python coding.

PM me if you need it.

Re: Need documentation for runecl.

Posted: Tue Dec 04, 2018 3:05 am
by Sgt Shagrat
bodom wrote: Mon Dec 11, 2017 2:10 am Some time ago, I wrote an escript decompiler.

Basically, it takes and .ecl and gives you back and .src and .inc (doing some guessing for the .inc part).

Bad news is that it was meant for POL093, so it will not work on POL099, good news is that to make it work, you should only need to remap tokens in bytecode (since during the years, somebody instead of adding new tokens at the end, inserted them in the middle, shifting everything up/down): that should be doable in a few hours of Python coding.

PM me if you need it.
Hi Bodom,
I found this thread searching for an Escript decompiler
I'm working on an old POL93, can you help me with this tool you wrote? I would be grateful :)

Re: Need documentation for runecl.

Posted: Tue Dec 04, 2018 6:42 pm
by bodom
Since many people have been asking, I've just chosen to publish it.

There are two branches: the master works on POL093. The "untested" should work on POL096.

If you make improvements, you are welcome to contribute back.

Re: Need documentation for runecl.

Posted: Tue Dec 04, 2018 9:48 pm
by ThisIsMe
bodom wrote: Tue Dec 04, 2018 6:42 pm Since many people have been asking, I've just chosen to publish it.

There are two branches: the master works on POL093. The "untested" should work on POL096.

If you make improvements, you are welcome to contribute back.
I can assure you the 096 version works swimmingly, there is some cleanup involved but it will get the job done.

When I say cleanup I mean, you likely can not just decompile an ecl and just compile the src file and have it run, you will need to cleanup some extra stuff near the top of the src file but it is not incredibly difficult to know which of these things does not fit in.

Thanks again Bodom and Turley for the help on my dilemma.

Re: Need documentation for runecl.

Posted: Wed Dec 05, 2018 7:39 am
by Ciechu
This decompilator is that thing I was waiting for 18 years. Is there any solution to decompile 095 files? When I try, I got msg that ecl version is 3.

It will save my time. We make a new copy of old shard, which was great in Poland in 2004 year.

Thank you, for your work.

Re: Need documentation for runecl.

Posted: Wed Dec 05, 2018 7:49 am
by bodom
Try the 096 "untested" branch. It has no limitation on src version, and it should work fine.

The 093 "master" version has been tested to (almost always) produce a source file that, when compiled back, matches exactly the original decompiled binary file.

Re: Need documentation for runecl.

Posted: Wed Dec 05, 2018 8:02 am
by Ciechu
Hello,

untested branch says it's not a pol093 version (in source file != 5), when I change this for example 3, there is no result (just blank lines)

Thanks,

Re: Need documentation for runecl.

Posted: Wed Dec 05, 2018 8:13 am
by bodom
It then probably needs some modifications to work for POL095.

Re: Need documentation for runecl.

Posted: Wed Dec 05, 2018 12:14 pm
by Sgt Shagrat
bodom wrote: Tue Dec 04, 2018 6:42 pm Since many people have been asking, I've just chosen to publish it.

There are two branches: the master works on POL093. The "untested" should work on POL096.

If you make improvements, you are welcome to contribute back.
Thank you so much for this!

May I use Python on windows to run the decompiler or I need a linux distro?

Thanks in advance

Re: Need documentation for runecl.

Posted: Wed Dec 05, 2018 12:21 pm
by bodom
I have never tested it under Windows, but i always write my scripts with OS portability in mind, so it should work with latest python3 for Windows.

If it doesn't, then it should be a matter of fixing a couple of lines of code.

Re: Need documentation for runecl.

Posted: Thu Dec 06, 2018 5:24 pm
by Yukiko
It works on Windows just fine as I recall.