diff --git a/libs/gamecode/opcodes.py b/libs/gamecode/opcodes.py index b9c316a1d..bf8993ee1 100644 --- a/libs/gamecode/opcodes.py +++ b/libs/gamecode/opcodes.py @@ -511,7 +511,7 @@ swizzle_formats = { "opcode": "OP_SWIZZLE_{swiz_type[t]}", "mnemonic": "swizzle.{swiz_type[t]}", "opname": "swizzle", - "format": "%Ga %sb %gc", + "format": "%Ga.%Sb %gc", "widths": "4, 0, 4", "types": "{swizzle_types[t]}", "args": { diff --git a/libs/gamecode/pr_debug.c b/libs/gamecode/pr_debug.c index ad0fca7e8..d77a46952 100644 --- a/libs/gamecode/pr_debug.c +++ b/libs/gamecode/pr_debug.c @@ -1182,6 +1182,26 @@ global_string (pr_debug_data_t *data, pr_ptr_t offset, qfot_type_t *type, return dstr->str; } +static const char * +swizzle_string (pr_debug_data_t *data, pr_uint_t swiz) +{ + progs_t *pr = data->pr; + prdeb_resources_t *res = pr->pr_debug_resources; + static char swizzle_components[] = "xyzw"; + const char *swizzle = ""; + + for (int i = 0; i < 4; i++) { + if (swiz & (0x1000 << i)) { + swizzle = va (res->va, "%s0", swizzle); + } else { + swizzle = va (res->va, "%s%s%c", swizzle, + swiz & (0x100 << i) ? "-" : "", + swizzle_components[(swiz >> 2 * i) & 3]); + } + } + return swizzle; +} + const char * PR_Debug_ValueString (progs_t *pr, pr_ptr_t offset, qfot_type_t *type, dstring_t *dstr) @@ -1806,6 +1826,9 @@ PR_PrintStatement (progs_t *pr, dstatement_t *s, int contents) case 's': str = dsprintf (res->dva, "%d", (short) opval); break; + case 'S': + str = swizzle_string (&data, opval); + break; case 'O': str = dsprintf (res->dva, "%04x", addr + (short) opval);