particle: fix tail texcoords and transformVec4 input size

Tail vertices V0/V1 read texture U/V from wrong addresses (no offset
from base instead of +8/+16 stride). Assembly reads 0x87D734/738 for
V0 and 0x87D73C/740 for V1, not the base 0x87D72C/730. This made both
base vertices share UVs, collapsing the texture and causing light beams
to taper to a point instead of maintaining width.

Also fix transformVec4 input: must be [4]f32 with w=0.0, not [3]f32.
The function reads all 4 components including [EDX+0xC]. Reading past
a 3-element array produced garbage w values that corrupted the velocity
transform, causing tail particles to extend wildly.

Fixed in both SSE and reference implementations.
This commit is contained in:
MarcelineVQ
2026-03-24 22:01:32 -07:00
parent 9a3e06a7cc
commit e78ebfd74d
4 changed files with 17 additions and 53 deletions
+3 -20
View File
@@ -131,29 +131,12 @@ pub fn dumpStats() void {
fallback_count = 0;
}
pub fn install(logger: logging.Logger) bool {
log = logger;
// Sanity test
pub fn install() bool {
const test_decomp = libdeflate_alloc_decompressor();
if (test_decomp == null) {
log.print("inflate_hook: alloc failed\n");
return false;
}
const test_in = [_]u8{ 0x78, 0x9C, 0xCB, 0x48, 0xCD, 0xC9, 0xC9, 0x07, 0x00, 0x06, 0x2C, 0x02, 0x15 };
var test_out: [64]u8 = undefined;
var test_len: usize = 0;
const test_ret = libdeflate_zlib_decompress(test_decomp, &test_in, test_in.len, &test_out, 64, &test_len);
log.fmt("inflate_hook: sanity ret={d} len={d} data='{s}'\n", .{ test_ret, test_len, test_out[0..@min(test_len, 32)] });
if (test_decomp == null) return false;
libdeflate_free_decompressor(test_decomp);
lib_available = true;
if (decompress_hook.attach(0x661A80, &decompressDetour) == .ok) {
log.print("inflate_hook: hooked (libdeflate tls-cached, 2.2x speedup)\n");
return true;
}
return false;
return decompress_hook.attach(0x661A80, &decompressDetour) == .ok;
}
pub fn remove() void {