Update #24 - 1000s of optimizations, shared worlds on desktop

This commit is contained in:
lax1dude
2024-03-02 20:51:44 -08:00
parent a50c93cb75
commit 8ab65942c5
624 changed files with 8091 additions and 3620 deletions

View File

@ -42,11 +42,13 @@ public interface IClientConfigAdapter {
String getWorldsDB();
String getResourcePacksDB();
JSONObject dumpConfig();
List<RelayEntry> getRelays();
boolean checkShaderGLErrors();
boolean isCheckShaderGLErrors();
boolean isDemo();

View File

@ -188,8 +188,12 @@ public class VFile2 {
return null;
}
ByteBuffer readBuffer = PlatformFilesystem.eaglerRead(path);
byte[] copyBuffer = PlatformRuntime.castNativeByteBuffer(readBuffer);
if(copyBuffer != null) {
return copyBuffer;
}
try {
byte[] copyBuffer = new byte[readBuffer.remaining()];
copyBuffer = new byte[readBuffer.remaining()];
readBuffer.get(copyBuffer);
return copyBuffer;
}finally {
@ -219,7 +223,12 @@ public class VFile2 {
public void setAllBytes(byte[] bytes) {
assertNotRelative();
ByteBuffer copyBuffer = PlatformRuntime.allocateByteBuffer(bytes.length);
ByteBuffer copyBuffer = PlatformRuntime.castPrimitiveByteArray(bytes);
if(copyBuffer != null) {
PlatformFilesystem.eaglerWrite(path, copyBuffer);
return;
}
copyBuffer = PlatformRuntime.allocateByteBuffer(bytes.length);
try {
copyBuffer.put(bytes);
copyBuffer.flip();

View File

@ -54,7 +54,7 @@ class VFileInputStream extends InputStream {
if(len > 0) {
fileBuffer.get(b, off, len);
}
return len;
return len <= 0 ? -1 : len;
}
@Override

View File

@ -1,8 +1,8 @@
package net.lax1dude.eaglercraft.v1_8.internal.vfs2;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import net.lax1dude.eaglercraft.v1_8.EaglerOutputStream;
import net.lax1dude.eaglercraft.v1_8.internal.PlatformFilesystem;
import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime;
import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
@ -22,7 +22,7 @@ import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
* POSSIBILITY OF SUCH DAMAGE.
*
*/
class VFileOutputStream extends ByteArrayOutputStream {
class VFileOutputStream extends EaglerOutputStream {
private final VFile2 vfsFile;
private boolean closed = false;