Members Login
Username 
 
Password 
    Remember Me  
Post Info TOPIC: Save File Editor


King Lifthransir

Status: Offline
Posts: 54
Date:
Save File Editor
Permalink   


I'm currently working on a Save File Editor. So far, I'm capable of modifying your Current and Max Strength, Intelligence, Constitution, Dexterity, HP and MP. Due to the fact that I cannot get a working Hex Editor onto MY computer (I have my own computer but it sucks as it only has Win 95....and no internet access), I can't get a complete File Editor. Also, the File Editor will be a Windows Application. (It will be my absolute first Windows Application.)

__________________


King Lifthransir

Status: Offline
Posts: 54
Date:
Permalink   

Don't mean to Double Post but, Out of curiosity, does anyone know the algorithm to finding where the money offset starts? I know there is a program that finds it for you, but I wondering if anyone knows it.

__________________
Maz


Newbie

Status: Offline
Posts: 4
Date:
Permalink   

If you use a program called cheatomatic it can find where the address of the money is held in runtime, another alternative is to check the source...

__________________
./maz


King Lifthransir

Status: Offline
Posts: 54
Date:
Permalink   

I found the program, thanks Maz. However, I was referring on how to find the money offset in the save file. Using the Money Offset program, it tells you where you can find the copper and such in the save file. I need the algorithm for it.

__________________
Maz


Newbie

Status: Offline
Posts: 4
Date:
Permalink   

Well, then check the amount of gold etc in the game, save and see what you can find. Are you a c programmer? Would seeing the source help you greatly? I'm not in possion at this moment but by the end of May I'll have it again.

__________________
./maz


King Lifthransir

Status: Offline
Posts: 54
Date:
Permalink   

Actually, I only know pascal, but I want to learn C and C++, but I can't find a good compiler. I downloaded Quincy 2005, but I haven't gotten it onto my own computer yet. I'm trying to get internet access for my computer, but it'll have to wait a bit.

__________________
Maz


Newbie

Status: Offline
Posts: 4
Date:
Permalink   

Try devc++ with mingw
or aquire Visual Studios :)

__________________
./maz
Anonymous

Date:
Permalink   

If you drop all of your equipped items before saving, the money value will always be in the same place in both Castle of the Winds 1 and 2 saves (0x48D, 4-byte value), and the Difficulty setting is just a few bytes farther along under the same conditions (0x495, 1-byte, 0-easy - 3-experts). I've also found other little bits of things, but I'm really working on making/duplicating items, but it has protection against it that's a bit hard to beat.

I assume 0 to be the starting address when using the hex addresses. Add 1 to the addresses if your editor starts at 1.

__________________


King Lifthransir

Status: Offline
Posts: 54
Date:
Permalink   

Do me a favor, and email me with your current findings, I'd love to help....My email is nova10@hotmail.com (Yeah, I know I shouldn't post it, oh well....I'll live) Make sure the subject has something to do with CotW. Anyways, my Save File Editor is on momentary pause. I'm not extremely familiar with Windows programming, and I'm forced to include a DLL file with the editor if I run it. I know how to read from the file and I could write to it if needed. I spoke a little too soon regarding being able to modify your stats. I'll probably focus on this again.

- nova10

__________________
Anonymous

Date:
Permalink   

I'll do one better than giving it to you by E-mail.


I've used Dave Melanson's UGE module to include all of my additions, and added editors for the Executable files.


You can get them here:
http://www.angelfire.com/nc/ugetab/castle12.html


Item editing is still fairly complex and inconsistent. Some items can have 5 enhancements, and others have only the initial 'none' slot reserved, and there's no way to tell without just understanding the way the save is setup. Data tables abound in this set, but I think they're mostly complete. The lists in this set include: item status variables, item activation variables, item effect variables, spell variables, item class/subclass variables, monster summoning variables, and room # variables, with other micro-lists that some variable states depend on.


Instructions for copying items have been included, but only for people who are seriously intent on turning 1 item into more than 1 item, or 1 pack's contents into any number of that pack's contents.


----


Over the course of writing this message, I thought up another possible reason why I couldn't duplicate items, and having successfully added a Normal Dagger to my arsenal, I'm pretty sure I can now just add stuff to my free hand at a whim. I just need to add a few neat items to automatically add to one's free hand(when they're carrying nothing), and I think I'll be set to release it. I may also make a way to read in a single item, or a pack full of items, and let that item get copied to the free hand once they've removed the item they wanted to copy and saved the game again, or just copy items from any game, to any game.


The possibilities are open for a lot of things to be made to work now. I'll add that program(with the source code) to the page if I ever get it working to my satasfaction. It'll be programmed in VB6, but the routine used is probably easy enough to figure out.


Way long message...


I'll check back again eventually.



__________________


King Lifthransir

Status: Offline
Posts: 54
Date:
Permalink   

Thank you very much. I just merely browsed through the text files, and I definately need to read carefully, otherwise it will just go over my head.

__________________
Anonymous

Date:
Permalink   

Well, after a mere 25-30 hours of computer time, I've got a working version of the program.


http://www.angelfire.com/nc/ugetab/castle12.html


Have fun with it. Improve it if you want, since I included the source code.


I'm beat. Must go hack MK stuff for mame, or sleep. Tough choice.



__________________


King Lifthransir

Status: Offline
Posts: 54
Date:
Permalink   

Incredible..... I congratulate you. However, there is one flaw. The adding items doesn't also add its weight and bulk to your character. Thus removing the items, decreases your current weight and bulk into negative (aka: way above your max). You have to use UGE/Hex Editor to reset your current weight and bulk to 0. But still, congratulations. I am in total awe....

__________________
Anonymous

Date:
Permalink   

I fixed the weight/bulk problem(I think...) for all items. I put together the list of Class-based Bulk/Weight combos (Like for Potions, Scrolls/Spellbooks, Capes, Rings and Boots), and filled in the existing information for Class+Subclass based Bulk/Weight combos (Like for Weapons, Shields, Helmets)


I also added all the defaults for the authentic Helm of Storms, so when you select that as your item, you get it like you picked it out of the ashes of the final battle.


I may do something similar for other items, but I'd probably end up going overboard with the authenticity, something which the program was designed to let you avoid easily.


Get version 1.10 of the source and prog at the same page.



__________________
Anonymous

Date:
Permalink   

I added the ability to add multiple items to a belt in the freehand(which is created for free for you), so you can add up to 254 items to the same file without stopping. You have to start with a new belt if you stop editing the file at any point, but that shouldn't be a problem.


I also debugged all the item types and specialty items, since they had to be written exactly right to have no errors once they are written to the belt.


I think this covers all of the problems now.



__________________
Anonymous

Date:
Permalink   

I tried out the program and it spawns the error: "runtime error 5: Invalid procedure call or argument" when I click "add to freehand"

The options look great, the dynamic stats worked...

__________________
Anonymous

Date:
Permalink   

I'm currently trying my hand at the editing too, and I've received similar results, but now I'm trying something which doesn't work. I'm trying to grab a weapon from one save and put it in another. The problem is I can't figure out which are the significant bytes for a weapon. How many bytes behind the weapon's name are still part of the weapon? I guess I'll try by trial and error, but it would be nice if we would create a thread where we share experiences and write up clear documentation. I read your files and they are very good, but at points a little fuzzy. A little further and I think we'll be able to create save-game editors which are able to edit most stuff in the game... I won't quit CotW before I achieve the free editing of any weapon...

__________________
Gil


King Lifthransir

Status: Offline
Posts: 90
Date:
Permalink   

Above post was mine, I wasn't logged in, so I'll have to double post, sorry for that.

Okay, I've been doing some research, here's what I've got.
First off, I'm trying to find out how one item block works. I found out that the item block runs from one name to the next. So, it's easy to separate a block of info. So, as I found out the first two bytes define which weapon it is. I see you have a list of which weapon is which two bytes in CASTLE.TXT of your uge module.

Next I found out that the name length is defined by the size of the byte in front of it, which allows for name changing in the hex editor.

So my next stop was trying to remove the name of an object and make it unnamed, in that purpose I stumbled onto two bytes though. the 7th and 8th byte, or starting from the first of the two weapon identifiers, 6 to the right and the one after that. Those two bytes are together with the name and the byte in front of it the only ones who change when you add a name to an object. Since I don't know what they do and couldn't figure it out, I left them alone.

Next try was to see what happened when you moved the object into a pack. I did so, saved, looked at the savegame and especially the block of the changed weapon. Apparently, it looks exactly the same when in the pack, except for two bytes, the 7th and the 8th. In other words, what do those two bytes do, as I stumbled upon them twice...

__________________
Anonymous

Date:
Permalink   

If it was a case where it was possible to easily determine how many bytes made up a given item, then someone else would have already made the editor I'm sure.


The problem is that ALL items are subject to a difference of length in bytes.


Belts have 5 bytes extra per slot. Packs that gain items not only add the item's bytes, but add bytes for each items in the pack to part of the pack's bytes, despite the fact that there's an item counter for the pack. All non-pack and non-belt items can have between 1 and 5 effect slots of 10 bytes length each, so I haven't yet figured out a way to determine the length of items with any consistency, other than using known values to add items to an empty equipment menu.


Grabbing a single item from your inventory and putting it into an empty inventory on another save is a much easier matter, but may not be what you want. Single items can be edited, because the start and end of the item are known. Multiple items in the inventory isn't yet possible because the start and end of any given item isn't known, and isn't recorded anywheres in the save, but instead, is calculated with an alghorithm that isn't known to us.


As for the Runtime Error 5, are you running it from the Executable or the Source Code, and if it's source code, what specific version of Visual Basic are you running it on?



__________________
Anonymous

Date:
Permalink   

You should note that CotW uses some semi-random numbers to determine item order, and other unknown things. Item 1 could be 4, Item 2 could be 8. Item 1 could also be 40516, and item 2 could be 40520. As seen in my program, all items share a certain similarity, but the difference in the number of slots is what kills the ability of an item editor.


I've tried to narrow down the possibilities, but the way it tells when an item has ended eludes me.


A sudden inspiration had me look at StatusB in Hexidecimal, and oddly enough, there may be something to it. 17 = 11, 17*5 = 55, 50(an unknown before) translates to 32, on an item with 2 effects. Further investigation is more helpful, as the 16 multiplier is doing nothing, while the 1 multiplier is deciding the item effect slots. Whipptidoodles, I think I may have found it! That's about the only thing missing from my understanding that's any challenge at all to program for.


I'll try to add some code to my prog now.



__________________
Anonymous

Date:
Permalink   

I finished up the Static Stats form, so it now edits more than the UGE module with stricter controls.


If someone wants to understand how items work, they can look at my item decompiling code. It's incomplete as yet, but provides a good basis to build your own additions into the program.


I'll have to add yet another form devoted to existing equipment if I want to edit any of it, but i'll need a lot of time to really get anything at all working, as this promises to be a most complex endeavor, and one which can be avoided by simply custom-building the items.



__________________


King Lifthransir

Status: Offline
Posts: 27
Date:
Permalink   

Is it possible to edit player's position (x and y coordinates)? It could be used in many ways. (at least my cheat could be used after going to the castle) I can't add any item because of the 'runtime error 5' too. Once I suceeded, don't know why. (run from executable)



-- Edited by googl at 22:01, 2005-05-20

__________________
Gil


King Lifthransir

Status: Offline
Posts: 90
Date:
Permalink   

I ran the executable, since I can't compile the source (haven't got VB on this pc). Besides, I'm not a huge VB fan, so I doubt I'd be able to just look at the source for the item code...

I found some small stuff, but nothing useful, let's keep searching...

Oh, btw, I get an error too when I try the other button (add empty belt?). It gives me an overflow error

-- Edited by Gil at 23:15, 2005-05-20

__________________


King Lifthransir

Status: Offline
Posts: 54
Date:
Permalink   

Hmmm, I'm not sure about the error, I still have the old 1.00 version, give me a few minutes and I'll let you know what happens to me with the new version

-- Edited by nova10 at 00:16, 2005-05-21

__________________
Anonymous

Date:
Permalink   

Frikin VB errors...


Without VB installed, and the error persisting, I can't debug the problem remotely. It could be a weird Int/Long/Double issue, or an erroneously places 6 byte string in a 5-byte space. I had to fight with the data routines to get them to fit 1-byte, 2-byte and 4-byte writes. It could also be related to Reference files.


It's an interesting problem, I'd just rather not have to deal with it right now.



__________________
Gil


King Lifthransir

Status: Offline
Posts: 90
Date:
Permalink   

From your castle.txt:

Effect Act. Capable:
This determines if the item can even be activated. Weapons tend to have a default value of 131.

84-Potions/Scrolls, 1 Activation(Better to use rings for more fancy effects)
100-Wands/Staffs, Limited Activation(Makes it a "Charged Object", which can't be named)

131=For status changing attributes, or no attributes.
134=Infinite item activations, including for wands/staffs/potions/scrolls
135?


I found out what 135 is. I noticed that when using 134 you couldn't add status changers at the same time, 135 does just that. I found the attribute on an Axe that can be activated for mana. Just something I noticed...

__________________
Anonymous

Date:
Permalink   

I updated my page with the address to get the latest VB6 runtimes. It's possible that using older versions of the runtime files is why the program won't work correctly.


http://www.angelfire.com/nc/ugetab/castle12.html



__________________
Gil


King Lifthransir

Status: Offline
Posts: 90
Date:
Permalink   

I think I'll create a small page with documentation on the save file structure, particularly items, do you mind if I include your lists of values? I'll give credit of course.


Okay, so far this is what I have for the headers of an item:

byte:

1: Item class
2: Item subclass
3-6: Item price, first byte is 1's, unsigned
7-8: ? I think these belong together
9: activation mode, 131 (83 in hex) standard for weapons
9-10: ? These probably belong together again

After I've done some study on prices I'll try to figure out those four illuster ones, I think they're important for deciding if an item has a name or not (important also for the game to know where an item block ends), where the item is situated (changing position changes 7-8 around I believe, or 9-10) and other things. Maybe one of them holds the total size of the item block, I'll have to check this.

EDIT: Okay, 9 seems to be the byte deciding the item status, I saw you have a list with possible values for this byte. Byte 10 seems to decide how many effects there are, as far as I can tell. Will post another update in a few minutes after I tested some weapons...

EDIT: Okay, I discovered that value 10 holds the number of enhancements, these are the values it takes:

17 (11 hex): 1 enhancement. Rings for example will always have 17
34 (22 hex): 2 enhancements. For example an enchanted club with one effect will have this. Weapons seem to have one invisible effect, which contains their weapon class, must research if this "invisible effect" exists with other items where item class and subclass decides the stats, such as armor
51 (33 hex): 3 enhancements
68 (44 hex): 4 enhancements
85 (55 hex): 5 enhancements (weapon with four effects)

I haven't encountered weapons with more than four effects, but I assume they take 66 hex, 77, 88, etc

My next step was to try and remove an effect of a weapon, but this gave a crash. There are probably some bytes somewhere telling how many bytes the item part of the savefile is big. You can Fix this by adding zeroes after the last weapon depending on how many bytes you removed. If we are to add effects we'll have to find the bytes which decide the size, these are my next goal to find. And again I'm one step closer to fully understanding items. I've got three more bytes plus the size bytes and I'm in full control...

-- Edited by Gil at 17:42, 2005-05-23

__________________
Gil


King Lifthransir

Status: Offline
Posts: 90
Date:
Permalink   

I just wanted to reply to say that installing VB6 runtimes doesn't fix the problem, I still get the error...

Oh, and I'm having a problem. I had a weapon which was resistant to fire, and I changed that into enchanted against dragons. This seems to work just fine, but when I move the weapon to a different slot, I get an error and the game shuts down, weird isn't it?

Oh, and another thing. I'm slowly figuring out some meanings of certain values of the item effect byte. You mention in your list that certain values do nothing. They do, but they aren't used to create effects. Weapons, bracers and gauntlets have "invisible effects", which use these values.

__________________
Anonymous

Date:
Permalink   

Please note: I've already figured out a great deal of the information you're providing, even the 11-55 for item effects (Note: 05, 15, ..., F5 = 5 effects). I'll post a little more detailed info then...


Letters prefixed to the names show the correct write order for the item data.


'Types will significantly reduce the effort it takes
'to avoid internal null-character quirks in VB.
Public Type ItemHeader
AClass As String * 1
BSubclass As String * 1
CCost As String * 4
DUnknownA As String * 2
EItemActivation As String * 1
FStatus As String * 1
GStatusB As String * 2
End Type
'
Public Type EffectSlot
AEffect As String * 1
BEffectActivation As String * 1
CChargesHours As String * 2
DPowerLevel As String * 2
ESummonMons As String * 4
End Type

I have the calculations for Status fields completed.
Identified = 0x01
Enchanted = 0x02
Cursed = 0x04
Is Money = 0x08
Use Fixed Weight = 0x10
Use Fixed Bulk = 0x20
Is a Belt = 0x40
Is a Pack = 0x80


(Is Uncursed = (Enchanted = true & Cursed = true)


Public Type EmptyPack
AClass As String * 1
BSubclass As String * 1
CCost As String * 4
DUnknownA As String * 2
ENull As String * 1
FStatus As String * 1
GUnknownB As String * 2
HWeight As String * 4
IBulk As String * 4
JMaxWeight As String * 4
KMaxBulk As String * 4
LFixedWeight As String * 4
MFixedBulk As String * 4
NItemsInPack As String * 2
OUnknownC As String * 2
PUnknownD As String * 5
End Type


I also have all valid item names and values in an array in Items.bas, which can be viewed with a text editor in this easy-to-use format:


ItemArray(14, 7) = "Boots of Stealth" ...


Item Name = "Boots of Stealth"
Item Class = 14(decimal)
Item Subclass = 7


Item Classes are prefilled with basic information taken from items from in the game. A basic template is used to prefill first, then modifications to that template are added.


I already have code written for all of the above.


The item data variable information is still incomplete as yet, because I haven't taken the time to find values that I haven't programmed settings for, such as a great possibility that one of the unknowns in both Packs and Normal Items that determines whether to look for name length and name text at the end of the item.


I also discovered that the absolute best way to debug if your item is correctly assembled is to stuff it into a belt. When you can insert it into a belt without problem, the item has the correct data length.


As for needing to add null data to reconcile any file loading errors, you need to do this:
Record how much data is added or subtracted from the file length(Storing it as a negative number when removing data is easier, from a programming standpoint)


Read in the following addresses to different temporary number-based variables of the maximum available in that language(For VB, it's a Double)
13, 17, 21, 25, 29, 33(This assumes 1 to be the first offset in the file)


Add the recorded amount to all of the temporary addresses(If it was a negative, it will subtract from the amount), then store those values to the same addresses they came from.


I use the address at 13(+ 1 to account for VB's first address in a file), Plus or Minus a few bytes to edit every one of the Dynamic variables. Each of those addresses certainly represent something, but I don't plan to make a level-saved-to-disk editor using this info. Someone else can try that trick.


Don't bash your brains in trying to figure out how this stuff works. I'm already in the process of slowly refining my information from tests.



__________________
1 2  >  Last»  | Page of 2  sorted by
 
Quick Reply

Please log in to post quick replies.

Tweet this page Post to Digg Post to Del.icio.us


Create your own FREE Forum
Report Abuse
Powered by ActiveBoard