From 23d0c1a0c0e324420e2b0a82d57740a0be9210ff Mon Sep 17 00:00:00 2001 From: ACA4DFA4 <29880332+ACA4DFA4@users.noreply.github.com> Date: Wed, 26 Aug 2026 03:54:44 +0800 Subject: [PATCH] thecl: restore pre-th10 jump displacement regression Pre-th9 ECL jump targets ('o' params) are displacements relative to the emitting instruction, matching ZUN's originals and thtk's own dumper (sub_name + instr->offset + value). f0190b2 originally wrote the correct term, but the serializer rewrite in 5ad773c dropped the '- instr->offset', so every jump/loop compiled for th06-th08 landed at an absolute sub offset instead; timelines (no 'o' params) were unaffected. Restore the lost term. Round-trip audit over all shipped stage scripts: th07 8/8 and th08 24/24 files corrupted before (1462 / 3085 findings); 0 after. --- thecl/thecl06.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thecl/thecl06.c b/thecl/thecl06.c index 7f6bada..7f71d2c 100644 --- a/thecl/thecl06.c +++ b/thecl/thecl06.c @@ -1592,7 +1592,7 @@ th06_serialize_data( case 'o': if (data_size < sizeof(int32_t)) return -1; - *(int32_t*)param_data = label_offset(sub, param->value.val.z); + *(int32_t*)param_data = label_offset(sub, param->value.val.z) - instr->offset; return sizeof(int32_t); case 't': if (data_size < sizeof(int32_t))