diff --git a/include/QF/sys.h b/include/QF/sys.h index ede903389..c2a6cd30b 100644 --- a/include/QF/sys.h +++ b/include/QF/sys.h @@ -47,7 +47,7 @@ extern int sys_sleep; extern int developer; - +extern bool sys_quake_encoding; extern const char sys_char_map[256]; typedef struct date_s { diff --git a/libs/util/sys.c b/libs/util/sys.c index 2ae275748..cc0dc45ff 100644 --- a/libs/util/sys.c +++ b/libs/util/sys.c @@ -164,6 +164,7 @@ bool stdin_ready; #endif /* The translation table between the graphical font and plain ASCII --KB */ +VISIBLE bool sys_quake_encoding; VISIBLE const char sys_char_map[256] = { 0, '#', '#', '#', '#', '.', '#', '#', '#', 9, 10, '#', ' ', 13, '.', '.', @@ -200,9 +201,6 @@ VISIBLE const char sys_char_map[256] = { 'x', 'y', 'z', '{', '|', '}', '~', '<' }; -#define MAXPRINTMSG 4096 - - #ifndef USE_INTEL_ASM void Sys_MaskFPUExceptions (void) @@ -319,9 +317,13 @@ Sys_Print (FILE *stream, const char *fmt, va_list args) fputs ("Fatal Error: ", stream); } - /* translate to ASCII instead of printing [xx] --KB */ - for (p = (unsigned char *) sys_print_msg->str; *p; p++) - putc (sys_char_map[*p], stream); + if (sys_quake_encoding) { + /* translate to ASCII instead of printing [xx] --KB */ + for (p = (unsigned char *) sys_print_msg->str; *p; p++) + putc (sys_char_map[*p], stream); + } else { + fputs (sys_print_msg->str, stream); + } if (stream == stderr) { fputs ("\n", stream); diff --git a/nq/source/host.c b/nq/source/host.c index f155d2699..1ddbc04b3 100644 --- a/nq/source/host.c +++ b/nq/source/host.c @@ -904,6 +904,7 @@ Host_ExecConfig (cbuf_t *cbuf, int skip_quakerc) void Host_Init (void) { + sys_quake_encoding = true; Sys_RegisterShutdown (Host_Shutdown, 0); Sys_Printf ("Host_Init\n"); diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index d5f8a049c..d1212bada 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -2052,6 +2052,7 @@ Host_Init (void) cl_cbuf = Cbuf_New (&id_interp); cl_stbuf = Cbuf_New (&id_interp); + sys_quake_encoding = true; Sys_Init (); GIB_Init (true); GIB_Key_Init (); diff --git a/qw/source/sv_main.c b/qw/source/sv_main.c index 5b43bfbad..5753c094a 100644 --- a/qw/source/sv_main.c +++ b/qw/source/sv_main.c @@ -2663,6 +2663,7 @@ SV_Init (void) sv_cbuf = Cbuf_New (&id_interp); sv_args = Cbuf_ArgsNew (); + sys_quake_encoding = true; Sys_RegisterShutdown (SV_Shutdown, 0); Sys_Init (); diff --git a/tools/qfcc/source/qfprogs.c b/tools/qfcc/source/qfprogs.c index 3b8a62581..b9d9e2dbe 100644 --- a/tools/qfcc/source/qfprogs.c +++ b/tools/qfcc/source/qfprogs.c @@ -102,6 +102,7 @@ static const struct option long_options[] = { {"modules", no_argument, 0, 'M'}, {"numeric", no_argument, 0, 'n'}, {"path", required_argument, 0, 'P'}, + {"quake", no_argument, 0, 'Q'}, {"relocs", no_argument, 0, 'r'}, {"strings", no_argument, 0, 's'}, {"types", no_argument, 0, 't'}, @@ -119,6 +120,7 @@ static const char *short_options = "M" // modules "n" // numeric "P:" // path + "Q" // quake "r" // relocs "s" // strings "t" // types @@ -150,6 +152,7 @@ usage (int status) " -M, --modules Dump Objective-QuakeC data.\n" " -n, --numeric Sort globals by address.\n" " -P, --path DIR Source path.\n" +" -Q, --quake Expect quake encoding instead of utf-8.\n" " -r, --relocs Dump reloc information.\n" " -s, --strings Dump static strings.\n" " -t, --types Dump type encodings.\n" @@ -354,6 +357,9 @@ main (int argc, char **argv) case 'P': source_path = strdup (optarg); break; + case 'Q': + sys_quake_encoding = true; + break; case 'r': func = &operations[7]; break;