Compare commits
12 Commits
i18n
...
2.0.2.75-D
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
223ade39cb | ||
|
|
5aca9e70b2 | ||
|
|
ce28799db3 | ||
|
|
92772cf334 | ||
|
|
0395e81a9f | ||
|
|
7734a7bf7e | ||
|
|
db2d19bb1e | ||
|
|
ab305a249c | ||
|
|
9d104a9dd8 | ||
|
|
bcd3bd5ca2 | ||
|
|
c1829a9837 | ||
|
|
cca23f6e05 |
@@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors></Authors>
|
<Authors></Authors>
|
||||||
<Company></Company>
|
<Company></Company>
|
||||||
<Version>2.0.3</Version>
|
<Version>2.0.2.75</Version>
|
||||||
<Description></Description>
|
<Description></Description>
|
||||||
<Copyright></Copyright>
|
<Copyright></Copyright>
|
||||||
<PackageProjectUrl>https://github.com/Light-Public-Syncshells/LightlessClient</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/Light-Public-Syncshells/LightlessClient</PackageProjectUrl>
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ public sealed partial class XivDataAnalyzer
|
|||||||
|
|
||||||
var tempSets = new Dictionary<string, HashSet<ushort>>(StringComparer.OrdinalIgnoreCase);
|
var tempSets = new Dictionary<string, HashSet<ushort>>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
var tempFileName = $"lightless_pap_{Guid.NewGuid():N}_{hash.Substring(0, Math.Min(8, hash.Length))}.hkx";
|
var tempFileName = $"lightless_pap_{Guid.NewGuid():N}_{hash[..Math.Min(8, hash.Length)]}.hkx";
|
||||||
var tempHavokDataPath = Path.Combine(Path.GetTempPath(), tempFileName);
|
var tempHavokDataPath = Path.Combine(Path.GetTempPath(), tempFileName);
|
||||||
IntPtr tempHavokDataPathAnsi = IntPtr.Zero;
|
IntPtr tempHavokDataPathAnsi = IntPtr.Zero;
|
||||||
|
|
||||||
@@ -215,7 +215,16 @@ public sealed partial class XivDataAnalyzer
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
File.WriteAllBytes(tempHavokDataPath, havokData);
|
// Write the file with explicit error handling
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.WriteAllBytes(tempHavokDataPath, havokData);
|
||||||
|
}
|
||||||
|
catch (Exception writeEx)
|
||||||
|
{
|
||||||
|
_logger.LogError(writeEx, "Failed to write temporary Havok file to {path}", tempHavokDataPath);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!File.Exists(tempHavokDataPath))
|
if (!File.Exists(tempHavokDataPath))
|
||||||
{
|
{
|
||||||
@@ -228,7 +237,26 @@ public sealed partial class XivDataAnalyzer
|
|||||||
{
|
{
|
||||||
_logger.LogWarning("Written temp file size mismatch: expected {expected}, got {actual}",
|
_logger.LogWarning("Written temp file size mismatch: expected {expected}, got {actual}",
|
||||||
havokData.Length, writtenFileInfo.Length);
|
havokData.Length, writtenFileInfo.Length);
|
||||||
File.Delete(tempHavokDataPath);
|
try { File.Delete(tempHavokDataPath); } catch { }
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(10); // stabilize file system
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var testStream = File.OpenRead(tempHavokDataPath);
|
||||||
|
if (testStream.Length != havokData.Length)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("File verification failed: length mismatch after write");
|
||||||
|
try { File.Delete(tempHavokDataPath); } catch { }
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception readEx)
|
||||||
|
{
|
||||||
|
_logger.LogError(readEx, "Cannot read back temporary file at {path}", tempHavokDataPath);
|
||||||
|
try { File.Delete(tempHavokDataPath); } catch { }
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,18 +273,31 @@ public sealed partial class XivDataAnalyzer
|
|||||||
hkResource* resource = null;
|
hkResource* resource = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (tempHavokDataPathAnsi == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
_logger.LogError("Failed to allocate ANSI string for path");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
resource = hkSerializeUtil.LoadFromFile((byte*)tempHavokDataPathAnsi, null, loadoptions);
|
resource = hkSerializeUtil.LoadFromFile((byte*)tempHavokDataPathAnsi, null, loadoptions);
|
||||||
}
|
}
|
||||||
catch (SEHException ex)
|
catch (SEHException ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "SEH exception loading Havok file from {path} (hash={hash}). Native error code: 0x{code:X}",
|
_logger.LogError(ex, "SEH exception loading Havok file from {path} (hash={hash}). Native error code: 0x{code:X}. This may indicate a corrupted PAP file or incompatible Havok format.",
|
||||||
tempHavokDataPath, hash, ex.ErrorCode);
|
tempHavokDataPath, hash, ex.ErrorCode);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Unexpected exception loading Havok file from {path} (hash={hash})",
|
||||||
|
tempHavokDataPath, hash);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (resource == null)
|
if (resource == null)
|
||||||
{
|
{
|
||||||
_logger.LogDebug("Havok resource was null after loading from {path} (hash={hash})", tempHavokDataPath, hash);
|
_logger.LogDebug("Havok resource was null after loading from {path} (hash={hash}). File may be corrupted or in an unsupported format.",
|
||||||
|
tempHavokDataPath, hash);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user