Renamed project, customisable window color(launch with color name as arg)

master
1987kostya 4 years ago
parent b716ed6814
commit 9b7212e1d8

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30517.126
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetCTFDumper", "DotNetCTFDumper\DotNetCTFDumper.csproj", "{86D99F9E-98FB-4E50-AB68-F5C115850C33}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CTFAK", "CTFAK\CTFAK.csproj", "{86D99F9E-98FB-4E50-AB68-F5C115850C33}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

@ -8,9 +8,9 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{86D99F9E-98FB-4E50-AB68-F5C115850C33}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>DotNetCTFDumper</RootNamespace>
<AssemblyName>DotNetCTFDumper</AssemblyName>
<OutputType>WinExe</OutputType>
<RootNamespace>CTFAK</RootNamespace>
<AssemblyName>CTFAK</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
@ -282,10 +282,10 @@
<PropertyGroup>
<PostBuildEvent>md $(SolutionDir)\Build\
md $(SolutionDir)\Build\x64\
copy $(TargetPath) $(SolutionDir)Build\DotNetCTFDumper.exe
copy $(TargetPath) $(SolutionDir)Build\CTFAK.exe
copy $(SolutionDir)Dependencies\Decrypter-x64.dll $(SolutionDir)Build\Decrypter-x64.dll
copy $(TargetDir)\x64\zlibwapi.dll $(SolutionDir)Build\x64\zlibwapi.dll
copy $(TargetDir)DotNetCTFDumper.pdb $(SolutionDir)Build\DotNetCTFDumper.pdb
copy $(TargetDir)CTFAK.pdb $(SolutionDir)Build\CTFAK.pdb
copy $(TargetDir)Be.Windows.Forms.HexBox.dll $(SolutionDir)Build\Be.Windows.Forms.HexBox.dll
copy $(TargetDir)Joveler.Compression.ZLib.dll $(SolutionDir)Build\Joveler.Compression.ZLib.dll
copy $(TargetDir)Joveler.DynLoader.dll $(SolutionDir)Build\Joveler.DynLoader.dll

@ -32,6 +32,7 @@ namespace DotNetCTFDumper.GUI
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.exitButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBox1
@ -47,11 +48,27 @@ namespace DotNetCTFDumper.GUI
this.textBox1.Size = new System.Drawing.Size(603, 274);
this.textBox1.TabIndex = 0;
//
// exitButton
//
this.exitButton.BackColor = System.Drawing.Color.Black;
this.exitButton.Dock = System.Windows.Forms.DockStyle.Bottom;
this.exitButton.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.exitButton.Font = new System.Drawing.Font("Ebrima", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (0)));
this.exitButton.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.exitButton.Location = new System.Drawing.Point(0, 246);
this.exitButton.Name = "exitButton";
this.exitButton.Size = new System.Drawing.Size(603, 28);
this.exitButton.TabIndex = 1;
this.exitButton.Text = "Exit";
this.exitButton.UseVisualStyleBackColor = false;
this.exitButton.Click += new System.EventHandler(this.exitButton_Click);
//
// ErrorLogBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(603, 274);
this.Controls.Add(this.exitButton);
this.Controls.Add(this.textBox1);
this.ForeColor = System.Drawing.Color.Red;
this.Name = "ErrorLogBox";
@ -60,6 +77,8 @@ namespace DotNetCTFDumper.GUI
this.PerformLayout();
}
private System.Windows.Forms.Button exitButton;
private System.Windows.Forms.TextBox textBox1;
#endregion

@ -28,5 +28,11 @@ namespace DotNetCTFDumper.GUI
//Console.ReadKey();
}
private void exitButton_Click(object sender, EventArgs e)
{
Logger.Log("Exiting because of exception");
Environment.Exit(-1);
}
}
}

@ -1,7 +1,10 @@
using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using DotNetCTFDumper.Utils;
namespace DotNetCTFDumper.GUI
{
@ -85,5 +88,10 @@ namespace DotNetCTFDumper.GUI
public short wBorderWidth;
public short wBorders;
}
private void MainConsole_Load(object sender, EventArgs e)
{
}
}
}

@ -158,9 +158,9 @@
this.GameInfo.Location = new System.Drawing.Point(8, 36);
this.GameInfo.Margin = new System.Windows.Forms.Padding(5, 0, 3, 0);
this.GameInfo.Name = "GameInfo";
this.GameInfo.Size = new System.Drawing.Size(182, 45);
this.GameInfo.Size = new System.Drawing.Size(182, 105);
this.GameInfo.TabIndex = 3;
this.GameInfo.Text = "GameInfo will appear here\r\nSemenLine\r\nLine3\r\n";
this.GameInfo.Text = "GameInfo will appear here\r\nLine2\r\nLine3\r\nLine4\r\nLine5\r\nLine6\r\n\r\n";
this.GameInfo.Visible = false;
//
// label1
@ -377,7 +377,7 @@
//
// SortedProgressBar
//
this.SortedProgressBar.Location = new System.Drawing.Point(97, 216);
this.SortedProgressBar.Location = new System.Drawing.Point(97, 407);
this.SortedProgressBar.Name = "SortedProgressBar";
this.SortedProgressBar.Size = new System.Drawing.Size(209, 41);
this.SortedProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
@ -701,18 +701,20 @@
this.pluginLogBox.Multiline = true;
this.pluginLogBox.Name = "pluginLogBox";
this.pluginLogBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.pluginLogBox.Size = new System.Drawing.Size(405, 479);
this.pluginLogBox.Size = new System.Drawing.Size(405, 448);
this.pluginLogBox.TabIndex = 2;
//
// activatePluginBtn
//
this.activatePluginBtn.Dock = System.Windows.Forms.DockStyle.Fill;
this.activatePluginBtn.AutoSize = true;
this.activatePluginBtn.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.activatePluginBtn.Dock = System.Windows.Forms.DockStyle.Bottom;
this.activatePluginBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.activatePluginBtn.Font = new System.Drawing.Font("Feast of Flesh BB", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte) (77)));
this.activatePluginBtn.ForeColor = System.Drawing.Color.FromArgb(((int) (((byte) (255)))), ((int) (((byte) (128)))), ((int) (((byte) (0)))));
this.activatePluginBtn.Location = new System.Drawing.Point(252, 0);
this.activatePluginBtn.Location = new System.Drawing.Point(252, 448);
this.activatePluginBtn.Name = "activatePluginBtn";
this.activatePluginBtn.Size = new System.Drawing.Size(683, 479);
this.activatePluginBtn.Size = new System.Drawing.Size(683, 31);
this.activatePluginBtn.TabIndex = 1;
this.activatePluginBtn.Text = "Activate";
this.activatePluginBtn.UseVisualStyleBackColor = true;

@ -40,10 +40,11 @@ namespace DotNetCTFDumper.GUI
public MainForm()
public MainForm(Color color)
{
//Buttons
InitializeComponent();
ColorTheme = color;
foreach (Control item in Controls)
{
item.ForeColor = ColorTheme;
@ -169,6 +170,7 @@ namespace DotNetCTFDumper.GUI
soundsButton.Visible = false;
musicsButton.Visible = false;
dumpSortedBtn.Visible = false;
Loaded = false;
@ -312,10 +314,10 @@ namespace DotNetCTFDumper.GUI
GameInfo.Visible = true;
loadingLabel.Visible = false;
Loaded = true;
InitKeyTab();
InitPackDataTab();
InitImages();
InitSounds();
InitKeyTab();
InitPlugins();
var toLog = "";
toLog += $"Title:{Exe.Instance.GameData.Name}\n";

@ -234,7 +234,6 @@ namespace DotNetCTFDumper.MMFParser.EXE
case 17478:
loader = new ObjectProperties(chunk);
return loader;
break;
case 8788:
//loader = new ObjectNames(chunk);
break;

@ -178,7 +178,12 @@ namespace DotNetCTFDumper.MMFParser.EXE.Loaders.Banks
_bitmap = null;
Reader.Seek(Position);
ByteReader imageReader;
if (Settings.twofiveplus)
{
//Do 2.5+ decryption
}
// imageReader = Debug ? Reader : Decompressor.DecompressAsReader(Reader, out var a);
imageReader = Debug ? Reader : Decompressor.DecompressAsReader(Reader, out var a);
long start = imageReader.Tell();

@ -22,7 +22,7 @@ namespace DotNetCTFDumper.MMFParser.EXE.Loaders
var endpos = start + Chunk.Size;
while(true)
{
if (Reader.Tell() >= endpos+4) break;
if (Reader.Tell() >= endpos) break;
var name = Reader.ReadWideString();
}

@ -31,7 +31,6 @@ namespace DotNetCTFDumper.MMFParser.Translation
Pame2Mfa.Message("Writing is finished!");
return template;
Logger.Log("MFA Done", true, ConsoleColor.Yellow);
}
public static void ReadTestMFA()

@ -21,9 +21,8 @@ namespace DotNetCTFDumper
[STAThread]
private static void Main(string[] args)
{
var handle = Helper.GetConsoleWindow();
Helper.ShowWindow(handle, Helper.SW_HIDE);
InitNativeLibrary();
// MFAGenerator.ReadTestMFA();
// Environment.Exit(0);
@ -36,27 +35,22 @@ namespace DotNetCTFDumper
var error = new ErrorLogBox(eventArgs.Exception);
Application.Run(error);
};
if (args.Length == 0)
Settings.UseGUI = true;
if (args.Length > 0)
{
Settings.UseGUI = true;
MyForm = new MainForm();
Application.Run(MyForm);
MyForm = new MainForm(Color.FromName(args[0]));
}
else
{
MyForm = new MainForm(Color.FromArgb(223, 114, 38));
}
Application.Run(MyForm);
if (args.Length > 0) path = args[0];
if (args.Length > 1) bool.TryParse(args[1], out verbose);
if (args.Length > 2) bool.TryParse(args[2], out dumpImages);
if (args.Length > 3) bool.TryParse(args[3], out dumpSounds);
if (args.Length > 0 && (args[0] == "-h" || args[0] == "-help"))
{
@ -74,13 +68,13 @@ namespace DotNetCTFDumper
Environment.Exit(0);
}
if (args.Length > 0) ReadFile(path, verbose, dumpImages, dumpSounds);
if (args.Length > 1) ReadFile(path, verbose, dumpImages, dumpSounds);
}
public static void ReadFile(string path, bool verbose = false, bool dumpImages = false, bool dumpSounds = true)
{
Settings.GamePath = path;
Logger.Log("DecryptionLibExist: "+File.Exists("x64\\Decrypter-x64.dll"));
PrepareFolders();
Settings.DumpImages = dumpImages;
@ -95,25 +89,7 @@ namespace DotNetCTFDumper
currentExe.ParseExe(exeReader);
stopWatch.Stop();
Logger.Log("Finished in "+stopWatch.Elapsed.ToString("g"), true, ConsoleColor.Yellow);
return;
if (File.Exists(path))
{
if (path.EndsWith(".exe"))
{
Settings.DoMFA = false;
}
else
{
Logger.Log($"File '{path}' is not a valid file", true, ConsoleColor.Red);
}
}
else
{
Logger.Log($"File '{path}' does not exist", true, ConsoleColor.Red);
}
}
public static void PrepareFolders()

@ -10,6 +10,7 @@ namespace DotNetCTFDumper
public static bool SaveChunks;
public static bool Verbose;
public static bool Old;
public static bool twofiveplus;
public static string GamePath;
public static string GameName => Path.GetFileNameWithoutExtension(GamePath);
@ -31,6 +32,6 @@ namespace DotNetCTFDumper
public static bool DoMFA;
public static bool UseGUI;
public static string DumperVersion = "CTFAK 0.2-a Alpha";
public static string DumperVersion = true ? "CTFAK 0.2-b Alpha" : "CTFAK 0.2.1-a Debug";
}
}

@ -47,7 +47,6 @@ namespace DotNetCTFDumper.Utils
MemoryStream decompressedStream = new MemoryStream(data);
MemoryStream compressedStream = new MemoryStream();
byte[] compressedData = null;
Int32 compressed_size = 0;
ZLibStream zs = new ZLibStream(compressedStream, compOpts);
decompressedStream.CopyTo(zs);
zs.Close();

@ -84,17 +84,17 @@ namespace DotNetCTFDumper.Utils
return decodedChunk;
}
[DllImport("Decrypter-x64.dll", EntryPoint = "decode_chunk", CharSet = CharSet.Auto)]
private const string _dllPath = "Decrypter-x64.dll";
[DllImport(_dllPath, EntryPoint = "decode_chunk", CharSet = CharSet.Auto)]
public static extern IntPtr decode_chunk(IntPtr chunkData, int chunkSize, byte magicChar, IntPtr wrapperKey);
[DllImport("Decrypter-x64.dll", EntryPoint = "make_key", CharSet = CharSet.Auto)]
[DllImport(_dllPath, EntryPoint = "make_key", CharSet = CharSet.Auto)]
public static extern IntPtr make_key(IntPtr cTitle, IntPtr cCopyright, IntPtr cProject, byte magicChar);
[DllImport("Decrypter-x64.dll", EntryPoint = "make_key_combined", CharSet = CharSet.Auto)]
[DllImport(_dllPath, EntryPoint = "make_key_combined", CharSet = CharSet.Auto)]
public static extern IntPtr make_key_combined(IntPtr data, byte magicChar);
[DllImport("Decrypter-x64.dll", EntryPoint = "make_key_w_combined", CharSet = CharSet.Auto)]
[DllImport(_dllPath, EntryPoint = "make_key_w_combined", CharSet = CharSet.Auto)]
public static extern IntPtr make_key_w_combined(IntPtr data, byte magicChar);
}
}

@ -232,15 +232,7 @@ namespace DotNetCTFDumper.Utils
return chosenValue;
}
public static string ActualName(this ChunkList.Chunk chunk)
{
return "Placeholder";
var constName = ((Constants.ChunkNames) chunk.Id).ToString();
int tempId = 0;
int.TryParse(constName, out tempId);
if (tempId != chunk.Id) return constName;
else return $"Unknown-{chunk.Id}";
}
public static ChunkNode GetChunkNode(ChunkList.Chunk chunk, string customName = "[DEFAULT-NAME]")
{

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save