mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-22 11:41:38 +00:00
[gamecode] Decode hops and extend opcodes
This commit is contained in:
parent
91edc5d177
commit
a88d17459f
2 changed files with 38 additions and 2 deletions
|
@ -212,7 +212,7 @@ extend_formats = {
|
|||
"opcode": "OP_EXTEND",
|
||||
"mnemonic": "extend",
|
||||
"opname": "extend",
|
||||
"format": "%Ga %Hb %gc",
|
||||
"format": "%Ga%Xb, %gc",
|
||||
"widths": "-1, 0, -1",
|
||||
"types": "ev_void, ev_short, ev_void",
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ hops_formats = {
|
|||
"opcode": "OP_HOPS",
|
||||
"mnemonic": "hops",
|
||||
"opname": "hops",
|
||||
"format": "%Ga %Hb %gc",
|
||||
"format": "%Ga<%Hb>, %gc",
|
||||
"widths": "-1, 0, 1",
|
||||
"types": "ev_void, ev_short, ev_void",
|
||||
}
|
||||
|
|
|
@ -1182,6 +1182,36 @@ global_string (pr_debug_data_t *data, pr_ptr_t offset, qfot_type_t *type,
|
|||
return dstr->str;
|
||||
}
|
||||
|
||||
static const char *
|
||||
extend_string (pr_debug_data_t *data, pr_uint_t ext)
|
||||
{
|
||||
progs_t *pr = data->pr;
|
||||
prdeb_resources_t *res = pr->pr_debug_resources;
|
||||
static const char *extend_range[] = {
|
||||
"1>2", "1>3", "1>4",
|
||||
"2>3", "2>4", "3>4",
|
||||
"res1", "res2",
|
||||
};
|
||||
static const char *extend_string[] = {
|
||||
"0", "1", "c", "-1",
|
||||
};
|
||||
return va (res->va, "[%s%s:%s]%d",
|
||||
extend_range[ext & 7],
|
||||
ext & 0100 ? ":r" : "",
|
||||
extend_string[(ext >> 3) & 2],
|
||||
32 << ((ext >> 5) & 1));
|
||||
}
|
||||
|
||||
static const char *
|
||||
hop_string (pr_debug_data_t *data, pr_uint_t hop)
|
||||
{
|
||||
static const char *hop_string[] = {
|
||||
"&", "|", "^", "+",
|
||||
"!&", "!|", "!^", "+",
|
||||
};
|
||||
return hop_string[hop & 7];
|
||||
}
|
||||
|
||||
static const char *
|
||||
swizzle_string (pr_debug_data_t *data, pr_uint_t swiz)
|
||||
{
|
||||
|
@ -1826,9 +1856,15 @@ PR_PrintStatement (progs_t *pr, dstatement_t *s, int contents)
|
|||
case 's':
|
||||
str = dsprintf (res->dva, "%d", (short) opval);
|
||||
break;
|
||||
case 'H':
|
||||
str = hop_string (&data, opval);
|
||||
break;
|
||||
case 'S':
|
||||
str = swizzle_string (&data, opval);
|
||||
break;
|
||||
case 'X':
|
||||
str = extend_string (&data, opval);
|
||||
break;
|
||||
case 'O':
|
||||
str = dsprintf (res->dva, "%04x",
|
||||
addr + (short) opval);
|
||||
|
|
Loading…
Reference in a new issue