by mike_hearn · 3y ago · 0 comments
I wonder though ... they say it's now pure open source that's been "rewritten" from scratch. Hate to be a party pooper but is that really true? It took all of two minutes to find this in the code:
https://github.com/dkfans/keeperfx/blob/master/src/engine_re...
//BucketKindPolygonStandard in this function could also be BucketKindPolygonSimple or BucketKindBasicUnk10 idk all 3 pretty similar
int z;
struct BucketKindPolygonStandard *v5;
int v6;
struct BasicQ *v7;
if ( (ec1->field_8 & (uint16_t)(ec2->field_8 & ec3->field_8) & 0x1F8) == 0
&& (ec3->view_width - ec2->view_width) * (ec1->view_height - ec2->view_height)
+ (ec3->view_height - ec2->view_height) * (ec2->view_width - ec1->view_width) > 0 )
{
I dunno, this looks a lot like decompiled code. There are lots of other variables with names like v15, v16 etc in other parts of the code too. // The choice of PolygonKind can be PolygonStandard, PolygonSimple, or BasicUnk10 - they are quite similar in functionality
int intersectionResult;
struct PolygonStandard *polygonStandard;
int computationResult;
struct BasicQueue *basicQueue;
if ((edgeClipper1->clipMask & (uint16_t)(edgeClipper2->clipMask & edgeClipper3->clipMask) & 0x1F8) == 0
&& (edgeClipper3->viewWidth - edgeClipper2->viewWidth) * (edgeClipper1->viewHeight - edgeClipper2->viewHeight)
+ (edgeClipper3->viewHeight - edgeClipper2->viewHeight) * (edgeClipper2->viewWidth - edgeClipper1->viewWidth) > 0)
{
Seems it didn't really understand "BucketKind".
Neither do I to be honest.That's not better variable names; that's better-looking garbage. At least you know you don't know what "v7" is. With the post-LLM code you're having to poke through confident error.
Once I asked chatgpt to make some obfuscated+minified js readable for me. It did. I was blown away by how well it chose the variable names.
I started looking at this code to find the prod bug, but I found other bugs that I wasn't expecting...
I took a closer look and realized that the code it made was almost right, but also 5% wrong.
I wouldn't have noticed the incorrectness if I wasn't debugging for several hours before and had some general idea of what the pretty printed code did and did not do.
But then you are doing boring work and letting the llm do the fun work, which is not the point the whole thing.
That’d be hardly useful in a full file with colliding names but on a single function that may be useful.
And what if it is? At what level is using decompiled code copyright violation as opposed to just replicating an algorithm?
If it is the disassembled code, nothing will happen. There are no damages to award, so there's no reason that this would even make it into court. If it did go to court (as part of a larger case), the artifact decompiled would be proprietary. However it would be impossible to prove (and difficult to convince anyone) that the code was directly from that artifact.