diff --git a/FriishProduce/MainForm.Designer.cs b/FriishProduce/MainForm.Designer.cs index 18318b0c..39113e8b 100644 --- a/FriishProduce/MainForm.Designer.cs +++ b/FriishProduce/MainForm.Designer.cs @@ -52,19 +52,21 @@ private void InitializeComponent() this.mainMenu = new System.Windows.Forms.MainMenu(this.components); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.new_project = new System.Windows.Forms.MenuItem(); + this.menuItem5 = new System.Windows.Forms.MenuItem(); this.open_project = new System.Windows.Forms.MenuItem(); this.open_recent = new System.Windows.Forms.MenuItem(); this.save_project = new System.Windows.Forms.MenuItem(); this.save_project_as = new System.Windows.Forms.MenuItem(); - this.menuItem5 = new System.Windows.Forms.MenuItem(); + this.menuItem6 = new System.Windows.Forms.MenuItem(); + this.close_project = new System.Windows.Forms.MenuItem(); + this.close_all = new System.Windows.Forms.MenuItem(); + this.menuItem7 = new System.Windows.Forms.MenuItem(); this.exit = new System.Windows.Forms.MenuItem(); this.menuItem2 = new System.Windows.Forms.MenuItem(); this.import_game_file = new System.Windows.Forms.MenuItem(); - this.menuItem6 = new System.Windows.Forms.MenuItem(); + this.menuItem8 = new System.Windows.Forms.MenuItem(); this.game_scan = new System.Windows.Forms.MenuItem(); this.export = new System.Windows.Forms.MenuItem(); - this.menuItem7 = new System.Windows.Forms.MenuItem(); - this.close_project = new System.Windows.Forms.MenuItem(); this.menuItem3 = new System.Windows.Forms.MenuItem(); this.extract_wad_banner = new System.Windows.Forms.MenuItem(); this.extract_wad_icon = new System.Windows.Forms.MenuItem(); @@ -74,11 +76,11 @@ private void InitializeComponent() this.updater = new System.Windows.Forms.MenuItem(); this.check_for_updates = new System.Windows.Forms.MenuItem(); this.auto_update = new System.Windows.Forms.MenuItem(); - this.menuItem8 = new System.Windows.Forms.MenuItem(); - this.language_file_editor = new System.Windows.Forms.MenuItem(); this.menuItem10 = new System.Windows.Forms.MenuItem(); - this.preferences = new System.Windows.Forms.MenuItem(); + this.language_file_editor = new System.Windows.Forms.MenuItem(); this.menuItem11 = new System.Windows.Forms.MenuItem(); + this.preferences = new System.Windows.Forms.MenuItem(); + this.menuItem12 = new System.Windows.Forms.MenuItem(); this.clear_database = new System.Windows.Forms.MenuItem(); this.reset_preferences = new System.Windows.Forms.MenuItem(); this.menuItem4 = new System.Windows.Forms.MenuItem(); @@ -240,11 +242,15 @@ private void InitializeComponent() this.menuItem1.Index = 0; this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.new_project, + this.menuItem5, this.open_project, this.open_recent, this.save_project, this.save_project_as, - this.menuItem5, + this.menuItem6, + this.close_project, + this.close_all, + this.menuItem7, this.exit}); this.menuItem1.Tag = "file"; resources.ApplyResources(this.menuItem1, "menuItem1"); @@ -255,41 +261,65 @@ private void InitializeComponent() resources.ApplyResources(this.new_project, "new_project"); this.new_project.Tag = "new_project"; // + // menuItem5 + // + this.menuItem5.Index = 1; + resources.ApplyResources(this.menuItem5, "menuItem5"); + // // open_project // - this.open_project.Index = 1; + this.open_project.Index = 2; resources.ApplyResources(this.open_project, "open_project"); this.open_project.Tag = "open_project"; this.open_project.Click += new System.EventHandler(this.OpenProject_Click); // // open_recent // - this.open_recent.Index = 2; + this.open_recent.Index = 3; this.open_recent.Tag = "open_recent"; resources.ApplyResources(this.open_recent, "open_recent"); // // save_project // resources.ApplyResources(this.save_project, "save_project"); - this.save_project.Index = 3; + this.save_project.Index = 4; this.save_project.Tag = "save_project"; this.save_project.Click += new System.EventHandler(this.Save_Click); // // save_project_as // resources.ApplyResources(this.save_project_as, "save_project_as"); - this.save_project_as.Index = 4; + this.save_project_as.Index = 5; this.save_project_as.Tag = "save_project_as"; this.save_project_as.Click += new System.EventHandler(this.SaveAs_Click); // - // menuItem5 + // menuItem6 // - this.menuItem5.Index = 5; - resources.ApplyResources(this.menuItem5, "menuItem5"); + this.menuItem6.Index = 6; + resources.ApplyResources(this.menuItem6, "menuItem6"); + // + // close_project + // + resources.ApplyResources(this.close_project, "close_project"); + this.close_project.Index = 7; + this.close_project.Tag = "close_project"; + this.close_project.Click += new System.EventHandler(this.CloseTab_Click); + // + // close_all + // + resources.ApplyResources(this.close_all, "close_all"); + this.close_all.Index = 8; + this.close_all.Tag = "close_all"; + this.close_all.Click += new System.EventHandler(this.CloseAll_Click); + // + // menuItem7 + // + this.menuItem7.Index = 9; + resources.ApplyResources(this.menuItem7, "menuItem7"); // // exit // - this.exit.Index = 6; + this.exit.Index = 10; resources.ApplyResources(this.exit, "exit"); this.exit.Tag = "exit"; this.exit.Click += new System.EventHandler(this.MenuItem_Exit_Click); @@ -299,11 +329,9 @@ private void InitializeComponent() this.menuItem2.Index = 1; this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.import_game_file, - this.menuItem6, + this.menuItem8, this.game_scan, - this.export, - this.menuItem7, - this.close_project}); + this.export}); this.menuItem2.Tag = "project"; resources.ApplyResources(this.menuItem2, "menuItem2"); // @@ -313,10 +341,10 @@ private void InitializeComponent() this.import_game_file.Index = 0; this.import_game_file.Click += new System.EventHandler(this.OpenROM_Click); // - // menuItem6 + // menuItem8 // - this.menuItem6.Index = 1; - resources.ApplyResources(this.menuItem6, "menuItem6"); + this.menuItem8.Index = 1; + resources.ApplyResources(this.menuItem8, "menuItem8"); // // game_scan // @@ -332,18 +360,6 @@ private void InitializeComponent() this.export.Tag = "export"; this.export.Click += new System.EventHandler(this.ExportWAD_Click); // - // menuItem7 - // - this.menuItem7.Index = 4; - resources.ApplyResources(this.menuItem7, "menuItem7"); - // - // close_project - // - resources.ApplyResources(this.close_project, "close_project"); - this.close_project.Index = 5; - this.close_project.Tag = "close_project"; - this.close_project.Click += new System.EventHandler(this.CloseTab_Click); - // // menuItem3 // this.menuItem3.Index = 2; @@ -354,11 +370,11 @@ private void InitializeComponent() this.extract_wad_manual, this.menuItem9, this.updater, - this.menuItem8, - this.language_file_editor, this.menuItem10, - this.preferences, + this.language_file_editor, this.menuItem11, + this.preferences, + this.menuItem12, this.clear_database, this.reset_preferences}); this.menuItem3.Tag = "tools"; @@ -420,10 +436,10 @@ private void InitializeComponent() resources.ApplyResources(this.auto_update, "auto_update"); this.auto_update.Click += new System.EventHandler(this.Update_Click); // - // menuItem8 + // menuItem10 // - this.menuItem8.Index = 6; - resources.ApplyResources(this.menuItem8, "menuItem8"); + this.menuItem10.Index = 6; + resources.ApplyResources(this.menuItem10, "menuItem10"); // // language_file_editor // @@ -431,10 +447,10 @@ private void InitializeComponent() resources.ApplyResources(this.language_file_editor, "language_file_editor"); this.language_file_editor.Click += new System.EventHandler(this.LanguageFileEditor); // - // menuItem10 + // menuItem11 // - this.menuItem10.Index = 8; - resources.ApplyResources(this.menuItem10, "menuItem10"); + this.menuItem11.Index = 8; + resources.ApplyResources(this.menuItem11, "menuItem11"); // // preferences // @@ -443,10 +459,10 @@ private void InitializeComponent() this.preferences.Tag = ""; this.preferences.Click += new System.EventHandler(this.Settings_Click); // - // menuItem11 + // menuItem12 // - this.menuItem11.Index = 10; - resources.ApplyResources(this.menuItem11, "menuItem11"); + this.menuItem12.Index = 10; + resources.ApplyResources(this.menuItem12, "menuItem12"); // // clear_database // @@ -616,6 +632,8 @@ private void InitializeComponent() private System.Windows.Forms.MenuItem reset_preferences; public TheArtOfDev.HtmlRenderer.WinForms.HtmlToolTip Tip; private System.Windows.Forms.MenuItem open_recent; + private System.Windows.Forms.MenuItem close_all; + private System.Windows.Forms.MenuItem menuItem12; } } diff --git a/FriishProduce/MainForm.cs b/FriishProduce/MainForm.cs index 764e1e31..4a05f46b 100644 --- a/FriishProduce/MainForm.cs +++ b/FriishProduce/MainForm.cs @@ -327,7 +327,7 @@ public void TabChanged(object sender, EventArgs e) import_game_file.Text = string.Format(Program.Lang.String(import_game_file.Tag.ToString(), Name), (tabControl.SelectedForm as ProjectForm).FileTypeName); } - import_game_file.Enabled = close_project.Enabled = hasTabs; + import_game_file.Enabled = close_all.Enabled = close_project.Enabled = hasTabs; // Sync toolbar buttons // ******** @@ -404,6 +404,17 @@ private void TabContextMenu_Opening(object sender, CancelEventArgs e) private void CloseTab_Click(object sender, EventArgs e) { var tab = tabControl.SelectedForm as Form; tab?.Close(); } + private void CloseAll_Click(object sender, EventArgs e) + { + List
list = new(); + + for (int i = 0; i < tabControl.TabPages.Count; i++) + list.Add(tabControl.TabPages[i].Form as Form); + + foreach (var tab in list) + tab.Close(); + } + private void About_Click(object sender, EventArgs e) { using var about = new About(); about.ShowDialog(); } private void MenuItem_Exit_Click(object sender, EventArgs e) => Application.Exit(); diff --git a/FriishProduce/MainForm.resx b/FriishProduce/MainForm.resx index e40b0f72..b4e7a328 100644 --- a/FriishProduce/MainForm.resx +++ b/FriishProduce/MainForm.resx @@ -430,6 +430,9 @@ new_project + + - + CtrlO @@ -457,7 +460,25 @@ save_project_as - + + - + + + False + + + CtrlF4 + + + close_project + + + False + + + close_all + + - @@ -478,7 +499,7 @@ import_game_file - + - @@ -499,18 +520,6 @@ export - - - - - - False - - - CtrlF4 - - - close_project - project @@ -544,13 +553,13 @@ updater - + - Language File Editor - + - @@ -559,7 +568,7 @@ preferences - + - @@ -2925,6 +2934,12 @@ System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + menuItem5 + + + System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + open_project @@ -2949,10 +2964,28 @@ System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - menuItem5 + + menuItem6 - + + System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + close_project + + + System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + close_all + + + System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + menuItem7 + + System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -2973,10 +3006,10 @@ System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - menuItem6 + + menuItem8 - + System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -2991,18 +3024,6 @@ System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - menuItem7 - - - System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - close_project - - - System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - menuItem3 @@ -3057,10 +3078,10 @@ System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - menuItem8 + + menuItem10 - + System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -3069,10 +3090,10 @@ System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - menuItem10 + + menuItem11 - + System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -3081,10 +3102,10 @@ System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - menuItem11 + + menuItem12 - + System.Windows.Forms.MenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 diff --git a/FriishProduce/Program.cs b/FriishProduce/Program.cs index 218db6ed..ae32738e 100644 --- a/FriishProduce/Program.cs +++ b/FriishProduce/Program.cs @@ -47,6 +47,7 @@ static void Main(string[] args) } catch { } + Logger.Log("Opening FriishProduce."); Config = new(Paths.Config); Lang = new Language(); @@ -54,11 +55,13 @@ static void Main(string[] args) // if (args.Length > 0 && args[0].StartsWith("--")) // { + // Logger.Log("Running in CLI (command-line) mode."); // CLI.Run(args); // } // else // { + Logger.Log("Running in GUI (graphical) mode."); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainForm = new MainForm(args); diff --git a/FriishProduce/ProjectForm.cs b/FriishProduce/ProjectForm.cs index fdcfec32..7dc945a1 100644 --- a/FriishProduce/ProjectForm.cs +++ b/FriishProduce/ProjectForm.cs @@ -344,11 +344,12 @@ private void SetRecentProjects(string project) // ******** if (project != Program.Config.paths.recent_00) { - for (int i = 0; i < max - 1; i++) + for (int i = max - 1; i > 0; i--) { - var prop1 = Program.Config.paths.GetType().GetProperty($"recent_{i:D2}"); - var prop2 = Program.Config.paths.GetType().GetProperty($"recent_{i + 1:D2}"); - prop2.SetValue(Program.Config.paths, prop1.GetValue(Program.Config.paths, null)); + var prop1 = Program.Config.paths.GetType().GetProperty($"recent_{i - 1:D2}"); + var prop2 = Program.Config.paths.GetType().GetProperty($"recent_{i:D2}"); + var path = prop1.GetValue(Program.Config.paths, null)?.ToString(); + prop2.SetValue(Program.Config.paths, path); } Program.Config.paths.recent_00 = project; @@ -1685,7 +1686,6 @@ private void saveToWAD(object sender, System.ComponentModel.DoWorkEventArgs e) string emulator = null; Forwarder.Storages device = 0; - Invoke(new MethodInvoker(delegate { m.IsMultifile = multifile_software.Checked; @@ -1695,11 +1695,14 @@ private void saveToWAD(object sender, System.ComponentModel.DoWorkEventArgs e) device = forwarder_root_device.SelectedIndex == 1 ? Forwarder.Storages.USB : Forwarder.Storages.SD; })); + int wad_tries = 0; + + Start: + Program.MainForm.Wait(false, false, false); if (inWadFile == null) Web.InternetTest(); Program.MainForm.Wait(true, true, true, 0, 1); - Start: // Get WAD data // ******* if (inWadFile != null) m.GetWAD(inWadFile, baseID.Text); @@ -1725,7 +1728,21 @@ private void saveToWAD(object sender, System.ComponentModel.DoWorkEventArgs e) case Platform.MSX: if (isVirtualConsole) try { m.Inject(); } - catch (Exception ex) { if (ex.Message == "U8 Header: Invalid Magic!") goto Start; else throw; } + catch (Exception ex) + { + if (ex.Message == "U8 Header: Invalid Magic!" && wad_tries == 0) + { + wad_tries++; + Logger.Log("Attempting to load/download WAD a second time."); + goto Start; + } + + else + { + Logger.Log("WAD is invalid or failed to load more than once. Process halted."); + throw; + } + } else m.CreateForwarder(emulator, device); break; diff --git a/FriishProduce/Strings/en.json b/FriishProduce/Strings/en.json index 5a8268aa..d6bf778b 100644 --- a/FriishProduce/Strings/en.json +++ b/FriishProduce/Strings/en.json @@ -103,7 +103,7 @@ "error": "An error has occurred", "e_000": "Unable to connect to the Internet.\n{0}", "e_001": "Unable to generate image.\nThis may be due to an issue with GDI+.", - "e_002": "Failed to replace content within the WAD.", + "e_002": "Failed to inject or replace content within the WAD.", "e_003": "The ROM provided is too large (size limit: {0} {1}).", "e_004": "Unable to modify the internal VC WAD's content options.\nInjection will continue as intended.", "e_005": "Unable to modify the following content options.\n{0}\nInjection will continue as intended.", @@ -142,27 +142,28 @@ "help": "&Help", "new_project": "&New...", - "open_project": "Open project...", + "open_project": "&Open project...", "open_recent": "Open &recent", - "save_project": "Save project", - "save_project_as": "Save project as...", - "close_project": "Close project", - - "import_game_file": "Import {0}...", - "game_scan": "Fill in game data", - "export": "Export...", + "clear_recent": "&Clear this list", + "save_project": "&Save project", + "save_project_as": "Save &project as...", + "close_project": "&Close project", + "close_all": "Close &all", + + "import_game_file": "&Import {0}...", + "game_scan": "&Fill in game data", + "export": "&Export...", "extract_wad_banner": "Extract channel &banner from WAD...", "extract_wad_icon": "Extract channel &icon from WAD...", "extract_wad_sound": "Extract channel &sound from WAD...", "extract_wad_manual": "Extract VC &manual from WAD...", - "updater": "Updater", - "check_for_updates": "Check for updates", - "auto_update": "Automatically check for updates on startup", - "clear_recent": "&Clear this list", + "updater": "&Updater", + "check_for_updates": "&Check for updates", + "auto_update": "&Automatically check for updates on startup", "clear_database": "&Clear all databases", "reset_preferences": "&Reset all preferences", - "exit": "Exit", + "exit": "&Exit", "project_type": "{0} WAD", "untitled_project": "Untitled {0} WAD" diff --git a/FriishProduce/Strings/es.json b/FriishProduce/Strings/es.json index 814086c8..8cc4e5da 100644 --- a/FriishProduce/Strings/es.json +++ b/FriishProduce/Strings/es.json @@ -103,7 +103,7 @@ "error": "Se ha producido un error", "e_000": "No se pudo conectar a Internet.\n{0}", "e_001": "No se pudo generar la imagen.\nEsto puede deberse a un problema con GDI+.", - "e_002": "No se pueden reemplazar los datos internos del canal.", + "e_002": "No se pudo inyectar o reemplazar los datos internos del canal.", "e_003": "La ROM es demasiado grande (más de {0} {1} en tamaño).", "e_004": "No se pudo modificar los ajustes de Consola Virtual.\nLa exportación continuará según lo previsto.", "e_005": "No se pudo modificar los ajustes siguientes:\n{0}\nLa exportación continuará según lo previsto.", @@ -135,27 +135,28 @@ "help": "A&yuda", "new_project": "&Nuevo...", - "open_project": "Abrir proyecto...", + "open_project": "&Abrir proyecto...", "open_recent": "Abrir &recientes", - "save_project": "Guardar proyecto", - "save_project_as": "Guardar proyecto como...", - "close_project": "Cerrar proyecto", + "clear_recent": "&Borrar esta lista", + "save_project": "&Guardar proyecto", + "save_project_as": "Guardar &proyecto como...", + "close_project": "&Cerrar proyecto", + "close_all": "Cerrar &todo", - "import_game_file": "Abrir un archivo de juego...", + "import_game_file": "&Abrir un archivo de juego...", "game_scan": "&Obtener datos del juego de la base de datos en línea", - "export": "Exportar...", + "export": "&Exportar...", "extract_wad_banner": "Extract channel &banner from WAD...", "extract_wad_icon": "Extract channel &icon from WAD...", "extract_wad_sound": "Extract channel &sound from WAD...", "extract_wad_manual": "Extract VC &manual from WAD...", - "updater": "Actualización", - "check_for_updates": "Buscar ahora", - "auto_update": "Buscar cuando se abra la aplicación", - "clear_recent": "&Borrar esta lista", - "clear_database": "Borrar los bases de datos internos", + "updater": "&Actualización", + "check_for_updates": "Buscar &ahora", + "auto_update": "Buscar &cuando se abra la aplicación", + "clear_database": "&Borrar los bases de datos internos", "reset_preferences": "&Restablecer los ajustes", - "exit": "Salir", + "exit": "&Salir", "project_type": "Canal de {0}", "untitled_project": "Canal de {0} sin título" @@ -167,6 +168,7 @@ "system_default": "Idioma del sistema", "use_custom_database": "Utilizar una base de datos externa para los canales de origen", "reset_all_dialogs": "Restablecer la opción \"No volver a mostrar este mensaje\"", + "bypass_rom_size": "Eliminar el límite de tamaño de los archivos ROM", "bios_files": "Archivos BIOS", "browse_bios": "Seleccionar un archivo BIOS...", @@ -179,9 +181,8 @@ "default_target_parameters": "Partidos reemplazables:", "use_online_wad_enabled": "Habilitar opción de descargar canales de origen", - "use_online_wad_tip": "This can be used to retrieve any WAD that is available from the current database without already requiring to have a WAD file. However, because libWiiSharp's NUS client does not allow for decrypting VC WADs in any form, it is only able to use Web download functionality. The legality of this is shady so it is better to have the option disabled.", "auto_fill_save_data": "Completar título de datos guardados automáticamente", - "auto_prefill": "Obtener datos de juego automáticamente tras abrir una ROM" + "auto_prefill": "Obtener datos de juego automáticamente tras abrir un archivo ROM" }, "projectform": { diff --git a/FriishProduce/Strings/fr.json b/FriishProduce/Strings/fr.json index 295bd4a6..7195a13a 100644 --- a/FriishProduce/Strings/fr.json +++ b/FriishProduce/Strings/fr.json @@ -103,7 +103,7 @@ "error": "Oups, un problème est survenu !", "e_000": "Échec de connexion à Internet.\n{0}", "e_001": "Échec de génération de l'image.\nCeci peut être provoqué par un problème avec GDI+.", - "e_002": "Échec du replacement des données internes de la chaîne.", + "e_002": "Échec de l'injection ou du replacement des données internes de la chaîne.", "e_003": "La taille de votre fichier de jeu dépasse la limite de {0} {1}.", "e_004": "Échec de modification des options de contenu de la chaîne.\nL'injection du logiciel se poursuivra comme prévu.", "e_005": "Échec de modification des options de contenu suivantes :\n{0}\nL'injection du logiciel se poursuivra comme prévu.", @@ -138,27 +138,28 @@ "help": "&Aide", "new_project": "&Nouveau ...", - "open_project": "Ouvrir un project ...", + "open_project": "&Ouvrir un project ...", "open_recent": "Projets &récents", - "save_project": "Enregistrer le projet", - "save_project_as": "Enregistrer le projet sous ...", - "close_project": "Fermer le projet", - - "import_game_file": "Ouvrir un fichier {0} ...", - "game_scan": "Charger les informations dès de la bibliothèque des jeux", - "export": "Exporter ...", + "clear_recent": "&Effacer cette liste", + "save_project": "&Enregistrer le projet", + "save_project_as": "Enregistrer le projet &sous ...", + "close_project": "&Fermer le projet", + "close_all": "Fermer &tous les projets", + + "import_game_file": "&Ouvrir un fichier {0} ...", + "game_scan": "&Charger les informations dès de la bibliothèque des jeux", + "export": "&Exporter ...", "extract_wad_banner": "Extraire le &banner d'aperçu d'une chaîne Wii...", "extract_wad_icon": "Extraire l'&icône d'aperçu d'une chaîne Wii...", "extract_wad_sound": "Extraire le &son d'aperçu d'une chaîne Wii...", - "extract_wad_manual": "Extraire un &mode d'emploi de Console virtuelle...", - "updater": "Mise à jour", - "check_for_updates": "Vérifier maintenant", - "auto_update": "Vérifier automatiquement au démarrage de l'application", - "clear_recent": "&Effacer cette liste", + "extract_wad_manual": "Extraire un mode d'&emploi de Console virtuelle...", + "updater": "&Mise à jour", + "check_for_updates": "&Vérifier maintenant", + "auto_update": "Vérifier &automatiquement au démarrage de l'application", "clear_database": "&Effacer les bases de données internelles", "reset_preferences": "&Réinitialiser la configuration", - "exit": "Quitter", + "exit": "&Quitter", "project_type": "Chaîne {0}", "untitled_project": "Chaîne {0} sans titre" @@ -170,6 +171,7 @@ "system_default": "Système", "reset_all_dialogs": "Réinitialiser le paramètre « Ne plus afficher ce message »", "use_custom_database": "Utiliser un autre fichier pour la base de données des chaînes", + "bypass_rom_size": "Désactiver la limite de taille des fichiers ROM", "bios_files": "Fichiers BIOS", "browse_bios": "Choisir un fichier BIOS ...", diff --git a/FriishProduce/Strings/ja.json b/FriishProduce/Strings/ja.json index 53a0c451..4a424244 100644 Binary files a/FriishProduce/Strings/ja.json and b/FriishProduce/Strings/ja.json differ diff --git a/FriishProduce/Strings/ko.json b/FriishProduce/Strings/ko.json index 1be97101..a5485212 100644 --- a/FriishProduce/Strings/ko.json +++ b/FriishProduce/Strings/ko.json @@ -103,7 +103,7 @@ "error": "오류가 발생했습니다!", "e_000": "인터넷에 연결하지 못했습니다.\n메시지: {0}", "e_001": "이미지를 생성하지 못했습니다.\n이는 GDI+ 문제 때문일 수 있습니다.", - "e_002": "WAD 내의 콘텐츠를 교체하지 못했습니다.", + "e_002": "Failed to inject or replace content within the WAD.", "e_003": "제공된 롬이 너무 큽니다 (크기 제한: {0} {1}).", "e_004": "내부 VC WAD의 콘텐츠 옵션을 수정할 수 없습니다.\n 의도한 대로 주입이 계속됩니다.", "e_005": "다음 콘텐츠 옵션을 수정하지 못했음:\n{0}\nWAD로 내보내기는 의도한 대로 계속됩니다.", @@ -140,9 +140,11 @@ "new_project": "새로운...(&N)", "open_project": "프로잭트 열기...(&O)", "open_recent": "Open &recent", + "clear_recent": "&Clear this list", "save_project": "프로젝트 저장(&S)", "save_project_as": "다른 이름으로 저잔...(&A)", "close_project": "프로젝트 닫기(&C)", + "close_all": "Close all", "import_game_file": "{0} 가져오기...(&G)", "game_scan": "온라인으로 게임 데이터 검색(&S)", @@ -155,7 +157,6 @@ "updater": "업데이터(&U)", "check_for_updates": "업데이트 확인(&C)", "auto_update": "시작 시 자동으로 업데이트 확인(&A)", - "clear_recent": "&Clear this list", "clear_database": "모든 롬 데이터베이스 지우기(&E)", "reset_preferences": "&Reset all preferences", "exit": "나가기(&X)", @@ -170,6 +171,7 @@ "system_default": "시스템 기본값", "reset_all_dialogs": "모든 대화상자 재설정", "use_custom_database": "커스텀 WAD 데이터베이스 파일 사용", + "bypass_rom_size": "Bypass ROM filesize limit", "bios_files": "바이오스 파일", "browse_bios": "바이오스 파일 선택...", diff --git a/FriishProduce/_classes/Creators/WiiVC/C64.cs b/FriishProduce/_classes/Creators/WiiVC/C64.cs index 0bfa58c4..9633c98b 100644 --- a/FriishProduce/_classes/Creators/WiiVC/C64.cs +++ b/FriishProduce/_classes/Creators/WiiVC/C64.cs @@ -54,10 +54,10 @@ protected override void ReplaceROM() "gbalzss", "d ik.fss.comp ik.fss" ); + if (File.Exists(Paths.WorkingFolder + "ik.fss.comp")) File.Delete(Paths.WorkingFolder + "ik.fss.comp"); - try { File.Delete(frodo + "ik.fss"); } catch { } - try { File.Move(Paths.WorkingFolder + "ik.fss", frodo + "ik.fss"); } catch { } - File.Delete(Paths.WorkingFolder + "ik.fss.comp"); + File.Copy(Paths.WorkingFolder + "ik.fss", frodo + "ik.fss", true); + if (File.Exists(Paths.WorkingFolder + "ik.fss")) File.Delete(Paths.WorkingFolder + "ik.fss"); } } @@ -185,14 +185,17 @@ protected override void ReplaceROM() if (!cancel) { - try { File.Delete(Paths.WorkingFolder + "ik.fss"); } catch { } - File.Move(snapshot, Paths.WorkingFolder + "ik.fss"); + File.Copy(snapshot, Paths.WorkingFolder + "ik.fss", true); + if (File.Exists(snapshot)) File.Delete(snapshot); + Utils.Run ( FileDatas.Apps.gbalzss, "gbalzss", "e ik.fss ik.fss.comp" ); + if (!File.Exists(Paths.WorkingFolder + "ik.fss.comp")) throw new Exception(Program.Lang.Msg(2, true)); + MainContent.ReplaceFile(ik_fss_index, File.ReadAllBytes(Paths.WorkingFolder + "ik.fss.comp")); } diff --git a/FriishProduce/_classes/Creators/WiiVC/_base.cs b/FriishProduce/_classes/Creators/WiiVC/_base.cs index 29001b60..5e8d9ad1 100644 --- a/FriishProduce/_classes/Creators/WiiVC/_base.cs +++ b/FriishProduce/_classes/Creators/WiiVC/_base.cs @@ -63,8 +63,7 @@ protected virtual void Load() if (needsManualLoaded && (mainContentIndex <= 1)) mainContentIndex = 5; if (mainContentIndex > 1 && WAD.Contents.Length > mainContentIndex) - try { MainContent = U8.Load(WAD.Contents[mainContentIndex]); } - catch { throw; } + MainContent = U8.Load(WAD.Contents[mainContentIndex]); manualContentIndex = 5; ManualContent = mainContentIndex == manualContentIndex ? null : U8.Load(WAD.Contents[manualContentIndex]); diff --git a/FriishProduce/_classes/Method.cs b/FriishProduce/_classes/Method.cs index 96607f35..822f4fdd 100644 --- a/FriishProduce/_classes/Method.cs +++ b/FriishProduce/_classes/Method.cs @@ -75,155 +75,192 @@ public Method(Platform platform) public void GetWAD(string path, string tid) { - WAD = new WAD(); - - if (File.Exists(path)) WAD = WAD.Load(path); - else if (path.ToLower().StartsWith("http")) + try { - _progress.max += 1.0; + WAD = new WAD(); - WAD = WAD.Load(Web.Get(path)); + if (File.Exists(path)) + { + Logger.Log($"Loading WAD file with title ID {tid}."); + WAD = WAD.Load(path); + } - _updateProgress(); - } + else if (path.ToLower().StartsWith("http")) + { + Logger.Log($"Downloading WAD with title ID {tid}."); + _progress.max += 1.0; + + WAD = WAD.Load(Web.Get(path)); + + _updateProgress(); + } + + // Title ID check + // **************** + if (WAD.UpperTitleID.ToUpper() != tid || !WAD.HasBanner) + WAD.Dispose(); - // Title ID check - // **************** - if (WAD.UpperTitleID.ToUpper() != tid || !WAD.HasBanner) - WAD.Dispose(); + // Contents check + // **************** + if (WAD == null || WAD?.NumOfContents <= 1) + throw new Exception(Program.Lang.Msg(9, true)); - // Contents check - // **************** - if (WAD == null || WAD?.NumOfContents <= 1) - throw new Exception(Program.Lang.Msg(9, true)); + Logger.Log($"WAD loaded."); + } + + catch (Exception ex) + { + Logger.Log($"ERROR: Failed to load original WAD. {ex.Message}"); + throw; + } } public void Inject(bool useOrigManual = false) { - if (Platform == Platform.Flash) + try { - Injectors.Flash Flash = new() + if (Platform == Platform.Flash) { - SWF = ROM.FilePath, - Settings = Settings.List, - Keymap = Settings.Keymap, - Multifile = IsMultifile - }; - - WAD = Flash.Inject(WAD, SaveDataTitle, Img); - } + Injectors.Flash Flash = new() + { + SWF = ROM.FilePath, + Settings = Settings.List, + Keymap = Settings.Keymap, + Multifile = IsMultifile + }; - else - { - // Create Wii VC injector to use - // ******* - InjectorWiiVC VC = null; + WAD = Flash.Inject(WAD, SaveDataTitle, Img); + } - switch (Platform) + else { - default: - throw new NotImplementedException(); - - // NES + // Create Wii VC injector to use // ******* - case Platform.NES: - VC = new Injectors.NES(); - break; + InjectorWiiVC VC = null; - // SNES - // ******* - case Platform.SNES: - VC = new Injectors.SNES(); - break; + switch (Platform) + { + default: + throw new NotImplementedException(); + + // NES + // ******* + case Platform.NES: + VC = new Injectors.NES(); + break; + + // SNES + // ******* + case Platform.SNES: + VC = new Injectors.SNES(); + break; + + // N64 + // ******* + case Platform.N64: + VC = new Injectors.N64() + { + CompressionType = EmuVersion == 3 ? (Settings.List["romc"] == "0" ? 1 : 2) : 0, + Allocate = Settings.List["rom_autosize"] == "True" && (EmuVersion <= 1), + }; + break; + + // SEGA + // ******* + case Platform.SMS: + case Platform.SMD: + VC = new Injectors.SEGA() + { + IsSMS = Platform == Platform.SMS + }; + break; + + // PCE(CD) + // ******* + case Platform.PCE: + case Platform.PCECD: + VC = new Injectors.PCE() + { + IsDisc = Platform == Platform.PCECD + }; + break; + + // NEOGEO + // ******* + case Platform.NEO: + VC = new Injectors.NEO(); + break; + + // MSX + // ******* + case Platform.C64: + VC = new Injectors.C64(); + break; + + // MSX + // ******* + case Platform.MSX: + VC = new Injectors.MSX(); + break; + } - // N64 - // ******* - case Platform.N64: - VC = new Injectors.N64() - { - CompressionType = EmuVersion == 3 ? (Settings.List["romc"] == "0" ? 1 : 2) : 0, - Allocate = Settings.List["rom_autosize"] == "True" && (EmuVersion <= 1), - }; - break; - - // SEGA - // ******* - case Platform.SMS: - case Platform.SMD: - VC = new Injectors.SEGA() - { - IsSMS = Platform == Platform.SMS - }; - break; - - // PCE(CD) - // ******* - case Platform.PCE: - case Platform.PCECD: - VC = new Injectors.PCE() - { - IsDisc = Platform == Platform.PCECD - }; - break; - - // NEOGEO + // Get settings from relevant form // ******* - case Platform.NEO: - VC = new Injectors.NEO(); - break; + VC.Settings = Settings.List; + VC.Keymap = Settings.Keymap; - // MSX - // ******* - case Platform.C64: - VC = new Injectors.C64(); - break; + // Set path to manual (if it exists) and load WAD + //// ******* + VC.Manual = Manual; - // MSX + // Actually inject everything // ******* - case Platform.MSX: - VC = new Injectors.MSX(); - break; + WAD = VC.Inject(WAD, ROM, SaveDataTitle, Img); } + Logger.Log("Created injected WAD."); + _updateProgress(); + } + + catch (Exception ex) + { + Logger.Log($"ERROR: {ex.Message}"); + throw; + } + } + + public void CreateForwarder(string emulator, Forwarder.Storages storage) + { + try + { + Forwarder f = new() + { + ROM = ROM.FilePath, + Multifile = IsMultifile, + ID = TitleID, + Emulator = emulator, + Storage = storage, + Name = ChannelTitles[1] + }; + // Get settings from relevant form // ******* - VC.Settings = Settings.List; - VC.Keymap = Settings.Keymap; - - // Set path to manual (if it exists) and load WAD - //// ******* - VC.Manual = Manual; + f.Settings = Settings.List; // Actually inject everything // ******* - WAD = VC.Inject(WAD, ROM, SaveDataTitle, Img); - } + f.CreateZIP(Path.Combine(Path.GetDirectoryName(Out), Path.GetFileNameWithoutExtension(Out) + $" ({f.Storage}).zip")); + WAD = f.CreateWAD(WAD); - _updateProgress(); - } + Logger.Log($"Created {emulator} forwarder."); + _updateProgress(); + } - public void CreateForwarder(string emulator, Forwarder.Storages storage) - { - Forwarder f = new() + catch (Exception ex) { - ROM = ROM.FilePath, - Multifile = IsMultifile, - ID = TitleID, - Emulator = emulator, - Storage = storage, - Name = ChannelTitles[1] - }; - - // Get settings from relevant form - // ******* - f.Settings = Settings.List; - - // Actually inject everything - // ******* - f.CreateZIP(Path.Combine(Path.GetDirectoryName(Out), Path.GetFileNameWithoutExtension(Out) + $" ({f.Storage}).zip")); - WAD = f.CreateWAD(WAD); - - _updateProgress(); + Logger.Log($"ERROR: Failed to create forwarder. {ex.Message}"); + throw; + } } public void EditMetadata() @@ -234,59 +271,83 @@ public void EditMetadata() WAD.ChangeChannelTitles(ChannelTitles_Limit); WAD.ChangeTitleID(LowerTitleID.Channel, TitleID); WAD.FakeSign = true; + + Logger.Log("Changed channel titles."); + Logger.Log($"Changed WAD title ID to {TitleID}."); + Logger.Log("Fakesigned WAD."); } public void EditBanner() { - // Sound - // ******* - if (File.Exists(BannerSound)) - SoundHelper.ReplaceSound(WAD, BannerSound); - else - SoundHelper.ReplaceSound(WAD, Properties.Resources.Sound_WiiVC); - - // Banner text - // ******* - BannerHelper.Modify - ( - WAD, - Platform, - BannerRegion, - BannerTitle, - BannerYear, - BannerPlayers - ); - - // Image - // ******* - if (Img?.VCPic != null) Img.ReplaceBanner(WAD); - - _updateProgress(); + try + { + // Sound + // ******* + if (File.Exists(BannerSound)) + SoundHelper.ReplaceSound(WAD, BannerSound); + else + SoundHelper.ReplaceSound(WAD, Properties.Resources.Sound_WiiVC); + + // Banner text + // ******* + BannerHelper.Modify + ( + WAD, + Platform, + BannerRegion, + BannerTitle, + BannerYear, + BannerPlayers + ); + + // Image + // ******* + if (Img?.VCPic != null) Img.ReplaceBanner(WAD); + + Logger.Log("Added VC banner."); + _updateProgress(); + } + + catch (Exception ex) + { + Logger.Log($"ERROR: Failed to add VC banner. {ex.Message}"); + throw; + } } public void Save() { - if (Directory.Exists(Paths.SDUSBRoot)) + try { - Directory.CreateDirectory(Paths.SDUSBRoot + "wad\\"); - WAD.Save(Paths.SDUSBRoot + "wad\\" + Path.GetFileNameWithoutExtension(Out) + ".wad"); + if (Directory.Exists(Paths.SDUSBRoot)) + { + Directory.CreateDirectory(Paths.SDUSBRoot + "wad\\"); + WAD.Save(Paths.SDUSBRoot + "wad\\" + Path.GetFileNameWithoutExtension(Out) + ".wad"); - // Get ZIP directory path & compress to .ZIP archive - // ******* - if (File.Exists(Out)) File.Delete(Out); + // Get ZIP directory path & compress to .ZIP archive + // ******* + if (File.Exists(Out)) File.Delete(Out); - FastZip z = new(); - z.CreateZip(Out, Paths.SDUSBRoot, true, null); + FastZip z = new(); + z.CreateZip(Out, Paths.SDUSBRoot, true, null); - // Clean - // ******* - Directory.Delete(Paths.SDUSBRoot, true); - } + // Clean + // ******* + Directory.Delete(Paths.SDUSBRoot, true); + } - else WAD.Save(Out); + else WAD.Save(Out); - _updateProgress(); - _progress.step = _progress.max; + Logger.Log($"SUCCESS: Exported to {Out}."); + _updateProgress(); + _progress.step = _progress.max; + } + + catch (Exception ex) + { + Logger.Log($"ERROR: Failed to export. {ex.Message}"); + throw; + } } public void Dispose() diff --git a/FriishProduce/_classes/Program/Language.cs b/FriishProduce/_classes/Program/Language.cs index ec125399..1da8a40f 100644 --- a/FriishProduce/_classes/Program/Language.cs +++ b/FriishProduce/_classes/Program/Language.cs @@ -154,6 +154,7 @@ public Language(string code = null) } Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = new CultureInfo(code == "sys" ? GetSystemLanguage() : code); + Logger.Log($"Language set to {Thread.CurrentThread.CurrentCulture.EnglishName}."); } #region Public methods and variables diff --git a/FriishProduce/_classes/Program/Paths.cs b/FriishProduce/_classes/Program/Paths.cs index 80c69714..18027e51 100644 --- a/FriishProduce/_classes/Program/Paths.cs +++ b/FriishProduce/_classes/Program/Paths.cs @@ -10,6 +10,7 @@ public static class Paths // Application paths public static readonly string Config = Path.Combine(EnvironmentFolder, "FriishProduce.json"); + public static readonly string Log = Path.Combine(EnvironmentFolder, "log.txt"); public static readonly string Databases = Path.Combine(EnvironmentFolder, "resources\\databases\\"); public static readonly string Tools = Path.Combine(EnvironmentFolder, "resources\\tools\\"); public static readonly string Languages = Path.Combine(EnvironmentFolder, "strings\\"); diff --git a/FriishProduce/_classes/Utilities.cs b/FriishProduce/_classes/Utilities.cs index f08d4de0..784e356f 100644 --- a/FriishProduce/_classes/Utilities.cs +++ b/FriishProduce/_classes/Utilities.cs @@ -25,6 +25,16 @@ public enum ExportResult FAILED_INJECTION, FAILED_DOWNLOADED_WAD } + public static class Logger + { + public static void Log(string msg) + { + // StringBuilder sb = new StringBuilder(); + // sb.Append($"[{DateTime.Now.Year}-{DateTime.Now.Month:D2}-{DateTime.Now.Day:D2} {DateTime.Now.Hour:D2}:{DateTime.Now.Minute:D2}:{DateTime.Now.Second:D2}] {msg}\n"); + // File.AppendAllText(Paths.Log, sb.ToString()); + // sb.Clear(); + } + } /* class CustomToolTip : ToolTip {