Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Dark Dreams of Furiae - a new module for NWN:EE! Buy now
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Savegame Actor -> CRE Matching

BubbBubb Member Posts: 823
Hello everyone! For the past few months or so, I've made it a hobby to gain a greater understanding of the Infinity Engine file structures. I have a pretty good understanding of the structures now, and I have even created a program that can edit some of these structures. Sidenote: This program is in no way trying to be Near Infinity or the like, it's just a tool to help me learn.

I was working on the interesting problem of updating a savegame; updating it as to make it match a modification that had been installed after its creation. I've hit a bit of a snag though, in regards to how the actors are stored. I've been looking at the IESDP, and the way an actor stores its reference to the CRE file that made it seems quite.. weird to say the least.

To paraphrase, it stores the first letter of the CRE file at an offset of 0x002e, and yet it stores the rest of the filename at an offset of 0x0080. My problem is that this "first letter" field gets overriden with a "*", seemingly when the actor first gets loaded. I believe this makes it impossible to track down the exact CRE file this actor represents, and this is the problem I am facing.

Now, this doesn't matter if every CRE file has a completely unique post first-character name, but I have found this to not be the case. In Planescape, for example, there are the files LENNY.CRE and NENNY.CRE. These two files look exactly the same in the save, because of the way they are stored. (*ENNY is what the save sees for both of these actors)

I was wondering if anyone had any insights into this dilemma, or if it simply impossible to do what I am attempting. Thanks for your time, and any help you might give!

Comments

  • ArdanisArdanis Member Posts: 1,736
    You should be able to restore the original name by concatenating the first letter at 0x2e and the rest from 0x81, skipping the asterisk at 0x80.

    Btw there's WeiDU command EDIT_SAV_FILE that gives relatively easy access to stored structures.

    Bubb
  • BubbBubb Member Posts: 823
    Ardanis said:

    You should be able to restore the original name by concatenating the first letter at 0x2e and the rest from 0x81, skipping the asterisk at 0x80.


    Hmm, I wish that was the case, but my testing does not align with what you say. I was a little unclear in my description; it is the first letter at 0x2e that gets overridden with the asterisk.

    Say, for example, an actor's CRE was "NENNY". The single byte at offset 0x2e represents the first letter: "N".
    The eight bytes at offset 0x80 represent all the characters *after* the first: "ENNY(null x4)". When the game overrides 0x2e, it seems any reference to the first letter is eradicated. Even Near Infinity only sees this asterisk when looking at the save, so it might be as I fear.

    I am puzzled *why* the game overrides this value, as I don't see any reason for it to do so. Maybe it signifies that the actor has spawned / diverged from its template?
    Ardanis said:


    Btw there's WeiDU command EDIT_SAV_FILE that gives relatively easy access to stored structures.


    I did not know WeiDU had that functionality. I looked and looked for it when I was first checking this out, but somehow I missed it! Thank you for pointing that out. I'm very new at WeiDU, so I can't check what it sees right now; but I'll definitely look into it. Again, thanks for all your help.

Sign In or Register to comment.