Author Topic: GE/PD Function Explorer  (Read 1141 times)

Your Eliteness

  • Posts: 1587
    • GE
    • PD
GE/PD Function Explorer
« on: June 13, 2018, 05:54:28 AM »

Smit

  • Posts: 2296
  • Oh, this is suicide! There's nowhere to go.
    • Eise
    • GE
    • PD
    • twitch
Re: GE/PD Function Explorer
« Reply #1 on: June 13, 2018, 11:06:23 AM »
Sick Ryan, thanks!

Wyst3r

  • Posts: 4119
  • Train Strat Master
    • Henrik
    • GE
    • PD
    • twitch
Re: GE/PD Function Explorer
« Reply #2 on: June 13, 2018, 03:49:31 PM »
Great to see you again! And really nice work on this. It's super convenient having these scripts easily accessible and with (continuously) improved readability/documentation. The annotations on the scripts themselves help a ton as well. I'll look into it more when I have time.

Btw, I did some research into instruction 6E a while back (used by Trev on Facility), which I explained in the facts topic:

https://forums.the-elite.net/index.php?topic=18518.msg411360#msg411360

A bit complicated, so not sure how to describe it in a short sentence. Also if I remember correctly, 6F just choses the preset closest to Bond?

Whiteted

  • Posts: 62
    • GE
    • PD
Re: GE/PD Function Explorer
« Reply #3 on: June 22, 2018, 04:36:45 PM »
Quote
"The global functions are viewable".
It's really great to be able to finally read those, thanks a lot.

Very good job on the code's descriptions, I feel like I do a lot more skimming than reading them in the GE editor, because the instruction descriptions are often horrible.

This definitely has the potential to be better than the GE editor's script thing but labels without colouring or indentation is not easy on the eyes. I'd be quite keen to work on recognising some standard patterns and reforming them back into loops, select statements and the like to make the control flow more readable. There definitely is potential for this decompiling as Dr Doak describes (~55 minutes in) the GE editor as "not very legible" and as "crazy unreadable language" lol.

And double thanks for the "0006 - Take a shot" code!

Your Eliteness

  • Posts: 1587
    • GE
    • PD
Re: GE/PD Function Explorer
« Reply #4 on: June 22, 2018, 08:58:32 PM »
Quote
This definitely has the potential to be better than the GE editor's script thing but labels without colouring or indentation is not easy on the eyes. I'd be quite keen to work on recognising some standard patterns and reforming them back into loops, select statements and the like to make the control flow more readable. There definitely is potential for this decompiling as Dr Doak describes (~55 minutes in) the GE editor as "not very legible" and as "crazy unreadable language" lol.

Yeah, I have a bit of backstory about this. Listening to the Dr Doak interview is what sparked my interest, and I found the wording in the GE Setup Editor to be absolutely unreadable, so I decided to start making something of my own. This was around November last year. It started out as a web based PHP application with a database backend. I added my annotations using this system. I even implemented label colouring and had an in-progress conversion into higher level code constructs (if statements, compound if-statements like if a AND b, negated if-statements, and loops). In the end I was spending too much time on getting the higher level constructs right, and I wanted to publish what I had.

I considered exporting everything as HTML and hosting it somewhere, but this wouldn't allow people to contribute amendments easily. I also considered building a login and submission system but that's a lot of work for little reward. I eventually settled on using GitLab, and ported it to Python for simplicity. I didn't port the label colouring or high level constructs though.

I will add both of these to my todo list but I'm not sure when I'll get around to them. Both of these depend on whether GitLab supports this level of customisation in markdown files though.

TheFlash

  • Posts: 2715
    • twitch
Re: GE/PD Function Explorer
« Reply #5 on: June 22, 2018, 09:18:09 PM »
I will add both of these to my todo list but I'm not sure when I'll get around to them. Both of these depend on whether GitLab supports this level of customisation in markdown files though.

You can use the "GitLab Pages" feature to generate an HTML page or full site by including a script that creates the page based on the contents of your repo.  It can be hosted under something like username.gitlab.whatever, or you can hook up your own domain/subdomain to the service. I've used it before and it worked great for my purposes.  I just had to make a script once to turn my files into web pages and then I haven't touched that part since. Every accepted commit will cause the site to update.

Whiteted

  • Posts: 62
    • GE
    • PD
Re: GE/PD Function Explorer
« Reply #6 on: July 15, 2018, 11:01:16 AM »
I've been doing some painstaking decompiling by hand and I've had some good ideas for natural simplifications that we can make and be certain that these are 'the right thing to do'. But ultimately I'm reasonably convinced that the code they wrote used some labels (a lot less than the GE-editor's code.. or more since the GE-editor only uses 'return value loops' :angry:).

A good example is this code, which is the remaining 'bad' control flow after I did a lot of work on a script. The natural thing to do is to make the whole thing into a top loop with the main loop nested in it. The only way to do this is to have a "if not A and not B and cycle counter <= X" test at the end of the main loop, and then re-test each of these to determine whether to do the routine / sleep / do nothing before reaching the end of the top loop, which surely isn't what they wrote.

Label Top
Reset Cycle Counter And Enable It
[...]

Label Main
Sleep
if A then
    Label Routine
    [...]
    if A then
        Sleep
        goto Routine
    end
    goto Top
if B then
    Sleep
    goto Top
if cycle counter > X then
    goto Top
else
    goto Main

Can anyone see a nice version of this code?

Whiteted

  • Posts: 62
    • GE
    • PD
Re: GE/PD Function Explorer
« Reply #7 on: July 15, 2018, 11:02:57 AM »
Sometime at the end of this month I'll have a good stab at writing a decompiler, which will have pseudocode for control flow but still have hex strings for the main portion of the instructions, i.e.
     35F107
     [...]
     0207
=>
    if <35F1> then
        [...]
    end

Where ultimately we'll want to interface this with Ryan's work to get
    if random byte <= 241 then
        [...]
    end
(notice the negation)

Interestingly I even found some logically unreachable code in one of the scripts

Your Eliteness

  • Posts: 1587
    • GE
    • PD
Re: GE/PD Function Explorer
« Reply #8 on: July 30, 2018, 12:26:35 AM »

Icy

  • Posts: 1848
    • GE
    • PD
    • twitch
    • 2014SilverStar
    • 2015SilverStar
Re: GE/PD Function Explorer
« Reply #9 on: July 30, 2018, 12:40:29 AM »
This is godlike, thanks so much!

Wyst3r

  • Posts: 4119
  • Train Strat Master
    • Henrik
    • GE
    • PD
    • twitch
Re: GE/PD Function Explorer
« Reply #10 on: July 30, 2018, 09:39:52 AM »
Looks great!

Whiteted

  • Posts: 62
    • GE
    • PD
Re: GE/PD Function Explorer
« Reply #11 on: July 30, 2018, 01:13:59 PM »
Pretty colours  :grinning: