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:
commit
3331ab745b
25 files changed
+4795
No files matched your search
@@ -0,0 +1,130 @@
|
||||
package org.scape2006.web;
|
||||
|
||||
import org.teavm.classlib.ReflectionContext;
|
||||
import org.teavm.classlib.ReflectionSupplier;
|
||||
import org.teavm.model.ClassReader;
|
||||
import org.teavm.model.FieldReader;
|
||||
import org.teavm.model.MethodDescriptor;
|
||||
import org.teavm.model.MethodReader;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* TeaVM ReflectionSupplier ensuring ScriptInterpreter can reflectively invoke
|
||||
* PluginContext, PluginGraphics, ClientScript, and game entity APIs at runtime.
|
||||
*/
|
||||
public final class WebReflectionSupplier implements ReflectionSupplier {
|
||||
|
||||
private static final Set<String> SCRIPTABLE_CLASSES = new HashSet<>();
|
||||
|
||||
static {
|
||||
String p = "org.scape2006.web.";
|
||||
SCRIPTABLE_CLASSES.add(p + "PluginContext");
|
||||
SCRIPTABLE_CLASSES.add(p + "PluginContext$WorldArea");
|
||||
SCRIPTABLE_CLASSES.add(p + "PluginContext$NpcWrapper");
|
||||
SCRIPTABLE_CLASSES.add(p + "PluginContext$PlayerWrapper");
|
||||
SCRIPTABLE_CLASSES.add(p + "PluginContext$GroundItemWrapper");
|
||||
SCRIPTABLE_CLASSES.add(p + "PluginContext$SceneObjectWrapper");
|
||||
SCRIPTABLE_CLASSES.add(p + "PluginContext$InventoryItemWrapper");
|
||||
SCRIPTABLE_CLASSES.add(p + "PluginContext$Prayer");
|
||||
SCRIPTABLE_CLASSES.add(p + "PluginContext$Spell");
|
||||
SCRIPTABLE_CLASSES.add(p + "PluginContext$Query");
|
||||
SCRIPTABLE_CLASSES.add(p + "PluginContext$NpcQuery");
|
||||
SCRIPTABLE_CLASSES.add(p + "PluginContext$GroundItemQuery");
|
||||
SCRIPTABLE_CLASSES.add(p + "PluginContext$ObjectQuery");
|
||||
SCRIPTABLE_CLASSES.add(p + "PluginContext$InventoryQuery");
|
||||
SCRIPTABLE_CLASSES.add(p + "PluginContext$PlayerQuery");
|
||||
SCRIPTABLE_CLASSES.add(p + "PluginGraphics");
|
||||
SCRIPTABLE_CLASSES.add(p + "PluginConfigItem");
|
||||
SCRIPTABLE_CLASSES.add(p + "ClientScript");
|
||||
SCRIPTABLE_CLASSES.add(p + "ClientPlugin");
|
||||
SCRIPTABLE_CLASSES.add(p + "ClientSettings");
|
||||
SCRIPTABLE_CLASSES.add(p + "ScriptLogger");
|
||||
SCRIPTABLE_CLASSES.add(p + "Game");
|
||||
SCRIPTABLE_CLASSES.add(p + "Player");
|
||||
SCRIPTABLE_CLASSES.add(p + "NPC");
|
||||
SCRIPTABLE_CLASSES.add(p + "Item");
|
||||
SCRIPTABLE_CLASSES.add(p + "ItemDef");
|
||||
SCRIPTABLE_CLASSES.add(p + "EntityDef");
|
||||
SCRIPTABLE_CLASSES.add(p + "ObjectDef");
|
||||
SCRIPTABLE_CLASSES.add(p + "Skills");
|
||||
SCRIPTABLE_CLASSES.add(p + "RSInterface");
|
||||
SCRIPTABLE_CLASSES.add(p + "RSColors");
|
||||
SCRIPTABLE_CLASSES.add(p + "ItemID");
|
||||
SCRIPTABLE_CLASSES.add(p + "StaticItemList");
|
||||
SCRIPTABLE_CLASSES.add(p + "SkillID");
|
||||
SCRIPTABLE_CLASSES.add(p + "NpcID");
|
||||
SCRIPTABLE_CLASSES.add(p + "StaticNpcList");
|
||||
SCRIPTABLE_CLASSES.add(p + "ObjectID");
|
||||
SCRIPTABLE_CLASSES.add(p + "StaticObjectList");
|
||||
SCRIPTABLE_CLASSES.add(p + "ScriptInterpreter");
|
||||
SCRIPTABLE_CLASSES.add(p + "ScriptInterpreter$Environment");
|
||||
SCRIPTABLE_CLASSES.add(p + "ScriptInterpreter$InterpretedScript");
|
||||
SCRIPTABLE_CLASSES.add(p + "ScriptInterpreter$InterpretedPlugin");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getAccessibleFields(ReflectionContext context, String className) {
|
||||
if (!SCRIPTABLE_CLASSES.contains(className)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
ClassReader cls = context.getClassSource().get(className);
|
||||
if (cls == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<String> fields = new ArrayList<>();
|
||||
for (FieldReader f : cls.getFields()) {
|
||||
fields.add(f.getName());
|
||||
}
|
||||
return fields;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<MethodDescriptor> getAccessibleMethods(ReflectionContext context, String className) {
|
||||
boolean isLangMath = "java.lang.Math".equals(className);
|
||||
boolean isLangSys = "java.lang.System".equals(className);
|
||||
boolean isLangStr = "java.lang.String".equals(className);
|
||||
boolean isUtilColl = "java.util.List".equals(className) || "java.util.ArrayList".equals(className)
|
||||
|| "java.util.Collection".equals(className) || "java.util.Map".equals(className)
|
||||
|| "java.util.HashMap".equals(className)
|
||||
|| "java.util.Collections$EmptyList".equals(className)
|
||||
|| "java.util.Collections$SingletonList".equals(className)
|
||||
|| "java.util.Arrays$ArrayList".equals(className);
|
||||
if (!SCRIPTABLE_CLASSES.contains(className) && !isLangMath && !isLangSys && !isLangStr && !isUtilColl) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
ClassReader cls = context.getClassSource().get(className);
|
||||
if (cls == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<MethodDescriptor> methods = new ArrayList<>();
|
||||
for (MethodReader m : cls.getMethods()) {
|
||||
String name = m.getName();
|
||||
if (isLangSys) {
|
||||
if (!"currentTimeMillis".equals(name) && !"nanoTime".equals(name)) continue;
|
||||
} else if (isLangMath) {
|
||||
if (!"max".equals(name) && !"min".equals(name) && !"abs".equals(name)
|
||||
&& !"round".equals(name) && !"floor".equals(name) && !"ceil".equals(name)
|
||||
&& !"sqrt".equals(name) && !"pow".equals(name) && !"hypot".equals(name)
|
||||
&& !"random".equals(name)) continue;
|
||||
} else if (isLangStr) {
|
||||
if (!"length".equals(name) && !"equals".equals(name) && !"equalsIgnoreCase".equals(name)
|
||||
&& !"contains".equals(name) && !"startsWith".equals(name) && !"endsWith".equals(name)
|
||||
&& !"toLowerCase".equals(name) && !"toUpperCase".equals(name) && !"trim".equals(name)
|
||||
&& !"substring".equals(name) && !"indexOf".equals(name) && !"replace".equals(name)
|
||||
&& !"isEmpty".equals(name) && !"valueOf".equals(name)) continue;
|
||||
} else if (isUtilColl) {
|
||||
if (!"size".equals(name) && !"isEmpty".equals(name) && !"get".equals(name)
|
||||
&& !"add".equals(name) && !"remove".equals(name) && !"clear".equals(name)
|
||||
&& !"contains".equals(name) && !"containsKey".equals(name) && !"put".equals(name)) continue;
|
||||
}
|
||||
methods.add(m.getDescriptor());
|
||||
}
|
||||
return methods;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user