.pyc decompiler

MerakSpielman

Warlord
Joined
Oct 27, 2005
Messages
217
when you run a .py file, it turns it into .pyc file. It's sort of the machine code version of the .py file.

Usually you edit the .py file, and see how Civ4 reacts to the difference. However, the game ships with several .pyc files, and no .py files for you to edit for them.

I found a decompiler program, to conver them back to .py files. I'm not sure we're allowed to do this though (plus I can't get the dangnabbed thing to work).

Do we have official word? Are we allowed to decompile .pyc files? If so I'll post the link to the decompiler, and see if any of you can get the thing running.
 
If the script you are decompiling is open source (i.e the .py file is available freely) then I don't see why there would be a problem. Then again, if the .py is available there is little need for a decompiler :)
 
Civ4 ships with several .pyc files. These are compiled .py files. It does not ship with their decompiled versions.

However, they're mixed into the Python directory, along with all the .py files I know we're allowed to edit.

And I'm thinking... if they really didn't want users getting at them, they probably would have left them as C++ code like the core engine of the game. We're allowed to mod everything else that's in the Assets folder, why not these?


Well, here's the link to Decompyler. If it turns out we're not supposed to get at these files, well, then I expect the mods will delete this thread.

I hope somebody can get it to work with better luck than myself. I'm not a programmer type. I can understand the gist of code well enough to delete sections that seem to be doing something I don't want, but I can't figure out the nuts and bolts and get this bugger working.
 
on that link it says this will only work for Python 1.5 up to 2.2. I believe Civ4 is using a higher version of Python. I could be wrong.
 
The version of Python recommended for us to download is 2.3, I think. Doesn't necessarily mean that Civ4 was written using that, though. I think this tool is worth a shot for anybody who gets the urge to mess around with those files. :)
 
To view a partial decompilation. I copied yhe entire Assets/Systems folder on to my desktop to be sure of no mistakes. Anyway I opened a pyc. file saved it as the same name but used the py subfix. It lets you see the changeable parts. The rest you,ll need a hex editor or the original source code.
 
The only parts that aren't byte code are comments. So that's pretty much all you'll be able to see until Firaxis feels like giving us the REST of the python source. :(

As for the decompyler "service", I personally would rather not pay someone to decompile it when there's an SDK coming within a couple months or so.
 
Back
Top Bottom