[Linux] GZDoom crashing when ZScript mod is combined with Dehacked weapon.

Need help running G/Q/ZDoom/ECWolf/Zandronum/3DGE/EDuke32/Raze? Did your computer break? Ask here.

Moderator: GZDoom Developers

Forum rules
Contrary to popular belief, we are not all-knowing-all-seeing magical beings!

If you want help you're going to have to provide lots of info. Like what is your hardware, what is your operating system, what version of GZDoom/LZDoom/whatever you're using, what mods you're loading, how you're loading it, what you've already tried for fixing the problem, and anything else that is even remotely relevant to the problem.

We can't magically figure out what it is if you're going to be vague, and if we feel like you're just wasting our time with guessing games we will act like that's what you're really doing and won't help you.
Post Reply
FEZ_GG
Posts: 5
Joined: Sat Oct 09, 2021 3:52 am

[Linux] GZDoom crashing when ZScript mod is combined with Dehacked weapon.

Post by FEZ_GG »

I'm trying to apply a ZScript mod that reduces the weapon switch speed of all weapons. The code that I'm using has the following format across all weapons:

class BFGNew: BFG9000 replaces BFG9000
{
Default
{
Weapon.SlotNumber 7;
}
States
{
Deselect:
BFGG A 1 A_Lower(18);
Loop;
Select:
BFGG A 1 A_Raise(18);
Loop;
}
}

For the most part this works fine. However, I decided to test this with the mapset Struggle: Antaresian Legacy, which uses extensive Dehacked to change the enemies and weapons. Most of the weapons cooperate with the new lower/raise speed, but the Leichenfaust, the BFG replacement, isn't cooperating. Shortly after I fire the weapon, before the projectile makes contact with anything, GZDoom will crash. I'm given the error "Address not mapped to object (signal 11) Address: 0x7fff57c0eff0".

I tried removing my States changes, and even the SlotNumber change so I had no new code when inheriting from BFG9000. That did not solve the issue. I also noticed that when firing the Leichenfaust, it still used 40 cells for ammo, when it's supposed to use 6 rockets. I tried adding Weapon.Ammotype = "RocketAmmo"; and Weapon.AmmoUse = 6; to see if that would resolve the issue, but it did not. At this point I'm not sure what to do. The original Leichenfaust, with no ZScript meddling, will work perfectly. It's only when I try to add a new BFG weapon in ZScript that issues arise. I can only assume there's some sort of conflict with Struggle's Dehacked file. The new BFG states call unusual pointers, like CheckReload and CloseShotgun2.

I'm running this on GZDoom 4.10.0 on my Steam Deck.
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: [Linux] GZDoom crashing when ZScript mod is combined with Dehacked weapon.

Post by wildweasel »

Can you upload your file to test? Dropbox, Google Drive, or whatever service works best for you.
User avatar
Player701
 
 
Posts: 1710
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: [Linux] GZDoom crashing when ZScript mod is combined with Dehacked weapon.

Post by Player701 »

I get a stack overflow in the VS debugger on Windows. From the stack trace, it looks like A_GunFlash is called initially and attempts to play the flash animation starting from the same state where it was called, which results in an endless chain of A_GunFlash calls. Essentially, the equivalent of this code:

Code: Select all

class CrashWeapon : Weapon
{
    ...
    
    States
    {
        ...

        Flash:
            TNT A 0 A_GunFlash; // Results in a stack overflow
            Stop;
    }
}
I'm aware that DECORATE/ZScript and DEHACKED do not play nice together when it concerns replacements, but this certainly looks like a bug to me. Therefore, I think this thread should be moved to Bugs.

For the record, here is the link to the WAD the OP is talking about. And the following ZScript code is enough to reproduce the issue:

Code: Select all

class NewBFG : BFG9000
{
}
Simply load this up along with strg.wad, type give NewBFG and attempt to fire - BOOM! stack overflow.

Reproduced in GZDoom 4.11.3 and g4.12pre-105-g22203cbc1.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49226
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [Linux] GZDoom crashing when ZScript mod is combined with Dehacked weapon.

Post by Graf Zahl »

The bug is on the mod side. A_GunFlash is what starts the flash state so you cannot use it from the initial flash state as it'd just repeatedly do the same thing all over again.
It is one of those things where the presence of data hacking like Dehacked does makes it quite impossible to do efficient error checks.
User avatar
Player701
 
 
Posts: 1710
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: [Linux] GZDoom crashing when ZScript mod is combined with Dehacked weapon.

Post by Player701 »

Graf Zahl wrote: Sat Nov 11, 2023 7:59 am The bug is on the mod side.
If it is, then why doesn't it appear when running only strg.wad without any ZScript?

Upd: Just in case my previous post may have been wrongly interpreted: The first snippet of code is just a showcase to explain what is essentially happening that leads to the crash. To reproduce it, only the second snippet is required, which is just an empty class declaration. That's why I think this is a bug, and not a user error.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49226
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [Linux] GZDoom crashing when ZScript mod is combined with Dehacked weapon.

Post by Graf Zahl »

If you try to mix Dehacked and DECORATE/ZScript mods all bets are off.
The DECORATE inheritance is done first, taking the state indices from the, in this case, original BFG.

Now Dehacked comes along and alters the states. If it also alters the state labels of the original BFG but not your copy's so now your inherited weapon points to states that are not what it expects them to be.
The gist of it: You cannot mix Dehacked mods with actor replacements. There is no way to handle this.
User avatar
Player701
 
 
Posts: 1710
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: [Linux] GZDoom crashing when ZScript mod is combined with Dehacked weapon.

Post by Player701 »

Graf Zahl wrote: Sun Nov 12, 2023 8:49 amThe gist of it: You cannot mix Dehacked mods with actor replacements.
Well, that's not in question. I only thought it would at least not crash like that.

Looks like the real issue here is that stack overflow in the VM is not handled gracefully.
User avatar
Rachael
Posts: 13924
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: [Linux] GZDoom crashing when ZScript mod is combined with Dehacked weapon.

Post by Rachael »

Player701 wrote: Sun Nov 12, 2023 9:03 am Looks like the real issue here is that stack overflow in the VM is not handled gracefully.
Already reported that, but it looks like it's not currently fixable.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49226
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [Linux] GZDoom crashing when ZScript mod is combined with Dehacked weapon.

Post by Graf Zahl »

What we really need for these cases is a crash log with clear text function names, but the obstacles the compiler vendors put in the way for that are utterly ridiculous. Even C++20's stacktrace feature won't work without debug symbols.
Post Reply

Return to “Technical Issues”