mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-19 17:01:46 +00:00
globals.c:
don't crash on bad function numbers qfprogs.c: if the file doesn't load first try, thy appending .gz
This commit is contained in:
parent
0b1d1ade73
commit
067c2dd6b2
2 changed files with 15 additions and 9 deletions
|
@ -67,11 +67,16 @@ dump_globals (progs_t *pr)
|
|||
|
||||
if (def->type == ev_func) {
|
||||
func_t func = G_FUNCTION (pr, offset);
|
||||
int start = pr->pr_functions[func].first_statement;
|
||||
if (start > 0)
|
||||
comment = va (" %d @ %d", func, start);
|
||||
else
|
||||
comment = va (" %d = #%d", func, -start);
|
||||
int start;
|
||||
if (func >= 0 && func < pr->progs->numfunctions) {
|
||||
start = pr->pr_functions[func].first_statement;
|
||||
if (start > 0)
|
||||
comment = va (" %d @ %d", func, start);
|
||||
else
|
||||
comment = va (" %d = #%d", func, -start);
|
||||
} else {
|
||||
comment = va (" %d = illegal function", func);
|
||||
}
|
||||
}
|
||||
|
||||
printf ("%s %d %d %s%s\n", type, saveglobal, offset, name, comment);
|
||||
|
|
|
@ -52,11 +52,10 @@ static const char rcsid[] =
|
|||
#include "QF/pr_comp.h"
|
||||
#include "QF/progs.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/va.h"
|
||||
#include "QF/vfile.h"
|
||||
#include "QF/zone.h"
|
||||
|
||||
#include "QF/vfile.h"
|
||||
|
||||
#include "disassemble.h"
|
||||
#include "globals.h"
|
||||
#include "strings.h"
|
||||
|
@ -115,8 +114,10 @@ load_file (progs_t *pr, const char *name)
|
|||
|
||||
file = open_file (name, &size);
|
||||
if (!file) {
|
||||
perror (name);
|
||||
return 0;
|
||||
file = open_file (va ("%s.gz", name), &size);
|
||||
if (!file) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
sym = malloc (size);
|
||||
Qread (file, sym, size);
|
||||
|
|
Loading…
Reference in a new issue