• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Fixed Levelling: Cannot Save Game During PostInit Process

If my laptop behaves I can test on Monday.
Could you test something for me.
Search in location_loader.c for the set post init state and comment out those two lines now try again if you can save at game start. It will disable postinit so will take long but it rules out if thats the problem
 
Could you test something for me.
Search in location_loader.c for the set post init state and comment out those two lines now try again if you can save at game start.
The SetCharacterPostInit ones, you mean?
 
Done and confirmed. With those two lines commented out, I can save right from the start.
Hmmm....Could you post a compile log with post init debugging enabled in this location?
 
And restored those lines, problem immediately returns. Looks like we've found the culprit.
Must be that the whole active "PostInit" queue is a bit too much for the game to save.

Maybe a simple fix could be to abort it when saving?
When I execute this through console, I can save straight away:
Code:
StopPostInitChars(); // Levis
 
The post init has stopped. And I don't think that's the problem. It might be in the other events I added to increase performance, but I need to test that myself.
What kind of error do you get when you try to save?
 
The post init has stopped.
I did indeed wait for it to finish before posting that compile.log file.
As long as the PostInit is still running, I cannot save. The second it stops, it is OK.

What kind of error do you get when you try to save?
Similar to the ones @ANSEL reported in the opening post.
I don't have the file anymore, but it was something like this:
Code:
RUNTIME ERROR - file: interface\interface.c; line: 1565
no memory
RUNTIME ERROR - file: interface\save_load.c; line: 1048
no memory
RUNTIME ERROR - file: interface\interface.c; line: 1565
no memory
 
When you do a Manual Save the game does an automatic Quicksave at the same time - don't know why.:shrug

If when you get a Bad Save - you check the save folder the Quicksave has a larger file size than the Bad Manual Save.

And the Quicksave is uncorrupted.

What I do when I get a Bad Manual Save is load my last good Save - then Press F6 to load the Quicksave.

I get Bad Saves most often when I try to save too soon after arriving in a new location - usually a Port.

:drunk
 
That double save thing is because of some changes @konradk made ages ago.
Can't remember why.

The situation where your saves fail sound VERY much the same as the one I've now found as well.

In your case, can you also tell a save is going to fail because the screenshot doesn't show in the Save interface before you actually make the save?
That's what I noticed on my side, at least.
 
In your case, can you also tell a save is going to fail because the screenshot doesn't show in the Save interface before you actually make the save?
That's what I noticed on my side, at least.

:no - It just appears to Save as normal - I have learnt from experience to go back and check to see that the Save is Good. :yes

:drunk
 
Slightly different from me then.
Well, hopefully today's escapades can serve to point @Levis towards a proper fix.
 
Yeah it should be able to just pause the post init when opening f1 menu. Just need to write that function.
 
@Pieter Boelen here is what you need could you take a look at it and see if it works?

When opening the menu (F1)
call this line of code if PostInitQueue.active is true:
Code:
PostInitQueue.active = false;
PostInitQueue.paused = true;
That should pause the postinit
On exit of the menu if paused exist call this code:
Code:
DeleteAttribute(&PostInitQueue,"paused");
PostEvent("PostInitChars",0);

That should resume the post init again
 
So @Levis, this at the top of mainmenu.c then?
Code:
  // Levis: To prevent save errors -->
   if (CheckAttribute(PostInitQueue, "active") && sti(PostInitQueue.active) == true)
   {
     PostInitQueue.active = false;
     PostInitQueue.paused = true;
   }
   // Levis: To prevent save errors <--

And this in the exit case?
Code:
  // Levis: To prevent save errors -->
   if (CheckAttribute(PostInitQueue, "paused") && sti(PostInitQueue.paused) == true)
   {
     DeleteAttribute(&PostInitQueue,"paused");
     PostEvent("PostInitChars",0);
   }
   // Levis: To prevent save errors <--

Should that not go in the "Save" menu?
 
Close, very close. But not entirely right yet.

This seems to be the code you want:
Code:
   // Levis: To prevent save errors -->
   if (CheckAttribute(PostInitQueue, "active") && sti(PostInitQueue.active) == true)
   {
     TraceAndLog("Pause PostInitQueue!");
     PostInitQueue.active = false;
     PostInitQueue.paused = true;
   }
   // Levis: To prevent save errors <--

Code:
   // Levis: To prevent save errors -->
   if (CheckAttribute(PostInitQueue, "paused") && sti(PostInitQueue.paused) == true)
   {
     TraceAndLog("Restore PostInitQueue");
     DeleteAttribute(&PostInitQueue,"paused");
     PostInitQueue.active = true;
     PostEvent("PostInitChars",0);
   }
   // Levis: To prevent save errors <--

That almost works. But pausing the queue when you get into the Save Menu (or even the Main Menu) does not seem to be early enough.
You have to pause the queue first and THEN open the Save menu and then it works.
I confirmed that with that code so you have to open the save menu, go back to the game, then open the save menu again and then I can save. o_O

Those were the times that the PostInitQueue didn't get properly reactivated.
I had to add an extra line PostInitQueue.active = true to the reactivation or it would never actually restart.
PostEvent("PostInitChars",0); by itself does not take care of that and therefore remains aborting.

Of course that doesn't exactly help us. To make that work, we'd need to do the pausing before you press the menu button.
Which either requires time travel or reading the player's mind. :rofl
 
Could you try and see if there is a timing issue here also? If you pause it and wait for a moment and then try to save does it work?
The picking of perks and assigning of skills is also done by events now do so maybe they are still catching up :S?
I believe i made a debug toggle for those things too. Could you check if that's the case?
 
Could you try and see if there is a timing issue here also? If you pause it and wait for a moment and then try to save does it work?
The picking of perks and assigning of skills is also done by events now do so maybe they are still catching up :S?
I believe i made a debug toggle for those things too. Could you check if that's the case?
I enabled ALL your debug toggles, then started Hornblower and tried to save with that 'pause' code in the Save/Load Interface file:
Code:
POSTINIT: eventcall
POSTINIT: character Higgins id Rifleman Higgins
XP LOG: Called AddXPtoChar for Higgins with skill:  and xp: 1233 CurXP: 3500
Pause PostInitQueue!
XP LOG: Event for skills triggered for Higgins
XP LOG: Called AddXPtoSkillsMain with Exp: 1233
XP LOG: AddXP to skill: leadership Old Skill Exp: 20 increase with: 11 needed for next level: 1346
XP LOG: chance of increasing importance: 0 for skill: leadership
XP LOG: AddXP to skill: fencing Old Skill Exp: 697 increase with: 368 needed for next level: 1346
XP LOG: chance of increasing importance: 0 for skill: fencing
XP LOG: AddXP to skill: sailing Old Skill Exp: 16 increase with: 9 needed for next level: 1346
XP LOG: chance of increasing importance: 0 for skill: sailing
XP LOG: AddXP to skill: accuracy Old Skill Exp: 371 increase with: 196 needed for next level: 1346
XP LOG: chance of increasing importance: 0 for skill: accuracy
XP LOG: AddXP to skill: cannons Old Skill Exp: 236 increase with: 125 needed for next level: 1346
XP LOG: chance of increasing importance: 0 for skill: cannons
XP LOG: AddXP to skill: grappling Old Skill Exp: 584 increase with: 309 needed for next level: 1346
XP LOG: chance of increasing importance: 0 for skill: grappling
XP LOG: AddXP to skill: repair Old Skill Exp: 24 increase with: 13 needed for next level: 1346
XP LOG: chance of increasing importance: 0 for skill: repair
XP LOG: AddXP to skill: defence Old Skill Exp: 351 increase with: 185 needed for next level: 1346
XP LOG: chance of increasing importance: 0 for skill: defence
XP LOG: AddXP to skill: commerce Old Skill Exp: 4 increase with: 2 needed for next level: 1346
XP LOG: chance of increasing importance: 0 for skill: commerce
XP LOG: AddXP to skill: sneak Old Skill Exp: 20 increase with: 10 needed for next level: 1346
XP LOG: chance of increasing importance: 0 for skill: sneak
POSTINIT: eventcall
After pausing, the game does still continue with stuff.
This ends after a bit, but even when nothing has been written to compile.log for a minute, saving still doesn't work.

It only starts working after I close the Save/Load Interface AND the Main Menu, then try again.
Seems that while in the interfaces, whatever prevents the saving doesn't update until you're back in the game. :facepalm
 
Oh, and this is a "clean" error log that goes with it:
Code:
RUNTIME ERROR - file: interface\interface.c; line: 1565
no memory
RUNTIME ERROR - file: interface\save_load.c; line: 1057
no memory
 
Back
Top