New F2 compiler/decompiler
New F2 compiler/decompiler
There is a new compiler / decompiler for fallout 2 at:
http://members.fortunecity.com/noid84/c ... mpiler.zip
Documentation isn't finished yet, but there is a start.
Comments anyone?
http://members.fortunecity.com/noid84/c ... mpiler.zip
Documentation isn't finished yet, but there is a start.
Comments anyone?
-
- SDF!
- Posts: 18
- Joined: Wed Dec 18, 2002 6:59 pm
[quote="Helios2000"]
decompile:2452:in `require': No such file to load -- getoptlong (LoadError)
from decompile:2452
this is my problem.[/quote]
Does this file exist ?:
c:\usr\local\lib\ruby\1.6\getoptlong.rb
If not then the interpreter was not installed into the root directory.
The ruby interpreter must be installed into the root directory of the drive so that it can find all the libraries.
Let me know if this helps.
decompile:2452:in `require': No such file to load -- getoptlong (LoadError)
from decompile:2452
this is my problem.[/quote]
Does this file exist ?:
c:\usr\local\lib\ruby\1.6\getoptlong.rb
If not then the interpreter was not installed into the root directory.
The ruby interpreter must be installed into the root directory of the drive so that it can find all the libraries.
Let me know if this helps.
-
- SDF!
- Posts: 18
- Joined: Wed Dec 18, 2002 6:59 pm
-
- Scarf-wearing n00b
- Posts: 33
- Joined: Tue May 28, 2002 12:44 pm
- Location: Krasnoyarsk, Russian Wasteland
- Contact:
The interpreter can be installed in any directory of any drive (I have installed it into d:\lang\ruby\ instead of c:\usr\local\).The ruby interpreter must be installed into the root directory of the drive so that it can find all the libraries.
The libraries are searched relatively to location of ruby.exe.
The compiler and decompiler are great!
They both work with native Interplay's syntax. Import/export of variables and even of functions is supported. There are also those "indirect" subroutine calls. This is simply amazing!
Where did you get all the information? And why you used that strange interpreted language, is there any way to make a Win32-executable?
Last edited by ABel on Tue Feb 04, 2003 2:55 pm, edited 1 time in total.
-
- SDF!
- Posts: 18
- Joined: Wed Dec 18, 2002 6:59 pm
[quote="ABel"]
Where did you get all the information? And why you used that strange interpreted language, is there any way to make a Win32-executable?[/quote]
I got the Interplay syntax from the KA compiler docs. The KA compile.exe was used to compile simple test programs, which I then hand disassembled to work out how that compiler works. To work out everything and write the compiler / decompiler took about a month.
I used the ruby language as it is really good for writing prototypes. There is no ruby to C converter, but I will probably rewrite the decompiler / compiler into C (at some stage) and post a native windows version.
Where did you get all the information? And why you used that strange interpreted language, is there any way to make a Win32-executable?[/quote]
I got the Interplay syntax from the KA compiler docs. The KA compile.exe was used to compile simple test programs, which I then hand disassembled to work out how that compiler works. To work out everything and write the compiler / decompiler took about a month.
I used the ruby language as it is really good for writing prototypes. There is no ruby to C converter, but I will probably rewrite the decompiler / compiler into C (at some stage) and post a native windows version.
[quote="Jargo"]But native interplay names are little hard to understand why not make it compatible with ipp.
And the ssl file is not very readable in "txt edytor" what edytor you use?[/quote]
The interplay names are those used by the original interplay compiler (examine fallout2.exe with a hex editor to see them). I use these names as I feel they are more "correct".
The problems with the ssl not being readable is my fault. I do all my development under unix where the end of line is "\n", but under windows the end of line is "\r\n". Wordpad.exe should be able to read and edit the ssl files.
And the ssl file is not very readable in "txt edytor" what edytor you use?[/quote]
The interplay names are those used by the original interplay compiler (examine fallout2.exe with a hex editor to see them). I use these names as I feel they are more "correct".
The problems with the ssl not being readable is my fault. I do all my development under unix where the end of line is "\n", but under windows the end of line is "\r\n". Wordpad.exe should be able to read and edit the ssl files.
- Red
- Hero of the Glowing Lands
- Posts: 2085
- Joined: Wed May 15, 2002 11:58 am
- Location: Nowhere (important anyway)
- Contact:
Remember that BIS might release their own compiler (I officially got this information, though when's another story, so (IMHO) it's better to support BIS's format over IPP since then we could later possibly simply convert the code into the native compiler (though maybe at that point we might not want to do that if too many features were added not supported in the original compiler).
To that effect I was wondering wether that import/export stuff was really supported in the normal compiler or wether this was something added...
It's nice though to see it in ruby since this means anyone can fiddle with the code fgiven a bug is found without even recompiling...
I started decompiling the entire Fallout2 scripts to see if I can find discripencies. Great work!
Oh and for the command line ABel's perfectly right. you just need to make sure that the lib directory is properly placed in relation to the EXE (and that the DLL is found beside the EXE of course). Although I'm using the mswin32 port of ruby. Here's my extraction line:
To that effect I was wondering wether that import/export stuff was really supported in the normal compiler or wether this was something added...
It's nice though to see it in ruby since this means anyone can fiddle with the code fgiven a bug is found without even recompiling...
I started decompiling the entire Fallout2 scripts to see if I can find discripencies. Great work!
Oh and for the command line ABel's perfectly right. you just need to make sure that the lib directory is properly placed in relation to the EXE (and that the DLL is found beside the EXE of course). Although I'm using the mswin32 port of ruby. Here's my extraction line:
Code: Select all
E:\games\Fallout2_extracted_reference\data\scripts>for %a in (*.int) do @D:\apps\ruby\bin\ruby \games\falloutdec\decompile %a
...
Thx Noid, It's cool that your compiler/docomplier is open source. :wink:
I have compiled many script's with no problem.
But found problem with:
or
in decompiled file DCVic.int
What does this mind: (a != 0 == 0)
I have compiled many script's with no problem.
But found problem with:
Code: Select all
if (op_local_var(11) != 0 == 0) then
Code: Select all
if (op_global_var(6) != 0 == 0) then
What does this mind: (a != 0 == 0)
- Red
- Hero of the Glowing Lands
- Posts: 2085
- Joined: Wed May 15, 2002 11:58 am
- Location: Nowhere (important anyway)
- Contact:
You mean what does this "mean"?
Sometimes the script actually does that... Check the precedence of the operatros to be sure but suppose a is true (ie: 1).
true != false == false becomes true == false becomes false.
For false:
false != false == false becomes false == false becomes true.
So effectifly it's just a "not". Now the reason something like this might come up is because the original compiler might not optimize anything in the original code. Suppose in the original script, the script wrote something along the lines
(GVAR_WHATEVER != GVAR_WHATEVER_SOMETHING_WAS_SET) == FALSE you might have endede up with such code, it would (kind of) make sense in the script, but look funky once compiled without optimization.
Sometimes the script actually does that... Check the precedence of the operatros to be sure but suppose a is true (ie: 1).
true != false == false becomes true == false becomes false.
For false:
false != false == false becomes false == false becomes true.
So effectifly it's just a "not". Now the reason something like this might come up is because the original compiler might not optimize anything in the original code. Suppose in the original script, the script wrote something along the lines
(GVAR_WHATEVER != GVAR_WHATEVER_SOMETHING_WAS_SET) == FALSE you might have endede up with such code, it would (kind of) make sense in the script, but look funky once compiled without optimization.
...
Hiya, can I pop in? :) Great work on the (de)compiler, and I can run it on my computer, too (the old one never did even after I got the database stuff several times over).
My gripe with the new compiler if I have one is not technical but graphical (and not just because I always preferred TurboPascal to C), the ssl output files look, well, a little cluttered compared to ipp, and the indention could be clearer as well. Also each script seems to have a pointless "checkPartyMembersNearDoor" procedure tagged onto it (the old ones often have ChooseFromList and TimeOfDay at the top but not that other one). Some scripts are almost 150% the size of their ipp counterparts.
But anyway, does this mean we're getting closer to my dream of a playermade patch for Fallout 2 along the lines of the Baldurdash fixpack for Baldur's Gate 2...? A totally commensurable compiler and the mod enabler should be all it takes really. Good ending for Gecko, here we come.
/Per
My gripe with the new compiler if I have one is not technical but graphical (and not just because I always preferred TurboPascal to C), the ssl output files look, well, a little cluttered compared to ipp, and the indention could be clearer as well. Also each script seems to have a pointless "checkPartyMembersNearDoor" procedure tagged onto it (the old ones often have ChooseFromList and TimeOfDay at the top but not that other one). Some scripts are almost 150% the size of their ipp counterparts.
But anyway, does this mean we're getting closer to my dream of a playermade patch for Fallout 2 along the lines of the Baldurdash fixpack for Baldur's Gate 2...? A totally commensurable compiler and the mod enabler should be all it takes really. Good ending for Gecko, here we come.
/Per
- Red
- Hero of the Glowing Lands
- Posts: 2085
- Joined: Wed May 15, 2002 11:58 am
- Location: Nowhere (important anyway)
- Contact:
Hey Per! :)
For the idents you can look at the ruby code and change it to your liking.
It's on line 27 in fact for easy access...
This in fact also applies to the function names as well if you feel like it, you could convert it to "ipp compatible format".
To that effect I wonder if we add such options wether we should post it for Noid to merge with his own code...
I have no idea about the "extra near door function" though. Maybe they indded all have it but for some reason dec ingored it? I just don't know (and don't know enough about the code to figure it out yet either).
For the idents you can look at the ruby code and change it to your liking.
It's on line 27 in fact for easy access...
This in fact also applies to the function names as well if you feel like it, you could convert it to "ipp compatible format".
To that effect I wonder if we add such options wether we should post it for Noid to merge with his own code...
I have no idea about the "extra near door function" though. Maybe they indded all have it but for some reason dec ingored it? I just don't know (and don't know enough about the code to figure it out yet either).
...
- Red
- Hero of the Glowing Lands
- Posts: 2085
- Joined: Wed May 15, 2002 11:58 am
- Location: Nowhere (important anyway)
- Contact:
Hmm, but is it really needed though? Chances are it isn't - at least not always (why it's there is probably simply because of an include someone added to the main scripts which slaps that code wether you need it or not)... I like to have to option to stick whatever I want there, and from what I gather IPP won't. Unless of course removing it legitimitely breaks it, but I doubt that.
...
[quote="Jargo"]But found problem with:
[code]if (op_local_var(11) != 0 == 0) then[/code]
or
[code]if (op_global_var(6) != 0 == 0) then[/code]
in decompiled file DCVic.int
What does this mind: [i](a != 0 == 0) [/i][/quote]
!= and == have the same precedence, so the decompiler doesn't put in the parenthesis. As Red stated, these should have been decompiled as:
((op_global_var(6) != 0) == 0)
(Note the extra parenthesis).
I will fix this and the "\r\n" end of line bug in the next version.
Does anyone else have any bugs / enhancements they'd like implemented?
[code]if (op_local_var(11) != 0 == 0) then[/code]
or
[code]if (op_global_var(6) != 0 == 0) then[/code]
in decompiled file DCVic.int
What does this mind: [i](a != 0 == 0) [/i][/quote]
!= and == have the same precedence, so the decompiler doesn't put in the parenthesis. As Red stated, these should have been decompiled as:
((op_global_var(6) != 0) == 0)
(Note the extra parenthesis).
I will fix this and the "\r\n" end of line bug in the next version.
Does anyone else have any bugs / enhancements they'd like implemented?
[quote="Red"]To that effect I was wondering wether that import/export stuff was really supported in the normal compiler
Here's my extraction line:
[code]E:\games\Fallout2_extracted_reference\data\scripts>for %a in (*.int) do @D:\apps\ruby\bin\ruby \games\falloutdec\decompile %a[/code][/quote]
import/export was supported in the original interplay compiler. You can see it in several of the scripts (e.g. broken1.ssl and hcliz.ssl).
The keyword "critical" does not seem to be supported by the fallout scripting engine, though my compiler does support it. See the KA compiler docs for info on critical.
For extracting multiple INT files at once, you can the wildcards "*" and "?".
e.g. ruby decompile *.int
Here's my extraction line:
[code]E:\games\Fallout2_extracted_reference\data\scripts>for %a in (*.int) do @D:\apps\ruby\bin\ruby \games\falloutdec\decompile %a[/code][/quote]
import/export was supported in the original interplay compiler. You can see it in several of the scripts (e.g. broken1.ssl and hcliz.ssl).
The keyword "critical" does not seem to be supported by the fallout scripting engine, though my compiler does support it. See the KA compiler docs for info on critical.
For extracting multiple INT files at once, you can the wildcards "*" and "?".
e.g. ruby decompile *.int