Update #43 - Fix invisible block entities and other issues
This commit is contained in:
parent
6cd2eed5b3
commit
1e235f93bf
|
@ -1 +1 @@
|
|||
u42
|
||||
u43
|
|
@ -303,7 +303,7 @@
|
|||
~ this.handleMouseInput();
|
||||
~ }
|
||||
|
||||
> INSERT 11 : 95 @ 11
|
||||
> INSERT 11 : 96 @ 11
|
||||
|
||||
+ public final Map<Integer, int[]> touchStarts = new HashMap<>();
|
||||
+
|
||||
|
@ -331,10 +331,11 @@
|
|||
+ }
|
||||
+ i = applyEaglerScale(scaleFac, i * this.width / this.mc.displayWidth, this.width);
|
||||
+ j = applyEaglerScale(scaleFac, this.height - j * this.height / this.mc.displayHeight - 1, this.height);
|
||||
+ float si = Touch.getEventTouchRadiusX(t) * this.width / this.mc.displayWidth / scaleFac;
|
||||
+ float rad = Touch.getEventTouchRadiusMixed(t);
|
||||
+ float si = rad * this.width / this.mc.displayWidth / scaleFac;
|
||||
+ if (si < 1.0f)
|
||||
+ si = 1.0f;
|
||||
+ float sj = Touch.getEventTouchRadiusY(t) * this.height / this.mc.displayHeight / scaleFac;
|
||||
+ float sj = rad * this.height / this.mc.displayHeight / scaleFac;
|
||||
+ if (sj < 1.0f)
|
||||
+ sj = 1.0f;
|
||||
+ int[] ck = touchStarts.remove(u);
|
||||
|
|
|
@ -77,17 +77,16 @@
|
|||
~ if (!compiledchunk.isLayerEmpty(enumworldblocklayer)) {
|
||||
~ this.chunkRenderDispatcher.uploadChunk(enumworldblocklayer,
|
||||
|
||||
> CHANGE 1 : 4 @ 1 : 2
|
||||
> CHANGE 1 : 3 @ 1 : 2
|
||||
|
||||
~ generator.getRenderChunk(), compiledchunk);
|
||||
~ generator.getRenderChunk().setCompiledChunk(compiledchunk);
|
||||
~ generator.setStatus(ChunkCompileTaskGenerator.Status.DONE);
|
||||
|
||||
> CHANGE 3 : 4 @ 3 : 4
|
||||
|
||||
~ this.chunkRenderDispatcher.uploadChunk(
|
||||
|
||||
> CHANGE 2 : 11 @ 2 : 3
|
||||
> CHANGE 2 : 10 @ 2 : 3
|
||||
|
||||
~ generator.getRenderChunk(), compiledchunk);
|
||||
~ if (DeferredStateManager.isRenderingRealisticWater()) {
|
||||
|
@ -96,7 +95,6 @@
|
|||
~ .getWorldRendererByLayer(EnumWorldBlockLayer.REALISTIC_WATER),
|
||||
~ generator.getRenderChunk(), compiledchunk);
|
||||
~ }
|
||||
~ generator.getRenderChunk().setCompiledChunk(compiledchunk);
|
||||
~ generator.setStatus(ChunkCompileTaskGenerator.Status.DONE);
|
||||
|
||||
> DELETE 2 @ 2 : 42
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> DELETE 2 @ 2 : 3
|
||||
> CHANGE 2 : 3 @ 2 : 3
|
||||
|
||||
~ import java.util.Arrays;
|
||||
|
||||
> CHANGE 1 : 5 @ 1 : 3
|
||||
|
||||
|
@ -14,12 +16,17 @@
|
|||
~
|
||||
~ import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
|
||||
|
||||
> CHANGE 15 : 16 @ 15 : 16
|
||||
> CHANGE 5 : 6 @ 5 : 6
|
||||
|
||||
~ public static final CompiledChunk DUMMY = new CompiledChunk(null) {
|
||||
|
||||
> CHANGE 9 : 10 @ 9 : 10
|
||||
|
||||
~ return true;
|
||||
|
||||
> CHANGE 2 : 4 @ 2 : 4
|
||||
> CHANGE 2 : 5 @ 2 : 4
|
||||
|
||||
~ private final RenderChunk chunk;
|
||||
~ private final boolean[] layersUsed = new boolean[EnumWorldBlockLayer._VALUES.length];
|
||||
~ private final boolean[] layersStarted = new boolean[EnumWorldBlockLayer._VALUES.length];
|
||||
|
||||
|
@ -27,7 +34,30 @@
|
|||
|
||||
+ private WorldRenderer.State stateWater;
|
||||
|
||||
> INSERT 45 : 53 @ 45
|
||||
> INSERT 1 : 15 @ 1
|
||||
|
||||
+ public CompiledChunk(RenderChunk chunk) {
|
||||
+ this.chunk = chunk;
|
||||
+ }
|
||||
+
|
||||
+ public void reset() {
|
||||
+ Arrays.fill(layersUsed, false);
|
||||
+ Arrays.fill(layersStarted, false);
|
||||
+ empty = true;
|
||||
+ tileEntities.clear();
|
||||
+ setVisibility.setAllVisible(false);
|
||||
+ setState(null);
|
||||
+ setStateRealisticWater(null);
|
||||
+ }
|
||||
+
|
||||
|
||||
> INSERT 42 : 45 @ 42
|
||||
|
||||
+ if (this.state != stateIn && this.state != null) {
|
||||
+ this.state.release();
|
||||
+ }
|
||||
|
||||
> INSERT 2 : 13 @ 2
|
||||
|
||||
+
|
||||
+ public WorldRenderer.State getStateRealisticWater() {
|
||||
|
@ -35,6 +65,9 @@
|
|||
+ }
|
||||
+
|
||||
+ public void setStateRealisticWater(WorldRenderer.State stateIn) {
|
||||
+ if (this.stateWater != stateIn && this.stateWater != null) {
|
||||
+ this.stateWater.release();
|
||||
+ }
|
||||
+ this.stateWater = stateIn;
|
||||
+ }
|
||||
|
||||
|
|
|
@ -69,7 +69,15 @@
|
|||
+ .getWorldRendererByLayer(EnumWorldBlockLayer.REALISTIC_WATER), compiledchunk);
|
||||
+ }
|
||||
|
||||
> DELETE 7 @ 7 : 8
|
||||
> CHANGE 3 : 8 @ 3 : 4
|
||||
|
||||
~ if (compiledChunk == CompiledChunk.DUMMY) {
|
||||
~ compiledChunk = new CompiledChunk(this);
|
||||
~ } else {
|
||||
~ compiledChunk.reset();
|
||||
~ }
|
||||
|
||||
> DELETE 3 @ 3 : 4
|
||||
|
||||
> CHANGE 2 : 4 @ 2 : 11
|
||||
|
||||
|
@ -79,7 +87,7 @@
|
|||
> INSERT 2 : 5 @ 2
|
||||
|
||||
+ regionrendercache = new RegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1);
|
||||
+ generator.setCompiledChunk(compiledchunk);
|
||||
+ generator.setCompiledChunk(compiledChunk);
|
||||
+
|
||||
|
||||
> CHANGE 4 : 5 @ 4 : 5
|
||||
|
@ -95,15 +103,24 @@
|
|||
|
||||
~ TileEntity tileentity = regionrendercache.getTileEntity(blockpos$mutableblockpos);
|
||||
|
||||
> INSERT 21 : 34 @ 21
|
||||
> CHANGE 3 : 4 @ 3 : 4
|
||||
|
||||
~ compiledChunk.addTileEntity(tileentity);
|
||||
|
||||
> CHANGE 10 : 12 @ 10 : 12
|
||||
|
||||
~ if (!compiledChunk.isLayerStarted(enumworldblocklayer1)) {
|
||||
~ compiledChunk.setLayerStarted(enumworldblocklayer1);
|
||||
|
||||
> INSERT 5 : 18 @ 5
|
||||
|
||||
+
|
||||
+ if (block.eaglerShadersShouldRenderGlassHighlights()) {
|
||||
+ enumworldblocklayer1 = EnumWorldBlockLayer.GLASS_HIGHLIGHTS;
|
||||
+ worldrenderer = generator.getRegionRenderCacheBuilder()
|
||||
+ .getWorldRendererByLayerId(enumworldblocklayer1.ordinal());
|
||||
+ if (!compiledchunk.isLayerStarted(enumworldblocklayer1)) {
|
||||
+ compiledchunk.setLayerStarted(enumworldblocklayer1);
|
||||
+ if (!compiledChunk.isLayerStarted(enumworldblocklayer1)) {
|
||||
+ compiledChunk.setLayerStarted(enumworldblocklayer1);
|
||||
+ this.preRenderBlocks(worldrenderer, blockpos);
|
||||
+ }
|
||||
+
|
||||
|
@ -117,7 +134,21 @@
|
|||
~ for (int i = 0; i < layers.length; ++i) {
|
||||
~ EnumWorldBlockLayer enumworldblocklayer = layers[i];
|
||||
|
||||
> DELETE 13 @ 13 : 14
|
||||
> CHANGE 1 : 2 @ 1 : 2
|
||||
|
||||
~ compiledChunk.setLayerUsed(enumworldblocklayer);
|
||||
|
||||
> CHANGE 2 : 3 @ 2 : 3
|
||||
|
||||
~ if (compiledChunk.isLayerStarted(enumworldblocklayer)) {
|
||||
|
||||
> CHANGE 2 : 3 @ 2 : 3
|
||||
|
||||
~ compiledChunk);
|
||||
|
||||
> CHANGE 4 : 5 @ 4 : 6
|
||||
|
||||
~ compiledChunk.setVisibility(visgraph.computeVisibility());
|
||||
|
||||
> CHANGE 1 : 8 @ 1 : 12
|
||||
|
||||
|
@ -173,10 +204,16 @@
|
|||
~ compiledChunkIn.setState(worldRendererIn.func_181672_a());
|
||||
~ }
|
||||
|
||||
> CHANGE 25 : 26 @ 25 : 33
|
||||
> DELETE 24 @ 24 : 35
|
||||
|
||||
~ this.compiledChunk = compiledChunkIn;
|
||||
> CHANGE 2 : 7 @ 2 : 3
|
||||
|
||||
> DELETE 10 @ 10 : 17
|
||||
~ if (this.compiledChunk != CompiledChunk.DUMMY) {
|
||||
~ this.compiledChunk.setState(null);
|
||||
~ this.compiledChunk.setStateRealisticWater(null);
|
||||
~ this.compiledChunk = CompiledChunk.DUMMY;
|
||||
~ }
|
||||
|
||||
> DELETE 5 @ 5 : 12
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -118,7 +118,7 @@
|
|||
+ public boolean hasShownProfanityFilter = false;
|
||||
+ public float touchControlOpacity = 1.0f;
|
||||
+ public boolean hideDefaultUsernameWarning = false;
|
||||
+ public boolean hideVideoSettingsWarning = false;
|
||||
+ public boolean hideVideoSettingsWarning = EagRuntime.getPlatformType() == EnumPlatformType.DESKTOP;
|
||||
|
||||
> CHANGE 1 : 15 @ 1 : 2
|
||||
|
||||
|
|
|
@ -41,9 +41,10 @@
|
|||
|
||||
~ tileentity = (TileEntity) oclass.get();
|
||||
|
||||
> CHANGE 2 : 3 @ 2 : 3
|
||||
> CHANGE 2 : 4 @ 2 : 3
|
||||
|
||||
~ logger.error("Could not create TileEntity", exception);
|
||||
~ logger.error("Could not create TileEntity");
|
||||
~ logger.error(exception);
|
||||
|
||||
> CHANGE 84 : 85 @ 84 : 85
|
||||
|
||||
|
|
|
@ -22,7 +22,11 @@
|
|||
+ }
|
||||
+
|
||||
|
||||
> CHANGE 22 : 23 @ 22 : 23
|
||||
> CHANGE 17 : 18 @ 17 : 18
|
||||
|
||||
~ this(source.x, source.y, source.z);
|
||||
|
||||
> CHANGE 4 : 5 @ 4 : 5
|
||||
|
||||
~ : new BlockPos((double) this.x + x, (double) this.y + y, (double) this.z + z);
|
||||
|
||||
|
|
|
@ -154,7 +154,11 @@
|
|||
|
||||
~ BlockPos blockpos$mutableblockpos = new BlockPos();
|
||||
|
||||
> CHANGE 224 : 225 @ 224 : 225
|
||||
> CHANGE 122 : 123 @ 122 : 123
|
||||
|
||||
~ tileEntityIn.setPos(new BlockPos(pos));
|
||||
|
||||
> CHANGE 101 : 102 @ 101 : 102
|
||||
|
||||
~ if (!this.provider.getHasNoSky() && this.getGameRules().getBoolean("doWeatherCycle")) {
|
||||
|
||||
|
|
|
@ -45,7 +45,11 @@
|
|||
+ ++EaglerMinecraftServer.counterLightUpdate;
|
||||
+ }
|
||||
|
||||
> DELETE 9 @ 9 : 10
|
||||
> CHANGE 9 : 12 @ 9 : 10
|
||||
|
||||
~ if (!this.worldObj.isRemote) {
|
||||
~ ++EaglerMinecraftServer.counterLightUpdate;
|
||||
~ }
|
||||
|
||||
> CHANGE 10 : 13 @ 10 : 11
|
||||
|
||||
|
@ -158,7 +162,24 @@
|
|||
+ }
|
||||
+
|
||||
|
||||
> CHANGE 176 : 178 @ 176 : 178
|
||||
> INSERT 58 : 59 @ 58
|
||||
|
||||
+ BlockPos pos2 = new BlockPos(blockpos);
|
||||
|
||||
> CHANGE 1 : 3 @ 1 : 3
|
||||
|
||||
~ tileentity = this.createNewTileEntity(pos2);
|
||||
~ this.worldObj.setTileEntity(pos2, tileentity);
|
||||
|
||||
> CHANGE 1 : 2 @ 1 : 2
|
||||
|
||||
~ this.tileEntityPosQueue.add(pos2);
|
||||
|
||||
> INSERT 19 : 20 @ 19
|
||||
|
||||
+ blockpos = new BlockPos(blockpos);
|
||||
|
||||
> CHANGE 94 : 96 @ 94 : 96
|
||||
|
||||
~ && (predicate == null || predicate.apply((T) entity))) {
|
||||
~ list.add((T) entity);
|
||||
|
|
|
@ -679,16 +679,8 @@ public class PlatformInput {
|
|||
return 0;
|
||||
}
|
||||
|
||||
public static float touchGetEventTouchRadiusX(int pointId) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public static float touchGetEventTouchRadiusY(int pointId) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public static float touchGetEventTouchRadiusMixed(int pointId) {
|
||||
return touchGetEventTouchRadiusX(pointId) * 0.5f + touchGetEventTouchRadiusY(pointId) * 0.5f;
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public static float touchGetEventTouchForce(int pointId) {
|
||||
|
@ -711,16 +703,8 @@ public class PlatformInput {
|
|||
return 0;
|
||||
}
|
||||
|
||||
public static float touchRadiusX(int pointId) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public static float touchRadiusY(int pointId) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public static float touchRadiusMixed(int pointId) {
|
||||
return touchRadiusX(pointId) * 0.5f + touchRadiusY(pointId) * 0.5f;
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public static float touchForce(int pointId) {
|
||||
|
|
|
@ -413,15 +413,11 @@ public class PlatformWebRTC {
|
|||
synchronized (serverLANEventBuffer) {
|
||||
serverLANEventBuffer.put(peerId, e);
|
||||
}
|
||||
if (client.peerStateDesc != PEERSTATE_SUCCESS)
|
||||
client.peerStateDesc = PEERSTATE_SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s) {
|
||||
logger.error("Failed to set local description for \"{}\"! {}", peerId, s);
|
||||
if (client.peerStateDesc == PEERSTATE_LOADING)
|
||||
client.peerStateDesc = PEERSTATE_FAILED;
|
||||
client.signalRemoteDisconnect(peerId);
|
||||
}
|
||||
});
|
||||
|
@ -430,8 +426,6 @@ public class PlatformWebRTC {
|
|||
@Override
|
||||
public void onFailure(String s) {
|
||||
logger.error("Failed to create answer for \"{}\"! {}", peerId, s);
|
||||
if (client.peerStateDesc == PEERSTATE_LOADING)
|
||||
client.peerStateDesc = PEERSTATE_FAILED;
|
||||
client.signalRemoteDisconnect(peerId);
|
||||
}
|
||||
});
|
||||
|
@ -441,13 +435,11 @@ public class PlatformWebRTC {
|
|||
@Override
|
||||
public void onFailure(String s) {
|
||||
logger.error("Failed to set remote description for \"{}\"! {}", peerId, s);
|
||||
if (client.peerStateDesc == PEERSTATE_LOADING) client.peerStateDesc = PEERSTATE_FAILED;
|
||||
client.signalRemoteDisconnect(peerId);
|
||||
}
|
||||
});
|
||||
} catch (Throwable err) {
|
||||
logger.error("Failed to parse remote description for \"{}\"! {}", peerId, err.getMessage());
|
||||
if (client.peerStateDesc == PEERSTATE_LOADING) client.peerStateDesc = PEERSTATE_FAILED;
|
||||
client.signalRemoteDisconnect(peerId);
|
||||
}
|
||||
}
|
||||
|
@ -459,10 +451,8 @@ public class PlatformWebRTC {
|
|||
JSONObject candidate = jsonArray.getJSONObject(i);
|
||||
peerConnection.addIceCandidate(new RTCIceCandidate(null, candidate.getInt("sdpMLineIndex"), candidate.getString("candidate")));
|
||||
}
|
||||
if (client.peerStateIce != PEERSTATE_SUCCESS) client.peerStateIce = PEERSTATE_SUCCESS;
|
||||
} catch (Throwable err) {
|
||||
logger.error("Failed to parse ice candidate for \"{}\"! {}", peerId, err.getMessage());
|
||||
if (client.peerStateIce == PEERSTATE_LOADING) client.peerStateIce = PEERSTATE_FAILED;
|
||||
client.signalRemoteDisconnect(peerId);
|
||||
}
|
||||
}
|
||||
|
@ -490,11 +480,6 @@ public class PlatformWebRTC {
|
|||
public Set<Map<String, String>> iceServers = new HashSet<>();
|
||||
public Map<String, LANPeer> peerList = new HashMap<>();
|
||||
public Map<String, LANPeer> ipcMapList = new HashMap<>();
|
||||
public byte peerState = PEERSTATE_LOADING;
|
||||
public byte peerStateConnect = PEERSTATE_LOADING;
|
||||
public byte peerStateInitial = PEERSTATE_LOADING;
|
||||
public byte peerStateDesc = PEERSTATE_LOADING;
|
||||
public byte peerStateIce = PEERSTATE_LOADING;
|
||||
private final Object lock3 = new Object();
|
||||
|
||||
public void setIceServers(String[] urls) {
|
||||
|
@ -541,10 +526,6 @@ public class PlatformWebRTC {
|
|||
}
|
||||
}
|
||||
|
||||
public void resetPeerStates() {
|
||||
peerState = peerStateConnect = peerStateInitial = peerStateDesc = peerStateIce = PEERSTATE_LOADING;
|
||||
}
|
||||
|
||||
public void signalRemoteConnect(String peerId) {
|
||||
try {
|
||||
List<Map<String, String>> iceCandidates = new ArrayList<>();
|
||||
|
@ -597,7 +578,6 @@ public class PlatformWebRTC {
|
|||
final Runnable[] retry = new Runnable[1];
|
||||
final int[] loopCount = new int[1];
|
||||
scheduleTask(-1l, retry[0] = () -> {
|
||||
int i = 0;
|
||||
f: {
|
||||
synchronized (lock3) {
|
||||
if (iceCandidates.isEmpty()) {
|
||||
|
@ -650,14 +630,7 @@ public class PlatformWebRTC {
|
|||
|
||||
@Override
|
||||
public void onConnectionChange(RTCPeerConnectionState connectionState) {
|
||||
if (connectionState == RTCPeerConnectionState.DISCONNECTED) {
|
||||
LANServer.this.signalRemoteDisconnect(peerId);
|
||||
} else if (connectionState == RTCPeerConnectionState.CONNECTED) {
|
||||
if (LANServer.this.peerState != PEERSTATE_SUCCESS)
|
||||
LANServer.this.peerState = PEERSTATE_SUCCESS;
|
||||
} else if (connectionState == RTCPeerConnectionState.FAILED) {
|
||||
if (LANServer.this.peerState == PEERSTATE_LOADING)
|
||||
LANServer.this.peerState = PEERSTATE_FAILED;
|
||||
if (connectionState == RTCPeerConnectionState.DISCONNECTED || connectionState == RTCPeerConnectionState.FAILED) {
|
||||
LANServer.this.signalRemoteDisconnect(peerId);
|
||||
}
|
||||
}
|
||||
|
@ -666,9 +639,10 @@ public class PlatformWebRTC {
|
|||
synchronized(peerList) {
|
||||
peerList.put(peerId, peerInstance[0]);
|
||||
}
|
||||
if (peerStateConnect != PEERSTATE_SUCCESS) peerStateConnect = PEERSTATE_SUCCESS;
|
||||
} catch (Throwable e) {
|
||||
if (peerStateConnect == PEERSTATE_LOADING) peerStateConnect = PEERSTATE_FAILED;
|
||||
logger.error("Failed to create peer for \"{}\"", peerId);
|
||||
logger.error(e);
|
||||
signalRemoteDisconnect(peerId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -871,7 +845,6 @@ public class PlatformWebRTC {
|
|||
synchronized(serverLANEventBuffer) {
|
||||
serverLANEventBuffer.clear();
|
||||
}
|
||||
rtcLANServer.resetPeerStates();
|
||||
rtcLANServer.setIceServers(servers);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,11 +25,20 @@ public class EaglerLWJGLAllocator {
|
|||
}
|
||||
}
|
||||
|
||||
private static final boolean enableAllocCount = false;
|
||||
private static volatile int allocCount = 0;
|
||||
|
||||
public static int getAllocCount() {
|
||||
if(!enableAllocCount) throw new UnsupportedOperationException();
|
||||
return allocCount;
|
||||
}
|
||||
|
||||
public static ByteBuffer allocByteBuffer(int len) {
|
||||
long ret = JEmalloc.nje_malloc(len);
|
||||
if(ret == 0l) {
|
||||
throw new OutOfMemoryError("Native je_malloc call returned null pointer!");
|
||||
}
|
||||
if(enableAllocCount) ++allocCount;
|
||||
return new EaglerLWJGLByteBuffer(ret, len, true);
|
||||
}
|
||||
|
||||
|
@ -38,6 +47,7 @@ public class EaglerLWJGLAllocator {
|
|||
if(ret == 0l) {
|
||||
throw new OutOfMemoryError("Native je_malloc call returned null pointer!");
|
||||
}
|
||||
if(enableAllocCount) ++allocCount;
|
||||
return new EaglerLWJGLShortBuffer(ret, len, true);
|
||||
}
|
||||
|
||||
|
@ -46,6 +56,7 @@ public class EaglerLWJGLAllocator {
|
|||
if(ret == 0l) {
|
||||
throw new OutOfMemoryError("Native je_malloc call returned null pointer!");
|
||||
}
|
||||
if(enableAllocCount) ++allocCount;
|
||||
return new EaglerLWJGLIntBuffer(ret, len, true);
|
||||
}
|
||||
|
||||
|
@ -54,6 +65,7 @@ public class EaglerLWJGLAllocator {
|
|||
if(ret == 0l) {
|
||||
throw new OutOfMemoryError("Native je_malloc call returned null pointer!");
|
||||
}
|
||||
if(enableAllocCount) ++allocCount;
|
||||
return new EaglerLWJGLFloatBuffer(ret, len, true);
|
||||
}
|
||||
|
||||
|
@ -62,6 +74,7 @@ public class EaglerLWJGLAllocator {
|
|||
EaglerLWJGLByteBuffer buf = (EaglerLWJGLByteBuffer)buffer;
|
||||
if(buf.original) {
|
||||
JEmalloc.nje_free(buf.address);
|
||||
if(enableAllocCount) --allocCount;
|
||||
}else {
|
||||
throwNotOriginal(buffer);
|
||||
}
|
||||
|
@ -84,6 +97,7 @@ public class EaglerLWJGLAllocator {
|
|||
EaglerLWJGLShortBuffer buf = (EaglerLWJGLShortBuffer)buffer;
|
||||
if(buf.original) {
|
||||
JEmalloc.nje_free(buf.address);
|
||||
if(enableAllocCount) --allocCount;
|
||||
}else {
|
||||
throwNotOriginal(buffer);
|
||||
}
|
||||
|
@ -106,6 +120,7 @@ public class EaglerLWJGLAllocator {
|
|||
EaglerLWJGLIntBuffer buf = (EaglerLWJGLIntBuffer)buffer;
|
||||
if(buf.original) {
|
||||
JEmalloc.nje_free(buf.address);
|
||||
if(enableAllocCount) --allocCount;
|
||||
}else {
|
||||
throwNotOriginal(buffer);
|
||||
}
|
||||
|
@ -128,6 +143,7 @@ public class EaglerLWJGLAllocator {
|
|||
EaglerLWJGLFloatBuffer buf = (EaglerLWJGLFloatBuffer)buffer;
|
||||
if(buf.original) {
|
||||
JEmalloc.nje_free(buf.address);
|
||||
if(enableAllocCount) --allocCount;
|
||||
}else {
|
||||
throwNotOriginal(buffer);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ public class EaglercraftVersion {
|
|||
/// Customize these to fit your fork:
|
||||
|
||||
public static final String projectForkName = "EaglercraftX";
|
||||
public static final String projectForkVersion = "u42";
|
||||
public static final String projectForkVersion = "u43";
|
||||
public static final String projectForkVendor = "lax1dude";
|
||||
|
||||
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";
|
||||
|
@ -20,20 +20,20 @@ public class EaglercraftVersion {
|
|||
public static final String projectOriginName = "EaglercraftX";
|
||||
public static final String projectOriginAuthor = "lax1dude";
|
||||
public static final String projectOriginRevision = "1.8";
|
||||
public static final String projectOriginVersion = "u42";
|
||||
public static final String projectOriginVersion = "u43";
|
||||
|
||||
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace
|
||||
|
||||
// EPK Version Identifier
|
||||
|
||||
public static final String EPKVersionIdentifier = "u42"; // Set to null to disable EPK version check
|
||||
public static final String EPKVersionIdentifier = "u43"; // Set to null to disable EPK version check
|
||||
|
||||
// Updating configuration
|
||||
|
||||
public static final boolean enableUpdateService = true;
|
||||
|
||||
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
|
||||
public static final int updateBundlePackageVersionInt = 42;
|
||||
public static final int updateBundlePackageVersionInt = 43;
|
||||
|
||||
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;
|
||||
|
||||
|
|
|
@ -31,8 +31,6 @@ import java.math.BigInteger;
|
|||
import java.math.MathContext;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.text.DateFormatSymbols;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
|
@ -1449,12 +1447,7 @@ public final class HFormatter implements Closeable, Flushable {
|
|||
}
|
||||
|
||||
if (null == lineSeparator) {
|
||||
lineSeparator = AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
|
||||
public String run() {
|
||||
return System.getProperty("line.separator"); //$NON-NLS-1$
|
||||
}
|
||||
});
|
||||
lineSeparator = System.getProperty("line.separator");
|
||||
}
|
||||
return lineSeparator;
|
||||
}
|
||||
|
|
|
@ -40,14 +40,6 @@ public class Touch {
|
|||
return PlatformInput.touchGetEventTouchY(pointId);
|
||||
}
|
||||
|
||||
public static float getEventTouchRadiusX(int pointId) {
|
||||
return PlatformInput.touchGetEventTouchRadiusX(pointId);
|
||||
}
|
||||
|
||||
public static float getEventTouchRadiusY(int pointId) {
|
||||
return PlatformInput.touchGetEventTouchRadiusY(pointId);
|
||||
}
|
||||
|
||||
public static float getEventTouchRadiusMixed(int pointId) {
|
||||
return PlatformInput.touchGetEventTouchRadiusMixed(pointId);
|
||||
}
|
||||
|
@ -72,14 +64,6 @@ public class Touch {
|
|||
return PlatformInput.touchPointY(pointId);
|
||||
}
|
||||
|
||||
public static float touchPointRadiusX(int pointId) {
|
||||
return PlatformInput.touchRadiusX(pointId);
|
||||
}
|
||||
|
||||
public static float touchPointRadiusY(int pointId) {
|
||||
return PlatformInput.touchRadiusY(pointId);
|
||||
}
|
||||
|
||||
public static float touchPointRadiusMixed(int pointId) {
|
||||
return PlatformInput.touchRadiusMixed(pointId);
|
||||
}
|
||||
|
|
|
@ -84,7 +84,6 @@ public class ChunkUpdateManager {
|
|||
generator.setStatus(ChunkCompileTaskGenerator.Status.DONE);
|
||||
}
|
||||
}
|
||||
generator.getRenderChunk().setCompiledChunk(compiledchunk);
|
||||
} else if (chunkcompiletaskgenerator$type == ChunkCompileTaskGenerator.Type.RESORT_TRANSPARENCY) {
|
||||
if(!compiledchunk.isLayerEmpty(EnumWorldBlockLayer.TRANSLUCENT)) {
|
||||
this.uploadChunk(EnumWorldBlockLayer.TRANSLUCENT, generator.getRegionRenderCacheBuilder()
|
||||
|
@ -96,7 +95,6 @@ public class ChunkUpdateManager {
|
|||
.getWorldRendererByLayer(EnumWorldBlockLayer.REALISTIC_WATER),
|
||||
generator.getRenderChunk(), compiledchunk);
|
||||
}
|
||||
generator.getRenderChunk().setCompiledChunk(compiledchunk);
|
||||
generator.setStatus(ChunkCompileTaskGenerator.Status.DONE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.Comparator;
|
|||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
import net.lax1dude.eaglercraft.v1_8.vector.Vector3f;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
@ -30,6 +31,8 @@ import net.minecraft.util.MathHelper;
|
|||
*/
|
||||
public class WorldRenderer {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger("WorldRenderer");
|
||||
|
||||
private boolean needsUpdate;
|
||||
private int drawMode;
|
||||
private double xOffset;
|
||||
|
@ -68,7 +71,7 @@ public class WorldRenderer {
|
|||
int i = this.byteBuffer.capacity() >> 2;
|
||||
if (parInt1 > (i - pos)) {
|
||||
int k = (((pos + parInt1 + (parInt1 >> 1)) >> 16) + 1) << 16;
|
||||
LogManager.getLogger() .warn("Needed to grow BufferBuilder buffer: Old size " + (i << 2) +
|
||||
logger.warn("Needed to grow BufferBuilder buffer: Old size " + (i << 2) +
|
||||
" bytes, new size " + (k << 2) + " bytes.");
|
||||
ByteBuffer bytebuffer = GLAllocation.createDirectByteBuffer(k << 2);
|
||||
this.byteBuffer.position(0);
|
||||
|
@ -139,17 +142,15 @@ public class WorldRenderer {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* SLOW AND STUPID UPLOAD QUEUE SYSTEM, MUST BE REPLACED
|
||||
*/
|
||||
public WorldRenderer.State func_181672_a() {
|
||||
this.intBuffer.position(0);
|
||||
VertexFormat fmt = this.vertexFormat;
|
||||
int i = (fmt.attribStride >> 2) * vertexCount;
|
||||
IntBuffer buf = EagRuntime.allocateIntBuffer(i);
|
||||
this.intBuffer.position(0);
|
||||
this.intBuffer.limit(i);
|
||||
int[] aint = new int[i];
|
||||
this.intBuffer.get(aint);
|
||||
return new WorldRenderer.State(aint, fmt);
|
||||
buf.put(this.intBuffer);
|
||||
buf.flip();
|
||||
return new WorldRenderer.State(buf, fmt);
|
||||
}
|
||||
|
||||
private static float func_181665_a(FloatBuffer parFloatBuffer, float parFloat1, float parFloat2, float parFloat3,
|
||||
|
@ -172,14 +173,14 @@ public class WorldRenderer {
|
|||
return f12 * f12 + f13 * f13 + f14 * f14;
|
||||
}
|
||||
|
||||
/**
|
||||
* SLOW AND STUPID COMPANION FUNCTION TO 'func_181672_a'
|
||||
*/
|
||||
public void setVertexState(WorldRenderer.State state) {
|
||||
this.grow(state.getRawBuffer().length);
|
||||
IntBuffer buf = state.getRawBuffer();
|
||||
int pp = buf.position();
|
||||
this.grow(buf.remaining());
|
||||
int p = intBuffer.position();
|
||||
this.intBuffer.position(0);
|
||||
this.intBuffer.put(state.getRawBuffer());
|
||||
this.intBuffer.put(buf);
|
||||
buf.position(pp);
|
||||
this.intBuffer.position(p);
|
||||
this.vertexCount = state.getVertexCount();
|
||||
this.vertexFormat = state.getVertexFormat();
|
||||
|
@ -521,24 +522,38 @@ public class WorldRenderer {
|
|||
}
|
||||
|
||||
public class State {
|
||||
private final int[] stateRawBuffer;
|
||||
private final IntBuffer stateRawBuffer;
|
||||
private final VertexFormat stateVertexFormat;
|
||||
private int refCount = 1;
|
||||
|
||||
public State(int[] parArrayOfInt, VertexFormat parVertexFormat) {
|
||||
public State(IntBuffer parArrayOfInt, VertexFormat parVertexFormat) {
|
||||
this.stateRawBuffer = parArrayOfInt;
|
||||
this.stateVertexFormat = parVertexFormat;
|
||||
}
|
||||
|
||||
public int[] getRawBuffer() {
|
||||
public IntBuffer getRawBuffer() {
|
||||
return this.stateRawBuffer;
|
||||
}
|
||||
|
||||
public int getVertexCount() {
|
||||
return this.stateRawBuffer.length / (this.stateVertexFormat.attribStride >> 2);
|
||||
return this.stateRawBuffer.remaining() / (this.stateVertexFormat.attribStride >> 2);
|
||||
}
|
||||
|
||||
public VertexFormat getVertexFormat() {
|
||||
return this.stateVertexFormat;
|
||||
}
|
||||
|
||||
public void retain() {
|
||||
++refCount;
|
||||
}
|
||||
|
||||
public void release() {
|
||||
if(--refCount == 0) {
|
||||
EagRuntime.freeIntBuffer(stateRawBuffer);
|
||||
}
|
||||
if(refCount < 0) {
|
||||
logger.error("WorldRenderer.State released multiple times");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -164,7 +164,7 @@ public class LANClientNetworkManager extends EaglercraftNetworkManager {
|
|||
|
||||
}
|
||||
EagUtils.sleep(20);
|
||||
}while(EagRuntime.steadyTimeMillis() - lm < 5000l);
|
||||
}while(EagRuntime.steadyTimeMillis() - lm < 10000l);
|
||||
|
||||
// no channel was opened
|
||||
sock.writePacket(new RelayPacket06ClientFailure(ipkt.peerId));
|
||||
|
@ -203,7 +203,7 @@ public class LANClientNetworkManager extends EaglercraftNetworkManager {
|
|||
continue mainLoop;
|
||||
}
|
||||
EagUtils.sleep(20);
|
||||
}while(EagRuntime.steadyTimeMillis() - lm < 5000l);
|
||||
}while(EagRuntime.steadyTimeMillis() - lm < 10000l);
|
||||
|
||||
// no ice candidates were sent
|
||||
sock.close();
|
||||
|
|
|
@ -84,7 +84,7 @@ class LANClientPeer {
|
|||
|
||||
protected void update() {
|
||||
if(state != CLOSED) {
|
||||
if(state != CONNECTED && EagRuntime.steadyTimeMillis() - startTime > 10000l) {
|
||||
if(state != CONNECTED && EagRuntime.steadyTimeMillis() - startTime > 13000l) {
|
||||
logger.info("LAN client '{}' handshake timed out", clientId);
|
||||
disconnect();
|
||||
return;
|
||||
|
|
|
@ -1 +1 @@
|
|||
u42
|
||||
u43
|
Binary file not shown.
|
@ -210,7 +210,7 @@ public class BootMenuDatastore {
|
|||
TeaVMUtils.addEventListener(f, "blocked", new EventHandler() {
|
||||
@Override
|
||||
public void handleEvent() {
|
||||
cb.complete(new DatabaseOpen(false, true, null, null));
|
||||
cb.complete(new DatabaseOpen(false, true, "database locked", null));
|
||||
}
|
||||
});
|
||||
TeaVMUtils.addEventListener(f, "success", new EventHandler() {
|
||||
|
|
|
@ -100,7 +100,7 @@ public class PlatformAudio {
|
|||
this.gain = gain;
|
||||
this.pitch = pitch;
|
||||
this.repeat = repeat;
|
||||
source.setOnEnded(this);
|
||||
TeaVMUtils.addEventListener(source, "ended", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -249,12 +249,11 @@ public class PlatformAudio {
|
|||
private static native boolean detectLoadViaAudioBufferSupport(AudioContext ctx);
|
||||
|
||||
private static void detectOGGSupport() {
|
||||
byte[] fileData = EagRuntime.getRequiredResourceBytes("/assets/eagler/audioctx_test_ogg.dat");
|
||||
|
||||
if(((TeaVMClientConfigAdapter)PlatformRuntime.getClientConfigAdapter()).isUseJOrbisAudioDecoderTeaVM()) {
|
||||
logger.info("Note: Using embedded JOrbis OGG decoder");
|
||||
oggSupport = false;
|
||||
}else {
|
||||
byte[] fileData = EagRuntime.getRequiredResourceBytes("/assets/eagler/audioctx_test_ogg.dat");
|
||||
try {
|
||||
Int8Array arr = Int8Array.create(fileData.length);
|
||||
arr.set(TeaVMUtils.unwrapByteArray(fileData), 0);
|
||||
|
|
|
@ -8,7 +8,6 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.teavm.TeaVMUtils;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.teavm.Touch;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.teavm.TouchEvent;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.teavm.VisualViewport;
|
||||
|
||||
|
@ -102,6 +101,7 @@ public class PlatformInput {
|
|||
private static EventListener<?> focus = null;
|
||||
private static EventListener<?> blur = null;
|
||||
private static EventListener<?> pointerlock = null;
|
||||
private static EventListener<?> fullscreen = null;
|
||||
|
||||
private static Map<String,LegacyKeycodeTranslator.LegacyKeycode> keyCodeTranslatorMap = null;
|
||||
|
||||
|
@ -685,7 +685,7 @@ public class PlatformInput {
|
|||
if(fullscreenSupported != FULLSCREEN_NONE) {
|
||||
fullscreenQuery = fullscreenMediaQuery();
|
||||
if(fullscreenSupported == FULLSCREEN_CORE && (keyboardLockSupported = checkKeyboardLockSupported())) {
|
||||
TeaVMUtils.addEventListener(fullscreenQuery, "change", new EventListener<Event>() {
|
||||
TeaVMUtils.addEventListener(fullscreenQuery, "change", fullscreen = new EventListener<Event>() {
|
||||
@Override
|
||||
public void handleEvent(Event evt) {
|
||||
if (!mediaQueryMatches(evt)) {
|
||||
|
@ -840,7 +840,7 @@ public class PlatformInput {
|
|||
@JSBody(params = { "e" }, script = "return (typeof e.location === \"number\") ? e.location : 0;")
|
||||
private static native int getLocationSafe(KeyboardEvent e);
|
||||
|
||||
@JSBody(params = { "el", "i", "j" }, script = "el.setSelectionRange(el, i, j)")
|
||||
@JSBody(params = { "el", "i", "j" }, script = "el.setSelectionRange(i, j)")
|
||||
private static native boolean setSelectionRange(HTMLElement el, int i, int j);
|
||||
|
||||
public static int getWindowWidth() {
|
||||
|
@ -1513,6 +1513,10 @@ public class PlatformInput {
|
|||
win.getDocument().removeEventListener("pointerlockchange", pointerlock);
|
||||
pointerlock = null;
|
||||
}
|
||||
if(fullscreen != null) {
|
||||
TeaVMUtils.removeEventListener(fullscreenQuery, "change", fullscreen);
|
||||
fullscreen = null;
|
||||
}
|
||||
if(mouseUngrabTimeout != -1) {
|
||||
Window.clearTimeout(mouseUngrabTimeout);
|
||||
mouseUngrabTimeout = -1;
|
||||
|
@ -1786,19 +1790,9 @@ public class PlatformInput {
|
|||
return currentTouchEvent != null ? currentTouchEvent.getEventTouches().get(pointId).posY : 0;
|
||||
}
|
||||
|
||||
public static float touchGetEventTouchRadiusX(int pointId) {
|
||||
return currentTouchEvent != null ? (float)currentTouchEvent.getEventTouches().get(pointId).touch.getRadiusXSafe(5.0 * windowDPI) : 1.0f;
|
||||
}
|
||||
|
||||
public static float touchGetEventTouchRadiusY(int pointId) {
|
||||
return currentTouchEvent != null ? (float)currentTouchEvent.getEventTouches().get(pointId).touch.getRadiusYSafe(5.0 * windowDPI) : 1.0f;
|
||||
}
|
||||
|
||||
public static float touchGetEventTouchRadiusMixed(int pointId) {
|
||||
if(currentTouchEvent != null) {
|
||||
Touch t = currentTouchEvent.getEventTouches().get(pointId).touch;
|
||||
double d = 5.0 * windowDPI;
|
||||
return (float)(t.getRadiusXSafe(d) * 0.5 + t.getRadiusYSafe(d) * 0.5);
|
||||
return currentTouchEvent.getEventTouches().get(pointId).radius;
|
||||
}else {
|
||||
return 1.0f;
|
||||
}
|
||||
|
@ -1834,8 +1828,7 @@ public class PlatformInput {
|
|||
|
||||
public static float touchRadiusMixed(int pointId) {
|
||||
if(currentTouchState != null) {
|
||||
Touch t = currentTouchState.getTargetTouches().get(pointId).touch;
|
||||
return (float)(t.getRadiusX() * 0.5 + t.getRadiusY() * 0.5);
|
||||
return currentTouchState.getTargetTouches().get(pointId).radius;
|
||||
}else {
|
||||
return 1.0f;
|
||||
}
|
||||
|
@ -1907,7 +1900,7 @@ public class PlatformInput {
|
|||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
JSObject obj = evt.getTimeStamp();
|
||||
if(TeaVMUtils.isTruthy(obj)) {
|
||||
if(obj != null && TeaVMUtils.isTruthy(obj)) {
|
||||
double d = ((JSNumber)obj).doubleValue();
|
||||
if(lastTouchKeyboardEvtA != 0.0 && (d - lastTouchKeyboardEvtA) < 10.0) {
|
||||
return;
|
||||
|
@ -1953,7 +1946,7 @@ public class PlatformInput {
|
|||
shownTouchKeyboardEventWarning = true;
|
||||
}
|
||||
JSObject obj = evt.getTimeStamp();
|
||||
if(TeaVMUtils.isTruthy(obj)) {
|
||||
if(obj != null && TeaVMUtils.isTruthy(obj)) {
|
||||
double d = ((JSNumber)obj).doubleValue();
|
||||
if(lastTouchKeyboardEvtA != 0.0 && (d - lastTouchKeyboardEvtA) < 10.0) {
|
||||
return;
|
||||
|
@ -2013,7 +2006,7 @@ public class PlatformInput {
|
|||
case "deleteByCut":
|
||||
break;
|
||||
default:
|
||||
PlatformRuntime.logger.info("Ingoring InputEvent.inputType \"{}\" from on-screen keyboard", evt.getInputType());
|
||||
PlatformRuntime.logger.info("Ignoring InputEvent.inputType \"{}\" from on-screen keyboard", evt.getInputType());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2027,7 +2020,7 @@ public class PlatformInput {
|
|||
PlatformRuntime.logger.info("Note: Caught legacy input events from on-screen keyboard, browser could be outdated and doesn't support beforeinput event, or does not respond to cancelling beforeinput");
|
||||
shownLegacyTouchKeyboardWarning = true;
|
||||
}
|
||||
if(TeaVMUtils.isTruthy(obj)) {
|
||||
if(obj != null && TeaVMUtils.isTruthy(obj)) {
|
||||
double d = ((JSNumber)obj).doubleValue();
|
||||
if(lastTouchKeyboardEvtA != 0.0 && (d - lastTouchKeyboardEvtA) < 10.0) {
|
||||
return;
|
||||
|
|
|
@ -252,6 +252,7 @@ public class PlatformRuntime {
|
|||
}
|
||||
|
||||
useVisualViewport = false;
|
||||
if(teavmCfg.isUseVisualViewportTeaVM()) {
|
||||
if(isVisualViewportSupported()) {
|
||||
if(isEmbeddedInBody) {
|
||||
useVisualViewport = true;
|
||||
|
@ -266,6 +267,7 @@ public class PlatformRuntime {
|
|||
if(useVisualViewport) {
|
||||
logger.info("Note: Detected game is embedded in body, some screens may be resized to window.visualViewport instead for a better mobile experience");
|
||||
}
|
||||
}
|
||||
|
||||
ByteBuffer endiannessTestBytes = allocateByteBuffer(4);
|
||||
try {
|
||||
|
|
|
@ -149,6 +149,7 @@ public class PlatformVoiceClient {
|
|||
private GainNode gain = null;
|
||||
private PannerNode panner = null;
|
||||
private AudioNode recNode = null;
|
||||
private HTMLAudioElement mediaElement = null;
|
||||
|
||||
public VoicePeer(EaglercraftUUID peerId, JSObject peerConnection, boolean offer) {
|
||||
this.peerId = peerId;
|
||||
|
@ -164,10 +165,10 @@ public class PlatformVoiceClient {
|
|||
});
|
||||
TeaVMUtils.addEventListener(peerConnection, "track", (EventListener<Event>) evt -> {
|
||||
rawStream = getFirstStream(evt);
|
||||
HTMLAudioElement aud = (HTMLAudioElement) PlatformRuntime.doc.createElement("audio");
|
||||
aud.setAutoplay(true);
|
||||
aud.setMuted(true);
|
||||
setSrcObject(aud, rawStream);
|
||||
mediaElement = (HTMLAudioElement) PlatformRuntime.doc.createElement("audio");
|
||||
mediaElement.setAutoplay(true);
|
||||
mediaElement.setMuted(true);
|
||||
setSrcObject(mediaElement, rawStream);
|
||||
handlePeerTrack(this, rawStream);
|
||||
});
|
||||
|
||||
|
|
|
@ -496,10 +496,6 @@ public class PlatformWebRTC {
|
|||
}
|
||||
}
|
||||
|
||||
public static final byte PEERSTATE_FAILED = 0;
|
||||
public static final byte PEERSTATE_SUCCESS = 1;
|
||||
public static final byte PEERSTATE_LOADING = 2;
|
||||
|
||||
public static class LANPeer {
|
||||
public LANServer client;
|
||||
public String peerId;
|
||||
|
@ -575,12 +571,7 @@ public class PlatformWebRTC {
|
|||
|
||||
TeaVMUtils.addEventListener(peerConnection, "connectionstatechange", (EventListener<Event>) evt -> {
|
||||
String connectionState = getConnectionState(peerConnection);
|
||||
if ("disconnected".equals(connectionState)) {
|
||||
client.signalRemoteDisconnect(peerId);
|
||||
} else if ("connected".equals(connectionState)) {
|
||||
if (client.peerState != PEERSTATE_SUCCESS) client.peerState = PEERSTATE_SUCCESS;
|
||||
} else if ("failed".equals(connectionState)) {
|
||||
if (client.peerState == PEERSTATE_LOADING) client.peerState = PEERSTATE_FAILED;
|
||||
if ("disconnected".equals(connectionState) || "failed".equals(connectionState)) {
|
||||
client.signalRemoteDisconnect(peerId);
|
||||
}
|
||||
});
|
||||
|
@ -604,27 +595,22 @@ public class PlatformWebRTC {
|
|||
synchronized(serverLANEventBuffer) {
|
||||
serverLANEventBuffer.put(peerId, e);
|
||||
}
|
||||
if (client.peerStateDesc != PEERSTATE_SUCCESS) client.peerStateDesc = PEERSTATE_SUCCESS;
|
||||
}, err -> {
|
||||
logger.error("Failed to set local description for \"{}\"! {}", peerId, TeaVMUtils.safeErrorMsgToString(err));
|
||||
if (client.peerStateDesc == PEERSTATE_LOADING) client.peerStateDesc = PEERSTATE_FAILED;
|
||||
client.signalRemoteDisconnect(peerId);
|
||||
});
|
||||
}, err -> {
|
||||
logger.error("Failed to create answer for \"{}\"! {}", peerId, TeaVMUtils.safeErrorMsgToString(err));
|
||||
if (client.peerStateDesc == PEERSTATE_LOADING) client.peerStateDesc = PEERSTATE_FAILED;
|
||||
client.signalRemoteDisconnect(peerId);
|
||||
});
|
||||
}
|
||||
}, err -> {
|
||||
logger.error("Failed to set remote description for \"{}\"! {}", peerId, TeaVMUtils.safeErrorMsgToString(err));
|
||||
if (client.peerStateDesc == PEERSTATE_LOADING) client.peerStateDesc = PEERSTATE_FAILED;
|
||||
client.signalRemoteDisconnect(peerId);
|
||||
});
|
||||
} catch (Throwable err) {
|
||||
logger.error("Failed to parse remote description for \"{}\"! {}", peerId, err.getMessage());
|
||||
logger.error(err);
|
||||
if (client.peerStateDesc == PEERSTATE_LOADING) client.peerStateDesc = PEERSTATE_FAILED;
|
||||
client.signalRemoteDisconnect(peerId);
|
||||
}
|
||||
}
|
||||
|
@ -632,10 +618,8 @@ public class PlatformWebRTC {
|
|||
public void addICECandidate(String candidates) {
|
||||
try {
|
||||
addIceCandidates(peerConnection, candidates);
|
||||
if (client.peerStateIce != PEERSTATE_SUCCESS) client.peerStateIce = PEERSTATE_SUCCESS;
|
||||
} catch (Throwable err) {
|
||||
logger.error("Failed to parse ice candidate for \"{}\"! {}", peerId, err.getMessage());
|
||||
if (client.peerStateIce == PEERSTATE_LOADING) client.peerStateIce = PEERSTATE_FAILED;
|
||||
client.signalRemoteDisconnect(peerId);
|
||||
}
|
||||
}
|
||||
|
@ -659,11 +643,6 @@ public class PlatformWebRTC {
|
|||
public Set<Map<String, String>> iceServers = new HashSet<>();
|
||||
public Map<String, LANPeer> peerList = new HashMap<>();
|
||||
public Map<String, LANPeer> ipcMapList = new HashMap<>();
|
||||
public byte peerState = PEERSTATE_LOADING;
|
||||
public byte peerStateConnect = PEERSTATE_LOADING;
|
||||
public byte peerStateInitial = PEERSTATE_LOADING;
|
||||
public byte peerStateDesc = PEERSTATE_LOADING;
|
||||
public byte peerStateIce = PEERSTATE_LOADING;
|
||||
|
||||
public void setIceServers(String[] urls) {
|
||||
iceServers.clear();
|
||||
|
@ -706,18 +685,15 @@ public class PlatformWebRTC {
|
|||
}
|
||||
}
|
||||
|
||||
public void resetPeerStates() {
|
||||
peerState = peerStateConnect = peerStateInitial = peerStateDesc = peerStateIce = PEERSTATE_LOADING;
|
||||
}
|
||||
|
||||
public void signalRemoteConnect(String peerId) {
|
||||
try {
|
||||
JSObject peerConnection = createRTCPeerConnection(JSONWriter.valueToString(iceServers));
|
||||
LANPeer peerInstance = new LANPeer(this, peerId, peerConnection);
|
||||
peerList.put(peerId, peerInstance);
|
||||
if (peerStateConnect != PEERSTATE_SUCCESS) peerStateConnect = PEERSTATE_SUCCESS;
|
||||
} catch (Throwable e) {
|
||||
if (peerStateConnect == PEERSTATE_LOADING) peerStateConnect = PEERSTATE_FAILED;
|
||||
logger.error("Failed to create peer for \"{}\"", peerId);
|
||||
logger.error(e);
|
||||
signalRemoteDisconnect(peerId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -907,7 +883,6 @@ public class PlatformWebRTC {
|
|||
synchronized(serverLANEventBuffer) {
|
||||
serverLANEventBuffer.clear();
|
||||
}
|
||||
rtcLANServer.resetPeerStates();
|
||||
rtcLANServer.setIceServers(servers);
|
||||
}
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ public class IndexedDBFilesystem implements IEaglerFilesystem {
|
|||
TeaVMUtils.addEventListener(f, "blocked", new EventHandler() {
|
||||
@Override
|
||||
public void handleEvent() {
|
||||
cb.complete(new DatabaseOpen(false, true, null, null));
|
||||
cb.complete(new DatabaseOpen(false, true, "database locked", null));
|
||||
}
|
||||
});
|
||||
TeaVMUtils.addEventListener(f, "success", new EventHandler() {
|
||||
|
|
|
@ -24,19 +24,23 @@ public class OffsetTouch {
|
|||
public final int eventUID;
|
||||
public final int posX;
|
||||
public final int posY;
|
||||
public final float radius;
|
||||
|
||||
public OffsetTouch(Touch touch, int eventUID, int posX, int posY) {
|
||||
public OffsetTouch(Touch touch, int eventUID, int posX, int posY, float radius) {
|
||||
this.touch = touch;
|
||||
this.eventUID = eventUID;
|
||||
this.posX = posX;
|
||||
this.posY = posY;
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
public static OffsetTouch create(Touch touch, ITouchUIDMapper mapper, int originX, int originY) {
|
||||
double contentScale = PlatformInput.getDPI();
|
||||
double d = 5.0 * contentScale;
|
||||
OffsetTouch ot = new OffsetTouch(touch, mapper.call(touch.getIdentifier()),
|
||||
(int) ((touch.getPageX() - originX) * contentScale),
|
||||
PlatformInput.getWindowHeight() - (int) ((touch.getPageY() - originY) * contentScale) - 1);
|
||||
PlatformInput.getWindowHeight() - (int) ((touch.getPageY() - originY) * contentScale) - 1,
|
||||
(float)(touch.getRadiusXSafe(d) * 0.5 + touch.getRadiusYSafe(d) * 0.5));
|
||||
return ot;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,9 @@ public class TeaVMUtils {
|
|||
@JSBody(params = { "obj", "name", "handler" }, script = "obj.addEventListener(name, handler);")
|
||||
public static native void addEventListener(JSObject obj, String name, JSObject handler);
|
||||
|
||||
@JSBody(params = { "obj", "name", "handler" }, script = "obj.removeEventListener(name, handler);")
|
||||
public static native void removeEventListener(JSObject obj, String name, JSObject handler);
|
||||
|
||||
@JSBody(params = {}, script = "return (new Error()).stack;")
|
||||
public static native String dumpJSStackTrace();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user