Browse Source

Fix bug with text length when compiling java class

master
BahaBulle 8 years ago
parent
commit
1432348298
2 changed files with 11 additions and 4 deletions
  1. +4
    -2
      Hack.Xenosaga/Process/JavaClass.cs
  2. +7
    -2
      Hack.Xenosaga/Process/Scripts.cs

+ 4
- 2
Hack.Xenosaga/Process/JavaClass.cs View File

@ -530,7 +530,9 @@ namespace Hack.Xenosaga.Process
{ {
bw.Write(IntToByteArrayBE(attribut.Value.attribute_name_index, 2), 0, 2); bw.Write(IntToByteArrayBE(attribut.Value.attribute_name_index, 2), 0, 2);
bw.Write(IntToByteArrayBE((int)attribut.Value.attribute_length, 4), 0, 4); bw.Write(IntToByteArrayBE((int)attribut.Value.attribute_length, 4), 0, 4);
bw.Write(attribut.Value.info);
if (attribut.Value.info != null)
bw.Write(attribut.Value.info);
} }
} }
} }
@ -1745,8 +1747,8 @@ namespace Hack.Xenosaga.Process
CONSTANT_Utf8_info stUTF8 = (CONSTANT_Utf8_info)constant_pool[id]; CONSTANT_Utf8_info stUTF8 = (CONSTANT_Utf8_info)constant_pool[id];
stUTF8.bytes = new byte[bytes.Length]; stUTF8.bytes = new byte[bytes.Length];
stUTF8.length = (short)(bytes.Length);
Array.Copy(bytes, 0, stUTF8.bytes, 0, bytes.Length); Array.Copy(bytes, 0, stUTF8.bytes, 0, bytes.Length);
//stUTF8.bytes[bytes.Length] = 0;
} }
} }
} }


+ 7
- 2
Hack.Xenosaga/Process/Scripts.cs View File

@ -264,7 +264,7 @@ namespace Hack.Xenosaga.Process
{ {
try try
{ {
Trace.WriteLine(string.Format("Insert {0} : ", pathName));
Trace.Write(string.Format("Insert {0} : ", pathName));
using (BinaryReader br = new BinaryReader(File.Open(pathName, FileMode.Open))) using (BinaryReader br = new BinaryReader(File.Open(pathName, FileMode.Open)))
{ {
@ -323,9 +323,14 @@ namespace Hack.Xenosaga.Process
foreach (KeyValuePair<int, byte[]> bytes in dictBytes) foreach (KeyValuePair<int, byte[]> bytes in dictBytes)
{ {
pt = string.Format("{0:X4}", bytes.Key); pt = string.Format("{0:X4}", bytes.Key);
if (dictBytes.ContainsKey(Convert.ToInt32(pt, 16)) && list[pt] != null) if (dictBytes.ContainsKey(Convert.ToInt32(pt, 16)) && list[pt] != null)
{
if (list[pt].Length >= 255)
throw new Exception("Line too long (254 characters max)!");
jc.setConstantsBytes(bytes.Key, list[pt]); jc.setConstantsBytes(bytes.Key, list[pt]);
}
} }
} }


Loading…
Cancel
Save