feat(web): add 2006Scape TeaVM WebGL2 client with mobile support and classic 2006 UI

Initializes the TeaVM-based 2006Scape-Web client repository with WebGL2 117HD rendering, WebSocket networking, SpessaSynth MIDI/PCM audio, and mobile-compatible touch/viewport controls. Preserves Revision 377 cache preloading via IndexedDB and localStorage-backed script and config persistence.

### Core Web Runtime & Rendering
- WebLauncher & DesktopHooks:
  - Added TeaVM entry point with URL/localStorage option parsing, async 377 cache preloading, and WebSocket port routing.
  - Implemented DesktopHooks.boxReflectValue using JSWrapper.isJava/maybeUnwrap to box TeaVM reflection primitives, plus localStorage persistence for plugin settings and imported scripts.
- WebHd117Renderer & RSImageProducer:
  - Implemented WebGL2 117HD rendering with 4x4 chunked static scenery VBOs and 0x010203 transparency sentinel so 0x000000 black UI elements stay opaque.
- WebReflectionSupplier:
  - Exposed PluginContext, PluginGraphics, ScriptInterpreter, ID lists, and Math/System/String/collection methods for TeaVM runtime reflection.

### Mobile & Classic 2006 Web UI
- index.html & RSApplet:
  - Styled the page to match the classic 2006 RuneScape webclient with optional classic navbar (auto-hidden below 765px), 1999-2006 Jagex footer, and responsive Fixed/Resizable/Fullscreen scaling.
  - Added Options modal (auto-login, server, world, 117HD, display mode, navbar) with scrollable body in mobile landscape.
  - Implemented Android-parity touch controls (tap, 450ms long-press right-click, 1-finger camera drag, 2-finger pinch zoom clamped to -1..8, and auto-keyboard on input fields).
This commit is contained in:
Dark98 committed 2026-11-30 20:45:03 +00:00
commit 3331ab745b
25 files changed
+4795

No files matched your search

@@ -0,0 +1,190 @@
package org.scape2006.web;
import java.io.IOException;
/**
* Web Decompressor operating on VirtualFile buffers instead of RandomAccessFile.
*/
final class Decompressor {
private final byte[] buffer = new byte[520];
private final VirtualFile dataFile;
private final VirtualFile indexFile;
private final int anInt311;
public Decompressor(VirtualFile dataFile, VirtualFile indexFile, int id) {
this.anInt311 = id;
this.dataFile = dataFile;
this.indexFile = indexFile;
}
public synchronized byte[] decompress(int i) {
try {
seekTo(indexFile, i * 6L);
int l;
for (int j = 0; j < 6; j += l) {
l = indexFile.read(buffer, j, 6 - j);
if (l == -1) {
return null;
}
}
int i1 = ((buffer[0] & 0xff) << 16) + ((buffer[1] & 0xff) << 8) + (buffer[2] & 0xff);
int j1 = ((buffer[3] & 0xff) << 16) + ((buffer[4] & 0xff) << 8) + (buffer[5] & 0xff);
if (j1 <= 0 || j1 > dataFile.length() / 520L) {
return null;
}
byte[] abyte0 = new byte[i1];
int k1 = 0;
for (int l1 = 0; k1 < i1; l1++) {
if (j1 == 0) {
return null;
}
seekTo(dataFile, j1 * 520L);
int k = 0;
int i2 = i1 - k1;
if (i2 > 512) {
i2 = 512;
}
int j2;
for (; k < i2 + 8; k += j2) {
j2 = dataFile.read(buffer, k, i2 + 8 - k);
if (j2 == -1) {
return null;
}
}
int k2 = ((buffer[0] & 0xff) << 8) + (buffer[1] & 0xff);
int l2 = ((buffer[2] & 0xff) << 8) + (buffer[3] & 0xff);
int i3 = ((buffer[4] & 0xff) << 16) + ((buffer[5] & 0xff) << 8) + (buffer[6] & 0xff);
int j3 = buffer[7] & 0xff;
if (k2 != i || l2 != l1 || j3 != anInt311) {
return null;
}
if (i3 < 0 || i3 > dataFile.length() / 520L) {
return null;
}
for (int k3 = 0; k3 < i2; k3++) {
abyte0[k1++] = buffer[k3 + 8];
}
j1 = i3;
}
return abyte0;
} catch (IOException ex) {
return null;
}
}
public synchronized boolean method234(int i, byte[] abyte0, int j) {
boolean flag = method235(true, j, i, abyte0);
if (!flag) {
flag = method235(false, j, i, abyte0);
}
return flag;
}
private synchronized boolean method235(boolean flag, int j, int k, byte[] abyte0) {
try {
int l;
if (flag) {
seekTo(indexFile, j * 6L);
int k1;
for (int i1 = 0; i1 < 6; i1 += k1) {
k1 = indexFile.read(buffer, i1, 6 - i1);
if (k1 == -1) {
return false;
}
}
l = ((buffer[3] & 0xff) << 16) + ((buffer[4] & 0xff) << 8) + (buffer[5] & 0xff);
if (l <= 0 || l > dataFile.length() / 520L) {
return false;
}
} else {
l = (int) ((dataFile.length() + 519L) / 520L);
if (l == 0) {
l = 1;
}
}
buffer[0] = (byte) (k >> 16);
buffer[1] = (byte) (k >> 8);
buffer[2] = (byte) k;
buffer[3] = (byte) (l >> 16);
buffer[4] = (byte) (l >> 8);
buffer[5] = (byte) l;
seekTo(indexFile, j * 6L);
indexFile.write(buffer, 0, 6);
int j1 = 0;
for (int l1 = 0; j1 < k; l1++) {
int i2 = 0;
if (flag) {
seekTo(dataFile, l * 520L);
int j2;
int i3;
for (j2 = 0; j2 < 8; j2 += i3) {
i3 = dataFile.read(buffer, j2, 8 - j2);
if (i3 == -1) {
break;
}
}
if (j2 == 8) {
int j3 = ((buffer[0] & 0xff) << 8) + (buffer[1] & 0xff);
int k3 = ((buffer[2] & 0xff) << 8) + (buffer[3] & 0xff);
i2 = ((buffer[4] & 0xff) << 16) + ((buffer[5] & 0xff) << 8) + (buffer[6] & 0xff);
int l3 = buffer[7] & 0xff;
if (j3 != j || k3 != l1 || l3 != anInt311) {
return false;
}
if (i2 < 0 || i2 > dataFile.length() / 520L) {
return false;
}
}
}
if (i2 == 0) {
flag = false;
i2 = (int) ((dataFile.length() + 519L) / 520L);
if (i2 == 0) {
i2++;
}
if (i2 == l) {
i2++;
}
}
if (k - j1 <= 512) {
i2 = 0;
}
buffer[0] = (byte) (j >> 8);
buffer[1] = (byte) j;
buffer[2] = (byte) (l1 >> 8);
buffer[3] = (byte) l1;
buffer[4] = (byte) (i2 >> 16);
buffer[5] = (byte) (i2 >> 8);
buffer[6] = (byte) i2;
buffer[7] = (byte) anInt311;
seekTo(dataFile, l * 520L);
dataFile.write(buffer, 0, 8);
int k2 = k - j1;
if (k2 > 512) {
k2 = 512;
}
dataFile.write(abyte0, j1, k2);
j1 += k2;
l = i2;
}
return true;
} catch (IOException ex) {
return false;
}
}
private synchronized void seekTo(VirtualFile file, long pos) throws IOException {
if (pos < 0 || pos > 0x3c00000L) {
pos = 0x3c00000L;
try {
Thread.sleep(1000L);
} catch (Exception ignored) {
}
}
file.seek(pos);
}
}