View Full Version : Saveconvert - change various settings in save file


Gyathaar
Apr 18, 2006, 01:15 AM
I decided to start a new thread since the tool has changed quite a bit from the original tool for playing scenarios in hotseat.

Original thread is here : http://forums.civfanatics.com/showthread.php?t=153759

Since 1.61 you no longer need to use this tool to play scenarios in hotseat or pbem, but there are still some requested functionality that is missing...

New in version 4.2:
Ability to change game options

New in version 4.1:
Support for saves with more than 18 civs

New in version 4.0:
Support for warlords saves

New in version 3.2:
- bugfix for toggling turntimer and takeover AI flags (they would change the simultanous turns settings instead)

New in version 3.1:
- bugfix for FfH scenario saves

New in version 3.0:
- Can convert human players into AIs (useful for kicking players from a pbem)
- Can change settings for simultaneous turns, take over AI
- Can change turn timers for multiplayer and pitboss games
- Can convert back and forth between all multiplayer game types
- Can convert single player games into multiplayer (but not other way - to prevent cheating)
- Can change what civ you are playing in single player
- Requires administrator password to change (or view) data if the save is protected.

Old features:
- Change victory conditions
- Turn AI players into human players
- Change difficulty levels

What it wont do:
- Change passwords
- Convert saves with 'lock modified assets' / 'no cheating' flag set
- Convert multiplayer saves into single player saves (thou you can make 1 player hotseat games which act pretty much like single player games, just no worldbuilder or debug tools)

I assume there are some bugs :)

To make it easier you may want to place the save you want to convert into the same dir as the tool when you run it.. else you will have to type out the full path when it asks you for the filename :evil:


Version 4.2 can be downloaded here:
http://forums.civfanatics.com/downloads.php?do=file&id=2544

version 3.0 removed after 127 views
version 3.1 removed after 24 views
version 3.2 removed after 638 views
version 4.0 removed after 559 views

HitAnyKey
Apr 18, 2006, 07:44 AM
So in reading above, you're saying that this program will take the save file for a pitboss game and can change the turn timer from say 24 hours to 36 hours and back?

Can you explain how that would be done?

Gyathaar
Apr 18, 2006, 08:25 AM
So in reading above, you're saying that this program will take the save file for a pitboss game and can change the turn timer from say 24 hours to 36 hours and back?

Can you explain how that would be done?

Assuming you start with a pitboss save.. called say 'pitboss_save.Civ4SavedGame' which is located in same dir as you extract the program to..

run program .. it should ask you for the savefile name.. type pitboss_save and press enter

if the pitboss save already has a turn timer.. press 9 (and enter) and input the number of hours you want to change the timer to..
If the save dont have a turn timer already, you first have to turn this on with 7..

when you are done, press -1 (enter) , or just enter with no number before.. and it should ask you for the savename to write to .. default will be 'output.Civ4SavedGame' I think.

HitAnyKey
Apr 18, 2006, 08:55 AM
Great! We'll have to check this out, since we want to be able to use this functionality for the RealPolitik game. This will really help us out.
Thanx!!

Great_Scott
Apr 20, 2006, 05:09 AM
I'm finding the program does not work. I've started a dummy PTBS game (through PTBS), then i've saved the game (in PTBS), closed down PTBS, run the program, changed the turn timer... then reloaded the output and it's still with the old turn timer value...

Am i doing somethig wrong here?

Gyathaar
Apr 20, 2006, 07:00 AM
I'm finding the program does not work. I've started a dummy PTBS game (through PTBS), then i've saved the game (in PTBS), closed down PTBS, run the program, changed the turn timer... then reloaded the output and it's still with the old turn timer value...

Am i doing somethig wrong here?
Not doing anything wrong.. its just that once the countdown has started.. it wont use the new timer value till the next turn starts. Guess I forgot to mention that :)

Great_Scott
Apr 20, 2006, 10:02 AM
ahhhh! thanks for that.. i'll test it now... be back in a hour if it dont work.

netbjarne
Apr 21, 2006, 04:18 AM
Not doing anything wrong.. its just that once the countdown has started.. it wont use the new timer value till the next turn starts. Guess I forgot to mention that :)

Also "Aaaah!" here ;-) may I recommend a "effective next turn" tip in version 3.1!

Otherwise, great util! - just made a few human playes ai. Very strange that the pitboss application is so limitied when it comes to changing options.

Gyathaar
Apr 21, 2006, 06:06 AM
Very strange that the pitboss application is so limitied when it comes to changing options.
Well.. the pitboss admin interface is located in Assets\Python\PitBoss\PbAdmin.py .. you could just add more functionality yourself :p

Jarnhestur
Apr 24, 2006, 10:21 AM
Friggin' sweet.

Paddy the Scot
Apr 26, 2006, 04:16 AM
Thanks Gyathaar :b:

GiantGuineaPig
Apr 29, 2006, 11:16 PM
can u add the function of changing the game name for a pitboss game? the pbnotify program crashes with a 64 char limit, so i want to shorten the game name...

Gyathaar
Apr 30, 2006, 08:39 AM
can u add the function of changing the game name for a pitboss game? the pbnotify program crashes with a 64 char limit, so i want to shorten the game name...
I believe you can change this by simply openening the save as a directIP multiplayer game in civ4, then vote to save now and continue playing..
Go to the game menu, and select game details.. the gamename should be there for you to change (after you input the admin password).. you can also change the admin password in same window..

Then save the game and open this save in pitboss

GiantGuineaPig
May 01, 2006, 09:48 PM
I believe you can change this by simply openening the save as a directIP multiplayer game in civ4, then vote to save now and continue playing..
Go to the game menu, and select game details.. the gamename should be there for you to change (after you input the admin password).. you can also change the admin password in same window..

Then save the game and open this save in pitboss

Ah thanks, I'll give that a shot!

naf4ever
May 08, 2006, 02:35 AM
Can you tell me why saveconvert wont work on this saved game file attached here. Its a save game of a multplayer game running mod fall from heaven. That shouldnt affect it though as saveconvert worked on a previous save a day earlier just fine with the same mod.

When i try save convert on this file all i get is:


Input savefile []:nafrog
Failed to open file "nafrog" ...
... Trying "nafrog.Civ4SavedGame" as filename...
... Success ...


Then nothing. The menu doesn't come up, the program just quits.

any ideas?

Gyathaar
May 08, 2006, 07:07 AM
Then nothing. The menu doesn't come up, the program just quits.

any ideas?
Fixed problem i v3.1

naf4ever
May 08, 2006, 12:21 PM
Wow thanks a ton. It works great now. -naf

Kael
May 08, 2006, 12:41 PM
That darn fall from heaven is always causing problems.

Gyathaar
May 10, 2006, 03:43 PM
Changed to version 3.2.. bugfixes for turntimer and takeover AI settings not getting changed in earlier versions

saint1979
May 14, 2006, 08:49 AM
Hmm, i'm using v3.2 and the prog just closed after i typed in the savegame file.
I need to change winning conditions... fast :D
Any suggestions?

Gyathaar
May 14, 2006, 11:33 AM
Hmm, i'm using v3.2 and the prog just closed after i typed in the savegame file.
I need to change winning conditions... fast :D
Any suggestions?
Are you playing some kind of mod?

saint1979
May 15, 2006, 04:18 AM
Nope, no mod.
I tried to just open the program and write anything (like asdf) then i did hit enter, and the program closed it self so I dont think that its the save file cousing the problem. But maybe i missunderstood, do i have to have the game running?

Gyathaar
May 15, 2006, 09:30 AM
The program will exist if it dont find the file.. it should write out a message first thou.
However if you are starting the program by just doubleclicking it, you prolly wont have time to see the message before it closes the window.. try to open a command prompt and then start the program from inside it.

OverloadUT
May 17, 2006, 02:11 AM
Can you explain what "[Does not] convert saves with 'lock modified assets' / 'no cheating' flag set" means? I turned on the "No Cheating" option in my PitBoss game way back before I even knew what it did - will I still be able to change the turn timer?

Gyathaar
May 17, 2006, 08:57 AM
Can you explain what "[Does not] convert saves with 'lock modified assets' / 'no cheating' flag set" means? I turned on the "No Cheating" option in my PitBoss game way back before I even knew what it did - will I still be able to change the turn timer?
I believe in patch v1.61 the game will automatically turn off this setting in multiplayer saves.. so if you are able to load the save in 1.61 pitboss (you know the admin password), then you should be able to.. not 100% sure thou.

OverloadUT
May 24, 2006, 06:58 PM
I believe in patch v1.61 the game will automatically turn off this setting in multiplayer saves.. so if you are able to load the save in 1.61 pitboss (you know the admin password), then you should be able to.. not 100% sure thou.

I just used it to change the turn timer, and it worked perfectly! Thank you for this awesome tool.

mickeyj
Jul 19, 2006, 03:53 AM
I've just converted a PitBoss game into a PBEM and it seemed to work fine but after loading up the turn timer is set to 2 minutes and ends the turn after the count down.

I've tried re-converting and changing the turn timer (tried 0 and 10) but it always seems to only give me 2 minutes. PBEM shouldn't have a turn timer at all.

Any suggestions?

I'm using 1.61

Gyathaar
Jul 23, 2006, 01:26 PM
I've just converted a PitBoss game into a PBEM and it seemed to work fine but after loading up the turn timer is set to 2 minutes and ends the turn after the count down.

I've tried re-converting and changing the turn timer (tried 0 and 10) but it always seems to only give me 2 minutes. PBEM shouldn't have a turn timer at all.

Any suggestions?

I'm using 1.61
Do you have a save?
Problem might be that turntimers dont change till it goes on to the next turn.. that is after all the human players and AIs have played

Keith_C
Aug 02, 2006, 09:08 AM
Will this work with warlords saves?

Gyathaar
Aug 03, 2006, 02:42 AM
Will this work with warlords saves?
Not yet...

Keith_C
Aug 03, 2006, 02:43 AM
Ah well - cheers for the reply!

Gary King
Aug 15, 2006, 04:14 PM
Hopefully it'll work with Warlords soon. Thanks!

upstart
Aug 19, 2006, 11:06 PM
Just adding another request for a warlords version... seems like one of the most useful utils out there at the moment... and thanks for all your work!

Gyathaar
Aug 21, 2006, 04:41 PM
Ok.. added a version that also works on warlords saves.

I have not tested all options in warlords thou, so let me know if something dont work

EmilH
Sep 06, 2006, 03:24 AM
Could you add an option to change leader's name? I'm having a problem with pitboss (the admin console is not painting) and I'm guessing that this is caused by a player using non english chars in it's name.

romelus
Sep 10, 2006, 08:53 PM
will this work on a mod save for warlord? i tried it, but after entering the file name the program does nothing.

Gyathaar
Sep 11, 2006, 03:42 AM
will this work on a mod save for warlord? i tried it, but after entering the file name the program does nothing.
It depends on the mod.. some mods adds extra game options or do other things to the save that the program doesnt know about.. in that case the program will crash (I dont check to see if everything the program does is legal on non standard saves) and may look like it does nothing

civfanphp
Sep 15, 2006, 11:32 AM
Its a great utility! :goodjob:

One thing that would be nice though is converting multiplayer to singleplayer if possible so that I could use worldbuilder and then change it back to multiplayer.

Gyathaar
Sep 15, 2006, 08:55 PM
Its a great utility! :goodjob:

One thing that would be nice though is converting multiplayer to singleplayer if possible so that I could use worldbuilder and then change it back to multiplayer.
umm.. it should already be able to do that

Edit: hmm.. guess not...

Edit2: Oh yeah.. I disabled that because allowing that would make it really easy to cheat in multiplayer games...

civfanphp
Sep 15, 2006, 09:17 PM
Edit2: Oh yeah.. I disabled that because allowing that would make it really easy to cheat in multiplayer games...

Yeah, I figured. But I only play with my sister and she is not so good. (She doesn't even like to play against me.) Then when she is losing, she gives up and we don't get to finish the game. The feature would have been nice to give her some extra troops or something.

Premator
Sep 20, 2006, 05:24 AM
Hi, I tried to load save from Warlord using v. 4.0, unfortunatelly every time this showed up :

Exception
at Civ4EditorModel.Wbs.Persist.Civ4Persistence`1.Load Header(Civ4PersistenceLoadContext context)
at Civ4EditorModel.Wbs.Persist.Civ4Persistence`1.Load (Stream stream, C concept, PersistenceTypeConverter converter, ProgressHost progressHost)
at Civ4EditorModel.Wbs.Persist.Civ4Persistence`1.Load (String file, C concept, PersistenceTypeConverter converter, ProgressHost progressHost)
at Civ4MapGenerator.Wbs.WorldBuilderSave.Load(String file, ProgressHost progressHost)
at Civ4MapGenerator.LoadScreen.DoLoad(Object param)
at Civ4MapGenerator.TaskScreen.RunThread(Object host)

the same think hapends when I try to load vanilla CIV saves
any ideas what went wrong ?

ps. I do not use any mod or anything like this...

Gyathaar
Sep 20, 2006, 07:40 AM
Umm.. I dont quite understand.. none of those functions that is giving errors exists in the program, so it should be impossible for it to crash with those errors...

Or do you say that Civ4 crashes with those errors when it tries to load a save from the program? if so, do you have a save?

Or did you simply post the Error message you get from running another util? I see some people has posted similar messages for this util: http://forums.civfanatics.com/showthread.php?t=144414

Premator
Sep 23, 2006, 04:26 PM
http://forums.civfanatics.com/uploads/95950/civ4_saveconverted_crsh.jpg

there you can see the prnt screen, unfortunately it is your app that crash
I use english Civ with Warlord add, no mods
I tried to load save file (any kind vanilla CIV or Civ Warlord) and always the same

pls hels as I only want to change difficulty level..:)

Gyathaar
Sep 23, 2006, 09:06 PM
http://forums.civfanatics.com/uploads/95950/civ4_saveconverted_crsh.jpg

there you can see the prnt screen, unfortunately it is your app that crash
I use english Civ with Warlord add, no mods
I tried to load save file (any kind vanilla CIV or Civ Warlord) and always the same

pls hels as I only want to change difficulty level..:)
That is not my app :)

Premator
Sep 24, 2006, 01:12 PM
ahm, yes, :) sorry for that
unfortunately I also have problems with your app :(
but I do know that it was caused due to very huge Earth mod map

anyway, I think you app is very good due to it simplicity
thanks for prompt answers

OverloadUT
Oct 09, 2006, 04:14 PM
Oh great Gyathaar, I beseech thee!

Our 32 player PTBS game is in need of your tool to convert our PTBS turn timer from nothing to 21 hours. The problem is when I run it, I get an output like this:

D:\pitboss\pitboss_32Warlords\Saves\multi>saveconvert Pitboss_BC-3960.CivWarlordsSave
Saveconvert Version 4.0

Input savefile [Pitboss_BC-3960.CivWarlordsSave]:

D:\pitboss\pitboss_32Warlords\Saves\multi>
As you can see, the program just exits after it (I assume) loads the save file. Is this because the game is running a mod with a modified .dll? Or is the 32 players in the save file messing it up because it only expects 19?

Gyathaar
Oct 09, 2006, 06:00 PM
As you can see, the program just exits after it (I assume) loads the save file. Is this because the game is running a mod with a modified .dll? Or is the 32 players in the save file messing it up because it only expects 19?
Its the 32 players.. the saveconvert program has this hardcoded to 18 player civs because it cant see from the save what this value is...

I have though some about how to get around this, and the easiest is prolly to prompt the user for how many players the save allows.. guess I can do this pretty quick since it isnt that much work.

Gyathaar
Oct 09, 2006, 06:38 PM
Can you see if this version allows you to edit 32 civs save properly?
http://forums.civfanatics.com/uploads/38257/saveconvert_v4.1.zip

OverloadUT
Oct 09, 2006, 06:47 PM
Can you see if this version allows you to edit 32 civs save properly?
http://forums.civfanatics.com/uploads/38257/saveconvert_v4.1.zip

As far as the 32 player thing goes, it worked! However, I found an unrelated bug. Well, it's more like a feature implemented wonky:

If a game has no turn timer, and then you change it to have a turn timer, when you load the game it will be at 0:00:00 and the turn will immediately advance to the next turn. It seems to me like it should start the timer at whatever the timer is instead of 0. Is this an easy fix? :)

Edit: Actually, I have a way to work around it in my game, so don't worry about this fix right away unless you want to. The 32 player thing works and that's good enough for me! Thanks!

Gyathaar
Oct 09, 2006, 07:08 PM
As far as the 32 player thing goes, it worked! However, I found an unrelated bug. Well, it's more like a feature implemented wonky:

If a game has no turn timer, and then you change it to have a turn timer, when you load the game it will be at 0:00:00 and the turn will immediately advance to the next turn. It seems to me like it should start the timer at whatever the timer is instead of 0. Is this an easy fix? :)

Edit: Actually, I have a way to work around it in my game, so don't worry about this fix right away unless you want to. The 32 player thing works and that's good enough for me! Thanks!
Changing that is not trivial.. I believe the countdown on current turn timer is stored in a more protected part of the save.. where I cant just change the value (doing so would prevent the save from loading)

Frisxo
Oct 20, 2006, 01:43 AM
I have a save file from a Warlords pitboss game. I want to change the turn timer from 36 hours (current) to 48 hours. I ran version 4.0 of the tool and everything went smoothly, in the convert tool it says the timer has changed to 48 hours but when I start up pitboss and load the newly changed file pitboss starts its countdown from 36 hours. I've tried the tool several times and every time it looks like the timer has been changed to 48 but when loaded into pitboss the countdown always starts from 36.

Any ideas? Thanks.

Gyathaar
Oct 20, 2006, 02:49 AM
I have a save file from a Warlords pitboss game. I want to change the turn timer from 36 hours (current) to 48 hours. I ran version 4.0 of the tool and everything went smoothly, in the convert tool it says the timer has changed to 48 hours but when I start up pitboss and load the newly changed file pitboss starts its countdown from 36 hours. I've tried the tool several times and every time it looks like the timer has been changed to 48 but when loaded into pitboss the countdown always starts from 36.

Any ideas? Thanks.
I believe it has been mentioned a couple times in the thread already, but the turntimer wont change to the new value untill the next turn starts (this is something that is not possible to get around without cracking the savegame protection, which i havent done)

Frisxo
Oct 20, 2006, 02:45 PM
ahhhhhhhhhh ok. Super, will look for time change next turn.

Thanks for the reply, and the tool!

-Frisxo

Meatbuster
Oct 21, 2006, 08:14 PM
Hi Gyathaar, I wonder if you have any plans to add functionality to edit special settings (Raging Barbs, No Vassal States and Permanent Alliances are something I could think off at the moment that people may want to change).

MaverickAvatar
Nov 02, 2006, 04:25 PM
Actually that is exactly what I need. To make a long story short, trying to play Fall From Heaven 2 mod in Pitboss. We've had lots of problems (it wouldn't allow us to select 6 of the civs, had to hack the pitboss python script to get that in there).

The other problem is it would NOT set 'Simultaneous Turns" or "Take over AI".

I used your SaveConvert and it fixed those problems.. was very happy.

Unfortunatly the original setup seems to have added "One City Challenge" (makes it so you cannot build Settlers).

If SaveConvert would allow edits of the game settings like Permanent Alliances, Raging Barbarians, ... and One City Challenge.. that would solve my problems... Please consider adding that functionality, it would really help.

But thanks for this program.. it really helps out!

Gyathaar
Nov 03, 2006, 04:44 PM
Added support for changing game options

MaverickAvatar
Nov 06, 2006, 07:16 AM
Fabulous! Thanks a lot!

Thuddmonkey
Dec 06, 2006, 10:57 PM
Thanks for writing this, Gyathaar!

Any chance you could release the source code? I'm trying to get it to convert a Fall From Heaven modded game (same effort MaverickAvatar was making a month ago; we wandered off to other things for a while, but are giving this a go again), and having some issues. It'd make troubleshooting much more convenient if I could see the internals.

Gyathaar
Dec 07, 2006, 04:15 AM
Thanks for writing this, Gyathaar!

Any chance you could release the source code? I'm trying to get it to convert a Fall From Heaven modded game (same effort MaverickAvatar was making a month ago; we wandered off to other things for a while, but are giving this a go again), and having some issues. It'd make troubleshooting much more convenient if I could see the internals.
Problem with releasing the source code is that would make it really easy to cheat in multiplayer games...
like with modifications you would convert the saves to single player and see what everyone is doing in worldbuilder or debug mode.

If you PM me the save you have problems with I could possibly make modifications so the program will handle it thou

the oob
Dec 09, 2006, 01:30 AM
Can you use this to change the amount of time left on the timer, rather than the time limit itself?

For instance, in a game with a 24 hour timer, but 9 hours left on the clock, could I reset the time left on the clock to 24 hours?

antibac
Dec 12, 2006, 04:55 PM
I hate to sound like a total newb but how do you install this application? When I open it up all I see is a dos window that I'm supposed to type something into and I don't know what or if I am supposed to.

Jangster
Dec 17, 2006, 12:03 PM
Another noob question... Where do you find the instructions for the program? When I use it it just shuts down after it asks: "what is the maximum number of players this game allows? [18] Whatever I answer to that the program and commandpromt just shuts down.

I'm starting FfH 2 MP game and I'm testing how to change the settings so that we can keep the game going constantly but play intesively once a week.

Thanks for the answers

tyomitch
Dec 31, 2006, 05:42 AM
I did a little search here, but couldn't come up with anything more relevant than this topic. (The one-search-per-minute restriction doesn't help.)

The question is: what is the Civ4SavedGame format?
Is it documented somewhere, or reverse-engineered by Gyathaar?

Gyathaar
Jan 01, 2007, 12:54 AM
Another noob question... Where do you find the instructions for the program? When I use it it just shuts down after it asks: "what is the maximum number of players this game allows? [18] Whatever I answer to that the program and commandpromt just shuts down.

I'm starting FfH 2 MP game and I'm testing how to change the settings so that we can keep the game going constantly but play intesively once a week.

Thanks for the answers
I am guessing that FfH2 adds some extra game options to the save that the program cant easilly detect (like FfH1 also did)
If the program tries to parse the save with wrong number of game options it will crash right after the question for how many players (which looks like it shuts down)

Will see about adding some code so it can make some guesses here for better results.. but wont be for another few days when I return from vacation


I did a little search here, but couldn't come up with anything more relevant than this topic. (The one-search-per-minute restriction doesn't help.)

The question is: what is the Civ4SavedGame format?
Is it documented somewhere, or reverse-engineered by Gyathaar?
Originally it was reverse engineered by mostly GOTM and HOF staff members (and a few others)..
nowadays you can find most of the save game format in the SDK thou...

tyomitch
Jan 01, 2007, 05:36 AM
Originally it was reverse engineered by mostly GOTM and HOF staff members (and a few others)..
nowadays you can find most of the save game format in the SDK thou...
I downloaded the SDK (27 Mb of C++ source files), where should I look for the savefile format reference?

Gyathaar
Jan 01, 2007, 11:03 AM
I downloaded the SDK (27 Mb of C++ source files), where should I look for the savefile format reference?
read and write functions in the various class files... ;)

tyomitch
Jan 01, 2007, 11:51 AM
read and write functions in the various class files... ;)
Obviously I did a search through them before posting here.
Even the string "Civ4SaveGame" doesn't occur anywhere in the sources.
They also refer to abstract methods CvDLLEngineIFaceBase::SaveGame and CvDLLUtilityIFaceBase::SaveGame, which are likely implemented elsewhere.
I'm concluding from here that the savefile handling code is missing from the public sources.
Did I download the right SDK? If yes, where should I really look for the savefile access functions?

HakTom
Feb 15, 2007, 02:54 AM
hi

i have a problem changing the turn timer.
i save the changes, but when i start the game, the turn timer has not changed.
but if i open the previously saved savegame, the convertertool shows mit the correct wanted turn timer.

i attach the savegame;

thanks for your help!

Gyathaar
Feb 15, 2007, 08:27 AM
hi

i have a problem changing the turn timer.
i save the changes, but when i start the game, the turn timer has not changed.
but if i open the previously saved savegame, the convertertool shows mit the correct wanted turn timer.

i attach the savegame;

thanks for your help!
See the answer to the exact same question in posts number 6 and 52..

HakTom
Feb 16, 2007, 08:42 AM
sorry for that ;)
anyway, thank you!

OGRastamon
May 16, 2007, 10:47 AM
Wasn't expecting a DOS program. It wouldn't bother me any if I had any idea to which commands it would respond. A very user-unfriendly interface earns a thumbs down from me.

OverloadUT
May 16, 2007, 11:14 AM
Wasn't expecting a DOS program. It wouldn't bother me any if I had any idea to which commands it would respond. A very user-unfriendly interface earns a thumbs down from me.

Good thing you didn't pay for it. ;)

It's actually quite a nice interface, especially for a shell program.

darrelljs
Aug 02, 2007, 12:43 PM
Is there a plan to update this for BTS? RBTS1 needs it :).

Thanks,
Darrell

Gyathaar
Aug 02, 2007, 05:31 PM
Is there a plan to update this for BTS? RBTS1 needs it :).

Thanks,
Darrell
No plan at the moment... BtS protects the savegame much better, so I cant change most of the values in the savegame without first breaking the savegame protection.

darrelljs
Aug 03, 2007, 08:09 AM
Okay...we found a work around for our problem for now :).

Darrell

Jangster
Sep 25, 2007, 07:56 AM
Does anyone know is there anyway to create a scenario from a pitboss savegame? We started 1936 europe with BtS and ended up noticing in 1939 that no wars will be declared at all, the open play didn't work!

We had 1 hours timer until late 1939 so no major harm done, but we got really excited about the coming war and feel disappointed at not knowing what would have happened to Finland.

I doubt there's a way around this because the obvious cheating element, but it would be nice if I could make a scenario out of the setting and edit wars for all the factions involved and we could see how things end up.

I'd be really happy if someone could inform me if it's possible to do this.

OverloadUT
Nov 10, 2007, 10:23 AM
Is there by any chance any update on the status of this? I started my BtS Pitboss game without a turn timer with plans to turn it on after everyone played their first turn (to give time for connection issues and whatnot) but I didn't realize that this doesn't support BtS! I really don't want to start my game over. :(

dogma00
Nov 11, 2007, 06:49 PM
... if I change the difficulty level of an AI player, what exactly happens?

If I want to make the AI players easier to beat for us puny humans, should I change the AI difficulty level up or down? I mean, if I change an AI player from the Noble level to the Warlord level, does it make the game easier for _us_ or for the AI player?

mabeco
Nov 21, 2007, 07:47 AM
Does anybody know if it is possible to change a player from human to AI in the midle of a BtS 3.13 PBEM game? If yes how?
Thanks.

LowtherCastle
Dec 02, 2007, 01:54 PM
No plan at the moment... BtS protects the savegame much better, so I cant change most of the values in the savegame without first breaking the savegame protection.Does this mean your options for creating the Challenger version in BOTM are severely limited, such as to simple WB changes?

Another question: I want to make 2 saves with exactly the same map and settings, except for difficulty level. If I use your utility to change nothing but difficulty level, do the AIs get the correct starting units, techs, etc.? Or do I have to go into WB and make additional corrections?

Gyathaar
Dec 02, 2007, 02:01 PM
Does this mean your options for creating the Challenger version in BOTM are severely limited, such as to simple WB changes?

Another question: I want to make 2 saves with exactly the same map and settings, except for difficulty level. If I use your utility to change nothing but difficulty level, do the AIs get the correct starting units, techs, etc.? Or do I have to go into WB and make additional corrections?
I havent used this util to set up any of the challenger saves so far... all has been done in the WB (or in some cases by editing the WB save in a text editor)

The starting units are not changed, so that has to be done in the WB

ruff_hi
Jan 02, 2008, 10:38 PM
I have a pbem ice age game that I converted to a hotseat (person I am playing with visited over christmas - however, not I cannot get it back to a PBEM. The saveconvert v4.2 reports it as a PBEM already.

Edit: I ran this tool against the hotseat game and it reported it as a PBEM. I changed it to hotseat, changed it back to PBEM, saved it and loaded the saved game up again. This time, it reported it as PBEM. I sent that to my friend who said it was back to the PBEM format. Not sure what was going on but we fixed it.

Mohatma
Jan 03, 2008, 02:31 AM
I have a problem loading my save: I wrote a new save and tried to load it but the game terminates with a message:
Runtime Error!
Program: (a path to Warlords)
This application has requested Runtime to terminate it in an unusual way. Please contact the application's support team for more more information.
I'm running Warlords 2.08 and saveconvert 4.2

JohnnyBeGood
Feb 28, 2008, 10:00 AM
Is there such a thing, I have the other which won't open BTS saved games.

In a previous post, someone mentioned a "workaround", would you like to share?

Thanks

Kot_Behemot
May 07, 2008, 05:36 AM
Yes I would also really need a version that reads BTS savegames! I need to change my victory conditions because I wanna conquer them all but have domination turned on and it is imposible to acheave conquest victory avoiding domination :)

Mknn
May 27, 2008, 03:43 AM
Is there any way to open up a BTS save file? Any utillity at all? Anyone? Bueller?

The ultimate goal is to convert a single player game to a multiplayer one, in case there is a utility to do that.

Bigben34
May 29, 2008, 11:36 AM
Hi Gyathaar,
I have a need for your utility for BTS. I host epic games online, and have a need to be able to change game speeds/turn timer, as well as add/drop human players and change their difficulty levels to appropriately match the rest.

This would be a big help, perhaps the software engineer who offered to help back in December would be willing to help?

Bigben34

Bigben34
Aug 06, 2008, 10:06 AM
*Bump*

Anyone yet have a lead on a save convert program for BTS? This was an awesomely useful tool for managing ongoing multiplayer games. Without it, flexibility is very difficult to attain.

Bigben34

Hyronymus
Aug 06, 2008, 11:07 AM
Yeah, I figured. But I only play with my sister and she is not so good. (She doesn't even like to play against me.) Then when she is losing, she gives up and we don't get to finish the game. The feature would have been nice to give her some extra troops or something.
Better yet: stop forcing your sister to sooth your Civ addiction ;).

I know Warlords is only recently supported but are you planning on supporting BtS in the near future?

Bigben34
Aug 07, 2008, 05:42 PM
LOL, this comment of his was posted 2 years ago!! That's kind of a slow conversation, eh?

Any programmers out there take pity on us and come up with a saveconvert solution for BTS?

Bigben34

Bratboy
Aug 11, 2008, 10:51 PM
I would love a saveconvert for BTS also...I always used it for warlords .....PLEASE HELP!

LDeska
Oct 03, 2008, 04:12 AM
No one will help us with SaveConvert for BtS :( ?

Paddy the Scot
Oct 03, 2008, 04:15 AM
what do you mean no one will help you?

did you ask for help?

mzichao
Feb 05, 2009, 12:36 PM
I would love a saveconvert for BTS also...I always used it for warlords .....PLEASE HELP!

It's been a while since anybody posted anything on save file editor support for BTS. Did anyone have any update on this? I need to add more civlizations into current BTS save file. Is there a workaround for this? Thank you.

infinitey
Feb 13, 2009, 11:20 AM
I scrounged through the forum to find such a utility and ended here. But no BtS support. Bummer. :(

Luckmann
Sep 25, 2009, 09:57 PM
I scrounged through the forum to find such a utility and ended here. But no BtS support. Bummer. :(
Aye. Even if it doesn't do what I'm really looking for (conversion from multiplayer to singleplayer) it'd be a neat program to try out.

Hopefully someone will pick up on it, sometime. :(

yaolin0
Jan 20, 2010, 12:17 AM
I need SaveConvert for BtS too! I want to convert my saves between hotseat and LAN.

Gyathaar
Apr 09, 2010, 03:39 PM
Since I don't intend to do any more coding on this, and I don't think many play multiplayer in vanilla or warlords any more.. I was wondering if I should post the sourcecode for this program.. perhaps some else will pick it up and make improvements?

PPQ_Purple
Apr 09, 2010, 03:44 PM
What language were you doing it in?
If it's C/C++/C# or Java/J# I would love to give it a try.

I could even try to give it a visual interface.

Gyathaar
Apr 09, 2010, 04:06 PM
the code was written in C..
but was written in very dirty C.. didnt put much work into it.. and very little comments :)

ruff_hi
Apr 09, 2010, 04:13 PM
the other option is that we write something in python and use the civ engine to change game options. That would work with some things but probably not all things. Would this also give us the ability to extra pbem passwords?

PPQ_Purple
Apr 09, 2010, 04:17 PM
Since its in C could you release the source to us?
I would love to see it.

I would transfer it to C# and do some comenting and reworking if I ever get it.

Gyathaar
Apr 09, 2010, 04:37 PM
for BtS you cant change the values in the savegame like this..
you would need to make something in game (in python or similar).. but such a mod would also prevent it being able to load standard savegames with locked assets (like multiplayer games)... so in BtS you would need to write your own savegame loading code from inside the mod... (or alternatively you could crack the BtS savegame protection mechanism)

here is the source code: (it contains some unused code and variables I think.. didnt study it too much :p )

/* Written by Peter Pettersen aka Gyathaar */

#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include <stdlib.h>
#include "md5.h"



void input_maxplayers();

enum GameOptions {
GO_NO_CITY_RAZING,
GO_NO_CITY_FLIPPING_FROM_CULTURE,
GO_CITY_FLIPPING_AFTER_CONQUEST,
GO_NO_BARBARIANS,
GO_RAGING_BARBARIANS,
GO_AGGRESSIVE_AI,
GO_RANDOM_PERSONALITIES,
GO_NO_TECHNOLOGY_TRADING,
GO_PERMANENT_ALLIANCES,
GO_ALWAYS_WAR,
GO_ALWAYS_PEACE,
GO_ONE_CITY_CHALLENGE,
GO_PERMANENT_WAR_OR_PEACE,
GO_DONT_PRESERVE_RANDOM_SEED,
GO_NO_CHEATING,
GO_REQUIRE_COMPLETE_KILLS,
GO_NO_VASSAL_STATES,
GO_NO_TRIBAL_VILLAGES,
GO_COUNT
} ;

int options_meny[GO_COUNT-3] = {\
GO_NO_CITY_RAZING,\
GO_NO_CITY_FLIPPING_FROM_CULTURE,\
GO_CITY_FLIPPING_AFTER_CONQUEST,\
GO_NO_BARBARIANS,\
GO_RAGING_BARBARIANS,\
GO_AGGRESSIVE_AI,\
GO_NO_TECHNOLOGY_TRADING,\
GO_PERMANENT_ALLIANCES,\
GO_ALWAYS_WAR,\
GO_ALWAYS_PEACE,\
GO_ONE_CITY_CHALLENGE,\
GO_PERMANENT_WAR_OR_PEACE,\
GO_DONT_PRESERVE_RANDOM_SEED,\
GO_REQUIRE_COMPLETE_KILLS,\
GO_NO_VASSAL_STATES\
};

char *options_meny_text[GO_COUNT-3] = {\
"No City Razing",\
"No City Flipping from Culture",\
"City Flipping after Conquest",\
"No Barbarians",\
"Raging Barbarians",\
"Aggressive AI",\
"No Technology Trading",\
"Permanent Alliances",\
"Always War",\
"Always Peace",\
"One City Challenge",\
"Permanent War or Peace",\
"Don\'t Preserve Random Seed",\
"Require Complete Kills",\
"No Vassal States"\
};

char *resources[35] = { "aluminium","coal","copper","horse","iron","marble","oil","stone","uranium","banana",\
"clam","corn","cow","crab","deer","fish","pig","rice","sheep","wheat",\
"dye","fur","gems","gold","incense","ivory","silk","silver","spices","sugar",\
"wine","whale","drama","music","movies"};

char *gametypes[16] = {\
"Singleplayer",\
"Singleplayer",\
"Singleplayer",\
"Multiplayer",\
"Multiplayer",\
"Multiplayer",\
"Hotseat",\
"Multiplayer",\
"Play by E-mail",\
"Play by E-mail ?"\
};

char *timers[6] = {\
"Static",\
"Snail",\
"Slow",\
"Medium",\
"Fast",\
"Blazing!!!"\
};

char *diff_str[9] = {\
"Settler",\
"Chieftain",\
"Warlord",\
"Noble",\
"Prince",\
"Monarch",\
"Emperor",\
"Immortal",\
"Deity"\
};


char* victoryoption_str[7] = {\
"Score",\
"Time",\
"Conquest",\
"Domination",\
"Cultural",\
"Space Race",\
"Diplomatic"\
};

char *civs[20] = {"America","Arabia","Aztec","China","Egypt","England","France","Germany","Greece","Inca",\
"India","Japan","Mali","Mongol","Persia","Rome","Russia","Spain","Minor civilization","Barbarian civilization"};

char *wcivs[26] = {"America","Arabia","Aztec","Carthage","Celt","China","Egypt","England","France","Germany","Greece","Inca",\
"India","Japan","Korea","Mali","Mongol","Ottoman","Persia","Rome","Russia","Spain","Viking","Zulu","Minor civilization","Barbarian civilization"};

char **civdesc;
char **leadername;
char **civadj;
char **civpasswd;
char **civemail;

int *civid;

int *convert;
int convert_to = 0;

char outfile[256] = "";


unsigned char *conditions;
int *diffs;
int score_vic;

int human_player = -1;
int humans = 0;
int ver;
int lastturn = -1;
int gamespeed;
int time_played;
int start_turn;
int start_year;
int turn_limit;
int gametype;

int max_players = 18;

unsigned char simul,takeover,timer,anonplayers;

int turnt;
int pbturnt;

md5_state_t state;

unsigned CHUNK;

FILE *fp,*outs,*outf;
unsigned long uncompressed_length;
char *uncompr;

char *full_file;
int fsize;
char *fptr;

char *header;
int hsize;
char *hptr;

char *data;
int dsize;
char *dptr;


char *modified_save;
int modified_length;
char *mptr;


char *victory_conditions;
char *score_victory;
char *difficulties;
char *converts;
char *turntimer;
char *pbturntimer;
char *multi;
char *gametype_ptr;
char *options_ptr;

unsigned have;
int err;
// z_stream d_stream; /* decompression stream */


int current_turn;

char out[4096];


unsigned char read_byte(int d){
unsigned char ret;
if(!d){
ret = fgetc(fp);
*mptr++ = ret;
}
else {
while(d--){
ret = *dptr++;
}
}
return ret;
}


short read_short(int d){
short l;
;
l = (((short) (read_byte(d))));
l |= (((short) (read_byte(d)))) << 8;
return l;
}


long read_long(int d){
long l;

l = (((long) (read_byte(d))));
l |= (((long) (read_byte(d)))) << 8;
l |= (((long) (read_byte(d)))) << 16;
l |= (((long) (read_byte(d)))) << 24;
return l;
}

int read_asciistring(int d){
long i;
long length = read_long(d);

out[0] = '\0';


if(length > 0) {
for(i=0; i<length;i++){
out[i] = (char)read_byte(d);
}
out[i] = '\0';
}
return length;
}

int read_ustring(int d){
long i;
long length = read_long(d);

out[0] = '\0';

if(length > 0) {
for(i=0; i<length;i++){
out[i] = read_byte(d);
read_byte(d);
}
out[i] = '\0';
}
return length;
}



int init(char *filename){

long start, stop, i;
int ret,flen;

if (NULL == (fp = fopen(filename, "rb"))) {
fprintf (stderr, "Failed to open file \"%s\" ...\n",filename);
fsize = 0;

flen = strlen(filename);
strcpy(&filename[flen],".Civ4SavedGame");

fprintf (stderr, "... Trying \"%s\" as filename...\n",filename);
if (NULL == (fp = fopen(filename, "rb"))) {
strcpy(&filename[flen],".CivWarlordsSave");

fprintf (stderr, "... Trying \"%s\" as filename...\n",filename);
if (NULL == (fp = fopen(filename, "rb"))) {
return -1;
}
}
fprintf (stderr, "... Success ...\n\n");
}

fseek (fp, 0L, 2);
modified_length = ftell (fp);
fseek (fp, 0L, 0);

// printf("%d\n",modified_length);

modified_save = malloc(modified_length);
mptr = modified_save;

return 0;
}


int parse_header(){

int i,j;

int mod,ret;
int options;

long stop;
int len;
char modpath[256];
char adminpasswd[33];

int haspassword = 0;

char buffer[40],passwd[256];
char* pos=buffer;
md5_byte_t digest[16];


ver = read_long(0);
mod = read_asciistring(0);
if(mod)
strncpy(modpath,out,mod+1);

// if(out != NULL) printf("%s\n",out);

i = read_asciistring(0);
read_long(0);

if(ver > 100){
i = read_asciistring(0);
// if(i > 0) printf("verstring: %s\n",out);
i=read_asciistring(0);
// if(i > 0) printf("dllcrc: %s\n",out);
i=read_asciistring(0);
// if(i > 0) printf("shadercrc: %s\n",out);
i=read_asciistring(0);
// if(i > 0) printf("pythoncrc: %s\n",out);
i=read_asciistring(0);
// if(i > 0) printf("xmlcrc: %s\n",out);
}
read_long(0);


gametype_ptr = mptr;
gametype = read_long(0);

read_ustring(0);
// if(out != NULL) printf("%s\n",out);

read_ustring(0); // clear text game password

i = read_ustring(0); // admin password

if(i>0){
if(strncmp(out,"d41d8cd98f00b204e9800998ecf8427e",32)){
haspassword = 1;
strncpy(adminpasswd,out,32);
adminpasswd[32] = '\0';
}
}

read_ustring(0);
read_byte(0);

read_long(0);
read_long(0);
read_long(0);
read_long(0);
gamespeed = read_long(0);
turntimer = mptr;
turnt = read_long(0);
read_long(0);


i = read_long(0); //map options
for(j=0;j<i;j++){
read_long(0);
}

if(ver>=200)
read_long(0);

i = read_long(0);

conditions = malloc(i * sizeof(char));

victory_conditions = mptr;
for(j=0;j<i;j++){
conditions[j] = read_byte(0);
}

options = (ver < 102 ? 13 : (ver < 103 ? 15 : 16));

if(ver >= 200){
options = 18;
}

if((ver == 103) && mod && !strncmp(modpath,"Mods\\Fall from Heaven 100\\",26)){
options = 17;
}

options_ptr = mptr;
for(j=0;j<options;j++){
i = read_byte(0);
if((j == GO_NO_CHEATING) && (i == 1)){
printf("Sorry, this program will not convert a save with the locked assets flag set.\n");
return -1;
}
}

if(haspassword){

printf("This save is protected by an admin password...\n");

// printf("md5: %s\n",out);

md5_init(&state);

printf("Input admin password: ");
fgets(passwd,256,stdin);
passwd[strlen(passwd)-1] = '\0';

md5_append(&state, (const md5_byte_t*)passwd, (int)strlen(passwd));

md5_finish ( &state, digest );
for (i = 0; i < 16; i++) {
sprintf(pos,"%02x", digest[i]);
pos += 2;
}

// printf("md5calc: %s\n",buffer);

if(strncmp(adminpasswd,buffer,32)){
printf("Incorrect admin password.. exiting program.\n");
return -1;
}

}

input_maxplayers();

civdesc = malloc((max_players+1) * sizeof(char *));
leadername = malloc((max_players+1) * sizeof(char *));
civadj = malloc((max_players+1) * sizeof(char *));
civpasswd = malloc((max_players+1) * sizeof(char *));
civemail = malloc((max_players+1) * sizeof(char *));

civid = malloc((max_players+1) * sizeof(char *));
convert = malloc((max_players+1) * sizeof(char *));
diffs = malloc((max_players+1) * sizeof(char *));

for(i=0;i<(max_players+1);i++){
civdesc[i] = NULL;
leadername[i] = NULL;
civadj[i] = NULL;
civpasswd[i] = NULL;
civemail[i] = NULL;

civid[i] = -1;
convert[i] = 0;
diffs[i] = 0;
}

multi = mptr;

simul = read_byte(0);
takeover = read_byte(0);

if(ver >= 200){
read_byte(0); //shuffleteams
anonplayers = read_byte(0);
}
timer = read_byte(0);

read_byte(0);

current_turn = read_long(0);

read_long(0);

pbturntimer = mptr;
pbturnt = read_long(0);

score_victory = mptr;
score_vic = read_long(0);
read_long(0);


for(i=0;i<(max_players+1);i++){
len = read_ustring(0);
if(len >0){
leadername[i] = malloc(len+1);
strncpy(leadername[i],out,len+1);
}
}
for(i=0;i<(max_players+1);i++){
len = read_ustring(0);
if(len >0){
civdesc[i] = malloc(len+1);
strncpy(civdesc[i],out,len+1);
}
}
for(i=0;i<(max_players+1);i++){
read_ustring(0);
}
for(i=0;i<(max_players+1);i++){
len = read_ustring(0);
if(len >0){
civadj[i] = malloc(len+1);
strncpy(civadj[i],out,len+1);
}
}
for(i=0;i<(max_players+1);i++){
len = read_ustring(0);
if(len >0){
civpasswd[i] = malloc(len+1);
strncpy(civpasswd[i],out,len+1);
}
}
for(i=0;i<(max_players+1);i++){
len = read_asciistring(0);

if(len >0){
civemail[i] = malloc(len+1);
strncpy(civemail[i],out,len+1);
}
}
for(i=0;i<(max_players+1);i++){
read_asciistring(0); // smtpserver
}
for(i=0;i<(max_players+1);i++){
read_byte(0);
}

for(i=0;i<(max_players+1);i++){
read_ustring(0);
}

for(i=0;i<(max_players+1);i++){
civid[i] = read_long(0);
}
for(i=0;i<(max_players+1);i++){
read_long(0);
}
for(i=0;i<(max_players+1);i++){
read_long(0);
}

difficulties = mptr;
for(i=0;i<(max_players+1);i++){
diffs[i] = read_long(0);
}
for(i=0;i<(max_players+1);i++){
read_long(0);
}
for(i=0;i<(max_players+1);i++){
read_long(0);
}

humans = 0;
converts = mptr;
for(i=0;i<(max_players+1);i++){
j = read_long(0);
if((j == 0) || (j == 3)){
convert[i] = 1;
humans++;
}
else
convert[i] = 0;
}


for(i=0;i<(max_players+1);i++){
j = read_byte(0);
}
if(ver != 100){
for(j=0;j<3;j++){
for(i=0;i<(max_players+1);i++){
read_byte(0);
}
}
}

for(i=0;i<(max_players+1);i++){
read_byte(0);
}
for(i=0;i<(max_players+1);i++){
read_byte(0);
}
read_long(0);

uncompressed_length = read_long(0);




i = read_long(0);


hsize = ftell (fp);

fseek (fp, 0L, 2);
stop = ftell (fp);
fsize = stop - hsize + 1;
fseek (fp, hsize, 0);


full_file = mptr;

for (i = 0 ; ret = fread (full_file+i, 1, 1, fp) ; i+= ret)
;

fclose(fp);

// printf("%d\n",full_file + i - modified_save);


return 0;


}



void convert_type(){
char input;

do {
printf("Convert to: 1=hotseat, 2=pbem, 3=pitboss/network game, 0=leave untouched [0]:");
input = fgetc(stdin);
if(input == '\n') {
convert_to = 0;
break;
}
if(input == '1')
convert_to = 1;
else if(input == '2')
convert_to = 2;
else if(input == '3')
convert_to = 3;
else if(input == '0')
convert_to = 0;
do {
;

} while (fgetc(stdin) != '\n');

} while ((convert_to != 0) && (convert_to != 1) && (convert_to != 2) && (convert_to != 3));

if(convert_to != 0)
*(gametype_ptr) = (convert_to == 1 ? 6 : (convert_to == 2 ? 8 : 3));
else
*(gametype_ptr) = gametype;
}

void out_file(){
if(ver < 200)
printf("Output savefile [%s.Civ4SavedGame]:",(convert_to == 1 ? "hotseat" : (convert_to == 2 ? "pbem" : "output")));
else
printf("Output savefile [%s.CivWarlordsSave]:",(convert_to == 1 ? "hotseat" : (convert_to == 2 ? "pbem" : "output")));

fgets(outfile,256,stdin);
outfile[strlen(outfile)-1] = '\0';

if(strlen(outfile)==0){
if(convert_to == 1){
if(ver < 200)
strcpy(outfile,"hotseat.Civ4SavedGame");
else
strcpy(outfile,"hotseat.CivWarlordsSave");
}
else if(convert_to == 2){
if(ver < 200)
strcpy(outfile,"pbem.Civ4SavedGame");
else
strcpy(outfile,"pbem.CivWarlordsSave");
}
else {
if(ver < 200)
strcpy(outfile,"output.Civ4SavedGame");
else
strcpy(outfile,"output.CivWarlordsSave");
}
}

if(ver < 200 && !strstr(outfile,".Civ4SavedGame")){
strcpy(&outfile[strlen(outfile)],".Civ4SavedGame");
}

if(ver >= 200 && !strstr(outfile,".CivWarlordsSave")){
strcpy(&outfile[strlen(outfile)],".CivWarlordsSave");
}

//printf("%s\n",outfile);
}

void convert_players(){

char *desc;
int default_civ;
int i,id;
char input_civ[256];

no_humans:

do {
for(i=0; i<(max_players+1); i++){
if(civid[i] != -1) {
if(civdesc[i] != NULL){
desc = civdesc[i];
}
else {
if(ver >= 200)
desc = wcivs[civid[i]];
else
desc = civs[civid[i]];
}
if(i<max_players)
printf("%-2d: %s (%s)\n",i,desc,convert[i]?"human":"AI");
else
printf("%-2d: Barbarian civilization\n",i);

}
}

default_civ = -1;

printf("Input civ number to toggle between human and AI player (-1 to input no more civs) [%d]:",default_civ);

fgets(input_civ,256,stdin);

if(input_civ[0] == '\n')
id = default_civ;
else
id = atoi(input_civ);

if((id > max_players) || (id < -1))
printf("Civ number %d is outside the valid range.\n",id);
else if((id != -1) && (civid[id] == -1))
printf("Civ number %d is not in this game.\n",id);
else if(id != -1) {
convert[id] = !convert[id];
printf("Converting civ number %d to %s player\n",id,convert[id]?"human":"AI");
if(convert[id])
humans++;
else
humans--;

}

} while (id != -1 );

if(humans <= 0){
printf("\nThere has to be atleast one human player in the game!!!\n\n");
goto no_humans;
}

for(i=0;i<(max_players+1);i++){
if(convert[i])
*(converts + 4*i) = 0;
else if(civid[i] != -1 )
*(converts + 4*i) = 1;

}
}

void change_victory_conditions(){
int i,id;
char input[256];

do {
if(conditions[0] && (score_vic > 0)){
printf("%-2d: %s victory - enabled (Required score: %d)\n",0,victoryoption_str[0],score_vic);
}
else {
printf("%-2d: %s victory - disabled\n",0,victoryoption_str[0]);
}
for(i=1; i<7; i++){
printf("%-2d: %s victory - %s\n",i,victoryoption_str[i],conditions[i]?"enabled":"disabled");

}

printf("Input victory condition to enable/disable (-1 to exit) [%d]:",-1);

fgets(input,256,stdin);

if(input[0] == '\n')
id = -1;
else
id = atoi(input);

if((id > 6) || (id < -1))
printf("Input is outside validrange outside the valid range.\n",id);
else if(id == 0){
if(conditions[0] && (score_vic > 0)){
conditions[0] = 0;
}
else {
conditions[0] = 1;
printf("Input score victory limit [%d]:",score_vic);

fgets(input,256,stdin);

if(input[0] == '\n')
i = score_vic;
else
i = atoi(input);
score_vic = i;
}
}
else {
conditions[id] = conditions[id]?0:1;
}

} while (id != -1 );


for(i=0; i<7; i++){
*(victory_conditions + i) = conditions[i];
}

*(score_victory + 0) = (char)( score_vic & ( (1<<8) - 1) );
*(score_victory + 1) = (char)( (score_vic & ( (1<<16) - 1) )>>8);
*(score_victory + 2) = (char)( (score_vic & ( (1<<24) - 1) )>>16);
*(score_victory + 3) = (char)( (score_vic & ( (1<<32) - 1) )>>24);
}

void change_difficulties(){
int i,id;
char input[256];
char *desc;

do {
for(i=0; i<(max_players+1); i++){
if(civid[i] != -1) {
if(civdesc[i] != NULL){
desc = civdesc[i];
}
else {
if(ver >= 200)
desc = wcivs[civid[i]];
else
desc = civs[civid[i]];
}
if(i<max_players)
printf("%-2d: %s - %s\n",i,desc,diff_str[diffs[i]]);
else
printf("%-2d: Barbarian civilization - %s\n",i,diff_str[diffs[i]]);

}
}
printf("Input civ you want to change difficulty level for (-1 to exit) [%d]:",-1);

fgets(input,256,stdin);

if(input[0] == '\n')
id = -1;
else
id = atoi(input);

if((id > max_players) || (id < -1))
printf("Civ number %d is outside the valid range.\n",id);
else if((id != -1) && (civid[id] == -1))
printf("Civ number %d is not in this game.\n",id);
else if(id != -1) {
do {

for(i=1; i<10; i++){
printf("%-2d: %s\n",i,diff_str[i-1]);
}
printf("Input desired difficulty level for civ %d [%d]:",id,diffs[id] + 1);

fgets(input,256,stdin);

if(input[0] == '\n')
i = diffs[id] + 1;
else
i = atoi(input);

} while ((i < 1) || (i > 9));
diffs[id] = i - 1;
}

} while (id != -1 );

for(i=0; i<(max_players+1); i++){
*(difficulties + i*4) = (char)( diffs[i] & ( (1<<8) - 1) );
}
}

void change_options(){
int i,id,options;
char input[256];


options = (ver < 102 ? 12 : (ver < 103 ? 13 : 14));

if(ver >= 200){
options = 15;
}

do {
for(i=0; i<options; i++){
printf("%-2d: %s - %s\n",i,options_meny_text[i],*(options_ptr + options_meny[i])?"enabled":"disabled");
}

printf("Input game option to enable/disable (-1 to exit) [%d]:",-1);

fgets(input,256,stdin);

if(input[0] == '\n')
id = -1;
else
id = atoi(input);

if((id >= options) || (id < -1))
printf("Input is outside validrange outside the valid range.\n",id);
else if(id >= 0){
*(options_ptr + options_meny[id]) = *(options_ptr + options_meny[id])?0:1;
}

} while (id != -1 );
}

void input_timer(){
int i;
char input[256];

for(i=0; i<6; i++){
printf("%d: %s%s\n",i,timers[i],i==turnt?" (current value)":"");
}

printf("Input desired turn timer [%d (%s)]:",turnt,timers[turnt]);

fgets(input,256,stdin);

if(input[0] == '\n')
i = turnt;
else
i = atoi(input);

if((i < 0) || (i > 5))
i = turnt;

*(turntimer) = i;
turnt = i;

}

void input_pbtimer(){
int i;
char input[256];

printf("Input desired pitboss turn timer in hours [%d]:",pbturnt);

fgets(input,256,stdin);

if(input[0] == '\n')
i = pbturnt;
else
i = atoi(input);

if(i < 0)
i = pbturnt;

*(pbturntimer + 0) = (char)( i & ( (1<<8) - 1) );
*(pbturntimer + 1) = (char)( (i & ( (1<<16) - 1) )>>8);
*(pbturntimer + 2) = (char)( (i & ( (1<<24) - 1) )>>16);
*(pbturntimer + 3) = (char)( (i & ( (1<<32) - 1) )>>24);

pbturnt = i;

}

void input_maxplayers(){
int i;
char input[256];

printf("What is the max number of players this game allows? [%d]:\n(Leave at default if you have no idea what this is about) ",max_players);

fgets(input,256,stdin);

if(input[0] == '\n')
i = max_players;
else
i = atoi(input);

if((i < 0))
i = max_players;

max_players = i;

}

void menu(){
char input[256];
int menuchoice;

strcpy(outfile,"output.Civ4SavedGame");


do {

printf("\nMenu:\n\n");

printf(" 1: Convert to type (%s%s).\n",(convert_to == 0 ? "unchanged - " :
(convert_to == 1 ? "hotseat" :
(convert_to == 2 ? "play by E-mail" : "pitboss / network multiplayer" ))),
(convert_to == 0 ? (gametype < 9 ? gametypes[gametype] : gametypes[9]): ""));

printf(" 2: Convert between AI <-> Human (Currently %d human players).\n",humans);

printf(" 3: Change difficulty levels.\n");

printf(" 4: Change victory conditions.\n");

printf(" 5: Change game options.\n");

if((convert_to != 1) && (convert_to != 2) && !((convert_to == 0) && ((gametype <= 2) || (gametype == 6) || (gametype >= 8)))){
printf(" 6: Toggle simultaneous turns (%s).\n",simul?"on":"off");

printf(" 7: Toggle take over AI (%s).\n",takeover?"on":"off");

printf(" 8: Toggle turn timers (%s).\n",timer?"on":"off");


if(timer){
printf(" 9: Change multiplayer timer (%s).\n",timers[turnt]);

printf("10: Change Pitboss timer (%d hours).\n",pbturnt);

}
if(ver >= 200){
printf("11: Toggle anonymous play (%s).\n",anonplayers?"on":"off");
}
}

printf("\n-1: Finish and write to output file.\n",outfile);

printf("\nSelect from menu [-1]: ");

fgets(input,256,stdin);

if(input[0] == '\n')
menuchoice = -1;
else
menuchoice = atoi(input);

switch(menuchoice){
case 1: convert_type();
break;
case 2: convert_players();
break;
case 3: change_difficulties();
break;
case 4: change_victory_conditions();
break;
case 5: change_options();
break;
case 6: simul = !simul;
*(multi + 0) = simul;
break;
case 7: takeover = !takeover;
*(multi + 1) = takeover;
break;
case 8: timer = !timer;
if(ver < 200)
*(multi + 2) = timer;
else
*(multi + 4) = timer;
break;
case 9: input_timer();
break;
case 10: input_pbtimer();
break;
case 11:if(ver >= 200) {
anonplayers = !anonplayers;
*(multi + 3) = anonplayers;
}
break;
default:
break;
}

} while (menuchoice != -1);
out_file();
}


void main(int argc, char **argv){

int ret,i,id;

char filename[256] = "";

printf("Saveconvert Version 4.2\n\n");

if(argc > 1){
strncpy(filename,argv[1],strlen(argv[1])+1);
}

printf("Input savefile [%s]:",filename);
fgets(filename,256,stdin);

filename[strlen(filename)-1] = '\0';
if(strlen(filename)==0){
if(argc > 1){
strncpy(filename,argv[1],strlen(argv[1])+1);
}
else {
filename[0] = '\0';
}
}

if(-1 == (ret = init(filename))){
return;
}


if(ret = parse_header()){
return;
}


menu();

if (NULL == (outf = fopen(outfile, "wb"))) {
fprintf (stderr, "Failed to open file \"%s\" for writing.\n",outfile);
return;
}
outs = outf;


fwrite (modified_save, 1, modified_length, outs);
if(outf) fclose(outf);
return;
}

PPQ_Purple
Apr 09, 2010, 05:12 PM
Thank you, will work on it to see what happens.

I can't make out what is what. What functions are responsible for reading the text from the save file? And where does it convert the text to the individual values?

infinitey
Apr 12, 2010, 01:13 PM
It would be truly wonderful if we could finally have a tool to edit BtS save games. I have two pbem games that need to have tech trading disabled, and we are quite far in and cannot restart them.

ruff_hi
Apr 12, 2010, 01:15 PM
It would be truly wonderful if we could finally have a tool to edit BtS save games. I have two pbem games that need to have tech trading disabled, and we are quite far in and cannot restart them.why disabled? Just interested to know.

infinitey
Apr 12, 2010, 03:40 PM
why disabled? Just interested to know.We're new to pbem with normal victory conditions, and one of the games is a free-for-all with AI's and another is a team-FFA with AI's. I'm just worried that the AI's are going to trade technology with each other and make it too complicated for us humans to win. It seems that most players in the pbem forum disable tech trading as well.

ruff_hi
Apr 12, 2010, 07:19 PM
fair enough - AIs in the game can be abused.

infinitey
Apr 12, 2010, 09:08 PM
fair enough - AIs in the game can be abused.Would you happen to know of another way to edit saves or disable tech trading? I asked in another thread about using a hex editor but no one responded. :(

Gyathaar
Apr 13, 2010, 02:38 AM
As far as I remember, if you just hexedit the save in BtS to change this, then the save wont load.. (the savegame checksum checks will fail)
But I may be wrong about just this setting..

infinitey
Apr 13, 2010, 03:25 PM
As far as I remember, if you just hexedit the save in BtS to change this, then the save wont load.. (the savegame checksum checks will fail)
But I may be wrong about just this setting..I see. I guess we'll have to start over again, perhaps with some extra advanced start points. Thanks ruff_hi and Gyathaar.

Peng Qi
Jun 27, 2010, 05:38 PM
I'd love to see this updated for BTS. Didn't even know such a thing existed; could've saved me a lot of headaches. Hope someone who knows what they're doing gets it done. :D

Furiey
Aug 26, 2010, 06:56 PM
A BTS version would certainly be welcome. I have a pitboss game that needs Takeover AI enabling.