u43
This commit is contained in:
parent
fef7defbe7
commit
8b8ae0669a
|
@ -1 +1 @@
|
|||
u42
|
||||
u43
|
Binary file not shown.
|
@ -600,10 +600,11 @@ public abstract class GuiScreen extends Gui implements GuiYesNoCallback {
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -92,7 +92,6 @@ public class ChunkRenderWorker {
|
|||
this.chunkRenderDispatcher.uploadChunk(enumworldblocklayer,
|
||||
generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(enumworldblocklayer),
|
||||
generator.getRenderChunk(), compiledchunk);
|
||||
generator.getRenderChunk().setCompiledChunk(compiledchunk);
|
||||
generator.setStatus(ChunkCompileTaskGenerator.Status.DONE);
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +106,6 @@ public class ChunkRenderWorker {
|
|||
.getWorldRendererByLayer(EnumWorldBlockLayer.REALISTIC_WATER),
|
||||
generator.getRenderChunk(), compiledchunk);
|
||||
}
|
||||
generator.getRenderChunk().setCompiledChunk(compiledchunk);
|
||||
generator.setStatus(ChunkCompileTaskGenerator.Status.DONE);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.minecraft.client.renderer.chunk;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
@ -30,7 +31,7 @@ import net.minecraft.util.EnumWorldBlockLayer;
|
|||
*
|
||||
*/
|
||||
public class CompiledChunk {
|
||||
public static final CompiledChunk DUMMY = new CompiledChunk() {
|
||||
public static final CompiledChunk DUMMY = new CompiledChunk(null) {
|
||||
protected void setLayerUsed(EnumWorldBlockLayer layer) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
@ -43,6 +44,7 @@ public class CompiledChunk {
|
|||
return true;
|
||||
}
|
||||
};
|
||||
private final RenderChunk chunk;
|
||||
private final boolean[] layersUsed = new boolean[EnumWorldBlockLayer._VALUES.length];
|
||||
private final boolean[] layersStarted = new boolean[EnumWorldBlockLayer._VALUES.length];
|
||||
private boolean empty = true;
|
||||
|
@ -51,6 +53,20 @@ public class CompiledChunk {
|
|||
private WorldRenderer.State state;
|
||||
private WorldRenderer.State stateWater;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return this.empty;
|
||||
}
|
||||
|
@ -93,6 +109,9 @@ public class CompiledChunk {
|
|||
}
|
||||
|
||||
public void setState(WorldRenderer.State stateIn) {
|
||||
if (this.state != stateIn && this.state != null) {
|
||||
this.state.release();
|
||||
}
|
||||
this.state = stateIn;
|
||||
}
|
||||
|
||||
|
@ -101,6 +120,9 @@ public class CompiledChunk {
|
|||
}
|
||||
|
||||
public void setStateRealisticWater(WorldRenderer.State stateIn) {
|
||||
if (this.stateWater != stateIn && this.stateWater != null) {
|
||||
this.stateWater.release();
|
||||
}
|
||||
this.stateWater = stateIn;
|
||||
}
|
||||
}
|
|
@ -131,7 +131,11 @@ public class RenderChunk {
|
|||
}
|
||||
|
||||
public void rebuildChunk(float x, float y, float z, ChunkCompileTaskGenerator generator) {
|
||||
CompiledChunk compiledchunk = new CompiledChunk();
|
||||
if (compiledChunk == CompiledChunk.DUMMY) {
|
||||
compiledChunk = new CompiledChunk(this);
|
||||
} else {
|
||||
compiledChunk.reset();
|
||||
}
|
||||
boolean flag = true;
|
||||
BlockPos blockpos = this.position;
|
||||
BlockPos blockpos1 = blockpos.add(15, 15, 15);
|
||||
|
@ -142,7 +146,7 @@ public class RenderChunk {
|
|||
}
|
||||
|
||||
regionrendercache = new RegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1);
|
||||
generator.setCompiledChunk(compiledchunk);
|
||||
generator.setCompiledChunk(compiledChunk);
|
||||
|
||||
VisGraph visgraph = new VisGraph();
|
||||
HashSet hashset = Sets.newHashSet();
|
||||
|
@ -163,7 +167,7 @@ public class RenderChunk {
|
|||
TileEntitySpecialRenderer tileentityspecialrenderer = TileEntityRendererDispatcher.instance
|
||||
.getSpecialRenderer(tileentity);
|
||||
if (tileentity != null && tileentityspecialrenderer != null) {
|
||||
compiledchunk.addTileEntity(tileentity);
|
||||
compiledChunk.addTileEntity(tileentity);
|
||||
if (tileentityspecialrenderer.func_181055_a()) {
|
||||
hashset.add(tileentity);
|
||||
}
|
||||
|
@ -174,8 +178,8 @@ public class RenderChunk {
|
|||
int i = enumworldblocklayer1.ordinal();
|
||||
if (block.getRenderType() != -1) {
|
||||
WorldRenderer worldrenderer = generator.getRegionRenderCacheBuilder().getWorldRendererByLayerId(i);
|
||||
if (!compiledchunk.isLayerStarted(enumworldblocklayer1)) {
|
||||
compiledchunk.setLayerStarted(enumworldblocklayer1);
|
||||
if (!compiledChunk.isLayerStarted(enumworldblocklayer1)) {
|
||||
compiledChunk.setLayerStarted(enumworldblocklayer1);
|
||||
this.preRenderBlocks(worldrenderer, blockpos);
|
||||
}
|
||||
|
||||
|
@ -186,8 +190,8 @@ public class RenderChunk {
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -201,18 +205,18 @@ public class RenderChunk {
|
|||
for (int i = 0; i < layers.length; ++i) {
|
||||
EnumWorldBlockLayer enumworldblocklayer = layers[i];
|
||||
if (aboolean[enumworldblocklayer.ordinal()]) {
|
||||
compiledchunk.setLayerUsed(enumworldblocklayer);
|
||||
compiledChunk.setLayerUsed(enumworldblocklayer);
|
||||
}
|
||||
|
||||
if (compiledchunk.isLayerStarted(enumworldblocklayer)) {
|
||||
if (compiledChunk.isLayerStarted(enumworldblocklayer)) {
|
||||
this.postRenderBlocks(enumworldblocklayer, x, y, z,
|
||||
generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(enumworldblocklayer),
|
||||
compiledchunk);
|
||||
compiledChunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
compiledchunk.setVisibility(visgraph.computeVisibility());
|
||||
compiledChunk.setVisibility(visgraph.computeVisibility());
|
||||
|
||||
HashSet hashset1 = Sets.newHashSet(hashset);
|
||||
HashSet hashset2 = Sets.newHashSet(this.field_181056_j);
|
||||
|
@ -287,13 +291,13 @@ public class RenderChunk {
|
|||
return this.compiledChunk;
|
||||
}
|
||||
|
||||
public void setCompiledChunk(CompiledChunk compiledChunkIn) {
|
||||
this.compiledChunk = compiledChunkIn;
|
||||
}
|
||||
|
||||
public void stopCompileTask() {
|
||||
this.finishCompileTask();
|
||||
this.compiledChunk = CompiledChunk.DUMMY;
|
||||
if (this.compiledChunk != CompiledChunk.DUMMY) {
|
||||
this.compiledChunk.setState(null);
|
||||
this.compiledChunk.setStateRealisticWater(null);
|
||||
this.compiledChunk = CompiledChunk.DUMMY;
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteGlResources() {
|
||||
|
|
|
@ -213,7 +213,7 @@ public class GameSettings {
|
|||
public boolean hasShownProfanityFilter = false;
|
||||
public float touchControlOpacity = 1.0f;
|
||||
public boolean hideDefaultUsernameWarning = false;
|
||||
public boolean hideVideoSettingsWarning = false;
|
||||
public boolean hideVideoSettingsWarning = EagRuntime.getPlatformType() == EnumPlatformType.DESKTOP;
|
||||
|
||||
public int voiceListenRadius = 16;
|
||||
public float voiceListenVolume = 0.5f;
|
||||
|
|
|
@ -115,7 +115,8 @@ public abstract class TileEntity {
|
|||
tileentity = (TileEntity) oclass.get();
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
logger.error("Could not create TileEntity", exception);
|
||||
logger.error("Could not create TileEntity");
|
||||
logger.error(exception);
|
||||
}
|
||||
|
||||
if (tileentity != null) {
|
||||
|
|
|
@ -61,7 +61,7 @@ public class BlockPos extends Vec3i {
|
|||
}
|
||||
|
||||
public BlockPos(Vec3i source) {
|
||||
this(source.getX(), source.getY(), source.getZ());
|
||||
this(source.x, source.y, source.z);
|
||||
}
|
||||
|
||||
/**+
|
||||
|
|
|
@ -1929,7 +1929,7 @@ public abstract class World implements IBlockAccess {
|
|||
public void setTileEntity(BlockPos pos, TileEntity tileEntityIn) {
|
||||
if (tileEntityIn != null && !tileEntityIn.isInvalid()) {
|
||||
if (this.processingLoadedTiles) {
|
||||
tileEntityIn.setPos(pos);
|
||||
tileEntityIn.setPos(new BlockPos(pos));
|
||||
Iterator iterator = this.addedTileEntityList.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
|
|
|
@ -261,6 +261,9 @@ public class Chunk {
|
|||
}
|
||||
|
||||
private void recheckGaps(boolean parFlag) {
|
||||
if (!this.worldObj.isRemote) {
|
||||
++EaglerMinecraftServer.counterLightUpdate;
|
||||
}
|
||||
if (this.worldObj.isAreaLoaded(new BlockPos(this.xPosition * 16 + 8, 0, this.zPosition * 16 + 8), 16)) {
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
for (int j = 0; j < 16; ++j) {
|
||||
|
@ -766,11 +769,12 @@ public class Chunk {
|
|||
public TileEntity getTileEntity(BlockPos blockpos, Chunk.EnumCreateEntityType chunk$enumcreateentitytype) {
|
||||
TileEntity tileentity = (TileEntity) this.chunkTileEntityMap.get(blockpos);
|
||||
if (tileentity == null) {
|
||||
BlockPos pos2 = new BlockPos(blockpos);
|
||||
if (chunk$enumcreateentitytype == Chunk.EnumCreateEntityType.IMMEDIATE) {
|
||||
tileentity = this.createNewTileEntity(blockpos);
|
||||
this.worldObj.setTileEntity(blockpos, tileentity);
|
||||
tileentity = this.createNewTileEntity(pos2);
|
||||
this.worldObj.setTileEntity(pos2, tileentity);
|
||||
} else if (chunk$enumcreateentitytype == Chunk.EnumCreateEntityType.QUEUED) {
|
||||
this.tileEntityPosQueue.add(blockpos);
|
||||
this.tileEntityPosQueue.add(pos2);
|
||||
}
|
||||
} else if (tileentity.isInvalid()) {
|
||||
this.chunkTileEntityMap.remove(blockpos);
|
||||
|
@ -790,6 +794,7 @@ public class Chunk {
|
|||
|
||||
public void addTileEntity(BlockPos blockpos, TileEntity tileentity) {
|
||||
tileentity.setWorldObj(this.worldObj);
|
||||
blockpos = new BlockPos(blockpos);
|
||||
tileentity.setPos(blockpos);
|
||||
if (this.getBlock(blockpos) instanceof ITileEntityProvider) {
|
||||
if (this.chunkTileEntityMap.containsKey(blockpos)) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,19 +252,21 @@ public class PlatformRuntime {
|
|||
}
|
||||
|
||||
useVisualViewport = false;
|
||||
if(isVisualViewportSupported()) {
|
||||
if(isEmbeddedInBody) {
|
||||
useVisualViewport = true;
|
||||
}else {
|
||||
HTMLElement bodyTag = doc.getBody();
|
||||
if (Math.abs(bodyTag.getClientWidth() - parent.getClientWidth()) <= 10
|
||||
&& Math.abs(bodyTag.getClientHeight() - parent.getClientHeight()) <= 10) {
|
||||
if(teavmCfg.isUseVisualViewportTeaVM()) {
|
||||
if(isVisualViewportSupported()) {
|
||||
if(isEmbeddedInBody) {
|
||||
useVisualViewport = true;
|
||||
}else {
|
||||
HTMLElement bodyTag = doc.getBody();
|
||||
if (Math.abs(bodyTag.getClientWidth() - parent.getClientWidth()) <= 10
|
||||
&& Math.abs(bodyTag.getClientHeight() - parent.getClientHeight()) <= 10) {
|
||||
useVisualViewport = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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");
|
||||
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);
|
||||
|
|
|
@ -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