DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

Wolf4SDL sporadically corrupting saved games
Page 1 of 1
DieHard Wolfers Forum Index -> SDL Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
Post new topicReply to topic
Author Message
Barry
DieHard Officer
DieHard Officer


Joined: 27 Aug 2008
Last Visit: 28 Oct 2017

Topics: 64
Posts: 565

blank.gif

PostPosted: Wed Jan 18, 2017 6:06 pm
   Subject: Wolf4SDL sporadically corrupting saved games
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

I am running into an issue in Atomprojekt where if the player keeps saves over the same game through the course of several levels, it will eventually become corrupt and crash the game when you attempt to reload it.

Has anybody ever experienced this and does anybody know what might cause it? It never happened in PTH so I am wondering if it might have something to do with the additional gamestates/enemies/etc added to Atomprojekt.

_________________
Atomprojekt Download: http://www.wolfenvault.com/files/barry/ATOM.3.zip
Passage to Hollenteufel Download: http://www.wolfenvault.com/files/barry/PTH.2.zip
Barry
DieHard Officer
DieHard Officer


Joined: 27 Aug 2008
Last Visit: 28 Oct 2017

Topics: 64
Posts: 565

blank.gif

PostPosted: Wed Jan 18, 2017 6:49 pm
   Subject: Re: Wolf4SDL sporadically corrupting saved games
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Additional info: I discovered that if I delete my CONFIG.WF2 file, I can load the saved game, but I get no music (or strange sounds in the place of music) and the AdLib sounds become muffled. If I re-save the game, the new save crashes when you attempt to load it.

_________________
Atomprojekt Download: http://www.wolfenvault.com/files/barry/ATOM.3.zip
Passage to Hollenteufel Download: http://www.wolfenvault.com/files/barry/PTH.2.zip
Barry
DieHard Officer
DieHard Officer


Joined: 27 Aug 2008
Last Visit: 28 Oct 2017

Topics: 64
Posts: 565

blank.gif

PostPosted: Wed Jan 18, 2017 7:22 pm
   Subject: Re: Wolf4SDL sporadically corrupting saved games
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Update: I figured out that if I turn off the music, load the game, re-save it, and then turn the music back on, it fixes it.

I tried this.

::: CODE :::

void
SD_ContinueMusic(int chunk, int startoffs)
{
    SD_MusicOff();

    if (MusicMode == smm_AdLib)
    {
        int32_t chunkLen = CA_CacheAudioChunk(chunk);
        sqHack = (word *)(void *) audiosegs[chunk];     // alignment is correct
        if(*sqHack == 0) sqHackLen = sqHackSeqLen = chunkLen;
        else sqHackLen = sqHackSeqLen = *sqHack++;
        sqHackPtr = sqHack;

//        if(startoffs >= sqHackLen)
//        {
//            Quit("SD_StartMusic: Illegal startoffs provided!");
//        }

        // fast forward to correct position
        // (needed to reconstruct the instruments)
        if(startoffs < sqHackLen)   //  If greater or equal, skip this and do like SD_StartMusic
        {
            for(int i = 0; i < startoffs; i += 2)
            {
                byte reg = *(byte *)sqHackPtr;
                byte val = *(((byte *)sqHackPtr) + 1);
                if(reg >= 0xb1 && reg <= 0xb8) val &= 0xdf;           // disable play note flag
                else if(reg == 0xbd) val &= 0xe0;                     // disable drum flags
   
                alOut(reg,val);
                sqHackPtr += 2;
                sqHackLen -= 4;
            }
        }
        sqHackTime = 0;
        alTimeCount = 0;

        SD_MusicOn();
    }
}


But it didn't seem to work. I think this is related to the old IllegalMusicStartoffs issue.

I replaced that line with "startoffs = 0;" previously when I was fine tuning PTH, but instead of being thrown out with an error message like before, it now just crashes the game with no error messages.

_________________
Atomprojekt Download: http://www.wolfenvault.com/files/barry/ATOM.3.zip
Passage to Hollenteufel Download: http://www.wolfenvault.com/files/barry/PTH.2.zip
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 2:00 ago.

Topics: 37
Posts: 2401
Location: Christchurch, New Zealand
newzealand.gif

PostPosted: Thu Jan 19, 2017 2:01 am
   Subject: Re: Wolf4SDL sporadically corrupting saved games
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Can you send me your source code again, along with the data files and a saved game that causes it?
Havoc
I am Death Incarnate
I am Death Incarnate


Joined: 03 Sep 2004
Last Visit: 16 Mar 2017

Topics: 7
Posts: 190
Location: Germany
blank.gif

PostPosted: Sat Jan 21, 2017 1:05 pm
   Subject: Re: Wolf4SDL sporadically corrupting saved games
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I've never bothered to find the actual cause of the problem, but here's a workaround for it:

Find the following line of code in the LoadTheGame function (wl_main.cpp)

::: CODE :::
if(lastgamemusicoffset<0) lastgamemusicoffset=0;


and change it to:

::: CODE :::
/*if(lastgamemusicoffset<0)*/ lastgamemusicoffset=0;


This way the music offset is always set to 0, when a saved game is loaded, and the music starts playing from the beginning instead of the position when the saved game was created.

_________________
Havoc's Wolf3D Page - updated 02/20/2017
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 2:00 ago.

Topics: 37
Posts: 2401
Location: Christchurch, New Zealand
newzealand.gif

PostPosted: Sat Jan 21, 2017 1:10 pm
   Subject: Re: Wolf4SDL sporadically corrupting saved games
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

If that fixes it after my compiler's seemingly different treatment of the packing pragma has been leading me astray for a few days, I'm going to be annoyed xD
Barry
DieHard Officer
DieHard Officer


Joined: 27 Aug 2008
Last Visit: 28 Oct 2017

Topics: 64
Posts: 565

blank.gif

PostPosted: Sat Jan 21, 2017 1:49 pm
   Subject: Re: Wolf4SDL sporadically corrupting saved games
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Havoc wrote:
I've never bothered to find the actual cause of the problem, but here's a workaround for it:

Find the following line of code in the LoadTheGame function (wl_main.cpp)

::: CODE :::
if(lastgamemusicoffset<0) lastgamemusicoffset=0;


and change it to:

::: CODE :::
/*if(lastgamemusicoffset<0)*/ lastgamemusicoffset=0;


This way the music offset is always set to 0, when a saved game is loaded, and the music starts playing from the beginning instead of the position when the saved game was created.


Thanks!

It appears this fixed it. The Wolf4SDL feature that starts the music off in the position where it was when the game was saved is a very nice feature, but it appears to not work correctly 100% of the time. I have experienced issues similar to this in numerous Wolf4SDL mods, especially older ports.

_________________
Atomprojekt Download: http://www.wolfenvault.com/files/barry/ATOM.3.zip
Passage to Hollenteufel Download: http://www.wolfenvault.com/files/barry/PTH.2.zip
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> SDL Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 1
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts Announcement: Wolf4SDL released
Author: Ripper
522 155231 Mon May 22, 2017 2:04 pm
Tricob View latest post
No new posts [help] Adding teleporters in wolf4sdl
Author: Mortimer
35 7362 Fri May 26, 2017 8:19 am
Military View latest post
No new posts [WOLF4SDL Help] Blake Stone Style doors
Author: Haasboy
3 2197 Sun Jul 20, 2008 7:56 am
Haasboy View latest post
No new posts [Wolf4SDL Help] Inserting a second palette (like in SoD)
Author: Andy_Nonymous
10 2403 Mon Jun 02, 2008 3:59 pm
Adam Biser View latest post
No new posts [Help] Problem with Checkweaponchange function (wolf4sdl)
Author: Mortimer
4 2335 Sat May 17, 2008 11:26 am
Mortimer View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group