Skip to content

Instantly share code, notes, and snippets.

@downthecrop
Created February 20, 2022 03:34
Show Gist options
  • Save downthecrop/7f65f73175c6330cd79a60033ec2865a to your computer and use it in GitHub Desktop.
Save downthecrop/7f65f73175c6330cd79a60033ec2865a to your computer and use it in GitHub Desktop.
2009scape Mobile Talk

Basics

What is Pojav Launcher

A launcher for minecraft JAVA edition for Android & iOS

This will only cover Android but you could do this with iOS however it requires libhooker (root)

---- JVM Implementation

implements OpenJDK 1.8

  • Not that impressive, running a JVM on ARM isn't anything new.

implements LWJGL Library (OpenGL and OpenAL)

The JVM runs but there aren't bindings for sound (ALSA server on linux) or X11

Caciocavallo is a library used to test gui in headless environments, this lets the JVM forgo X11 to get display serverlike graphical. Most Swing ect will now work.

--- Mouse Input

First I tested the input system with this 
https://docs.oracle.com/javase/tutorial/uiswing/events/mouselistener.html

Added many additional mouselisteners to the jframes and canvas components
to get the input working in Pojav.

Just a quirk of Caciocavallo but I'm not sure.

--- Keyboard

About Key Events. Because the Android Spec doesn't require
soft keyboards to dispatch key events not all keyboard implementations
across Android will trigger these actions.

-- Special Characters and Capitals

Currently we use the following function to translate keycodes for
special character, capital letters, and digits.

keycode 123 (F12) is used as a single digit capslock button which
when sent to the miniclient before a char will act accordingly.


Issues with Modifier keys sticking so as a workaround I changed F12 scancode into a single
character capslock modifer in my KeyboardListener.

    KeyboardListener.java
    https://github.com/downthecrop/miniclient/blob/main/Client/src/main/java/org/runite/client/KeyboardListener.java

Pojav AWTInputBridge sends the scancode/character to the JVM.

--- SOUND

NO SOUND DEVICES are available to javax. I attempted to feed the sound data through OpenAL but
the javax audiostream fails not just failing to play from speakers the entire pipeline is dead.

It worked on my machine tho :) https://youtu.be/mRrhoDNHVGo?t=106

I abandoned OpenAL after this and instead dumped my resources to .ogg to play them outside of
the JVM.

If I was really smart I'd port the playback function from the Client to read the sounds
directly from the cache instead of needing to include the dumped .ogg sounds which take
up a lot of space.

I have a listener in the logoutput which listens for "AMESSAGE" tagged output. Those messages
are handled and play the correct sound effect or song at the client specified volume.

A service is backgrounded with 2 MediaPlayer's for non-blocking playback of sfx and music.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment