diff --git a/SharpTune.exe b/SharpTune.exe deleted file mode 100644 index db486f5..0000000 Binary files a/SharpTune.exe and /dev/null differ diff --git a/SharpTune/Program.cs b/SharpTune/Program.cs index de6b462..e4ce55f 100644 --- a/SharpTune/Program.cs +++ b/SharpTune/Program.cs @@ -22,11 +22,17 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the using System.Text; using EcuMapTools; using SharpTuneCore; +using System.Runtime.InteropServices; namespace SharpTune { public static class Program { + // defines for commandline output + [DllImport("kernel32.dll")] + static extern bool AttachConsole(int dwProcessId); + private const int ATTACH_PARENT_PROCESS = -1; + private static SharpTuner sharpTuner; /// /// Entry point. Runs the utility with or without exception handling, depending on whether a debugger is attached. @@ -45,6 +51,9 @@ public static int Main(string[] args) { try { + // redirect console output to parent process; + // must be before any calls to Console.WriteLine() + AttachConsole(ATTACH_PARENT_PROCESS); result = Run(args); } catch (Exception exception) diff --git a/SharpTune/RomMod/Mod.cs b/SharpTune/RomMod/Mod.cs index 105b144..6325044 100644 --- a/SharpTune/RomMod/Mod.cs +++ b/SharpTune/RomMod/Mod.cs @@ -211,8 +211,8 @@ public Mod(string modPath, string build) FilePath = modPath; isResource = false; reader = new SRecordReader(modPath); - TryReadPatches(); - TryReversePatches(); + //TryReadPatches(); + //TryReversePatches(); } public bool TryDefinition(AvailableDevices ad, string defPath) diff --git a/SharpTune/RomMod/ModDefinition.cs b/SharpTune/RomMod/ModDefinition.cs index 790ca7d..6164991 100644 --- a/SharpTune/RomMod/ModDefinition.cs +++ b/SharpTune/RomMod/ModDefinition.cs @@ -352,7 +352,7 @@ public bool TryReadDefString(Blob metadata, out string metaString, ref int offse } char[] splitter = { '\0' }; - string tempstring = System.Text.Encoding.ASCII.GetString(tempbytelist.ToArray()); + string tempstring = System.Text.Encoding.UTF8.GetString(tempbytelist.ToArray()); metaString = tempstring.Split(splitter)[0]; return true; } diff --git a/SharpTune/RomMod/RomMod.cs b/SharpTune/RomMod/RomMod.cs index a0019cc..57115f2 100644 --- a/SharpTune/RomMod/RomMod.cs +++ b/SharpTune/RomMod/RomMod.cs @@ -240,6 +240,9 @@ public static bool TryHewBuild(AvailableDevices ad, string patchPath, string rom return false; } } + + // use baseline'd patch to create new mod + mod = new Mod(mod.ModIdent + ".patch"); File.Copy(romPath, "oem.bin", true); Trace.WriteLine("Attempting to test patches"); if (!mod.TryCheckApplyMod(romPath, romPath, true, false)) //&& !mod.TryCheckApplyMod(romPath, romPath, false, false)) ;