Fix CultureVariance issues,

Tell the germans to use ,'s to seperate decimal numbers OR SO HELP ME
This commit is contained in:
Bluzume 2021-08-18 00:08:11 +12:00
parent 1afe520ac7
commit 19ee4bd38a
8 changed files with 40 additions and 23 deletions

Binary file not shown.

View File

@ -75,6 +75,9 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>cxml.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="DotNetZip, Version=1.13.3.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetZip.1.13.3\lib\net40\DotNetZip.dll</HintPath>
@ -102,5 +105,8 @@
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="cxml.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -6,7 +6,7 @@ using General;
using System.IO;
using System.Text;
using System.Xml;
using System.Globalization;
namespace CXML
{
@ -102,7 +102,7 @@ namespace CXML
public bool ProcessFiles = false;
public bool WaitExit = false;
public bool NoRecursive = false;
public void Init(string path, bool CheckMagic = true)
{
InfoFile = File.Open(path, FileMode.Open, FileAccess.Read);
@ -479,6 +479,9 @@ namespace CXML
if (Extension == ".rcs") // Recursive Decompile, remove this if statement to remove RCS processing
{
if (NoRecursive)
return;
Console.WriteLine("Decompiling " + Path.GetFileName(FileName));
string DirectoryName = Path.Combine(FileDir, "converted", "RCStoXML", Path.GetFileNameWithoutExtension(FileName));
if (!Directory.Exists(DirectoryName))
@ -611,7 +614,7 @@ namespace CXML
break;
case AttributeType.TYPE_FLOAT:
float FloatValue = bTreeTable.ReadSingle();
AttributeValue = ((double)FloatValue).ToString() + "f";
AttributeValue = FloatValue.ToString("G9", CultureInfo.InvariantCulture) + "f";
Console.WriteLine("Float - Value: " + AttributeValue.ToString() + " sz:" + bTreeTable.ReadInt32());
break;
case AttributeType.TYPE_STRING:
@ -640,11 +643,11 @@ namespace CXML
int HashTableOffset = bTreeTable.ReadInt32();
int HashTableSize = bTreeTable.ReadInt32();
HashIDTable.Seek(HashTableOffset * 4, SeekOrigin.Begin);
Console.WriteLine("Hash ID Offset:" + HashTableOffset.ToString() + " size: " + HashTableSize);
Console.WriteLine("Hash ID Offset:" + HashTableOffset.ToString(CultureInfo.InvariantCulture) + " size: " + HashTableSize);
int HashId = bHashIDTable.ReadInt32();
AttributeValue = HashId.ToString("X8");
AttributeValue = HashId.ToString("X8", CultureInfo.InvariantCulture);
break;
case AttributeType.TYPE_INTEGER_ARRAY:
@ -673,7 +676,7 @@ namespace CXML
for(int i = 0; i < FloatArraySize; i++)
{
FloatValue = bFloatArrayTable.ReadSingle();
StrList.Add(((double)FloatValue).ToString() +"f");
StrList.Add(FloatValue.ToString("G9", CultureInfo.InvariantCulture) +"f");
}
string[] StrArray = StrList.ToArray();
AttributeValue = "[" + String.Join(", ", StrArray) + "]";
@ -689,7 +692,7 @@ namespace CXML
string FileHash = Tools.GenerateHash(FileData);
string FileSmallHash = Tools.GenerateShortHash(FileData);
String Extension = Tools.GetFileExtension(FileData);
String FileName = Path.Combine(FileDir, "original", FilePtr.ToString("X")+"-"+FileHash + Extension);
String FileName = Path.Combine(FileDir, "original", FilePtr.ToString("X", CultureInfo.InvariantCulture) +"-"+FileHash + Extension);
String IdealName = ElementName + "-" + AttributeName + "-" + FileSmallHash + Extension;
if (!File.Exists(FileName))
{

View File

@ -1,11 +1,7 @@
using Ionic.Zip;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace CXMLDecompiler
{
@ -55,7 +51,7 @@ namespace CXMLDecompiler
zip.Dispose();
zipStream.Dispose();
File.AppendAllText("GimConv\\GimConv.cfg", "option -psvindex8 {\r\n format_endian = little\r\n format_style = psp\r\n image_format = index8\r\n pixel_order = normal\r\n pixel_channel = rgba\r\n limit_image_width = 4096\r\n limit_image_height = 4096\r\n}");
File.AppendAllText("GimConv\\GimConv.cfg", "option -psvrgba8888 {\r\n format_endian = little\r\n format_style = psp\r\n image_format = rgba8888\r\n pixel_order = normal\r\n pixel_channel = rgba\r\n limit_image_width = 4096\r\n limit_image_height = 4096\r\n}\r\noption -psvindex4 {\r\n format_endian = little\r\n format_style = psp\r\n image_format = index4\r\n pixel_order = normal\r\n pixel_channel = rgba\r\n limit_image_width = 4096\r\n limit_image_height = 4096\r\n}\r\noption -psvindex8 {\r\n format_endian = little\r\n format_style = psp\r\n image_format = index8\r\n pixel_order = normal\r\n pixel_channel = rgba\r\n limit_image_width = 4096\r\n limit_image_height = 4096\r\n}");
DownloadCompleted = true;
}

View File

@ -53,6 +53,7 @@ namespace CXMLCli
Console.WriteLine("\t-fat --dump-float-array Dump float array table.");
Console.WriteLine("\t-ft --dump-file Dump file table.");
Console.WriteLine("\t-p --process-files Process Extracted Files");
Console.WriteLine("\t-nr --no-recursive Do not recursively decompile .RCS to XML");
Console.WriteLine("\t-w --wait-exit Wait for keypress before exiting");
Console.WriteLine("\t-d --decompile Decompile CXML to XML.");
Console.WriteLine("\t-c --compile Compile XML to CXML");
@ -189,6 +190,11 @@ namespace CXMLCli
cxmlParser.WaitExit = true;
}
if (HasArg(ArgsFull, "-nr") || HasArg(ArgsFull, "--no-recursive"))
{
cxmlParser.NoRecursive = true;
}
if (HasArg(ArgsFull, "-d") || HasArg(ArgsFull, "--decompile") && !HasArg(ArgsFull, "-dt"))
{
Console.WriteLine("Decompiling.");

View File

@ -5,13 +5,13 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AppInfoCli")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("CXML Decompiler")]
[assembly: AssemblyDescription("CXML Decompiler & Compiler")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AppInfoCli")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCompany("SilicaAndPina Inc")]
[assembly: AssemblyProduct("CXML Decompiler")]
[assembly: AssemblyCopyright("Public Domain © 2021")]
[assembly: AssemblyTrademark("CXML Decompiler is not a trademark of SilicaAndPina Inc")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("be72e673-25ff-47ab-af5b-9448b69e3990")]
[assembly: Guid("7e3c8d27-de0C-45c1-96ed-a408f3c03b93")]
// Version information for an assembly consists of the following four values:
//

BIN
AppInfoCli/cxml.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -1,20 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2003
# Visual Studio Version 16
VisualStudioVersion = 16.0.31515.178
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CXMLCli", "AppInfoCli\CXMLCli.csproj", "{BE72E673-25FF-47AB-AF5B-9448B69E3990}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BE72E673-25FF-47AB-AF5B-9448B69E3990}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BE72E673-25FF-47AB-AF5B-9448B69E3990}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BE72E673-25FF-47AB-AF5B-9448B69E3990}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BE72E673-25FF-47AB-AF5B-9448B69E3990}.Release|Any CPU.Build.0 = Release|Any CPU
{BE72E673-25FF-47AB-AF5B-9448B69E3990}.Debug|x64.ActiveCfg = Debug|x64
{BE72E673-25FF-47AB-AF5B-9448B69E3990}.Debug|x64.Build.0 = Debug|x64
{BE72E673-25FF-47AB-AF5B-9448B69E3990}.Release|Any CPU.ActiveCfg = Release|x64
{BE72E673-25FF-47AB-AF5B-9448B69E3990}.Release|Any CPU.Build.0 = Release|x64
{BE72E673-25FF-47AB-AF5B-9448B69E3990}.Release|x64.ActiveCfg = Release|x64
{BE72E673-25FF-47AB-AF5B-9448B69E3990}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE