Switch to full style
Discussions and questions about the CK and mods for Skyrim
Topic locked

Skyrim save format questions

Wed Nov 23, 2011 5:06 am

So I'm working on a tool to unspend skill points and I've been looking at http://www.uesp.net/wiki/Tes5Mod:Save_File_Format to get started with understanding the save file format. I've noticed some discrepancies in the information I've found there, but don't want to go start editing the wiki without at least verifying some of the things I've found.

The Header Size was said to be a ushort, but I've found that it's actually a uint32. I should note that I'm working with a PC version of the save file, so I'm not sure if there may be a difference between that and the Xbox 360 version which the wiki says it was documented from.


Thanks for the help.

Brian
Last edited by wbrian on Sat Nov 26, 2011 2:42 pm, edited 1 time in total.

Re: Skyrim save format questions

Sat Nov 26, 2011 1:38 pm

Anyone know how to find your created items? I haven't been able to find it like I was in Oblivion...

Re: Skyrim save format questions

Sat Nov 26, 2011 11:18 pm

I have been slowly documenting the Skyrim save format on the wiki from personal research (as I did for Oblivion). If you have any questions about the format I'll answer them to the best of my ability.

@TheNightFather What in particular about created items?

Re: Skyrim save format questions

Sun Nov 27, 2011 12:11 am

There is no difference in the file formats for Xbox360 and PC. Todd Howard has confirmed this himself when he was asked if Skyrim was going to have mod capabilities for consoles. He replied that it's something they'd like to do, and it's something that they could've done a long time ago with Oblivion. In fact, he even said that you could take a mod and stick it right onto your Xbox and it would work the same. The only issue was that Microsoft doesn't want people putting stuff onto their consoles, (essentially a security issue).

Re: Skyrim save format questions

Sun Nov 27, 2011 12:22 am

You're correct about the save file format not being different, but non-save files do have differences between platforms (endian difference).

Re: Skyrim save format questions

Sun Nov 27, 2011 12:26 am

Well I know that what Todd Howard said was that the PC and Xbox360 versions are able to be modded the same way. So that means that enough of the files are the same for it to work.

Re: Skyrim save format questions

Sun Nov 27, 2011 12:31 am

From personal research Skyrim is set up to load data in either endian as long as it can reasonably detect it which platform it was created for.

Re: Skyrim save format questions

Fri Dec 02, 2011 3:02 am

I don't seem to have endian problems. I seem to go wrong after reading the screen shot. The dimensions I get for a PC screen short are 192x64 (which seems a bit odd), and after reading 192x64x3 bytes, I don't see a form version of 57. Anyone else got working code for the PC that can read it following the spec?
(My code is in Java. I'm happy to share if there is interest.)

Re: Skyrim save format questions

Fri Dec 02, 2011 3:24 am

That resolution is odd but on the PC the preview image size is based on the resolution when the save was made.

Please doublecheck your code against the latest version of the Save File Format page.

Re: Skyrim save format questions

Fri Dec 02, 2011 4:28 pm

:oops: Went through a hex dump byte by byte and found a bug in my byte -> int routine. Doh. How embarrassing.
Sorry for the noise. (And many thanks Rick for your work documenting the format!)

Skyrim-Savegame Parser C# implementation

Fri Dec 02, 2011 7:21 pm

Hi guyz,

i wrote a Skyrim-Savegame Parser in C# implementing the file format description provided by Rick, which it like to share.
Btw: Great research job, mate! How did u do that? Are u a matrix operator as professional, who sees blonds and brunettes in binary code rolling over the screen?

My program reads until the misc stats, as they are the point of my interest.
It exports the stats data from multiple savegames into csv or xml. You can watch the stats in the in-game menu, but i was missing them in steam, where only the achievements are listet. But this was not enough for a solid comparison from my savegames to those of my friends. With the exported statsdata i am planning to create a gameplay history, where you can see the evolution of your skyrim avatar - visualized in graphs.

Unfortunately it seems that i am not authorized to post the links to the sourcecode nor can i see how to put an attachment to this post... any advice?

Till then write me a PM if u'd like to get the program or code.

CVS anyone?

Fri Dec 02, 2011 11:54 pm

I've got a CVS server that I'm storing my Java code on that I could open up. Would that work for you? Would it work for anyone else?

Re: Skyrim save format questions

Sat Dec 03, 2011 4:09 pm

@Rick (or anyone really): Do you have a .hsl (hex workshop structure file) or anything similar of the current structure, as it's understood, that you wouldn't mind sharing? I'm just not wanting to "re-create the wheel" if it's not needed.

Re: CVS anyone?

Sun Dec 04, 2011 7:18 am

jjaquinta wrote:I've got a CVS server that I'm storing my Java code on that I could open up. Would that work for you? Would it work for anyone else?


I will upload it there but how do u get the URL to the public when we're not authorized to publish it here?

Re: Skyrim save format questions

Tue Dec 06, 2011 2:50 am

I've got a CVS server that I'm storing my Java code on that I could open up. Would that work for you? Would it work for anyone else?


A publicly accessible CVS-server would be nice (maybe that a Github project would be easier for collaborative efforts, but that assumes Git-familiarity of course...).

Re: Skyrim save format questions

Tue Dec 06, 2011 9:35 pm

github was a great idea, thx mhermans.

i just created an account and uploaded my two projects:

- SkyrimCharacterParser (C#) to parse savegames for character stats

- SkyrimCharacterAnalyzer (Java) to create nice reports

Just search for these projects in github.

Have a look at the sample report i created, on my github-page kewl-deus github com look for /SkyrimCharacterAnalyzer/samplereport/index.html

Re: Skyrim save format questions

Thu Dec 08, 2011 2:07 pm

First of all, thanks for the fantastic resource! I've been having great fun getting a parser working for the Skyrim savegame format. I have however come across a couple of problems, I was wondering you might be able to shed some light on.

My parser successfully extracts the Global Vars (easy bit!), various Global Data structures and the Change Forms data (including uncompressing compressed data), and I've managed to find what I think are the player NPC_ and ACHR structures (based on NPC_.changeFormID=7 and ACHR.changeFormID=14) however getting any useful data from the resulting data within this data is proving to be rather difficult, even when I go on the structures you've kindly provided (http://www.uesp.net/wiki/Tes5Mod:Mod_File_Format/NPC for example).

Within the aformentioned structure (NPC), sub records are mentioned. Can I assume these are instances of Change Form objects - and can I also assume they are identified by their RefID? Just looking for a bit of clarification, that's all.

As a next progress mark, I've been trying to extract the players current X/Y/Z position from their ACHR instance. While I've managed to find the offset in my specific save file, the leading data (as expected) is not the same length between all save files, so to get this data reliably I need to figure out how to parse the leading data structures.

Any pointers you could give me would be greatly appreciated :) If it's too much to ask, don't worry. I've had great fun already getting this far!

p.s. below are a couple of hex dumps of the two data sets I've extracted for the player from the NPC and ACHR Change Form objects

NPC_player.bin: hexpaste dot com/ypvNJ7KW
ACHR_player.bin: hexpaste dot com/z3Pu49KE
Last edited by Seidr on Thu Dec 08, 2011 2:10 pm, edited 1 time in total.

Re: Skyrim save format questions

Thu Dec 08, 2011 2:10 pm

The change flags on a change form indicate what data has changed and how you parse the change data. I've not looked at this data yet and you won't be able to reliably read that data without knowing exactly how to read it.

Re: Skyrim save format questions

Thu Dec 08, 2011 2:12 pm

Ahh ok, that's cool. I did notice a lot of the definitions were missing. If I manage to figure out any of the data I'm looking at, I'll certainly dump it here.

Oh, and thanks for all your hard work :)

Re: Skyrim save format questions

Sun Dec 11, 2011 10:09 pm

I too, started a small project to read/write TES savefiles. It's very basic so far, but I put it up on github anyway. I've used the wiki pages by Rick to read TES4 and TES5 with a couple of python scipts.

git://github.com/bjowi/essedit.git

Re: Skyrim save format questions

Sat Dec 17, 2011 4:00 am

Can someone tell me how vsval types work? http://uesp.net/wiki/Tes5Mod:File_Format_Conventions says the last 2 bits tell you the size of the the value, but how can you look at the last 2 bits if you don't know what the size is? You have to know the size to look at the last 2 bits, but you can't tell the size without looking at the last 2 bits. I must not be understanding it correctly.

Re: Skyrim save format questions

Sat Dec 17, 2011 4:11 am

Read the first byte. Determine size, read the rest of the bytes.

Re: Skyrim save format questions

Sat Dec 17, 2011 4:32 am

It says:

value <= 0x40000000 becomes uint32, (value << 2) | 2

if value is a uint32 then value << 2 | 2 wouldn't that put the 2 in the 4th byte not the 1st?

Re: Skyrim save format questions

Sat Dec 17, 2011 4:55 am

No, it's stored as little-endian.

Re: Skyrim save format questions

Sat Dec 17, 2011 5:16 am

Oh, I hate endians. I never do much coding where I care about endian at all.
So peek the first byte so position in the stream doesn't move, determine the size, then read in the right type. Got it.
Thanks.
Topic locked