Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Issue with editing save.dat in Liberal Crime Squad  (Read 8972 times)

Madman_Andre

  • Bay Watcher
    • View Profile
Issue with editing save.dat in Liberal Crime Squad
« on: November 03, 2011, 06:33:04 pm »

Started a thread, couldn't find another thread about the problem.

Basically, it's exactly what it says on the tin. I've been playing LCS for a while now and I was wanting to create an Ubermensch founder to go on a spree of destruction with. The only issue I'm having is that making most changes at all it seems to the save.da seems to cause the game to crash on start-up(By most it seems that if I were to raise one of the base attributes like Heart or Health to 9 it works perfectly, but 10 or higher causes a crash).

I can be more specific if needed, like post snippets of code to show exactly what I'm doing. I'm using Notepad++ to edit it by the way. If it's something simple I'm missing I'll kick myself though.
Logged

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

Madman_Andre

  • Bay Watcher
    • View Profile
Re: Issue with editing save.dat in Liberal Crime Squad
« Reply #2 on: November 03, 2011, 07:37:30 pm »

"You also should know that before every blob of xml in the otherwise binary file are four (I think) bytes counting how many bytes the following blob of xml is. So if you insert or remove characters, eg changing 0 to 20 adds one extra character, rather than just change them you have to change the preceding count as well."

After looking at the save.dat, this is what is bugging me, I can't find any "blobs" of code, at least not anything that looks like a character count. closest to a lofty number would be my total funds.

Is that value stored elsewhere? I can't find it.  :-\
Logged

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: Issue with editing save.dat in Liberal Crime Squad
« Reply #3 on: November 03, 2011, 07:38:56 pm »

What are you opening it with? The common text editors cannot show it I think.
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

Madman_Andre

  • Bay Watcher
    • View Profile
Re: Issue with editing save.dat in Liberal Crime Squad
« Reply #4 on: November 03, 2011, 07:45:42 pm »

Notepad++, same thing I used on the .xml files in the art folder.

Although not that I'm thinking about it I see a lot of  NUL entries in the file, could possibly be the data I need to edit to get this to work.
Logged

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: Issue with editing save.dat in Liberal Crime Squad
« Reply #5 on: November 03, 2011, 08:00:44 pm »

Yeah, I use Notepad++ too so apparently it's not what we need :P. You could always go an easier way and use Artmoney to change the stats.
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

Carlos Gustavos

  • Bay Watcher
    • View Profile
Re: Issue with editing save.dat in Liberal Crime Squad
« Reply #6 on: November 04, 2011, 09:35:17 am »

Right before the <creature> tag are four bytes that, in binary, tell how long the following <creature>...</creature>\r\n xml element (+line break) is. As it's binary, I recommend using a hexeditor. Eg if the element is 8085 bytes the four bytes before it will be (in hexadecimal) 95 1F 00 00 because 0x1F95 = 8085. Notice lowest byte is first.
Logged

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: Issue with editing save.dat in Liberal Crime Squad
« Reply #7 on: November 04, 2011, 10:53:42 am »

Yeah, that's what those NUL are then. I tried a hex editor and they are clearly seen.
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

Madman_Andre

  • Bay Watcher
    • View Profile
Re: Issue with editing save.dat in Liberal Crime Squad
« Reply #8 on: November 04, 2011, 06:49:02 pm »

Right before the <creature> tag are four bytes that, in binary, tell how long the following <creature>...</creature>\r\n xml element (+line break) is. As it's binary, I recommend using a hexeditor. Eg if the element is 8085 bytes the four bytes before it will be (in hexadecimal) 95 1F 00 00 because 0x1F95 = 8085. Notice lowest byte is first.

Thanks, this fixed my issues. Was confused a bit at first but I figured it out. Turns out you can do it all from withing Notepad++ if you know just what to do  ;D
Logged

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: Issue with editing save.dat in Liberal Crime Squad
« Reply #9 on: November 05, 2011, 02:04:13 am »

Can you tell me how to? Some option in Notepad++ to see the hex values? Because I may need it to properly edit my world.dat in DF :).
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

Madman_Andre

  • Bay Watcher
    • View Profile
Re: Issue with editing save.dat in Liberal Crime Squad
« Reply #10 on: November 05, 2011, 04:31:37 pm »

Can you tell me how to? Some option in Notepad++ to see the hex values? Because I may need it to properly edit my world.dat in DF :).

Well, first find the <creature> tag(or tag for whatever stuff you want to edit), highlight the bit of data just before it(for LCS it's one or two random symbos and two NUL symbols), highlight them, then go up into the Plugins dropdown box, cursor over "converter" and it'll have options to change what a selection is displayed as. ASCII -> HEX will change the selection to its Hex value. For example, "#!"(before the NULs) becomes "2321" and vice versa.

Also, another trick to get the exact number of bytes down after your edits is to copy the <creature></creature> tags and everything between them into a blank text document and look at the size in Properties. it's exact in terms of bytes. If NP++ has an option for that I haven't found it yet.
« Last Edit: November 05, 2011, 04:34:07 pm by Madman_Andre »
Logged

Coronel_Niel

  • Bay Watcher
    • View Profile
Re: Issue with editing save.dat in Liberal Crime Squad
« Reply #11 on: November 05, 2011, 04:50:50 pm »

You could edit the SVN source code to change default values or code in a cheat option if you want.

Its rather easy. Theres a ton of presets in "include" I believe. Looking at them might help
Logged