Skip to content

Commit 397bdd9

Browse files
committed
Fixed Readonly setting.
1 parent d236a6c commit 397bdd9

8 files changed

Lines changed: 14 additions & 15 deletions

ActiveTextureManagement/ActiveTextureManagement.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class TexInfo
2727

2828
public bool loadOriginalFirst;
2929
public bool needsResize;
30-
public bool readable;
30+
public bool makeNotReadable;
3131

3232
public TexInfo(string name)
3333
{
@@ -37,7 +37,7 @@ public TexInfo(string name)
3737
this.height = 1;
3838
loadOriginalFirst = false;
3939
needsResize = false;
40-
readable = true;
40+
makeNotReadable = true;
4141
}
4242

4343
public void SetScalingParams(int scale, int maxSize, int minSize)

ActiveTextureManagement/CacheController.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CacheController
1414
static String MD5String = "";
1515
static String LastFile = "";
1616

17-
public static TextureInfoWrapper FetchCacheTexture(TexInfo Texture, bool compress, bool mipmaps, bool makeNotReadable)
17+
public static TextureInfoWrapper FetchCacheTexture(TexInfo Texture, bool compress, bool mipmaps)
1818
{
1919
String textureName = Texture.name;
2020
String originalTextureFile = KSPUtil.ApplicationRootPath + "GameData/" + textureName;
@@ -36,7 +36,7 @@ public static TextureInfoWrapper FetchCacheTexture(TexInfo Texture, bool compres
3636
if (origWidthString == null || origHeightString == null ||
3737
cacheHash == null || format == null)
3838
{
39-
return RebuildCache(Texture, compress, mipmaps, makeNotReadable);
39+
return RebuildCache(Texture, compress, mipmaps);
4040
}
4141

4242
originalTextureFile += format;
@@ -86,33 +86,32 @@ public static TextureInfoWrapper FetchCacheTexture(TexInfo Texture, bool compres
8686
{
8787
ActiveTextureManagement.DBGLog(Texture.resizeHeight + " != " + cacheHeight);
8888
}
89-
return RebuildCache(Texture, compress, mipmaps, makeNotReadable);
89+
return RebuildCache(Texture, compress, mipmaps);
9090
}
9191
else
9292
{
9393
ActiveTextureManagement.DBGLog("Loading from cache... " + textureName);
9494
Texture.needsResize = false;
9595
Texture.width = Texture.resizeWidth;
9696
Texture.height = Texture.resizeHeight;
97-
Texture.readable = !makeNotReadable;
9897
Texture.filename = cacheFile;
9998

10099
return TextureConverter.DDSToTexture(Texture, hasMipmaps, isCompressed, hasAlpha); ;
101100
}
102101
}
103102
else
104103
{
105-
return RebuildCache(Texture, compress, mipmaps, makeNotReadable);
104+
return RebuildCache(Texture, compress, mipmaps);
106105
}
107106
}
108107
else
109108
{
110-
return RebuildCache(Texture, compress, mipmaps, makeNotReadable);
109+
return RebuildCache(Texture, compress, mipmaps);
111110
}
112111

113112
}
114113

115-
private static TextureInfoWrapper RebuildCache(TexInfo Texture, bool compress, bool mipmaps, bool makeNotReadable)
114+
private static TextureInfoWrapper RebuildCache(TexInfo Texture, bool compress, bool mipmaps)
116115
{
117116
Texture.loadOriginalFirst = true;
118117
ActiveTextureManagement.DBGLog("Loading texture...");
@@ -158,9 +157,9 @@ private static TextureInfoWrapper RebuildCache(TexInfo Texture, bool compress, b
158157
tex.Compress(true);
159158
}
160159
cacheTexture.isCompressed = compress;
161-
tex.Apply(false, makeNotReadable);
160+
tex.Apply(false, Texture.makeNotReadable);
162161

163-
cacheTexture.isReadable = !makeNotReadable;
162+
cacheTexture.isReadable = !Texture.makeNotReadable;
164163

165164
return cacheTexture;
166165
}

ActiveTextureManagement/DatabaseLoaderTexture_ATM.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ static public TextureInfoWrapper UpdateTexture(TexInfo texture)
247247
}
248248
}
249249
texture.SetScalingParams(scale, maxSize, minSize);
250-
251-
TextureInfoWrapper ret = CacheController.FetchCacheTexture(texture, compress, mipmaps, makeNotReadable && !readableList.Contains(texture.name));
250+
texture.makeNotReadable = makeNotReadable && !readableList.Contains(texture.name);
251+
TextureInfoWrapper ret = CacheController.FetchCacheTexture(texture, compress, mipmaps);
252252
ret.texture.filterMode = filterMode;
253253
return ret;
254254
}

ActiveTextureManagement/TextureConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,10 +470,10 @@ public static TextureInfoWrapper DDSToTexture(TexInfo Texture, bool mipmaps, boo
470470
Texture2D newTex = new Texture2D(Texture.width, Texture.height, format, mipmaps);
471471

472472
newTex.LoadRawTextureData(imageBuffer);
473-
newTex.Apply(false, !Texture.readable);
473+
newTex.Apply(false, Texture.makeNotReadable);
474474
newTex.name = Texture.name;
475475

476-
return new TextureInfoWrapper(newTex, Texture.isNormalMap, false, true);
476+
return new TextureInfoWrapper(newTex, Texture.isNormalMap, !Texture.makeNotReadable, true);
477477
}
478478

479479
public static void GetReadable(TexInfo Texture, bool mipmaps)

x64-Aggressive-Release.zip

6 Bytes
Binary file not shown.

x64-Basic-Release.zip

6 Bytes
Binary file not shown.

x86-Aggressive-Release.zip

16 Bytes
Binary file not shown.

x86-Basic-Release.zip

16 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)