Compare commits

..

No commits in common. "main" and "1.7.0" have entirely different histories.
main ... 1.7.0

21 changed files with 416 additions and 587 deletions

View File

@ -1,3 +1,41 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build, test, sign and package a WPF or Windows Forms desktop application
# built on .NET Core.
# To learn how to migrate your existing application to .NET Core,
# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework
#
# To configure this workflow:
#
# 1. Configure environment variables
# GitHub sets default environment variables for every workflow run.
# Replace the variables relative to your project in the "env" section below.
#
# 2. Signing
# Generate a signing certificate in the Windows Application
# Packaging Project or add an existing signing certificate to the project.
# Next, use PowerShell to encode the .pfx file using Base64 encoding
# by running the following Powershell script to generate the output string:
#
# $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte
# [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt'
#
# Open the output file, SigningCertificate_Encoded.txt, and copy the
# string inside. Then, add the string to the repo as a GitHub secret
# and name it "Base64_Encoded_Pfx."
# For more information on how to configure your signing certificate for
# this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing
#
# Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key".
# See "Build the Windows Application Packaging project" below to see how the secret is used.
#
# For more information on GitHub Actions, refer to https://github.com/features/actions
# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications,
# refer to https://github.com/microsoft/github-actions-for-desktop-apps
name: Linux
on:
@ -14,33 +52,35 @@ jobs:
matrix:
configuration: [Release]
runs-on: ubuntu-latest
runs-on: ubuntu-latest # For a list of available runner types, refer to
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
env:
Solution_Name: SwitchGiftDataManager.sln
Project_Path: SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install .NET
uses: actions/setup-dotnet@v4
# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
- name: Clean previous build artifacts
run: dotnet clean ${{ env.Project_Path }} --configuration ${{ matrix.configuration }}
- name: Install dependencies and build
run: |
dotnet restore ${{ env.Project_Path }}
dotnet build ${{ env.Project_Path }} --configuration ${{ matrix.configuration }} --no-restore
dotnet-version: 8.0.x
# Create the app package by building and packaging
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj --configuration Release --no-restore
- name: Test
run: dotnet test SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj --no-restore --verbosity normal
# Upload the artifact: https://github.com/marketplace/actions/upload-a-build-artifact
- name: Upload Linux CommandLine build artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: Linux.CommandLine.App
path: SwitchGiftDataManager.CommandLine/bin
path: SwitchGiftDataManager.CommandLine/bin

View File

@ -1,3 +1,41 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build, test, sign and package a WPF or Windows Forms desktop application
# built on .NET Core.
# To learn how to migrate your existing application to .NET Core,
# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework
#
# To configure this workflow:
#
# 1. Configure environment variables
# GitHub sets default environment variables for every workflow run.
# Replace the variables relative to your project in the "env" section below.
#
# 2. Signing
# Generate a signing certificate in the Windows Application
# Packaging Project or add an existing signing certificate to the project.
# Next, use PowerShell to encode the .pfx file using Base64 encoding
# by running the following Powershell script to generate the output string:
#
# $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte
# [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt'
#
# Open the output file, SigningCertificate_Encoded.txt, and copy the
# string inside. Then, add the string to the repo as a GitHub secret
# and name it "Base64_Encoded_Pfx."
# For more information on how to configure your signing certificate for
# this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing
#
# Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key".
# See "Build the Windows Application Packaging project" below to see how the secret is used.
#
# For more information on GitHub Actions, refer to https://github.com/features/actions
# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications,
# refer to https://github.com/microsoft/github-actions-for-desktop-apps
name: MacOS
on:
@ -14,42 +52,35 @@ jobs:
matrix:
configuration: [Release]
runs-on: macos-latest
runs-on: macos-latest # For a list of available runner types, refer to
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
env:
Solution_Name: SwitchGiftDataManager.sln
Project_Path: SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
- name: Cache NuGet packages
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
dotnet-version: 8.0.x
# Create the app package by building and packaging
- name: Install dependencies
run: dotnet restore ${{ env.Project_Path }}
run: dotnet restore
- name: Build
run: dotnet build ${{ env.Project_Path }} --configuration ${{ matrix.configuration }} --no-restore
run: dotnet build SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj --configuration Release --no-restore
- name: Test
run: dotnet test ${{ env.Project_Path }} --no-restore --verbosity normal
run: dotnet test SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj --no-restore --verbosity normal
# Upload the artifact: https://github.com/marketplace/actions/upload-a-build-artifact
- name: Upload MacOS CommandLine build artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: MacOS.CommandLine.App
path: SwitchGiftDataManager.CommandLine/bin
path: SwitchGiftDataManager.CommandLine/bin

View File

@ -1,3 +1,41 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build, test, sign and package a WPF or Windows Forms desktop application
# built on .NET Core.
# To learn how to migrate your existing application to .NET Core,
# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework
#
# To configure this workflow:
#
# 1. Configure environment variables
# GitHub sets default environment variables for every workflow run.
# Replace the variables relative to your project in the "env" section below.
#
# 2. Signing
# Generate a signing certificate in the Windows Application
# Packaging Project or add an existing signing certificate to the project.
# Next, use PowerShell to encode the .pfx file using Base64 encoding
# by running the following Powershell script to generate the output string:
#
# $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte
# [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt'
#
# Open the output file, SigningCertificate_Encoded.txt, and copy the
# string inside. Then, add the string to the repo as a GitHub secret
# and name it "Base64_Encoded_Pfx."
# For more information on how to configure your signing certificate for
# this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing
#
# Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key".
# See "Build the Windows Application Packaging project" below to see how the secret is used.
#
# For more information on GitHub Actions, refer to https://github.com/features/actions
# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications,
# refer to https://github.com/microsoft/github-actions-for-desktop-apps
name: Windows
on:
@ -14,42 +52,52 @@ jobs:
matrix:
configuration: [Release]
runs-on: windows-latest
runs-on: windows-latest # For a list of available runner types, refer to
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
env:
Solution_Name: SwitchGiftDataManager.sln
Configuration: ${{ matrix.configuration }}
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install .NET
uses: actions/setup-dotnet@v4
# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
dotnet-version: 8.0.x
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2
uses: microsoft/setup-msbuild@v1.1
# Execute all unit tests in the solution
- name: Execute unit tests
run: dotnet test
- name: Restore and build the application
run: |
msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
msbuild $env:Solution_Name /property:Configuration=$env:Configuration
# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore the application
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}
# Create the app package by building and packaging the Windows Application Packaging project
- name: Create the app package
run: msbuild $env:Solution_Name /property:Configuration=Release
# Upload the artifact: https://github.com/marketplace/actions/upload-a-build-artifact
- name: Upload WinForms build artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: WindowsForm.GUI.App
path: SwitchGiftDataManager.WinForm/bin
# Upload the artifact: https://github.com/marketplace/actions/upload-a-build-artifact
- name: Upload Windows CommandLine build artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: Windows.CommandLine.App
path: SwitchGiftDataManager.CommandLine/bin
path: SwitchGiftDataManager.CommandLine/bin

View File

@ -2,75 +2,74 @@
![immagine](https://github.com/Manu098vm/Switch-Gift-Data-Manager/assets/52102823/2c327c72-d34a-41c2-b912-fe290ea00446)
## About
This tool aims to bring back past Mystery Gift event content in all Pokémon games for Nintendo Switch.
Since these games don't allow event injection in the save file, this tool creates a forged BCAT package, which can be injected using homebrew tools like [JKSV](https://github.com/J-D-K/JKSV/releases).
This allows wondercards to be redeemed through the in-game Mystery Gift menu. The use of this tool does not involve hacking the game ROM or modifying the game save file.
This tool aims to make past Mystery Gift event contents back again in all the Pokémon games for Nintendo Switch.
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 allows wondercards to be redeemed through the In-Game Mystery Gift Menu. The use of this tool does not involve hacking the game ROM nor hacking the game SAV.
### 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)
* Scarlet & Violet wondercard files (.wc9)
* Legends Z-A wondercard files (.wa9)
* BCAT wondercard files, containing either multiple or single wondercards (no file format extension)
* Scarlet & Violet wondercard files (.wc9)
* BCAT wondercard files, either with mutiple or single wondercards (no file format extension)
### 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
* Pokémon Scarlet and Violet
* Pokémon Legends Z-A
* Pokémon Scarlet and Violet
## Disclosure
Neither I nor the Project Pokémon staff take any responsibility for possible adverse outcomes or bans resulting from the use of this tool. Use it at your own discretion.
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 sensitive console-specific information that you should keep secure. Do not share your BCAT with others!
**N.B:** Some BCAT files contain sensible console-specific informations, which you should keep safe. Don't share your BCAT to others!
## Usage
This section refers to the Windows Form app. The Command Line app usage is similar and should be fairly intuitive.
* Ensure you have the required [.NET 9.0 Desktop Runtime](https://dotnet.microsoft.com/it-it/download/dotnet/9.0) installed correctly.
* Dump your game's BCAT with [JKSV](https://github.com/J-D-K/JKSV/releases) and keep some copies in a safe place.
* Open the tool and select your game of choice.
* Import the wondercard files of your choice (by drag & drop or by clicking the `Open Files` button).
* Optionally, edit the wondercard ID (WCID) if you have duplicate WCs, then 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 using JKSV.
* To redeem the old event gifts, 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).
This paragraph refers to the Windows Form app. The Command Line app usage is similar and should be fairly intuitive.
* Ensure you have the required [.NET 8.0 Desktop Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/8.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
* 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 recommend avoiding this procedure during that timeframe to prevent desynchronization.
**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, press X to open the menu, then click `Reset Save Data`.
* Download the latest BCAT for your game 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.
* 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.
## Support/Troubleshooting
If you find any bugs or need support, please post in the [relevant topic on 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 my [Discord server](https://discord.gg/yWveAjKbKt).
If you find any bug or you need support, please write in the [relevant topic on 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 in my [Discord server](https://discord.gg/yWveAjKbKt).
[<img src="https://canary.discordapp.com/api/guilds/693083823197519873/widget.png?style=banner2">](https://discord.gg/yWveAjKbKt)
## Building
* All Switch Gift Data Manager projects require .NET 9.0.
* `.WinForm` is a Windows Form application and can only be built on Windows operating systems.
* `.Core` and `.CommandLine` can be built on any platform.
* Use the Debug build configuration when editing or developing code related to the `.WinForm` project. Build as Release only once the code is finalized.
* To build the projects, open the `.sln` file in the root directory with an IDE such as Visual Studio 2022, then click `Build` -> `Build Solution`.
* All the Switch Gift Data Manager projects require .NET 8.0.
* .WinForm is a Windows Form application and can only be built in Windows Operating Systems.
* .Core and .CommandLine can be built in any platform OS.
* Use the Debug build configuration when editing or developing code related to the .WinForm project. Build as Release only once the code is finished.
* To build the projects, open the .sln file in the root directory with an IDE such as Visual Studio 2022, click `Build` -> `Build Solution`.
The `.CommandLine` project is currently just a simple script that calls the `.Core` functionalities and can run on any popular OS. Feel free to improve it and/or submit a pull request if you'd like :-)
The .CommandLine project is currently just a simple script that calls the .Core functionalities and can run on any popular OS. Feel free to improve it and/or submit a pull request if you'd like :-)
## Credits
* [PNZeml](https://github.com/PNZeml) for the CRC-16/CCITT-FALSE with lookup table [implementation](https://gist.github.com/tijnkooijmans/10981093?permalink_comment_id=3996072#gistcomment-3996072).
* [kwsch](https://github.com/kwsch), [sora10pls](https://github.com/sora10pls), and all the [PKHeX](https://github.com/kwsch/PKHeX) and [pkNX](https://github.com/kwsch/pkNX) developers and contributors for various offsets and resources.
* [PP-theSLAYER](https://github.com/PP-theSLAYER) and [pasqualenardiello](https://github.com/pasqualenardiello) for their research on the Sword & Shield fashion block and the Scarlet & Violet fashion block, respectively.
* All the Project Pokémon staff and the [Event Gallery](https://github.com/projectpokemon/EventsGallery) contributors for their archival efforts that made this project possible.
* [PNZeml](https://github.com/PNZeml) for the CRC-16/CCITT-FALSE with lookup table [implementation](https://gist.github.com/tijnkooijmans/10981093?permalink_comment_id=3996072#gistcomment-3996072)
* [kwsch](https://github.com/kwsch), [sora10pls](https://github.com/sora10pls) and all the [PKHeX](https://github.com/kwsch/PKHeX) and [pkNX](https://github.com/kwsch/pkNX) devs and contributors
for a lot of offsets and resources
* [PP-theSLAYER](https://github.com/PP-theSLAYER) and [pasqualenardiello](https://github.com/pasqualenardiello) for their researches on the Sword & Shield fashion block and on the Scarlet and Violet fashion block respectively
* All the Project Pokémon Staff and the [Event Gallery](https://github.com/projectpokemon/EventsGallery) contributors for their archival efforts that made this possible
## License
![gplv3-with-text-136x68](https://user-images.githubusercontent.com/52102823/199572700-4e02ed70-74ef-4d67-991e-3168d93aac0d.png)
Copyright © 2025 Manu098vm
Copyright © 2023 Manu098vm
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -17,12 +17,11 @@ public static class Program
$"2 - SWSH{Environment.NewLine}" +
$"3 - BDSP{Environment.NewLine}" +
$"4 - PLA{Environment.NewLine}" +
$"5 - SCVI{Environment.NewLine}" +
$"6 - ZA";
$"5 - SCVI";
Log(msg);
Games game = (Games)int.Parse(Console.ReadLine()!);
if (game is Games.None || game > Games.ZA)
if (game is Games.None || game > Games.SCVI)
{
Log("Invalid input. Aborted.");
Console.ReadKey();

View File

@ -2,11 +2,11 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Authors>Manu098vm</Authors>
<Copyright>Copyright (C) 2024 Manu098vm</Copyright>
<Copyright>Copyright (C) 2022 Manu098vm</Copyright>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>pokemon; mystery gift; wondercard; reader; nintendo; bcat; event injection;</PackageTags>
<PackageLicenseFile>LICENSE</PackageLicenseFile>

View File

@ -7,7 +7,7 @@ namespace SwitchGiftDataManager.Core;
public class BCATManager
{
public const string Version = "1.9.0";
public const string Version = "1.7.0";
private const int FileNameOffset = 0x00;
private const int UnkOffset = 0x20;
@ -35,7 +35,6 @@ public class BCATManager
Games.BDSP => new WB8(data),
Games.PLA => new WA8(data),
Games.SCVI => new WC9(data),
Games.ZA => new WA9(data),
_ => throw new ArgumentOutOfRangeException(nameof(Game)),
};
}
@ -342,12 +341,10 @@ public class BCATManager
return Games.SWSH;
else if (data.Length % (int)Wondercard.GetSize(Games.BDSP) == 0)
return Games.BDSP;
else if (data.Length % (int)Wondercard.GetSize(Games.PLA) == 0 && data[0x0F] != 0)
else if (data.Length % (int)Wondercard.GetSize(Games.PLA) == 0 && data[Wondercard.GenOffset] != 0)
return Games.PLA;
else if (data.Length % (int)Wondercard.GetSize(Games.SCVI) == 0 && data[0x0F] == 0 && data[0x2C0] == 0)
else if (data.Length % (int)Wondercard.GetSize(Games.SCVI) == 0 && data[Wondercard.GenOffset] == 0)
return Games.SCVI;
else if (data.Length % (int)Wondercard.GetSize(Games.ZA) == 0 && data[0x2C0] != 0)
return Games.ZA;
else
return Games.None;
}
@ -361,7 +358,6 @@ public class BCATManager
Games.BDSP => "99",
Games.PLA => "normal",
Games.SCVI => "normal",
Games.ZA => "normal",
_ => throw new ArgumentOutOfRangeException(nameof(game)),
};
}
@ -374,7 +370,6 @@ public class BCATManager
Games.BDSP => "99",
Games.PLA => "distribution_internet",
Games.SCVI => "distribution_internet",
Games.ZA => "distribution_internet",
_ => throw new ArgumentOutOfRangeException(nameof(game)),
};
}

View File

@ -1,5 +1,4 @@
using Enums;
using System.Runtime.CompilerServices;
namespace SwitchGiftDataManager.Core;
@ -8,11 +7,11 @@ public class OtherGift
public object? Type { get; set; }
public ushort Item { get; set; }
public uint Quantity { get; set; }
public uint Opt { get; set; }
public ushort Opt { get; set; }
public string GetItemName() => GetItemName(Item, Type!, Opt);
public static string GetItemName(ushort id, object type, uint opt = 0)
public static string GetItemName(ushort id, object type, ushort opt = 0)
{
var str = "";
@ -99,25 +98,7 @@ public class OtherGift
else
str = ((GiftType9)type).ToString();
}
else if (type.GetType() == typeof(GiftType9A))
{
if ((GiftType9A)type is GiftType9A.Item or GiftType9A.Flag)
str = Properties.Resources.Items.Split(new String[] { "\n" }, StringSplitOptions.None)[id];
else if ((GiftType9A)type is GiftType9A.Clothing)
{
if (!Clothing9A.TryGetValue(opt, out str))
str = "Unknown Clothing Item";
}
else
{
str = ((GiftType9A)type).ToString();
}
}
return str;
}
private static Dictionary<uint, string> Clothing9A = new()
{
{ 0x2E1937, "Trench Coat and Pants Set (Beige)" },
};
}

View File

@ -13,20 +13,26 @@ public class PokemonGift
public string GetSpeciesName() => GetSpeciesName(Species);
public bool IsShiny() => ShinyType switch
public bool IsShiny()
{
ShinyType.ShinyForced => true,
ShinyType.ShinyPossible => (PID != 0 && TID != 0 && SID != 0) && IsShiny(PID, TID, SID),
_ => false,
};
if (ShinyType is ShinyType.ShinyForced)
return true;
else if (ShinyType is ShinyType.ShinyPossible && PID != 0 && TID != 0 && SID != 0)
return IsShiny(PID, TID, SID);
public static string GetSpeciesName(uint species) => Properties.Resources.Species.Split(["\n"], StringSplitOptions.None)[species];
return false;
}
public static bool IsShiny(uint pid, uint tid, uint sid) => (sid != 0 || tid != 0) && (sid ^ tid ^ (pid >> 16) ^ (pid & 0xFFFF)) < 16;
public static string GetSpeciesName(uint species) => Properties.Resources.Species.Split(new string[] { "\n" }, StringSplitOptions.None)[species];
public static bool IsTIDAbusePossible(uint tid, uint sid, PIDType type) => type switch
public static bool IsShiny(uint pid, uint tid, uint sid) => sid != 0 || tid != 0 ? (sid ^ tid ^ (pid >> 16) ^ (pid & 0xFFFF)) < 16 : false;
public static bool IsTIDAbusePossible(uint tid, uint sid, PIDType type)
{
PIDType.FixedPID => tid == 0 && sid == 0,
_ => false,
};
if (type is PIDType.FixedPID)
if (tid == 0)
if (sid == 0)
return true;
return false;
}
}

View File

@ -1,142 +0,0 @@
using System.Buffers.Binary;
using Enums;
namespace SwitchGiftDataManager.Core;
public class WA9 : Wondercard
{
private const int WondercardIDOffset = 0x08;
private const int FlagOffset = 0x10;
private const int GiftTypeOffset = 0x11;
private const int ItemOffset = 0x18;
private const int QuantityOffset = 0x1A;
private const int TIDOffset = 0x18;
private const int SIDOffset = 0x1A;
private const int PIDOffset = 0x24;
private const int FlagStringOffset = 0x28;
private const int FlagItemOffset = 0x6C;
private const int FlagItemQuantityOffset = 0x6E;
private const int SpeciesOffset = 0x270;
private const int ShinyTypeOffset = 0x278;
private const int ChecksumOffset = 0x2C0;
public WA9(ReadOnlySpan<byte> data) : base(data)
{
WCID = BinaryPrimitives.ReadUInt16LittleEndian(data[WondercardIDOffset..]);
IsRepeatable = (Data![FlagOffset] & 1) == 0;
Type = (GiftType9A)Data![GiftTypeOffset];
Content = Type switch
{
GiftType9A.Pokemon => GetPokemon(),
_ => GetItems(),
};
}
private PokemonGift GetPokemon()
{
var species = BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(SpeciesOffset));
var pid = BinaryPrimitives.ReadUInt32LittleEndian(Data.AsSpan(PIDOffset));
var tid = BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(TIDOffset));
var sid = BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(SIDOffset));
var pidtype = (ShinyType9)Data![ShinyTypeOffset] switch
{
ShinyType9.ShinyLocked => PIDType.RandomPID,
ShinyType9.ShinyRandom => PIDType.RandomPID,
ShinyType9.ShinyStar => PIDType.FixedPID,
ShinyType9.ShinySquare => PIDType.FixedPID,
ShinyType9.Fixed => PIDType.FixedPID,
_ => throw new ArgumentOutOfRangeException(),
};
var shinytype = (ShinyType9)Data![ShinyTypeOffset] switch
{
ShinyType9.ShinyLocked => ShinyType.ShinyLocked,
ShinyType9.ShinyRandom => ShinyType.ShinyPossible,
ShinyType9.ShinyStar or ShinyType9.ShinySquare => ShinyType.ShinyForced,
ShinyType9.Fixed => PokemonGift.IsShiny(pid, tid, sid) ? ShinyType.ShinyForced :
PokemonGift.IsTIDAbusePossible(tid, sid, pidtype) ? ShinyType.ShinyTIDAbuse : ShinyType.ShinyLocked,
_ => throw new ArgumentOutOfRangeException(),
};
return new PokemonGift
{
Species = species,
PID = pid,
TID = tid,
SID = sid,
ShinyType = shinytype,
PIDType = pidtype,
};
}
private List<OtherGift> GetItems()
{
List<OtherGift> items = new();
for (int i = 0; i < MaxItemCount; i++)
{
ushort item = 0;
uint quantity = 0;
uint opt = 0;
var type = (GiftType9A)Type!;
if (type is GiftType9A.Clothing)
{
item = BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(ItemOffset + (0x04 * i)));
opt = BinaryPrimitives.ReadUInt32LittleEndian(Data.AsSpan(ItemOffset + (0x04 * i)));
}
else
{
item = type is GiftType9A.Flag ? BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(FlagItemOffset + (0x04 * i))) :
BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(ItemOffset + (0x04 * i)));
quantity = type is GiftType9A.Flag ? BinaryPrimitives.ReadUInt32LittleEndian(Data.AsSpan(FlagItemQuantityOffset + (0x04 * i))) :
BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(QuantityOffset + (0x04 * i)));
}
var gift = new OtherGift
{
Type = type,
Item = item,
Quantity = quantity,
Opt = opt,
};
if ((type is not GiftType9A.Clothing && gift.Item != ushort.MinValue) || (type is GiftType9A.Clothing && item != ushort.MaxValue))
items.Add(gift);
}
return items;
}
public override bool IsChecksumValid()
{
if (Data is not null)
{
var oldChecksum = BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(ChecksumOffset));
var span = Data.ToArray().AsSpan();
BinaryPrimitives.WriteUInt16LittleEndian(span[ChecksumOffset..], 0x0);
var newchecksum = ChecksumCalculator.CalcCcittFalse(span);
if (oldChecksum == newchecksum)
return true;
}
return false;
}
public override void UpdateChecksum()
{
BinaryPrimitives.WriteUInt16LittleEndian(Data.AsSpan(ChecksumOffset), 0x0);
var checksum = ChecksumCalculator.CalcCcittFalse(Data.AsSpan());
BinaryPrimitives.WriteUInt16LittleEndian(Data.AsSpan(ChecksumOffset), checksum);
}
public override void SetID(ushort wcid)
{
BinaryPrimitives.WriteUInt16LittleEndian(Data.AsSpan(WondercardIDOffset), wcid);
WCID = wcid;
UpdateChecksum();
}
public override void SetRepeatable(bool repeatable)
{
Data![FlagOffset] = (byte)((Data![FlagOffset] & ~1) | (repeatable ? 0 : 1));
IsRepeatable = repeatable;
UpdateChecksum();
}
}

View File

@ -14,7 +14,7 @@ public class WB7 : Wondercard
private const int SIDOffset = 0x272;
private const int SpeciesOffset = 0x28A;
private const int ShinyTypeOffset = 0x2AB;
private const int PIDOffset = 0x2DC;
private const int PIDOffset = 0xD4;
private const int ChecksumOffset = 0x202;
public WB7(ReadOnlySpan<byte> data) : base(data)

View File

@ -5,6 +5,7 @@ namespace SwitchGiftDataManager.Core;
public abstract class Wondercard
{
public static int GenOffset = 0x0F;
protected const int MaxItemCount = 6;
public Games Game { get; }
@ -21,9 +22,8 @@ public abstract class Wondercard
WondercardSize.WB7 => Games.LGPE,
WondercardSize.WC8 => Games.SWSH,
WondercardSize.WB8 => Games.BDSP,
WondercardSize.WA8 when data[0x0F] != 0 => Games.PLA,
WondercardSize.WC9 when data[0x0F] == 0 && data[0x2C0] == 0 => Games.SCVI,
WondercardSize.WA9 when data[0x2C0] != 0 => Games.ZA,
WondercardSize.WA8 when data[GenOffset] != 0 => Games.PLA,
WondercardSize.WC9 when data[GenOffset] == 0 => Games.SCVI,
_ => Games.None,
};
Data = data.ToArray();
@ -67,7 +67,6 @@ public abstract class Wondercard
Games.BDSP => WondercardSize.WB8,
Games.PLA => WondercardSize.WA8,
Games.SCVI => WondercardSize.WC9,
Games.ZA => WondercardSize.WA9,
_ => throw new ArgumentOutOfRangeException(nameof(game)),
};
}

View File

@ -8,7 +8,6 @@ public enum Games : int
BDSP = 3,
PLA = 4,
SCVI = 5,
ZA = 6,
}
public enum WCType
@ -24,7 +23,6 @@ public enum WondercardSize : ushort
WB8 = 0x2DC,
WA8 = 0x2C8,
WC9 = 0x2C8,
WA9 = 0x2C8,
}
public enum GiftType7 : byte
@ -73,15 +71,6 @@ public enum GiftType9 : byte
Clothing = 4,
}
public enum GiftType9A : byte
{
None = 0,
Pokemon = 1,
Item = 2,
Flag = 3,
Clothing = 4,
}
public enum PIDType
{
RandomPID,

View File

@ -119,7 +119,7 @@ Shock Drive
Burn Drive
Chill Drive
???
Pokémon Box Link
Pokémon Box Link (1)
Medicine Pocket
TM Case
Candy Jar
@ -424,8 +424,8 @@ HM03
HM04
HM05
HM06
???
???
HM07 (G4)
HM08 (G4)
Explorer Kit
Loot Sack
Rule Book
@ -454,18 +454,18 @@ Oaks Letter
Lunar Feather
Member Card
Azure Flute
S.S. Ticket
S.S. Ticket (HG/SS)
Contest Pass
Magma Stone
Parcel
Parcel (HG/SS)
Coupon 1
Coupon 2
Coupon 3
Storage Key
Secret Medicine
Storage Key (DPPt)
Secret Medicine (G4)
Vs. Recorder
Gracidea
Secret Key
Secret Key (Pt)
Apricorn Box
Unown Report
Berry Pots
@ -473,11 +473,11 @@ Dowsing Machine
Blue Card
Slowpoke Tail
Clear Bell
Card Key
Basement Key
Card Key (HG/SS)
Basement Key (HG/SS)
Squirt Bottle
Red Scale
Lost Item
Lost Item (HG/SS)
Pass
Machine Part
Silver Feather
@ -619,15 +619,15 @@ Dark Stone
TM93
TM94
TM95
Xtransceiver
Xtransceiver (M)
???
Gram 1
Gram 2
Gram 3
Xtransceiver
Xtransceiver (F)
Medal Box
DNA Splicers
DNA Splicers
DNA Splicers (2)
Permit
Oval Charm
Shiny Charm
@ -635,7 +635,7 @@ Plasma Card
Grubby Hanky
Colress Machine
Dropped Item
Dropped Item
Dropped Item (2)
Reveal Glass
Weakness Policy
Assault Vest
@ -692,7 +692,7 @@ TM96
TM97
TM98
TM99
TM100
TM100 (G6-8)
Power Plant Pass
Mega Ring
Intriguing Stone
@ -705,14 +705,14 @@ Adventure Guide
Strange Souvenir
Lens Case
Makeup Bag
Travel Trunk
Travel Trunk (2)
Lumiose Galette
Shalour Sable
Jaw Fossil
Sail Fossil
Looker Ticket
Bike
Holo Caster
Bike (2)
Holo Caster (2)
Fairy Gem
Mega Charm
Mega Glove
@ -721,24 +721,24 @@ Acro Bike
Wailmer Pail
Devon Parts
Soot Sack
Basement Key
Basement Key (OR/AS)
Pokéblock Kit
Letter
Eon Ticket
Scanner
Go-Goggles
Meteorite
Meteorite (1)
Key to Room 1
Key to Room 2
Key to Room 4
Key to Room 6
Storage Key
Storage Key (OR/AS)
Devon Scope
S.S. Ticket
S.S. Ticket (OR/AS)
HM07
Devon Scuba Gear
Contest Costume
Contest Costume
Contest Costume (2)
Magma Suit
Aqua Suit
Pair of Tickets
@ -749,7 +749,7 @@ Mega Anchor
Mega Stickpin
Mega Tiara
Mega Anklet
Meteorite
Meteorite (2)
Swampertite
Sceptilite
Sablenite
@ -769,8 +769,8 @@ Cameruptite
Lopunnite
Salamencite
Beedrillite
Meteorite
Meteorite
Meteorite (3)
Meteorite (4)
Key Stone
Meteorite Shard
Eon Flute
@ -805,42 +805,42 @@ Aloraichium Z
Snorlium Z
Eevium Z
Mewnium Z
Normalium Z
Firium Z
Waterium Z
Electrium Z
Grassium Z
Icium Z
Fightinium Z
Poisonium Z
Groundium Z
Flyinium Z
Psychium Z
Buginium Z
Rockium Z
Ghostium Z
Dragonium Z
Darkinium Z
Steelium Z
Fairium Z
Pikanium Z
Decidium Z
Incinium Z
Primarium Z
Tapunium Z
Marshadium Z
Aloraichium Z
Snorlium Z
Eevium Z
Mewnium Z
Pikashunium Z
Normalium Z [Z]
Firium Z [Z]
Waterium Z [Z]
Electrium Z [Z]
Grassium Z [Z]
Icium Z [Z]
Fightinium Z [Z]
Poisonium Z [Z]
Groundium Z [Z]
Flyinium Z [Z]
Psychium Z [Z]
Buginium Z [Z]
Rockium Z [Z]
Ghostium Z [Z]
Dragonium Z [Z]
Darkinium Z [Z]
Steelium Z [Z]
Fairium Z [Z]
Pikanium Z [Z]
Decidium Z [Z]
Incinium Z [Z]
Primarium Z [Z]
Tapunium Z [Z]
Marshadium Z [Z]
Aloraichium Z [Z]
Snorlium Z [Z]
Eevium Z [Z]
Mewnium Z [Z]
Pikashunium Z [Z]
Pikashunium Z
???
???
???
???
Forage Bag
Fishing Rod
Fishing Rod (SM)
Professors Mask
Festival Ticket
Sparkling Stone
@ -871,12 +871,12 @@ Golden Pinap Berry
???
???
Secret Key
S.S. Ticket
S.S. Ticket (GP/GE)
Silph Scope
Parcel
Card Key
Gold Teeth
Lift Key
Lift Key (GP/GE)
Terrain Extender
Protective Pads
Electric Seed
@ -892,8 +892,8 @@ Gold Leaf
Silver Leaf
Polished Mud Ball
Tropical Shell
Leaf Letter
Leaf Letter
Leaf Letter (GP)
Leaf Letter (GE)
Small Bouquet
???
???
@ -925,12 +925,12 @@ Ultranecrozium Z
Mimikium Z
Lycanium Z
Kommonium Z
Solganium Z
Lunalium Z
Ultranecrozium Z
Mimikium Z
Lycanium Z
Kommonium Z
Solganium Z [Z]
Lunalium Z [Z]
Ultranecrozium Z [Z]
Mimikium Z [Z]
Lycanium Z [Z]
Kommonium Z [Z]
Z-Power Ring
Pink Petal
Orange Petal
@ -943,8 +943,8 @@ Rainbow Flower
Surge Badge
N-Solarizer
N-Lunarizer
N-Solarizer
N-Lunarizer
N-Solarizer (2)
N-Lunarizer (2)
Ilimas Normalium Z
Left Poké Ball
Roto Hatch
@ -1073,13 +1073,13 @@ Magmar Candy
???
???
Endorsement
Pokémon Box Link
Pokémon Box Link (2)
Wishing Star
Dynamax Band
???
???
Fishing Rod
Rotom Bike
Fishing Rod (SW/SH)
Rotom Bike (1)
???
???
Sausages
@ -1264,7 +1264,7 @@ Instant Noodles
Precooked Burger
Gigantamix
Wishing Chip
Rotom Bike
Rotom Bike (2)
Catching Charm
???
Old Letter
@ -1583,13 +1583,13 @@ Galarica Twig
Galarica Cuff
Style Card
Armor Pass
Rotom Bike
Rotom Bike
Rotom Bike (3)
Rotom Bike (4)
Exp. Charm
Armorite Ore
Mark Charm
Reins of Unity
Reins of Unity
Reins of Unity (1)
Reins of Unity (2)
Galarica Wreath
Legendary Clue 1
Legendary Clue 2
@ -1605,7 +1605,7 @@ Shaderoot Carrot
Dynite Ore
Carrot Seeds
Ability Patch
Reins of Unity
Reins of Unity (3)
Time Balm
Space Balm
Mysterious Balm
@ -1614,13 +1614,13 @@ Hometown Muffin
Apricorn
Jubilife Muffin
Aux Powerguard
Dire Hit
Dire Hit (LA)
Choice Dumpling
Twice-Spiced Radish
Swap Snack
Caster Fern
Seed of Mastery
Poké Ball
Poké Ball (-)
???
Eternal Ice
Uxies Claw
@ -1638,44 +1638,44 @@ Crunchy Salt
Wood
Kings Leaf
Marsh Balm
Poké Ball
Great Ball
Ultra Ball
Feather Ball
Pokéshi Doll
Poké Ball (~)
Great Ball (~)
Ultra Ball (~)
Feather Ball (~)
Pokéshi Doll (~)
???
Smoke Bomb
Scatter Bang
Sticky Glob
Star Piece
Mushroom Cake
Smoke Bomb (~)
Scatter Bang (~)
Sticky Glob (~)
Star Piece (~)
Mushroom Cake (~)
Bugwort
Honey Cake
Grain Cake
Bean Cake
Salt Cake
Potion
Super Potion
Hyper Potion
Max Potion
Full Restore
Remedy
Fine Remedy
Superb Remedy
Old Gateau
Jubilife Muffin
Full Heal
Revive
Max Revive
Max Ether
Max Elixir
Stealth Spray
Honey Cake (~)
Grain Cake (~)
Bean Cake (~)
Salt Cake (~)
Potion (~)
Super Potion (~)
Hyper Potion (~)
Max Potion (~)
Full Restore (~)
Remedy (~)
Fine Remedy (~)
Superb Remedy (~)
Old Gateau (~)
Jubilife Muffin (~)
Full Heal (~)
Revive (~)
Max Revive (~)
Max Ether (~)
Max Elixir (~)
Stealth Spray (~)
???
Aux Power
Aux Guard
Dire Hit
Aux Evasion
Aux Powerguard
Aux Power (~)
Aux Guard (~)
Dire Hit (~)
Aux Evasion (~)
Aux Powerguard (~)
Forest Balm
Iron Chunk
???
@ -1687,7 +1687,7 @@ Ball of Mud
Pop Pod
Sootfoot Root
Spoiled Apricorn
Snowball
Snowball (LA)
Sticky Glob
Black Augurite
Peat Block
@ -1708,9 +1708,9 @@ Tempting Charm T
Tempting Charm Y
Candy Truffle
Cake-Lure Base
Poké Ball
Great Ball
Ultra Ball
Poké Ball (LA)
Great Ball (LA)
Ultra Ball (LA)
Feather Ball
???
???
@ -1727,9 +1727,9 @@ Grain Cake
Bean Cake
Mushroom Cake
Salt Cake
Swap Snack
Choice Dumpling
Twice-Spiced Radish
Swap Snack (~)
Choice Dumpling (~)
Twice-Spiced Radish (~)
Survival Charm R
Survival Charm B
Survival Charm P
@ -1746,12 +1746,12 @@ Basculegion Food
Old Journal
Wing Ball
Jet Ball
Heavy Ball
Heavy Ball (LA)
Leaden Ball
Gigaton Ball
Wing Ball
Jet Ball
Heavy Ball
Wing Ball (~)
Jet Ball (~)
Heavy Ball (~)
Hopo Berry
Superb Remedy
Aux Power
@ -1761,13 +1761,13 @@ Grit Dust
Grit Gravel
Grit Pebble
Grit Rock
Secret Medicine
Secret Medicine (LA)
Tempting Charm R
Lost Satchel
Lost Satchel
Lost Satchel
Lost Satchel
Lost Satchel
Lost Satchel (1)
Lost Satchel (2)
Lost Satchel (3)
Lost Satchel (4)
Lost Satchel (5)
???
Origin Ball
???
@ -1781,8 +1781,8 @@ Griseous Core
Blank Plate
???
Crafting Kit
Leaden Ball
Gigaton Ball
Leaden Ball (~)
Gigaton Ball (~)
Strange Ball
Pokédex
Old Verse 1
@ -1832,8 +1832,8 @@ Sandwich
Koraidons Poké Ball
Miraidons Poké Ball
Tera Orb
Scarlet Book
Violet Book
Scarlet Book (1)
Violet Book (1)
Kofus Wallet
@ -2311,24 +2311,24 @@ TM229
Picnic Set
Academy Bottle
Academy Bottle
Academy Bottle (1)
Academy Bottle (2)
Polka-Dot Bottle
Striped Bottle
Diamond Bottle
Academy Cup
Academy Cup
Academy Cup (1)
Academy Cup (2)
Striped Cup
Polka-Dot Cup
Flower Pattern Cup
Academy Tablecloth
Academy Tablecloth
Academy Tablecloth (1)
Academy Tablecloth (2)
Whimsical Tablecloth
Leafy Tablecloth
Spooky Tablecloth
Academy Ball
Academy Ball
Academy Ball (1)
Academy Ball (2)
Marill Ball
Yarn Ball
Cyber Ball
@ -2416,8 +2416,8 @@ Genius Mochi
Clever Mochi
Swift Mochi
Simple Chairs
Academy Chairs
Academy Chairs
Academy Chairs (SL)
Academy Chairs (VL)
Whimsical Chairs
Leafy Chairs
Spooky Chairs
@ -2553,83 +2553,6 @@ Blueberry Tablecloth
Blueberry Chairs
Synchro Machine
Meteorite
Scarlet Book
Violet Book
Scarlet Book (2)
Violet Book (2)
Briars Book
Seed of Mastery
Clefablite
Victreebelite
Starminite
Dragoninite
Meganiumite
Feraligite
Skarmorite
Froslassite
Emboarite
Excadrite
Scolipite
Scraftinite
Eelektrossite
Chandelurite
Chesnaughtite
Delphoxite
Greninjite
Pyroarite
Floettite
Malamarite
Barbaracite
Dragalgite
Hawluchanite
Zygardite
Drampanite
Falinksite
Key to Room 202
Super Lumiose Galette
Lab Key Card A
Lab Key Card B
Lab Key Card C
Pebble
Cherished Ring
Autographed Plush
Tasty Trash
Revitalizing Twig
Lidas Things
Mega Shard
Colorful Screw
Red Canari Plush
Red Canari Plush
Red Canari Plush
Gold Canari Plush
Gold Canari Plush
Gold Canari Plush
Pink Canari Plush
Pink Canari Plush
Pink Canari Plush
Green Canari Plush
Green Canari Plush
Green Canari Plush
Blue Canari Plush
Blue Canari Plush
Blue Canari Plush

View File

@ -8061,8 +8061,6 @@ Pika-Vee Case
Scarlet Case
Violet Case
@ -8073,7 +8071,9 @@ Violet Case
Neo-Kitakami Case

View File

@ -2,11 +2,11 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Authors>Manu098vm</Authors>
<Copyright>Copyright (C) 2024 Manu098vm</Copyright>
<Copyright>Copyright (C) 2022 Manu098vm</Copyright>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>pokemon; mystery gift; wondercard; reader; nintendo; bcat; event injection;</PackageTags>
<PackageLicenseFile>LICENSE</PackageLicenseFile>

View File

@ -62,7 +62,6 @@ partial class MainWindow
ToolsToolStripMenu = new ToolStripMenuItem();
MenuItemMGDB = new ToolStripMenuItem();
toolTipRedemptionMethod = new ToolTip(components);
BtnZA = new Button();
GrpBCAT.SuspendLayout();
GrpContent.SuspendLayout();
ContextMenuStripWC.SuspendLayout();
@ -77,7 +76,7 @@ partial class MainWindow
BtnLGPE.FlatStyle = FlatStyle.Flat;
BtnLGPE.Location = new Point(5, 37);
BtnLGPE.Name = "BtnLGPE";
BtnLGPE.Size = new Size(111, 60);
BtnLGPE.Size = new Size(136, 60);
BtnLGPE.TabIndex = 0;
BtnLGPE.TabStop = false;
BtnLGPE.Text = "LGPE";
@ -90,9 +89,9 @@ partial class MainWindow
BtnSWSH.AccessibleName = "";
BtnSWSH.Cursor = Cursors.Hand;
BtnSWSH.FlatStyle = FlatStyle.Flat;
BtnSWSH.Location = new Point(122, 37);
BtnSWSH.Location = new Point(147, 37);
BtnSWSH.Name = "BtnSWSH";
BtnSWSH.Size = new Size(111, 60);
BtnSWSH.Size = new Size(136, 60);
BtnSWSH.TabIndex = 1;
BtnSWSH.TabStop = false;
BtnSWSH.Text = "SWSH";
@ -105,9 +104,9 @@ partial class MainWindow
BtnBDSP.AccessibleName = "";
BtnBDSP.Cursor = Cursors.Hand;
BtnBDSP.FlatStyle = FlatStyle.Flat;
BtnBDSP.Location = new Point(239, 37);
BtnBDSP.Location = new Point(289, 37);
BtnBDSP.Name = "BtnBDSP";
BtnBDSP.Size = new Size(111, 60);
BtnBDSP.Size = new Size(136, 60);
BtnBDSP.TabIndex = 2;
BtnBDSP.TabStop = false;
BtnBDSP.Text = "BDSP";
@ -120,9 +119,9 @@ partial class MainWindow
BtnSCVI.AccessibleName = "";
BtnSCVI.Cursor = Cursors.Hand;
BtnSCVI.FlatStyle = FlatStyle.Flat;
BtnSCVI.Location = new Point(473, 37);
BtnSCVI.Location = new Point(573, 37);
BtnSCVI.Name = "BtnSCVI";
BtnSCVI.Size = new Size(111, 60);
BtnSCVI.Size = new Size(136, 60);
BtnSCVI.TabIndex = 3;
BtnSCVI.TabStop = false;
BtnSCVI.Text = "SCVI";
@ -135,9 +134,9 @@ partial class MainWindow
BtnPLA.AccessibleName = "";
BtnPLA.Cursor = Cursors.Hand;
BtnPLA.FlatStyle = FlatStyle.Flat;
BtnPLA.Location = new Point(356, 37);
BtnPLA.Location = new Point(431, 37);
BtnPLA.Name = "BtnPLA";
BtnPLA.Size = new Size(111, 60);
BtnPLA.Size = new Size(136, 60);
BtnPLA.TabIndex = 4;
BtnPLA.TabStop = false;
BtnPLA.Text = "PLA";
@ -149,6 +148,7 @@ partial class MainWindow
ListBoxWC.AllowDrop = true;
ListBoxWC.DrawMode = DrawMode.OwnerDrawFixed;
ListBoxWC.FormattingEnabled = true;
ListBoxWC.ItemHeight = 20;
ListBoxWC.Location = new Point(7, 96);
ListBoxWC.Name = "ListBoxWC";
ListBoxWC.Size = new Size(214, 304);
@ -196,7 +196,7 @@ partial class MainWindow
GrpBCAT.Enabled = false;
GrpBCAT.Location = new Point(5, 103);
GrpBCAT.Name = "GrpBCAT";
GrpBCAT.Size = new Size(696, 409);
GrpBCAT.Size = new Size(704, 409);
GrpBCAT.TabIndex = 8;
GrpBCAT.TabStop = false;
GrpBCAT.Text = "BCAT Manager";
@ -404,7 +404,7 @@ partial class MainWindow
MenuStrip.Items.AddRange(new ToolStripItem[] { ToolsToolStripMenu });
MenuStrip.Location = new Point(0, 0);
MenuStrip.Name = "MenuStrip";
MenuStrip.Size = new Size(709, 28);
MenuStrip.Size = new Size(715, 28);
MenuStrip.TabIndex = 9;
MenuStrip.Text = "menuStrip1";
//
@ -432,28 +432,12 @@ partial class MainWindow
toolTipRedemptionMethod.ToolTipIcon = ToolTipIcon.Info;
toolTipRedemptionMethod.ToolTipTitle = "Redemption Date";
//
// BtnZA
//
BtnZA.AccessibleDescription = "";
BtnZA.AccessibleName = "";
BtnZA.Cursor = Cursors.Hand;
BtnZA.FlatStyle = FlatStyle.Flat;
BtnZA.Location = new Point(590, 37);
BtnZA.Name = "BtnZA";
BtnZA.Size = new Size(111, 60);
BtnZA.TabIndex = 10;
BtnZA.TabStop = false;
BtnZA.Text = "ZA";
BtnZA.UseVisualStyleBackColor = true;
BtnZA.Click += BtnZA_Click;
//
// MainWindow
//
AllowDrop = true;
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(709, 518);
Controls.Add(BtnZA);
ClientSize = new Size(715, 518);
Controls.Add(MenuStrip);
Controls.Add(GrpBCAT);
Controls.Add(BtnPLA);
@ -514,5 +498,4 @@ partial class MainWindow
private Label lblRedemptionMethod;
private ToolTip toolTipRedemptionMethod;
private ComboBox cmbRedemptionMethod;
private Button BtnZA;
}

View File

@ -17,7 +17,6 @@ public partial class MainWindow : Form
private BCATManager PackageBDSP = new(Games.BDSP);
private BCATManager PackagePLA = new(Games.PLA);
private BCATManager PackageSCVI = new(Games.SCVI);
private BCATManager PackageZA = new(Games.ZA);
private List<ushort> Duplicated = new List<ushort>();
public MainWindow()
@ -60,14 +59,12 @@ public partial class MainWindow : Form
BtnBDSP.Enabled = true;
BtnPLA.Enabled = true;
BtnSCVI.Enabled = true;
BtnZA.Enabled = true;
BtnLGPE.Font = new Font(BtnLGPE.Font.Name, BtnLGPE.Font.Size, FontStyle.Regular);
BtnSWSH.Font = new Font(BtnSWSH.Font.Name, BtnSWSH.Font.Size, FontStyle.Regular);
BtnBDSP.Font = new Font(BtnBDSP.Font.Name, BtnBDSP.Font.Size, FontStyle.Regular);
BtnPLA.Font = new Font(BtnPLA.Font.Name, BtnPLA.Font.Size, FontStyle.Regular);
BtnSCVI.Font = new Font(BtnSCVI.Font.Name, BtnSCVI.Font.Size, FontStyle.Regular);
BtnZA.Font = new Font(BtnZA.Font.Name, BtnZA.Font.Size, FontStyle.Regular);
}
private void EditFileFilter()
@ -79,7 +76,6 @@ public partial class MainWindow : Form
Games.BDSP => "wb8 files (*.wb8)|*.wb8|All files (*.*)|*.*",
Games.PLA => "wa8 files (*.wa8)|*.wa8|All files (*.*)|*.*",
Games.SCVI => "wc9 files (*.wc9)|*.wc9|All files (*.*)|*.*",
Games.ZA => "wa9 files (*.wa9)|*.wa9|All files (*.*)|*.*",
_ => "All files (*.*)|*.*",
};
}
@ -93,7 +89,6 @@ public partial class MainWindow : Form
Games.BDSP => BtnBDSP,
Games.PLA => BtnPLA,
Games.SCVI => BtnSCVI,
Games.ZA => BtnZA,
_ => throw new ArgumentOutOfRangeException(),
};
EditSelectedButton(btn);
@ -117,7 +112,6 @@ public partial class MainWindow : Form
Games.BDSP => PackageBDSP.GetListNames(),
Games.PLA => PackagePLA.GetListNames(),
Games.SCVI => PackageSCVI.GetListNames(),
Games.ZA => PackageZA.GetListNames(),
_ => throw new ArgumentOutOfRangeException(),
};
@ -150,7 +144,6 @@ public partial class MainWindow : Form
Games.BDSP => PackageBDSP,
Games.PLA => PackagePLA,
Games.SCVI => PackageSCVI,
Games.ZA => PackageZA,
_ => throw new ArgumentOutOfRangeException(),
};
}
@ -197,8 +190,6 @@ public partial class MainWindow : Form
private void BtnSCVI_Click(object sender, EventArgs e) => ChangeGame(Games.SCVI);
private void BtnZA_Click(object sender, EventArgs e) => ChangeGame(Games.ZA);
private void BtnSave_Click(object sender, EventArgs e)
{
this.Enabled = false;
@ -428,7 +419,7 @@ public partial class MainWindow : Form
var curr = ((ListBox)sender).Items[e.Index].ToString()!;
var wcid = UInt16.Parse(Regex.Match(curr, @"(?<=\#)(.*?)(?=\:)").Groups[1].Value);
var handled = false;
if ((CurrentGame is Games.BDSP or Games.LGPE && wcid >= 2048) || (CurrentGame is Games.SWSH && e.Index >= 129))
if ((CurrentGame is Games.BDSP && wcid >= 2048) || (CurrentGame is Games.SWSH && e.Index >= 129))
{
if (!curr.Contains('\u2757'))
((ListBox)sender).Items[e.Index] = $"{curr} \u2757";

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Microsoft ResX Schema
Version 2.0
@ -18,7 +18,7 @@
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
@ -48,7 +48,7 @@
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter

View File

@ -38,35 +38,22 @@ public partial class MgdbForm : Form
Directory.CreateDirectory(path);
var zipPath = Path.Combine(path, "tmp.zip");
using (var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead))
using (var response = await client.GetAsync(url))
{
var totalBytes = response.Content.Headers.ContentLength ?? 0;
using (var content = await response.Content.ReadAsStreamAsync())
using (var stream = new FileStream(zipPath, FileMode.Create, FileAccess.Write, FileShare.None))
{
var buffer = new byte[8192];
int bytesRead;
long totalRead = 0;
while ((bytesRead = await content.ReadAsync(buffer, 0, buffer.Length)) > 0)
using (var stream = new FileStream(zipPath, FileMode.Create, FileAccess.Write, FileShare.None))
{
await stream.WriteAsync(buffer, 0, bytesRead);
totalRead += bytesRead;
if (totalBytes > 0)
{
double progressPercentage = (double)totalRead / totalBytes * 100;
lblMessage.Text = $"Download progress: {progressPercentage:F2}%";
}
await content.CopyToAsync(stream);
}
}
}
lblMessage.Text = $"Extracting files...";
ZipFile.ExtractToDirectory(zipPath, path);
File.Delete(zipPath);
var tmpMgbdPath = Path.Combine(path, "EventsGallery-master");
lblMessage.Text = $"Cleaning up residual files...";
File.Delete(Path.Combine(tmpMgbdPath, ".gitignore"));
Directory.Delete(Path.Combine(tmpMgbdPath, "Extras"), true);
Directory.Delete(Path.Combine(tmpMgbdPath, "Unreleased"), true);
@ -87,9 +74,9 @@ public partial class MgdbForm : Form
var swshPath = Path.Combine(Path.Combine(genPath, "Gen 8"), "SwSh");
Directory.Delete(Path.Combine(swshPath, "Wild Area Events"), true);
var svPath = Path.Combine(genPath, "Gen 9", "SV");
Directory.Delete(Path.Combine(svPath, "Raid Events"), true);
Directory.Delete(Path.Combine(svPath, "Outbreak Events"), true);
var gen9Path = Path.Combine(genPath, "Gen 9");
Directory.Delete(Path.Combine(gen9Path, "Raid Events"), true);
Directory.Delete(Path.Combine(gen9Path, "Outbreak Events"), true);
Directory.Move(tmpMgbdPath, mgdbPath);
Directory.Delete(path, true);

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows7.0</TargetFramework>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
@ -10,7 +10,7 @@
<ApplicationIcon>Resources\icon.ico</ApplicationIcon>
<Authors>Manu098vm</Authors>
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
<Copyright>Copyright (C) 2024 Manu098vm</Copyright>
<Copyright>Copyright (C) 2022 Manu098vm</Copyright>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>pokemon; mystery gift; wondercard; reader; nintendo; bcat; event injection;</PackageTags>
<PackageLicenseFile>LICENSE</PackageLicenseFile>