"levels 5" dialog box randomly appears [BUG][PLAYER]

Started by Wafflem, May 30, 2017, 03:41:49 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Wafflem

Stable player V10.13.18, though it even happens on older versions, as well as exp Player V11.14.19:0F5D7C7

While playing any level, the dialog box with "levels" on top, and the text "5" randomly appears, and hinders me from playing the level. There is also the chance that even when I click OK or the X on the upper right, the dialog box will not go away.
YouTube: www.tinyurl.com/YTWafflem
Twitch: www.twitch.tv/Wafflem467

Have level designer's block right now? Have some of my incomplete levels for LOTS of ideas!

namida

Sounds like this may be a debugging message I forgot to remove.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Wafflem

YouTube: www.tinyurl.com/YTWafflem
Twitch: www.twitch.tv/Wafflem467

Have level designer's block right now? Have some of my incomplete levels for LOTS of ideas!

namida

Yes, I had a quick look but couldn't find any obvious cause, nor have I been able to reproduce it yet. I'll have a harder look next time I'm working on NL.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Wafflem

Okay...I've played some levels on the stable versions of NeoLemmix and that "5" error has started to pop up as well on V10.13.18.  Even when downgrading to the earlier stable NeoLemmix players like V10.13.16-B, this error still happens. I don't know what exactly is causing this.

This dialog box appears whenever these happen:
1. The trapdoor opens
2. A skill is assigned to a lemming
3. A lemming enters the exit
4. A lemming dies in any way (splatting, falling off the screen, etc.)

If it helps, I've also posted a picture of an Access Violation, which appears when clicking on OK at the pass/fail screen.

Might it have to do with my own computer? Nobody else seems to be experiencing the same problem. :-[
YouTube: www.tinyurl.com/YTWafflem
Twitch: www.twitch.tv/Wafflem467

Have level designer's block right now? Have some of my incomplete levels for LOTS of ideas!

namida

Can you post your config INI file please? (And, just to be safe, hotkeys too.)

If you prefer you can PM it, if so, can you send to Nepster as well? (I probably won't be working on NL much for the next few days, so might be good for him to have a copy too.)
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Wafflem

Here they are! Note that these are for the stable version (V10.13.18).

I can confirm that this problem appears to be computer-specific; this issue doesn't happen on my laptop, but on one of my other computers (and especially since nobody else appears to have this issue...).
YouTube: www.tinyurl.com/YTWafflem
Twitch: www.twitch.tv/Wafflem467

Have level designer's block right now? Have some of my incomplete levels for LOTS of ideas!

Nepster

Thanks. Could you please disable the sound (i.e. set the sound volume to 0) and check whether the error still occurs?

The only code I found that might produce your error appears in GameSound.pas (line 410). So I suspect that the library handling sound output has problems with some setting on your computer, which would explain why it happens only on one of your computers, and there so frequently.

Wafflem

No such error appears when the sound is disabled. It may indeed have to do with the computer I'm using, as the computer does not even have any speakers installed.
YouTube: www.tinyurl.com/YTWafflem
Twitch: www.twitch.tv/Wafflem467

Have level designer's block right now? Have some of my incomplete levels for LOTS of ideas!

Nepster

Ok, great. But then I have to defer to namida to fix this bug, because I have no knowledge about the sound code and could only "fix" it by removing the sound completely on all computers that have this problem-

namida

Nepster: I'm not likely to be on my PC much for the next few days, could you copy/paste the relevant code here?
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Nepster

Here the method, that I suspect creates the error messages via the ShowMessage call at the end:

procedure TSoundManager.PlaySound(aName: String; aBalance: Integer = 0);
var
  SoundIndex: Integer;
  SampleChannel: LongWord;
begin
  if fMuteSound then Exit;
  SoundIndex := FindSoundIndex(aName);

  if SoundIndex = -1 then
    SoundIndex := LoadSoundFromFile(aName);

  if aBalance < -100 then aBalance := -100;
  if aBalance > 100 then aBalance := 100;

  if SoundIndex <> -1 then
  begin
    SampleChannel := BASS_SampleGetChannel(fSoundEffects[SoundIndex].BassSample, true);
    if aBalance <> 0 then
    begin
      if not BASS_ChannelSetAttribute(SampleChannel, BASS_ATTRIB_PAN, (aBalance / 100)) then
        ShowMessage(IntToStr(BASS_ErrorGetCode));
    end;
    BASS_ChannelSetAttribute(SampleChannel, BASS_ATTRIB_VOL, (fSoundVolume / 100));
    BASS_ChannelPlay(SampleChannel, true);
  end;
end;

ccexplore

#12
It looks like it's trying to set the left/right panning balance of a sound channel, and displaying the error code if the operation failed.  I'm pretty sure that it is non-fatal failure, at worst maybe the sound wouldn't sound quite right but shouldn't otherwise be interrupting the game with what looks like leftover debug mechanism.

If there is already an existing mechanism in your codebase to direct debug messages to a log file, I'd strongly recommend changing the ShowMessage to output silently to such debug log file instead.  Otherwise it's probably safe to just remove the ShowMessage() call in the code snippet.

[edit: maybe I speak too soon.  I'm not sure how the access violation mentioned by Wafflem happens, though I'm pretty sure it is not solely dependent on BASS_ChannelSetAttribute(..., BASS_ATTRIB_PAN...) failing.  Most likely there is just some portion of sound code, likely not shown in the snippet above, that implicitly assumes some sound-related operation can always succeed, and then behaves badly when it doesn't succeed, for example due to no speakers/audio output devices installed, and eventually the code did something stupid accordingly that causes the access violation.

Removing ShowMessage() would obviously not do anything about the access violation, but at the same time it's not making things worst either.]

namida

Yes, this is unremoved debug code. The Bass_ChannelSetAttribute needs to be kept, but the if...then around it (not the aBalance one, but the one around the Bass function itself) and the ShowMessage can be removed.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)