mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-19 21:10:19 -07:00
Renamed ClientScript decoding
This commit is contained in:
parent
3f08a87a20
commit
cf9639ea79
3 changed files with 59 additions and 61 deletions
|
|
@ -7,25 +7,25 @@ import org.openrs2.deob.annotation.OriginalMember;
|
||||||
public final class ClientScript extends SecondaryNode {
|
public final class ClientScript extends SecondaryNode {
|
||||||
|
|
||||||
@OriginalMember(owner = "client!qc", name = "I", descriptor = "I")
|
@OriginalMember(owner = "client!qc", name = "I", descriptor = "I")
|
||||||
public int anInt4665;
|
public int intArgs;
|
||||||
|
|
||||||
@OriginalMember(owner = "client!qc", name = "L", descriptor = "I")
|
@OriginalMember(owner = "client!qc", name = "L", descriptor = "I")
|
||||||
public int anInt4667;
|
public int intLocals;
|
||||||
|
|
||||||
@OriginalMember(owner = "client!qc", name = "N", descriptor = "I")
|
@OriginalMember(owner = "client!qc", name = "N", descriptor = "I")
|
||||||
public int anInt4669;
|
public int stringArgs;
|
||||||
|
|
||||||
@OriginalMember(owner = "client!qc", name = "O", descriptor = "[I")
|
@OriginalMember(owner = "client!qc", name = "O", descriptor = "[I")
|
||||||
public int[] opcodes;
|
public int[] opcodes;
|
||||||
|
|
||||||
@OriginalMember(owner = "client!qc", name = "Q", descriptor = "[Lclient!sc;")
|
@OriginalMember(owner = "client!qc", name = "Q", descriptor = "[Lclient!sc;")
|
||||||
public HashTable[] aClass133Array1;
|
public HashTable[] switchTables;
|
||||||
|
|
||||||
@OriginalMember(owner = "client!qc", name = "R", descriptor = "Lclient!na;")
|
@OriginalMember(owner = "client!qc", name = "R", descriptor = "Lclient!na;")
|
||||||
public JagString name;
|
public JagString name;
|
||||||
|
|
||||||
@OriginalMember(owner = "client!qc", name = "S", descriptor = "I")
|
@OriginalMember(owner = "client!qc", name = "S", descriptor = "I")
|
||||||
public int anInt4671;
|
public int stringLocals;
|
||||||
|
|
||||||
@OriginalMember(owner = "client!qc", name = "T", descriptor = "[Lclient!na;")
|
@OriginalMember(owner = "client!qc", name = "T", descriptor = "[Lclient!na;")
|
||||||
public JagString[] stringOperands;
|
public JagString[] stringOperands;
|
||||||
|
|
|
||||||
|
|
@ -10,59 +10,57 @@ public class ClientScriptList {
|
||||||
|
|
||||||
@OriginalMember(owner = "client!hc", name = "a", descriptor = "(IB)Lclient!qc;")
|
@OriginalMember(owner = "client!hc", name = "a", descriptor = "(IB)Lclient!qc;")
|
||||||
public static ClientScript get(@OriginalArg(0) int id) {
|
public static ClientScript get(@OriginalArg(0) int id) {
|
||||||
@Pc(12) ClientScript local12 = (ClientScript) scripts.get((long) id);
|
@Pc(12) ClientScript script = (ClientScript) scripts.get(id);
|
||||||
if (local12 != null) {
|
if (script != null) {
|
||||||
return local12;
|
return script;
|
||||||
}
|
}
|
||||||
@Pc(22) byte[] local22 = client.js5Archive12.fetchFile(id, 0);
|
@Pc(22) byte[] bytes = client.js5Archive12.fetchFile(id, 0);
|
||||||
if (local22 == null) {
|
if (bytes == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
local12 = new ClientScript();
|
script = new ClientScript();
|
||||||
@Pc(42) Buffer local42 = new Buffer(local22);
|
@Pc(42) Buffer buffer = new Buffer(bytes);
|
||||||
local42.offset = local42.data.length - 2;
|
buffer.offset = buffer.data.length - 2;
|
||||||
@Pc(53) int local53 = local42.g2();
|
@Pc(53) int trailerLen = buffer.g2();
|
||||||
@Pc(63) int local63 = local42.data.length - local53 - 12 - 2;
|
@Pc(63) int trailerPos = buffer.data.length - trailerLen - 12 - 2;
|
||||||
local42.offset = local63;
|
buffer.offset = trailerPos;
|
||||||
@Pc(70) int local70 = local42.g4();
|
@Pc(70) int instructions = buffer.g4();
|
||||||
local12.anInt4667 = local42.g2();
|
script.intLocals = buffer.g2();
|
||||||
local12.anInt4671 = local42.g2();
|
script.stringLocals = buffer.g2();
|
||||||
local12.anInt4665 = local42.g2();
|
script.intArgs = buffer.g2();
|
||||||
local12.anInt4669 = local42.g2();
|
script.stringArgs = buffer.g2();
|
||||||
@Pc(98) int local98 = local42.g1();
|
@Pc(98) int switches = buffer.g1();
|
||||||
@Pc(107) int local107;
|
if (switches > 0) {
|
||||||
@Pc(114) int local114;
|
script.switchTables = new HashTable[switches];
|
||||||
if (local98 > 0) {
|
for (int i = 0; i < switches; i++) {
|
||||||
local12.aClass133Array1 = new HashTable[local98];
|
int cases = buffer.g2();
|
||||||
for (local107 = 0; local107 < local98; local107++) {
|
@Pc(121) HashTable table = new HashTable(IntUtils.clp2(cases));
|
||||||
local114 = local42.g2();
|
script.switchTables[i] = table;
|
||||||
@Pc(121) HashTable local121 = new HashTable(IntUtils.clp2(local114));
|
while (cases-- > 0) {
|
||||||
local12.aClass133Array1[local107] = local121;
|
@Pc(136) int value = buffer.g4();
|
||||||
while (local114-- > 0) {
|
@Pc(140) int offset = buffer.g4();
|
||||||
@Pc(136) int local136 = local42.g4();
|
table.put(new IntNode(offset), value);
|
||||||
@Pc(140) int local140 = local42.g4();
|
|
||||||
local121.put(new IntNode(local140), (long) local136);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
local42.offset = 0;
|
buffer.offset = 0;
|
||||||
local12.name = local42.fastgjstr();
|
script.name = buffer.fastgjstr();
|
||||||
local12.opcodes = new int[local70];
|
script.opcodes = new int[instructions];
|
||||||
local12.stringOperands = new JagString[local70];
|
script.stringOperands = new JagString[instructions];
|
||||||
local107 = 0;
|
int i = 0;
|
||||||
local12.intOperands = new int[local70];
|
script.intOperands = new int[instructions];
|
||||||
while (local63 > local42.offset) {
|
while (trailerPos > buffer.offset) {
|
||||||
local114 = local42.g2();
|
int cases = buffer.g2();
|
||||||
if (local114 == 3) {
|
if (cases == 3) {
|
||||||
local12.stringOperands[local107] = local42.gjstr();
|
script.stringOperands[i] = buffer.gjstr();
|
||||||
} else if (local114 >= 100 || local114 == 21 || local114 == 38 || local114 == 39) {
|
} else if (cases >= 100 || cases == 21 || cases == 38 || cases == 39) {
|
||||||
local12.intOperands[local107] = local42.g1();
|
script.intOperands[i] = buffer.g1();
|
||||||
} else {
|
} else {
|
||||||
local12.intOperands[local107] = local42.g4();
|
script.intOperands[i] = buffer.g4();
|
||||||
}
|
}
|
||||||
local12.opcodes[local107++] = local114;
|
script.opcodes[i++] = cases;
|
||||||
}
|
}
|
||||||
scripts.put(local12, (long) id);
|
scripts.put(script, id);
|
||||||
return local12;
|
return script;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -385,9 +385,9 @@ public final class ScriptRunner {
|
||||||
@Pc(44) byte op = -1;
|
@Pc(44) byte op = -1;
|
||||||
@Pc(58) int cycles;
|
@Pc(58) int cycles;
|
||||||
try {
|
try {
|
||||||
intLocals = new int[script.anInt4667];
|
intLocals = new int[script.intLocals];
|
||||||
@Pc(50) int intLocalIndex = 0;
|
@Pc(50) int intLocalIndex = 0;
|
||||||
stringLocals = new JagString[script.anInt4671];
|
stringLocals = new JagString[script.stringLocals];
|
||||||
@Pc(56) int stringLocalIndex = 0;
|
@Pc(56) int stringLocalIndex = 0;
|
||||||
@Pc(77) int id;
|
@Pc(77) int id;
|
||||||
@Pc(194) JagString value;
|
@Pc(194) JagString value;
|
||||||
|
|
@ -571,16 +571,16 @@ public final class ScriptRunner {
|
||||||
if (opcode == 40) {
|
if (opcode == 40) {
|
||||||
id = intOperands[pc];
|
id = intOperands[pc];
|
||||||
@Pc(642) ClientScript local642 = ClientScriptList.get(id);
|
@Pc(642) ClientScript local642 = ClientScriptList.get(id);
|
||||||
@Pc(646) int[] local646 = new int[local642.anInt4667];
|
@Pc(646) int[] local646 = new int[local642.intLocals];
|
||||||
@Pc(650) JagString[] local650 = new JagString[local642.anInt4671];
|
@Pc(650) JagString[] local650 = new JagString[local642.stringLocals];
|
||||||
for (local652 = 0; local652 < local642.anInt4665; local652++) {
|
for (local652 = 0; local652 < local642.intArgs; local652++) {
|
||||||
local646[local652] = intStack[local652 + isp - local642.anInt4665];
|
local646[local652] = intStack[local652 + isp - local642.intArgs];
|
||||||
}
|
}
|
||||||
for (local652 = 0; local652 < local642.anInt4669; local652++) {
|
for (local652 = 0; local652 < local642.stringArgs; local652++) {
|
||||||
local650[local652] = stringStack[local652 + ssp - local642.anInt4669];
|
local650[local652] = stringStack[local652 + ssp - local642.stringArgs];
|
||||||
}
|
}
|
||||||
isp -= local642.anInt4665;
|
isp -= local642.intArgs;
|
||||||
ssp -= local642.anInt4669;
|
ssp -= local642.stringArgs;
|
||||||
@Pc(705) GoSubFrame local705 = new GoSubFrame();
|
@Pc(705) GoSubFrame local705 = new GoSubFrame();
|
||||||
local705.stringLocals = stringLocals;
|
local705.stringLocals = stringLocals;
|
||||||
local705.intLocals = intLocals;
|
local705.intLocals = intLocals;
|
||||||
|
|
@ -667,7 +667,7 @@ public final class ScriptRunner {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (opcode == 51) {
|
if (opcode == 51) {
|
||||||
@Pc(992) HashTable local992 = script.aClass133Array1[intOperands[pc]];
|
@Pc(992) HashTable local992 = script.switchTables[intOperands[pc]];
|
||||||
isp--;
|
isp--;
|
||||||
@Pc(1002) IntNode local1002 = (IntNode) local992.get((long) intStack[isp]);
|
@Pc(1002) IntNode local1002 = (IntNode) local992.get((long) intStack[isp]);
|
||||||
if (local1002 != null) {
|
if (local1002 != null) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue