Author Topic: Hard CTD on write to custom HUD gauge text  (Read 1307 times)

0 Members and 1 Guest are viewing this topic.

Hard CTD on write to custom HUD gauge text
Title says it all. The following are minimal *-sct.tbm and *-hdg.tbm files to reproduce the issue, adapted from my actual mod files:

Code: [Select]
#Conditional Hooks

$Application: FS2_Open

$State: GS_STATE_GAME_PLAY
$On Frame: [
if mn.getMissionTime() > 5 then --rule out some sort of first-frame issue
local gauge = hu.getHUDGaugeHandle("TBeamStatus")
if gauge then gauge.Text = "DEBUG" end
end
]

#End

Code: [Select]
#Gauge Config
$Base:       (1024,768)
$Gauges:
+Custom:
Scale Gauge: NO
Origin: (1, 0.5)
Offset: (-159, 0)
Name: TBeamHeader
Text: Tractor Beam
X Offset: 2
Y Offset: 2
Gauge Type: CENTER_RETICLE
Slew: NO
Active by default: YES
Filename: escort1
+Custom:
Scale Gauge: NO
Origin: (1, 0.5)
Offset: (-159, 13)
Name: TBeamTarget
Text:
X Offset: 4
Y Offset: 1
Gauge Type: CENTER_RETICLE
Slew: NO
Active by default: YES
Filename: escort2
+Custom:
Scale Gauge: NO
Origin: (1, 0.5)
Offset: (-159, 24)
Name: TBeamStatus
Text:
X Offset: 4
Y Offset: 1
Gauge Type: CENTER_RETICLE
Slew: NO
Active by default: YES
Filename: escort3
$End Gauges
#End

As soon as the mission clock hits 5 seconds (well, right before that frame is drawn, I think), the game either hangs for a bit and crashes, or just immediately crashes. In either case, the usual FSO error popup is missing, even with debug builds. I've attached a log generated by a debug build.

[attachment stolen by Russian hackers]
« Last Edit: February 21, 2017, 04:38:55 pm by xenocartographer »

 
Re: Hard CTD on write to custom HUD gauge text
Found a workaround with help from IRC folks, and a recent nightly's actually fixed the issue, so /shrug

 

Offline chief1983

  • Still lacks a custom title
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: Hard CTD on write to custom HUD gauge text
Heh, if it's the timer code fix, you're welcome :)

Well, not for the fix, but for calling attention to what needed to be fixed.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Hard CTD on write to custom HUD gauge text
Heh, if it's the timer code fix, you're welcome :)

Well, not for the fix, but for calling attention to what needed to be fixed.
Doubt the timer code would cause a crash there; 5 seconds isn't long enough for an overflow, an overflow shouldn't cause a crash anyway, and the mn.getMissionTime() call clearly works because it waits until the correct amount of time has elapsed before crashing. Unfortunately, diagnosing exactly why it did crash would require figuring out when the problem went away, and that's an awful lot of troubleshooting for a bug that appears to have already been fixed...
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline chief1983

  • Still lacks a custom title
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: Hard CTD on write to custom HUD gauge text
Yeah it seemed awfully short to me too.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 
Re: Hard CTD on write to custom HUD gauge text
I'm pretty sure it was a bug with the C code backing up the Lua API. In the actual mod, not the minimal test case version, the HUD change was triggered by weapons fire.

Regardless, it's not a problem in the nightlies and I've worked around it for people who prefer not to use them, so I'm not concerned. I hope I didn't waste anyone's time too badly.

 

Offline m!m

  • 211
Re: Hard CTD on write to custom HUD gauge text
Does your scripting code actually update the text of the HUD gauge when you use the nightlies?

I have fixed another bug that may be related to the crash you were experiencing but while fixing that I noticed that the scripting API used a copy of the custom HUD gauge instead of the actual HUD gauge so, as far as I can tell, it wasn't possible to actually change the values of the HUD gauge through the scripting API.