Update #32 - Fixed some bugs in the client
This commit is contained in:
parent
6ea4ffe62d
commit
aeb63fcd41
|
@ -1 +1 @@
|
||||||
u31
|
u32
|
|
@ -14,7 +14,11 @@
|
||||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
+ import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
||||||
+
|
+
|
||||||
|
|
||||||
> CHANGE 8 : 16 @ 8 : 10
|
> INSERT 6 : 7 @ 6
|
||||||
|
|
||||||
|
+ protected boolean hasAllocated;
|
||||||
|
|
||||||
|
> CHANGE 2 : 10 @ 2 : 4
|
||||||
|
|
||||||
~ if (blur != parFlag || mipmap != parFlag2) {
|
~ if (blur != parFlag || mipmap != parFlag2) {
|
||||||
~ this.blur = parFlag;
|
~ this.blur = parFlag;
|
||||||
|
@ -30,4 +34,25 @@
|
||||||
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, i);
|
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, i);
|
||||||
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, short1);
|
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, short1);
|
||||||
|
|
||||||
|
> INSERT 15 : 16 @ 15
|
||||||
|
|
||||||
|
+ hasAllocated = false;
|
||||||
|
|
||||||
|
> INSERT 12 : 26 @ 12
|
||||||
|
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * This function is needed due to EaglercraftX's use of glTexStorage2D to
|
||||||
|
+ * allocate memory for textures, some OpenGL implementations don't like it when
|
||||||
|
+ * you call glTexStorage2D on the same texture object more than once
|
||||||
|
+ */
|
||||||
|
+ protected void regenerateIfNotAllocated() {
|
||||||
|
+ if (this.glTextureId != -1) {
|
||||||
|
+ if (hasAllocated) {
|
||||||
|
+ EaglercraftGPU.regenerateTexture(glTextureId);
|
||||||
|
+ }
|
||||||
|
+ hasAllocated = true;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
|
||||||
> EOF
|
> EOF
|
||||||
|
|
|
@ -18,4 +18,8 @@
|
||||||
~ this(bufferedImage.width, bufferedImage.height);
|
~ this(bufferedImage.width, bufferedImage.height);
|
||||||
~ System.arraycopy(bufferedImage.pixels, 0, dynamicTextureData, 0, bufferedImage.pixels.length);
|
~ System.arraycopy(bufferedImage.pixels, 0, dynamicTextureData, 0, bufferedImage.pixels.length);
|
||||||
|
|
||||||
|
> INSERT 7 : 8 @ 7
|
||||||
|
|
||||||
|
+ this.hasAllocated = true;
|
||||||
|
|
||||||
> EOF
|
> EOF
|
||||||
|
|
|
@ -54,4 +54,8 @@
|
||||||
~ bufferedimage.drawLayer(bufferedimage2, 0, 0, bufferedimage2.width, bufferedimage2.height, 0, 0,
|
~ bufferedimage.drawLayer(bufferedimage2, 0, 0, bufferedimage2.width, bufferedimage2.height, 0, 0,
|
||||||
~ bufferedimage2.width, bufferedimage2.height);
|
~ bufferedimage2.width, bufferedimage2.height);
|
||||||
|
|
||||||
|
> INSERT 8 : 9 @ 8
|
||||||
|
|
||||||
|
+ regenerateIfNotAllocated();
|
||||||
|
|
||||||
> EOF
|
> EOF
|
||||||
|
|
|
@ -40,4 +40,8 @@
|
||||||
~ bufferedimage.drawLayer(bufferedimage1, 0, 0, bufferedimage1.width, bufferedimage1.height, 0, 0,
|
~ bufferedimage.drawLayer(bufferedimage1, 0, 0, bufferedimage1.width, bufferedimage1.height, 0, 0,
|
||||||
~ bufferedimage1.width, bufferedimage1.height);
|
~ bufferedimage1.width, bufferedimage1.height);
|
||||||
|
|
||||||
|
> INSERT 7 : 8 @ 7
|
||||||
|
|
||||||
|
+ regenerateIfNotAllocated();
|
||||||
|
|
||||||
> EOF
|
> EOF
|
||||||
|
|
|
@ -20,4 +20,8 @@
|
||||||
|
|
||||||
~ ImageData bufferedimage = TextureUtil.readBufferedImage(inputstream);
|
~ ImageData bufferedimage = TextureUtil.readBufferedImage(inputstream);
|
||||||
|
|
||||||
|
> INSERT 15 : 16 @ 15
|
||||||
|
|
||||||
|
+ regenerateIfNotAllocated();
|
||||||
|
|
||||||
> EOF
|
> EOF
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
~ private final Map<String, EaglerTextureAtlasSprite> mapRegisteredSprites;
|
~ private final Map<String, EaglerTextureAtlasSprite> mapRegisteredSprites;
|
||||||
~ private final Map<String, EaglerTextureAtlasSprite> mapUploadedSprites;
|
~ private final Map<String, EaglerTextureAtlasSprite> mapUploadedSprites;
|
||||||
|
|
||||||
> CHANGE 3 : 9 @ 3 : 4
|
> CHANGE 3 : 10 @ 3 : 4
|
||||||
|
|
||||||
~ private final EaglerTextureAtlasSprite missingImage;
|
~ private final EaglerTextureAtlasSprite missingImage;
|
||||||
~ private final EaglerTextureAtlasSpritePBR missingImagePBR;
|
~ private final EaglerTextureAtlasSpritePBR missingImagePBR;
|
||||||
|
@ -51,6 +51,7 @@
|
||||||
~ private int height;
|
~ private int height;
|
||||||
~ private boolean isEaglerPBRMode = false;
|
~ private boolean isEaglerPBRMode = false;
|
||||||
~ public int eaglerPBRMaterialTexture = -1;
|
~ public int eaglerPBRMaterialTexture = -1;
|
||||||
|
~ private boolean hasAllocatedEaglerPBRMaterialTexture = false;
|
||||||
|
|
||||||
> INSERT 1 : 7 @ 1
|
> INSERT 1 : 7 @ 1
|
||||||
|
|
||||||
|
@ -114,7 +115,7 @@
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
|
||||||
> INSERT 8 : 43 @ 8
|
> INSERT 8 : 44 @ 8
|
||||||
|
|
||||||
+ if (copyColorFramebuffer != null) {
|
+ if (copyColorFramebuffer != null) {
|
||||||
+ for (int l = 0; l < copyColorFramebuffer.length; ++l) {
|
+ for (int l = 0; l < copyColorFramebuffer.length; ++l) {
|
||||||
|
@ -126,6 +127,7 @@
|
||||||
+ if (isEaglerPBRMode) {
|
+ if (isEaglerPBRMode) {
|
||||||
+ if (eaglerPBRMaterialTexture == -1) {
|
+ if (eaglerPBRMaterialTexture == -1) {
|
||||||
+ eaglerPBRMaterialTexture = GlStateManager.generateTexture();
|
+ eaglerPBRMaterialTexture = GlStateManager.generateTexture();
|
||||||
|
+ hasAllocatedEaglerPBRMaterialTexture = false;
|
||||||
+ }
|
+ }
|
||||||
+ if (copyMaterialFramebuffer == null) {
|
+ if (copyMaterialFramebuffer == null) {
|
||||||
+ GlStateManager.bindTexture(eaglerPBRMaterialTexture);
|
+ GlStateManager.bindTexture(eaglerPBRMaterialTexture);
|
||||||
|
@ -302,9 +304,17 @@
|
||||||
~ stitcher.addSprite(this.missingImage);
|
~ stitcher.addSprite(this.missingImage);
|
||||||
~ }
|
~ }
|
||||||
|
|
||||||
> INSERT 11 : 28 @ 11
|
> INSERT 9 : 10 @ 9
|
||||||
|
|
||||||
|
+ regenerateIfNotAllocated();
|
||||||
|
|
||||||
|
> INSERT 2 : 23 @ 2
|
||||||
|
|
||||||
+ if (isEaglerPBRMode) {
|
+ if (isEaglerPBRMode) {
|
||||||
|
+ if (hasAllocatedEaglerPBRMaterialTexture) {
|
||||||
|
+ EaglercraftGPU.regenerateTexture(eaglerPBRMaterialTexture);
|
||||||
|
+ }
|
||||||
|
+ hasAllocatedEaglerPBRMaterialTexture = true;
|
||||||
+ TextureUtil.allocateTextureImpl(eaglerPBRMaterialTexture, this.mipmapLevels, stitcher.getCurrentWidth(),
|
+ TextureUtil.allocateTextureImpl(eaglerPBRMaterialTexture, this.mipmapLevels, stitcher.getCurrentWidth(),
|
||||||
+ stitcher.getCurrentHeight() * 2);
|
+ stitcher.getCurrentHeight() * 2);
|
||||||
+ }
|
+ }
|
||||||
|
|
|
@ -111,7 +111,7 @@
|
||||||
+ public static int[] convertComponentOrder(int[] arr) {
|
+ public static int[] convertComponentOrder(int[] arr) {
|
||||||
+ for (int i = 0; i < arr.length; ++i) {
|
+ for (int i = 0; i < arr.length; ++i) {
|
||||||
+ int j = arr[i];
|
+ int j = arr[i];
|
||||||
+ arr[i] = (j & 0xFF000000) | ((j >> 16) & 0xFF) | (j & 0xFF00) | ((j << 16) & 0xFF0000);
|
+ arr[i] = ((j >> 16) & 0xFF) | (j & 0xFF00FF00) | ((j << 16) & 0xFF0000);
|
||||||
+ }
|
+ }
|
||||||
+ return arr;
|
+ return arr;
|
||||||
+ }
|
+ }
|
||||||
|
|
|
@ -15,7 +15,12 @@
|
||||||
|
|
||||||
> DELETE 6 @ 6 : 8
|
> DELETE 6 @ 6 : 8
|
||||||
|
|
||||||
> INSERT 128 : 158 @ 128
|
> INSERT 104 : 106 @ 104
|
||||||
|
|
||||||
|
+ protected abstract String getEaglerFolderName();
|
||||||
|
+
|
||||||
|
|
||||||
|
> INSERT 24 : 54 @ 24
|
||||||
|
|
||||||
+ private void proceedWithBs(int l, boolean deleteInstead) {
|
+ private void proceedWithBs(int l, boolean deleteInstead) {
|
||||||
+ if (!deleteInstead && l != 1) {
|
+ if (!deleteInstead && l != 1) {
|
||||||
|
@ -40,7 +45,7 @@
|
||||||
+ if (deleteInstead) {
|
+ if (deleteInstead) {
|
||||||
+ this.mc.loadingScreen.eaglerShow(I18n.format("resourcePack.load.deleting"), this.func_148312_b());
|
+ this.mc.loadingScreen.eaglerShow(I18n.format("resourcePack.load.deleting"), this.func_148312_b());
|
||||||
+ EaglerFolderResourcePack.deleteResourcePack(EaglerFolderResourcePack.RESOURCE_PACKS,
|
+ EaglerFolderResourcePack.deleteResourcePack(EaglerFolderResourcePack.RESOURCE_PACKS,
|
||||||
+ this.func_148312_b());
|
+ this.getEaglerFolderName());
|
||||||
+ } else {
|
+ } else {
|
||||||
+ this.resourcePacksGUI.getSelectedResourcePacks().add(0, this);
|
+ this.resourcePacksGUI.getSelectedResourcePacks().add(0, this);
|
||||||
+ }
|
+ }
|
||||||
|
|
|
@ -23,4 +23,12 @@
|
||||||
|
|
||||||
~ } catch (JSONException jsonparseexception) {
|
~ } catch (JSONException jsonparseexception) {
|
||||||
|
|
||||||
|
> INSERT 35 : 40 @ 35
|
||||||
|
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ protected String getEaglerFolderName() {
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
|
||||||
> EOF
|
> EOF
|
||||||
|
|
|
@ -11,4 +11,12 @@
|
||||||
|
|
||||||
~ return this.field_148319_c.getResourcePackEaglerDisplayName();
|
~ return this.field_148319_c.getResourcePackEaglerDisplayName();
|
||||||
|
|
||||||
|
> INSERT 5 : 10 @ 5
|
||||||
|
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ protected String getEaglerFolderName() {
|
||||||
|
+ return field_148319_c.getResourcePackName();
|
||||||
|
+ }
|
||||||
|
|
||||||
> EOF
|
> EOF
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class EaglercraftVersion {
|
||||||
/// Customize these to fit your fork:
|
/// Customize these to fit your fork:
|
||||||
|
|
||||||
public static final String projectForkName = "EaglercraftX";
|
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 projectForkVendor = "lax1dude";
|
||||||
|
|
||||||
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";
|
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 projectOriginName = "EaglercraftX";
|
||||||
public static final String projectOriginAuthor = "lax1dude";
|
public static final String projectOriginAuthor = "lax1dude";
|
||||||
public static final String projectOriginRevision = "1.8";
|
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
|
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 boolean enableUpdateService = true;
|
||||||
|
|
||||||
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
|
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;
|
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,10 @@ public class GLObjectMap<T> {
|
||||||
return (T) values[obj];
|
return (T) values[obj];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void set(int obj, T val) {
|
||||||
|
values[obj] = val;
|
||||||
|
}
|
||||||
|
|
||||||
private void resize() {
|
private void resize() {
|
||||||
int oldSize = size;
|
int oldSize = size;
|
||||||
size += size / 2;
|
size += size / 2;
|
||||||
|
|
|
@ -153,13 +153,14 @@ public class EaglerFolderResourcePack extends AbstractResourcePack {
|
||||||
List<String> fileNames = Lists.newArrayList();
|
List<String> fileNames = Lists.newArrayList();
|
||||||
|
|
||||||
logger.info("Counting files...");
|
logger.info("Counting files...");
|
||||||
ZipInputStream ziss = new ZipInputStream(new EaglerInputStream(file));
|
|
||||||
ZipEntry zipEntry;
|
ZipEntry zipEntry;
|
||||||
|
try(ZipInputStream ziss = new ZipInputStream(new EaglerInputStream(file))) {
|
||||||
while ((zipEntry = ziss.getNextEntry()) != null) {
|
while ((zipEntry = ziss.getNextEntry()) != null) {
|
||||||
if (!zipEntry.isDirectory()) {
|
if (!zipEntry.isDirectory()) {
|
||||||
fileNames.add(zipEntry.getName());
|
fileNames.add(zipEntry.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int prefixLen = Integer.MAX_VALUE;
|
int prefixLen = Integer.MAX_VALUE;
|
||||||
for(int i = 0, l = fileNames.size(); i < l; ++i) {
|
for(int i = 0, l = fileNames.size(); i < l; ++i) {
|
||||||
|
@ -195,16 +196,23 @@ public class EaglerFolderResourcePack extends AbstractResourcePack {
|
||||||
int totalSize = 0;
|
int totalSize = 0;
|
||||||
int totalFiles = 0;
|
int totalFiles = 0;
|
||||||
int lastProg = 0;
|
int lastProg = 0;
|
||||||
ziss = new ZipInputStream(new EaglerInputStream(file));
|
try(ZipInputStream ziss = new ZipInputStream(new EaglerInputStream(file))) {
|
||||||
|
int sz;
|
||||||
while ((zipEntry = ziss.getNextEntry()) != null) {
|
while ((zipEntry = ziss.getNextEntry()) != null) {
|
||||||
if (!zipEntry.isDirectory()) {
|
if (!zipEntry.isDirectory()) {
|
||||||
fn = zipEntry.getName();
|
fn = zipEntry.getName();
|
||||||
if(fn.length() > prefixLen) {
|
if(fn.length() > prefixLen) {
|
||||||
byte[] buffer = new byte[(int)zipEntry.getSize()];
|
byte[] buffer;
|
||||||
|
sz = (int)zipEntry.getSize();
|
||||||
|
if(sz >= 0) {
|
||||||
|
buffer = new byte[sz];
|
||||||
int i = 0, j;
|
int i = 0, j;
|
||||||
while(i < buffer.length && (j = ziss.read(buffer, i, buffer.length - i)) != -1) {
|
while(i < buffer.length && (j = ziss.read(buffer, i, buffer.length - i)) != -1) {
|
||||||
i += j;
|
i += j;
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
buffer = EaglerInputStream.inputStreamToBytes(ziss);
|
||||||
|
}
|
||||||
(new VFile2(prefix, folderName, fn.substring(prefixLen))).setAllBytes(buffer);
|
(new VFile2(prefix, folderName, fn.substring(prefixLen))).setAllBytes(buffer);
|
||||||
totalSize += buffer.length;
|
totalSize += buffer.length;
|
||||||
++totalFiles;
|
++totalFiles;
|
||||||
|
@ -215,6 +223,7 @@ public class EaglerFolderResourcePack extends AbstractResourcePack {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}catch(IOException ex) {
|
}catch(IOException ex) {
|
||||||
logger.error("Encountered an error extracting zip file, deleting extracted files...");
|
logger.error("Encountered an error extracting zip file, deleting extracted files...");
|
||||||
for(int i = 0, l = fileNames.size(); i < l; ++i) {
|
for(int i = 0, l = fileNames.size(); i < l; ++i) {
|
||||||
|
|
|
@ -488,6 +488,17 @@ public class EaglercraftGPU {
|
||||||
return mapTexturesGL.get(tex);
|
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) {
|
public static final void drawHighPoly(HighPolyMesh mesh) {
|
||||||
if(mesh.vertexCount == 0 || mesh.indexCount == 0 || mesh.vertexArray == null) {
|
if(mesh.vertexCount == 0 || mesh.indexCount == 0 || mesh.vertexArray == null) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -589,18 +589,25 @@ public class GlStateManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void deleteTexture(int texture) {
|
public static final void deleteTexture(int texture) {
|
||||||
|
unbindTextureIfCached(texture);
|
||||||
_wglDeleteTextures(EaglercraftGPU.mapTexturesGL.free(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) {
|
for(int i = 0; i < boundTexture.length; ++i) {
|
||||||
if(boundTexture[i] == texture) {
|
if(boundTexture[i] == texture) {
|
||||||
|
f1 = i != activeTexture;
|
||||||
|
if(f2 || f1) {
|
||||||
_wglActiveTexture(GL_TEXTURE0 + i);
|
_wglActiveTexture(GL_TEXTURE0 + i);
|
||||||
|
f2 = f1;
|
||||||
|
}
|
||||||
_wglBindTexture(GL_TEXTURE_2D, null);
|
_wglBindTexture(GL_TEXTURE_2D, null);
|
||||||
_wglBindTexture(GL_TEXTURE_3D, null);
|
_wglBindTexture(GL_TEXTURE_3D, null);
|
||||||
boundTexture[i] = -1;
|
boundTexture[i] = -1;
|
||||||
f = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(f) {
|
if(f2) {
|
||||||
_wglActiveTexture(GL_TEXTURE0 + activeTexture);
|
_wglActiveTexture(GL_TEXTURE0 + activeTexture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2058,7 +2058,7 @@ public class EaglerDeferredPipeline {
|
||||||
|
|
||||||
GlStateManager.disableBlend();
|
GlStateManager.disableBlend();
|
||||||
|
|
||||||
if(reprojectionEngineEnable || config.realisticWater) {
|
if(reprojectionEngineEnable || config.is_rendering_realisticWater) {
|
||||||
|
|
||||||
// =========== SAVE REPROJECTION DATA FOR NEXT FRAME ============= //
|
// =========== SAVE REPROJECTION DATA FOR NEXT FRAME ============= //
|
||||||
|
|
||||||
|
|
|
@ -74,13 +74,17 @@ public class WorldConverterMCA {
|
||||||
if (f.isDirectory()) continue;
|
if (f.isDirectory()) continue;
|
||||||
String lowerName = f.getName().toLowerCase();
|
String lowerName = f.getName().toLowerCase();
|
||||||
if (!(lowerName.endsWith(".dat") || lowerName.endsWith(".dat_old") || lowerName.endsWith(".mca") || lowerName.endsWith(".mcr") || lowerName.endsWith(".bmp"))) continue;
|
if (!(lowerName.endsWith(".dat") || lowerName.endsWith(".dat_old") || lowerName.endsWith(".mca") || lowerName.endsWith(".mcr") || lowerName.endsWith(".bmp"))) continue;
|
||||||
EaglerOutputStream baos = new EaglerOutputStream();
|
byte[] b;
|
||||||
int len;
|
int sz = (int)f.getSize();
|
||||||
while ((len = zis.read(bb)) != -1) {
|
if(sz >= 0) {
|
||||||
baos.write(bb, 0, len);
|
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);
|
String fileName = f.getName().substring(folderPrefixOffset);
|
||||||
if (fileName.equals("level.dat") || fileName.equals("level.dat_old")) {
|
if (fileName.equals("level.dat") || fileName.equals("level.dat_old")) {
|
||||||
NBTTagCompound worldDatNBT = CompressedStreamTools.readCompressed(new EaglerInputStream(b));
|
NBTTagCompound worldDatNBT = CompressedStreamTools.readCompressed(new EaglerInputStream(b));
|
||||||
|
|
|
@ -44,6 +44,27 @@ window.eaglercraftXOptsHints = {
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
"use strict";
|
"use strict";
|
||||||
(function(){
|
(function(){
|
||||||
|
function fetchB64PayloadSafe() {
|
||||||
|
const dataURL = window.eaglercraftXClientBundle;
|
||||||
|
if(!dataURL.startsWith("data:application/octet-stream;base64,")) {
|
||||||
|
return fetch(dataURL, { cache: "force-cache" }).then((response) => response.blob());
|
||||||
|
}
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
fetch(dataURL)
|
||||||
|
.then((response) => response.blob())
|
||||||
|
.then((blob) => { resolve(blob); })
|
||||||
|
.catch((err) => {
|
||||||
|
console.error("Caught an error decoding base64 via fetch, doing it the slow way instead...");
|
||||||
|
// MIT License - https://github.com/beatgammit/base64-js
|
||||||
|
const base64js = (function(){return function(){function b(d,e,g){function a(j,i){if(!e[j]){if(!d[j]){var f="function"==typeof require&&require;if(!i&&f)return f(j,!0);if(h)return h(j,!0);var c=new Error("Cannot find module '"+j+"'");throw c.code="MODULE_NOT_FOUND",c}var k=e[j]={exports:{}};d[j][0].call(k.exports,function(b){var c=d[j][1][b];return a(c||b)},k,k.exports,b,d,e,g)}return e[j].exports}for(var h="function"==typeof require&&require,c=0;c<g.length;c++)a(g[c]);return a}return b}()({"/":[function(a,b,c){"use strict";function d(a){var b=a.length;if(0<b%4)throw new Error("Invalid string. Length must be a multiple of 4");var c=a.indexOf("=");-1===c&&(c=b);var d=c===b?0:4-c%4;return[c,d]}function e(a,b,c){return 3*(b+c)/4-c}function f(a){var b,c,f=d(a),g=f[0],j=f[1],k=new Uint8Array(e(a,g,j)),l=0,m=0<j?g-4:g;for(c=0;c<m;c+=4)b=h[a.charCodeAt(c)]<<18|h[a.charCodeAt(c+1)]<<12|h[a.charCodeAt(c+2)]<<6|h[a.charCodeAt(c+3)],k[l++]=255&b>>16,k[l++]=255&b>>8,k[l++]=255&b;return 2===j&&(b=h[a.charCodeAt(c)]<<2|h[a.charCodeAt(c+1)]>>4,k[l++]=255&b),1===j&&(b=h[a.charCodeAt(c)]<<10|h[a.charCodeAt(c+1)]<<4|h[a.charCodeAt(c+2)]>>2,k[l++]=255&b>>8,k[l++]=255&b),k}c.byteLength=function b(a){var c=d(a),e=c[0],f=c[1];return 3*(e+f)/4-f},c.toByteArray=f;for(var g=[],h=[],j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k=0,l=j.length;k<l;++k)g[k]=j[k],h[j.charCodeAt(k)]=k;h[45]=62,h[95]=63},{}]},{},[])("/")})();
|
||||||
|
const bytesDec = base64js.toByteArray(dataURL.substring(37)).buffer;
|
||||||
|
const bytesBlob = new Blob([bytesDec], { type: "application/octet-stream" });
|
||||||
|
window.eaglercraftXClientBundle = URL.createObjectURL(bytesBlob);
|
||||||
|
console.error("Created " + bytesDec.byteLength + " byte object URL: " + window.eaglercraftXClientBundle);
|
||||||
|
resolve(bytesBlob);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
var ds = new DecompressionStream("gzip");
|
var ds = new DecompressionStream("gzip");
|
||||||
var result = [];
|
var result = [];
|
||||||
function fetchStream(reader) {
|
function fetchStream(reader) {
|
||||||
|
@ -58,9 +79,7 @@ window.eaglercraftXOptsHints = {
|
||||||
return reader.read().then(processData);
|
return reader.read().then(processData);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
fetch(window.eaglercraftXClientBundle, { cache: "force-cache" })
|
fetchB64PayloadSafe().then((blob) => fetchStream(blob.stream().pipeThrough(ds).getReader()));
|
||||||
.then((response) => response.blob())
|
|
||||||
.then((blob) => fetchStream(blob.stream().pipeThrough(ds).getReader()));
|
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
Binary file not shown.
|
@ -1 +1 @@
|
||||||
{"pluginName":"EaglercraftXBungee","pluginVersion":"1.2.1","pluginButton":"Download \"EaglerXBungee-1.2.1.jar\"","pluginFilename":"EaglerXBungee.zip"}
|
{"pluginName":"EaglercraftXBungee","pluginVersion":"1.2.3","pluginButton":"Download \"EaglerXBungee-1.2.3.jar\"","pluginFilename":"EaglerXBungee.zip"}
|
|
@ -44,6 +44,27 @@ window.eaglercraftXOptsHints = {
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
"use strict";
|
"use strict";
|
||||||
(function(){
|
(function(){
|
||||||
|
function fetchB64PayloadSafe() {
|
||||||
|
const dataURL = window.eaglercraftXClientBundle;
|
||||||
|
if(!dataURL.startsWith("data:application/octet-stream;base64,")) {
|
||||||
|
return fetch(dataURL, { cache: "force-cache" }).then((response) => response.blob());
|
||||||
|
}
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
fetch(dataURL)
|
||||||
|
.then((response) => response.blob())
|
||||||
|
.then((blob) => { resolve(blob); })
|
||||||
|
.catch((err) => {
|
||||||
|
console.error("Caught an error decoding base64 via fetch, doing it the slow way instead...");
|
||||||
|
// MIT License - https://github.com/beatgammit/base64-js
|
||||||
|
const base64js = (function(){return function(){function b(d,e,g){function a(j,i){if(!e[j]){if(!d[j]){var f="function"==typeof require&&require;if(!i&&f)return f(j,!0);if(h)return h(j,!0);var c=new Error("Cannot find module '"+j+"'");throw c.code="MODULE_NOT_FOUND",c}var k=e[j]={exports:{}};d[j][0].call(k.exports,function(b){var c=d[j][1][b];return a(c||b)},k,k.exports,b,d,e,g)}return e[j].exports}for(var h="function"==typeof require&&require,c=0;c<g.length;c++)a(g[c]);return a}return b}()({"/":[function(a,b,c){"use strict";function d(a){var b=a.length;if(0<b%4)throw new Error("Invalid string. Length must be a multiple of 4");var c=a.indexOf("=");-1===c&&(c=b);var d=c===b?0:4-c%4;return[c,d]}function e(a,b,c){return 3*(b+c)/4-c}function f(a){var b,c,f=d(a),g=f[0],j=f[1],k=new Uint8Array(e(a,g,j)),l=0,m=0<j?g-4:g;for(c=0;c<m;c+=4)b=h[a.charCodeAt(c)]<<18|h[a.charCodeAt(c+1)]<<12|h[a.charCodeAt(c+2)]<<6|h[a.charCodeAt(c+3)],k[l++]=255&b>>16,k[l++]=255&b>>8,k[l++]=255&b;return 2===j&&(b=h[a.charCodeAt(c)]<<2|h[a.charCodeAt(c+1)]>>4,k[l++]=255&b),1===j&&(b=h[a.charCodeAt(c)]<<10|h[a.charCodeAt(c+1)]<<4|h[a.charCodeAt(c+2)]>>2,k[l++]=255&b>>8,k[l++]=255&b),k}c.byteLength=function b(a){var c=d(a),e=c[0],f=c[1];return 3*(e+f)/4-f},c.toByteArray=f;for(var g=[],h=[],j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k=0,l=j.length;k<l;++k)g[k]=j[k],h[j.charCodeAt(k)]=k;h[45]=62,h[95]=63},{}]},{},[])("/")})();
|
||||||
|
const bytesDec = base64js.toByteArray(dataURL.substring(37)).buffer;
|
||||||
|
const bytesBlob = new Blob([bytesDec], { type: "application/octet-stream" });
|
||||||
|
window.eaglercraftXClientBundle = URL.createObjectURL(bytesBlob);
|
||||||
|
console.error("Created " + bytesDec.byteLength + " byte object URL: " + window.eaglercraftXClientBundle);
|
||||||
|
resolve(bytesBlob);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
var ds = new DecompressionStream("gzip");
|
var ds = new DecompressionStream("gzip");
|
||||||
var result = [];
|
var result = [];
|
||||||
function fetchStream(reader) {
|
function fetchStream(reader) {
|
||||||
|
@ -58,9 +79,7 @@ window.eaglercraftXOptsHints = {
|
||||||
return reader.read().then(processData);
|
return reader.read().then(processData);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
fetch(window.eaglercraftXClientBundle, { cache: "force-cache" })
|
fetchB64PayloadSafe().then((blob) => fetchStream(blob.stream().pipeThrough(ds).getReader()));
|
||||||
.then((response) => response.blob())
|
|
||||||
.then((blob) => fetchStream(blob.stream().pipeThrough(ds).getReader()));
|
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.Base64;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
|
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
|
||||||
import net.lax1dude.eaglercraft.v1_8.profile.EaglerProfile;
|
import net.lax1dude.eaglercraft.v1_8.profile.EaglerProfile;
|
||||||
|
@ -377,10 +378,26 @@ public class PlatformRuntime {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Async
|
@Async
|
||||||
public static native ArrayBuffer downloadRemoteURI(String assetPackageURI, boolean forceCache);
|
public static native ArrayBuffer downloadRemoteURI(final String assetPackageURI, final boolean forceCache);
|
||||||
|
|
||||||
private static void downloadRemoteURI(String assetPackageURI, boolean useCache, final AsyncCallback<ArrayBuffer> cb) {
|
private static void downloadRemoteURI(final String assetPackageURI, final boolean useCache, final AsyncCallback<ArrayBuffer> cb) {
|
||||||
doFetchDownload(assetPackageURI, useCache ? "force-cache" : "no-store", cb::complete);
|
doFetchDownload(assetPackageURI, useCache ? "force-cache" : "no-store",
|
||||||
|
assetPackageURI.startsWith("data:application/octet-stream;base64,") ? (data) -> {
|
||||||
|
if(data != null) {
|
||||||
|
cb.complete(data);
|
||||||
|
}else {
|
||||||
|
logger.error("Caught an error decoding base64 via fetch, doing it the slow way instead...");
|
||||||
|
byte[] b = null;
|
||||||
|
try {
|
||||||
|
b = Base64.decodeBase64(assetPackageURI.substring(37));
|
||||||
|
}catch(Throwable t) {
|
||||||
|
logger.error("Failed to manually decode base64!", t);
|
||||||
|
cb.complete(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cb.complete(TeaVMUtils.unwrapArrayBuffer(b));
|
||||||
|
}
|
||||||
|
} : cb::complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDebugRuntime() {
|
public static boolean isDebugRuntime() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user