mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 12:31:10 +00:00
[util] Support utf-8 strings in Sys_Printf
By default. Conversion of quake strings needs to be requested (which is done by nq and qw clients and servers, as well as qfprogs via an option). I got tired of seeing mangled source code in the disassembly.
This commit is contained in:
parent
30f2abb0ad
commit
8ff2c5a747
6 changed files with 18 additions and 7 deletions
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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 ();
|
||||
|
|
|
@ -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 ();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue