From 5500df803d8475ee187b05a76cc08c09ec909c3d Mon Sep 17 00:00:00 2001 From: DerelictDrone Date: Mon, 11 Dec 2023 01:27:16 -0600 Subject: [PATCH 1/2] MLOOKAT and DWRITEFMT fixed --- lua/entities/gmod_wire_gpu/cl_gpuvm.lua | 8 ++++---- lua/wire/zvm/zvm_opcodes.lua | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/entities/gmod_wire_gpu/cl_gpuvm.lua b/lua/entities/gmod_wire_gpu/cl_gpuvm.lua index a630e4c..67d3c0b 100644 --- a/lua/entities/gmod_wire_gpu/cl_gpuvm.lua +++ b/lua/entities/gmod_wire_gpu/cl_gpuvm.lua @@ -2039,7 +2039,7 @@ VM.OpcodeTable[246] = function(self) --DWRITEFMT string.format( self:Dyn_Emit("text = string.sub(text,2,65536)") self:Dyn_Emit("if (inparam == false) then") - self:Dyn_Emit("if (chr == \"%\") then") + self:Dyn_Emit("if (chr == \"%%%%\") then") self:Dyn_Emit("inparam = true") self:Dyn_Emit("else") self:Dyn_Emit("finaltext = finaltext .. chr") @@ -2091,13 +2091,13 @@ VM.OpcodeTable[246] = function(self) --DWRITEFMT string.format( self:Dyn_Emit("inparam = false") self:Dyn_Emit("lengthmod = nil") self:Dyn_Emit("elseif (chr == \"t\") then") - self:Dyn_Emit("while (string.len(finaltext) % (lengthmod or 6) != 0) do") + self:Dyn_Emit("while (math.mod(string.len(finaltext),(lengthmod or 6)) != 0) do") self:Dyn_Emit("finaltext = finaltext..\" \"") self:Dyn_Emit("end") self:Dyn_Emit("inparam = false") self:Dyn_Emit("lengthmod = nil") - self:Dyn_Emit("elseif (chr == \"%\") then") - self:Dyn_Emit("finaltext = finaltext .. \"%\"") + self:Dyn_Emit("elseif (chr == \"%%%%\") then") + self:Dyn_Emit("finaltext = finaltext .. \"%%%%\"") self:Dyn_Emit("inparam = false") self:Dyn_Emit("lengthmod = nil") self:Dyn_Emit("end") diff --git a/lua/wire/zvm/zvm_opcodes.lua b/lua/wire/zvm/zvm_opcodes.lua index ad8a235..b912b30 100644 --- a/lua/wire/zvm/zvm_opcodes.lua +++ b/lua/wire/zvm/zvm_opcodes.lua @@ -1576,9 +1576,9 @@ end ZVM.OpcodeTable[267] = function(self) --MLOOKAT local seg1code = self.EmitOperandSegment[1] and "0" or "VM.DS" local seg2code = self.EmitOperandSegment[2] and "0" or "VM.DS" - self:Dyn_Emit("$L EYE = VM:ReadVector3f($2 + %s+0",seg2code) - self:Dyn_Emit("$L CENTER = VM:ReadVector3f($2 + %s+3",seg2code) - self:Dyn_Emit("$L UP = VM:ReadVector3f($2 + %s+6",seg2code) + self:Dyn_Emit("$L EYE = VM:ReadVector3f($2 + VM."..(self.EmitOperandSegment[2] or "DS").."+0)") + self:Dyn_Emit("$L CENTER = VM:ReadVector3f($2 + VM."..(self.EmitOperandSegment[2] or "DS").."+3)") + self:Dyn_Emit("$L UP = VM:ReadVector3f($2 + VM."..(self.EmitOperandSegment[2] or "DS").."+6)") self:Dyn_EmitInterruptCheck() self:Dyn_Emit("$L X = { 0, 0, 0 }") From ad35e56a39789141481ccab1ce5411307589e3b7 Mon Sep 17 00:00:00 2001 From: DerelictDrone Date: Mon, 11 Dec 2023 04:52:27 -0600 Subject: [PATCH 2/2] Update zvm_opcodes.lua --- lua/wire/zvm/zvm_opcodes.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/wire/zvm/zvm_opcodes.lua b/lua/wire/zvm/zvm_opcodes.lua index b912b30..2c5d4f0 100644 --- a/lua/wire/zvm/zvm_opcodes.lua +++ b/lua/wire/zvm/zvm_opcodes.lua @@ -1576,9 +1576,9 @@ end ZVM.OpcodeTable[267] = function(self) --MLOOKAT local seg1code = self.EmitOperandSegment[1] and "0" or "VM.DS" local seg2code = self.EmitOperandSegment[2] and "0" or "VM.DS" - self:Dyn_Emit("$L EYE = VM:ReadVector3f($2 + VM."..(self.EmitOperandSegment[2] or "DS").."+0)") - self:Dyn_Emit("$L CENTER = VM:ReadVector3f($2 + VM."..(self.EmitOperandSegment[2] or "DS").."+3)") - self:Dyn_Emit("$L UP = VM:ReadVector3f($2 + VM."..(self.EmitOperandSegment[2] or "DS").."+6)") + self:Dyn_Emit("$L EYE = VM:ReadVector3f($2 + %s+0)",seg2code) + self:Dyn_Emit("$L CENTER = VM:ReadVector3f($2 + %s+3)",seg2code) + self:Dyn_Emit("$L UP = VM:ReadVector3f($2 + %s+6)",seg2code) self:Dyn_EmitInterruptCheck() self:Dyn_Emit("$L X = { 0, 0, 0 }")