mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-22 06:52:55 +08:00
Fix for saving texture resources
This commit is contained in:
parent
a11ec59dda
commit
0418e7743e
@ -2940,7 +2940,22 @@ namespace CodeWalker.GameFiles
|
||||
if (ytd2.TextureDict.Textures?.Count != ytdfile.TextureDict.Textures?.Count)
|
||||
{ continue; }
|
||||
|
||||
for (int i = 0; i < ytdfile.TextureDict.Textures.Count; i++)
|
||||
{
|
||||
var tx1 = ytdfile.TextureDict.Textures[i];
|
||||
var tx2 = ytd2.TextureDict.Textures[i];
|
||||
var td1 = tx1.Data;
|
||||
var td2 = tx2.Data;
|
||||
if (td1.FullData.Length != td2.FullData.Length)
|
||||
{ continue; }
|
||||
|
||||
for (int j = 0; j < td1.FullData.Length; j++)
|
||||
{
|
||||
if (td1.FullData[j] != td2.FullData[j])
|
||||
{ break; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ namespace CodeWalker.GameFiles
|
||||
foreach (var block in blocks)
|
||||
{
|
||||
if (block.FilePosition != -1)
|
||||
throw new Exception("A position of -1 is not possible!");
|
||||
throw new Exception("Block was already assigned a position!");
|
||||
//if (block.Length == 0)
|
||||
// throw new Exception("A length of 0 is not allowed!");
|
||||
|
||||
@ -226,23 +226,14 @@ namespace CodeWalker.GameFiles
|
||||
|
||||
|
||||
|
||||
var sysDataSize = 0x2000;
|
||||
while (sysDataSize < systemStream.Length)
|
||||
{
|
||||
sysDataSize *= 2;
|
||||
}
|
||||
var sysDataSize = systemPageCount * systemPageSize;
|
||||
var sysData = new byte[sysDataSize];
|
||||
systemStream.Flush();
|
||||
systemStream.Position = 0;
|
||||
systemStream.Read(sysData, 0, (int)systemStream.Length);
|
||||
|
||||
|
||||
var gfxPageSize = 0x2000;
|
||||
while (gfxPageSize != graphicsPageSize)
|
||||
{
|
||||
gfxPageSize *= 2;
|
||||
}
|
||||
var gfxDataSize = graphicsPageCount * gfxPageSize;
|
||||
var gfxDataSize = graphicsPageCount * graphicsPageSize;
|
||||
var gfxData = new byte[gfxDataSize];
|
||||
graphicsStream.Flush();
|
||||
graphicsStream.Position = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user