Commits

DaFox  committed b1ecfcc

Basic file loading

  • Participants
  • Parent commits 1ac1c05

Comments (0)

Files changed (4)

File Forms/MainForm.Designer.cs

 			this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
 			this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
 			this.tabControl1 = new System.Windows.Forms.TabControl();
-			this.tabPage1 = new System.Windows.Forms.TabPage();
+			this.tabNew = new System.Windows.Forms.TabPage();
+			this.btLoad = new System.Windows.Forms.Button();
 			this.lbGameSelection = new System.Windows.Forms.ListBox();
-			this.btLoad = new System.Windows.Forms.Button();
 			this.menuStrip1.SuspendLayout();
 			this.tabControl1.SuspendLayout();
-			this.tabPage1.SuspendLayout();
+			this.tabNew.SuspendLayout();
 			this.SuspendLayout();
 			// 
 			// menuStrip1
 			// 
 			// tabControl1
 			// 
-			this.tabControl1.Controls.Add(this.tabPage1);
-			this.tabControl1.Location = new System.Drawing.Point(0, 27);
+			this.tabControl1.Controls.Add(this.tabNew);
+			this.tabControl1.Dock = System.Windows.Forms.DockStyle.Top;
+			this.tabControl1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+			this.tabControl1.Location = new System.Drawing.Point(0, 24);
 			this.tabControl1.Name = "tabControl1";
 			this.tabControl1.SelectedIndex = 0;
-			this.tabControl1.Size = new System.Drawing.Size(954, 224);
+			this.tabControl1.Size = new System.Drawing.Size(954, 239);
 			this.tabControl1.TabIndex = 1;
 			// 
-			// tabPage1
+			// tabNew
 			// 
-			this.tabPage1.Controls.Add(this.btLoad);
-			this.tabPage1.Controls.Add(this.lbGameSelection);
-			this.tabPage1.Location = new System.Drawing.Point(4, 22);
-			this.tabPage1.Name = "tabPage1";
-			this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
-			this.tabPage1.Size = new System.Drawing.Size(946, 198);
-			this.tabPage1.TabIndex = 0;
-			this.tabPage1.Text = "New";
-			this.tabPage1.UseVisualStyleBackColor = true;
-			// 
-			// lbGameSelection
-			// 
-			this.lbGameSelection.FormattingEnabled = true;
-			this.lbGameSelection.ImeMode = System.Windows.Forms.ImeMode.NoControl;
-			this.lbGameSelection.Location = new System.Drawing.Point(528, 6);
-			this.lbGameSelection.Name = "lbGameSelection";
-			this.lbGameSelection.Size = new System.Drawing.Size(171, 186);
-			this.lbGameSelection.TabIndex = 0;
-			this.lbGameSelection.SelectedIndexChanged += new System.EventHandler(this.lbGameSelection_SelectedIndexChanged);
+			this.tabNew.Controls.Add(this.lbGameSelection);
+			this.tabNew.Controls.Add(this.btLoad);
+			this.tabNew.Location = new System.Drawing.Point(4, 22);
+			this.tabNew.Name = "tabNew";
+			this.tabNew.Padding = new System.Windows.Forms.Padding(3);
+			this.tabNew.Size = new System.Drawing.Size(946, 213);
+			this.tabNew.TabIndex = 0;
+			this.tabNew.Text = "New";
+			this.tabNew.UseVisualStyleBackColor = true;
 			// 
 			// btLoad
 			// 
 			this.btLoad.Enabled = false;
 			this.btLoad.Image = global::GameSaveProgress.Properties.Resources.folder_add;
 			this.btLoad.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
-			this.btLoad.Location = new System.Drawing.Point(791, 87);
+			this.btLoad.Location = new System.Drawing.Point(740, 87);
 			this.btLoad.Name = "btLoad";
 			this.btLoad.Size = new System.Drawing.Size(75, 23);
 			this.btLoad.TabIndex = 1;
 			this.btLoad.UseVisualStyleBackColor = true;
 			this.btLoad.Click += new System.EventHandler(this.btLoad_Click);
 			// 
+			// lbGameSelection
+			// 
+			this.lbGameSelection.FormattingEnabled = true;
+			this.lbGameSelection.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+			this.lbGameSelection.Location = new System.Drawing.Point(563, 24);
+			this.lbGameSelection.Name = "lbGameSelection";
+			this.lbGameSelection.Size = new System.Drawing.Size(171, 147);
+			this.lbGameSelection.TabIndex = 0;
+			this.lbGameSelection.SelectedIndexChanged += new System.EventHandler(this.lbGameSelection_SelectedIndexChanged);
+			// 
 			// MainForm
 			// 
 			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
 			this.menuStrip1.ResumeLayout(false);
 			this.menuStrip1.PerformLayout();
 			this.tabControl1.ResumeLayout(false);
-			this.tabPage1.ResumeLayout(false);
+			this.tabNew.ResumeLayout(false);
 			this.ResumeLayout(false);
 			this.PerformLayout();
 
 		private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
 		private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
 		private System.Windows.Forms.TabControl tabControl1;
-		private System.Windows.Forms.TabPage tabPage1;
+		private System.Windows.Forms.TabPage tabNew;
 		private System.Windows.Forms.ListBox lbGameSelection;
 		private System.Windows.Forms.Button btLoad;
 

File Forms/MainForm.cs

 			{
 				ofd.InitialDirectory = @"D:\Consoles\N64\Mupen64Plus\config\save\"; // todo: Get default save path for game
 
-				ofd.Filter = "All Save Game Files|*.eep|Mario Kart 64 (*.eep)|*.eep"; // todo: Get save file extension for game
+				ofd.Filter = "Mario Kart 64 (*.eep)|*.eep"; // todo: Get save file extension for game
 				ofd.FilterIndex = 1;
 				ofd.RestoreDirectory = true;
 
 				{
 					if (OpenSaveGameFile(ofd.FileName))
 					{
-						//lbGameSelection.Dispose(true);
+						tabNew.Controls.Remove(lbGameSelection);
+						tabNew.Controls.Remove(btLoad);
+
+						/*Label tab1Label1 = new Label();
+
+						tab1Label1.Location = new System.Drawing.Point(200, 200);
+						tab1Label1.Text = "TESTICLES";
+						tab1Label1.Size = new System.Drawing.Size(224, 96);
+						tab1Label1.TabIndex = 1;*/
+
+						//tabNew.Controls.Add(btLoad);
+						tabNew = mk64.GameUI(tabNew);
+						mk64.Print();
 					}
 				}
 			}

File Forms/MainForm.resx

   <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>17, 17</value>
   </metadata>
-  <metadata name="tabPage1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
 </root>

File src/MarioKart64.cs

 using System.IO;
 using Helpers;
 using System.Diagnostics;
+using System.Windows.Forms;
+
 namespace GameSave
 {
 	class MarioKart64
 	{
-		public bool IsLoaded { get; private set; }
+		public bool Loaded_ { get; private set; }
+		private string SaveGamePath_;
+		private byte[] SaveGame_;
 
+		private System.Windows.Forms.TextBox tbDetailedView_;
 
-		private string savegamePath;
-		private byte[] savegame;
+		struct TIMECHAR
+		{    
+			uint time : 20;
+			byte character : 4;
+		}
+		private byte Character_;
+		//private uint FirstTimer_;
 
 		public static string GetGameName()
 		{
 			{
 				using (FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
 				{
-					savegame = stream.GetBytes();
+					SaveGame_ = stream.GetBytes();
 
-					if (savegame != null && savegame.Length > 0)
+					if (SaveGame_ != null && SaveGame_.Length > 0)
 					{
-						Debug.WriteLine("File Loaded!");
-						savegamePath = path;
-						IsLoaded = true;
+						Loaded_ = true;
+						SaveGamePath_ = path;
+
+						
 						return true;
 					}
 				}
 			}
 
-			IsLoaded = false;
+			Loaded_ = false;
 			return false;
 		}
+
+		public bool Parse()
+		{
+			if (!Loaded_)
+			{
+				return false;
+			}
+
+			Character_ = (byte)BitConverter.ToInt16(SaveGame_, 0);
+
+			return true;
+		}
+
+		public void Print()
+		{
+			tbDetailedView_.Paste("Loaded: " + SaveGamePath_);
+			tbDetailedView_.Paste("Character: " + Character_);
+		}		
+
+		public TabPage GameUI(TabPage tab)
+		{
+			tbDetailedView_ = new System.Windows.Forms.TextBox();
+
+			tbDetailedView_.Location = new System.Drawing.Point(422, 76);
+			tbDetailedView_.Location = new System.Drawing.Point(6, 6);
+			tbDetailedView_.Multiline = true;
+			tbDetailedView_.Name = "tbDetailedView";
+			tbDetailedView_.Size = new System.Drawing.Size(400, 186);
+			tbDetailedView_.TabIndex = 2;
+			tbDetailedView_.ScrollBars = ScrollBars.Vertical;
+			tab.Controls.Add(tbDetailedView_);
+
+			tab.Text = Path.GetFileName(SaveGamePath_);
+
+			return tab;
+		}
 	}
 }