Explorar el Código

Fix CacheFileBuilder for new HXSL version

TothBenoit hace 1 año
padre
commit
980586ce1d
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      hxsl/CacheFileBuilder.hx

+ 3 - 1
hxsl/CacheFileBuilder.hx

@@ -256,8 +256,10 @@ class CacheFileBuilder {
 			case "-lib":
 			case "-lib":
 				var lib = new format.hl.Reader().read(new haxe.io.BytesInput(sys.io.File.getBytes(getArg())));
 				var lib = new format.hl.Reader().read(new haxe.io.BytesInput(sys.io.File.getBytes(getArg())));
 				for( s in lib.strings ) {
 				for( s in lib.strings ) {
-					if( !StringTools.startsWith(s,"HXSL") ) continue;
+					if( !StringTools.startsWith(s,"HXS") ) continue;
 					var data = try haxe.crypto.Base64.decode(s) catch( e : Dynamic ) continue;
 					var data = try haxe.crypto.Base64.decode(s) catch( e : Dynamic ) continue;
+					if (data.length < 4 )
+						continue;
 					var len = data.get(3);
 					var len = data.get(3);
 					var name = data.getString(4,len);
 					var name = data.getString(4,len);
 					builder.shaderLib.set(name, s);
 					builder.shaderLib.set(name, s);