mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
massively speedup savegame scanning (and bump the menu progs memory size again :/)
This commit is contained in:
parent
b1b7c49b11
commit
d996c364b8
5 changed files with 25 additions and 4 deletions
|
@ -484,7 +484,7 @@ Menu_Load (void)
|
||||||
|
|
||||||
menu_pr_state.progs = 0;
|
menu_pr_state.progs = 0;
|
||||||
if ((size = QFS_FOpenFile (menu_pr_state.progs_name, &file)) != -1) {
|
if ((size = QFS_FOpenFile (menu_pr_state.progs_name, &file)) != -1) {
|
||||||
PR_LoadProgsFile (&menu_pr_state, file, size, 0, 512 * 1024);
|
PR_LoadProgsFile (&menu_pr_state, file, size, 0, 1024 * 1024);
|
||||||
Qclose (file);
|
Qclose (file);
|
||||||
|
|
||||||
if (!PR_RunLoadFuncs (&menu_pr_state)) {
|
if (!PR_RunLoadFuncs (&menu_pr_state)) {
|
||||||
|
|
|
@ -39,6 +39,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
||||||
# include <strings.h>
|
# include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "QF/dstring.h"
|
||||||
#include "QF/progs.h"
|
#include "QF/progs.h"
|
||||||
#include "QF/quakefs.h"
|
#include "QF/quakefs.h"
|
||||||
#include "QF/va.h"
|
#include "QF/va.h"
|
||||||
|
@ -201,6 +202,23 @@ bi_Qgetline (progs_t *pr)
|
||||||
R_STRING (pr) = 0;
|
R_STRING (pr) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
bi_Qreadstring (progs_t *pr)
|
||||||
|
{
|
||||||
|
int handle = P_INT (pr, 0);
|
||||||
|
int len = P_INT (pr, 1);
|
||||||
|
qfile_t *h = get_handle (pr, __FUNCTION__, handle);
|
||||||
|
string_t str = PR_NewMutableString (pr);
|
||||||
|
dstring_t *dstr = PR_GetMutableString (pr, str);
|
||||||
|
|
||||||
|
dstr->size = len + 1;
|
||||||
|
dstring_adjust (dstr);
|
||||||
|
len = Qread (h->file, dstr->str, len);
|
||||||
|
dstr->size = len + 1;
|
||||||
|
dstr->str[len] = 0;
|
||||||
|
R_STRING (pr) = str;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_buffer (progs_t *pr, pr_type_t *buf, int count, const char *name)
|
check_buffer (progs_t *pr, pr_type_t *buf, int count, const char *name)
|
||||||
{
|
{
|
||||||
|
@ -340,6 +358,7 @@ static builtin_t insecure_builtins[] = {
|
||||||
static builtin_t builtins[] = {
|
static builtin_t builtins[] = {
|
||||||
{"Qclose", bi_Qclose, -1},
|
{"Qclose", bi_Qclose, -1},
|
||||||
{"Qgetline", bi_Qgetline, -1},
|
{"Qgetline", bi_Qgetline, -1},
|
||||||
|
{"Qreadstring", bi_Qreadstring, -1},
|
||||||
{"Qread", bi_Qread, -1},
|
{"Qread", bi_Qread, -1},
|
||||||
{"Qwrite", bi_Qwrite, -1},
|
{"Qwrite", bi_Qwrite, -1},
|
||||||
{"Qputs", bi_Qputs, -1},
|
{"Qputs", bi_Qputs, -1},
|
||||||
|
|
|
@ -93,11 +93,11 @@ integer save_cursor;
|
||||||
string (QFile f) get_comment =
|
string (QFile f) get_comment =
|
||||||
{
|
{
|
||||||
local string line;
|
local string line;
|
||||||
local string plist_data = str_new ();
|
local string plist_data;
|
||||||
local PLItem plist;
|
local PLItem plist;
|
||||||
|
local integer pos = Qtell (f);
|
||||||
|
|
||||||
while ((line = Qgetline (f)))
|
plist_data = Qreadstring (f, Qfilesize (f) - pos);
|
||||||
str_cat (plist_data, line);
|
|
||||||
plist = [PLItem newFromString:plist_data];
|
plist = [PLItem newFromString:plist_data];
|
||||||
str_free (plist_data);
|
str_free (plist_data);
|
||||||
line = [(PLString) [plist getObjectForKey:"comment"] string];
|
line = [(PLString) [plist getObjectForKey:"comment"] string];
|
||||||
|
|
|
@ -9,6 +9,7 @@ typedef struct _qfile_t [] QFile;
|
||||||
@extern QFile (string path, string mode) Qopen;
|
@extern QFile (string path, string mode) Qopen;
|
||||||
@extern void (QFile file) Qclose;
|
@extern void (QFile file) Qclose;
|
||||||
@extern string (QFile file) Qgetline;
|
@extern string (QFile file) Qgetline;
|
||||||
|
@extern string (QFile file, integer len) Qreadstring;
|
||||||
@extern integer (QFile file, void [] buf, integer count) Qread;
|
@extern integer (QFile file, void [] buf, integer count) Qread;
|
||||||
@extern integer (QFile file, void [] buf, integer count) Qwrite;
|
@extern integer (QFile file, void [] buf, integer count) Qwrite;
|
||||||
@extern integer (QFile file, string str) Qputs;
|
@extern integer (QFile file, string str) Qputs;
|
||||||
|
|
|
@ -5,6 +5,7 @@ integer (string path) Qremove = #0;
|
||||||
QFile (string path, string mode) Qopen = #0;
|
QFile (string path, string mode) Qopen = #0;
|
||||||
void (QFile file) Qclose = #0;
|
void (QFile file) Qclose = #0;
|
||||||
string (QFile file) Qgetline = #0;
|
string (QFile file) Qgetline = #0;
|
||||||
|
string (QFile file, integer length) Qreadstring = #0;
|
||||||
integer (QFile file, void [] buf, integer count) Qread = #0;
|
integer (QFile file, void [] buf, integer count) Qread = #0;
|
||||||
integer (QFile file, void [] buf, integer count) Qwrite = #0;
|
integer (QFile file, void [] buf, integer count) Qwrite = #0;
|
||||||
integer (QFile file, string str) Qputs = #0;
|
integer (QFile file, string str) Qputs = #0;
|
||||||
|
|
Loading…
Reference in a new issue