Beta v0.4.5 code
Update checker Editor does no longer rely on hardcoded FLW1 and FLI1 Flow implementation just started
This commit is contained in:
@@ -41,13 +41,13 @@ namespace BMGEditor
|
||||
private Int64 FLW1sectionStart;
|
||||
private Int32 FLW1sectionMagic;
|
||||
private UInt32 FLW1sectionSize;
|
||||
private List<Byte> FLW1sectionContent;
|
||||
private List<Byte> FLW1sectionContent = new List<byte>();
|
||||
|
||||
//FLI1
|
||||
private Int64 FLI1sectionStart;
|
||||
private Int32 FLI1sectionMagic;
|
||||
private UInt32 FLI1sectionSize;
|
||||
private List<Byte> FLI1sectionContent;
|
||||
private List<Byte> FLI1sectionContent = new List<byte>();
|
||||
|
||||
public BMG(FileBase file, Bcsv tbl)
|
||||
{
|
||||
@@ -129,6 +129,10 @@ namespace BMGEditor
|
||||
FLW1sectionMagic = m_File.Reader.ReadInt32();
|
||||
if (FLW1sectionMagic != FLW1magic) throw new Exception("FLW1 section missing. Check your BMG file");
|
||||
FLW1sectionSize = m_File.Reader.ReadUInt32();
|
||||
for (int i = 0; i < FLW1sectionSize - 0x08; i++)
|
||||
{
|
||||
FLW1sectionContent.Add(m_File.Reader.ReadByte());
|
||||
}
|
||||
|
||||
|
||||
//FLI1
|
||||
@@ -137,6 +141,19 @@ namespace BMGEditor
|
||||
FLI1sectionMagic = m_File.Reader.ReadInt32();
|
||||
if (FLI1sectionMagic != FLI1magic) throw new Exception("FLI1 section missing. Check your BMG file");
|
||||
FLI1sectionSize = m_File.Reader.ReadUInt32();
|
||||
for (int i = 0; i < FLI1sectionSize - 0x08; i++)
|
||||
{
|
||||
FLI1sectionContent.Add(m_File.Reader.ReadByte());
|
||||
/*For some reason Nintendo decided to set this section's size 0x10 bytes more than
|
||||
*it really is (aligned size vs real size), so checking if we are at the end of the
|
||||
*stream to avoid a EndOfStreamException and changing the section size if incorrect
|
||||
*since the game (thanks god) doesn't care about that */
|
||||
if (m_File.Stream.Length - m_File.Stream.Position == 0)
|
||||
{
|
||||
FLI1sectionSize = (UInt32)(m_File.Stream.Position - FLI1sectionStart);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
@@ -219,6 +236,7 @@ namespace BMGEditor
|
||||
Entries.Add(newEntry);
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
public void DeleteEntry(Int32 entryIndex) //Problem: if custom entries, alphabetical index != in-game/tbl index
|
||||
{
|
||||
Entries.Remove(Entries[entryIndex]);
|
||||
@@ -327,11 +345,13 @@ namespace BMGEditor
|
||||
|
||||
m_File.Writer.Write((Int32)FLW1magic);
|
||||
m_File.Writer.Write((UInt32)FLW1sectionSize);
|
||||
//m_File.Writer.Write(FLW1sectionContent);
|
||||
foreach (byte b in FLW1sectionContent)
|
||||
m_File.Writer.Write(b);
|
||||
|
||||
m_File.Writer.Write((Int32)FLI1magic);
|
||||
m_File.Writer.Write((UInt32)FLI1sectionSize);
|
||||
//m_File.Writer.Write(FLI1sectionContent);
|
||||
foreach (byte b in FLI1sectionContent)
|
||||
m_File.Writer.Write(b);
|
||||
|
||||
Int64 newFileSize = m_File.Stream.Position;
|
||||
m_File.Stream.Position = 0x08;
|
||||
@@ -342,12 +362,6 @@ namespace BMGEditor
|
||||
m_File.Flush();
|
||||
}
|
||||
|
||||
public void NukeFile() //Yay, its code has been moved into WriteToFile()!!
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public List<TextEntry> Entries;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Text;
|
||||
using System.Globalization;
|
||||
using System.Net.Http;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
||||
namespace BMGEditor
|
||||
{
|
||||
@@ -24,12 +25,13 @@ namespace BMGEditor
|
||||
{
|
||||
ApplicationConfiguration.Initialize();
|
||||
Bcsv.PopulateHashtable();
|
||||
if (Variables.isBeta && Variables.isPrivateBeta) MessageBox.Show("This is a private beta, please don\'t leak it.", "Private", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
if (Variables.isBeta && Variables.isPrivateBeta)
|
||||
MessageBox.Show("This is a private beta, please don\'t leak it.", "Private", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
Application.Run(new MainForm());
|
||||
}
|
||||
|
||||
static readonly HttpClient wrClient = new HttpClient();
|
||||
static async void CheckUpdates()
|
||||
public static async void CheckUpdates()
|
||||
{
|
||||
const string verCheckURL = "https://bussun.github.io/res/checks/luma/upre1";
|
||||
Stream wrAnswer;
|
||||
|
||||
13
BMGEditor/UI/MainForm.Designer.cs
generated
13
BMGEditor/UI/MainForm.Designer.cs
generated
@@ -38,6 +38,7 @@ namespace BMGEditor
|
||||
this.openBcsvEditorBtn = new System.Windows.Forms.Button();
|
||||
this.openARCFileDialog = new System.Windows.Forms.OpenFileDialog();
|
||||
this.aboutBtn = new System.Windows.Forms.Button();
|
||||
this.updateCheckBtn = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// openFileBtn
|
||||
@@ -98,11 +99,22 @@ namespace BMGEditor
|
||||
this.aboutBtn.UseVisualStyleBackColor = true;
|
||||
this.aboutBtn.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// updateCheckBtn
|
||||
//
|
||||
this.updateCheckBtn.Location = new System.Drawing.Point(282, 47);
|
||||
this.updateCheckBtn.Name = "updateCheckBtn";
|
||||
this.updateCheckBtn.Size = new System.Drawing.Size(143, 29);
|
||||
this.updateCheckBtn.TabIndex = 5;
|
||||
this.updateCheckBtn.Text = "Check for updates";
|
||||
this.updateCheckBtn.UseVisualStyleBackColor = true;
|
||||
this.updateCheckBtn.Click += new System.EventHandler(this.updateCheckBtn_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(437, 153);
|
||||
this.Controls.Add(this.updateCheckBtn);
|
||||
this.Controls.Add(this.aboutBtn);
|
||||
this.Controls.Add(this.openBcsvEditorBtn);
|
||||
this.Controls.Add(this.openTextEditorBtn);
|
||||
@@ -125,5 +137,6 @@ namespace BMGEditor
|
||||
private Button openBcsvEditorBtn;
|
||||
private OpenFileDialog openARCFileDialog;
|
||||
private Button aboutBtn;
|
||||
private Button updateCheckBtn;
|
||||
}
|
||||
}
|
||||
@@ -86,5 +86,10 @@ namespace BMGEditor
|
||||
{
|
||||
MessageBox.Show("BMG Editor by Bussun", "About", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
private void updateCheckBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
Program.CheckUpdates();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user