Skip to content

Commit

Permalink
Fix languages.dat loading
Browse files Browse the repository at this point in the history
  • Loading branch information
aianlinb committed Jul 28, 2023
1 parent 23f81e1 commit 7db5b0c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion LibDat2/DatContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public DatContainer(Stream stream, string fileName, bool SchemaMin = false) {
FieldDefinitions = new(kvps);
}

if (Name != "Languages") {
if (Name != "languages") {
var actualRecordLength = GetActualRecordLength(reader, Count);
DataSectionOffset = Count * actualRecordLength + 4;
// DataSectionDataLength = Length - DataSectionOffset - 8;
Expand Down
2 changes: 1 addition & 1 deletion LibDat2/LibDat2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<Authors>aianlinb</Authors>
<Copyright>Copyright © 2020-2023 aianlinb</Copyright>
<Version>0.16.0</Version>
<Version>0.16.1</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>embedded</DebugType>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
4 changes: 2 additions & 2 deletions LibDat2/Types/ValueStringData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public override unsafe ValueStringData Read(BinaryReader reader) {
short ch;
while ((ch = reader.ReadInt16()) != 0)
sb.Append((char)ch);
if (Dat.Name != "Languages" && reader.ReadInt16() != 0) // string should end with 4 bytes of zero
if (Dat.Name != "languages" && reader.ReadInt16() != 0) // string should end with 4 bytes of zero
throw new("Not found \\0 at the end of the string");
}
Value = sb.ToString();
Expand All @@ -37,7 +37,7 @@ public unsafe override void Write(BinaryWriter writer) {
else
fixed (char* c = Value) // string is stored in UTF-16 in C#, so we can directly get its bytes for writing
writer.BaseStream.Write(new ReadOnlySpan<byte>(c, Value.Length * 2));
if (Dat.Name == "Languages")
if (Dat.Name == "languages")
writer.Write((short)0);
else
writer.Write(0); // \0 at the end of string
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Notice
All projects in this repository are not thread-safe,
do not use these libraries with more than one thread!
Do not process a single ggpk file with more than one thread

This project is reserved for VisualGGPK2.
For development, it is recommended to use [LibGGPK3](https://github.com/aianlinb/LibGGPK3) instead.
For development, it's recommended to use [LibGGPK3](https://github.com/aianlinb/LibGGPK3) instead.

## LibGGPK2
Library for Content.ggpk of game PathOfExile.

Rewrite of https://github.com/aianlinb/libggpk
## VisualGGPK2
A visual program to view/edit ggpk file.
A windows desktop program to view/edit ggpk file.

![image](https://github.com/aianlinb/LibGGPK2/blob/master/.github/example.png)
## What's New?
Expand Down
2 changes: 1 addition & 1 deletion VisualGGPK2/VisualGGPK2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net6.0-windows</TargetFramework>
<Authors>aianlinb</Authors>
<Copyright>Copyright © 2020-2023 aianlinb</Copyright>
<Version>0.16.0</Version>
<Version>0.16.1</Version>
<OutputType>WinExe</OutputType>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
Expand Down

0 comments on commit 7db5b0c

Please sign in to comment.