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

@ -14,7 +14,11 @@
+ 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) {
~ this.blur = parFlag;
@ -30,4 +34,25 @@
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, i);
~ 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

View File

@ -18,4 +18,8 @@
~ this(bufferedImage.width, bufferedImage.height);
~ System.arraycopy(bufferedImage.pixels, 0, dynamicTextureData, 0, bufferedImage.pixels.length);
> INSERT 7 : 8 @ 7
+ this.hasAllocated = true;
> EOF

View File

@ -54,4 +54,8 @@
~ bufferedimage.drawLayer(bufferedimage2, 0, 0, bufferedimage2.width, bufferedimage2.height, 0, 0,
~ bufferedimage2.width, bufferedimage2.height);
> INSERT 8 : 9 @ 8
+ regenerateIfNotAllocated();
> EOF

View File

@ -40,4 +40,8 @@
~ bufferedimage.drawLayer(bufferedimage1, 0, 0, bufferedimage1.width, bufferedimage1.height, 0, 0,
~ bufferedimage1.width, bufferedimage1.height);
> INSERT 7 : 8 @ 7
+ regenerateIfNotAllocated();
> EOF

View File

@ -20,4 +20,8 @@
~ ImageData bufferedimage = TextureUtil.readBufferedImage(inputstream);
> INSERT 15 : 16 @ 15
+ regenerateIfNotAllocated();
> EOF

View File

@ -43,7 +43,7 @@
~ private final Map<String, EaglerTextureAtlasSprite> mapRegisteredSprites;
~ private final Map<String, EaglerTextureAtlasSprite> mapUploadedSprites;
> CHANGE 3 : 9 @ 3 : 4
> CHANGE 3 : 10 @ 3 : 4
~ private final EaglerTextureAtlasSprite missingImage;
~ private final EaglerTextureAtlasSpritePBR missingImagePBR;
@ -51,6 +51,7 @@
~ private int height;
~ private boolean isEaglerPBRMode = false;
~ public int eaglerPBRMaterialTexture = -1;
~ private boolean hasAllocatedEaglerPBRMaterialTexture = false;
> INSERT 1 : 7 @ 1
@ -114,7 +115,7 @@
+ }
+
> INSERT 8 : 43 @ 8
> INSERT 8 : 44 @ 8
+ if (copyColorFramebuffer != null) {
+ for (int l = 0; l < copyColorFramebuffer.length; ++l) {
@ -126,6 +127,7 @@
+ if (isEaglerPBRMode) {
+ if (eaglerPBRMaterialTexture == -1) {
+ eaglerPBRMaterialTexture = GlStateManager.generateTexture();
+ hasAllocatedEaglerPBRMaterialTexture = false;
+ }
+ if (copyMaterialFramebuffer == null) {
+ GlStateManager.bindTexture(eaglerPBRMaterialTexture);
@ -302,9 +304,17 @@
~ stitcher.addSprite(this.missingImage);
~ }
> INSERT 11 : 28 @ 11
> INSERT 9 : 10 @ 9
+ regenerateIfNotAllocated();
> INSERT 2 : 23 @ 2
+ if (isEaglerPBRMode) {
+ if (hasAllocatedEaglerPBRMaterialTexture) {
+ EaglercraftGPU.regenerateTexture(eaglerPBRMaterialTexture);
+ }
+ hasAllocatedEaglerPBRMaterialTexture = true;
+ TextureUtil.allocateTextureImpl(eaglerPBRMaterialTexture, this.mipmapLevels, stitcher.getCurrentWidth(),
+ stitcher.getCurrentHeight() * 2);
+ }

View File

@ -111,7 +111,7 @@
+ 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;
+ }

View File

@ -15,7 +15,12 @@
> 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) {
+ if (!deleteInstead && l != 1) {
@ -40,7 +45,7 @@
+ 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);
+ }

View File

@ -23,4 +23,12 @@
~ } catch (JSONException jsonparseexception) {
> INSERT 35 : 40 @ 35
+
+ @Override
+ protected String getEaglerFolderName() {
+ return null;
+ }
> EOF

View File

@ -11,4 +11,12 @@
~ return this.field_148319_c.getResourcePackEaglerDisplayName();
> INSERT 5 : 10 @ 5
+
+ @Override
+ protected String getEaglerFolderName() {
+ return field_148319_c.getResourcePackName();
+ }
> EOF