1. This forum is archived for reference. For support & bug reports visit the help section of forums.stardewvalley.net

How to fix corrupted save files [Tutorial]

Discussion in 'Support' started by Yusuke Urameshi, Mar 14, 2016.

  1. Yusuke Urameshi

    Yusuke Urameshi Space Kumquat

    ---DO NOT POST BROKEN SAVES HERE TO FIX, MAKE A SEPARATE THREAD FOR THOSE--
    Not all save files can be fixed. If you open it with Notepad++ and all it has is NULL values, it can't be fixed. Instructions on how to go about checking are in the guide.

    Make backups when learning how to do this. I cannot overstate the importance of this, even if you are having no problems with your save file. With that said:

    First you will need to install Notepad++
    https://notepad-plus-plus.org/download/v6.9.html

    and the XML plugin for it

    Within Notepad++, hit Plugins-->Plugin Manager-->Show Plugin Manager-->Check the box "XML plugins" and hit install.

    and Winrar
    http://www.win-rar.com/start.html?&L=0
    How to zip and unzip files using Winrar quick video tutorial:

    A brand new save file, Spring 1, 1st year, maybe two minutes in. (Provided) The name of the character was my friend's idea. .:rofl:
    Preferably (but not required) an earlier working version of your corrupted one.
    If the save file you're trying to recover is quite developed, eg. completed community center, mostly completed museum, etc. You would better off using a similar working save that has also progressed to that point. (Provided, thanks to sorrymyfault)
    Depending on which end of the spectrum you are determines which save file would be easiest for you to adapt into your broken save. Of course it is almost always the most preferable to use an earlier working version of your own save file.

    You will also need to know the location of your save file. Search for “%appdata%” without the quotes on your computer. Then from there go to:
    Roaming-->Stardew Valley-->Saves-->
    The folder with your character's name on it followed by some numbers contains the save file, which has the same name as the folder.

    Right click your save file. Open with Notepad++. You will see a huge mess that is your save file. The XML plugin comes into play here. Within Notepad++, on the top, click:
    Plugins-->XML tools-->Pretty print (XML only – with line breaks)
    Wait a few seconds.
    This will organize the text so it is much easier to manage.
    It should now look something like this:
    [​IMG]
    [​IMG]


    Notice how entries begin and end.
    Examples:
    <name>Ryan</name>
    <completed>false</completed>

    Notice how sections are indented:
    [​IMG]


    When adding or subtracting text, follow suit with the indentations with the use of the tab and backspace keys on your keyboard.

    Notice that you can close off sections by clicking the minus signs on the left:

    [​IMG]


    ^By doing this you can quickly compact your massive save file into just a few lines, allowing you to skip sections you know are okay and complete.

    Now that you know these things.
    I run into three different save file problems.

    1. Let's look at case one:
    http://community.playstarbound.com/threads/save-help.109331/#post-2816101

    Someone altered their save file and screwed up the XML formatting.
    This player wanted to edit his save file, allowing him to purchase the mermaid pendant again after losing it. The instructions from Concerned Ape stated to go within your save file and find: <int>460</int>
    and delete it. To find it yourself, type Ctrl+F and type in “<int>460</int>” without the quotes. CA did not explicitly say this, but you have to delete both instances of <int>460</int>.
    This player did not do this. This player deleted the entire special items section, going from this:
    [​IMG]

    to this:
    [​IMG]


    Which screwed up his save file.
    To repair it, I simply opened my save file and copy pasted the missing section. You can compare files within Notepad++ by right clicking the file's tab on the top and clicking “Move to other view.”

    2. Case two, halfway down, presented by user “Hamburger”
    The save file simply ends abruptly, and doesn't finish:
    http://community.playstarbound.com/threads/i-need-help-please.109613/#post-2821070

    This is the most common issue I find.
    This was his save file:

    [​IMG]


    To fix it, I had to add in data from another save file. Depending on how far along the corrupt save file is, you will want another working save with a similar level of progression to pull data from. (Again, a previous version of your corrupted save is almost always preferable.)
    This is where more work is required and adjustments have to be made to get it back into its original state.
    These are the steps I took to make his save file work again:
    1.
    [​IMG]

    2.
    [​IMG]


    “Vector2” was too common, as was “item”
    The more unique the set of letters/numbers, the easier it is to find a matching section.
    3.
    [​IMG]


    The idea is to end every open section by the time we are done.

    4.
    [​IMG]


    This is why it is beneficial to have a previous working save of your broken file, so that you can revert the save to its original state as closely as possible.

    Test to see if there are any errors by going to Plugins-->XML tools-->Check XML syntax now
    If you get “No error detected” congrats. If not, keep trying using the methods I have discussed. Once again, do not post here with your broken saves. Make another thread for that.

    It is important to note that every case is different. From my experience an incomplete save file is only missing the sections that are towards the last 10-30% of the save file. Some areas to be aware of that are within the last areas of a save file include: (Use Ctrl+F when looking for these in the save file)
    The <GameLocation> data, which is a tier below the location section. Some of these areas can be safely copy pasted from any game, like areas of the town that don't change.
    Other areas, like your farm, the mines, the community center, and the museum are obviously important towards game progression.

    The <specificMonstersKilled> data. Let's say you patch in your completed monster challenge data into someone's save file that hasn't completed those challenges. Gil will now immediately reward the player for every challenge now completed. Do take note that there is currently a bug where if you do not accept the rewards and instead exit the menu then that player will permanently miss out on those rewards.

    <daysplayed> I found that having this number less than five will prevent you from getting to the mines, because in the first five days of the game there is a pile of rocks near the mine entrance. I haven't found another important aspect of the game that this affects, but it is something to keep in mind.

    <bridgefixed> If you see coral under the player's collections, then their bridge on the beach should be fixed and set to true, and vice versa.

    </mine_permanentMineChanges> This section determines what elevators are unlocked in the mines. If you look closely, you will see an entry for an elevator every five levels unlocked. There are also entries in-between which probably represent chests, coal backpacks, and barrels. See picture for some clarification:
    [​IMG]

    In order to maintain mine progress, you must copy paste the unlocked elevator data from another save file.
    1. You can find the lowest that a character has gone by searching "deepest" and the value will be indicated under <deepestMineLevel>.
    2. Go to <mine_permanentMineChanges> in the working save file, copy paste the elevator sections within, up to the latest level unlocked in the corrupted file. Eg. Latest level unlocked in corrupted save is 31. Copy paste elevator data from floors 0-30.
    3. Ensure that the section in the corrupted save begins with <mine_permanentMineChanges>
    and ends with </mine_permanentMineChanges>.
    4. Ensure that <mine_lowestLevelReached> is set to at or below the latest elevator, otherwise your elevators won't work. Eg. I paste in elevator data up to level 10, I set the lowest level reached to 8, now my elevators only work up to level 5.
    You should end up with something like this:
    [​IMG]

    The <museumPieces> section dictates what has already been donated to the museum. If you copy paste data from a completed museum and paste it into a file that previously had nothing in the museum, then Gunther will still have every reward ready for the player to pick up.

    The season, and more importantly the year the character is on. This can be easily modified by typing Ctrl+F and searching for "year" and changing the data appropriately.
    Be aware of these when recovering your save file and the save files of others.
    With that out of the way..

    Loading up Stardew Valley still shows us “No save files found.”
    SaveGameInfo, the file that is always alongside your save file, must be edited in a similar manner.
    Opening Hamburger's SaveFileInfo file reveals this:
    [​IMG]

    A whole lot of NULL – nothing. Useless. We must use our own SaveGameInfo. Copy paste a fresh new working one alongside the save file you finished working on. Start a new game to acquire one. The important step we're trying to get to here is to allow the game to load our save file we worked on.
    After doing this, the save data information within the start menu in-game will not match the data within the save file. Ignore this. Once you save in game, it will create an accurate save info slot.
    Restart the game. Delete the inaccurate profile.
    You should now hopefully have a working save file again, which may require minor adjustments to get the date and time right, along with other things depending on the circumstances.

    3. Case three, who was user "wallaceian01":
    http://community.playstarbound.com/threads/i-need-help-please.109613/#post-2821425
    You open the save file in Notepad++, and you get this:
    [​IMG]

    Nothing but NULLs. Remember how I talked about getting this with the SaveGameInfo file and having to scrap it completely for a new one? This isn't that file. This is the file with your character's name with numbers afterward. This is the majority of your save data. When it looks like this, it cannot be recovered.
    R.I.P. I am sorry for your loss. Next time maybe make a backup periodically?

    This is pretty much all I know so far.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    “But Yusuke,” you say to me, “this is too long, no one is going to read all this.”

    Well haha funny you say that random person. I actually also do not have the time or the patience to fix every corrupted save file. I have a full time job. I cannot be on this site 24/7. I understand that you lost dozens, maybe hundreds of hours of work. Putting this tutorial out there enables people to fix their own save files and to fix other people's save files. I will fix what can but I would prefer to not be the only one fixing these.

    Useful links:
    Save data editor
    http://community.playstarbound.com/...-inventory-editor-thanks-to-midgetman.108255/

    Upload save files and savegameinfo files here and post the link it gives you on the forums in a new thread if you are unable to upload your save file and savegameinfo file normally-- so that me or someone else can fix it.
    http://www.filedropper.com/
    Zip files can be uploaded to the forums without problems. If you can figure out how to use winrar and change the file extension to .zip then you won't need this website.

    Hope this helps. I will update this as I learn more.
     

      Attached Files:

      Last edited: Mar 31, 2016
    • Yusuke Urameshi

      Yusuke Urameshi Space Kumquat

      Updated with XML plugin installation step by step, how to use Winrar zipping and unzipping, and how to enable file extensions depending on your OS.
       
      • Yusuke Urameshi

        Yusuke Urameshi Space Kumquat

        Updated with sections of a save file important towards game progression that have to be patched in more carefully.
         
        • WATERTHOOOOOSSEE

          WATERTHOOOOOSSEE Phantasmal Quasar

          ! C:\Users\Andrei\Downloads\Xml Tools 2.4.8 Unicode.zip: Cannot create C:\Program Files (x86)\Notepad++\plugins\libcurl.dll
          Access is denied.
          ! C:\Users\Andrei\Downloads\Xml Tools 2.4.8 Unicode.zip: Cannot create C:\Program Files (x86)\Notepad++\plugins\libiconv-2.dll
          Access is denied.
          ! C:\Users\Andrei\Downloads\Xml Tools 2.4.8 Unicode.zip: Cannot create C:\Program Files (x86)\Notepad++\plugins\libwinpthread-1.dll
          Access is denied.
          ! C:\Users\Andrei\Downloads\Xml Tools 2.4.8 Unicode.zip: Cannot create C:\Program Files (x86)\Notepad++\plugins\libxml2-2.dll
          Access is denied.
          ! C:\Users\Andrei\Downloads\Xml Tools 2.4.8 Unicode.zip: Cannot create C:\Program Files (x86)\Notepad++\plugins\libxslt-1.dll
          Access is denied.
          ! C:\Users\Andrei\Downloads\Xml Tools 2.4.8 Unicode.zip: Cannot create C:\Program Files (x86)\Notepad++\plugins\zlib1.dll
          Access is denied.

          Please help.my file...its all gone.
           
          • WATERTHOOOOOSSEE

            WATERTHOOOOOSSEE Phantasmal Quasar

            It says that for all the files.
             
            • Yusuke Urameshi

              Yusuke Urameshi Space Kumquat

              Read the first sentence of this thread
               
              • WATERTHOOOOOSSEE

                WATERTHOOOOOSSEE Phantasmal Quasar

                Please define if this save is unfixable,i need it so much...
                 

                  Attached Files:

                • WATERTHOOOOOSSEE

                  WATERTHOOOOOSSEE Phantasmal Quasar

                  if it is,can yous end me your file? i also have a complete community center,heh,wonder why it got corrupted,but ive got a idea,please tell me if its going to work,i have it in a zip file,what if i copy that file into the saves folder?
                   
                  • Yusuke Urameshi

                    Yusuke Urameshi Space Kumquat

                    First off, you put those files in the wrong spot. They don't go in the plugins folder. They go in the Notepad++ folder.
                    Secondly, your save file is fine. I don't know why it isn't working for you. Did you move it out of
                    Roaming-->Stardew Valley-->Saves?
                    because the save file isn't the problem. There is nothing wrong with it.
                     
                    • Wuatt

                      Wuatt Space Hobo

                      Hey, so I'm not trying to be a bother but I followed your instructions for just over two and a half hours but I still couldn't fix my save. I will leave a copy of my save and an error report, whenever you get some free time if you could look it over I would be super appreciative :)

                      I narrowed it down a little. I believe the issue is within savegame line 2 somewhere


                      Error log bellow

                      essage: There is an error in XML document (20809, 65).
                      InnerException: System.InvalidOperationException: There is an error in XML document (20809, 65). ---> System.Xml.XmlException: '', hexadecimal value 0x05, is an invalid character. Line 20809, position 65.
                      at System.Xml.XmlTextReaderImpl.Throw(Exception e)
                      at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
                      at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
                      at System.Xml.XmlTextReaderImpl.ParseText()
                      at System.Xml.XmlTextReaderImpl.ParseElementContent()
                      at System.Xml.XmlTextReaderImpl.Read()
                      at System.Xml.XmlTextReader.Read()
                      at System.Xml.XmlReader.ReadElementString()
                      at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderObject.Read21_Fence(Boolean isNullable, Boolean checkType)
                      at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderObject.Read33_Object(Boolean isNullable, Boolean checkType)
                      at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderObject.Read34_Object()
                      --- End of inner exception stack trace ---
                      at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
                      at StardewValley.SerializableDictionary`2.ReadXml(XmlReader reader)
                      at System.Xml.Serialization.XmlSerializationReader.ReadSerializable(IXmlSerializable serializable, Boolean wrappedAny)
                      at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSaveGame.Read80_Farm(Boolean isNullable, Boolean checkType)
                      at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSaveGame.Read85_GameLocation(Boolean isNullable, Boolean checkType)
                      at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSaveGame.Read127_SaveGame(Boolean isNullable, Boolean checkType)
                      at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSaveGame.Read128_SaveGame()
                      Stack Trace: at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
                      at System.Xml.Serialization.XmlSerializer.Deserialize(Stream stream)
                      at StardewValley.SaveGame.<getLoadEnumerator>d__b.MoveNext()
                      at StardewValley.Game1.UpdateTitleScreen(GameTime time)
                      at StardewValley.Game1.Update(GameTime gameTime)
                      at Microsoft.Xna.Framework.Game.Tick()
                      at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
                      at Microsoft.Xna.Framework.GameHost.OnIdle()
                      at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()
                      at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)
                      at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
                      at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
                      at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
                      at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
                      at System.Windows.Forms.Application.Run(Form mainForm)
                      at Microsoft.Xna.Framework.WindowsGameHost.Run()
                      at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
                      at StardewValley.Program.Main(String[] args)
                       

                        Attached Files:

                      • RushToward

                        RushToward Big Damn Hero

                        The issue is that you deleted 80% of your save file and replaced it with a web URL.
                         
                        • Wuatt

                          Wuatt Space Hobo

                          .... How the f*ck would that have happened?
                           
                          • RushToward

                            RushToward Big Damn Hero

                            Shouldn't I be asking you that? It's not like you gave any context for exactly when your game stopped working. Your save file cuts off halfway through the data for your farm layout.

                            This is why we make backup copies of our precious files before we go tinkering with them, people.
                             
                            • Yusuke Urameshi

                              Yusuke Urameshi Space Kumquat

                              You know, I had one request in the first sentence in bold, big letters, since the very first version of the guide -- to not post broken save files here. Making another thread would still let me see it because I am still active here and it would let other people more easily see responses to that similar problem or even pitch in themselves. *sigh*

                              Your save file is working now, Wuatt.
                              Like RushToward mentioned, a large portion of your data was cut off, all the way up into your farm data. SO...

                              -Your farm is mostly gone. There are a few scraps. I recommend using the inventory editor I linked in the guide to get any unique things back.
                              -I'm assuming you had a barn, because I see a fence with a gate. You will have to rebuild those.
                              -Your home and the chests inside are intact.
                              -Your relationships are intact.
                              -Your community center is back to 100%.
                              -The kill counts of yours for the monsters were replaced with another save file I had. Therefore Gil will immediately reward you with a number of unique items when you talk to him. There is currently a bug where if you exit out of the reward screen, you lose the items forever. So be sure to accept them right then.
                              -Your museum data was replaced with another save file partially done. I gave you the Rusty Key so you can get into the sewers. Gunther will immediately give you any missed reward items if you talk to him.
                              -Your inventory is intact along with any collection data.
                              -I don't know which cave you had so I gave you the mushroom cave.

                              Here you go:
                               

                                Attached Files:

                                Last edited: Mar 31, 2016
                                RushToward likes this.
                              • Yusuke Urameshi

                                Yusuke Urameshi Space Kumquat

                                -Fresh save data Spring 1 Year 1 uploaded
                                -Completed community center save data uploaded thanks to sorrymyfault
                                -File extension section removed (completely unnecessary) thanks to RushToward
                                -How to install XML Plugins updated (now much easier) thanks to RushToward
                                 
                                • Wuatt

                                  Wuatt Space Hobo

                                  I honestly am speechless... all I can say is thank you so much. I won't forget what you did for me :)
                                   
                                    Last edited: Mar 31, 2016
                                  • Yusuke Urameshi

                                    Yusuke Urameshi Space Kumquat

                                    You're welcome! Glad to help! :D

                                    -Added how to maintain bridge repair at the beach
                                    -Corrected information about <specificMonstersKilled>
                                    -Added information on <daysplayed>
                                    -Added information on <museumPieces>
                                    -Added how to maintain mine progress
                                     
                                    • AsianZensation

                                      AsianZensation Void-Bound Voyager

                                      Hey Yusuke,

                                      Love how you know how to edit file types for games but the way you explain isnt very simple to people who dont know what they are doing meaning meh :p but id love if you could help a poor farmer out lol
                                       

                                        Attached Files:

                                      • nobodymac

                                        nobodymac Void-Bound Voyager

                                        Hi Yusuke, if you or anyone else could do this for me I would be really happy because I'm trying but I just cant do this (probably I'm the bad). The save file: http://www.filedropper.com/dgod119632737
                                         
                                        • Yusuke Urameshi

                                          Yusuke Urameshi Space Kumquat


                                          Message: Index was out of range. Must be non-negative and less than the size of the collection.
                                          Parameter name: index
                                          InnerException:
                                          Stack Trace: at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
                                          at StardewValley.Locations.FarmHouse.setWallpaper(Int32 which, Int32 whichRoom, Boolean persist)
                                          at StardewValley.Locations.FarmHouse.setWallpapers()
                                          at StardewValley.Locations.FarmHouse.resetForPlayerEntry()
                                          at StardewValley.SaveGame.loadDataToLocations(List`1 gamelocations)
                                          at StardewValley.SaveGame.<getLoadEnumerator>d__d.MoveNext()
                                          at StardewValley.Game1.UpdateTitleScreen(GameTime time)
                                          at StardewValley.Game1.Update(GameTime gameTime)
                                          at Microsoft.Xna.Framework.Game.Tick()
                                          at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
                                          at Microsoft.Xna.Framework.GameHost.OnIdle()
                                          at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()
                                          at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)
                                          at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
                                          at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
                                          at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
                                          at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
                                          at System.Windows.Forms.Application.Run(Form mainForm)
                                          at Microsoft.Xna.Framework.WindowsGameHost.Run()
                                          at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
                                          at StardewValley.Program.Main(String[] args)

                                          My tutorial does not cover this kind of problem.
                                          Regardless, try picking all the weeds on your farm and see if that helps. If it doesn't work, make another thread, because that is the only solution I know of.
                                          http://steamcommunity.com/app/413150/discussions/1/405692758726683344/
                                           

                                          Share This Page