mirror of
https://github.com/CPunch/LuaDecompy.git
synced 2024-12-22 20:40:04 +00:00
lp: bug fix (forgot to transfer registers)
This commit is contained in:
parent
19bed999ee
commit
bc4e762e26
@ -71,8 +71,9 @@ R[5]: i
|
||||
==== [[example.lua's pseudo-code]] ====
|
||||
|
||||
local tbl = {"He", "llo", " ", "Wo", "rld", "!", }
|
||||
local str = ""
|
||||
for i = 1, #tbl, 1 do
|
||||
local str = str .. tbl[i]
|
||||
str = str .. tbl[i]
|
||||
end
|
||||
print(str)
|
||||
|
||||
|
@ -207,7 +207,6 @@ class LuaDecomp:
|
||||
|
||||
self.__endStatement()
|
||||
|
||||
|
||||
# =====================================[[ Instructions ]]======================================
|
||||
|
||||
def __emitOperand(self, a: int, b: str, c: str, op: str) -> None:
|
||||
@ -268,7 +267,7 @@ class LuaDecomp:
|
||||
tblOps = [Opcodes.LOADK, Opcodes.SETLIST]
|
||||
|
||||
instr = self.__getNextInstr()
|
||||
cachedRegs = self.top
|
||||
cachedRegs = {}
|
||||
tbl = "{"
|
||||
while instr.opcode in tblOps:
|
||||
if instr.opcode == Opcodes.LOADK: # operate on registers
|
||||
@ -278,6 +277,7 @@ class LuaDecomp:
|
||||
|
||||
for i in range(numElems):
|
||||
tbl += "%s, " % cachedRegs[instr.A + i + 1]
|
||||
del cachedRegs[instr.A + i + 1]
|
||||
|
||||
self.pc += 1
|
||||
instr = self.__getNextInstr()
|
||||
@ -289,6 +289,10 @@ class LuaDecomp:
|
||||
self.__setReg(indx, tbl, forceLocal=True)
|
||||
self.__endStatement()
|
||||
|
||||
# if we have leftovers... oops, set those
|
||||
for i, v in cachedRegs.items():
|
||||
self.__setReg(i, v)
|
||||
|
||||
def parseInstr(self):
|
||||
instr = self.__getCurrInstr()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user