Fixed Game crashes when adding file via Lua script

Status
Not open for further replies.

FuriousFox

AKA FuriousFox
Retired Staff
1. Start SRB2
2. Go to MAP01
3. type "ADDFILE TESTSCRIPT.LUA" in the console and press enter

At this point, the game will crash. EIP=004b3848

testscript.lua contains the following code:
Code:
do
	COM_BufInsertText(server, "addfile scr_mysticrealm.wad")
end
 

Attachments

  • testscript.lua
    66 bytes · Views: 342
Last edited by a moderator:
The odd thing here is when I followed the instructions to reproduce, I actually got a different crash, EIP=4e9e3f, which is in p_setup.c, line 2905 (in P_AddWadFile). Were you using srb2win.exe at the time?
 
Last edited:
It should just run once.


The strange thing is the script works totally fine when added at the title screen, yet not in-level? Very weird.

EDIT: actually, that might be because the player isn't valid at the title screen so the script makes a console error, lol.
 
Last edited:
The odd thing here is when I followed the instructions to reproduce, I actually got a different crash, EIP=4e9e3f, which is in p_setup.c, line 2905 (in P_AddWadFile). Were you using srb2win.exe at the time?

I'm using Wolfy's 2.1.15 EXE compiled with the optimizations turned on.
 
Then yeah the EIP is utterly useless for anyone but Wolfy himself, if he has the .debug file that is. Not that it matters since the crash is definitely reproducable anyway.



What's going on here is that because the Lua script is calling addfile within itself immediately on load, the fact this occurs just at the end of loading the Lua script itself before means that the newly added file itself overwrites the Lua script's slot in the game's storage array for all loaded wad files and leaves the next one totally inaccessible without a crash. =V
 
There, fixed the crash. Though tbh this doesn't seem like something you should be doing anyway? I dunno really.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top