From ed6f28be1e35f8de70e26e19b5b7736a2de4a30e Mon Sep 17 00:00:00 2001 From: Manu <52102823+Manu098vm@users.noreply.github.com> Date: Sun, 6 Nov 2022 20:15:35 +0100 Subject: [PATCH] Prepare for public release --- .gitignore | 1 + README.md | 20 ++++++++------ SwitchGiftDataManager.CommandLine/Program.cs | 17 +++++++----- .../Properties/launchSettings.json | 12 +++++++++ .../SwitchGiftDataManager.CommandLine.csproj | 7 ++++- ...tchGiftDataManager.CommandLine.csproj.user | 9 +++++++ .../Classes/BCATManager/BCATManager.cs | 4 +-- .../SwitchGiftDataManager.Core.csproj | 5 ++++ SwitchGiftDataManager.WinForm/MainWindow.cs | 9 ++++++- .../Properties/Settings.Designer.cs | 26 +++++++++++++++++++ .../Properties/Settings.settings | 6 +++++ .../SaveWindow.Designer.cs | 2 +- SwitchGiftDataManager.WinForm/SaveWindow.cs | 4 ++- .../SwitchGiftDataManager.WinForm.csproj | 15 +++++++++++ 14 files changed, 117 insertions(+), 20 deletions(-) create mode 100644 SwitchGiftDataManager.CommandLine/Properties/launchSettings.json create mode 100644 SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj.user create mode 100644 SwitchGiftDataManager.WinForm/Properties/Settings.Designer.cs create mode 100644 SwitchGiftDataManager.WinForm/Properties/Settings.settings diff --git a/.gitignore b/.gitignore index 3e19cc7..cb3e512 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .git .vs +.vscode **/bin **/obj \ No newline at end of file diff --git a/README.md b/README.md index 53bf822..5a12df9 100644 --- a/README.md +++ b/README.md @@ -5,39 +5,43 @@ This tool aims to make past Mystery Gift event contents back again in all the Po Since those games won't allow event injection in the SAV file, this tool creates a forged BCAT package, injectable with homebrews like [JKSV](https://github.com/J-D-K/JKSV/releases). This does not involve hacking the game ROM nor hacking the game SAV. -### Compatible files: +### Compatible files * Let's Go Pikachu and Let's Go Eevee wondercard full files (.wb7full) * Sword and Shield wondercard files (.wc8) * Brilliant Diamond and Shining Pearl wondercard files (.wb8) * Legends Arceus wondercard files (.wa8) +* BCAT wondercard files, either with mutiple or single wondercards (no file format extension) -### Compatible games: +### Compatible games * Pokémon Let's Go Pikachu and Eevee * Pokémon Sword and Shield * Pokémon Brilliant Diamond and Shining Pearl * Pokémon Legends Arceus -* A support for Pokémon Scarlet and Violet is planned for the future - no guarantee here - don't ask for eta. +* Support for Pokémon Scarlet and Violet is planned for the future - no guarantee here - don't ask for eta. ## Disclosure Neither I nor the Project Pokémon staff takes any responsibility for possible adverse outcomes or bans due to the use of this tool. Use at your own discretion. +**N.B:** Some BCAT files contain sensible console-specific informations, which you should keep safe. Don't share your BCAT to others! ## Usage This paragraph refers to the Windows Form app. The Command Line app usage is similar and should be fairly intuitive. -* Ensure to have the required [.NET 6.0 runtimes](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) correctly installed +* Ensure you have the required [.NET 6.0 runtimes](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) correctly installed * Dump your game's BCAT with [JKSV](https://github.com/J-D-K/JKSV/releases) and keep some copies somewhere safe * Open the tool and select your game of choice * Import wondercard files of your choice (by drag & drop or by clicking the `Open Files` button) * Eventually edit the wondercard id (WCID) if you have duplicated WCs and click `Apply` * Click the `Save as BCAT Package` button and browse to your dumped BCAT * A folder called "Forged_BCAT_{Game}" should appear next to your dumped BCAT -* Restore the Forged Bcat with JKSV and enjoy the old events +* Restore the Forged Bcat with JKSV * To redeem the old fashion events, open your game -> Menu -> Mystery Gift -> redeem via Internet * When you're done, restore your original BCAT package with JKSV (not doing so may cause sync issues) -**N.B**: BCAT Sync usually occurs between 12:00 AM (UTC) and 01:00 AM (UTC). I strongly suggest to not follow this procedure during that timeframe to avoid a desync. -If you experience a desync, download the latest BCAT for your game from my [bcat_updates](https://github.com/Manu098vm/bcat_updates) repo or from [citrusbolt](https://github.com/citrusbolt)'s [website](http://citrusbolt.net/bcat/) and add the missing files to your dumped BCAT, then restore it with JKSV. +**N.B**: BCAT Sync usually occurs between 12:00 AM (UTC) and 01:00 AM (UTC). I suggest to not follow this procedure during that timeframe to avoid a desync. +If you experience a desync, follow one of these methods to resync: +* Open JKSV, select BCAT, hover over your game and press X to open the menu, then click `Reset Save Data`. +* Download the latest BCAT for your game from my [bcat_updates](https://github.com/Manu098vm/bcat_updates) repo or from [citrusbolt](https://github.com/citrusbolt)'s [website](http://citrusbolt.net/bcat/) and add the missing files to your dumped BCAT, then restore it with JKSV. -If you find any bug or you need support, please write in the relevant topic in the Project Pokémon forums. +If you find any bug or you need support, please write in the [relevant topic in the Project Pokémon forums](https://projectpokemon.org/home/forums/topic/62491-switch-gift-data-manager-import-wondercards-into-switch-games-by-faking-bcat-packages/). Alternatively, feel free to contact me on Discord by DMs (SkyLink98#5946 - **only for bug reports**) or in my [server](https://discord.gg/F9nMfvw9sS). ## Building diff --git a/SwitchGiftDataManager.CommandLine/Program.cs b/SwitchGiftDataManager.CommandLine/Program.cs index 5fddbe6..5ed9a91 100644 --- a/SwitchGiftDataManager.CommandLine/Program.cs +++ b/SwitchGiftDataManager.CommandLine/Program.cs @@ -20,13 +20,13 @@ namespace SwitchGiftDataManager.CommandLine Log(msg); Games game = (Games)int.Parse(Console.ReadLine()!); - if(game is Games.None || game > Games.SCVI) + if (game is Games.None || game > Games.SCVI) { Log("Invalid input. Aborted."); Console.ReadKey(); return; } - else if(game is Games.SCVI) + else if (game is Games.SCVI) { Log("Scarlet and Violet are still not supported by this program. Please wait patiently."); Console.ReadKey(); @@ -44,7 +44,7 @@ namespace SwitchGiftDataManager.CommandLine if (File.Exists(path)) bcat.TryAddWondercards(File.ReadAllBytes(path)); else if (CheckValidPath(path)) - foreach(var file in Directory.GetFiles(path)) + foreach (var file in Directory.GetFiles(path)) if (!bcat.TryAddWondercards(File.ReadAllBytes(file))) Log($"{file} could not be loaded."); @@ -58,7 +58,7 @@ namespace SwitchGiftDataManager.CommandLine bcat.Sort(); Log($"{Environment.NewLine}Enter the source (full) path to your dumped BCAT:"); var sourcepath = Console.ReadLine()!; - if(!CheckValidBcatPath(sourcepath)) + if (!CheckValidBcatPath(sourcepath)) { Log("Not a valid BCAT folder path. Aborted."); Console.ReadKey(); @@ -74,7 +74,7 @@ namespace SwitchGiftDataManager.CommandLine return; } - if (game is not Games.LGPE) + if (game is not (Games.LGPE or Games.BDSP)) { msg = $"{Environment.NewLine}Select a build option:{Environment.NewLine}{Environment.NewLine}" + $"1 - Merge as one file{Environment.NewLine}" + @@ -82,7 +82,12 @@ namespace SwitchGiftDataManager.CommandLine Log(msg); } - var opt = game is not Games.LGPE ? int.Parse(Console.ReadLine()!) : 2; + var opt = game switch { + Games.LGPE => 2, + Games.BDSP => 1, + _ => int.Parse(Console.ReadLine()!), + }; + if(opt < 1 || opt > 2) { Log("Invalid input. Aborted."); diff --git a/SwitchGiftDataManager.CommandLine/Properties/launchSettings.json b/SwitchGiftDataManager.CommandLine/Properties/launchSettings.json new file mode 100644 index 0000000..df1a02c --- /dev/null +++ b/SwitchGiftDataManager.CommandLine/Properties/launchSettings.json @@ -0,0 +1,12 @@ +{ + "profiles": { + "SwitchGiftDataManager.CommandLine": { + "commandName": "Project", + "remoteDebugEnabled": false + }, + "WSL": { + "commandName": "WSL2", + "distributionName": "" + } + } +} \ No newline at end of file diff --git a/SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj b/SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj index 5f35eef..246637b 100644 --- a/SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj +++ b/SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net6.0-windows enable enable Manu098vm @@ -14,12 +14,17 @@ https://github.com/Manu098vm/Switch-Gift-Data-Manager https://github.com/Manu098vm/Switch-Gift-Data-Manager git + Debug;Release;WSL embedded + + embedded + + embedded diff --git a/SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj.user b/SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj.user new file mode 100644 index 0000000..4db7283 --- /dev/null +++ b/SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj.user @@ -0,0 +1,9 @@ + + + + ProjectDebugger + + + SwitchGiftDataManager.CommandLine + + \ No newline at end of file diff --git a/SwitchGiftDataManager.Core/Classes/BCATManager/BCATManager.cs b/SwitchGiftDataManager.Core/Classes/BCATManager/BCATManager.cs index 13769ac..547f295 100644 --- a/SwitchGiftDataManager.Core/Classes/BCATManager/BCATManager.cs +++ b/SwitchGiftDataManager.Core/Classes/BCATManager/BCATManager.cs @@ -133,7 +133,7 @@ namespace SwitchGiftDataManager.Core if (WCList is not null && WCList.Count > 0) foreach (var wc in WCList) { - var str = wc.Type!.ToString()!.Equals("Pokemon") ? ((PokemonGift)wc.Content!).GetSpeciesName() : ((List)wc.Content!)[0].Type!.ToString()!; + var str = wc.Type!.ToString()!.Equals("Pokemon") ? ((PokemonGift)wc.Content!).GetSpeciesName() : wc.Type!.ToString()!; list.Add($"{Game} #{wc.WCID}: {str}"); } return list; @@ -148,7 +148,7 @@ namespace SwitchGiftDataManager.Core var el4 = ""; var el5 = ""; - if (WCList is not null && WCList.Count > 0 && WCList.Count >= index - 1) + if (WCList is not null && WCList.Count > 0 && WCList.Count >= index) { var wc = WCList.ElementAt(index); wcid = wc.WCID.ToString(); diff --git a/SwitchGiftDataManager.Core/SwitchGiftDataManager.Core.csproj b/SwitchGiftDataManager.Core/SwitchGiftDataManager.Core.csproj index 0b2d180..2fbdb09 100644 --- a/SwitchGiftDataManager.Core/SwitchGiftDataManager.Core.csproj +++ b/SwitchGiftDataManager.Core/SwitchGiftDataManager.Core.csproj @@ -14,12 +14,17 @@ https://github.com/Manu098vm/Switch-Gift-Data-Manager https://github.com/Manu098vm/Switch-Gift-Data-Manager git + Debug;Release;WSL embedded + + embedded + + embedded diff --git a/SwitchGiftDataManager.WinForm/MainWindow.cs b/SwitchGiftDataManager.WinForm/MainWindow.cs index 338685c..693a8be 100644 --- a/SwitchGiftDataManager.WinForm/MainWindow.cs +++ b/SwitchGiftDataManager.WinForm/MainWindow.cs @@ -171,7 +171,14 @@ namespace SwitchGiftDataManager.WinForm MessageBox.Show("Scarlet and Violet features still not available."); } - private void BtnSave_Click(object sender, EventArgs e) => new SaveWindow(GetCurrentList(), CurrentGame).Show(); + private void BtnSave_Click(object sender, EventArgs e) + { + this.Enabled = false; + var saveForm = new SaveWindow(GetCurrentList(), CurrentGame); + saveForm.FormClosed += (s, e) => this.Enabled = true; + saveForm.Location = this.Location; + saveForm.Show(); + } private void BtnApply_Click(object sender, EventArgs e) { diff --git a/SwitchGiftDataManager.WinForm/Properties/Settings.Designer.cs b/SwitchGiftDataManager.WinForm/Properties/Settings.Designer.cs new file mode 100644 index 0000000..c47076c --- /dev/null +++ b/SwitchGiftDataManager.WinForm/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SwitchGiftDataManager.WinForm.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/SwitchGiftDataManager.WinForm/Properties/Settings.settings b/SwitchGiftDataManager.WinForm/Properties/Settings.settings new file mode 100644 index 0000000..049245f --- /dev/null +++ b/SwitchGiftDataManager.WinForm/Properties/Settings.settings @@ -0,0 +1,6 @@ + + + + + + diff --git a/SwitchGiftDataManager.WinForm/SaveWindow.Designer.cs b/SwitchGiftDataManager.WinForm/SaveWindow.Designer.cs index 72b9547..67391d8 100644 --- a/SwitchGiftDataManager.WinForm/SaveWindow.Designer.cs +++ b/SwitchGiftDataManager.WinForm/SaveWindow.Designer.cs @@ -172,6 +172,7 @@ this.MinimizeBox = false; this.Name = "SaveWindow"; this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.Text = "Save BCAT Package"; this.GrpBuild.ResumeLayout(false); this.GrpBuild.PerformLayout(); @@ -180,7 +181,6 @@ this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); - } #endregion diff --git a/SwitchGiftDataManager.WinForm/SaveWindow.cs b/SwitchGiftDataManager.WinForm/SaveWindow.cs index 320b4ef..58a6789 100644 --- a/SwitchGiftDataManager.WinForm/SaveWindow.cs +++ b/SwitchGiftDataManager.WinForm/SaveWindow.cs @@ -16,11 +16,13 @@ namespace SwitchGiftDataManager.WinForm Package = bcat; Game = game; - if(Game is Games.LGPE) + if (Game is Games.LGPE) { RadioUnique.Checked = true; RadioMultiple.Enabled = false; } + else if (Game is Games.BDSP) + RadioUnique.Enabled = false; } private void BtnCancel_Click(object sender, EventArgs e) => this.Close(); diff --git a/SwitchGiftDataManager.WinForm/SwitchGiftDataManager.WinForm.csproj b/SwitchGiftDataManager.WinForm/SwitchGiftDataManager.WinForm.csproj index 032a045..c5070a7 100644 --- a/SwitchGiftDataManager.WinForm/SwitchGiftDataManager.WinForm.csproj +++ b/SwitchGiftDataManager.WinForm/SwitchGiftDataManager.WinForm.csproj @@ -17,6 +17,7 @@ Project Pokémon https://github.com/Manu098vm/Switch-Gift-Data-Manager https://github.com/Manu098vm/Switch-Gift-Data-Manager + Debug;Release;WSL @@ -24,6 +25,11 @@ True + + embedded + True + + embedded @@ -55,6 +61,11 @@ True Resources.resx + + True + True + Settings.settings + @@ -65,6 +76,10 @@ + + SettingsSingleFileGenerator + Settings.Designer.cs + True \