u32
This commit is contained in:
parent
f6612ce09e
commit
cfab2e85bf
23 changed files with 216 additions and 47 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 ============= //
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ public abstract class AbstractTexture implements ITextureObject {
|
|||
protected boolean mipmap;
|
||||
protected boolean blurLast;
|
||||
protected boolean mipmapLast;
|
||||
protected boolean hasAllocated;
|
||||
|
||||
public void setBlurMipmapDirect(boolean parFlag, boolean parFlag2) {
|
||||
if (blur != parFlag || mipmap != parFlag2) {
|
||||
|
|
@ -67,6 +68,7 @@ public abstract class AbstractTexture implements ITextureObject {
|
|||
public int getGlTextureId() {
|
||||
if (this.glTextureId == -1) {
|
||||
this.glTextureId = TextureUtil.glGenTextures();
|
||||
hasAllocated = false;
|
||||
}
|
||||
|
||||
return this.glTextureId;
|
||||
|
|
@ -79,4 +81,18 @@ public abstract class AbstractTexture implements ITextureObject {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -40,6 +40,7 @@ public class DynamicTexture extends AbstractTexture {
|
|||
this.width = textureWidth;
|
||||
this.height = textureHeight;
|
||||
this.dynamicTextureData = new int[textureWidth * textureHeight];
|
||||
this.hasAllocated = true;
|
||||
TextureUtil.allocateTexture(this.getGlTextureId(), textureWidth, textureHeight);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ public class LayeredColorMaskTexture extends AbstractTexture {
|
|||
return;
|
||||
}
|
||||
|
||||
regenerateIfNotAllocated();
|
||||
TextureUtil.uploadTextureImage(this.getGlTextureId(), bufferedimage);
|
||||
}
|
||||
}
|
||||
|
|
@ -63,6 +63,7 @@ public class LayeredTexture extends AbstractTexture {
|
|||
return;
|
||||
}
|
||||
|
||||
regenerateIfNotAllocated();
|
||||
TextureUtil.uploadTextureImage(this.getGlTextureId(), bufferedimage);
|
||||
}
|
||||
}
|
||||
|
|
@ -62,6 +62,7 @@ public class SimpleTexture extends AbstractTexture {
|
|||
}
|
||||
}
|
||||
|
||||
regenerateIfNotAllocated();
|
||||
TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1);
|
||||
} finally {
|
||||
if (inputstream != null) {
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ public class TextureMap extends AbstractTexture implements ITickableTextureObjec
|
|||
private int height;
|
||||
private boolean isEaglerPBRMode = false;
|
||||
public int eaglerPBRMaterialTexture = -1;
|
||||
private boolean hasAllocatedEaglerPBRMaterialTexture = false;
|
||||
|
||||
public static final int _GL_FRAMEBUFFER = 0x8D40;
|
||||
public static final int _GL_COLOR_ATTACHMENT0 = 0x8CE0;
|
||||
|
|
@ -173,6 +174,7 @@ public class TextureMap extends AbstractTexture implements ITickableTextureObjec
|
|||
if (isEaglerPBRMode) {
|
||||
if (eaglerPBRMaterialTexture == -1) {
|
||||
eaglerPBRMaterialTexture = GlStateManager.generateTexture();
|
||||
hasAllocatedEaglerPBRMaterialTexture = false;
|
||||
}
|
||||
if (copyMaterialFramebuffer == null) {
|
||||
GlStateManager.bindTexture(eaglerPBRMaterialTexture);
|
||||
|
|
@ -422,9 +424,14 @@ public class TextureMap extends AbstractTexture implements ITickableTextureObjec
|
|||
|
||||
logger.info("Created: {}x{} {}-atlas", new Object[] { Integer.valueOf(stitcher.getCurrentWidth()),
|
||||
Integer.valueOf(stitcher.getCurrentHeight()), this.basePath });
|
||||
regenerateIfNotAllocated();
|
||||
TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(),
|
||||
stitcher.getCurrentHeight());
|
||||
if (isEaglerPBRMode) {
|
||||
if (hasAllocatedEaglerPBRMaterialTexture) {
|
||||
EaglercraftGPU.regenerateTexture(eaglerPBRMaterialTexture);
|
||||
}
|
||||
hasAllocatedEaglerPBRMaterialTexture = true;
|
||||
TextureUtil.allocateTextureImpl(eaglerPBRMaterialTexture, this.mipmapLevels, stitcher.getCurrentWidth(),
|
||||
stitcher.getCurrentHeight() * 2);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ public class TextureUtil {
|
|||
public static int[] convertComponentOrder(int[] arr) {
|
||||
for (int i = 0; i < arr.length; ++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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,6 +136,8 @@ public abstract class ResourcePackListEntry implements GuiListExtended.IGuiListE
|
|||
|
||||
protected abstract void func_148313_c();
|
||||
|
||||
protected abstract String getEaglerFolderName();
|
||||
|
||||
protected boolean func_148310_d() {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -183,7 +185,7 @@ public abstract class ResourcePackListEntry implements GuiListExtended.IGuiListE
|
|||
if (deleteInstead) {
|
||||
this.mc.loadingScreen.eaglerShow(I18n.format("resourcePack.load.deleting"), this.func_148312_b());
|
||||
EaglerFolderResourcePack.deleteResourcePack(EaglerFolderResourcePack.RESOURCE_PACKS,
|
||||
this.func_148312_b());
|
||||
this.getEaglerFolderName());
|
||||
} else {
|
||||
this.resourcePacksGUI.getSelectedResourcePacks().add(0, this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,4 +100,9 @@ public class ResourcePackListEntryDefault extends ResourcePackListEntry {
|
|||
protected boolean func_148310_d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getEaglerFolderName() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -50,4 +50,9 @@ public class ResourcePackListEntryFound extends ResourcePackListEntry {
|
|||
public ResourcePackRepository.Entry func_148318_i() {
|
||||
return this.field_148319_c;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getEaglerFolderName() {
|
||||
return field_148319_c.getResourcePackName();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue