Jump to content
Sign in to follow this  
benu

cpp2bin tool

Recommended Posts

...but i searched and found no answer sad_o.gif

I modified the official commented config, but when i try to bin it with cpp2bin there is an error message "Error on property". I get this error also when trying to bin the unmodified commented config . Are there any other tools to do this or are there some conversions i have to do to the config.cpp to bin it?

Share this post


Link to post
Share on other sites

Might be possible, i found some more bugs in the meantime and i still get an error saying "value not an array" when starting the game with the config.cpp, but why does it also not work with bis commented config? I unpacked the files and put each .h and .hpp file into the location where the #include directive in the config.cpp is. Could this be the problem? This is my first config project, so i may be missing something really simple...

Share this post


Link to post
Share on other sites

I get no errors starting the game with bis commented config, yet cpp2bin still is not able to bin it. So there are issues with cpp2bin. Regardless of the errors my config still might have, the question remains what do i have to change in a config.cpp to make it work with cpp2bin or what other tool can i use to get the job done?

Share this post


Link to post
Share on other sites

This is most likely because of the block commenets that BIS used. Ex:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">/*

TahomaB24 = hfont12;

TahomaB36 = hfont16;

TahomaB48 = hfont16;

CourierNewB64 = hfont16;

Garamond64 = hfont16;

SteelfishB64 = hfont16;

SteelfishB128 = hfont32;

AudreysHandB48 = hfont12;

AudreysHandI48 = hfont12;

*/

It's my finding that cpp2bin will give that error if any block comments are present, and the very first line of the commented config is a comment of that type. I'm guessing that's because it checks the file line-by-line while compiling it and doesn't actually try to parse it, so it doesn't "know" that the text contained between the /* and */ is commented.

You may also want to look at any include statements - cpp2bin will also generate errors if those are present.

Share this post


Link to post
Share on other sites

Thanks for the answer. I got my config working, there was an ",," in an array of arrays. Hard to find after i changed nearly 2000 lines in the config.

I already did remove all #include statements. I will now remove all /* */ comments and see if that helps.

Share this post


Link to post
Share on other sites

If I remember correctly, one of the files you have to include has a include inside of that so make sure you double-checked for any includes in the config.

Writing configs can be a real pain sometimes.

Share this post


Link to post
Share on other sites

I am sure i got the includes right. My cpp is working now too, as is the bis cpp. But cpp2bin can't convert them.

I found out one other thing, cpp2bin can't seem to handle array defines, like "#define mydefine {1.0,0.8,06}". I have all those taken out and replaced by their actual values now.

If it also reads only one line at a time it won't be able to handle these constructs properly:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#define TimedCombatActions(x) TimedCombatActionsExt(x,x)

/*

class x##Actions: CombatActions \

{ \

stop=#x;default = #x; \

down="Lying";up="Combat"; \

turnL=""; \

turnR=""; \

turnLRelaxed="";turnRRelaxed=""; \

putDownEnd ="Combat"; \

fireNotPossible="Combat"; \

};

*/

TimedCombatActions(PutDown)

TimedCombatActionsExt(TakeFlag,Combat)

TimedCombatActions(Medic)

TimedCombatActions(Treated)

So i guess i replace these with actual classes also. I will keep you informed about my progress.

One question though: if bis commented config obviously does not work with cpp2bin, then how do you make your configs? Don't you use bis cpp as a basis or do you use a different tool to make your bins?

Share this post


Link to post
Share on other sites
One question though: if bis commented config obviously does not work with cpp2bin, then how do you make your configs?

You can just leave it as cpp and it'll work fine, its like that in FDFmod.

Also you can easily get "rid" of all the macros, comments, etc. by passing the file through a C preprocessor but cpp2bin wont still convert it.

Share this post


Link to post
Share on other sites
You can just leave it as cpp and it'll work fine, its like that in FDFmod.

Wouldn't be a problem either, i guess i just want to do my first project "right" and not fail at binning wink_o.gif Actually, i am thinking of taking this cpp exploration a little further if time and skill permits.

Quote[/b] ]Also you can easily get "rid" of all the macros, comments, etc. by passing the file through a C preprocessor but cpp2bin wont still convert it.

I thought about that but never really tried it yet. Besides some warnings about the escaped double quotes in the preload section this seems to work fine though biggrin_o.gif Thanks for the info.

Update: i ran my config through gcc -E [1] and the resulting config was not playable any more sad_o.gif

[1]<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">-E Stop after the preprocessing stage; do not run the compiler proper. The output is in the form of preprocessed source code, which is sent to the standard output.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×