Recover plugins from export javascript...???

Discussion and feedback on Construct 2

Post » Sun Nov 15, 2015 9:11 pm

I have a very big problem.. :cry:
Today, I have to upgrade and maintain my games which has been developed 2 years ago. But unfortunately all of my own plugins for my games are missing and I can't open these capx files without these plugins (Just only export javascript files still there)... :roll: .Basically, I understand that some or all code in my plugins still there in somewhere in export file but reading and understanding then extract them out form of more than 10K of code lines are terrible and impossible job.
So could someone help me..there are any method, recipe, tool...etc to help me recover plugins from exported javascript file...???.
Thank all of you in advance
B
11
S
2
Posts: 73
Reputation: 1,438

Post » Sun Nov 15, 2015 10:14 pm

Ashley has deliberately made the export as difficult to reverse engineer as possible in order to prevent just the thing you are asking.

I doubt anyone (except maybe Ashley) would be able to do what you ask.

Did you ever release them to the users on here? If so, do you remember the name(s) of the plugins? Maybe some users may still have them.

If not, then you may be out of luck.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
136
S
31
G
86
Posts: 5,480
Reputation: 59,746

Post » Sun Nov 15, 2015 11:43 pm

You can unzip the capx, and remove all references to the plugs in the xml.
That won't help you recreate their actions however.
Image ImageImage
B
170
S
50
G
178
Posts: 8,378
Reputation: 112,925

Post » Mon Nov 16, 2015 12:17 am

Extracting the runtime portion from a minified export is not really doable. I mean at most you could possibly get the minified version of the runtime with a lot of trial and error. Unfortunately all the names would be mangled so it would be a real chore to fix that into a usable form.

To be able to open a capx that uses one of those plugins you'll either have to remove all references like newt says, or you can recreate the edittime portion from the capx. After you unzip the capx you can get all you need to recreate it.

The plugin's id can be retrieved from the .caproj file under used plugins or behaviors.
Next you need to add all ACEs. The event sheet xml stores the id of the action/condition and all you need to recreate it in the edittime is the id and parameters need to be the same. Properties can be done similarly by looking at an instance in a layout xml. just keep the same order and type and you should be ok.

That at least can let you open it. Hopefully your plugins are in an old c2 install somewhere though.
B
94
S
33
G
113
Posts: 5,353
Reputation: 73,267

Post » Mon Nov 16, 2015 2:12 am

Thank too much for all of advises from you
@zenox98: I don't share these plugins in this forum because it is useless for other (Just override websocket to get command from C# application on server side whereas people in this forum use socket.io of NodeJS )
@R0J0hound, luckily, in that time my JavaRuntime broken so I couldn't use minify feature o Constract2 to export. Name, function..ect still there in export file. There are any best recipe to recover them..???
B
11
S
2
Posts: 73
Reputation: 1,438

Post » Mon Nov 16, 2015 2:51 am

@hoanganh17

Even better! In that case you can easily recover the runtime portion.

search for:
cr.plugins_.Sprite
in c2runtime.js, except replace "Sprite" with your plugin's id.

You should see something like this:
Code: Select all
cr.plugins_.Sprite = function(runtime)
{
   this.runtime = runtime;
};
(function ()
{
...

That's the start of that plugin. It continues till the matching "(" in the line "(function ()".

I used notepad++ to click on that "(" and use the command "Select all between matching brace" to do it, but you could use something else.

All that's left is to re-create the edittime.js as mentioned before since that's not exported.
B
94
S
33
G
113
Posts: 5,353
Reputation: 73,267


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 5 guests