diff --git a/BRAM_Manager/About.Designer.cs b/BRAM_Manager/About.Designer.cs
new file mode 100644
index 0000000..fe0a099
--- /dev/null
+++ b/BRAM_Manager/About.Designer.cs
@@ -0,0 +1,119 @@
+namespace BRAM_Manager
+{
+ partial class About
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(About));
+ this.label1 = new System.Windows.Forms.Label();
+ this.linkLabel1 = new System.Windows.Forms.LinkLabel();
+ this.VersionNumLabel = new System.Windows.Forms.Label();
+ this.pictureBoxWithInterpolation1 = new BRAM_Manager.PictureBoxWithInterpolation();
+ this.linkLabel2 = new System.Windows.Forms.LinkLabel();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxWithInterpolation1)).BeginInit();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(12, 9);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(296, 26);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "PC Engine BRAM Manager is free and open source software.\r\nCreated by wid";
+ //
+ // linkLabel1
+ //
+ this.linkLabel1.AutoSize = true;
+ this.linkLabel1.Location = new System.Drawing.Point(12, 65);
+ this.linkLabel1.Name = "linkLabel1";
+ this.linkLabel1.Size = new System.Drawing.Size(40, 13);
+ this.linkLabel1.TabIndex = 1;
+ this.linkLabel1.TabStop = true;
+ this.linkLabel1.Text = "GitHub";
+ this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
+ //
+ // VersionNumLabel
+ //
+ this.VersionNumLabel.AutoSize = true;
+ this.VersionNumLabel.Location = new System.Drawing.Point(12, 52);
+ this.VersionNumLabel.Name = "VersionNumLabel";
+ this.VersionNumLabel.Size = new System.Drawing.Size(54, 13);
+ this.VersionNumLabel.TabIndex = 3;
+ this.VersionNumLabel.Text = "Version: v";
+ //
+ // pictureBoxWithInterpolation1
+ //
+ this.pictureBoxWithInterpolation1.Image = global::BRAM_Manager.Properties.Resources.icon;
+ this.pictureBoxWithInterpolation1.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
+ this.pictureBoxWithInterpolation1.Location = new System.Drawing.Point(337, 9);
+ this.pictureBoxWithInterpolation1.Name = "pictureBoxWithInterpolation1";
+ this.pictureBoxWithInterpolation1.Size = new System.Drawing.Size(69, 69);
+ this.pictureBoxWithInterpolation1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
+ this.pictureBoxWithInterpolation1.TabIndex = 4;
+ this.pictureBoxWithInterpolation1.TabStop = false;
+ //
+ // linkLabel2
+ //
+ this.linkLabel2.AutoSize = true;
+ this.linkLabel2.Location = new System.Drawing.Point(58, 65);
+ this.linkLabel2.Name = "linkLabel2";
+ this.linkLabel2.Size = new System.Drawing.Size(29, 13);
+ this.linkLabel2.TabIndex = 5;
+ this.linkLabel2.TabStop = true;
+ this.linkLabel2.Text = "Help";
+ this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked);
+ //
+ // About
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(418, 87);
+ this.Controls.Add(this.linkLabel2);
+ this.Controls.Add(this.pictureBoxWithInterpolation1);
+ this.Controls.Add(this.VersionNumLabel);
+ this.Controls.Add(this.linkLabel1);
+ this.Controls.Add(this.label1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "About";
+ this.ShowInTaskbar = false;
+ this.Text = "About";
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxWithInterpolation1)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.LinkLabel linkLabel1;
+ private System.Windows.Forms.Label VersionNumLabel;
+ private PictureBoxWithInterpolation pictureBoxWithInterpolation1;
+ private System.Windows.Forms.LinkLabel linkLabel2;
+ }
+}
\ No newline at end of file
diff --git a/BRAM_Manager/About.cs b/BRAM_Manager/About.cs
new file mode 100644
index 0000000..fe37203
--- /dev/null
+++ b/BRAM_Manager/About.cs
@@ -0,0 +1,33 @@
+using System.Drawing.Drawing2D;
+using System.Reflection;
+using System.Windows.Forms;
+
+namespace BRAM_Manager
+{
+ public partial class About : Form
+ {
+ public About() {
+ InitializeComponent();
+
+ VersionNumLabel.Text += Assembly.GetExecutingAssembly().GetName().Version.ToString();
+ }
+
+ private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
+ System.Diagnostics.Process.Start("https://github.com/Widdiful/PCE_BRAM_Manager");
+ }
+
+ private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
+ System.Diagnostics.Process.Start("https://github.com/Widdiful/PCE_BRAM_Manager/wiki");
+ }
+ }
+
+ public class PictureBoxWithInterpolation : PictureBox
+ {
+ public InterpolationMode InterpolationMode { get; set; }
+
+ protected override void OnPaint(PaintEventArgs pe) {
+ pe.Graphics.InterpolationMode = InterpolationMode;
+ base.OnPaint(pe);
+ }
+ }
+}
diff --git a/BRAM_Manager/About.resx b/BRAM_Manager/About.resx
new file mode 100644
index 0000000..0c99b45
--- /dev/null
+++ b/BRAM_Manager/About.resx
@@ -0,0 +1,163 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+
+ AAABAAEAFxcAAAEAIADICAAAFgAAACgAAAAXAAAALgAAAAEAIAAAAAAARAgAABMLAAATCwAAAAAAAAAA
+ AAAeISMAHiEj/x4hI/8eISP/HiEj/x4hI/8eISP/HiEj/x4hI/8eISP/HiEj/x4hI/8eISP/HiEj/x4h
+ I/8eISP/HiEj/x4hI/8eISP/HiEj/x4hI/8eISP/HiEjAB4hI/9oZ2n/aGdp/2hnaf9oZ2n/aGdp/2hn
+ af9oZ2n/aGdp/2hnaf9oZ2n/aGdp/2hnaf9oZ2n/aGdp/2hnaf9oZ2n/aGdp/2hnaf9oZ2n/aGdp/2hn
+ af8eISP/HiEj/7Gwsv+xsLL/S2wE/1uZAP9LbAT/sbCy/7Gwsv+xsLL/R0VF/0dFRf9HRUX/R0VF/0dF
+ Rf+xsLL/sbCy/7Gwsv8eISP/HiEj/x4hI/+xsLL/sbCy/x4hI/8eISP/sbCy/7Gwsv9LbAT/W5kA/0ts
+ BP+xsLL/aGdp/x4hI/8eISP/HiEj/x4hI/8eISP/HiEj/x4hI/9oZ2n/sbCy/x4hI/8eISP/HiEj/7Gw
+ sv+xsLL/HiEj/x4hI/9HRUX/sbCy/7Gwsv+xsLL/sbCy/2hnaf8eISP/aGdp/2hnaf+3tbX/t7W1/7e1
+ tf///////////x4hI/9oZ2n/sbCy/7Gwsv+xsLL/sbCy/0dFRf8eISP/HiEj/2hnaf9HRUX/R0VF/0dF
+ Rf9HRUX/R0VF/x4hI////////////7e1tf+3tbX/t7W1////////////HiEj/0dFRf9HRUX/R0VF/0dF
+ Rf9HRUX/aGdp/x4hI/8eISP/sbCy/2hnaf///////////7e1tf//////HiEj////////////////////
+ //////////////////8eISP//////7e1tf///////////2hnaf+xsLL/HiEj/x4hI/+xsLL/aGdp/7e1
+ tf+3tbX/t7W1//////8eISP//////7e1tf//////t7W1//////+3tbX//////x4hI///////t7W1/7e1
+ tf+3tbX/aGdp/7Gwsv8eISP/HiEj/7Gwsv9oZ2n/t7W1/7e1tf+3tbX//////x4hI///////t7W1////
+ //+3tbX//////7e1tf//////HiEj//////+3tbX/t7W1/7e1tf9oZ2n/sbCy/x4hI/8eISP/sbCy/2hn
+ af+3tbX/t7W1/7e1tf//////HiEj//////+3tbX//////7e1tf//////t7W1//////8eISP//////7e1
+ tf+3tbX/t7W1/2hnaf+xsLL/HiEj/x4hI/+xsLL/aGdp////////////t7W1//////8eISP//////7e1
+ tf//////t7W1//////+3tbX//////x4hI///////t7W1////////////aGdp/7Gwsv8eISP/HiEj/7Gw
+ sv9oZ2n///////////+3tbX//////7Gwsv8eISP/HiEj/x4hI/8eISP/HiEj/x4hI/8eISP/sbCy////
+ //+3tbX///////////9oZ2n/sbCy/x4hI/8eISP/sbCy/2hnaf///////////7e1tf//////////////
+ /////////////wAAkP///////////////////////////7e1tf///////////2hnaf+xsLL/HiEj/x4h
+ I/+xsLL/aGdp////////////t7W1//////////////////////8AAJD/AACQ/wAAkP8AAJD/////////
+ ////////t7W1////////////aGdp/7Gwsv8eISP/HiEj/7Gwsv9oZ2n///////////+3tbX/////////
+ ////////AACQ/wAAkP//////AACQ/wAAkP////////////////+3tbX///////////9oZ2n/sbCy/x4h
+ I/8eISP/sbCy/2hnaf///////////7e1tf///////////wAAkP//////AACQ//////8AAJD/AACQ/wAA
+ kP///////////7e1tf///////////2hnaf+xsLL/HiEj/x4hI/+xsLL/aGdp////////////t7W1////
+ /////////////wAAkP8AAJD/AACQ/wAAkP//////////////////////t7W1////////////aGdp/7Gw
+ sv8eISP/HiEj/7Gwsv9oZ2n/////////////////t7W1/////////////////wAAkP//////AACQ/wAA
+ kP///////////7e1tf////////////////9oZ2n/sbCy/x4hI/8eISP/sbCy/2hnaf//////////////
+ ////////t7W1//////////////////////////////////////+3tbX//////////////////////2hn
+ af+xsLL/HiEj/x4hI/+xsLL/aGdp////////////////////////////t7W1/7e1tf//////////////
+ //+3tbX/t7W1////////////////////////////aGdp/7Gwsv8eISP/HiEj/2hnaf+xsLL/aGdp////
+ /////////////////////////////7e1tf+3tbX/t7W1/////////////////////////////////2hn
+ af+xsLL/aGdp/x4hI/////8AHiEj/2hnaf+xsLL/aGdp/2hnaf9oZ2n/aGdp/2hnaf9oZ2n/aGdp/2hn
+ af9oZ2n/aGdp/2hnaf9oZ2n/aGdp/2hnaf9oZ2n/sbCy/2hnaf8eISP/HiEjAP///wD///8AHiEj/x4h
+ I/8eISP/HiEj/x4hI/8eISP/HiEj/x4hI/8eISP/HiEj/x4hI/8eISP/HiEj/x4hI/8eISP/HiEj/x4h
+ I/8eISP/HiEj/x4hIwD///8AgAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAACAMAABgA=
+
+
+
\ No newline at end of file
diff --git a/BRAM_Manager/App.config b/BRAM_Manager/App.config
index e3382e1..cba43f0 100644
--- a/BRAM_Manager/App.config
+++ b/BRAM_Manager/App.config
@@ -1,18 +1,21 @@
-
+
-
-
+
+
-
+
c:\\
+
+ False
+
-
\ No newline at end of file
+
diff --git a/BRAM_Manager/BRAM Merge.Designer.cs b/BRAM_Manager/BRAM Merge.Designer.cs
index 6df4e88..9c353c0 100644
--- a/BRAM_Manager/BRAM Merge.Designer.cs
+++ b/BRAM_Manager/BRAM Merge.Designer.cs
@@ -23,66 +23,77 @@ partial class BRAM_Merge {
/// the contents of this method with the code editor.
///
private void InitializeComponent() {
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BRAM_Merge));
- this.MergeList = new System.Windows.Forms.ListBox();
- this.MergeFreeSpace = new System.Windows.Forms.Label();
- this.MergeButton = new System.Windows.Forms.Button();
- this.MergeAddress = new System.Windows.Forms.TextBox();
- this.SuspendLayout();
- //
- // MergeList
- //
- this.MergeList.FormattingEnabled = true;
- this.MergeList.Location = new System.Drawing.Point(12, 12);
- this.MergeList.Name = "MergeList";
- this.MergeList.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
- this.MergeList.Size = new System.Drawing.Size(182, 199);
- this.MergeList.TabIndex = 0;
- this.MergeList.SelectedIndexChanged += new System.EventHandler(this.MergeList_SelectedIndexChanged);
- //
- // MergeFreeSpace
- //
- this.MergeFreeSpace.AutoSize = true;
- this.MergeFreeSpace.Location = new System.Drawing.Point(12, 246);
- this.MergeFreeSpace.Name = "MergeFreeSpace";
- this.MergeFreeSpace.Size = new System.Drawing.Size(37, 13);
- this.MergeFreeSpace.TabIndex = 14;
- this.MergeFreeSpace.Text = " ";
- //
- // MergeButton
- //
- this.MergeButton.Location = new System.Drawing.Point(119, 241);
- this.MergeButton.Name = "MergeButton";
- this.MergeButton.Size = new System.Drawing.Size(75, 23);
- this.MergeButton.TabIndex = 15;
- this.MergeButton.Text = "Merge";
- this.MergeButton.UseVisualStyleBackColor = true;
- this.MergeButton.Click += new System.EventHandler(this.MergeButton_Click);
- //
- // MergeAddress
- //
- this.MergeAddress.Location = new System.Drawing.Point(12, 217);
- this.MergeAddress.Name = "MergeAddress";
- this.MergeAddress.ReadOnly = true;
- this.MergeAddress.Size = new System.Drawing.Size(182, 20);
- this.MergeAddress.TabIndex = 16;
- //
- // BRAM_Merge
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(206, 268);
- this.Controls.Add(this.MergeAddress);
- this.Controls.Add(this.MergeButton);
- this.Controls.Add(this.MergeFreeSpace);
- this.Controls.Add(this.MergeList);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
- this.MaximizeBox = false;
- this.Name = "BRAM_Merge";
- this.Text = "Merge";
- this.ResumeLayout(false);
- this.PerformLayout();
+ this.components = new System.ComponentModel.Container();
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BRAM_Merge));
+ this.MergeList = new System.Windows.Forms.ListBox();
+ this.MergeFreeSpace = new System.Windows.Forms.Label();
+ this.MergeButton = new System.Windows.Forms.Button();
+ this.MergeAddress = new System.Windows.Forms.TextBox();
+ this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
+ this.SuspendLayout();
+ //
+ // MergeList
+ //
+ this.MergeList.Dock = System.Windows.Forms.DockStyle.Top;
+ this.MergeList.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.MergeList.FormattingEnabled = true;
+ this.MergeList.ItemHeight = 15;
+ this.MergeList.Location = new System.Drawing.Point(0, 0);
+ this.MergeList.Name = "MergeList";
+ this.MergeList.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
+ this.MergeList.Size = new System.Drawing.Size(206, 199);
+ this.MergeList.TabIndex = 0;
+ this.MergeList.SelectedIndexChanged += new System.EventHandler(this.MergeList_SelectedIndexChanged);
+ this.MergeList.MouseLeave += new System.EventHandler(this.MergeList_MouseLeave);
+ this.MergeList.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MergeList_MouseMove);
+ //
+ // MergeFreeSpace
+ //
+ this.MergeFreeSpace.AutoSize = true;
+ this.MergeFreeSpace.Location = new System.Drawing.Point(12, 246);
+ this.MergeFreeSpace.Name = "MergeFreeSpace";
+ this.MergeFreeSpace.Size = new System.Drawing.Size(37, 13);
+ this.MergeFreeSpace.TabIndex = 14;
+ this.MergeFreeSpace.Text = " ";
+ //
+ // MergeButton
+ //
+ this.MergeButton.Location = new System.Drawing.Point(119, 241);
+ this.MergeButton.Name = "MergeButton";
+ this.MergeButton.Size = new System.Drawing.Size(75, 23);
+ this.MergeButton.TabIndex = 15;
+ this.MergeButton.Text = "Merge";
+ this.toolTip1.SetToolTip(this.MergeButton, "Merge the data and save the file");
+ this.MergeButton.UseVisualStyleBackColor = true;
+ this.MergeButton.Click += new System.EventHandler(this.MergeButton_Click);
+ //
+ // MergeAddress
+ //
+ this.MergeAddress.Location = new System.Drawing.Point(12, 217);
+ this.MergeAddress.Name = "MergeAddress";
+ this.MergeAddress.ReadOnly = true;
+ this.MergeAddress.Size = new System.Drawing.Size(182, 20);
+ this.MergeAddress.TabIndex = 16;
+ //
+ // BRAM_Merge
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(206, 268);
+ this.Controls.Add(this.MergeAddress);
+ this.Controls.Add(this.MergeButton);
+ this.Controls.Add(this.MergeFreeSpace);
+ this.Controls.Add(this.MergeList);
+ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+ this.MaximizeBox = false;
+ this.MaximumSize = new System.Drawing.Size(999, 307);
+ this.MinimizeBox = false;
+ this.MinimumSize = new System.Drawing.Size(222, 307);
+ this.Name = "BRAM_Merge";
+ this.ShowInTaskbar = false;
+ this.Text = "Merge";
+ this.ResumeLayout(false);
+ this.PerformLayout();
}
@@ -92,5 +103,6 @@ partial class BRAM_Merge {
private System.Windows.Forms.Label MergeFreeSpace;
private System.Windows.Forms.Button MergeButton;
private System.Windows.Forms.TextBox MergeAddress;
- }
+ private System.Windows.Forms.ToolTip toolTip1;
+ }
}
\ No newline at end of file
diff --git a/BRAM_Manager/BRAM Merge.cs b/BRAM_Manager/BRAM Merge.cs
index 0bd0c73..ffc059a 100644
--- a/BRAM_Manager/BRAM Merge.cs
+++ b/BRAM_Manager/BRAM Merge.cs
@@ -1,93 +1,124 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
+using System.IO;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace BRAM_Manager {
- public partial class BRAM_Merge : Form {
- MainForm mainForm;
- MainForm.BRAM mergeBRAM;
- List SavesToMerge = new List();
- int freeSpace = 0;
-
- public BRAM_Merge() {
- InitializeComponent();
- }
-
- public void InitialiseForm(MainForm main, string[] paths) {
- mainForm = main;
-
- // initialise new BRAM
- mergeBRAM = new MainForm.BRAM();
- byte[] newFileBytes = new byte[] { 0x48, 0x55, 0x42, 0x4D, 0x00, 0x88, 0x10, 0x80 };
- byte[] newFile = new byte[2048];
- byte[] newHeader = new byte[16];
-
- main.WriteBytes(newFileBytes, newFile, 0, 8);
- mergeBRAM.data = newFile;
- main.WriteBytes(newFileBytes, newHeader, 0, 8);
- mergeBRAM.header = newHeader;
- mergeBRAM.nextSlot = 16;
- mergeBRAM.freeSpace = freeSpace = 2032;
- mergeBRAM.saves = new List();
-
- // Find all save data and add it to a list
- MergeAddress.Text = "";
- MergeList.Items.Clear();
- foreach (string path in paths) {
- MainForm.BRAM newBRAM = main.ReadFile(path);
- if (newBRAM.loaded) {
- foreach (MainForm.BRAMEntry save in newBRAM.saves) {
- SavesToMerge.Add(save);
- MergeList.Items.Add(String.Format("{0} ({1}B)", save.name, save.length));
- }
- MergeAddress.Text += String.Format("\"{0}\" ", path);
- }
- }
-
- MergeFreeSpace.Text = String.Format("Free: {0}B", mergeBRAM.freeSpace);
- }
-
- private void MergeList_SelectedIndexChanged(object sender, EventArgs e) {
- // Calculate how much free space would be left after adding all selected files
- freeSpace = mergeBRAM.freeSpace;
-
- foreach (int item in MergeList.SelectedIndices) {
- freeSpace -= SavesToMerge[item].length;
- }
-
- MergeFreeSpace.Text = String.Format("Free: {0}B", freeSpace);
- }
-
- private void MergeButton_Click(object sender, EventArgs e) {
- if (freeSpace < 0) {
- MessageBox.Show("Not enough space! Please select fewer saves.");
- return;
- }
- if (freeSpace >= mergeBRAM.freeSpace) {
- MessageBox.Show("No items selected.");
- return;
- }
-
- string path = mainForm.SaveFileBrowser();
- if (path == "") {
- return;
- }
-
- // Add saved files to BRAM and save it
- foreach (int item in MergeList.SelectedIndices) {
- mergeBRAM.saves.Add(SavesToMerge[item]);
- }
-
- mainForm.SaveFile(ref mergeBRAM, path);
- mainForm.QuickOpen(path);
-
- Close();
- }
- }
+ public partial class BRAM_Merge : Form {
+ MainForm mainForm;
+ BRAM mergeBRAM;
+ List SavesToMerge = new List();
+ int freeSpace = 0;
+ int hoveredIndex = -1;
+
+ public BRAM_Merge() {
+ InitializeComponent();
+ }
+
+ public void InitialiseForm(MainForm main, string[] paths) {
+ mainForm = main;
+
+ // initialise new BRAM
+ mergeBRAM = new BRAM();
+
+ // Find all save data and add it to a list
+ MergeAddress.Text = "";
+ MergeList.Items.Clear();
+ foreach (string path in paths) {
+ // Provide useful file name
+ string fileName = Path.GetFileName(path);
+ if (fileName == "bram_exp.brm") {
+ fileName = Path.GetFileName(Path.GetDirectoryName(path));
+ }
+
+ // Read data from path
+ BRAM newBRAM = DataFuncLib.ReadFile(path);
+ if (newBRAM.loaded) {
+ foreach (BRAMEntry save in newBRAM.saves) {
+ SavesToMerge.Add(save);
+
+ // Adding a tab to make it look nice, \t is too big
+ string tab = String.Concat(Enumerable.Repeat(" ", IntNumOfDigits(ByteFuncLib.maxBRAMSize) - IntNumOfDigits(save.length)));
+
+ MergeList.Items.Add(String.Format("{0} ({1}B) {2}- {3}", save.name, save.length, tab, fileName));
+ }
+ MergeAddress.Text += String.Format("\"{0}\" ", path);
+ }
+ }
+
+ MergeFreeSpace.Text = String.Format("Free: {0}B", mergeBRAM.freeSpace);
+ }
+
+ public void InitialiseForm(MainForm main, IEnumerable paths) {
+ // Find BRAM files in folders
+ List files = new List();
+ foreach (string path in paths) {
+ foreach (string file in Directory.EnumerateFiles(path, "*.*")) {
+ if (DataFuncLib.IsValidBRAMFile(file)) {
+ files.Add(file);
+ }
+ }
+ }
+
+ // Regular initialisation
+ InitialiseForm(main, files.ToArray());
+ }
+
+ public int IntNumOfDigits(int inInt) {
+ return (int)Math.Floor(Math.Log10(inInt) + 1);
+ }
+
+ private void MergeList_SelectedIndexChanged(object sender, EventArgs e) {
+ // Calculate how much free space would be left after adding all selected files
+ freeSpace = mergeBRAM.freeSpace;
+
+ foreach (int item in MergeList.SelectedIndices) {
+ freeSpace -= SavesToMerge[item].length;
+ }
+
+ MergeFreeSpace.Text = String.Format("Free: {0}B", freeSpace);
+ }
+
+ private void MergeButton_Click(object sender, EventArgs e) {
+ if (freeSpace < 0) {
+ MessageBox.Show("Not enough space! Please select fewer saves.");
+ return;
+ }
+ if (freeSpace >= mergeBRAM.freeSpace) {
+ MessageBox.Show("No items selected.");
+ return;
+ }
+
+ string path = GuiFuncLib.SaveFileBrowser();
+ if (path == "") {
+ return;
+ }
+
+ // Add saved files to BRAM and save it
+ foreach (int item in MergeList.SelectedIndices) {
+ mergeBRAM.saves.Add(SavesToMerge[item]);
+ }
+
+ DataFuncLib.SaveFile(ref mergeBRAM, path);
+ mainForm.QuickOpen(path);
+
+ Close();
+ }
+
+ // Show the full name of the hovered item
+ private void MergeList_MouseMove(object sender, MouseEventArgs e) {
+ int newHoverIndex = MergeList.IndexFromPoint(e.Location);
+ if (newHoverIndex != hoveredIndex) {
+ hoveredIndex = newHoverIndex;
+ if (hoveredIndex >= 0) {
+ toolTip1.SetToolTip(MergeList, MergeList.Items[hoveredIndex].ToString());
+ }
+ }
+ }
+
+ private void MergeList_MouseLeave(object sender, EventArgs e) {
+ hoveredIndex = -1;
+ }
+ }
}
diff --git a/BRAM_Manager/BRAM Merge.resx b/BRAM_Manager/BRAM Merge.resx
index 0c99b45..efb3d85 100644
--- a/BRAM_Manager/BRAM Merge.resx
+++ b/BRAM_Manager/BRAM Merge.resx
@@ -117,6 +117,9 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 17, 17
+
diff --git a/BRAM_Manager/BRAM_Manager.csproj b/BRAM_Manager/BRAM_Manager.csproj
index 1dc86e3..1a145ab 100644
--- a/BRAM_Manager/BRAM_Manager.csproj
+++ b/BRAM_Manager/BRAM_Manager.csproj
@@ -7,11 +7,12 @@
{54421FA0-0A27-424E-B119-6D62786C6CDF}
WinExe
BRAM_Manager
- BRAM_Manager
- v4.6.1
+ PCE_BRAM_Manager
+ v4.7.1
512
true
true
+
AnyCPU
@@ -22,7 +23,7 @@
DEBUG;TRACE
prompt
4
- 7.3
+ preview
AnyCPU
@@ -32,14 +33,24 @@
TRACE
prompt
4
- 7.3
+ preview
icon.ico
+
+
+ ..\packages\Microsoft-WindowsAPICodePack-Core.1.1.5\lib\net462\Microsoft.WindowsAPICodePack.dll
+
+
+ ..\packages\Microsoft-WindowsAPICodePack-Shell.1.1.5\lib\net462\Microsoft.WindowsAPICodePack.Shell.dll
+
+
+
+
@@ -49,14 +60,25 @@
+
+
+
+ Form
+
+
+ About.cs
+
Form
BRAM Merge.cs
+
+
+
Form
@@ -65,6 +87,15 @@
+
+ Form
+
+
+ TransferTool.cs
+
+
+ About.cs
+
BRAM Merge.cs
@@ -79,7 +110,12 @@
True
Resources.resx
+ True
+
+ TransferTool.cs
+
+
SettingsSingleFileGenerator
Settings.Designer.cs
@@ -95,6 +131,8 @@
+
+
\ No newline at end of file
diff --git a/BRAM_Manager/ByteFuncLib.cs b/BRAM_Manager/ByteFuncLib.cs
new file mode 100644
index 0000000..04423c0
--- /dev/null
+++ b/BRAM_Manager/ByteFuncLib.cs
@@ -0,0 +1,125 @@
+using System;
+using System.Linq;
+
+// This library contains functions related to byte operations, as well as PCE-specifc binary data
+internal class ByteFuncLib
+{
+ public static int maxBRAMSize = 2048;
+ public static int memoryOffset = 32768;
+ public static int headerSize = 16;
+ public static int entryHeaderSize = 16;
+ public static byte[] newFileBytes = { 0x48, 0x55, 0x42, 0x4D, 0x00, 0x88, 0x10, 0x80 };
+
+ // Slightly inaccurate character map, inaccuracies are to ensure no duplicates for accurate encoding
+ public static char[] characterMap = new char[] {
+ ' ', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█', '♤', '♡', '◇', '♧', '○', '●', '/',
+ '\\', '円', '年', '月', '日', '時', '分', '秒', '◢', '◣', '◥', '◤', '→', '←', '↑', '↓',
+ ' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
+ '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
+ 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '¥', ']', '^', '_',
+ ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+ 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '¦', '}', '~', '☓',
+ ' ', '。', '「', '」', '、', '・', 'を', 'ぁ', '╭', '─', '╮', '│', '|', '╰', '━', '╯',
+ 'ー', 'あ', 'い', 'う', 'え', 'お', 'か', 'き', 'く', 'け', 'こ', 'さ', 'し', 'す', 'せ', 'そ',
+ ' ', '。', '「', '」', '、', '・', 'ヲ', 'ァ', '┬', '|', '┴', 'ォ', 'ャ', 'ュ', 'ョ', 'ッ',
+ '-', 'ア', 'イ', 'ウ', 'エ', 'オ', 'カ', 'キ', 'ク', 'ケ', 'コ', 'サ', 'シ', 'ス', 'セ', 'ソ',
+ 'タ', 'チ', 'ツ', 'テ', 'ト', 'ナ', 'ニ', 'ヌ', 'ネ', 'ノ', 'ハ', 'ヒ', 'フ', 'ヘ', 'ホ', 'マ',
+ 'ミ', 'ム', 'メ', 'モ', 'ヤ', 'ユ', 'ヨ', 'ラ', 'リ', 'ル', 'レ', 'ロ', 'ワ', 'ン', '゛', '゜',
+ 'た', 'ち', 'つ', 'て', 'と', 'な', 'に', 'ぬ', 'ね', 'の', 'は', 'ひ', 'ふ', 'へ', 'ほ', 'ま',
+ 'み', 'む', 'め', 'も', 'や', 'ゆ', 'よ', 'ら', 'り', 'る', 'れ', 'ろ', 'わ', 'ん', '゙', '©'};
+
+ // Binary data handling ----------------------------
+
+ // Returns bytes from a byte array, given a range
+ public static byte[] ReadBytes(byte[] data, int from, int to)
+ {
+ byte[] result = new byte[to - from];
+
+ int index = 0;
+ for (int i = from; i < to; i++)
+ {
+ result[index] = data[i];
+ index++;
+ }
+
+ return result;
+ }
+
+ // Converts bytes into a human-readable form following the PC Engine character map
+ public static string DecodeBytes(byte[] data)
+ {
+ string result = string.Empty;
+
+ foreach (byte Byte in data)
+ {
+ if (characterMap.Length > Byte)
+ {
+ result += characterMap[Byte];
+ }
+ }
+
+ return result;
+ }
+
+ // Converts a string into valid bytes following the PC Engine character map
+ public static byte[] EncodeString(string data)
+ {
+ byte[] result = new byte[data.Length];
+
+ for (int i = 0; i < data.Length; i++)
+ {
+ char Char = data[i];
+ if (characterMap.Contains(Char))
+ {
+ result[i] = Convert.ToByte(Array.IndexOf(characterMap, Char));
+ }
+ }
+
+ return result;
+ }
+
+ // Writes bytes to a byte array, given a starting location and a length
+ public static void WriteBytes(byte[] input, byte[] dest, int startLoc, int length)
+ {
+ int index = 0;
+ for (int i = startLoc; i < startLoc + length; i++)
+ {
+ if (dest.Length > i && input.Length > index)
+ {
+ dest[i] = input[index];
+ index++;
+ }
+ }
+ }
+
+ // Calculates the checksum for a given BRAM entry
+ public static byte[] CalculateChecksum(byte[] data, int length)
+ {
+ byte[] result = new byte[2];
+ int calculationStartsAt = 4;
+ int dataSize = length - calculationStartsAt;
+ byte[] newData = new byte[dataSize];
+
+ // get data bytes minus first four bytes
+ int index = 0;
+ for (int i = calculationStartsAt; i < length; i++)
+ {
+ newData[index] = data[i];
+ index++;
+ }
+
+ // checksum is the sum of all bytes
+ int sum = 0;
+ foreach (byte Byte in newData)
+ {
+ sum += Byte;
+ }
+
+ // stored checksum is the negation of the checksum
+ int checksum = sum * -1;
+ result = BitConverter.GetBytes(checksum);
+
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/BRAM_Manager/DataFuncLib.cs b/BRAM_Manager/DataFuncLib.cs
new file mode 100644
index 0000000..52689da
--- /dev/null
+++ b/BRAM_Manager/DataFuncLib.cs
@@ -0,0 +1,194 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Windows.Forms;
+
+using BRAM_Manager;
+using static System.Net.WebRequestMethods;
+
+// This library contains functions related to data handling on the PC-side
+internal class DataFuncLib
+{
+ public static int nextSlotStartByte = 6;
+ public static int nextSlotLength = 2;
+
+ // Reads a file and converts it to a BRAM data entry
+ public static BRAM ReadFile(string file) {
+ BRAM result = new BRAM();
+ result.saves = new List();
+
+ // Allow loading from folder
+ if (Directory.Exists(file)){
+ foreach(string path in Directory.EnumerateFiles(file)) {
+ if (IsValidBRAMFile(path)) {
+ file = path;
+ break;
+ }
+ }
+ }
+
+ string dataString;
+
+ try {
+ dataString = System.IO.File.ReadAllText(file);
+ }
+ catch (IOException) {
+ MessageBox.Show("File is in use.");
+ return result;
+ }
+
+ byte[] data = System.IO.File.ReadAllBytes(file);
+ if (dataString.StartsWith("HUBM")) {
+ result.data = data;
+ result.header = ByteFuncLib.ReadBytes(data, 0, ByteFuncLib.headerSize);
+
+ // bytes 7 and 8 are pointers to the next available memory slot
+ byte[] nextSlotBytes = ByteFuncLib.ReadBytes(data, nextSlotStartByte, nextSlotStartByte + nextSlotLength);
+ result.nextSlot = BitConverter.ToUInt16(nextSlotBytes, 0);
+ result.nextSlot -= ByteFuncLib.memoryOffset; // remove the offset of 0x8000 to get the number we actually want
+ result.freeSpace = ByteFuncLib.maxBRAMSize - result.nextSlot;
+
+ int nextSaveIndex = ByteFuncLib.headerSize;
+ int nextLength = BitConverter.ToInt16(data, nextSaveIndex);
+
+ // loop through saves until reaching a file that is 0 bytes long (no file)
+ while (nextLength != 0) {
+ BRAMEntry newEntry = new BRAMEntry();
+
+ newEntry.length = nextLength;
+ newEntry.data = ByteFuncLib.ReadBytes(data, nextSaveIndex, nextSaveIndex + nextLength);
+ newEntry.name = ByteFuncLib.DecodeBytes(ByteFuncLib.ReadBytes(data, nextSaveIndex + nextSlotStartByte, nextSaveIndex + ByteFuncLib.entryHeaderSize));
+ newEntry.startsAt = nextSaveIndex;
+
+ result.saves.Add(newEntry);
+ nextSaveIndex += nextLength;
+ nextLength = BitConverter.ToInt16(data, nextSaveIndex);
+ }
+
+ result.loaded = true;
+ }
+ else {
+ MessageBox.Show("File is not a valid BRAM file.");
+ }
+
+ return result;
+ }
+
+ // Saves the BRAM file to a given path
+ public static bool SaveFile(ref BRAM bram, string path) {
+ if (path.Length > 0) {
+ byte[] outputData = new byte[ByteFuncLib.maxBRAMSize];
+
+ // create new data array
+ ByteFuncLib.WriteBytes(bram.header, outputData, 0, ByteFuncLib.headerSize);
+ int index = ByteFuncLib.headerSize;
+ foreach (BRAMEntry entry in bram.saves) {
+ ByteFuncLib.WriteBytes(entry.data, outputData, index, entry.length);
+ index += entry.length;
+ }
+
+ // calculate new next slot pointer
+ int nextSlot = index;
+ byte[] nextSlotBytes = new byte[nextSlotLength];
+ nextSlot += ByteFuncLib.memoryOffset;
+ nextSlotBytes = BitConverter.GetBytes(nextSlot);
+ ByteFuncLib.WriteBytes(nextSlotBytes, outputData, nextSlotStartByte, nextSlotLength);
+
+ System.IO.File.WriteAllBytes(path, outputData);
+ bram.edited = false;
+
+ return true;
+ }
+ return false;
+ }
+
+ // Full file opening process, given a path
+ public static bool OpenAndLoadFile(string path, ref BRAM bram, ref ListBox list, ref TextBox textBox, ref Label label) {
+ BRAM newBRAM = ReadFile(path);
+
+ if (newBRAM.loaded) {
+ bram = newBRAM;
+
+ list.Items.Clear();
+
+ foreach (BRAMEntry entry in bram.saves) {
+ list.Items.Add(String.Format("{0} ({1}B)", entry.name, entry.length));
+ }
+
+ textBox.Text = path;
+ label.Text = String.Format("Free: {0}B", bram.freeSpace);
+
+ return true;
+ }
+
+ return false;
+ }
+
+ public static bool IsValidBRAMFile(string path) {
+ string dataString = System.IO.File.ReadAllText(path);
+ return dataString.StartsWith("HUBM");
+ }
+
+ // Copies a save file from one BRAM to another
+ public static void CopyEntry(ref BRAM sourceBRAM, ref BRAM targetBRAM, ref ListBox targetList, int index) {
+ BRAMEntry entry = sourceBRAM.saves[index];
+ if (targetBRAM.freeSpace < entry.length) {
+ MessageBox.Show("Not enough space in destination BRAM.");
+ return;
+ }
+
+ foreach (BRAMEntry otherEntry in targetBRAM.saves) {
+ if (otherEntry.name == entry.name) {
+ if (GuiFuncLib.WarningPopup("Filename already exists, which can cause issues. Are you sure you want to copy?")) {
+ return;
+ }
+ }
+ }
+
+ targetBRAM.saves.Add(entry);
+ targetList.Items.Add(String.Format("{0} ({1}B)", entry.name, entry.length));
+ targetBRAM.freeSpace -= entry.length;
+ targetBRAM.edited = true;
+ }
+
+ // Deletes a save file entry from a BRAM
+ public static void DeleteEntry(ref BRAM bram, ref ListBox list, int index) {
+ bram.freeSpace += bram.saves[index].length;
+ bram.edited = true;
+
+ bram.saves.RemoveAt(index);
+ list.Items.RemoveAt(index);
+
+ if (list.Items.Count > index) {
+ list.SelectedIndex = index;
+ }
+
+ else {
+ list.SelectedIndex = list.Items.Count - 1;
+ }
+ }
+ public static void MoveEntry(ref BRAM bram, ref ListBox list, int index, int direction) {
+ if (index + direction >= 0 && index + direction < list.Items.Count) {
+ DataFuncLib.SwapListItems(bram.saves, index, index + direction);
+ DataFuncLib.SwapListItems(list.Items, index, index + direction);
+ list.SelectedIndex += direction;
+ bram.edited = true;
+ }
+ }
+
+ // Swaps item positions in a list
+ public static void SwapListItems(List list, int indexA, int indexB)
+ {
+ T temp = list[indexA];
+ list[indexA] = list[indexB];
+ list[indexB] = temp;
+ }
+
+ // Swaps item positions in a list box
+ public static void SwapListItems(ListBox.ObjectCollection list, int indexA, int indexB)
+ {
+ object temp = list[indexA];
+ list[indexA] = list[indexB];
+ list[indexB] = temp;
+ }
+}
diff --git a/BRAM_Manager/GuiFuncLib.cs b/BRAM_Manager/GuiFuncLib.cs
new file mode 100644
index 0000000..166390c
--- /dev/null
+++ b/BRAM_Manager/GuiFuncLib.cs
@@ -0,0 +1,125 @@
+using Microsoft.WindowsAPICodePack.Dialogs;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Windows.Forms;
+
+// This library contains functions related to the user interface.
+internal class GuiFuncLib
+{
+ public static string savedInitialDirectory = "c:\\";
+ public static string fileDialogFilter =
+ "All BRAM files (*.bup;*.brm;*.sav)|*.bup;*.brm;*.sav|" +
+ "BUP files (SSDS3) (*.bup)|*.bup|" +
+ "BRM files (Everdrive) (*.brm)|*.brm|" +
+ "SAV files (Emulator) (*.sav)|*.sav|" +
+ "All files (*.*)|*.*";
+
+ public static string OpenFileBrowser()
+ {
+ return OpenFileBrowser(savedInitialDirectory);
+ }
+
+ // Opens a file browser and returns the path to the selected file
+ public static string OpenFileBrowser(string initialDirectory)
+ {
+ using (OpenFileDialog openFileDialog = new OpenFileDialog())
+ {
+ openFileDialog.InitialDirectory = initialDirectory;
+ openFileDialog.Filter = fileDialogFilter;
+ openFileDialog.FilterIndex = 1;
+ openFileDialog.RestoreDirectory = true;
+
+ if (openFileDialog.ShowDialog() == DialogResult.OK)
+ {
+ savedInitialDirectory = Path.GetDirectoryName(openFileDialog.FileName);
+ BRAM_Manager.Properties.Settings.Default.savedInitialDirectory = savedInitialDirectory;
+ BRAM_Manager.Properties.Settings.Default.Save();
+ return openFileDialog.FileName;
+ }
+ }
+
+ return string.Empty;
+ }
+
+ // Opens a file browser and returns the paths to the selected files
+ public static string[] OpenMultiFileBrowser(string initialDirectory)
+ {
+ using (OpenFileDialog openFileDialog = new OpenFileDialog()) {
+ openFileDialog.InitialDirectory = initialDirectory;
+ openFileDialog.Filter = fileDialogFilter;
+ openFileDialog.FilterIndex = 1;
+ openFileDialog.RestoreDirectory = true;
+ openFileDialog.Multiselect = true;
+
+ if (openFileDialog.ShowDialog() == DialogResult.OK) {
+ savedInitialDirectory = Path.GetDirectoryName(openFileDialog.FileName);
+ BRAM_Manager.Properties.Settings.Default.savedInitialDirectory = savedInitialDirectory;
+ BRAM_Manager.Properties.Settings.Default.Save();
+ return openFileDialog.FileNames;
+ }
+ }
+
+ return new string[0];
+ }
+
+ public static string OpenFolderBrowser(string initialDirectory) {
+ using (CommonOpenFileDialog openFolderDialog = new CommonOpenFileDialog()) {
+ openFolderDialog.InitialDirectory = initialDirectory;
+ openFolderDialog.IsFolderPicker = true;
+
+ if (openFolderDialog.ShowDialog() == CommonFileDialogResult.Ok) {
+ return openFolderDialog.FileName;
+ }
+ }
+
+ return string.Empty;
+ }
+
+ public static IEnumerable OpenMultiFolderBrowser(string initialDirectory) {
+ using (CommonOpenFileDialog openFolderDialog = new CommonOpenFileDialog()) {
+ openFolderDialog.InitialDirectory = initialDirectory;
+ openFolderDialog.IsFolderPicker = true;
+ openFolderDialog.Multiselect = true;
+
+ if (openFolderDialog.ShowDialog() == CommonFileDialogResult.Ok) {
+ return openFolderDialog.FileNames;
+ }
+ }
+
+ return Enumerable.Empty();
+ }
+
+ // Opens a file browser and returns a path to the new file
+ public static string SaveFileBrowser(string defaultDirectory = "", string defaultFileName = "")
+ {
+ SaveFileDialog saveFileDialog = new SaveFileDialog();
+
+ if (defaultDirectory.Length > 0)
+ saveFileDialog.InitialDirectory = defaultDirectory;
+ else
+ saveFileDialog.InitialDirectory = savedInitialDirectory;
+ if (defaultFileName.Length > 0)
+ saveFileDialog.FileName = defaultFileName;
+ saveFileDialog.Filter = fileDialogFilter;
+ saveFileDialog.FilterIndex = 1;
+ saveFileDialog.RestoreDirectory = true;
+
+ if (saveFileDialog.ShowDialog() == DialogResult.OK)
+ {
+ savedInitialDirectory = Path.GetDirectoryName(saveFileDialog.FileName);
+ BRAM_Manager.Properties.Settings.Default.savedInitialDirectory = savedInitialDirectory;
+ BRAM_Manager.Properties.Settings.Default.Save();
+ return saveFileDialog.FileName;
+ }
+
+ return string.Empty;
+ }
+
+ public static bool WarningPopup(string msg) {
+ if (BRAM_Manager.Properties.Settings.Default.disablePopups)
+ return false;
+
+ return MessageBox.Show(msg, "", MessageBoxButtons.YesNo) == DialogResult.No;
+ }
+}
diff --git a/BRAM_Manager/MainForm.Designer.cs b/BRAM_Manager/MainForm.Designer.cs
index 320f7d2..4aac9f9 100644
--- a/BRAM_Manager/MainForm.Designer.cs
+++ b/BRAM_Manager/MainForm.Designer.cs
@@ -23,259 +23,338 @@ partial class MainForm {
/// the contents of this method with the code editor.
///
private void InitializeComponent() {
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
- this.menuStrip1 = new System.Windows.Forms.MenuStrip();
- this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.newBRAMToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.clearAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.LeftList = new System.Windows.Forms.ListBox();
- this.RightList = new System.Windows.Forms.ListBox();
- this.LeftAddress = new System.Windows.Forms.TextBox();
- this.RightAddress = new System.Windows.Forms.TextBox();
- this.LeftBrowse = new System.Windows.Forms.Button();
- this.RightBrowse = new System.Windows.Forms.Button();
- this.CopyButton = new System.Windows.Forms.Button();
- this.DeleteButton = new System.Windows.Forms.Button();
- this.DownButton = new System.Windows.Forms.Button();
- this.UpButton = new System.Windows.Forms.Button();
- this.LeftSave = new System.Windows.Forms.Button();
- this.RightSave = new System.Windows.Forms.Button();
- this.LeftFreeSpace = new System.Windows.Forms.Label();
- this.RightFreeSpace = new System.Windows.Forms.Label();
- this.LeftEdited = new System.Windows.Forms.Label();
- this.RightEdited = new System.Windows.Forms.Label();
- this.mergeMultipleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.menuStrip1.SuspendLayout();
- this.SuspendLayout();
- //
- // menuStrip1
- //
- this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.fileToolStripMenuItem});
- this.menuStrip1.Location = new System.Drawing.Point(0, 0);
- this.menuStrip1.Name = "menuStrip1";
- this.menuStrip1.Size = new System.Drawing.Size(370, 24);
- this.menuStrip1.TabIndex = 0;
- this.menuStrip1.Text = "menuStrip1";
- //
- // fileToolStripMenuItem
- //
- this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.newBRAMToolStripMenuItem,
+ this.components = new System.ComponentModel.Container();
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.clearAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+ this.mergeMultipleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.mergeFromFoldersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.transferToolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.disableWarningsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.LeftList = new System.Windows.Forms.ListBox();
+ this.RightList = new System.Windows.Forms.ListBox();
+ this.LeftAddress = new System.Windows.Forms.TextBox();
+ this.RightAddress = new System.Windows.Forms.TextBox();
+ this.LeftBrowse = new System.Windows.Forms.Button();
+ this.RightBrowse = new System.Windows.Forms.Button();
+ this.CopyButton = new System.Windows.Forms.Button();
+ this.DeleteButton = new System.Windows.Forms.Button();
+ this.DownButton = new System.Windows.Forms.Button();
+ this.UpButton = new System.Windows.Forms.Button();
+ this.LeftSave = new System.Windows.Forms.Button();
+ this.RightSave = new System.Windows.Forms.Button();
+ this.LeftFreeSpace = new System.Windows.Forms.Label();
+ this.RightFreeSpace = new System.Windows.Forms.Label();
+ this.LeftEdited = new System.Windows.Forms.Label();
+ this.RightEdited = new System.Windows.Forms.Label();
+ this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
+ this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
+ this.menuStrip1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.fileToolStripMenuItem,
+ this.optionsToolStripMenuItem});
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(370, 24);
+ this.menuStrip1.TabIndex = 0;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // fileToolStripMenuItem
+ //
+ this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.clearAllToolStripMenuItem,
+ this.toolStripSeparator1,
this.mergeMultipleToolStripMenuItem,
- this.clearAllToolStripMenuItem});
- this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
- this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
- this.fileToolStripMenuItem.Text = "File";
- //
- // newBRAMToolStripMenuItem
- //
- this.newBRAMToolStripMenuItem.Name = "newBRAMToolStripMenuItem";
- this.newBRAMToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
- this.newBRAMToolStripMenuItem.Text = "New BRAM";
- this.newBRAMToolStripMenuItem.Click += new System.EventHandler(this.newBRAMToolStripMenuItem_Click);
- //
- // clearAllToolStripMenuItem
- //
- this.clearAllToolStripMenuItem.Name = "clearAllToolStripMenuItem";
- this.clearAllToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
- this.clearAllToolStripMenuItem.Text = "Clear All";
- this.clearAllToolStripMenuItem.Click += new System.EventHandler(this.clearAllToolStripMenuItem_Click);
- //
- // LeftList
- //
- this.LeftList.FormattingEnabled = true;
- this.LeftList.Location = new System.Drawing.Point(12, 27);
- this.LeftList.Name = "LeftList";
- this.LeftList.Size = new System.Drawing.Size(130, 199);
- this.LeftList.TabIndex = 1;
- this.LeftList.SelectedIndexChanged += new System.EventHandler(this.LeftList_SelectedIndexChanged);
- //
- // RightList
- //
- this.RightList.FormattingEnabled = true;
- this.RightList.Location = new System.Drawing.Point(229, 27);
- this.RightList.Name = "RightList";
- this.RightList.Size = new System.Drawing.Size(129, 199);
- this.RightList.TabIndex = 2;
- this.RightList.SelectedIndexChanged += new System.EventHandler(this.RightList_SelectedIndexChanged);
- //
- // LeftAddress
- //
- this.LeftAddress.Location = new System.Drawing.Point(12, 232);
- this.LeftAddress.Name = "LeftAddress";
- this.LeftAddress.ReadOnly = true;
- this.LeftAddress.Size = new System.Drawing.Size(130, 20);
- this.LeftAddress.TabIndex = 3;
- //
- // RightAddress
- //
- this.RightAddress.Location = new System.Drawing.Point(229, 232);
- this.RightAddress.Name = "RightAddress";
- this.RightAddress.ReadOnly = true;
- this.RightAddress.Size = new System.Drawing.Size(129, 20);
- this.RightAddress.TabIndex = 4;
- //
- // LeftBrowse
- //
- this.LeftBrowse.Location = new System.Drawing.Point(86, 259);
- this.LeftBrowse.Name = "LeftBrowse";
- this.LeftBrowse.Size = new System.Drawing.Size(56, 23);
- this.LeftBrowse.TabIndex = 5;
- this.LeftBrowse.Text = "Browse...";
- this.LeftBrowse.UseVisualStyleBackColor = true;
- this.LeftBrowse.Click += new System.EventHandler(this.LeftBrowse_Click);
- //
- // RightBrowse
- //
- this.RightBrowse.Location = new System.Drawing.Point(302, 258);
- this.RightBrowse.Name = "RightBrowse";
- this.RightBrowse.Size = new System.Drawing.Size(56, 23);
- this.RightBrowse.TabIndex = 6;
- this.RightBrowse.Text = "Browse...";
- this.RightBrowse.UseVisualStyleBackColor = true;
- this.RightBrowse.Click += new System.EventHandler(this.RightBrowse_Click);
- //
- // CopyButton
- //
- this.CopyButton.Location = new System.Drawing.Point(148, 161);
- this.CopyButton.Name = "CopyButton";
- this.CopyButton.Size = new System.Drawing.Size(75, 23);
- this.CopyButton.TabIndex = 7;
- this.CopyButton.Text = "Copy";
- this.CopyButton.UseVisualStyleBackColor = true;
- this.CopyButton.Click += new System.EventHandler(this.CopyButton_Click);
- //
- // DeleteButton
- //
- this.DeleteButton.Location = new System.Drawing.Point(148, 190);
- this.DeleteButton.Name = "DeleteButton";
- this.DeleteButton.Size = new System.Drawing.Size(75, 23);
- this.DeleteButton.TabIndex = 8;
- this.DeleteButton.Text = "Delete";
- this.DeleteButton.UseVisualStyleBackColor = true;
- this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
- //
- // DownButton
- //
- this.DownButton.Location = new System.Drawing.Point(148, 132);
- this.DownButton.Name = "DownButton";
- this.DownButton.Size = new System.Drawing.Size(75, 23);
- this.DownButton.TabIndex = 9;
- this.DownButton.Text = "Down";
- this.DownButton.UseVisualStyleBackColor = true;
- this.DownButton.Click += new System.EventHandler(this.DownButton_Click);
- //
- // UpButton
- //
- this.UpButton.Location = new System.Drawing.Point(148, 103);
- this.UpButton.Name = "UpButton";
- this.UpButton.Size = new System.Drawing.Size(75, 23);
- this.UpButton.TabIndex = 10;
- this.UpButton.Text = "Up";
- this.UpButton.UseVisualStyleBackColor = true;
- this.UpButton.Click += new System.EventHandler(this.UpButton_Click);
- //
- // LeftSave
- //
- this.LeftSave.Location = new System.Drawing.Point(12, 259);
- this.LeftSave.Name = "LeftSave";
- this.LeftSave.Size = new System.Drawing.Size(56, 23);
- this.LeftSave.TabIndex = 11;
- this.LeftSave.Text = "Save";
- this.LeftSave.UseVisualStyleBackColor = true;
- this.LeftSave.Click += new System.EventHandler(this.LeftSave_Click);
- //
- // RightSave
- //
- this.RightSave.Location = new System.Drawing.Point(229, 258);
- this.RightSave.Name = "RightSave";
- this.RightSave.Size = new System.Drawing.Size(56, 23);
- this.RightSave.TabIndex = 12;
- this.RightSave.Text = "Save";
- this.RightSave.UseVisualStyleBackColor = true;
- this.RightSave.Click += new System.EventHandler(this.RightSave_Click);
- //
- // LeftFreeSpace
- //
- this.LeftFreeSpace.AutoSize = true;
- this.LeftFreeSpace.Location = new System.Drawing.Point(9, 285);
- this.LeftFreeSpace.Name = "LeftFreeSpace";
- this.LeftFreeSpace.Size = new System.Drawing.Size(37, 13);
- this.LeftFreeSpace.TabIndex = 13;
- this.LeftFreeSpace.Text = " ";
- //
- // RightFreeSpace
- //
- this.RightFreeSpace.AutoSize = true;
- this.RightFreeSpace.Location = new System.Drawing.Point(226, 285);
- this.RightFreeSpace.Name = "RightFreeSpace";
- this.RightFreeSpace.Size = new System.Drawing.Size(37, 13);
- this.RightFreeSpace.TabIndex = 14;
- this.RightFreeSpace.Text = " ";
- //
- // LeftEdited
- //
- this.LeftEdited.AutoSize = true;
- this.LeftEdited.Location = new System.Drawing.Point(102, 285);
- this.LeftEdited.Name = "LeftEdited";
- this.LeftEdited.Size = new System.Drawing.Size(40, 13);
- this.LeftEdited.TabIndex = 15;
- this.LeftEdited.Text = "Edited ";
- this.LeftEdited.TextAlign = System.Drawing.ContentAlignment.TopRight;
- this.LeftEdited.Visible = false;
- //
- // RightEdited
- //
- this.RightEdited.AutoSize = true;
- this.RightEdited.Location = new System.Drawing.Point(318, 285);
- this.RightEdited.Name = "RightEdited";
- this.RightEdited.Size = new System.Drawing.Size(40, 13);
- this.RightEdited.TabIndex = 16;
- this.RightEdited.Text = "Edited ";
- this.RightEdited.TextAlign = System.Drawing.ContentAlignment.TopRight;
- this.RightEdited.Visible = false;
- //
- // mergeMultipleToolStripMenuItem
- //
- this.mergeMultipleToolStripMenuItem.Name = "mergeMultipleToolStripMenuItem";
- this.mergeMultipleToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
- this.mergeMultipleToolStripMenuItem.Text = "Merge Multiple";
- this.mergeMultipleToolStripMenuItem.Click += new System.EventHandler(this.mergeMultipleToolStripMenuItem_Click);
- //
- // MainForm
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(370, 306);
- this.Controls.Add(this.RightEdited);
- this.Controls.Add(this.LeftEdited);
- this.Controls.Add(this.RightFreeSpace);
- this.Controls.Add(this.LeftFreeSpace);
- this.Controls.Add(this.RightSave);
- this.Controls.Add(this.LeftSave);
- this.Controls.Add(this.UpButton);
- this.Controls.Add(this.DownButton);
- this.Controls.Add(this.DeleteButton);
- this.Controls.Add(this.CopyButton);
- this.Controls.Add(this.RightBrowse);
- this.Controls.Add(this.LeftBrowse);
- this.Controls.Add(this.RightAddress);
- this.Controls.Add(this.LeftAddress);
- this.Controls.Add(this.RightList);
- this.Controls.Add(this.LeftList);
- this.Controls.Add(this.menuStrip1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
- this.MainMenuStrip = this.menuStrip1;
- this.MaximizeBox = false;
- this.Name = "MainForm";
- this.Text = "BRAM Manager";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
- this.menuStrip1.ResumeLayout(false);
- this.menuStrip1.PerformLayout();
- this.ResumeLayout(false);
- this.PerformLayout();
+ this.mergeFromFoldersToolStripMenuItem,
+ this.transferToolToolStripMenuItem,
+ this.toolStripSeparator2,
+ this.aboutToolStripMenuItem});
+ this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
+ this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
+ this.fileToolStripMenuItem.Text = "File";
+ //
+ // clearAllToolStripMenuItem
+ //
+ this.clearAllToolStripMenuItem.Name = "clearAllToolStripMenuItem";
+ this.clearAllToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
+ this.clearAllToolStripMenuItem.Text = "Unload Both BRAMs";
+ this.clearAllToolStripMenuItem.ToolTipText = "Unload the files in both BRAM slots, does not delete data in the files themselves" +
+ "";
+ this.clearAllToolStripMenuItem.Click += new System.EventHandler(this.clearAllToolStripMenuItem_Click);
+ //
+ // toolStripSeparator1
+ //
+ this.toolStripSeparator1.Name = "toolStripSeparator1";
+ this.toolStripSeparator1.Size = new System.Drawing.Size(186, 6);
+ //
+ // mergeMultipleToolStripMenuItem
+ //
+ this.mergeMultipleToolStripMenuItem.Name = "mergeMultipleToolStripMenuItem";
+ this.mergeMultipleToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
+ this.mergeMultipleToolStripMenuItem.Text = "Merge Multiple...";
+ this.mergeMultipleToolStripMenuItem.ToolTipText = "Merge multiple BRAM files together to create a new one";
+ this.mergeMultipleToolStripMenuItem.Click += new System.EventHandler(this.mergeMultipleToolStripMenuItem_Click);
+ //
+ // mergeFromFoldersToolStripMenuItem
+ //
+ this.mergeFromFoldersToolStripMenuItem.Name = "mergeFromFoldersToolStripMenuItem";
+ this.mergeFromFoldersToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
+ this.mergeFromFoldersToolStripMenuItem.Text = "Merge From Folders...";
+ this.mergeFromFoldersToolStripMenuItem.ToolTipText = "Merges multiple BRAM files within selected folders";
+ this.mergeFromFoldersToolStripMenuItem.Click += new System.EventHandler(this.mergeFromFoldersToolStripMenuItem_Click);
+ //
+ // transferToolToolStripMenuItem
+ //
+ this.transferToolToolStripMenuItem.Name = "transferToolToolStripMenuItem";
+ this.transferToolToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
+ this.transferToolToolStripMenuItem.Text = "Transfer Tool...";
+ this.transferToolToolStripMenuItem.ToolTipText = "Bulk transfer saves between two formats (SSDS3, Everdrive, Emulator...)";
+ this.transferToolToolStripMenuItem.Click += new System.EventHandler(this.transferToolToolStripMenuItem_Click);
+ //
+ // optionsToolStripMenuItem
+ //
+ this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.disableWarningsToolStripMenuItem});
+ this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
+ this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
+ this.optionsToolStripMenuItem.Text = "Options";
+ //
+ // disableWarningsToolStripMenuItem
+ //
+ this.disableWarningsToolStripMenuItem.CheckOnClick = true;
+ this.disableWarningsToolStripMenuItem.Name = "disableWarningsToolStripMenuItem";
+ this.disableWarningsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.disableWarningsToolStripMenuItem.Text = "Disable Warnings";
+ this.disableWarningsToolStripMenuItem.ToolTipText = "When ticked, no \"are you sure?\" warnings will pop up.\r\nOnly enable if you know wh" +
+ "at you\'re doing";
+ this.disableWarningsToolStripMenuItem.CheckedChanged += new System.EventHandler(this.disableWarningsToolStripMenuItem_CheckedChanged);
+ //
+ // LeftList
+ //
+ this.LeftList.AllowDrop = true;
+ this.LeftList.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.LeftList.FormattingEnabled = true;
+ this.LeftList.ItemHeight = 14;
+ this.LeftList.Location = new System.Drawing.Point(12, 27);
+ this.LeftList.Name = "LeftList";
+ this.LeftList.Size = new System.Drawing.Size(130, 186);
+ this.LeftList.TabIndex = 1;
+ this.LeftList.SelectedIndexChanged += new System.EventHandler(this.LeftList_SelectedIndexChanged);
+ this.LeftList.DragDrop += new System.Windows.Forms.DragEventHandler(this.LeftList_DragDrop);
+ this.LeftList.DragEnter += new System.Windows.Forms.DragEventHandler(this.LeftList_DragEnter);
+ //
+ // RightList
+ //
+ this.RightList.AllowDrop = true;
+ this.RightList.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.RightList.FormattingEnabled = true;
+ this.RightList.ItemHeight = 14;
+ this.RightList.Location = new System.Drawing.Point(229, 27);
+ this.RightList.Name = "RightList";
+ this.RightList.Size = new System.Drawing.Size(129, 186);
+ this.RightList.TabIndex = 2;
+ this.RightList.SelectedIndexChanged += new System.EventHandler(this.RightList_SelectedIndexChanged);
+ this.RightList.DragDrop += new System.Windows.Forms.DragEventHandler(this.RightList_DragDrop);
+ this.RightList.DragEnter += new System.Windows.Forms.DragEventHandler(this.RightList_DragEnter);
+ //
+ // LeftAddress
+ //
+ this.LeftAddress.Location = new System.Drawing.Point(12, 232);
+ this.LeftAddress.Name = "LeftAddress";
+ this.LeftAddress.ReadOnly = true;
+ this.LeftAddress.Size = new System.Drawing.Size(130, 20);
+ this.LeftAddress.TabIndex = 3;
+ //
+ // RightAddress
+ //
+ this.RightAddress.Location = new System.Drawing.Point(229, 232);
+ this.RightAddress.Name = "RightAddress";
+ this.RightAddress.ReadOnly = true;
+ this.RightAddress.Size = new System.Drawing.Size(129, 20);
+ this.RightAddress.TabIndex = 4;
+ //
+ // LeftBrowse
+ //
+ this.LeftBrowse.Location = new System.Drawing.Point(86, 259);
+ this.LeftBrowse.Name = "LeftBrowse";
+ this.LeftBrowse.Size = new System.Drawing.Size(56, 23);
+ this.LeftBrowse.TabIndex = 5;
+ this.LeftBrowse.Text = "Browse...";
+ this.toolTip1.SetToolTip(this.LeftBrowse, "Opens a file to the left BRAM slot");
+ this.LeftBrowse.UseVisualStyleBackColor = true;
+ this.LeftBrowse.Click += new System.EventHandler(this.LeftBrowse_Click);
+ //
+ // RightBrowse
+ //
+ this.RightBrowse.Location = new System.Drawing.Point(302, 258);
+ this.RightBrowse.Name = "RightBrowse";
+ this.RightBrowse.Size = new System.Drawing.Size(56, 23);
+ this.RightBrowse.TabIndex = 6;
+ this.RightBrowse.Text = "Browse...";
+ this.toolTip1.SetToolTip(this.RightBrowse, "Opens a file to the right BRAM slot");
+ this.RightBrowse.UseVisualStyleBackColor = true;
+ this.RightBrowse.Click += new System.EventHandler(this.RightBrowse_Click);
+ //
+ // CopyButton
+ //
+ this.CopyButton.Location = new System.Drawing.Point(148, 161);
+ this.CopyButton.Name = "CopyButton";
+ this.CopyButton.Size = new System.Drawing.Size(75, 23);
+ this.CopyButton.TabIndex = 7;
+ this.CopyButton.Text = "Copy";
+ this.toolTip1.SetToolTip(this.CopyButton, "Copies the selected item to the other BRAM slot");
+ this.CopyButton.UseVisualStyleBackColor = true;
+ this.CopyButton.Click += new System.EventHandler(this.CopyButton_Click);
+ //
+ // DeleteButton
+ //
+ this.DeleteButton.Location = new System.Drawing.Point(148, 190);
+ this.DeleteButton.Name = "DeleteButton";
+ this.DeleteButton.Size = new System.Drawing.Size(75, 23);
+ this.DeleteButton.TabIndex = 8;
+ this.DeleteButton.Text = "Delete";
+ this.toolTip1.SetToolTip(this.DeleteButton, "Deletes the selected item");
+ this.DeleteButton.UseVisualStyleBackColor = true;
+ this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
+ //
+ // DownButton
+ //
+ this.DownButton.Location = new System.Drawing.Point(148, 132);
+ this.DownButton.Name = "DownButton";
+ this.DownButton.Size = new System.Drawing.Size(75, 23);
+ this.DownButton.TabIndex = 9;
+ this.DownButton.Text = "Down";
+ this.toolTip1.SetToolTip(this.DownButton, "Moves the selected item down");
+ this.DownButton.UseVisualStyleBackColor = true;
+ this.DownButton.Click += new System.EventHandler(this.DownButton_Click);
+ //
+ // UpButton
+ //
+ this.UpButton.Location = new System.Drawing.Point(148, 103);
+ this.UpButton.Name = "UpButton";
+ this.UpButton.Size = new System.Drawing.Size(75, 23);
+ this.UpButton.TabIndex = 10;
+ this.UpButton.Text = "Up";
+ this.toolTip1.SetToolTip(this.UpButton, "Moves the selected item up");
+ this.UpButton.UseVisualStyleBackColor = true;
+ this.UpButton.Click += new System.EventHandler(this.UpButton_Click);
+ //
+ // LeftSave
+ //
+ this.LeftSave.Location = new System.Drawing.Point(12, 259);
+ this.LeftSave.Name = "LeftSave";
+ this.LeftSave.Size = new System.Drawing.Size(56, 23);
+ this.LeftSave.TabIndex = 11;
+ this.LeftSave.Text = "Save...";
+ this.toolTip1.SetToolTip(this.LeftSave, "Saves the left BRAM slot to a file");
+ this.LeftSave.UseVisualStyleBackColor = true;
+ this.LeftSave.Click += new System.EventHandler(this.LeftSave_Click);
+ //
+ // RightSave
+ //
+ this.RightSave.Location = new System.Drawing.Point(229, 258);
+ this.RightSave.Name = "RightSave";
+ this.RightSave.Size = new System.Drawing.Size(56, 23);
+ this.RightSave.TabIndex = 12;
+ this.RightSave.Text = "Save...";
+ this.toolTip1.SetToolTip(this.RightSave, "Saves the right BRAM slot to a file");
+ this.RightSave.UseVisualStyleBackColor = true;
+ this.RightSave.Click += new System.EventHandler(this.RightSave_Click);
+ //
+ // LeftFreeSpace
+ //
+ this.LeftFreeSpace.AutoSize = true;
+ this.LeftFreeSpace.Location = new System.Drawing.Point(9, 285);
+ this.LeftFreeSpace.Name = "LeftFreeSpace";
+ this.LeftFreeSpace.Size = new System.Drawing.Size(37, 13);
+ this.LeftFreeSpace.TabIndex = 13;
+ this.LeftFreeSpace.Text = " ";
+ //
+ // RightFreeSpace
+ //
+ this.RightFreeSpace.AutoSize = true;
+ this.RightFreeSpace.Location = new System.Drawing.Point(226, 285);
+ this.RightFreeSpace.Name = "RightFreeSpace";
+ this.RightFreeSpace.Size = new System.Drawing.Size(37, 13);
+ this.RightFreeSpace.TabIndex = 14;
+ this.RightFreeSpace.Text = " ";
+ //
+ // LeftEdited
+ //
+ this.LeftEdited.AutoSize = true;
+ this.LeftEdited.Location = new System.Drawing.Point(102, 285);
+ this.LeftEdited.Name = "LeftEdited";
+ this.LeftEdited.Size = new System.Drawing.Size(40, 13);
+ this.LeftEdited.TabIndex = 15;
+ this.LeftEdited.Text = "Edited ";
+ this.LeftEdited.TextAlign = System.Drawing.ContentAlignment.TopRight;
+ this.LeftEdited.Visible = false;
+ //
+ // RightEdited
+ //
+ this.RightEdited.AutoSize = true;
+ this.RightEdited.Location = new System.Drawing.Point(318, 285);
+ this.RightEdited.Name = "RightEdited";
+ this.RightEdited.Size = new System.Drawing.Size(40, 13);
+ this.RightEdited.TabIndex = 16;
+ this.RightEdited.Text = "Edited ";
+ this.RightEdited.TextAlign = System.Drawing.ContentAlignment.TopRight;
+ this.RightEdited.Visible = false;
+ //
+ // aboutToolStripMenuItem
+ //
+ this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
+ this.aboutToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
+ this.aboutToolStripMenuItem.Text = "About...";
+ this.aboutToolStripMenuItem.ToolTipText = "What is this program?";
+ this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
+ //
+ // toolStripSeparator2
+ //
+ this.toolStripSeparator2.Name = "toolStripSeparator2";
+ this.toolStripSeparator2.Size = new System.Drawing.Size(186, 6);
+ //
+ // MainForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(370, 306);
+ this.Controls.Add(this.RightEdited);
+ this.Controls.Add(this.LeftEdited);
+ this.Controls.Add(this.RightFreeSpace);
+ this.Controls.Add(this.LeftFreeSpace);
+ this.Controls.Add(this.RightSave);
+ this.Controls.Add(this.LeftSave);
+ this.Controls.Add(this.UpButton);
+ this.Controls.Add(this.DownButton);
+ this.Controls.Add(this.DeleteButton);
+ this.Controls.Add(this.CopyButton);
+ this.Controls.Add(this.RightBrowse);
+ this.Controls.Add(this.LeftBrowse);
+ this.Controls.Add(this.RightAddress);
+ this.Controls.Add(this.LeftAddress);
+ this.Controls.Add(this.RightList);
+ this.Controls.Add(this.LeftList);
+ this.Controls.Add(this.menuStrip1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+ this.MainMenuStrip = this.menuStrip1;
+ this.MaximizeBox = false;
+ this.Name = "MainForm";
+ this.Text = "PCE BRAM Manager";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
}
@@ -283,10 +362,6 @@ partial class MainForm {
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
- private System.Windows.Forms.ListBox LeftList;
- private System.Windows.Forms.ListBox RightList;
- private System.Windows.Forms.TextBox LeftAddress;
- private System.Windows.Forms.TextBox RightAddress;
private System.Windows.Forms.Button LeftBrowse;
private System.Windows.Forms.Button RightBrowse;
private System.Windows.Forms.Button CopyButton;
@@ -295,13 +370,24 @@ partial class MainForm {
private System.Windows.Forms.Button UpButton;
private System.Windows.Forms.Button LeftSave;
private System.Windows.Forms.Button RightSave;
- private System.Windows.Forms.Label LeftFreeSpace;
- private System.Windows.Forms.Label RightFreeSpace;
- private System.Windows.Forms.ToolStripMenuItem newBRAMToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem clearAllToolStripMenuItem;
- private System.Windows.Forms.Label LeftEdited;
- private System.Windows.Forms.Label RightEdited;
private System.Windows.Forms.ToolStripMenuItem mergeMultipleToolStripMenuItem;
- }
+ public System.Windows.Forms.ListBox LeftList;
+ public System.Windows.Forms.ListBox RightList;
+ public System.Windows.Forms.TextBox LeftAddress;
+ public System.Windows.Forms.TextBox RightAddress;
+ public System.Windows.Forms.Label LeftFreeSpace;
+ public System.Windows.Forms.Label RightFreeSpace;
+ public System.Windows.Forms.Label LeftEdited;
+ public System.Windows.Forms.Label RightEdited;
+ private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem disableWarningsToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem transferToolToolStripMenuItem;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
+ private System.Windows.Forms.ToolStripMenuItem mergeFromFoldersToolStripMenuItem;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
+ private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
+ private System.Windows.Forms.ToolTip toolTip1;
+ }
}
diff --git a/BRAM_Manager/MainForm.cs b/BRAM_Manager/MainForm.cs
index aec7f08..7edcafa 100644
--- a/BRAM_Manager/MainForm.cs
+++ b/BRAM_Manager/MainForm.cs
@@ -1,582 +1,415 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
+/* TODO
+ * Renaming BRAM entries
+ * Japanese language support
+ */
+
namespace BRAM_Manager {
- public partial class MainForm : Form {
- public string savedInitialDirectory = "c:\\";
- public BRAM leftBRAM, rightBRAM;
-
- // Slightly inaccurate character map, inaccuracies are to ensure no duplicates for accurate encoding
- public char[] characterMap = new char[] {
- ' ', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█', '♤', '♡', '◇', '♧', '○', '●', '/',
- '\\', '円', '年', '月', '日', '時', '分', '秒', '◢', '◣', '◥', '◤', '→', '←', '↑', '↓',
- ' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/',
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
- '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
- 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '¥', ']', '^', '_',
- ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
- 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '¦', '}', '~', '☓',
- ' ', '。', '「', '」', '、', '・', 'を', 'ぁ', '╭', '─', '╮', '│', '|', '╰', '━', '╯',
- 'ー', 'あ', 'い', 'う', 'え', 'お', 'か', 'き', 'く', 'け', 'こ', 'さ', 'し', 'す', 'せ', 'そ',
- ' ', '。', '「', '」', '、', '・', 'ヲ', 'ァ', '┬', '|', '┴', 'ォ', 'ャ', 'ュ', 'ョ', 'ッ',
- '-', 'ア', 'イ', 'ウ', 'エ', 'オ', 'カ', 'キ', 'ク', 'ケ', 'コ', 'サ', 'シ', 'ス', 'セ', 'ソ',
- 'タ', 'チ', 'ツ', 'テ', 'ト', 'ナ', 'ニ', 'ヌ', 'ネ', 'ノ', 'ハ', 'ヒ', 'フ', 'ヘ', 'ホ', 'マ',
- 'ミ', 'ム', 'メ', 'モ', 'ヤ', 'ユ', 'ヨ', 'ラ', 'リ', 'ル', 'レ', 'ロ', 'ワ', 'ン', '゛', '゜',
- 'た', 'ち', 'つ', 'て', 'と', 'な', 'に', 'ぬ', 'ね', 'の', 'は', 'ひ', 'ふ', 'へ', 'ほ', 'ま',
- 'み', 'む', 'め', 'も', 'や', 'ゆ', 'よ', 'ら', 'り', 'る', 'れ', 'ろ', 'わ', 'ん', '゙', '©'};
-
- public struct BRAM {
- public byte[] data;
- public byte[] header;
- public List saves;
- public int nextSlot;
- public int freeSpace;
- public bool loaded;
- public bool edited;
- }
-
- public struct BRAMEntry {
- public byte[] data;
- public string name;
- public int length;
- public int startsAt;
- }
-
- public MainForm() {
- InitializeComponent();
-
- savedInitialDirectory = Properties.Settings.Default.savedInitialDirectory;
- }
-
- //--------------------------------------------------
- // Main functions
- //--------------------------------------------------
-
- public string OpenFileBrowser() {
- return OpenFileBrowser(savedInitialDirectory);
- }
-
- // Opens a file browser and returns the path to the selected file
- public string OpenFileBrowser(string initialDirectory) {
- using (OpenFileDialog openFileDialog = new OpenFileDialog()) {
- openFileDialog.InitialDirectory = initialDirectory;
- openFileDialog.Filter = "BRAM files (*.bup;*.sav)|*.bup;*.sav|All files (*.*)|*.*";
- openFileDialog.FilterIndex = 1;
- openFileDialog.RestoreDirectory = true;
-
- if (openFileDialog.ShowDialog() == DialogResult.OK) {
- savedInitialDirectory = Path.GetDirectoryName(openFileDialog.FileName);
- Properties.Settings.Default.savedInitialDirectory = savedInitialDirectory;
- Properties.Settings.Default.Save();
- return openFileDialog.FileName;
- }
- }
-
- return string.Empty;
- }
-
- // Opens a file browser and returns the paths to the selected files
- public string[] OpenMultiFileBrowser(string initialDirectory) {
- using (OpenFileDialog openFileDialog = new OpenFileDialog()) {
- openFileDialog.InitialDirectory = initialDirectory;
- openFileDialog.Filter = "BRAM files (*.bup;*.sav)|*.bup;*.sav|All files (*.*)|*.*";
- openFileDialog.FilterIndex = 1;
- openFileDialog.RestoreDirectory = true;
- openFileDialog.Multiselect = true;
-
- if (openFileDialog.ShowDialog() == DialogResult.OK) {
- savedInitialDirectory = Path.GetDirectoryName(openFileDialog.FileName);
- Properties.Settings.Default.savedInitialDirectory = savedInitialDirectory;
- Properties.Settings.Default.Save();
- return openFileDialog.FileNames;
- }
- }
-
- return new string[0];
- }
-
- // Opens a file browser and returns a path to the new file
- public string SaveFileBrowser(string defaultDirectory = "", string defaultFileName = "") {
- SaveFileDialog saveFileDialog = new SaveFileDialog();
-
- if (defaultDirectory.Length > 0)
- saveFileDialog.InitialDirectory = defaultDirectory;
- else
- saveFileDialog.InitialDirectory = savedInitialDirectory;
- if (defaultFileName.Length > 0)
- saveFileDialog.FileName = defaultFileName;
- saveFileDialog.Filter = "BRAM files (*.bup;*.sav)|*.bup;*.sav|All files (*.*)|*.*";
- saveFileDialog.FilterIndex = 1;
- saveFileDialog.RestoreDirectory = true;
-
- if (saveFileDialog.ShowDialog() == DialogResult.OK) {
- savedInitialDirectory = Path.GetDirectoryName(saveFileDialog.FileName);
- Properties.Settings.Default.savedInitialDirectory = savedInitialDirectory;
- Properties.Settings.Default.Save();
- return saveFileDialog.FileName;
- }
-
- return string.Empty;
- }
-
- // Returns bytes from a byte array, given a range
- public byte[] ReadBytes(byte[] data, int from, int to) {
- byte[] result = new byte[to - from];
-
- int index = 0;
- for (int i = from; i < to; i++) {
- result[index] = data[i];
- index++;
- }
-
- return result;
- }
-
- // Converts bytes into a human-readable form following the PC Engine character map
- public string DecodeBytes(byte[] data) {
- string result = string.Empty;
-
- foreach (byte Byte in data) {
- if (characterMap.Length > Byte) {
- result += characterMap[Byte];
- }
- }
-
- return result;
- }
-
- // Converts a string into valid bytes following the PC Engine character map
- public byte[] EncodeString(string data) {
- byte[] result = new byte[data.Length];
-
- for (int i = 0; i < data.Length; i++) {
- char Char = data[i];
- if (characterMap.Contains(Char)) {
- result[i] = Convert.ToByte(Array.IndexOf(characterMap, Char));
- }
- }
-
- return result;
- }
-
- // Writes bytes to a byte array, given a starting location and a length
- public void WriteBytes(byte[] input, byte[] dest, int startLoc, int length) {
- int index = 0;
- for (int i = startLoc; i < startLoc + length; i++) {
- if (dest.Length > i && input.Length > index) {
- dest[i] = input[index];
- index++;
- }
- }
- }
-
- // Calculates the checksum for a given BRAM entry
- public byte[] CalculateChecksum(byte[] data, int length) {
- byte[] result = new byte[2];
- int dataSize = length - 4;
- byte[] newData = new byte[dataSize];
-
- // get data bytes minus first four bytes
- int index = 0;
- for (int i = 4; i < length; i++) {
- newData[index] = data[i];
- index++;
- }
-
- // checksum is the sum of all bytes
- int sum = 0;
- foreach (byte Byte in newData) {
- sum += Byte;
- }
-
- // stored checksum is the negation of the checksum
- int checksum = sum * -1;
- result = BitConverter.GetBytes(checksum);
-
- return result;
- }
-
- // Reads a file and converts it to a BRAM data entry
- public BRAM ReadFile(string file) {
- BRAM result = new BRAM();
- result.saves = new List();
-
- string dataString;
-
- try {
- dataString = System.IO.File.ReadAllText(file);
- }
- catch (IOException)
- {
- MessageBox.Show("File is in use.");
- return result;
- }
-
- byte[] data = System.IO.File.ReadAllBytes(file);
- if (dataString.StartsWith("HUBM")) {
- int length = data.Length;
- result.data = data;
- result.header = ReadBytes(data, 0, 16);
-
- // bytes 7 and 8 are pointers to the next available memory slot
- byte[] nextSlotBytes = ReadBytes(data, 6, 8);
- result.nextSlot = BitConverter.ToUInt16(nextSlotBytes, 0);
- result.nextSlot -= 32768; // remove the offset of 0x8000 to get the number we actually want
- result.freeSpace = 2048 - result.nextSlot;
-
- int nextSaveIndex = 16;
- int nextLength = BitConverter.ToInt16(data, nextSaveIndex);
-
- // loop through saves until reaching a file that is 0 bytes long (no file)
- while (nextLength != 0) {
- BRAMEntry newEntry = new BRAMEntry();
-
- newEntry.length = nextLength;
- newEntry.data = ReadBytes(data, nextSaveIndex, nextSaveIndex + nextLength);
- //newEntry.name = System.Text.Encoding.UTF8.GetString(ReadBytes(data, nextSaveIndex + 6, nextSaveIndex + 16));
- newEntry.name = DecodeBytes(ReadBytes(data, nextSaveIndex + 6, nextSaveIndex + 16));
- newEntry.startsAt = nextSaveIndex;
-
- result.saves.Add(newEntry);
- nextSaveIndex += nextLength;
- nextLength = BitConverter.ToInt16(data, nextSaveIndex);
- }
-
- result.loaded = true;
- }
- else {
- MessageBox.Show("File is not a valid BRAM file.");
- }
-
- return result;
- }
-
- // Saves the BRAM file to a given path
- public bool SaveFile(ref BRAM bram, string path) {
- if (path.Length > 0) {
- byte[] outputData = new byte[2048];
-
- // create new data array
- WriteBytes(bram.header, outputData, 0, 16);
- int index = 16;
- foreach (BRAMEntry entry in bram.saves) {
- WriteBytes(entry.data, outputData, index, entry.length);
- index += entry.length;
- }
-
- // calculate new next slot pointer
- int nextSlot = index;
- byte[] nextSlotBytes = new byte[2];
- nextSlot += 32768;
- nextSlotBytes = BitConverter.GetBytes(nextSlot);
- WriteBytes(nextSlotBytes, outputData, 6, 2);
-
- File.WriteAllBytes(path, outputData);
- bram.edited = false;
-
- return true;
- }
- return false;
- }
-
- // Swaps item positions in a list
- public void SwapListItems(List list, int indexA, int indexB) {
- T temp = list[indexA];
- list[indexA] = list[indexB];
- list[indexB] = temp;
- }
-
- // Swaps item positions in a list box
- public void SwapListItems(ListBox.ObjectCollection list, int indexA, int indexB) {
- object temp = list[indexA];
- list[indexA] = list[indexB];
- list[indexB] = temp;
- }
-
- // Full file opening process, given a path
- public void OpenAndLoadFile(string path, ref BRAM bram, ref ListBox list, ref TextBox textBox, ref Label label) {
- BRAM newBRAM = ReadFile(path);
-
- if (newBRAM.loaded) {
- bram = newBRAM;
-
- list.Items.Clear();
-
- foreach (BRAMEntry entry in bram.saves) {
- list.Items.Add(String.Format("{0} ({1}B)", entry.name, entry.length));
- }
-
- textBox.Text = path;
- label.Text = String.Format("Free: {0}B", bram.freeSpace);
- }
- }
-
- // Opens a file to a free BRAM slot
- public void QuickOpen(string path) {
- if (!leftBRAM.loaded) {
- OpenAndLoadFile(path, ref leftBRAM, ref LeftList, ref LeftAddress, ref LeftFreeSpace);
- }
- else if (!rightBRAM.loaded) {
- OpenAndLoadFile(path, ref rightBRAM, ref RightList, ref RightAddress, ref RightFreeSpace);
- }
- }
-
- //--------------------------------------------------
- // GUI Interactions
- //--------------------------------------------------
-
- // Main interface
-
- private void LeftBrowse_Click(object sender, EventArgs e) {
- string openPath = LeftAddress.Text.Length > 0 ? Path.GetDirectoryName(LeftAddress.Text) : savedInitialDirectory;
- string path = OpenFileBrowser(openPath);
- if (path.Length == 0)
- return;
-
- OpenAndLoadFile(path, ref leftBRAM, ref LeftList, ref LeftAddress, ref LeftFreeSpace);
- }
-
- private void RightBrowse_Click(object sender, EventArgs e) {
- string openPath = RightAddress.Text.Length > 0 ? Path.GetDirectoryName(RightAddress.Text) : savedInitialDirectory;
- string path = OpenFileBrowser(openPath);
- if (path.Length == 0)
- return;
-
- OpenAndLoadFile(path, ref rightBRAM, ref RightList, ref RightAddress, ref RightFreeSpace);
- }
-
- private void LeftSave_Click(object sender, EventArgs e) {
- if (leftBRAM.loaded) {
- SaveFile(ref leftBRAM, SaveFileBrowser(Path.GetDirectoryName(LeftAddress.Text), Path.GetFileName(LeftAddress.Text)));
- LeftEdited.Visible = leftBRAM.edited;
- }
- }
-
- private void RightSave_Click(object sender, EventArgs e) {
- if (rightBRAM.loaded) {
- SaveFile(ref rightBRAM, SaveFileBrowser(Path.GetDirectoryName(RightAddress.Text), Path.GetFileName(RightAddress.Text)));
- RightEdited.Visible = rightBRAM.edited;
- }
- }
-
- private void DeleteButton_Click(object sender, EventArgs e) {
- ref BRAM selectedBRAM = ref leftBRAM;
- ref ListBox selectedList = ref LeftList;
- if (LeftList.SelectedIndex >= 0) {
- selectedBRAM = ref leftBRAM;
- selectedList = ref LeftList;
- }
- else if (RightList.SelectedIndex >= 0) {
- selectedBRAM = ref rightBRAM;
- selectedList = ref RightList;
- }
- else {
- MessageBox.Show("Please select a file to delete.");
- return;
- }
-
- int index = selectedList.SelectedIndex;
- selectedBRAM.freeSpace += selectedBRAM.saves[index].length;
- selectedBRAM.edited = true;
-
- LeftEdited.Visible = leftBRAM.edited;
- RightEdited.Visible = rightBRAM.edited;
-
- selectedBRAM.saves.RemoveAt(index);
- selectedList.Items.RemoveAt(index);
-
- if (leftBRAM.loaded)
- LeftFreeSpace.Text = String.Format("Free: {0}B", leftBRAM.freeSpace);
- if (rightBRAM.loaded)
- RightFreeSpace.Text = String.Format("Free: {0}B", rightBRAM.freeSpace);
-
- if (selectedList.Items.Count > index) {
- selectedList.SelectedIndex = index;
- }
-
- else {
- selectedList.SelectedIndex = selectedList.Items.Count - 1;
- }
- }
-
- private void CopyButton_Click(object sender, EventArgs e) {
- if (!(leftBRAM.loaded && rightBRAM.loaded)) {
- MessageBox.Show("Please load two BRAM files.");
- return;
- }
-
- ref BRAM selectedBRAM = ref leftBRAM;
- ref BRAM otherBRAM = ref rightBRAM;
- ListBox selectedList = new ListBox();
- ListBox otherList = new ListBox();
- if (LeftList.SelectedIndex >= 0) {
- selectedList = LeftList;
- otherList = RightList;
- }
- else if (RightList.SelectedIndex >= 0) {
- selectedBRAM = ref rightBRAM;
- otherBRAM = ref leftBRAM;
- selectedList = RightList;
- otherList = LeftList;
- }
- else {
- MessageBox.Show("Please select a file to copy.");
- return;
- }
-
- BRAMEntry entry = selectedBRAM.saves[selectedList.SelectedIndex];
- if (otherBRAM.freeSpace < entry.length) {
- MessageBox.Show("Not enough space in destination BRAM.");
- return;
- }
-
- foreach (BRAMEntry otherEntry in otherBRAM.saves) {
- if (otherEntry.name == entry.name) {
- if (MessageBox.Show("Filename already exists, which can cause issues. Are you sure you want to copy?", "", MessageBoxButtons.YesNo) == DialogResult.No) {
- return;
- }
- }
- }
-
- otherBRAM.saves.Add(entry);
- otherList.Items.Add(String.Format("{0} ({1}B)", entry.name, entry.length));
- otherBRAM.freeSpace -= entry.length;
- otherBRAM.edited = true;
- LeftEdited.Visible = leftBRAM.edited;
- RightEdited.Visible = rightBRAM.edited;
-
- LeftFreeSpace.Text = String.Format("Free: {0}B", leftBRAM.freeSpace);
- RightFreeSpace.Text = String.Format("Free: {0}B", rightBRAM.freeSpace);
- }
-
- private void UpButton_Click(object sender, EventArgs e) {
- ref BRAM selectedBRAM = ref leftBRAM;
- ref ListBox selectedList = ref LeftList;
- if (LeftList.SelectedIndex >= 0) {
- selectedBRAM = ref leftBRAM;
- selectedList = ref LeftList;
- }
- else if (RightList.SelectedIndex >= 0) {
- selectedBRAM = ref rightBRAM;
- selectedList = ref RightList;
- }
- else {
- MessageBox.Show("Please select a file to move.");
- return;
- }
-
- int index = selectedList.SelectedIndex;
- if (index > 0) {
- SwapListItems(selectedBRAM.saves, index, index - 1);
- SwapListItems(selectedList.Items, index, index - 1);
- selectedList.SelectedIndex--;
- selectedBRAM.edited = true;
- LeftEdited.Visible = leftBRAM.edited;
- RightEdited.Visible = rightBRAM.edited;
- }
- }
-
- private void DownButton_Click(object sender, EventArgs e) {
- ref BRAM selectedBRAM = ref leftBRAM;
- ref ListBox selectedList = ref LeftList;
- if (LeftList.SelectedIndex >= 0) {
- selectedBRAM = ref leftBRAM;
- selectedList = ref LeftList;
- }
- else if (RightList.SelectedIndex >= 0) {
- selectedBRAM = ref rightBRAM;
- selectedList = ref RightList;
- }
- else {
- MessageBox.Show("Please select a file to move.");
- return;
- }
-
- int index = selectedList.SelectedIndex;
- if (index < selectedList.Items.Count - 1) {
- SwapListItems(selectedBRAM.saves, index, index + 1);
- SwapListItems(selectedList.Items, index, index + 1);
- selectedList.SelectedIndex++;
- selectedBRAM.edited = true;
- LeftEdited.Visible = leftBRAM.edited;
- RightEdited.Visible = rightBRAM.edited;
- }
- }
-
- // Toolbar
-
- private void newBRAMToolStripMenuItem_Click(object sender, EventArgs e) {
- byte[] newFileBytes = new byte[] { 0x48, 0x55, 0x42, 0x4D, 0x00, 0x88, 0x10, 0x80 };
- byte[] newFile = new byte[2048];
-
- WriteBytes(newFileBytes, newFile, 0, 8);
- string newFilePath = SaveFileBrowser();
- if (newFilePath.Length > 0) {
- File.WriteAllBytes(newFilePath, newFile);
-
- QuickOpen(newFilePath);
- }
- }
-
- private void mergeMultipleToolStripMenuItem_Click(object sender, EventArgs e) {
- string openPath = savedInitialDirectory;
- string[] path = OpenMultiFileBrowser(openPath);
- if (path.Length == 0)
- return;
-
- BRAM_Merge mergeForm = new BRAM_Merge();
- mergeForm.InitialiseForm(this, path);
- mergeForm.StartPosition = FormStartPosition.Manual;
- mergeForm.Left = this.Left;
- mergeForm.Top = this.Top;
- mergeForm.Show();
- }
-
- private void clearAllToolStripMenuItem_Click(object sender, EventArgs e) {
- if (leftBRAM.edited || rightBRAM.edited) {
- if (MessageBox.Show("There are unsaved changes. Are you sure you want to clear?", "", MessageBoxButtons.YesNo) == DialogResult.No) {
- return;
- }
- }
- leftBRAM = new BRAM();
- rightBRAM = new BRAM();
- LeftList.Items.Clear();
- RightList.Items.Clear();
- LeftAddress.Text = "";
- RightAddress.Text = "";
- LeftFreeSpace.Text = "";
- RightFreeSpace.Text = "";
- LeftEdited.Visible = false;
- RightEdited.Visible = false;
- }
-
- // Misc
-
- // Ensuring only one list has a selected item at a time
- private void LeftList_SelectedIndexChanged(object sender, EventArgs e) {
- if (LeftList.Focused)
- RightList.ClearSelected();
- }
-
- private void RightList_SelectedIndexChanged(object sender, EventArgs e) {
- if (RightList.Focused)
- LeftList.ClearSelected();
- }
-
- private void MainForm_FormClosing(object sender, FormClosingEventArgs e) {
- if (leftBRAM.edited || rightBRAM.edited) {
- if (MessageBox.Show("There are unsaved changes. Are you sure you want to quit?", "", MessageBoxButtons.YesNo) == DialogResult.No ){
- e.Cancel = true;
- }
- }
- }
- }
+
+ // Primary struct for all BRAM information
+ public struct BRAM
+ {
+ public BRAM() {
+ byte[] newData = new byte[ByteFuncLib.maxBRAMSize];
+ ByteFuncLib.WriteBytes(ByteFuncLib.newFileBytes, newData, 0, ByteFuncLib.newFileBytes.Length);
+ data = newData;
+
+ byte[] newHeader = new byte[ByteFuncLib.headerSize];
+ ByteFuncLib.WriteBytes(ByteFuncLib.newFileBytes, newHeader, 0, ByteFuncLib.newFileBytes.Length);
+ header = newHeader;
+
+ saves = new List();
+ nextSlot = ByteFuncLib.headerSize;
+ freeSpace = ByteFuncLib.maxBRAMSize - ByteFuncLib.headerSize;
+ loaded = true;
+ }
+
+ public byte[] data; // Entire 2048-byte set of data for the BRAM
+ public byte[] header; // BRAM header
+ public List saves; // Each save file, including save header
+ public int nextSlot; // The next available slot that can be saved in
+ public int freeSpace; // How much free space is left in the BRAM in bytes
+ public bool loaded; // Whether or not the file has been loaded
+ public bool edited; // Weather or not the file has been edited
+ }
+
+ // Data required for a BRAM entry
+ public struct BRAMEntry
+ {
+ public byte[] data; // Entire set of data for the save data
+ public string name; // Name of the save file
+ public int length; // Total length of the save file
+ public int startsAt; // Which byte in the BRAM does this file start at
+ }
+
+ public partial class MainForm : Form {
+ public BRAM leftBRAM, rightBRAM;
+
+ public MainForm() {
+ InitializeComponent();
+
+ leftBRAM = new BRAM();
+ rightBRAM = new BRAM();
+
+ disableWarningsToolStripMenuItem.Checked = Properties.Settings.Default.disablePopups;
+ GuiFuncLib.savedInitialDirectory = Properties.Settings.Default.savedInitialDirectory;
+ }
+
+ //--------------------------------------------------
+ // Main functions
+ //--------------------------------------------------
+
+ // Custom data handling ----------------------------
+
+ // Opens a file to a free BRAM slot
+ public void QuickOpen(string path) {
+ if (!leftBRAM.loaded) {
+ DataFuncLib.OpenAndLoadFile(path, ref leftBRAM, ref LeftList, ref LeftAddress, ref LeftFreeSpace);
+ }
+ else if (!rightBRAM.loaded) {
+ DataFuncLib.OpenAndLoadFile(path, ref rightBRAM, ref RightList, ref RightAddress, ref RightFreeSpace);
+ }
+ }
+
+ // Copies a save file from one BRAM to another
+ public void CopyEntry(ref BRAM sourceBRAM, ref BRAM targetBRAM, ref ListBox targetList, int index) {
+ DataFuncLib.CopyEntry(ref sourceBRAM, ref targetBRAM, ref targetList, index);
+
+ LeftEdited.Visible = leftBRAM.edited;
+ RightEdited.Visible = rightBRAM.edited;
+
+ LeftFreeSpace.Text = String.Format("Free: {0}B", leftBRAM.freeSpace);
+ RightFreeSpace.Text = String.Format("Free: {0}B", rightBRAM.freeSpace);
+ }
+
+ // Deletes a save file entry from a BRAM
+ public void DeleteEntry(ref BRAM bram, ref ListBox list, int index) {
+ DataFuncLib.DeleteEntry(ref bram, ref list, index);
+
+ LeftEdited.Visible = leftBRAM.edited;
+ RightEdited.Visible = rightBRAM.edited;
+
+ if (leftBRAM.loaded)
+ LeftFreeSpace.Text = String.Format("Free: {0}B", leftBRAM.freeSpace);
+ if (rightBRAM.loaded)
+ RightFreeSpace.Text = String.Format("Free: {0}B", rightBRAM.freeSpace);
+ }
+
+ public void MoveEntry(ref BRAM bram, ref ListBox list, int index, int direction) {
+ DataFuncLib.MoveEntry(ref bram, ref list, index, direction);
+
+ LeftEdited.Visible = leftBRAM.edited;
+ RightEdited.Visible = rightBRAM.edited;
+ }
+
+ public void ClearAllBRAMs() {
+ leftBRAM = new BRAM();
+ rightBRAM = new BRAM();
+ LeftList.Items.Clear();
+ RightList.Items.Clear();
+ LeftAddress.Text = "";
+ RightAddress.Text = "";
+ LeftFreeSpace.Text = "";
+ RightFreeSpace.Text = "";
+ LeftEdited.Visible = false;
+ RightEdited.Visible = false;
+ }
+
+ //--------------------------------------------------
+ // GUI Interactions
+ //--------------------------------------------------
+
+ // Main interface
+ private void LeftBrowse_Click(object sender, EventArgs e) {
+ string openPath = LeftAddress.Text.Length > 0 ? Path.GetDirectoryName(LeftAddress.Text) : GuiFuncLib.savedInitialDirectory;
+ string path = GuiFuncLib.OpenFileBrowser(openPath);
+ if (path.Length == 0)
+ return;
+
+ if (leftBRAM.edited) {
+ if (GuiFuncLib.WarningPopup("There are unsaved changes. Are you sure you want to load?")) {
+ return;
+ }
+ }
+
+ if (DataFuncLib.OpenAndLoadFile(path, ref leftBRAM, ref LeftList, ref LeftAddress, ref LeftFreeSpace))
+ LeftEdited.Visible = false;
+ }
+
+ private void RightBrowse_Click(object sender, EventArgs e) {
+ string openPath = RightAddress.Text.Length > 0 ? Path.GetDirectoryName(RightAddress.Text) : GuiFuncLib.savedInitialDirectory;
+ string path = GuiFuncLib.OpenFileBrowser(openPath);
+ if (path.Length == 0)
+ return;
+
+ if (rightBRAM.edited) {
+ if (GuiFuncLib.WarningPopup("There are unsaved changes. Are you sure you want to load?")) {
+ return;
+ }
+ }
+
+ if (DataFuncLib.OpenAndLoadFile(path, ref rightBRAM, ref RightList, ref RightAddress, ref RightFreeSpace))
+ RightEdited.Visible = false;
+ }
+
+ private void LeftSave_Click(object sender, EventArgs e) {
+ if (leftBRAM.loaded) {
+ string directory = Directory.Exists(LeftAddress.Text) ? Path.GetDirectoryName(LeftAddress.Text) : GuiFuncLib.savedInitialDirectory;
+ string fileName = Directory.Exists(LeftAddress.Text) ? Path.GetFileName(LeftAddress.Text) : "";
+
+ string saveLocation = GuiFuncLib.SaveFileBrowser(directory, fileName);
+ DataFuncLib.SaveFile(ref leftBRAM, saveLocation);
+ LeftAddress.Text = saveLocation;
+ LeftEdited.Visible = leftBRAM.edited;
+ }
+ }
+
+ private void RightSave_Click(object sender, EventArgs e) {
+ if (rightBRAM.loaded) {
+ string directory = Directory.Exists(RightAddress.Text) ? Path.GetDirectoryName(RightAddress.Text) : GuiFuncLib.savedInitialDirectory;
+ string fileName = Directory.Exists(RightAddress.Text) ? Path.GetFileName(RightAddress.Text) : "";
+
+ string saveLocation = GuiFuncLib.SaveFileBrowser(directory, fileName);
+ DataFuncLib.SaveFile(ref rightBRAM, saveLocation);
+ RightAddress.Text = saveLocation;
+ RightEdited.Visible = rightBRAM.edited;
+ }
+ }
+
+ private void DeleteButton_Click(object sender, EventArgs e) {
+ ref BRAM selectedBRAM = ref leftBRAM;
+ ref ListBox selectedList = ref LeftList;
+ if (LeftList.SelectedIndex >= 0) {
+ selectedBRAM = ref leftBRAM;
+ selectedList = ref LeftList;
+ }
+ else if (RightList.SelectedIndex >= 0) {
+ selectedBRAM = ref rightBRAM;
+ selectedList = ref RightList;
+ }
+ else {
+ MessageBox.Show("Please select a file to delete.");
+ return;
+ }
+
+ int index = selectedList.SelectedIndex;
+ DeleteEntry(ref selectedBRAM, ref selectedList, index);
+ }
+
+ private void CopyButton_Click(object sender, EventArgs e) {
+ if (!(leftBRAM.loaded && rightBRAM.loaded)) {
+ MessageBox.Show("Please load two BRAM files.");
+ return;
+ }
+
+ ref BRAM selectedBRAM = ref leftBRAM;
+ ref BRAM otherBRAM = ref rightBRAM;
+ ListBox selectedList = new ListBox();
+ ListBox otherList = new ListBox();
+ if (LeftList.SelectedIndex >= 0) {
+ selectedList = LeftList;
+ otherList = RightList;
+ }
+ else if (RightList.SelectedIndex >= 0) {
+ selectedBRAM = ref rightBRAM;
+ otherBRAM = ref leftBRAM;
+ selectedList = RightList;
+ otherList = LeftList;
+ }
+ else {
+ MessageBox.Show("Please select a file to copy.");
+ return;
+ }
+
+ CopyEntry(ref selectedBRAM, ref otherBRAM, ref otherList, selectedList.SelectedIndex);
+ }
+
+ private void UpButton_Click(object sender, EventArgs e) {
+ ref BRAM selectedBRAM = ref leftBRAM;
+ ref ListBox selectedList = ref LeftList;
+ if (LeftList.SelectedIndex >= 0) {
+ selectedBRAM = ref leftBRAM;
+ selectedList = ref LeftList;
+ }
+ else if (RightList.SelectedIndex >= 0) {
+ selectedBRAM = ref rightBRAM;
+ selectedList = ref RightList;
+ }
+ else {
+ MessageBox.Show("Please select a file to move.");
+ return;
+ }
+
+ int index = selectedList.SelectedIndex;
+ MoveEntry(ref selectedBRAM, ref selectedList, index, -1);
+ }
+
+ private void DownButton_Click(object sender, EventArgs e) {
+ ref BRAM selectedBRAM = ref leftBRAM;
+ ref ListBox selectedList = ref LeftList;
+ if (LeftList.SelectedIndex >= 0) {
+ selectedBRAM = ref leftBRAM;
+ selectedList = ref LeftList;
+ }
+ else if (RightList.SelectedIndex >= 0) {
+ selectedBRAM = ref rightBRAM;
+ selectedList = ref RightList;
+ }
+ else {
+ MessageBox.Show("Please select a file to move.");
+ return;
+ }
+
+ int index = selectedList.SelectedIndex;
+ MoveEntry(ref selectedBRAM, ref selectedList, index, 1);
+ }
+
+ // Toolbar --------------------
+
+ // Create new file
+ private void newBRAMToolStripMenuItem_Click(object sender, EventArgs e) {
+ if (!leftBRAM.loaded) {
+
+ }
+ }
+
+ // Open merge tool
+ private void mergeMultipleToolStripMenuItem_Click(object sender, EventArgs e) {
+ string openPath = GuiFuncLib.savedInitialDirectory;
+ string[] path = GuiFuncLib.OpenMultiFileBrowser(openPath);
+ if (path.Length == 0)
+ return;
+
+ BRAM_Merge mergeForm = new BRAM_Merge();
+ mergeForm.InitialiseForm(this, path);
+ mergeForm.StartPosition = FormStartPosition.Manual;
+ mergeForm.Left = this.Left;
+ mergeForm.Top = this.Top;
+ mergeForm.Show(this);
+ }
+
+ private void mergeFromFoldersToolStripMenuItem_Click(object sender, EventArgs e) {
+ string openPath = GuiFuncLib.savedInitialDirectory;
+ IEnumerable paths = GuiFuncLib.OpenMultiFolderBrowser(openPath);
+ if (paths.Count() == 0)
+ return;
+
+ BRAM_Merge mergeForm = new BRAM_Merge();
+ mergeForm.InitialiseForm(this, paths);
+ mergeForm.StartPosition = FormStartPosition.Manual;
+ mergeForm.Left = this.Left;
+ mergeForm.Top = this.Top;
+ mergeForm.Show(this);
+ }
+
+ // Unload both BRAM slots
+ private void clearAllToolStripMenuItem_Click(object sender, EventArgs e) {
+ if (leftBRAM.edited || rightBRAM.edited) {
+ if (GuiFuncLib.WarningPopup("There are unsaved changes. Are you sure you want to clear?")) {
+ return;
+ }
+ }
+
+ ClearAllBRAMs();
+ }
+
+ // Toggle disable warnings option
+ private void disableWarningsToolStripMenuItem_CheckedChanged(object sender, EventArgs e) {
+ Properties.Settings.Default.disablePopups = disableWarningsToolStripMenuItem.Checked;
+ Properties.Settings.Default.Save();
+ }
+
+ // Open the transfer tool
+ private void transferToolToolStripMenuItem_Click(object sender, EventArgs e) {
+ TransferTool transferForm = new TransferTool();
+ transferForm.StartPosition = FormStartPosition.Manual;
+ transferForm.Left = this.Left;
+ transferForm.Top = this.Top;
+ transferForm.Show(this);
+ }
+
+ private void aboutToolStripMenuItem_Click(object sender, EventArgs e) {
+ About aboutForm = new About();
+ aboutForm.StartPosition = FormStartPosition.Manual;
+ aboutForm.Left = this.Left;
+ aboutForm.Top = this.Top;
+ aboutForm.Show(this);
+ }
+
+ // Misc --------------------
+
+ // Ensuring only one list has a selected item at a time
+ private void LeftList_SelectedIndexChanged(object sender, EventArgs e) {
+ if (LeftList.Focused)
+ RightList.ClearSelected();
+ }
+
+ private void RightList_SelectedIndexChanged(object sender, EventArgs e) {
+ if (RightList.Focused)
+ LeftList.ClearSelected();
+ }
+
+ // Drag and drop ----------
+ private void LeftList_DragEnter(object sender, DragEventArgs e)
+ {
+ if (e.Data.GetDataPresent(DataFormats.FileDrop))
+ e.Effect = DragDropEffects.All;
+ else
+ e.Effect = DragDropEffects.None;
+ }
+
+ private void LeftList_DragDrop(object sender, DragEventArgs e)
+ {
+ string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false);
+ if (s.Length > 0)
+ {
+ if (leftBRAM.edited) {
+ if (GuiFuncLib.WarningPopup("There are unsaved changes. Are you sure you want to load?")) {
+ return;
+ }
+ }
+
+ if (DataFuncLib.OpenAndLoadFile(s[0], ref leftBRAM, ref LeftList, ref LeftAddress, ref LeftFreeSpace))
+ LeftEdited.Visible = false;
+ }
+ }
+
+ private void RightList_DragEnter(object sender, DragEventArgs e)
+ {
+ if (e.Data.GetDataPresent(DataFormats.FileDrop))
+ e.Effect = DragDropEffects.All;
+ else
+ e.Effect = DragDropEffects.None;
+ }
+
+ private void RightList_DragDrop(object sender, DragEventArgs e)
+ {
+ string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false);
+ if (s.Length > 0)
+ {
+ if (rightBRAM.edited) {
+ if (GuiFuncLib.WarningPopup("There are unsaved changes. Are you sure you want to load?")) {
+ return;
+ }
+ }
+
+ if (DataFuncLib.OpenAndLoadFile(s[0], ref rightBRAM, ref RightList, ref RightAddress, ref RightFreeSpace))
+ RightEdited.Visible = false;
+ }
+ }
+
+ // Confirm close if there are unsaved changes
+ private void MainForm_FormClosing(object sender, FormClosingEventArgs e) {
+ if (leftBRAM.edited || rightBRAM.edited) {
+ if (GuiFuncLib.WarningPopup("There are unsaved changes. Are you sure you want to quit?")){
+ e.Cancel = true;
+ }
+ }
+ }
+ }
}
diff --git a/BRAM_Manager/MainForm.resx b/BRAM_Manager/MainForm.resx
index 44eaf00..7517cfc 100644
--- a/BRAM_Manager/MainForm.resx
+++ b/BRAM_Manager/MainForm.resx
@@ -120,6 +120,9 @@
17, 17
+
+ 132, 17
+
diff --git a/BRAM_Manager/Properties/AssemblyInfo.cs b/BRAM_Manager/Properties/AssemblyInfo.cs
index 04d6e71..413af17 100644
--- a/BRAM_Manager/Properties/AssemblyInfo.cs
+++ b/BRAM_Manager/Properties/AssemblyInfo.cs
@@ -5,11 +5,11 @@
// 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("BRAM_Manager")]
-[assembly: AssemblyDescription("")]
+[assembly: AssemblyTitle("PCE BRAM Manager")]
+[assembly: AssemblyDescription("PC Engine/TurboGrafx BRAM Save Data Manager")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("BRAM_Manager")]
+[assembly: AssemblyCompany("wid")]
+[assembly: AssemblyProduct("PCE BRAM Manager")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("1.03")]
+[assembly: AssemblyFileVersion("1.03")]
diff --git a/BRAM_Manager/Properties/Resources.Designer.cs b/BRAM_Manager/Properties/Resources.Designer.cs
index 86183ed..0e538ed 100644
--- a/BRAM_Manager/Properties/Resources.Designer.cs
+++ b/BRAM_Manager/Properties/Resources.Designer.cs
@@ -9,8 +9,9 @@
//------------------------------------------------------------------------------
namespace BRAM_Manager.Properties {
-
-
+ using System;
+
+
///
/// A strongly-typed resource class, for looking up localized strings, etc.
///
@@ -18,33 +19,33 @@ namespace BRAM_Manager.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
-
+
private static global::System.Resources.ResourceManager resourceMan;
-
+
private static global::System.Globalization.CultureInfo resourceCulture;
-
+
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
-
+
///
/// Returns the cached ResourceManager instance used by this class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
- if ((resourceMan == null)) {
+ if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BRAM_Manager.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
-
+
///
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
@@ -58,5 +59,15 @@ internal class Resources {
resourceCulture = value;
}
}
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap icon {
+ get {
+ object obj = ResourceManager.GetObject("icon", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
}
}
diff --git a/BRAM_Manager/Properties/Resources.resx b/BRAM_Manager/Properties/Resources.resx
index af7dbeb..ac34357 100644
--- a/BRAM_Manager/Properties/Resources.resx
+++ b/BRAM_Manager/Properties/Resources.resx
@@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
- : System.Serialization.Formatters.Binary.BinaryFormatter
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
+
@@ -68,9 +69,10 @@
-
+
+
@@ -85,9 +87,10 @@
-
+
+
@@ -109,9 +112,13 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ ..\Resources\icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/BRAM_Manager/Properties/Settings.Designer.cs b/BRAM_Manager/Properties/Settings.Designer.cs
index 6c5000f..44442b0 100644
--- a/BRAM_Manager/Properties/Settings.Designer.cs
+++ b/BRAM_Manager/Properties/Settings.Designer.cs
@@ -12,7 +12,7 @@ namespace BRAM_Manager.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@@ -34,5 +34,17 @@ internal sealed partial class Settings : global::System.Configuration.Applicatio
this["savedInitialDirectory"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]
+ public bool disablePopups {
+ get {
+ return ((bool)(this["disablePopups"]));
+ }
+ set {
+ this["disablePopups"] = value;
+ }
+ }
}
}
diff --git a/BRAM_Manager/Properties/Settings.settings b/BRAM_Manager/Properties/Settings.settings
index f18ffaa..10fb911 100644
--- a/BRAM_Manager/Properties/Settings.settings
+++ b/BRAM_Manager/Properties/Settings.settings
@@ -5,5 +5,8 @@
c:\\
+
+ False
+
\ No newline at end of file
diff --git a/BRAM_Manager/Resources/icon.png b/BRAM_Manager/Resources/icon.png
new file mode 100644
index 0000000..70f7559
Binary files /dev/null and b/BRAM_Manager/Resources/icon.png differ
diff --git a/BRAM_Manager/TransferTool.Designer.cs b/BRAM_Manager/TransferTool.Designer.cs
new file mode 100644
index 0000000..a44f49e
--- /dev/null
+++ b/BRAM_Manager/TransferTool.Designer.cs
@@ -0,0 +1,227 @@
+namespace BRAM_Manager
+{
+ partial class TransferTool
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.components = new System.ComponentModel.Container();
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TransferTool));
+ this.SourceDirectoryText = new System.Windows.Forms.TextBox();
+ this.DestinationDirectoryText = new System.Windows.Forms.TextBox();
+ this.GameDirectoryText = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.GameDirectoryLabel = new System.Windows.Forms.Label();
+ this.BrowseSourceDirectory = new System.Windows.Forms.Button();
+ this.BrowseDestinationDirectory = new System.Windows.Forms.Button();
+ this.TransferButton = new System.Windows.Forms.Button();
+ this.label4 = new System.Windows.Forms.Label();
+ this.Tooltip1 = new System.Windows.Forms.ToolTip(this.components);
+ this.BrowseGameDirectory = new System.Windows.Forms.Button();
+ this.SourceTypeComboBox = new System.Windows.Forms.ComboBox();
+ this.DestinationTypeComboBox = new System.Windows.Forms.ComboBox();
+ this.SuspendLayout();
+ //
+ // SourceDirectoryText
+ //
+ this.SourceDirectoryText.Location = new System.Drawing.Point(124, 12);
+ this.SourceDirectoryText.Name = "SourceDirectoryText";
+ this.SourceDirectoryText.Size = new System.Drawing.Size(274, 20);
+ this.SourceDirectoryText.TabIndex = 0;
+ this.Tooltip1.SetToolTip(this.SourceDirectoryText, "Folder where all your save files are stored.\r\nWill be \"bup\" for SSDS3, \"gamedata\"" +
+ " for Everdrive\r\nand \"sav\" for Mednafen.");
+ //
+ // DestinationDirectoryText
+ //
+ this.DestinationDirectoryText.Location = new System.Drawing.Point(124, 38);
+ this.DestinationDirectoryText.Name = "DestinationDirectoryText";
+ this.DestinationDirectoryText.Size = new System.Drawing.Size(274, 20);
+ this.DestinationDirectoryText.TabIndex = 2;
+ this.Tooltip1.SetToolTip(this.DestinationDirectoryText, "Where you want to copy the save files");
+ //
+ // GameDirectoryText
+ //
+ this.GameDirectoryText.Enabled = false;
+ this.GameDirectoryText.Location = new System.Drawing.Point(124, 64);
+ this.GameDirectoryText.Name = "GameDirectoryText";
+ this.GameDirectoryText.Size = new System.Drawing.Size(274, 20);
+ this.GameDirectoryText.TabIndex = 4;
+ this.Tooltip1.SetToolTip(this.GameDirectoryText, "When transferring to Everdrive, this directory will be used to determine the game" +
+ "\'s file extension which the Everdrive needs to load the data.");
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(13, 13);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(86, 13);
+ this.label1.TabIndex = 3;
+ this.label1.Text = "Source Directory";
+ this.Tooltip1.SetToolTip(this.label1, "Folder where all your save files are stored.\r\nWill be \"bup\" for SSDS3, \"gamedata\"" +
+ " for Everdrive\r\nand \"sav\" for Mednafen.");
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(13, 41);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(105, 13);
+ this.label2.TabIndex = 4;
+ this.label2.Text = "Destination Directory";
+ this.Tooltip1.SetToolTip(this.label2, "Where you want to copy the save files");
+ //
+ // GameDirectoryLabel
+ //
+ this.GameDirectoryLabel.AutoSize = true;
+ this.GameDirectoryLabel.Location = new System.Drawing.Point(13, 67);
+ this.GameDirectoryLabel.Name = "GameDirectoryLabel";
+ this.GameDirectoryLabel.Size = new System.Drawing.Size(80, 13);
+ this.GameDirectoryLabel.TabIndex = 5;
+ this.GameDirectoryLabel.Text = "Game Directory";
+ this.Tooltip1.SetToolTip(this.GameDirectoryLabel, "When transferring to Everdrive, this directory will be used to determine the game" +
+ "\'s file extension which the Everdrive needs to load the data.");
+ //
+ // BrowseSourceDirectory
+ //
+ this.BrowseSourceDirectory.Location = new System.Drawing.Point(404, 10);
+ this.BrowseSourceDirectory.Name = "BrowseSourceDirectory";
+ this.BrowseSourceDirectory.Size = new System.Drawing.Size(26, 23);
+ this.BrowseSourceDirectory.TabIndex = 1;
+ this.BrowseSourceDirectory.Text = "...";
+ this.Tooltip1.SetToolTip(this.BrowseSourceDirectory, "Browse...");
+ this.BrowseSourceDirectory.UseVisualStyleBackColor = true;
+ this.BrowseSourceDirectory.Click += new System.EventHandler(this.BrowseSourceDirectory_Click);
+ //
+ // BrowseDestinationDirectory
+ //
+ this.BrowseDestinationDirectory.Location = new System.Drawing.Point(404, 36);
+ this.BrowseDestinationDirectory.Name = "BrowseDestinationDirectory";
+ this.BrowseDestinationDirectory.Size = new System.Drawing.Size(26, 23);
+ this.BrowseDestinationDirectory.TabIndex = 3;
+ this.BrowseDestinationDirectory.Text = "...";
+ this.Tooltip1.SetToolTip(this.BrowseDestinationDirectory, "Browse...");
+ this.BrowseDestinationDirectory.UseVisualStyleBackColor = true;
+ this.BrowseDestinationDirectory.Click += new System.EventHandler(this.BrowseDestinationDirectory_Click);
+ //
+ // TransferButton
+ //
+ this.TransferButton.Location = new System.Drawing.Point(404, 88);
+ this.TransferButton.Name = "TransferButton";
+ this.TransferButton.Size = new System.Drawing.Size(119, 23);
+ this.TransferButton.TabIndex = 6;
+ this.TransferButton.Text = "Transfer";
+ this.Tooltip1.SetToolTip(this.TransferButton, "Begin the transfer!");
+ this.TransferButton.UseVisualStyleBackColor = true;
+ this.TransferButton.Click += new System.EventHandler(this.TransferButton_Click);
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(12, 88);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(400, 52);
+ this.label4.TabIndex = 9;
+ this.label4.Text = resources.GetString("label4.Text");
+ //
+ // BrowseGameDirectory
+ //
+ this.BrowseGameDirectory.Location = new System.Drawing.Point(404, 61);
+ this.BrowseGameDirectory.Name = "BrowseGameDirectory";
+ this.BrowseGameDirectory.Size = new System.Drawing.Size(26, 23);
+ this.BrowseGameDirectory.TabIndex = 5;
+ this.BrowseGameDirectory.Text = "...";
+ this.Tooltip1.SetToolTip(this.BrowseGameDirectory, "Browse...");
+ this.BrowseGameDirectory.UseVisualStyleBackColor = true;
+ this.BrowseGameDirectory.Click += new System.EventHandler(this.BrowseGameDirectory_Click);
+ //
+ // SourceTypeComboBox
+ //
+ this.SourceTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.SourceTypeComboBox.FormattingEnabled = true;
+ this.SourceTypeComboBox.Location = new System.Drawing.Point(437, 11);
+ this.SourceTypeComboBox.Name = "SourceTypeComboBox";
+ this.SourceTypeComboBox.Size = new System.Drawing.Size(90, 21);
+ this.SourceTypeComboBox.TabIndex = 10;
+ this.Tooltip1.SetToolTip(this.SourceTypeComboBox, "What format are the source save files in?");
+ this.SourceTypeComboBox.SelectedIndexChanged += new System.EventHandler(this.SourceTypeComboBox_SelectedIndexChanged);
+ //
+ // DestinationTypeComboBox
+ //
+ this.DestinationTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.DestinationTypeComboBox.FormattingEnabled = true;
+ this.DestinationTypeComboBox.Location = new System.Drawing.Point(437, 37);
+ this.DestinationTypeComboBox.Name = "DestinationTypeComboBox";
+ this.DestinationTypeComboBox.Size = new System.Drawing.Size(90, 21);
+ this.DestinationTypeComboBox.TabIndex = 11;
+ this.Tooltip1.SetToolTip(this.DestinationTypeComboBox, "What format do you want to transfer to?");
+ this.DestinationTypeComboBox.SelectedIndexChanged += new System.EventHandler(this.DestinationTypeComboBox_SelectedIndexChanged);
+ //
+ // TransferTool
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(535, 145);
+ this.Controls.Add(this.DestinationTypeComboBox);
+ this.Controls.Add(this.SourceTypeComboBox);
+ this.Controls.Add(this.TransferButton);
+ this.Controls.Add(this.BrowseGameDirectory);
+ this.Controls.Add(this.label4);
+ this.Controls.Add(this.BrowseDestinationDirectory);
+ this.Controls.Add(this.BrowseSourceDirectory);
+ this.Controls.Add(this.GameDirectoryLabel);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.GameDirectoryText);
+ this.Controls.Add(this.DestinationDirectoryText);
+ this.Controls.Add(this.SourceDirectoryText);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "TransferTool";
+ this.ShowInTaskbar = false;
+ this.Text = "Transfer Tool";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TextBox SourceDirectoryText;
+ private System.Windows.Forms.TextBox DestinationDirectoryText;
+ private System.Windows.Forms.TextBox GameDirectoryText;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label GameDirectoryLabel;
+ private System.Windows.Forms.Button BrowseSourceDirectory;
+ private System.Windows.Forms.Button BrowseDestinationDirectory;
+ private System.Windows.Forms.Button TransferButton;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.ToolTip Tooltip1;
+ private System.Windows.Forms.Button BrowseGameDirectory;
+ private System.Windows.Forms.ComboBox SourceTypeComboBox;
+ private System.Windows.Forms.ComboBox DestinationTypeComboBox;
+ }
+}
\ No newline at end of file
diff --git a/BRAM_Manager/TransferTool.cs b/BRAM_Manager/TransferTool.cs
new file mode 100644
index 0000000..530c74b
--- /dev/null
+++ b/BRAM_Manager/TransferTool.cs
@@ -0,0 +1,291 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.IO;
+using System.Linq;
+using System.Windows.Forms;
+
+namespace BRAM_Manager
+{
+ public partial class TransferTool : Form
+ {
+ FolderFormat sourceFormat = FolderFormat.None;
+ FolderFormat destinationFormat = FolderFormat.None;
+ IEnumerable gameDirectoryEnumerator = Enumerable.Empty();
+
+ enum FolderFormat{
+ None,
+ SSDS3,
+ Everdrive,
+ Emulator
+ }
+
+ struct FileData {
+ public string filePath;
+ public string gameName;
+ }
+
+ public TransferTool() {
+ InitializeComponent();
+
+ SourceTypeComboBox.DataSource = Enum.GetValues(typeof(FolderFormat));
+ DestinationTypeComboBox.DataSource = Enum.GetValues(typeof(FolderFormat));
+ }
+
+ // Main functions ----------------------------------
+
+ private FolderFormat CalculateFolderFormat(string directory) {
+ // bup folder means SSDS3
+ if (directory.EndsWith("\\bup")) {
+ return FolderFormat.SSDS3;
+ }
+
+ // gamedata folder means Everdrive
+ if (directory.EndsWith("\\gamedata")) {
+ return FolderFormat.Everdrive;
+ }
+
+ if (directory.EndsWith("\\sav")) {
+ return FolderFormat.Emulator;
+ }
+
+ return FolderFormat.None;
+ }
+
+ private void StartTransfer() {
+ // Find the appropriate files
+ List files = new List();
+ switch (sourceFormat) {
+ case FolderFormat.SSDS3:
+ files = GetSSDS3Files(SourceDirectoryText.Text);
+ break;
+ case FolderFormat.Everdrive:
+ files = GetEverdriveFiles(SourceDirectoryText.Text);
+ break;
+ case FolderFormat.Emulator:
+ files = GetEmulatorFiles(SourceDirectoryText.Text);
+ break;
+ default:
+ break;
+ }
+
+ // Transfer them to the appropriate format
+ switch (destinationFormat) {
+ case FolderFormat.SSDS3:
+ TransferToSSDS3(files, DestinationDirectoryText.Text);
+ break;
+ case FolderFormat.Everdrive:
+ TransferToEverdrive(files, DestinationDirectoryText.Text);
+ break;
+ case FolderFormat.Emulator:
+ TransferToEmulator(files, DestinationDirectoryText.Text);
+ break;
+ default:
+ break;
+ }
+
+ MessageBox.Show("Done!");
+ }
+
+ private List GetSSDS3Files(string directory) {
+ List result = new List();
+
+ // Get all .bup files in the directory
+ foreach (string file in Directory.EnumerateFiles(directory)) {
+ if (file.EndsWith(".bup") && DataFuncLib.IsValidBRAMFile(file)) {
+ FileData newData;
+ newData.filePath = file;
+ newData.gameName = Path.GetFileNameWithoutExtension(file);
+
+ result.Add(newData);
+ }
+ }
+
+ return result;
+ }
+
+ private List GetEverdriveFiles(string directory) {
+ List result = new List();
+
+ // Get all .bup files in the directory
+ foreach (string dir in Directory.EnumerateDirectories(directory)) {
+ foreach (string file in Directory.EnumerateFiles(dir)) {
+ if (file.EndsWith(".brm") && DataFuncLib.IsValidBRAMFile(file)) {
+ FileData newData;
+ newData.filePath = file;
+ newData.gameName = Path.GetFileNameWithoutExtension(Path.GetDirectoryName(file));
+ result.Add(newData);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ private List GetEmulatorFiles(string directory) {
+ List result = new List();
+
+ // Get all PCE .sav files in the directory
+ foreach (string file in Directory.EnumerateFiles(directory, "*.*", SearchOption.AllDirectories)) {
+ if (DataFuncLib.IsValidBRAMFile(file)) {
+ FileData newData;
+ newData.filePath = file;
+ newData.gameName = Path.GetFileNameWithoutExtension(file).Split('.')[0];
+ result.Add(newData);
+ }
+ }
+
+ return result;
+ }
+
+ private void TransferToSSDS3(List files, string directory) {
+ // Transfer each file to SSDS3 format
+ foreach (FileData file in files) {
+ TransferToSSDS3(file, DestinationDirectoryText.Text);
+ }
+ }
+
+ private void TransferToSSDS3(FileData file, string directory) {
+ // Copy the file
+ string destinationFileName = directory + "\\" + file.gameName + ".bup";
+ File.Copy(file.filePath, destinationFileName, true);
+ }
+
+ private void TransferToEverdrive(List files, string directory) {
+ // Create enumerator to find game file extensions
+ if (GameDirectoryText.Text != "") {
+ gameDirectoryEnumerator = Directory.EnumerateFiles(GameDirectoryText.Text, "*.*", SearchOption.AllDirectories);
+ gameDirectoryEnumerator.OrderBy(filename => filename);
+ }
+
+ // Transfer each file to Everdrive format
+ foreach (FileData file in files) {
+ TransferToEverdrive(file, DestinationDirectoryText.Text);
+ }
+ }
+
+ private void TransferToEverdrive(FileData file, string directory) {
+ string[] validExtensions = new[] { ".pce", ".cue", ".iso", ".img" };
+ string fileExtension = "";
+
+ // Find game extension
+ // This is a bit slow but games may not be stored alphabetically, so it's safer to do a full check
+ if (gameDirectoryEnumerator.Count() > 0) {
+ foreach (string game in gameDirectoryEnumerator) {
+ if (Path.GetFileNameWithoutExtension(game) == file.gameName) {
+ string gameExtension = Path.GetExtension(game);
+
+ if (validExtensions.Contains(gameExtension)) {
+ fileExtension = gameExtension;
+ break;
+ }
+ }
+ }
+ }
+ else {
+ // Assume cue as that's most likely
+ fileExtension = ".cue";
+ }
+
+ // Only transfer games with a discovered file extension
+ if (fileExtension != "") {
+ string folderName = directory + "\\" + file.gameName + fileExtension;
+ string destinationFileName = folderName + "\\bram_exp.brm";
+
+ // Create the directory and copy the file
+ Directory.CreateDirectory(folderName);
+ File.Copy(file.filePath, destinationFileName, true);
+ }
+ }
+
+ private void TransferToEmulator(List files, string directory) {
+ // Transfer each file to emulator format
+ foreach (FileData file in files) {
+ TransferToEmulator(file, DestinationDirectoryText.Text);
+ }
+ }
+
+ private void TransferToEmulator(FileData file, string directory) {
+ // Copy the file
+ string destinationFileName = directory + "\\" + file.gameName + ".sav";
+ File.Copy(file.filePath, destinationFileName, true);
+ }
+
+ // GUI functions ----------------------------------
+
+ private void BrowseSourceDirectory_Click(object sender, EventArgs e) {
+ string folderPath;
+ folderPath = GuiFuncLib.OpenFolderBrowser(GuiFuncLib.savedInitialDirectory);
+ if (folderPath.Length == 0) {
+ return;
+ }
+
+ sourceFormat = CalculateFolderFormat(folderPath);
+ SourceTypeComboBox.SelectedIndex = (int)sourceFormat;
+ SourceDirectoryText.Text = folderPath;
+ }
+
+ private void BrowseDestinationDirectory_Click(object sender, EventArgs e) {
+ string folderPath = GuiFuncLib.OpenFolderBrowser(GuiFuncLib.savedInitialDirectory);
+ if (folderPath.Length == 0) {
+ return;
+ }
+
+ destinationFormat = CalculateFolderFormat(folderPath);
+ DestinationTypeComboBox.SelectedIndex = (int)destinationFormat;
+ DestinationDirectoryText.Text = folderPath;
+ }
+
+ private void BrowseGameDirectory_Click(object sender, EventArgs e) {
+ GameDirectoryText.Text = GuiFuncLib.OpenFolderBrowser(GuiFuncLib.savedInitialDirectory);
+ }
+
+ private void TransferButton_Click(object sender, EventArgs e) {
+ if (sourceFormat == FolderFormat.None) {
+ MessageBox.Show("No source folder format selected");
+ return;
+ }
+
+ if (destinationFormat == FolderFormat.None) {
+ MessageBox.Show("No destination folder format selected");
+ return;
+ }
+
+ if (SourceDirectoryText.Text.Length == 0) {
+ MessageBox.Show("No source directory selected");
+ return;
+ }
+
+ if (DestinationDirectoryText.Text.Length == 0) {
+ MessageBox.Show("No destination directory selected");
+ return;
+ }
+
+ if (GameDirectoryText.Text.Length == 0 && destinationFormat == FolderFormat.Everdrive) {
+ if (GuiFuncLib.WarningPopup("Attempting a transfer to Everdrive without specifying a game directory, all files will be assumed .cue! This means you will have to manually edit the folders to get non-cue games to work. Are you sure?")) {
+ return;
+ }
+ }
+
+ if (GuiFuncLib.WarningPopup("This process will overwrite files in the destination directory, are you sure?")) {
+ return;
+ }
+
+ StartTransfer();
+ }
+
+ private void SourceTypeComboBox_SelectedIndexChanged(object sender, EventArgs e) {
+ FolderFormat outVal;
+ Enum.TryParse(SourceTypeComboBox.SelectedValue.ToString(), out outVal);
+ sourceFormat = outVal;
+ }
+
+ private void DestinationTypeComboBox_SelectedIndexChanged(object sender, EventArgs e) {
+ FolderFormat outVal;
+ Enum.TryParse(DestinationTypeComboBox.SelectedValue.ToString(), out outVal);
+ destinationFormat = outVal;
+
+ GameDirectoryText.Enabled = BrowseGameDirectory.Enabled = outVal == FolderFormat.Everdrive;
+ }
+ }
+}
diff --git a/BRAM_Manager/TransferTool.resx b/BRAM_Manager/TransferTool.resx
new file mode 100644
index 0000000..6cfbb94
--- /dev/null
+++ b/BRAM_Manager/TransferTool.resx
@@ -0,0 +1,175 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
+ This tool will transfer all save files from one format to another.
+For example, from SSDS3 to Turbo Everdrive.
+If the source directory is in the SSDS3 format, then it will be transferred to
+the destination directory in Turbo Everdrive format, ready to be used on that device.
+
+
+ 17, 17
+
+
+
+
+ AAABAAEAFxcAAAEAIADICAAAFgAAACgAAAAXAAAALgAAAAEAIAAAAAAARAgAABMLAAATCwAAAAAAAAAA
+ AAAeISMAHiEj/x4hI/8eISP/HiEj/x4hI/8eISP/HiEj/x4hI/8eISP/HiEj/x4hI/8eISP/HiEj/x4h
+ I/8eISP/HiEj/x4hI/8eISP/HiEj/x4hI/8eISP/HiEjAB4hI/9oZ2n/aGdp/2hnaf9oZ2n/aGdp/2hn
+ af9oZ2n/aGdp/2hnaf9oZ2n/aGdp/2hnaf9oZ2n/aGdp/2hnaf9oZ2n/aGdp/2hnaf9oZ2n/aGdp/2hn
+ af8eISP/HiEj/7Gwsv+xsLL/S2wE/1uZAP9LbAT/sbCy/7Gwsv+xsLL/R0VF/0dFRf9HRUX/R0VF/0dF
+ Rf+xsLL/sbCy/7Gwsv8eISP/HiEj/x4hI/+xsLL/sbCy/x4hI/8eISP/sbCy/7Gwsv9LbAT/W5kA/0ts
+ BP+xsLL/aGdp/x4hI/8eISP/HiEj/x4hI/8eISP/HiEj/x4hI/9oZ2n/sbCy/x4hI/8eISP/HiEj/7Gw
+ sv+xsLL/HiEj/x4hI/9HRUX/sbCy/7Gwsv+xsLL/sbCy/2hnaf8eISP/aGdp/2hnaf+3tbX/t7W1/7e1
+ tf///////////x4hI/9oZ2n/sbCy/7Gwsv+xsLL/sbCy/0dFRf8eISP/HiEj/2hnaf9HRUX/R0VF/0dF
+ Rf9HRUX/R0VF/x4hI////////////7e1tf+3tbX/t7W1////////////HiEj/0dFRf9HRUX/R0VF/0dF
+ Rf9HRUX/aGdp/x4hI/8eISP/sbCy/2hnaf///////////7e1tf//////HiEj////////////////////
+ //////////////////8eISP//////7e1tf///////////2hnaf+xsLL/HiEj/x4hI/+xsLL/aGdp/7e1
+ tf+3tbX/t7W1//////8eISP//////7e1tf//////t7W1//////+3tbX//////x4hI///////t7W1/7e1
+ tf+3tbX/aGdp/7Gwsv8eISP/HiEj/7Gwsv9oZ2n/t7W1/7e1tf+3tbX//////x4hI///////t7W1////
+ //+3tbX//////7e1tf//////HiEj//////+3tbX/t7W1/7e1tf9oZ2n/sbCy/x4hI/8eISP/sbCy/2hn
+ af+3tbX/t7W1/7e1tf//////HiEj//////+3tbX//////7e1tf//////t7W1//////8eISP//////7e1
+ tf+3tbX/t7W1/2hnaf+xsLL/HiEj/x4hI/+xsLL/aGdp////////////t7W1//////8eISP//////7e1
+ tf//////t7W1//////+3tbX//////x4hI///////t7W1////////////aGdp/7Gwsv8eISP/HiEj/7Gw
+ sv9oZ2n///////////+3tbX//////7Gwsv8eISP/HiEj/x4hI/8eISP/HiEj/x4hI/8eISP/sbCy////
+ //+3tbX///////////9oZ2n/sbCy/x4hI/8eISP/sbCy/2hnaf///////////7e1tf//////////////
+ /////////////wAAkP///////////////////////////7e1tf///////////2hnaf+xsLL/HiEj/x4h
+ I/+xsLL/aGdp////////////t7W1//////////////////////8AAJD/AACQ/wAAkP8AAJD/////////
+ ////////t7W1////////////aGdp/7Gwsv8eISP/HiEj/7Gwsv9oZ2n///////////+3tbX/////////
+ ////////AACQ/wAAkP//////AACQ/wAAkP////////////////+3tbX///////////9oZ2n/sbCy/x4h
+ I/8eISP/sbCy/2hnaf///////////7e1tf///////////wAAkP//////AACQ//////8AAJD/AACQ/wAA
+ kP///////////7e1tf///////////2hnaf+xsLL/HiEj/x4hI/+xsLL/aGdp////////////t7W1////
+ /////////////wAAkP8AAJD/AACQ/wAAkP//////////////////////t7W1////////////aGdp/7Gw
+ sv8eISP/HiEj/7Gwsv9oZ2n/////////////////t7W1/////////////////wAAkP//////AACQ/wAA
+ kP///////////7e1tf////////////////9oZ2n/sbCy/x4hI/8eISP/sbCy/2hnaf//////////////
+ ////////t7W1//////////////////////////////////////+3tbX//////////////////////2hn
+ af+xsLL/HiEj/x4hI/+xsLL/aGdp////////////////////////////t7W1/7e1tf//////////////
+ //+3tbX/t7W1////////////////////////////aGdp/7Gwsv8eISP/HiEj/2hnaf+xsLL/aGdp////
+ /////////////////////////////7e1tf+3tbX/t7W1/////////////////////////////////2hn
+ af+xsLL/aGdp/x4hI/////8AHiEj/2hnaf+xsLL/aGdp/2hnaf9oZ2n/aGdp/2hnaf9oZ2n/aGdp/2hn
+ af9oZ2n/aGdp/2hnaf9oZ2n/aGdp/2hnaf9oZ2n/sbCy/2hnaf8eISP/HiEjAP///wD///8AHiEj/x4h
+ I/8eISP/HiEj/x4hI/8eISP/HiEj/x4hI/8eISP/HiEj/x4hI/8eISP/HiEj/x4hI/8eISP/HiEj/x4h
+ I/8eISP/HiEj/x4hIwD///8AgAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAACAMAABgA=
+
+
+
\ No newline at end of file
diff --git a/BRAM_Manager/packages.config b/BRAM_Manager/packages.config
new file mode 100644
index 0000000..678aab5
--- /dev/null
+++ b/BRAM_Manager/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/changelog.txt b/changelog.txt
new file mode 100644
index 0000000..0af2d5a
--- /dev/null
+++ b/changelog.txt
@@ -0,0 +1,43 @@
+1.03
+Lots of Everdrive functionality:
+Added transfer tool, which allows you to easily transfer your per-game save files between SSDS3 and Turbo Everdrive Pro
+Added support for Turbo Everdrive Pro .brm files
+Added option to merge from multiple folders
+
+Quality of life features:
+Added file/folder name of BRAM file to merge window
+Added drag-and-drop functionality
+Added option to disable warnings
+Added lots of tooltips
+Added an about page
+Changed the font in the BRAM viewers
+Removed option to create new BRAM file, as empty/unloaded BRAM slots now function as empty BRAM files which can be saved/edited
+
+Major refactoring of code, now more organised and with separate helper function libraries. Optimisations and removed magic numbers
+
+1.02
+Added Merge Multiple feature
+Behind-the-scenes work to support renaming in future
+
+1.01
+Added an icon to the exe (oops!)
+Added dialog for confirmation when creating duplicate save data
+Added dialog for clicking "Clear All" with unsaved edits
+Saving last used directory for next time program is launched
+Each browse button now defaults to open in the last folder for that side, instead of either side
+Implemented proper text decoding
+Resized BRAM windows to see longer names
+Disable window resizing
+
+1.0
+Cleaned up code
+Added option to create a new BRAM file
+Added option to unload both BRAM files
+Added .sav to BRAM filter for emulators
+Added "Edited" sign for unsaved edits
+Save button now brings up file browser
+Closing the program with unsaved changes will prompt you to save them
+
+0.1
+Ability to save and load two BRAM files
+Copy, delete and reorder save files