Skip to content

Commit

Permalink
Bugfixes & other additions
Browse files Browse the repository at this point in the history
  • Loading branch information
CatmanFan committed Apr 5, 2024
1 parent 5acaf37 commit 1817195
Show file tree
Hide file tree
Showing 14 changed files with 145 additions and 75 deletions.
2 changes: 2 additions & 0 deletions FriishProduce/FriishProduce.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,8 @@
<ItemGroup>
<Content Include="Database.xml" />
<Content Include="icon.ico" />
<None Include="Resources\apps\flips.exe" />
<None Include="Resources\apps\xdelta3.exe" />
<None Include="Resources\icons\brick.ico" />
<None Include="Resources\icons\wooden-box--pencil.png" />
<None Include="Resources\icons\disk-black.png" />
Expand Down
1 change: 1 addition & 0 deletions FriishProduce/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion FriishProduce/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ private void ExportWAD_Click(object sender, EventArgs e)
{
var currentForm = tabControl.SelectedForm as ProjectForm;

SaveWAD.FileName = string.IsNullOrWhiteSpace(SaveWAD.FileName) ? currentForm.GetName() : Path.GetFileNameWithoutExtension(SaveWAD.FileName);
SaveWAD.FileName = currentForm.GetName();
if (SaveWAD.ShowDialog() == DialogResult.OK) currentForm.SaveToWAD();
}

Expand Down
21 changes: 12 additions & 9 deletions FriishProduce/MainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@
<value>Tahoma, 8pt</value>
</data>
<data name="ToolStrip_NewProject.Font" type="System.Drawing.Font, System.Drawing">
<value>Tahoma, 7pt</value>
<value>Microsoft Sans Serif, 8pt</value>
</data>
<data name="ToolStrip_NewProject.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
Expand All @@ -475,7 +475,7 @@
<value>False</value>
</data>
<data name="ToolStrip_SaveAs.Font" type="System.Drawing.Font, System.Drawing">
<value>Tahoma, 7pt</value>
<value>Microsoft Sans Serif, 8pt</value>
</data>
<data name="ToolStrip_SaveAs.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
Expand All @@ -490,13 +490,13 @@
<value>False</value>
</data>
<data name="ToolStrip_ExportWAD.Font" type="System.Drawing.Font, System.Drawing">
<value>Arial, 7pt</value>
<value>Microsoft Sans Serif, 8pt</value>
</data>
<data name="ToolStrip_ExportWAD.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="ToolStrip_ExportWAD.Size" type="System.Drawing.Size, System.Drawing">
<value>89, 22</value>
<value>23, 22</value>
</data>
<data name="ToolStrip_ExportWAD.Text" xml:space="preserve">
<value>save_as_wad</value>
Expand All @@ -508,13 +508,13 @@
<value>False</value>
</data>
<data name="ToolStrip_OpenROM.Font" type="System.Drawing.Font, System.Drawing">
<value>Arial, 7pt</value>
<value>Microsoft Sans Serif, 8pt</value>
</data>
<data name="ToolStrip_OpenROM.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="ToolStrip_OpenROM.Size" type="System.Drawing.Size, System.Drawing">
<value>99, 22</value>
<value>96, 22</value>
</data>
<data name="ToolStrip_OpenROM.Text" xml:space="preserve">
<value>open_gamefile</value>
Expand All @@ -523,13 +523,13 @@
<value>False</value>
</data>
<data name="ToolStrip_OpenImage.Font" type="System.Drawing.Font, System.Drawing">
<value>Arial, 7pt</value>
<value>Microsoft Sans Serif, 8pt</value>
</data>
<data name="ToolStrip_OpenImage.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="ToolStrip_OpenImage.Size" type="System.Drawing.Size, System.Drawing">
<value>87, 22</value>
<value>85, 22</value>
</data>
<data name="ToolStrip_OpenImage.Text" xml:space="preserve">
<value>open_image</value>
Expand All @@ -541,7 +541,7 @@
<value>False</value>
</data>
<data name="ToolStrip_UseLibRetro.Font" type="System.Drawing.Font, System.Drawing">
<value>Tahoma, 7pt</value>
<value>Microsoft Sans Serif, 8pt</value>
</data>
<data name="ToolStrip_UseLibRetro.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
Expand All @@ -558,6 +558,9 @@
<data name="ToolStrip_CloseTab.Enabled" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="ToolStrip_CloseTab.Font" type="System.Drawing.Font, System.Drawing">
<value>Microsoft Sans Serif, 8pt</value>
</data>
<data name="ToolStrip_CloseTab.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
Expand Down
51 changes: 27 additions & 24 deletions FriishProduce/ProjectForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public void Save()
var p = new ProjectType();
p.Console = Console;
p.Creator = Creator;
p.ROM = ROM.Path;
p.ROM = ROM?.Path;
p.PatchFile = PatchFile;
p.Img = Img.Source;
p.Img = Img?.Source ?? null;
p.Options = CO?.Options ?? null;
p.LibRetro = LibRetro;
p.WADRegion = TargetRegion.SelectedIndex;
Expand Down Expand Up @@ -359,7 +359,8 @@ private void Form_Shown(object sender, EventArgs e)

if (ParentProject.LibRetro != null) LibRetro = ParentProject.LibRetro;
if (CO != null) CO.Options = ParentProject.Options;
ROM.Path = ParentProject.ROM;

ROM.Path = File.Exists(ParentProject.ROM) ? ParentProject.ROM : null;

Img = new ImageHelper(ParentProject.Console, null);
Img.LoadToSource(ParentProject.Img);
Expand All @@ -382,6 +383,9 @@ private void Form_Shown(object sender, EventArgs e)
TargetRegion.SelectedIndex = ParentProject.WADRegion;
LinkSaveData.Checked = ParentProject.LinkSaveDataTitle;

PatchFile = File.Exists(ParentProject.PatchFile) ? ParentProject.PatchFile : null;
Patch.Checked = !string.IsNullOrWhiteSpace(ParentProject.PatchFile);

ParentProject = null;
ToggleControls(!string.IsNullOrEmpty(ROM?.Path));
}
Expand Down Expand Up @@ -441,7 +445,13 @@ protected virtual void SetROMDataText()

private void RandomTID() => TitleID.Text = Creator.TitleID = TIDCode != null ? TIDCode + GenerateTitleID().Substring(0, 3) : GenerateTitleID();

public string GetName() => ROM?.Path != null ? Path.GetFileNameWithoutExtension(ROM?.Path) + $" [{TitleID.Text.ToUpper()}]" : $"{Console} - {ChannelTitle.Text} [{TitleID.Text.ToUpper()}]";
public string GetName()
{
return Patch.Checked ? Path.GetFileNameWithoutExtension(PatchFile) + $" [{TitleID.Text.ToUpper()}]"
: ROM?.Path != null ? Path.GetFileNameWithoutExtension(ROM?.Path) + $" [{TitleID.Text.ToUpper()}]"

: $"{Console} - {ChannelTitle.Text} [{TitleID.Text.ToUpper()}]";
}

private void isClosing(object sender, FormClosingEventArgs e)
{
Expand All @@ -462,15 +472,20 @@ public bool CheckUnsaved()
{
return Parent.SaveAs_Trigger();
}

else if (result == MessageBox.Result.Button2)
{
return true;
}

else if (result == MessageBox.Result.Cancel || result == MessageBox.Result.Button3)
{
return false;
}
}
}

return false;
return true;
}

private void Random_Click(object sender, EventArgs e) => RandomTID();
Expand Down Expand Up @@ -520,8 +535,6 @@ private void TextBox_Changed(object sender, EventArgs e)

if (sender == BannerTitle || sender == ChannelTitle) LinkSaveDataTitle();

if (sender == TitleID) Parent.SaveWAD.FileName = GetName();

var currentSender = sender as TextBox;
if (currentSender.Multiline && currentSender.Lines.Length > 2) currentSender.Lines = new string[] { currentSender.Lines[0], currentSender.Lines[1] };

Expand Down Expand Up @@ -816,7 +829,6 @@ public void LoadROM(string ROMpath, bool UseLibRetro = true)
Parent.tabControl.Visible = true;

if (ROM != null && UseLibRetro && CheckToolStripButtons()[0]) LoadLibRetroData();
Parent.SaveWAD.FileName = GetName();
}

public async void LoadLibRetroData()
Expand Down Expand Up @@ -867,9 +879,9 @@ public bool SaveToWAD()
try
{
Parent.CleanTemp();

Creator.Out = Parent.SaveWAD.FileName;
if (PatchFile != null) ROM.Patch(PatchFile, false);

if (Patch.Checked) ROM.Patch(PatchFile);

OutWAD = new WAD();

Expand Down Expand Up @@ -929,7 +941,6 @@ public bool SaveToWAD()
if (File.Exists(Creator.Out) && File.ReadAllBytes(Creator.Out).Length > 10)
{
System.Media.SystemSounds.Beep.Play();
Tag = null;

var Message = MessageBox.Show(Program.Lang.Msg(3), null, MessageBox.Buttons.Custom, Ookii.Dialogs.WinForms.TaskDialogIcon.Information);

Expand Down Expand Up @@ -969,7 +980,7 @@ public void ForwarderCreator()
Forwarder f = new Forwarder()
{
ROM = ROM.Bytes,
ROMExtension = Path.GetExtension(ROM.Path),
ROMExtension = Path.GetExtension(this.ROM.Path),
ID = Creator.TitleID,
Emulator = InjectorsList.SelectedItem.ToString(),
Storage = FStorage_USB.Checked ? Forwarder.Storages.USB : Forwarder.Storages.SD
Expand Down Expand Up @@ -1541,20 +1552,12 @@ private void CustomManual_CheckedChanged(object sender, EventArgs e)

private void Patch_CheckedChanged(object sender, EventArgs e)
{
if (Patch.Checked)
if (Patch.Checked && PatchFile == null)
{
if (BrowsePatch.ShowDialog() == DialogResult.OK)
{
if (ROM.Patch(BrowsePatch.FileName, true))
{
PatchFile = BrowsePatch.FileName;
CheckExport();
}
else
{
PatchFile = null;
Patch.Checked = false;
}
PatchFile = BrowsePatch.FileName;
CheckExport();
}

else
Expand Down
20 changes: 20 additions & 0 deletions FriishProduce/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions FriishProduce/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -319,4 +319,10 @@
<data name="brick" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons\brick.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="App_Flips" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\apps\flips.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="App_XDelta" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\apps\xdelta3.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
Binary file added FriishProduce/Resources/apps/flips.exe
Binary file not shown.
Binary file added FriishProduce/Resources/apps/xdelta3.exe
Binary file not shown.
36 changes: 20 additions & 16 deletions FriishProduce/Subforms/Options/Options_VC_N64.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions FriishProduce/Subforms/Options/Options_VC_N64.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ protected override void ResetOptions()
// *******
if (Options != null)
{
n64003.Enabled = patch_fixcrashes.Enabled = EmuType <= 1;
patch_autosizerom.Enabled = patch_fixcrashes.Enabled = EmuType <= 1;
g2.Visible = g2.Enabled = EmuType == 3;
patch_fixbrightness.Checked = bool.Parse(Options["brightness"]);
patch_fixcrashes.Checked = bool.Parse(Options["crash"]);
patch_expandedram.Checked = bool.Parse(Options["expansion"]);
n64003.Checked = bool.Parse(Options["rom_autosize"]);
patch_autosizerom.Checked = bool.Parse(Options["rom_autosize"]);
romc_type.SelectedIndex = int.Parse(Options["romc"]);
}
// *******
Expand All @@ -53,7 +53,7 @@ protected override void SaveOptions()
Options["brightness"] = patch_fixbrightness.Checked.ToString();
Options["crash"] = patch_fixcrashes.Checked.ToString();
Options["expansion"] = patch_expandedram.Checked.ToString();
Options["rom_autosize"] = n64003.Checked.ToString();
Options["rom_autosize"] = patch_autosizerom.Checked.ToString();
Options["romc"] = romc_type.SelectedIndex.ToString();
}

Expand Down
Loading

0 comments on commit 1817195

Please sign in to comment.