mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-12-01 06:12:35 -08:00
Fix OSC Android fuckery
This commit is contained in:
5 files changed
+43
-8
No files matched your search
@@ -146,7 +146,7 @@ android {
|
||||
targetSdk = 33
|
||||
|
||||
// Defines the version number of your app.
|
||||
versionCode = 2
|
||||
versionCode = 3
|
||||
|
||||
// Defines a user-friendly version name for your app.
|
||||
versionName = "0.7.0"
|
||||
|
||||
@@ -10,6 +10,7 @@ import io.eiren.util.logging.LogManager;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
|
||||
@@ -71,7 +72,7 @@ public class OSCRouter {
|
||||
// Else, create our own OSC receiver
|
||||
if (oscReceiver == null) {
|
||||
try {
|
||||
oscReceiver = new OSCPortIn(portIn);
|
||||
oscReceiver = new OSCPortIn(OSCStatic.serializer, portIn);
|
||||
if (lastPortIn != portIn || !wasListening) {
|
||||
LogManager.info("[OSCRouter] Listening to port " + portIn);
|
||||
}
|
||||
@@ -114,8 +115,8 @@ public class OSCRouter {
|
||||
if (oscSender == null) {
|
||||
try {
|
||||
oscSender = new OSCPortOut(
|
||||
address,
|
||||
portOut
|
||||
OSCStatic.serializer,
|
||||
new InetSocketAddress(address, portOut)
|
||||
);
|
||||
if ((lastPortOut != portOut && lastAddress != address) || !wasConnected) {
|
||||
LogManager
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package dev.slimevr.osc;
|
||||
|
||||
import com.illposed.osc.OSCSerializerAndParserBuilder;
|
||||
import com.illposed.osc.argument.ArgumentHandler;
|
||||
import com.illposed.osc.argument.handler.Activator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OSCStatic {
|
||||
public static OSCSerializerAndParserBuilder serializer;
|
||||
|
||||
static {
|
||||
// Really hacky workaround for getting the OSC library to work on Android
|
||||
// (Removes reference to java.awt.Color)
|
||||
// https://github.com/hoijui/JavaOSC/issues/60#issuecomment-960713779
|
||||
OSCSerializerAndParserBuilder serializer = new OSCSerializerAndParserBuilder();
|
||||
serializer.setUsingDefaultHandlers(false);
|
||||
List<ArgumentHandler> defaultParserTypes = Activator.createSerializerTypes();
|
||||
defaultParserTypes.remove(16);
|
||||
char typeChar = 'a';
|
||||
for (ArgumentHandler argumentHandler : defaultParserTypes) {
|
||||
serializer.registerArgumentHandler(argumentHandler, typeChar);
|
||||
typeChar++;
|
||||
}
|
||||
|
||||
OSCStatic.serializer = serializer;
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import io.github.axisangles.ktmath.Vector3;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -94,6 +95,7 @@ public class VMCHandler implements OSCHandler {
|
||||
try {
|
||||
int port = config.getPortIn();
|
||||
oscReceiver = new OSCPortIn(
|
||||
OSCStatic.serializer,
|
||||
port
|
||||
);
|
||||
if (lastPortIn != port || !wasListening) {
|
||||
@@ -130,8 +132,8 @@ public class VMCHandler implements OSCHandler {
|
||||
InetAddress address = InetAddress.getByName(config.getAddress());
|
||||
int port = config.getPortOut();
|
||||
oscSender = new OSCPortOut(
|
||||
address,
|
||||
port
|
||||
OSCStatic.serializer,
|
||||
new InetSocketAddress(address, port)
|
||||
);
|
||||
if ((lastPortOut != port && lastAddress != address) || !wasConnected) {
|
||||
LogManager
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package dev.slimevr.osc;
|
||||
|
||||
import com.illposed.osc.*;
|
||||
import com.illposed.osc.argument.ArgumentHandler;
|
||||
import com.illposed.osc.argument.handler.Activator;
|
||||
import com.illposed.osc.messageselector.OSCPatternAddressMessageSelector;
|
||||
import com.illposed.osc.transport.OSCPortIn;
|
||||
import com.illposed.osc.transport.OSCPortOut;
|
||||
@@ -22,6 +24,7 @@ import io.github.axisangles.ktmath.Vector3;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -116,6 +119,7 @@ public class VRCOSCHandler implements OSCHandler {
|
||||
try {
|
||||
int port = config.getPortIn();
|
||||
oscReceiver = new OSCPortIn(
|
||||
OSCStatic.serializer,
|
||||
port
|
||||
);
|
||||
if (lastPortIn != port || !wasListening) {
|
||||
@@ -147,8 +151,8 @@ public class VRCOSCHandler implements OSCHandler {
|
||||
InetAddress address = InetAddress.getByName(config.getAddress());
|
||||
int port = config.getPortOut();
|
||||
oscSender = new OSCPortOut(
|
||||
address,
|
||||
port
|
||||
OSCStatic.serializer,
|
||||
new InetSocketAddress(address, port)
|
||||
);
|
||||
if ((lastPortOut != port && lastAddress != address) || !wasConnected) {
|
||||
LogManager
|
||||
|
||||
Reference in new issue
Block a user