Skip to content

Commit cfab2e8

Browse files
author
eaglercraft
committed
u32
1 parent f6612ce commit cfab2e8

File tree

23 files changed

+216
-47
lines changed

23 files changed

+216
-47
lines changed

desktopRuntime/resources/SignedClientTemplate.txt

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,27 @@ window.eaglercraftXOptsHints = {
4444
<script type="text/javascript">
4545
"use strict";
4646
(function(){
47+
function fetchB64PayloadSafe() {
48+
const dataURL = window.eaglercraftXClientBundle;
49+
if(!dataURL.startsWith("data:application/octet-stream;base64,")) {
50+
return fetch(dataURL, { cache: "force-cache" }).then((response) => response.blob());
51+
}
52+
return new Promise((resolve) => {
53+
fetch(dataURL)
54+
.then((response) => response.blob())
55+
.then((blob) => { resolve(blob); })
56+
.catch((err) => {
57+
console.error("Caught an error decoding base64 via fetch, doing it the slow way instead...");
58+
// MIT License - https://github.com/beatgammit/base64-js
59+
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},{}]},{},[])("/")})();
60+
const bytesDec = base64js.toByteArray(dataURL.substring(37)).buffer;
61+
const bytesBlob = new Blob([bytesDec], { type: "application/octet-stream" });
62+
window.eaglercraftXClientBundle = URL.createObjectURL(bytesBlob);
63+
console.error("Created " + bytesDec.byteLength + " byte object URL: " + window.eaglercraftXClientBundle);
64+
resolve(bytesBlob);
65+
});
66+
});
67+
}
4768
var ds = new DecompressionStream("gzip");
4869
var result = [];
4970
function fetchStream(reader) {
@@ -58,9 +79,7 @@ window.eaglercraftXOptsHints = {
5879
return reader.read().then(processData);
5980
});
6081
}
61-
fetch(window.eaglercraftXClientBundle, { cache: "force-cache" })
62-
.then((response) => response.blob())
63-
.then((blob) => fetchStream(blob.stream().pipeThrough(ds).getReader()));
82+
fetchB64PayloadSafe().then((blob) => fetchStream(blob.stream().pipeThrough(ds).getReader()));
6483
})();
6584
</script>
6685
<script type="text/javascript">

desktopRuntime/resources/assets/eagler/CREDITS.txt

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- Made the integrated PBR resource pack
1212
- Wrote all desktop emulation code
1313
- Wrote EaglercraftXBungee
14+
- Wrote EaglercraftXVelocity
1415
- Wrote WebRTC relay server
1516
- Wrote voice chat server
1617
- Wrote the patch and build system
@@ -20,6 +21,7 @@
2021
- Many bug fixes
2122
- WebRTC LAN worlds
2223
- WebRTC voice chat
24+
- Made velocity plugin work
2325
- Added resource packs
2426
- Added screen recording
2527
- Added seamless fullscreen
@@ -584,6 +586,44 @@
584586

585587
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
586588

589+
Project Name: BungeeCord
590+
Project Author: md_5
591+
Project URL: https://www.spigotmc.org/go/bungeecord/
592+
593+
Used For: parsing YAML config files in EaglercraftXVelocity
594+
595+
* Copyright (c) 2012, md_5. All rights reserved.
596+
*
597+
* Redistribution and use in source and binary forms, with or without
598+
* modification, are permitted provided that the following conditions are met:
599+
*
600+
* Redistributions of source code must retain the above copyright notice, this
601+
* list of conditions and the following disclaimer.
602+
*
603+
* Redistributions in binary form must reproduce the above copyright notice,
604+
* this list of conditions and the following disclaimer in the documentation
605+
* and/or other materials provided with the distribution.
606+
*
607+
* The name of the author may not be used to endorse or promote products derived
608+
* from this software without specific prior written permission.
609+
*
610+
* You may not use the software for commercial software hosting services without
611+
* written permission from the author.
612+
*
613+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
614+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
615+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
616+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
617+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
618+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
619+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
620+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
621+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
622+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
623+
* POSSIBILITY OF SUCH DAMAGE.
624+
625+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
626+
587627
Project Name: 3D Sound System
588628
Project Author: Paul Lamb
589629
Project URL: http://www.paulscode.com/forum/index.php?topic=4.0
-113 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"pluginName":"EaglercraftXBungee","pluginVersion":"1.2.1","pluginButton":"Download \"EaglerXBungee-1.2.1.jar\"","pluginFilename":"EaglerXBungee.zip"}
1+
{"pluginName":"EaglercraftXBungee","pluginVersion":"1.2.3","pluginButton":"Download \"EaglerXBungee-1.2.3.jar\"","pluginFilename":"EaglerXBungee.zip"}

javascript/SignedClientTemplate.txt

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,27 @@ window.eaglercraftXOptsHints = {
4444
<script type="text/javascript">
4545
"use strict";
4646
(function(){
47+
function fetchB64PayloadSafe() {
48+
const dataURL = window.eaglercraftXClientBundle;
49+
if(!dataURL.startsWith("data:application/octet-stream;base64,")) {
50+
return fetch(dataURL, { cache: "force-cache" }).then((response) => response.blob());
51+
}
52+
return new Promise((resolve) => {
53+
fetch(dataURL)
54+
.then((response) => response.blob())
55+
.then((blob) => { resolve(blob); })
56+
.catch((err) => {
57+
console.error("Caught an error decoding base64 via fetch, doing it the slow way instead...");
58+
// MIT License - https://github.com/beatgammit/base64-js
59+
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},{}]},{},[])("/")})();
60+
const bytesDec = base64js.toByteArray(dataURL.substring(37)).buffer;
61+
const bytesBlob = new Blob([bytesDec], { type: "application/octet-stream" });
62+
window.eaglercraftXClientBundle = URL.createObjectURL(bytesBlob);
63+
console.error("Created " + bytesDec.byteLength + " byte object URL: " + window.eaglercraftXClientBundle);
64+
resolve(bytesBlob);
65+
});
66+
});
67+
}
4768
var ds = new DecompressionStream("gzip");
4869
var result = [];
4970
function fetchStream(reader) {
@@ -58,9 +79,7 @@ window.eaglercraftXOptsHints = {
5879
return reader.read().then(processData);
5980
});
6081
}
61-
fetch(window.eaglercraftXClientBundle, { cache: "force-cache" })
62-
.then((response) => response.blob())
63-
.then((blob) => fetchStream(blob.stream().pipeThrough(ds).getReader()));
82+
fetchB64PayloadSafe().then((blob) => fetchStream(blob.stream().pipeThrough(ds).getReader()));
6483
})();
6584
</script>
6685
<script type="text/javascript">

src/main/java/net/lax1dude/eaglercraft/v1_8/EaglercraftVersion.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class EaglercraftVersion {
1010
/// Customize these to fit your fork:
1111

1212
public static final String projectForkName = "EaglercraftX";
13-
public static final String projectForkVersion = "u31";
13+
public static final String projectForkVersion = "u32";
1414
public static final String projectForkVendor = "lax1dude";
1515

1616
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";
@@ -20,7 +20,7 @@ public class EaglercraftVersion {
2020
public static final String projectOriginName = "EaglercraftX";
2121
public static final String projectOriginAuthor = "lax1dude";
2222
public static final String projectOriginRevision = "1.8";
23-
public static final String projectOriginVersion = "u31";
23+
public static final String projectOriginVersion = "u32";
2424

2525
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace
2626

@@ -31,7 +31,7 @@ public class EaglercraftVersion {
3131
public static final boolean enableUpdateService = true;
3232

3333
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
34-
public static final int updateBundlePackageVersionInt = 31;
34+
public static final int updateBundlePackageVersionInt = 32;
3535

3636
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;
3737

src/main/java/net/lax1dude/eaglercraft/v1_8/internal/GLObjectMap.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ public T get(int obj) {
6060
return (T) values[obj];
6161
}
6262

63+
public void set(int obj, T val) {
64+
values[obj] = val;
65+
}
66+
6367
private void resize() {
6468
int oldSize = size;
6569
size += size / 2;

src/main/java/net/lax1dude/eaglercraft/v1_8/minecraft/EaglerFolderResourcePack.java

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,12 @@ public static EaglerFolderResourcePack importResourcePack(String name, String pr
153153
List<String> fileNames = Lists.newArrayList();
154154

155155
logger.info("Counting files...");
156-
ZipInputStream ziss = new ZipInputStream(new EaglerInputStream(file));
157156
ZipEntry zipEntry;
158-
while ((zipEntry = ziss.getNextEntry()) != null) {
159-
if (!zipEntry.isDirectory()) {
160-
fileNames.add(zipEntry.getName());
157+
try(ZipInputStream ziss = new ZipInputStream(new EaglerInputStream(file))) {
158+
while ((zipEntry = ziss.getNextEntry()) != null) {
159+
if (!zipEntry.isDirectory()) {
160+
fileNames.add(zipEntry.getName());
161+
}
161162
}
162163
}
163164

@@ -195,22 +196,30 @@ public static EaglerFolderResourcePack importResourcePack(String name, String pr
195196
int totalSize = 0;
196197
int totalFiles = 0;
197198
int lastProg = 0;
198-
ziss = new ZipInputStream(new EaglerInputStream(file));
199-
while ((zipEntry = ziss.getNextEntry()) != null) {
200-
if (!zipEntry.isDirectory()) {
201-
fn = zipEntry.getName();
202-
if(fn.length() > prefixLen) {
203-
byte[] buffer = new byte[(int)zipEntry.getSize()];
204-
int i = 0, j;
205-
while(i < buffer.length && (j = ziss.read(buffer, i, buffer.length - i)) != -1) {
206-
i += j;
207-
}
208-
(new VFile2(prefix, folderName, fn.substring(prefixLen))).setAllBytes(buffer);
209-
totalSize += buffer.length;
210-
++totalFiles;
211-
if(totalSize - lastProg > 25000) {
212-
lastProg = totalSize;
213-
logger.info("Extracted {} files, {} bytes from ZIP file...", totalFiles, totalSize);
199+
try(ZipInputStream ziss = new ZipInputStream(new EaglerInputStream(file))) {
200+
int sz;
201+
while ((zipEntry = ziss.getNextEntry()) != null) {
202+
if (!zipEntry.isDirectory()) {
203+
fn = zipEntry.getName();
204+
if(fn.length() > prefixLen) {
205+
byte[] buffer;
206+
sz = (int)zipEntry.getSize();
207+
if(sz >= 0) {
208+
buffer = new byte[sz];
209+
int i = 0, j;
210+
while(i < buffer.length && (j = ziss.read(buffer, i, buffer.length - i)) != -1) {
211+
i += j;
212+
}
213+
}else {
214+
buffer = EaglerInputStream.inputStreamToBytes(ziss);
215+
}
216+
(new VFile2(prefix, folderName, fn.substring(prefixLen))).setAllBytes(buffer);
217+
totalSize += buffer.length;
218+
++totalFiles;
219+
if(totalSize - lastProg > 25000) {
220+
lastProg = totalSize;
221+
logger.info("Extracted {} files, {} bytes from ZIP file...", totalFiles, totalSize);
222+
}
214223
}
215224
}
216225
}

src/main/java/net/lax1dude/eaglercraft/v1_8/opengl/EaglercraftGPU.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,17 @@ public static final ITextureGL getNativeTexture(int tex) {
488488
return mapTexturesGL.get(tex);
489489
}
490490

491+
public static final void regenerateTexture(int tex) {
492+
ITextureGL webglTex = mapTexturesGL.get(tex);
493+
if(webglTex != null) {
494+
GlStateManager.unbindTextureIfCached(tex);
495+
_wglDeleteTextures(webglTex);
496+
mapTexturesGL.set(tex, _wglGenTextures());
497+
}else {
498+
logger.error("Tried to regenerate a missing texture!");
499+
}
500+
}
501+
491502
public static final void drawHighPoly(HighPolyMesh mesh) {
492503
if(mesh.vertexCount == 0 || mesh.indexCount == 0 || mesh.vertexArray == null) {
493504
return;

src/main/java/net/lax1dude/eaglercraft/v1_8/opengl/GlStateManager.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -589,18 +589,25 @@ public static final int generateTexture() {
589589
}
590590

591591
public static final void deleteTexture(int texture) {
592+
unbindTextureIfCached(texture);
592593
_wglDeleteTextures(EaglercraftGPU.mapTexturesGL.free(texture));
593-
boolean f = false;
594+
}
595+
596+
static final void unbindTextureIfCached(int texture) {
597+
boolean f1, f2 = false;
594598
for(int i = 0; i < boundTexture.length; ++i) {
595599
if(boundTexture[i] == texture) {
596-
_wglActiveTexture(GL_TEXTURE0 + i);
600+
f1 = i != activeTexture;
601+
if(f2 || f1) {
602+
_wglActiveTexture(GL_TEXTURE0 + i);
603+
f2 = f1;
604+
}
597605
_wglBindTexture(GL_TEXTURE_2D, null);
598606
_wglBindTexture(GL_TEXTURE_3D, null);
599607
boundTexture[i] = -1;
600-
f = true;
601608
}
602609
}
603-
if(f) {
610+
if(f2) {
604611
_wglActiveTexture(GL_TEXTURE0 + activeTexture);
605612
}
606613
}

0 commit comments

Comments
 (0)