Skip to content

Commit

Permalink
Merge pull request #11 from foohyfooh/bdsp_support
Browse files Browse the repository at this point in the history
Add Support For BDSP
  • Loading branch information
Bl4ckSh4rk authored Jan 26, 2024
2 parents 94a797a + a5f511d commit 04f5541
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
22 changes: 18 additions & 4 deletions FeebasLocatorPlugin/FeebasLocatorForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,27 @@ public FeebasLocatorForm(SaveFile sav)
case GameVersion.Pt:
SeedOffset = 0x5664;
break;
case GameVersion.BD:
case GameVersion.SP:
SeedOffset = 436;
break;
}

if (sav is SAV3 s3)
{
SetupGen3Form();
Seed = BitConverter.ToUInt16(s3.Large, SeedOffset);
}
else if (sav is SAV4 s4)
else if (sav is SAV4Sinnoh s4)
{
SetupGen4Form();
Seed = BitConverter.ToUInt32(s4.General[SeedOffset..]);
}
else if (sav is SAV8BS s8)
{
SetupGen4Form();
Seed = (uint)s8.GetWork(SeedOffset);
}

FeebasSeedBox.Text = Seed.ToString("X");
}
Expand Down Expand Up @@ -114,7 +123,7 @@ private void MarkTiles(ushort[] tiles)
if (Feebas3.IsUnderBridge(tiles[i]))
MarkGen3UnderBridgeTiles();
}
else if (sav is SAV4)
else if (sav is SAV4Sinnoh or SAV8BS)
{
x = TileCoordinatesGen4[tiles[i], 0];
y = TileCoordinatesGen4[tiles[i], 1];
Expand Down Expand Up @@ -166,7 +175,7 @@ private void FeebasSeedBox_TextChanged(object sender, EventArgs e)

if (sav is SAV3)
MarkTiles(Feebas3.GetTiles(Seed));
else if (sav is SAV4)
else if (sav is SAV4Sinnoh or SAV8BS)
MarkTiles(Feebas4.GetTiles(Seed));
}

Expand All @@ -176,10 +185,15 @@ private void SaveButton_Click(object sender, EventArgs e)
{
BitConverter.GetBytes(Util.GetHexValue(FeebasSeedBox.Text)).CopyTo(s3.Large, SeedOffset);
}
else if (sav is SAV4 s4)
else if (sav is SAV4Sinnoh s4)
{
BitConverter.GetBytes(Util.GetHexValue(FeebasSeedBox.Text)).CopyTo(s4.General[SeedOffset..]);
}
else if(sav is SAV8BS s8)
{
s8.SetWork(SeedOffset, (int)Util.GetHexValue(FeebasSeedBox.Text));
}
sav.State.Edited = true;
Close();
}

Expand Down
2 changes: 1 addition & 1 deletion FeebasLocatorPlugin/FeebasLocatorPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private void OpenFeebasLocatorForm(object? sender, EventArgs? e)
public void NotifySaveLoaded()
{
if (ctrl != null)
ctrl.Visible = SaveFileEditor.SAV is IGen3Hoenn or SAV4Sinnoh;
ctrl.Visible = SaveFileEditor.SAV is IGen3Hoenn or SAV4Sinnoh or SAV8BS;
}

public bool TryLoadFile(string filePath) => false;
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ Get the latest release on **[ProjectPokémon.org](https://projectpokemon.org/hom
## How to use
Put the plugin into the *plugins* folder in your PKHeX directory, then access it from the *Tools* menu.

Ruby, Sapphire and Emerald as well as Diamond, Pearl and Platinum are supported.
Ruby, Sapphire and Emerald as well as Diamond, Pearl, Platinum, Brilliant Diamond and Shining Pearl are supported.

## Credits & Thanks
- Kaphotics for [PKHeX](https://github.com/kwsch/PKHeX)
- TuxSH for his extensive research about Feebas fishing spots ([RSE](https://www.smogon.com/forums/threads/past-gen-rng-research.61090/page-34#post-3986326), [DPPt](https://www.smogon.com/forums/threads/past-gen-rng-research.61090/page-36#post-4079097))
- suloku for his Feebas Fishing Spot tool](https://projectpokemon.org/home/forums/topic/37192-feebas-fishing-spot-value-rusaem/) that has inspired me to make this plugin!
- suloku for his [Feebas Fishing Spot tool](https://projectpokemon.org/home/forums/topic/37192-feebas-fishing-spot-value-rusaem/) that has inspired me to make this plugin!
- Translators
- Chinese (CHT/CHS): ppllouf/wubinwww
- Japanese: mi-ya1987
- Japanese: mi-ya1987

0 comments on commit 04f5541

Please sign in to comment.