Update #32 - Fixed some bugs in the client

This commit is contained in:
lax1dude
2024-05-30 21:42:11 -07:00
parent 6ea4ffe62d
commit aeb63fcd41
23 changed files with 214 additions and 52 deletions

View File

@ -10,7 +10,7 @@ public class EaglercraftVersion {
/// Customize these to fit your fork:
public static final String projectForkName = "EaglercraftX";
public static final String projectForkVersion = "u31";
public static final String projectForkVersion = "u32";
public static final String projectForkVendor = "lax1dude";
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";
@ -20,7 +20,7 @@ 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 = "u31";
public static final String projectOriginVersion = "u32";
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace
@ -31,7 +31,7 @@ public class EaglercraftVersion {
public static final boolean enableUpdateService = true;
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
public static final int updateBundlePackageVersionInt = 31;
public static final int updateBundlePackageVersionInt = 32;
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;

View File

@ -60,6 +60,10 @@ public class GLObjectMap<T> {
return (T) values[obj];
}
public void set(int obj, T val) {
values[obj] = val;
}
private void resize() {
int oldSize = size;
size += size / 2;

View File

@ -153,11 +153,12 @@ public class EaglerFolderResourcePack extends AbstractResourcePack {
List<String> fileNames = Lists.newArrayList();
logger.info("Counting files...");
ZipInputStream ziss = new ZipInputStream(new EaglerInputStream(file));
ZipEntry zipEntry;
while ((zipEntry = ziss.getNextEntry()) != null) {
if (!zipEntry.isDirectory()) {
fileNames.add(zipEntry.getName());
try(ZipInputStream ziss = new ZipInputStream(new EaglerInputStream(file))) {
while ((zipEntry = ziss.getNextEntry()) != null) {
if (!zipEntry.isDirectory()) {
fileNames.add(zipEntry.getName());
}
}
}
@ -195,22 +196,30 @@ public class EaglerFolderResourcePack extends AbstractResourcePack {
int totalSize = 0;
int totalFiles = 0;
int lastProg = 0;
ziss = new ZipInputStream(new EaglerInputStream(file));
while ((zipEntry = ziss.getNextEntry()) != null) {
if (!zipEntry.isDirectory()) {
fn = zipEntry.getName();
if(fn.length() > prefixLen) {
byte[] buffer = new byte[(int)zipEntry.getSize()];
int i = 0, j;
while(i < buffer.length && (j = ziss.read(buffer, i, buffer.length - i)) != -1) {
i += j;
}
(new VFile2(prefix, folderName, fn.substring(prefixLen))).setAllBytes(buffer);
totalSize += buffer.length;
++totalFiles;
if(totalSize - lastProg > 25000) {
lastProg = totalSize;
logger.info("Extracted {} files, {} bytes from ZIP file...", totalFiles, totalSize);
try(ZipInputStream ziss = new ZipInputStream(new EaglerInputStream(file))) {
int sz;
while ((zipEntry = ziss.getNextEntry()) != null) {
if (!zipEntry.isDirectory()) {
fn = zipEntry.getName();
if(fn.length() > prefixLen) {
byte[] buffer;
sz = (int)zipEntry.getSize();
if(sz >= 0) {
buffer = new byte[sz];
int i = 0, j;
while(i < buffer.length && (j = ziss.read(buffer, i, buffer.length - i)) != -1) {
i += j;
}
}else {
buffer = EaglerInputStream.inputStreamToBytes(ziss);
}
(new VFile2(prefix, folderName, fn.substring(prefixLen))).setAllBytes(buffer);
totalSize += buffer.length;
++totalFiles;
if(totalSize - lastProg > 25000) {
lastProg = totalSize;
logger.info("Extracted {} files, {} bytes from ZIP file...", totalFiles, totalSize);
}
}
}
}

View File

@ -488,6 +488,17 @@ public class EaglercraftGPU {
return mapTexturesGL.get(tex);
}
public static final void regenerateTexture(int tex) {
ITextureGL webglTex = mapTexturesGL.get(tex);
if(webglTex != null) {
GlStateManager.unbindTextureIfCached(tex);
_wglDeleteTextures(webglTex);
mapTexturesGL.set(tex, _wglGenTextures());
}else {
logger.error("Tried to regenerate a missing texture!");
}
}
public static final void drawHighPoly(HighPolyMesh mesh) {
if(mesh.vertexCount == 0 || mesh.indexCount == 0 || mesh.vertexArray == null) {
return;

View File

@ -589,18 +589,25 @@ public class GlStateManager {
}
public static final void deleteTexture(int texture) {
unbindTextureIfCached(texture);
_wglDeleteTextures(EaglercraftGPU.mapTexturesGL.free(texture));
boolean f = false;
}
static final void unbindTextureIfCached(int texture) {
boolean f1, f2 = false;
for(int i = 0; i < boundTexture.length; ++i) {
if(boundTexture[i] == texture) {
_wglActiveTexture(GL_TEXTURE0 + i);
f1 = i != activeTexture;
if(f2 || f1) {
_wglActiveTexture(GL_TEXTURE0 + i);
f2 = f1;
}
_wglBindTexture(GL_TEXTURE_2D, null);
_wglBindTexture(GL_TEXTURE_3D, null);
boundTexture[i] = -1;
f = true;
}
}
if(f) {
if(f2) {
_wglActiveTexture(GL_TEXTURE0 + activeTexture);
}
}

View File

@ -2058,7 +2058,7 @@ public class EaglerDeferredPipeline {
GlStateManager.disableBlend();
if(reprojectionEngineEnable || config.realisticWater) {
if(reprojectionEngineEnable || config.is_rendering_realisticWater) {
// =========== SAVE REPROJECTION DATA FOR NEXT FRAME ============= //

View File

@ -74,13 +74,17 @@ public class WorldConverterMCA {
if (f.isDirectory()) continue;
String lowerName = f.getName().toLowerCase();
if (!(lowerName.endsWith(".dat") || lowerName.endsWith(".dat_old") || lowerName.endsWith(".mca") || lowerName.endsWith(".mcr") || lowerName.endsWith(".bmp"))) continue;
EaglerOutputStream baos = new EaglerOutputStream();
int len;
while ((len = zis.read(bb)) != -1) {
baos.write(bb, 0, len);
byte[] b;
int sz = (int)f.getSize();
if(sz >= 0) {
b = new byte[sz];
int j = 0, k;
while(j < b.length && (k = zis.read(b, j, b.length - j)) != -1) {
j += k;
}
}else {
b = EaglerInputStream.inputStreamToBytes(zis);
}
baos.close();
byte[] b = baos.toByteArray();
String fileName = f.getName().substring(folderPrefixOffset);
if (fileName.equals("level.dat") || fileName.equals("level.dat_old")) {
NBTTagCompound worldDatNBT = CompressedStreamTools.readCompressed(new EaglerInputStream(b));