Jump to content

[1.10.0] S.A.V.E - automatic backup system - 1.10.0-3173


Nereid

Recommended Posts

On 11/9/2018 at 1:30 PM, linuxgurugamer said:

@Nereid

Thanks for the 1.5 version, but did you look at the PR I submitted?

No.  I just forgot about that.

I have merged your pull request, but I do not update the master anymore. Because of my workflow the master did cause more confusion than any good so I just keep track of the branches. And I do not merge back any changes into the master anymore. So merging your PR into 1.5.x is a little complicated now (I will have to examine all changes and merge them manually)...

I prefer to use just branches for releases, no master at all and I just ignore all "best practise advises" in this case (ist more or less just because FF but I do it for all mods). 

Link to comment
Share on other sites

27 minutes ago, linuxgurugamer said:

Oh ok.  So in the future, I'll have to use the correct branch.

Thanks

I have merged your changes into 1.5.x. The position of the gui is working, but not the exclude list. Its pushed to the 1.5.x branch. Maybe you can check what is wrong? 

I will stop working on code for today and... well... for the rest of the year. ;)

 

Link to comment
Share on other sites

Just now, Nereid said:

I have merged your changes into 1.5.x. The position of the gui is working, but not the exclude list. Its pushed to the 1.5.x branch. Maybe you can check what is wrong? 

I will stop working on code for today and... well... for the rest of the year. ;)

 

Sure, I'll look at it tomorrow night during my coding stream.  Feel free to watch, would be a kick having you watch.  I stream 7pm US eastern

Link to comment
Share on other sites

3 minutes ago, linuxgurugamer said:

Sure, I'll look at it tomorrow night during my coding stream.  Feel free to watch, would be a kick having you watch.  I stream 7pm US eastern

This is 01:00 CET. My girlfriend would kill me for sure... ;)

Link to comment
Share on other sites

3 hours ago, Nereid said:

I have merged your changes into 1.5.x. The position of the gui is working, but not the exclude list. Its pushed to the 1.5.x branch. Maybe you can check what is wrong? 

I will stop working on code for today and... well... for the rest of the year. ;)

 

I've pushed some changes back to your 1.5.x branch.

I didn't see anything wrong with the exclude code, is it possible you didn't have the file there?

Also, I found a small problem with the floating window, had to set one var to false and add a DragWindow().

As of now, it's working for me, I'll be putting it into my games this evening as a test

Link to comment
Share on other sites

7 minutes ago, linuxgurugamer said:

I've pushed some changes back to your 1.5.x branch.

I didn't see anything wrong with the exclude code, is it possible you didn't have the file there?

Also, I found a small problem with the floating window, had to set one var to false and add a DragWindow().

As of now, it's working for me, I'll be putting it into my games this evening as a test

Strange. I will take a look into it next year. The file in PluginData is there and it doesn't work for me. I've also tried your mod "KaptainsLog" and all of its contents were copied in the backup. Maybe I've done something wrong.

Anyway. I will release a new version next year with all changes included an a button to save config changes.

And an idea: What about a marker file ".nobackup" in a subfolder? That would be much easier to implement and any mod creator could adapt easily.

Link to comment
Share on other sites

5 minutes ago, Nereid said:

Strange. I will take a look into it next year. The file in PluginData is there and it doesn't work for me. I've also tried your mod "KaptainsLog" and all of its contents were copied in the backup. Maybe I've done something wrong.

Anyway. I will release a new version next year with all changes included an a button to save config changes.

And an idea: What about a marker file ".nobackup" in a subfolder? That would be much easier to implement and any mod creator could adapt easily.

That would work.  If I get some time, I'll see what I can do about it.

Link to comment
Share on other sites

The changes of linuxgurugamer are released. Addidional changes:

  • No backups of folders with .nobackup file
  • Fixed cloning of compressed backups
  • save config button

 

Edited by Nereid
Link to comment
Share on other sites

  • 4 months later...
  • 4 weeks later...
19 hours ago, gap said:

Little useful mod! Thank you for sharing it @Nereid!

I have a quick question: when the 'Each save' option is checked, are automatic saves taken into consideration too, or only manual saves count for back-up creation?

Each save means that all saves (vessel recover, switch back to space center from flight, VAB, ... etcc) are taken into account. Keep in mind: KSP saves quite often.

"each save" is more or less just usefull for mod developers where a single save could destroy an important save they need to investiage a special situation.

That was the reason to write this mod, because in FF there was a time when things in the save game went horrribly wrong because I didn't really understand how saves and loads are handled inside of KSP.

 

Edited by Nereid
Link to comment
Share on other sites

8 hours ago, Nereid said:

Each save means that all saves (vessel recover, switch back to space center from flight, VAB, ... etcc) are taken into account. Keep in mind: KSP saves quite often.

"each save" is more or less just usefull for mod developers where a single save could destroy an important save they need to investiage a special situation.

That was the reason to write this mod, because in FF there was a time when things in the save game went horrribly wrong because I didn't really understand how saves and loads are handled inside of KSP.

 

Thank you Nereid, you have been perfectly clear!
Is there any hope that  you might add an option for backing up only on manual saves, and another one for deleting old/redundant saves by manual selection (instead of having to rely on days, min and max configuration settings?)

Link to comment
Share on other sites

4 minutes ago, gap said:

Is there any hope that  you might add an option for backing up only on manual saves, and another one for deleting old/redundant saves by manual selection (instead of having to rely on days, min and max configuration settings?)

Maybe. If its easy then I could add this on my vacation in two weeks

Link to comment
Share on other sites

  • 4 months later...
  • 4 months later...
  • 3 weeks later...
56 minutes ago, GJNelson said:

What exactly is the difference between using the "delete" function or the "erase" function for backups? "Delete" seems to do what it says, delete the selected backup, but not sure exactly what erase is for?

Delete deletes the selected backup Erase annihilates everything, pretty simple

Link to comment
Share on other sites

52 minutes ago, dtoxic said:

Delete deletes the selected backup Erase annihilates everything, pretty simple

Ok, thanks for the info. I thought that might be the case with "erase", but wanted to know for sure before "stepping off the edge". LoL

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Due the the issue of the internal threading in this mod, I've started my process to adopt this mod.  Even though it seemed to work in 1.9.1, due to the threads you are constantly at risk of the game crashing.  Look at my previous post from May 1 (right above this) for an example.

I have it working without the threads, and will be doing a full adoption soon.  I hope to be able to release a final version in the next week or so.

 

Link to comment
Share on other sites

Try to deactivate logging Exceptions and Errors on the Screen. On the settings.cfg, make sure the following options are set to False

LOG_ERRORS_TO_SCREEN = False
LOG_EXCEPTIONS_TO_SCREEN = False

 

I think this will "solve" the issue, but didn't tested on a Windows machine. Linux and MacOS don't crash on these stunts, Windows does - but, granted, my KSP hangs on quitting and I need to kill -9 it. By deactivating that options, all messages are logged fine and KSP keeps going as nothing had happened.

With the options off:

[EXC 13:28:01.445] FileNotFoundException: Fake exception.
        Nereid.SAVE.BackupSet.CreateBackup (System.Boolean preRestore) (at <f5cc573fbecf4c83a65192d6588fac6e>:0)
        UnityEngine.DebugLogHandler:LogException(Exception, Object)
        KSPe.Util.Log.UnityLogDecorator:UnityEngine.ILogHandler.LogException(Exception, Object)
        ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
        UnityEngine.Debug:LogException(Exception)
        KSPe.Util.Log.UnityLogger:logException(String, Exception)
        KSPe.Util.Log.Logger:error(Exception, String, Object[])
        Nereid.SAVE.Log:error(Exception, String, Object[])
        Nereid.SAVE.BackupSet:CreateBackup(Boolean)
        Nereid.SAVE.BackupJob:CreateBackup()
        Nereid.SAVE.BackupJob:Backup()
        Nereid.SAVE.BackupManager:BackupWork()
        System.Threading.ThreadHelper:ThreadStart()

With the options on, that last log entry is never logged.

My guess is that the Exception that would be serialised to be displayed on the screen is out of bounds for the Unity UI thread (different threads, different stacks and perhaps different memory pools), the thing ends up with an invalid pointer (for that context) and BADABOOM. I have some cases of Unity abuses that breaks up Windows processes, but passes through on MacOS (Unity was born on MacOS, after all).

Deactivating the Threads will impact the game play when automatic background  backups kick in, as they will be run on the Unity's main thread, mainly when using compression. So I think that deactivating that options would be better for the end users, as many of them don't have exactly a top notch rig for playing.

 

Link to comment
Share on other sites

6 hours ago, Lisias said:

Deactivating the Threads will impact the game play when automatic background  backups kick in, as they will be run on the Unity's main thread, mainly when using compression. So I think that deactivating that options would be better for the end users, as many of them don't have exactly a top notch rig for playing.

The proper fix is to figure out what's causing the exception and then fixing that, not randomly removing or disabling features/settings.

There's nothing inherently wrong with multi-threading. The most difficult thing about that is to ensure any state which is accessed by multiple threads  is properly protected and indeed can be accessed from those threads (some Unity state can only be accessed from the main thread, for example). Haven't hat time to look at the sources recently, but ensure there are mutexes protecting shared resources.  In the case of this mod (presumably) you could also take a take a copy of the data into thread-local memory before performing long (compress and write to disk) operations on them to minimise the amount of time you hold an exclusive lock on the data.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...