Cave Story Python save converter

Jul 9, 2009 at 3:22 AM
Neophyte Member
"Fresh from the Bakery"
Join Date: Jun 30, 2009
Location:
Posts: 2
Hey, thats a good suggestion. It looks like I am running an older version of Python. Luckily I can update and I'll get back to you on if that fixes it.

Thanks for the help!

Strtpls3
 
Jul 9, 2009 at 2:50 PM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
Keep in mind that you can currently only convert on a Mac. Just in case you didn't read the Readme. :p


So it's the Mac that needs a Python upgrade, I presume.
 
Nov 7, 2009 at 8:16 AM
Novice Member
"Officially Worth 1 Rupee"
Join Date: Nov 7, 2009
Location:
Posts: 1
I registered just to ask (because for once, Google has failed me) why I can't get your script to work:

Which operation would you like to perform?
E - Extract a save from a Macintosh property list and save it to a file.
S - Store a save in a Macintosh property list, overwriting the existing one.
X - Edit a save file.
Q - Quit the program.
e
Enter the filename to extract the profile to:
Or type Q to cancel.
default.d
[('extract-mac-profile', '/Users/vflux/Library/Preferences/com.nakiwo.Doukutsu.plist', '.pycs_temp'), ('convert-profile', '.pycs_temp', 'default.d'), ('clean-temp-file', '.pycs_temp'), ('interactive',)]
Traceback (most recent call last):
File "cavesaveconv.py", line 188, in <module>
main()
File "cavesaveconv.py", line 23, in main
functions[curTask[0]](*curTask[1:])
File "/Users/vflux/Desktop/cavesaveconv2/csc_convert.py", line 10, in extract
prefs = plist.readPlistFromString(prefs)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plistlib.py", line 103, in readPlistFromString
return readPlist(StringIO(data))
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plistlib.py", line 78, in readPlist
rootObject = p.parse(pathOrFile)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plistlib.py", line 406, in parse
parser.ParseFile(fileobj)
xml.parsers.expat.ExpatError: no element found: line 1, column 0

I updated Python to the latest version, but that didn't work.

Any ideas?
 
Jan 2, 2010 at 1:28 PM
Banned
"Master using it, and you can have this!"
Join Date: Jan 2, 2010
Location: Behind you, holding a gun, aimed at your head. *bo
Posts: 88
hey celtic minstrel, i m big fan. i can say i am pretty advanced in cavestory, but i have a save file i want to convert in mac save file, so, can yoou type out what you have to insert exactly in terminal? i already know how to activate it, cuz i work much more with terminal, just place all files in the home folder... but that isn't the subject, just i want 2 know how 2 convert a profile.dat into com.nakiwo.doukutsu.plist file. what do i have to type???:)
u already wuz a big help 4 me so already thnx...
 
Jan 2, 2010 at 1:52 PM
Banned
"Master using it, and you can have this!"
Join Date: Jan 2, 2010
Location: Behind you, holding a gun, aimed at your head. *bo
Posts: 88
i forgotten 2 say: i also want to add the lvl 3 machinegun, the blade lvl3, lvl 1 nemesis and spur lvl max. if i need to add sum other details i want bout the weapons, just tell me... but as you maybe will know... can you also write down how to insert this weapons? Thnx already...
 
Jan 5, 2010 at 7:37 PM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
vflux said:
I registered just to ask (because for once, Google has failed me) why I can't get your script to work:
Eep, I forgot to comment the debug code.

Anyway... I'm not quite sure what your problem could be. Unless... had you run Cave Story before trying to do this? That could cause a problem... or if you haven't saved a game yet. Apart from that, I dunno... if this isn't the problem, I'll look into it at some point.

Merlinoboy said:
hey celtic minstrel, i m big fan. i can say i am pretty advanced in cavestory, but i have a save file i want to convert in mac save file, so, can yoou type out what you have to insert exactly in terminal? i already know how to activate it, cuz i work much more with terminal, just place all files in the home folder... but that isn't the subject, just i want 2 know how 2 convert a profile.dat into com.nakiwo.doukutsu.plist file. what do i have to type???

I'm pretty sure your question is answered in the readme. Just cd into the folder containing the program (that means typing "cd" in the terminal followed by a space, then dragging the folder into the terminal window, then pressing return), and then type "./cavesaveconv.py" and press return. (If that doesn't work, you could try "python cavesaveconv.py" instead.)

Once there, you choose what you want to do; "E" saves your current save into a file (converting it to a Windows save in the process), while "S" converts a Windows save to Mac and stores it where Cave Story will find it.

Merlinoboy said:
i forgotten 2 say: i also want to add the lvl 3 machinegun, the blade lvl3, lvl 1 nemesis and spur lvl max. if i need to add sum other details i want bout the weapons, just tell me... but as you maybe will know... can you also write down how to insert this weapons? Thnx already...
For this, you would need to choose "X" in the menu, but I can't remember if I implemented it yet.

EDIT: I just checked, and it is implemented; however, you need to know the number of the weapon you're adding. Each weapon has its own number. There's a list somewhere of which weapon is which number, but I'm not quite sure where it is.



...I really need to get back to this and make it more user-friendly.
 
Jan 6, 2010 at 2:27 PM
Banned
"Master using it, and you can have this!"
Join Date: Jan 2, 2010
Location: Behind you, holding a gun, aimed at your head. *bo
Posts: 88
thnx, i now know how 2 change save files from .dat 2 .nakiwo.doukutsu.plist, and i am very happy:D. u r the best. and already thnx 4 the weaponadd part. hope u later have the change 2 find out what you precisely have 2 type 4 the weapons, cuz that should really help, but already thnx and u rule. bye
 
Jan 9, 2010 at 3:35 AM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
I have several format questions, if anyone knowledgeable is listening watching.

  1. What is the format of the Equipped Items section (offset 0x2C-0x2F)? Is it a bit field? (I did find a cavestory-profile.txt that tries to explain this, but it's not clear enough.) The best way to explain this to me would probably be to tell me the full 4-byte value (in hex) for every possibility in which exactly one item is equipped.
  2. Also, is it possible to have an item equipped that you do not possess, and if so does it have any odd effects? Should it be allowed with this editor? Are the equip slots even each associated with a specific item, or are they independent of the items?
  3. Are the flags stored as a bit field? The cavestory-flags.txt file I have suggests that they are, but I'm not quite sure how to interpret it. (It's by "kapow".)
  4. Are skip flags stored in the save file? If so, where?
  5. Weapon level depends directly on weapon energy, right? What is the weapon energy needed for each level on each weapon?
  6. What happens if you set the Spur to have weapon energy greater than 0? Does it reset immediately, or last for one shot?

I think that's all my questions for now...

I do also have one request though. Could someone on Windows try using the command-line argument "-x star=1 -" on a save-game where the whimsical star is not active, and tell me what happens? Because I have a sneaking suspicion that the advanced edits, as currently coded, will only work on Mac. (This should give you one star only, not two or three.)

For the record, this means you would type the following at the command-line after cd-ing into the proper directory:
Code:
python cavesaveconv.py -edit profile.dat -x star=1 -
But replace "profile.dat" with the name of the save you're working on.
 
Jan 9, 2010 at 3:46 AM
Cold Agony of Resolute Vacuum
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jan 1, 2008
Location: Elsewhere
Posts: 1973
Celtic Minstrel said:
  1. Also, is it possible to have an item equipped that you do not possess, and if so does it have any odd effects? Should it be allowed with this editor? Are the equip slots even each associated with a specific item, or are they independent of the items?
  2. Are skip flags stored in the save file? If so, where?
  3. Weapon level depends directly on weapon energy, right? What is the weapon energy needed for each level on each weapon?
  4. What happens if you set the Spur to have weapon energy greater than 0? Does it reset immediately, or last for one shot?

1.) Yes. Equip flags are independant of items.
2.) No, skip flags aren't stored anywhere. They reset when the game is exited (RAM-based, I think is the term). To manipulate skipflags you'd have to do some TSC edits or some major EXE haxx.
3.) Open Cave Story up in CS (if possible) and check under the edit weapons thing.
4.) Why not just experiment? :S
 
Jan 9, 2010 at 3:50 AM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
DragonBoots said:
3.) Open Cave Story up in CS (if possible) and check under the edit weapons thing.
...CS? Do you mean CaveEditor? I could do that, but I'd have to go down two flights of stairs and turn on the computer; while I might do it sometime, it's easier to let people who use Windows anyway answer the question.

Also, I might have seen the answer somewhere on this forum.

DragonBoots said:
4.) Why not just experiment? :S
See above.
 
Jan 9, 2010 at 3:56 AM
Cold Agony of Resolute Vacuum
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jan 1, 2008
Location: Elsewhere
Posts: 1973
Celtic Minstrel said:
Also, I might have seen the answer somewhere on this forum.

Snake
1 > 2: 30
2 > 3: 40
3 > MAX: 16

Polar Star
1 > 2: 10
2 > 3: 20
3 > MAX: 10

Fireball
1 > 2: 10
2 > 3: 20
3 > MAX: 20

Machinegun
1 > 2: 30
2 > 3: 40
3 > MAX: 10

Missiles
1 > 2: 10
2 > 3: 20
3 > MAX: 10

Bubbler
1 > 2: 10
2 > 3: 20
3 > MAX: 5

Blade
1 > 2: 30
2 > 3: 60
3 > MAX: 0

Super Missiles
1 > 2: 30
2 > 3: 60
3 > MAX: 10

Nemesis (As if you didn't know :D)
1 > 2: 1
2 > 3: 1
3 > MAX: 1

Spur (Relates to charge time)
1 > 2: 40
2 > 3: 60
3 > MAX: 200

Regardless of if I get this done, I think I might have an answer for point 4.

It's just a hunch, but I did a little poking around with a save editor and set the Spur to level 3 Max... IIRC it discharged immediately once the game loaded unless I held down shoot.
 
Jan 10, 2010 at 11:35 PM
Novice Member
"Officially Worth 1 Rupee"
Join Date: Jan 10, 2010
Location:
Posts: 1
Hi I had to register to ask a few questions.
I have a mac and i downloaded the python. so i opened up terminal and cd'ed into the cavesaveconv folder which is on my desktop. so now what when i run it I click x to edit save but then what do i type in? i tried moving the .plist file from the library into that folder and typin in that but it says that i cant add anymore weapons and when i try to delete one it says it isnt found.

I have the Spur and i would like to get the Snake and the Machinegun all at the same time. is that possible with this?
 
Jan 11, 2010 at 1:37 AM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
fl4r3 said:
so now what when i run it I click x to edit save but then what do i type in?
Before you can edit, you need to extract. After editing, you need to store.

fl4r3 said:
I have the Spur and i would like to get the Snake and the Machinegun all at the same time. is that possible with this?
Yes. I'd give you a line that will do it, but there will be a new release soonish; stuff has changed, and I can't remember the old way to do it.

Celtic Minstrel said:
Are the flags stored as a bit field? The cavestory-flags.txt file I have suggests that they are, but I'm not quite sure how to interpret it. (It's by "kapow".)
Anyone know how to interpret the file? (The file is actually linked earlier in this thread by Andwhyisit, if anyone doesn't know what I'm talking about.)

Incidentally, the format of the equip flags is no longer an issue. I do have another question though. Where are map flags stored? Has anyone ever looked into this?

Celtic Minstrel said:
I do also have one request though. Could someone on Windows try using the command-line argument "-x star=1 -" on a save-game where the whimsical star is not active, and tell me what happens? Because I have a sneaking suspicion that the advanced edits, as currently coded, will only work on Mac. (This should give you one star only, not two or three.)

For the record, this means you would type the following at the command-line after cd-ing into the proper directory:
Code:
python cavesaveconv.py -edit profile.dat -x star=1 -
But replace "profile.dat" with the name of the save you're working on.
 
Jan 13, 2010 at 2:57 AM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
And now, a new version! I'd be delighted if lots of people would play around with this and notify me of any problems.

You can now edit every part of the save file except for the flags, and the interactive interface supports all the same operations as the command-line interface. Moreover, the clunkiness of having to double-specify the filename if you want to first edit then store is gone (this was a command-line thing).

Extract and store are still unavailable through the interactive interface on Windows; this is because I'm 99% sure they won't work. They're accessible through the command-line interface, but you'll probably get an error message.

Speaking of error messages, any unexpected error message will be written to an error.log file. This keeps them from cluttering up the screen while still making them available (though I haven't quite worked out how to do it properly yet).

And weapons can now be specified by name rather than by number.

Get it here.
 
Feb 13, 2010 at 12:28 AM
Novice Member
"Officially Worth 1 Rupee"
Join Date: Feb 13, 2010
Location:
Posts: 1
First of all, thanks so much for putting this together. Looking at the python files, you must have put quite a bit of time into this.

It seems that my file is not actually being replaced, when I try to "store" it. The Cave Story save file is, as I'm sure you know, /Users/Seth/Library/Preferences/com.nakiwo.Doukutsu.plist. The file I'm trying to convert is /Users/Seth/Desktop/profile.dat. So, when I launch your nifty program through the Terminal, I hit "s" for Store, and then it asks me the filename of the profile to store, and so I type in "/users/seth/desktop/profile.dat". It says it's converted and all, but when I launch Cave Story again and hit load, it loads my old profile. Any idea why?

I am sub-proficient in Python... I'm still learning. So I went through your csc_convert.py and cavestoryconv.py files, and of everything that I understood, I didn't find any problems.

Anyway, thanks a lot for doing this all. I respect those who give back to their communities. :)
 
Feb 17, 2010 at 4:22 PM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
Hm. I'm actually not sure why this doesn't work for you. You do need to make sure that Cave Story is not running when you do this, otherwise the prefs file will be overwritten again when it closes, but it sounds like it wasn't running.

The only think I can think of to suggest is moving profile.dat into the same folder as cavesaveconv.py and typing in just "profile.dat" when it asks for the filename of the profile.

You could also try using the command-line arguments version, which allows you to explicitly specify the plist.

Still, I doubt either those would fix your problem. If they do, there's something wrong; doing as I suggest should be equivalent to what you were doing originally.

I suppose there could be a permissions problem. If this were the case, an exception would have been thrown and you wouldn't see the message "--> Profile from <filename> has been stored".

If you can think of any more information that might help me determine why it doesn't work, tell me!
 
Feb 23, 2010 at 3:33 PM
Banned
"Master using it, and you can have this!"
Join Date: Jan 2, 2010
Location: Behind you, holding a gun, aimed at your head. *bo
Posts: 88
hi again.

you know,
a time ago i went to friends that had windows and downloaded an cavestorydeluxepocket for windows.
i simply loved it to edit the text everything/everyone said.
could you try to work on an update to edit text that appears if you talk to something/one? i really beg ya, cuz i don't have windows and i really wanna do it again...

merlinoboy
 
Feb 23, 2010 at 8:58 PM
Been here way too long...
"Big Joe Tire and Battery Restaurant! Opening Soon! Eat at Big Joes!"
Join Date: Sep 16, 2009
Location:
Posts: 519
You're going to have to do it yourself. There isn't a editor for the mac, but Celtic knows how to do it.
 
Mar 5, 2010 at 2:34 AM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
Merlinoboy said:
a time ago i went to friends that had windows and downloaded an cavestorydeluxepocket for windows.
i simply loved it to edit the text everything/everyone said.
could you try to work on an update to edit text that appears if you talk to something/one? i really beg ya, cuz i don't have windows and i really wanna do it again...
Um, this is a save editor, not a game editor. If you really want to edit text, I can give you a program that will allow you to decrypt the tsc files, edit them in a text editor, and re-encrypt them. I don't intend to release it anytime soon (it's going to be released someday as part of a suite of game editors), but if you want it, PM me. And be patient; I check this forum infrequently, so I may take a week or so to reply.


Incidentally, this would let you edit a whole lot more than just text.
 
Mar 25, 2010 at 1:05 AM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
I was wondering if it would be possible for one to take a completed mod and convert it to something mac-friendly? Would it be a lot of work? How was Cave Story ported to the mac?
Kinda not really on topic but I didn't want to make a whole new thread and stuff so this seemed like the best place to put it.
 
Top