Renamed IdkType opcodes to match original naming

This commit is contained in:
Pazaz 2022-07-22 09:50:41 -04:00
parent 6b361daa4c
commit e75dfaf684
3 changed files with 103 additions and 98 deletions

View file

@ -9,152 +9,153 @@ import org.openrs2.deob.annotation.Pc;
public final class IdkType {
@OriginalMember(owner = "client!dm", name = "b", descriptor = "[S")
private short[] recolorDestination;
private short[] recol_d;
@OriginalMember(owner = "client!dm", name = "i", descriptor = "[S")
private short[] recolorSource;
private short[] recol_s;
@OriginalMember(owner = "client!dm", name = "s", descriptor = "[S")
private short[] retextureDestination;
private short[] retex_d;
@OriginalMember(owner = "client!dm", name = "t", descriptor = "[S")
private short[] retextureSource;
private short[] retex_s;
@OriginalMember(owner = "client!dm", name = "w", descriptor = "[I")
private int[] bodyModels;
private int[] model;
@OriginalMember(owner = "client!dm", name = "x", descriptor = "[I")
private final int[] headModels = new int[]{-1, -1, -1, -1, -1};
private final int[] head = new int[]{-1, -1, -1, -1, -1};
@OriginalMember(owner = "client!dm", name = "k", descriptor = "I")
public int feature = -1;
@OriginalMember(owner = "client!dm", name = "A", descriptor = "Z")
public boolean aBoolean85 = false;
public boolean disable = false;
@OriginalMember(owner = "client!dm", name = "a", descriptor = "(Z)Lclient!gb;")
public final RawModel getHeadModel() {
@Pc(13) int local13 = 0;
@Pc(16) RawModel[] local16 = new RawModel[5];
for (@Pc(18) int local18 = 0; local18 < 5; local18++) {
if (this.headModels[local18] != -1) {
local16[local13++] = RawModel.create(IdkTypeList.modelsArchive, this.headModels[local18]);
public RawModel getHeadModel() {
@Pc(13) int modelCount = 0;
@Pc(16) RawModel[] models = new RawModel[5];
for (@Pc(18) int i = 0; i < 5; i++) {
if (this.head[i] != -1) {
models[modelCount++] = RawModel.create(IdkTypeList.modelsArchive, this.head[i]);
}
}
@Pc(52) RawModel local52 = new RawModel(local16, local13);
@Pc(58) int local58;
if (this.recolorSource != null) {
for (local58 = 0; local58 < this.recolorSource.length; local58++) {
local52.recolor(this.recolorSource[local58], this.recolorDestination[local58]);
@Pc(52) RawModel model = new RawModel(models, modelCount);
@Pc(58) int i;
if (this.recol_s != null) {
for (i = 0; i < this.recol_s.length; i++) {
model.recolor(this.recol_s[i], this.recol_d[i]);
}
}
if (this.retextureSource != null) {
for (local58 = 0; local58 < this.retextureSource.length; local58++) {
local52.retexture(this.retextureSource[local58], this.retextureDestination[local58]);
if (this.retex_s != null) {
for (i = 0; i < this.retex_s.length; i++) {
model.retexture(this.retex_s[i], this.retex_d[i]);
}
}
return local52;
return model;
}
@OriginalMember(owner = "client!dm", name = "a", descriptor = "(I)Z")
public final boolean isBodyModelReady() {
if (this.bodyModels == null) {
public boolean isBodyModelReady() {
if (this.model == null) {
return true;
}
@Pc(13) boolean local13 = true;
for (@Pc(22) int local22 = 0; local22 < this.bodyModels.length; local22++) {
if (!IdkTypeList.modelsArchive.isFileReady(0, this.bodyModels[local22])) {
local13 = false;
@Pc(13) boolean ready = true;
for (@Pc(22) int i = 0; i < this.model.length; i++) {
if (!IdkTypeList.modelsArchive.isFileReady(0, this.model[i])) {
ready = false;
}
}
return local13;
return ready;
}
@OriginalMember(owner = "client!dm", name = "a", descriptor = "(BLclient!wa;I)V")
private void decode(@OriginalArg(1) Buffer arg0, @OriginalArg(2) int arg1) {
if (arg1 == 1) {
this.feature = arg0.g1();
private void decode(@OriginalArg(1) Buffer buffer, @OriginalArg(2) int opcode) {
if (opcode == 1) {
this.feature = buffer.g1();
return;
}
@Pc(22) int local22;
@Pc(28) int local28;
if (arg1 == 2) {
local22 = arg0.g1();
this.bodyModels = new int[local22];
for (local28 = 0; local28 < local22; local28++) {
this.bodyModels[local28] = arg0.g2();
@Pc(22) int count;
@Pc(28) int i;
if (opcode == 2) {
count = buffer.g1();
this.model = new int[count];
for (i = 0; i < count; i++) {
this.model[i] = buffer.g2();
}
} else if (arg1 == 3) {
this.aBoolean85 = true;
} else if (arg1 == 40) {
local22 = arg0.g1();
this.recolorDestination = new short[local22];
this.recolorSource = new short[local22];
for (local28 = 0; local28 < local22; local28++) {
this.recolorSource[local28] = (short) arg0.g2();
this.recolorDestination[local28] = (short) arg0.g2();
} else if (opcode == 3) {
this.disable = true;
} else if (opcode == 40) {
count = buffer.g1();
this.recol_d = new short[count];
this.recol_s = new short[count];
for (i = 0; i < count; i++) {
this.recol_s[i] = (short) buffer.g2();
this.recol_d[i] = (short) buffer.g2();
}
} else if (arg1 == 41) {
local22 = arg0.g1();
this.retextureSource = new short[local22];
this.retextureDestination = new short[local22];
for (local28 = 0; local28 < local22; local28++) {
this.retextureSource[local28] = (short) arg0.g2();
this.retextureDestination[local28] = (short) arg0.g2();
} else if (opcode == 41) {
count = buffer.g1();
this.retex_s = new short[count];
this.retex_d = new short[count];
for (i = 0; i < count; i++) {
this.retex_s[i] = (short) buffer.g2();
this.retex_d[i] = (short) buffer.g2();
}
} else if (arg1 >= 60 && arg1 < 70) {
this.headModels[arg1 - 60] = arg0.g2();
} else if (opcode >= 60 && opcode < 70) {
this.head[opcode - 60] = buffer.g2();
}
}
@OriginalMember(owner = "client!dm", name = "b", descriptor = "(B)Lclient!gb;")
public final RawModel getBodyModel() {
if (this.bodyModels == null) {
public RawModel getBodyModel() {
if (this.model == null) {
return null;
}
@Pc(16) RawModel[] local16 = new RawModel[this.bodyModels.length];
for (@Pc(18) int local18 = 0; local18 < this.bodyModels.length; local18++) {
local16[local18] = RawModel.create(IdkTypeList.modelsArchive, this.bodyModels[local18]);
@Pc(16) RawModel[] models = new RawModel[this.model.length];
for (@Pc(18) int i = 0; i < this.model.length; i++) {
models[i] = RawModel.create(IdkTypeList.modelsArchive, this.model[i]);
}
@Pc(56) RawModel local56;
if (local16.length == 1) {
local56 = local16[0];
@Pc(56) RawModel model;
if (models.length == 1) {
model = models[0];
} else {
local56 = new RawModel(local16, local16.length);
model = new RawModel(models, models.length);
}
@Pc(70) int local70;
if (this.recolorSource != null) {
for (local70 = 0; local70 < this.recolorSource.length; local70++) {
local56.recolor(this.recolorSource[local70], this.recolorDestination[local70]);
@Pc(70) int i;
if (this.recol_s != null) {
for (i = 0; i < this.recol_s.length; i++) {
model.recolor(this.recol_s[i], this.recol_d[i]);
}
}
if (this.retextureSource != null) {
for (local70 = 0; local70 < this.retextureSource.length; local70++) {
local56.retexture(this.retextureSource[local70], this.retextureDestination[local70]);
if (this.retex_s != null) {
for (i = 0; i < this.retex_s.length; i++) {
model.retexture(this.retex_s[i], this.retex_d[i]);
}
}
return local56;
return model;
}
@OriginalMember(owner = "client!dm", name = "c", descriptor = "(I)Z")
public final boolean isHeadModelReady() {
@Pc(3) boolean local3 = true;
for (@Pc(12) int local12 = 0; local12 < 5; local12++) {
if (this.headModels[local12] != -1 && !IdkTypeList.modelsArchive.isFileReady(0, this.headModels[local12])) {
local3 = false;
public boolean isHeadModelReady() {
@Pc(3) boolean ready = true;
for (@Pc(12) int i = 0; i < 5; i++) {
if (this.head[i] != -1 && !IdkTypeList.modelsArchive.isFileReady(0, this.head[i])) {
ready = false;
}
}
return local3;
return ready;
}
@OriginalMember(owner = "client!dm", name = "a", descriptor = "(ILclient!wa;)V")
public final void decode(@OriginalArg(1) Buffer arg0) {
public void decode(@OriginalArg(1) Buffer buffer) {
while (true) {
@Pc(13) int local13 = arg0.g1();
if (local13 == 0) {
@Pc(13) int opcode = buffer.g1();
if (opcode == 0) {
return;
}
this.decode(arg0, local13);
this.decode(buffer, opcode);
}
}
}

View file

@ -5,35 +5,39 @@ import org.openrs2.deob.annotation.OriginalMember;
import org.openrs2.deob.annotation.Pc;
public class IdkTypeList {
@OriginalMember(owner = "client!fe", name = "jb", descriptor = "Lclient!n;")
public static final SoftLruHashTable types = new SoftLruHashTable(64);
@OriginalMember(owner = "client!bd", name = "g", descriptor = "Lclient!ve;")
public static Js5 modelsArchive;
@OriginalMember(owner = "client!ri", name = "c", descriptor = "Lclient!ve;")
public static Js5 archive;
@OriginalMember(owner = "client!ec", name = "z", descriptor = "I")
public static int anInt1716;
public static int count;
@OriginalMember(owner = "client!jl", name = "a", descriptor = "(ILclient!ve;Lclient!ve;)V")
public static void init(@OriginalArg(1) Js5 arg0, @OriginalArg(2) Js5 arg1) {
modelsArchive = arg0;
archive = arg1;
anInt1716 = archive.getGroupCapacity(3);
count = archive.getGroupCapacity(3);
}
@OriginalMember(owner = "client!gg", name = "d", descriptor = "(II)Lclient!dm;")
public static IdkType get(@OriginalArg(0) int arg0) {
@Pc(10) IdkType local10 = (IdkType) types.get(arg0);
if (local10 != null) {
return local10;
public static IdkType get(@OriginalArg(0) int id) {
@Pc(10) IdkType type = (IdkType) types.get(id);
if (type != null) {
return type;
}
@Pc(21) byte[] local21 = archive.fetchFile(3, arg0);
local10 = new IdkType();
if (local21 != null) {
local10.decode(new Buffer(local21));
@Pc(21) byte[] src = archive.fetchFile(3, id);
type = new IdkType();
if (src != null) {
type.decode(new Buffer(src));
}
types.put(local10, arg0);
return local10;
types.put(type, id);
return type;
}
@OriginalMember(owner = "client!oi", name = "a", descriptor = "(I)V")

View file

@ -207,9 +207,9 @@ public final class PlayerAppearance {
if (identikit == null) {
identikit = new int[12];
for (@Pc(24) int i = 0; i < 8; i++) {
for (@Pc(31) int id = 0; id < IdkTypeList.anInt1716; id++) {
for (@Pc(31) int id = 0; id < IdkTypeList.count; id++) {
@Pc(38) IdkType type = IdkTypeList.get(id);
if (type != null && !type.aBoolean85 && type.feature == (female ? FEMALE_FEATURES[i] : MALE_FEATURES[i])) {
if (type != null && !type.disable && type.feature == (female ? FEMALE_FEATURES[i] : MALE_FEATURES[i])) {
identikit[BASE_PART_MAP[i]] = Integer.MIN_VALUE | id;
break;
}