Merge pull request #2974 from Jonatino/master

rsc: Refactored/exported some fields and methods
This commit is contained in:
ThatGamerBlue
2021-03-26 16:33:32 +00:00
committed by GitHub
18 changed files with 103 additions and 90 deletions

View File

@@ -1188,23 +1188,23 @@ public abstract class AbstractWorldMapIcon {
if (var3 == 4) { // L: 11146
if (var2 == 0) { // L: 11147
class171.method3641(127);
class171.updateSoundEffectVolume(127);
}
if (var2 == 1) { // L: 11148
class171.method3641(96);
class171.updateSoundEffectVolume(96);
}
if (var2 == 2) { // L: 11149
class171.method3641(64);
class171.updateSoundEffectVolume(64);
}
if (var2 == 3) { // L: 11150
class171.method3641(32);
class171.updateSoundEffectVolume(32);
}
if (var2 == 4) { // L: 11151
class171.method3641(0);
class171.updateSoundEffectVolume(0);
}
}
@@ -1270,4 +1270,4 @@ public abstract class AbstractWorldMapIcon {
}
} // L: 11178
}
}

View File

@@ -121,7 +121,7 @@ public class ApproximateRouteStrategy extends RouteStrategy {
return 1; // L: 1758
} else if (var0 == 3205) { // L: 1760
var3 = Math.min(Math.max(Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize], 0), 100); // L: 1761
class171.method3641(Math.round(1.27F * (float)var3)); // L: 1762
class171.updateSoundEffectVolume(Math.round(1.27F * (float)var3)); // L: 1762
return 1; // L: 1763
} else if (var0 == 3206) { // L: 1765
Interpreter.Interpreter_intStack[++Interpreter.Interpreter_intStackSize - 1] = Math.round((float)WorldMapSectionType.clientPreferences.soundEffectsVolume / 1.27F); // L: 1766
@@ -423,4 +423,4 @@ public class ApproximateRouteStrategy extends RouteStrategy {
}
} // L: 11081
}
}

View File

@@ -161,8 +161,8 @@ public class ChatChannel {
MusicPatchNode.worldHost = var0.host; // L: 1555
Client.worldId = var0.id; // L: 1556
Client.worldProperties = var0.properties; // L: 1557
MouseRecorder.port1 = Client.gameBuild == 0 ? 43594 : var0.id + 40000; // L: 1558
class171.port2 = Client.gameBuild == 0 ? 443 : var0.id + 50000; // L: 1559
DynamicObject.port3 = MouseRecorder.port1; // L: 1560
MouseRecorder.worldPort = Client.gameBuild == 0 ? 43594 : var0.id + 40000; // L: 1558
class171.js5Port = Client.gameBuild == 0 ? 443 : var0.id + 50000; // L: 1559
DynamicObject.currentPort = MouseRecorder.worldPort; // L: 1560
} // L: 1561
}
}

View File

@@ -1566,9 +1566,9 @@ public final class Client extends GameEngine implements Usernamed {
@Export("setUp")
protected final void setUp() {
Strings.method4329(new int[]{20, 260, 10000}, new int[]{1000, 100, 500}); // L: 791
MouseRecorder.port1 = gameBuild == 0 ? 43594 : worldId + 40000; // L: 792
class171.port2 = gameBuild == 0 ? 443 : worldId + 50000; // L: 793
DynamicObject.port3 = MouseRecorder.port1; // L: 794
MouseRecorder.worldPort = gameBuild == 0 ? 43594 : worldId + 40000; // L: 792
class171.js5Port = gameBuild == 0 ? 443 : worldId + 50000; // L: 793
DynamicObject.currentPort = MouseRecorder.worldPort; // L: 794
PlayerComposition.field2565 = class224.field2577; // L: 795
class105.field1339 = class224.field2573; // L: 796
HealthBar.field1143 = class224.field2575; // L: 797
@@ -2000,7 +2000,7 @@ public final class Client extends GameEngine implements Usernamed {
byte var9 = 0; // L: 775
try {
Projectile.method2255("oldschool", var8, var9, 21); // L: 777
Projectile.findAndLoadCache("oldschool", var8, var9, 21); // L: 777
} catch (Exception var10) { // L: 779
SequenceDefinition.RunException_sendStackTrace((String)null, var10); // L: 780
}
@@ -2274,7 +2274,7 @@ public final class Client extends GameEngine implements Usernamed {
if (--field761 + 1 <= 0) { // L: 1249
try {
if (js5ConnectState == 0) { // L: 1251
TaskHandler.js5SocketTask = GameEngine.taskHandler.newSocketTask(MusicPatchNode.worldHost, DynamicObject.port3); // L: 1252
TaskHandler.js5SocketTask = GameEngine.taskHandler.newSocketTask(MusicPatchNode.worldHost, DynamicObject.currentPort); // L: 1252
++js5ConnectState; // L: 1253
}
@@ -2401,10 +2401,10 @@ public final class Client extends GameEngine implements Usernamed {
TaskHandler.js5SocketTask = null; // L: 1356
WorldMapArea.js5Socket = null; // L: 1357
js5ConnectState = 0; // L: 1358
if (DynamicObject.port3 == MouseRecorder.port1) { // L: 1359
DynamicObject.port3 = class171.port2;
if (DynamicObject.currentPort == MouseRecorder.worldPort) { // L: 1359
DynamicObject.currentPort = class171.js5Port;
} else {
DynamicObject.port3 = MouseRecorder.port1; // L: 1360
DynamicObject.currentPort = MouseRecorder.worldPort; // L: 1360
}
++js5Errors; // L: 1361
@@ -2462,7 +2462,7 @@ public final class Client extends GameEngine implements Usernamed {
if (loginState == 1) { // L: 1815
if (NetSocket.socketTask == null) { // L: 1816
NetSocket.socketTask = GameEngine.taskHandler.newSocketTask(MusicPatchNode.worldHost, DynamicObject.port3); // L: 1817
NetSocket.socketTask = GameEngine.taskHandler.newSocketTask(MusicPatchNode.worldHost, DynamicObject.currentPort); // L: 1817
}
if (NetSocket.socketTask.status == 2) { // L: 1819
@@ -2908,10 +2908,10 @@ public final class Client extends GameEngine implements Usernamed {
++field696; // L: 2395
if (field696 > 2000) { // L: 2396
if (field786 < 1) { // L: 2397
if (MouseRecorder.port1 == DynamicObject.port3) { // L: 2398
DynamicObject.port3 = class171.port2;
if (MouseRecorder.worldPort == DynamicObject.currentPort) { // L: 2398
DynamicObject.currentPort = class171.js5Port;
} else {
DynamicObject.port3 = MouseRecorder.port1; // L: 2399
DynamicObject.currentPort = MouseRecorder.worldPort; // L: 2399
}
++field786; // L: 2400
@@ -3070,10 +3070,10 @@ public final class Client extends GameEngine implements Usernamed {
}
} catch (IOException var22) { // L: 2408
if (field786 < 1) { // L: 2409
if (MouseRecorder.port1 == DynamicObject.port3) { // L: 2410
DynamicObject.port3 = class171.port2;
if (MouseRecorder.worldPort == DynamicObject.currentPort) { // L: 2410
DynamicObject.currentPort = class171.js5Port;
} else {
DynamicObject.port3 = MouseRecorder.port1; // L: 2411
DynamicObject.currentPort = MouseRecorder.worldPort; // L: 2411
}
++field786; // L: 2412
@@ -5984,4 +5984,4 @@ public final class Client extends GameEngine implements Usernamed {
}
}
}
}
}

View File

@@ -192,7 +192,7 @@ public class ClientPreferences {
if (var1 != null) { // L: 188
return var1;
} else {
var1 = class171.method3642(SequenceDefinition.SequenceDefinition_animationsArchive, SequenceDefinition.SequenceDefinition_skeletonsArchive, var0, false); // L: 189
var1 = class171.loadFrames(SequenceDefinition.SequenceDefinition_animationsArchive, SequenceDefinition.SequenceDefinition_skeletonsArchive, var0, false); // L: 189
if (var1 != null) { // L: 190
SequenceDefinition.SequenceDefinition_cachedFrames.put(var1, (long)var0);
}
@@ -237,4 +237,4 @@ public class ClientPreferences {
}
} // L: 10003
}
}

View File

@@ -31,11 +31,11 @@ public class DesktopPlatformInfoProvider implements PlatformInfoProvider {
@Export("get")
public PlatformInfo get() {
byte var1;
if (GZipDecompressor.field4046.startsWith("win")) { // L: 15
if (GZipDecompressor.formattedOperatingSystemName.startsWith("win")) { // L: 15
var1 = 1;
} else if (GZipDecompressor.field4046.startsWith("mac")) { // L: 16
} else if (GZipDecompressor.formattedOperatingSystemName.startsWith("mac")) { // L: 16
var1 = 2;
} else if (GZipDecompressor.field4046.startsWith("linux")) {
} else if (GZipDecompressor.formattedOperatingSystemName.startsWith("linux")) {
var1 = 3;
} else {
var1 = 4; // L: 18
@@ -210,4 +210,4 @@ public class DesktopPlatformInfoProvider implements PlatformInfoProvider {
public static StudioGame[] method6478() {
return new StudioGame[]{StudioGame.stellardawn, StudioGame.game5, StudioGame.oldscape, StudioGame.game4, StudioGame.runescape, StudioGame.game3}; // L: 17
}
}
}

View File

@@ -16,8 +16,8 @@ public class DynamicObject extends Renderable {
@ObfuscatedGetter(
intValue = 1685580933
)
@Export("port3")
static int port3;
@Export("currentPort")
static int currentPort;
@ObfuscatedName("n")
@ObfuscatedGetter(
intValue = -1583763067
@@ -166,4 +166,4 @@ public class DynamicObject extends Renderable {
return var12.getModelDynamic(this.type, this.orientation, var8, var10, var9, var11, this.sequenceDefinition, this.frame); // L: 83
}
}
}
}

View File

@@ -8,7 +8,8 @@ import net.runelite.mapping.ObfuscatedSignature;
@Implements("GZipDecompressor")
public class GZipDecompressor {
@ObfuscatedName("t")
public static String field4046;
@Export("formattedOperatingSystemName")
public static String formattedOperatingSystemName;
@ObfuscatedName("n")
@Export("inflater")
Inflater inflater;
@@ -49,4 +50,4 @@ public class GZipDecompressor {
throw new RuntimeException("");
}
} // L: 27
}
}

View File

@@ -56,7 +56,8 @@ public class JagexCache {
@Export("cacheGamebuild")
static int cacheGamebuild;
@ObfuscatedName("p")
static String field2065;
@Export("operatingSystemName")
static String operatingSystemName;
@ObfuscatedName("m")
@Export("userHomeDirectory")
static String userHomeDirectory;
@@ -225,4 +226,4 @@ public class JagexCache {
return 2; // L: 2643
}
}
}
}

View File

@@ -10,8 +10,8 @@ public class MouseRecorder implements Runnable {
@ObfuscatedGetter(
intValue = -1626344665
)
@Export("port1")
static int port1;
@Export("worldPort")
static int worldPort;
@ObfuscatedName("n")
@Export("isRunning")
boolean isRunning;
@@ -56,4 +56,4 @@ public class MouseRecorder implements Runnable {
}
} // L: 28
}
}

View File

@@ -246,17 +246,18 @@ public final class Projectile extends Renderable {
descriptor = "(Ljava/lang/String;Ljava/lang/String;IIB)V",
garbageValue = "23"
)
public static void method2255(String var0, String var1, int var2, int var3) throws IOException {
@Export("findAndLoadCache")
public static void findAndLoadCache(String var0, String var1, int var2, int var3) throws IOException {
JagexCache.idxCount = var3; // L: 40
JagexCache.cacheGamebuild = var2; // L: 41
try {
JagexCache.field2065 = System.getProperty("os.name"); // L: 43
JagexCache.operatingSystemName = System.getProperty("os.name"); // L: 43
} catch (Exception var28) { // L: 45
JagexCache.field2065 = "Unknown"; // L: 46
JagexCache.operatingSystemName = "Unknown"; // L: 46
}
GZipDecompressor.field4046 = JagexCache.field2065.toLowerCase(); // L: 48
GZipDecompressor.formattedOperatingSystemName = JagexCache.operatingSystemName.toLowerCase(); // L: 48
try {
JagexCache.userHomeDirectory = System.getProperty("user.home"); // L: 50
@@ -267,7 +268,7 @@ public final class Projectile extends Renderable {
}
try {
if (GZipDecompressor.field4046.startsWith("win")) { // L: 55
if (GZipDecompressor.formattedOperatingSystemName.startsWith("win")) { // L: 55
if (JagexCache.userHomeDirectory == null) { // L: 56
JagexCache.userHomeDirectory = System.getenv("USERPROFILE");
}
@@ -285,8 +286,8 @@ public final class Projectile extends Renderable {
JagexCache.userHomeDirectory = "~/";
}
class224.field2576 = new String[]{"c:/rscache/", "/rscache/", "c:/windows/", "c:/winnt/", "c:/", JagexCache.userHomeDirectory, "/tmp/", ""}; // L: 65
Timer.field3621 = new String[]{".jagex_cache_" + JagexCache.cacheGamebuild, ".file_store_" + JagexCache.cacheGamebuild}; // L: 66
class224.cacheParentPaths = new String[]{"c:/rscache/", "/rscache/", "c:/windows/", "c:/winnt/", "c:/", JagexCache.userHomeDirectory, "/tmp/", ""}; // L: 65
Timer.cacheSubPaths = new String[]{".jagex_cache_" + JagexCache.cacheGamebuild, ".file_store_" + JagexCache.cacheGamebuild}; // L: 66
int var18 = 0;
label250:
@@ -347,7 +348,7 @@ public final class Projectile extends Renderable {
if (var7 != null) { // L: 109
var33 = new File(var7, "test.dat"); // L: 110
if (!class23.method235(var33, true)) { // L: 111
if (!class23.isWriteable(var33, true)) { // L: 111
var7 = null; // L: 112
}
}
@@ -355,10 +356,10 @@ public final class Projectile extends Renderable {
if (var7 == null && var18 == 0) { // L: 116
label225:
for (int var19 = 0; var19 < Timer.field3621.length; ++var19) { // L: 117
for (int var20 = 0; var20 < class224.field2576.length; ++var20) { // L: 118
File var21 = new File(class224.field2576[var20] + Timer.field3621[var19] + File.separatorChar + var0 + File.separatorChar); // L: 119
if (var21.exists() && class23.method235(new File(var21, "test.dat"), true)) { // L: 120 121
for (int var19 = 0; var19 < Timer.cacheSubPaths.length; ++var19) { // L: 117
for (int var20 = 0; var20 < class224.cacheParentPaths.length; ++var20) { // L: 118
File var21 = new File(class224.cacheParentPaths[var20] + Timer.cacheSubPaths[var19] + File.separatorChar + var0 + File.separatorChar); // L: 119
if (var21.exists() && class23.isWriteable(new File(var21, "test.dat"), true)) { // L: 120 121
var7 = var21.toString(); // L: 122
var9 = true; // L: 123
break label225; // L: 124
@@ -429,7 +430,7 @@ public final class Projectile extends Renderable {
for (int var23 = 0; var23 < var34.length; ++var23) { // L: 184
File var24 = var34[var23]; // L: 185
if (!class23.method235(var24, false)) { // L: 187
if (!class23.isWriteable(var24, false)) { // L: 187
++var18; // L: 67
continue label250;
}
@@ -438,8 +439,8 @@ public final class Projectile extends Renderable {
break;
}
class3.method36(JagexCache.cacheDir); // L: 194
Varcs.method2346(); // L: 195
class3.assertCacheDirExists(JagexCache.cacheDir); // L: 194
Varcs.findOrCreateRandomDatFile(); // L: 195
JagexCache.JagexCache_dat2File = new BufferedFile(new AccessFile(GraphicsObject.getFile("main_file_cache.dat2"), "rw", 1048576000L), 5200, 0); // L: 196
JagexCache.JagexCache_idx255File = new BufferedFile(new AccessFile(GraphicsObject.getFile("main_file_cache.idx255"), "rw", 1048576L), 6000, 0); // L: 197
WorldMapEvent.JagexCache_idxFiles = new BufferedFile[JagexCache.idxCount]; // L: 198
@@ -690,4 +691,4 @@ public final class Projectile extends Renderable {
}
} // L: 9183
}
}

View File

@@ -47,8 +47,8 @@ public abstract class Renderable extends DualNode {
static final void method3417() {
if (Client.field889 != class90.Client_plane) { // L: 3402
Client.field889 = class90.Client_plane; // L: 3403
class224.method4232(class90.Client_plane); // L: 3404
class224.createMinimapSprite(class90.Client_plane); // L: 3404
}
} // L: 3406
}
}

View File

@@ -8,7 +8,8 @@ import net.runelite.mapping.ObfuscatedSignature;
@Implements("Timer")
public class Timer {
@ObfuscatedName("f")
static String[] field3621;
@Export("cacheSubPaths")
static String[] cacheSubPaths;
@ObfuscatedName("n")
@ObfuscatedGetter(
longValue = -2999131098664295081L
@@ -175,4 +176,4 @@ public class Timer {
var1.writeShort(this.field3613); // L: 76
var1.writeShort(this.field3619); // L: 77
} // L: 78
}
}

View File

@@ -398,7 +398,8 @@ public class Varcs {
descriptor = "(B)V",
garbageValue = "0"
)
static void method2346() {
@Export("findOrCreateRandomDatFile")
static void findOrCreateRandomDatFile() {
try {
File var0 = new File(JagexCache.userHomeDirectory, "random.dat"); // L: 250
int var2;
@@ -406,9 +407,9 @@ public class Varcs {
JagexCache.JagexCache_randomDat = new BufferedFile(new AccessFile(var0, "rw", 25L), 24, 0); // L: 252
} else {
label39:
for (int var1 = 0; var1 < Timer.field3621.length; ++var1) { // L: 255
for (var2 = 0; var2 < class224.field2576.length; ++var2) { // L: 256
File var3 = new File(class224.field2576[var2] + Timer.field3621[var1] + File.separatorChar + "random.dat"); // L: 257
for (int var1 = 0; var1 < Timer.cacheSubPaths.length; ++var1) { // L: 255
for (var2 = 0; var2 < class224.cacheParentPaths.length; ++var2) { // L: 256
File var3 = new File(class224.cacheParentPaths[var2] + Timer.cacheSubPaths[var1] + File.separatorChar + "random.dat"); // L: 257
if (var3.exists()) { // L: 258
JagexCache.JagexCache_randomDat = new BufferedFile(new AccessFile(var3, "rw", 25L), 24, 0); // L: 259
break label39; // L: 260
@@ -430,4 +431,4 @@ public class Varcs {
}
} // L: 276
}
}

View File

@@ -9,15 +9,16 @@ public class class171 implements class170 {
@ObfuscatedGetter(
intValue = -853566565
)
@Export("port2")
static int port2;
@Export("js5Port")
static int js5Port;
@ObfuscatedName("n")
@ObfuscatedSignature(
descriptor = "(Lig;Lig;IZI)Lel;",
garbageValue = "-2064266261"
)
public static Frames method3642(AbstractArchive var0, AbstractArchive var1, int var2, boolean var3) {
@Export("loadFrames")
public static Frames loadFrames(AbstractArchive var0, AbstractArchive var1, int var2, boolean var3) {
boolean var4 = true; // L: 11
int[] var5 = var0.getGroupFileIds(var2); // L: 12
@@ -281,9 +282,10 @@ public class class171 implements class170 {
descriptor = "(IB)V",
garbageValue = "0"
)
static final void method3641(int var0) {
@Export("updateSoundEffectVolume")
static final void updateSoundEffectVolume(int var0) {
var0 = Math.min(Math.max(var0, 0), 127); // L: 11112
WorldMapSectionType.clientPreferences.soundEffectsVolume = var0; // L: 11113
class23.savePreferences(); // L: 11114
} // L: 11115
}
}

View File

@@ -1,3 +1,5 @@
import net.runelite.mapping.Export;
import net.runelite.mapping.Implements;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
@@ -12,7 +14,8 @@ public class class224 {
@ObfuscatedName("c")
public static final short[][] field2574;
@ObfuscatedName("x")
static String[] field2576;
@Export("cacheParentPaths")
static String[] cacheParentPaths;
static {
field2577 = new short[]{6798, 8741, 25238, 4626, 4550}; // L: 4
@@ -26,7 +29,8 @@ public class class224 {
descriptor = "(II)V",
garbageValue = "2091444199"
)
static final void method4232(int var0) {
@Export("createMinimapSprite")
static final void createMinimapSprite(int plane) {
int[] var1 = GrandExchangeOfferAgeComparator.sceneMinimapSprite.pixels; // L: 5775
int var2 = var1.length; // L: 5776
@@ -41,12 +45,12 @@ public class class224 {
var4 = (103 - var3) * 2048 + 24628; // L: 5779
for (var5 = 1; var5 < 103; ++var5) { // L: 5780
if ((Tiles.Tiles_renderFlags[var0][var5][var3] & 24) == 0) { // L: 5781
MilliClock.scene.drawTileMinimap(var1, var4, 512, var0, var5, var3);
if ((Tiles.Tiles_renderFlags[plane][var5][var3] & 24) == 0) { // L: 5781
MilliClock.scene.drawTileMinimap(var1, var4, 512, plane, var5, var3);
}
if (var0 < 3 && (Tiles.Tiles_renderFlags[var0 + 1][var5][var3] & 8) != 0) { // L: 5782
MilliClock.scene.drawTileMinimap(var1, var4, 512, var0 + 1, var5, var3);
if (plane < 3 && (Tiles.Tiles_renderFlags[plane + 1][var5][var3] & 8) != 0) { // L: 5782
MilliClock.scene.drawTileMinimap(var1, var4, 512, plane + 1, var5, var3);
}
var4 += 4; // L: 5783
@@ -60,12 +64,12 @@ public class class224 {
int var6;
for (var5 = 1; var5 < 103; ++var5) { // L: 5789
for (var6 = 1; var6 < 103; ++var6) { // L: 5790
if ((Tiles.Tiles_renderFlags[var0][var6][var5] & 24) == 0) { // L: 5791
Username.drawObject(var0, var6, var5, var3, var4);
if ((Tiles.Tiles_renderFlags[plane][var6][var5] & 24) == 0) { // L: 5791
Username.drawObject(plane, var6, var5, var3, var4);
}
if (var0 < 3 && (Tiles.Tiles_renderFlags[var0 + 1][var6][var5] & 8) != 0) { // L: 5792
Username.drawObject(var0 + 1, var6, var5, var3, var4);
if (plane < 3 && (Tiles.Tiles_renderFlags[plane + 1][var6][var5] & 8) != 0) { // L: 5792
Username.drawObject(plane + 1, var6, var5, var3, var4);
}
}
}
@@ -90,4 +94,4 @@ public class class224 {
FileSystem.rasterProvider.apply(); // L: 5814
} // L: 5815
}
}

View File

@@ -13,7 +13,8 @@ public class class23 {
descriptor = "(Ljava/io/File;ZI)Z",
garbageValue = "-1646838359"
)
static boolean method235(File var0, boolean var1) {
@Export("isWriteable")
static boolean isWriteable(File var0, boolean deleteAfterWrite) {
try {
RandomAccessFile var2 = new RandomAccessFile(var0, "rw"); // L: 206
int var3 = var2.read(); // L: 207
@@ -21,7 +22,7 @@ public class class23 {
var2.write(var3); // L: 209
var2.seek(0L); // L: 210
var2.close(); // L: 211
if (var1) { // L: 212
if (deleteAfterWrite) { // L: 212
var0.delete();
}
@@ -136,4 +137,4 @@ public class class23 {
}
} // L: 2665
}
}

View File

@@ -119,7 +119,8 @@ public class class3 implements Enumerated {
descriptor = "(Ljava/io/File;B)V",
garbageValue = "1"
)
static void method36(File var0) {
@Export("assertCacheDirExists")
static void assertCacheDirExists(File var0) {
FileSystem.FileSystem_cacheDir = var0; // L: 16
if (!FileSystem.FileSystem_cacheDir.exists()) { // L: 17
throw new RuntimeException("");
@@ -212,4 +213,4 @@ public class class3 implements Enumerated {
return var2; // L: 100
}
}
}