Skip to content

Commit

Permalink
(GUI) Allow patch creation from ROMs that are at different sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
GlitchyPSIX committed Sep 13, 2020
1 parent bffc866 commit 58a06b1
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions CometCharGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,23 @@ private void btnPatch_Click(object sender, RoutedEventArgs e)

if (fileSize == 8)
{
MessageBoxResult _dresult = MessageBox.Show("This ROM is a 8MB ROM.\nCMTP ROM EXPANSION IS EXPERIMENTAL. THIS ROM WILL *NOT* BE COMPATIBLE WITH ROM MANAGER. YOU ARE STRONGLY ADVISED TO EXPAND YOUR ROM BY OPENING IT IN SM64 ROM MANAGER FIRST.\nAdditionally, this does NOT work with Decomp ROMs!\nAre you sure you wish to continue?", "ROM is small!", MessageBoxButton.YesNo, MessageBoxImage.Question);
MessageBoxResult _dresult = MessageBox.Show("This ROM is a 8MB ROM.\nThis patching process does NOT work with Decomp ROMs!\nAre you sure you wish to continue?", "ROM is small!", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (_dresult == MessageBoxResult.Yes)
{
Dispatcher.Invoke(() => pbProgress.IsIndeterminate = true);
usingTemp = true;
Task prepareROM = Task.Run(async () =>
{
try
{
romPath = await Task.Run(() => PrepareVanillaROM(romPath));
pbProgress.Dispatcher.Invoke(() => pbProgress.IsIndeterminate = false);
patchFile();
}
catch
{
MessageBox.Show("Failed to patch the ROM. You're sure this is a good ROM?", "Oh no", MessageBoxButton.OK, MessageBoxImage.Error);
}
});

}
Expand All @@ -134,7 +141,7 @@ private void btnPatch_Click(object sender, RoutedEventArgs e)
}
if (fileSize > 8 && fileSize < 64)
{
MessageBox.Show("This ROM may be an older SM64 hack. This is not supported right now.", "Invalid ROM size", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show("This ROM appears to be an older SM64 hack. This is not supported right now.", "Invalid ROM size", MessageBoxButton.OK, MessageBoxImage.Error);
Dispatcher.Invoke(() =>
{
tcMain.IsEnabled = true;
Expand Down Expand Up @@ -282,11 +289,11 @@ private void btnCreatePatch_Click(object sender, RoutedEventArgs e)

if (valid)
{
if (fileSize < 65)
if (fileSize < 16)
{
MessageBox.Show("Are you sure this is a valid character mod?\nKeep in mind 8MB (Vanilla/Decomp), 24MB and 48MB mods are not supported yet.");
MessageBox.Show("Are you sure this is a valid character mod?\nKeep in mind 8MB (Vanilla/Decomp) ROMs are not supported.");
}
else if (fileSize > 65)
else
{
using (FileStream fs = new FileStream(romPath, FileMode.Open, FileAccess.Read))
{
Expand Down

0 comments on commit 58a06b1

Please sign in to comment.