Skip to content

Commit

Permalink
Merge branch 'master' into case-insensitive-responses
Browse files Browse the repository at this point in the history
  • Loading branch information
m4-used-rollout committed Dec 14, 2023
2 parents 3a1d3c2 + fde8c4d commit 69c5917
Show file tree
Hide file tree
Showing 9 changed files with 446 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/json-schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
git add config.matchmode.schema.json
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git diff-index --quiet HEAD || { echo 'Please update the json schemas by running `dotnet run -- regenjsonschemas`'; exit 1; }
git diff-index --quiet HEAD || { echo 'The configuration schema has changed. Please update the json schema files by running `dotnet run -- regenjsonschemas` locally and committing the output.'; exit 1; }
4 changes: 3 additions & 1 deletion TPP.Common/Emblems.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ public static class Emblems
[72] = "Randomized Soul Silver",
[73] = "Resolute",
[74] = "Black and White 3: Genesis",
[75] = "Mega Power"
[75] = "Mega Power",
[76] = "Snakewood DX",
[77] = "Nameless"
};

public static string FormatEmblem(int emblemNum)
Expand Down
67 changes: 63 additions & 4 deletions TPP.Core/ButtonProfiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@ public enum ButtonProfile
{
[EnumMember(Value = "gb")] GameBoy,
[EnumMember(Value = "gba")] GameBoyAdvance,
[EnumMember(Value = "nds")] NintendoDS,
[EnumMember(Value = "3ds")] Nintendo3DS,

[EnumMember(Value = "nes")] NES,
[EnumMember(Value = "snes")] SNES,
[EnumMember(Value = "n64")] N64,
[EnumMember(Value = "gc")] GameCube,
[EnumMember(Value = "switch")] Switch,

[EnumMember(Value = "dualgb")] DualGameBoy,
[EnumMember(Value = "dualnes")] DualNES,
[EnumMember(Value = "dualsnes")] DualSNES,
[EnumMember(Value = "dualn64")] DualN64,
[EnumMember(Value = "dualgc")] DualGameCube,
}

public static class ButtonProfileExtensions
Expand All @@ -19,14 +32,60 @@ public static InputParserBuilder ToInputParserBuilder(this ButtonProfile profile
ButtonProfile.GameBoy => InputParserBuilder.FromBare()
.Buttons("a", "b", "start", "select")
.DPad()
.RemappedDPad(up: "n", down: "s", left: "w", right: "e", mapsToPrefix: "")
.RemappedDPad(up: "north", down: "south", left: "west", right: "east", mapsToPrefix: "")
.LengthRestrictions(maxSetLength: 2, maxSequenceLength: 1)
.HoldEnabled(true),
// Max set length of 3 is too short to perform Soft Reset (A+B+Start+Select)
.LengthRestrictions(maxSetLength: 3, maxSequenceLength: 1),
ButtonProfile.GameBoyAdvance => ButtonProfile.GameBoy.ToInputParserBuilder()
.Buttons("l", "r"),
ButtonProfile.NintendoDS => ButtonProfile.SNES.ToInputParserBuilder()
.Touchscreen(width: 256, height: 192, multitouch: false, allowDrag: true),
ButtonProfile.Nintendo3DS => ButtonProfile.SNES.ToInputParserBuilder()
.SimpleAliasedDPad("d", "")
.AnalogStick("c", true)
.Touchscreen(width: 320, height: 240, multitouch: false, allowDrag: true)
// Prevent Soft Reset in 3DS Pokemon Games (L+R+Start/Select) as well as Luma3DS and NTR menu shortcuts
.Conflicts(("l", "select"), ("l", "start")),

ButtonProfile.NES => ButtonProfile.GameBoy.ToInputParserBuilder(),
ButtonProfile.SNES => ButtonProfile.GameBoyAdvance.ToInputParserBuilder()
.Buttons("x", "y"),
ButtonProfile.N64 => InputParserBuilder.FromBare()
.Buttons("a", "b", "start", "l", "r", "z")
.DPad()
.SimpleAliasedDPad("d", "")
.DPad("c")
.AnalogStick("a", true)
.SimpleAliasedAnalogStick("l", "a", true)
.LengthRestrictions(maxSetLength: 4, maxSequenceLength: 1),
ButtonProfile.GameCube => InputParserBuilder.FromBare()
.Buttons("a", "b", "x", "y", "l", "r", "z", "start")
.AliasedButtons(("pause", "start"))
.DPad()
.SimpleAliasedDPad("d", "")
.AnalogStick("l", true)
.AnalogStick("r", true)
.SimpleAliasedAnalogStick("c", "r", true)
.Conflicts(("x", "start")) // Prevent Soft Reset in Pokemon XD (B+X+Start)
.LengthRestrictions(maxSetLength: 4, maxSequenceLength: 1),
ButtonProfile.Switch => InputParserBuilder.FromBare()
.Buttons("a", "b", "x", "y", "l", "r", "zl", "zr", "lstick", "rstick", "plus", "minus") // Capture and Home buttons omitted on purpose
.AliasedButtons(("start", "plus"), ("select", "minus"), ("+", "plus"), ("-", "minus"), ("l2", "zl"), ("r2", "zr"), ("l3", "lstick"), ("r3", "rstick"))
.DPad()
.SimpleAliasedDPad("d", "")
.AnalogStick("l", true)
.AnalogStick("r", true)
.SimpleAliasedAnalogStick("c", "r", true)
.LengthRestrictions(maxSetLength: 4, maxSequenceLength: 1),

ButtonProfile.DualGameBoy => ButtonProfile.GameBoy.ToInputParserBuilder()
.LeftRightSidesEnabled(true),
ButtonProfile.DualNES => ButtonProfile.NES.ToInputParserBuilder()
.LeftRightSidesEnabled(true),
ButtonProfile.DualSNES => ButtonProfile.SNES.ToInputParserBuilder()
.LeftRightSidesEnabled(true),
ButtonProfile.DualN64 => ButtonProfile.DualN64.ToInputParserBuilder()
.LeftRightSidesEnabled(true),
ButtonProfile.DualGameCube => ButtonProfile.GameCube.ToInputParserBuilder()
.LeftRightSidesEnabled(true),
};
}
}
2 changes: 1 addition & 1 deletion TPP.Core/PokedexData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private static IEnumerable<PkmnSpecies> LoadSpeciesNames()
[Generation.Gen6] = 721, // Volcanion
[Generation.Gen7] = 807, // Zeraora
[Generation.Gen8] = 905, // Enamorus
[Generation.Gen9] = 1010, // Annihilape
[Generation.Gen9] = 1018, // Archaludon (for now)
}.ToImmutableSortedDictionary();

public static Generation GetGeneration(PkmnSpecies species)
Expand Down
104 changes: 104 additions & 0 deletions TPP.Core/Resources/pokemon_names.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,14 @@
1008,Kingambit
1009,Clodsire
1010,Annihilape
1011,Dipplin
1012,Poltchageist
1013,Sinistcha
1014,Okidogi
1015,Munkidori
1016,Fezandipiti
1017,Ogerpon
1018,Archaludon
2000,MissingNo.
2001,Phancero
2002,Fambaco
Expand Down Expand Up @@ -1311,3 +1319,99 @@
342-star,Harambe
370-star,UB-Lunar
800-star,UB-Queen
1-snakewood,Boilbasaur
2-snakewood,Shrivlsaur
3-snakewood,Vivosaur
4-snakewood,Rotmander
5-snakewood,Charmeworm
6-snakewood,Zombizard
7-snakewood,Oozle
8-snakewood,Entrailtle
9-snakewood,Bleedoise
10-snakewood,Shinigami
11-snakewood,Latinstein
12-snakewood,Antispiral
13-snakewood,Glute
14-snakewood,Bute
15-snakewood,Nute
19-snakewood,Ramshaker
23-snakewood,Sevicious
24-snakewood,Zangol
25-snakewood,Pikachew
26-snakewood,Stitcher
51-snakewood,Galactimon
56-snakewood,Rotting
60-snakewood,Polihag
61-snakewood,Poliworm
62-snakewood,Poliwraith
73-snakewood,Qwilshark
83-snakewood,Dragoone
88-snakewood,Moulder
89-snakewood,Yuck
90-snakewood,Tentorture
91-snakewood,Tecthulu
92-snakewood,Ghastlier
93-snakewood,Haunteyes
94-snakewood,Gengaze
115-snakewood,Roclobster
122-snakewood,Vigourlan
123-snakewood,Grimreaper
124-snakewood,Eye-Eye
125-snakewood,Electabugs
126-snakewood,Miasmar
143-snakewood,Gorelax
150-snakewood,Mutagon
151-snakewood,Mewby
172-snakewood,Azombie
175-snakewood,Kamina
183-snakewood,Graveill
184-snakewood,Azombarill
185-snakewood,Gluemadio
186-snakewood,Krampus
187-snakewood,Earthmadio
188-snakewood,Bonemadio
189-snakewood,Crazymadio
190-snakewood,Seamadio
191-snakewood,Burstmadio
192-snakewood,Blastmadio
193-snakewood,Treemadio
196-snakewood,Toxeon
197-snakewood,Demoneon
198-snakewood,Dirtkrow
203-snakewood,Aeromadio
206-snakewood,Diamandix
207-snakewood,Normadio
209-snakewood,Cinderco
210-snakewood,Radiorange
212-snakewood,Ironreaper
217-snakewood,Chocwork
225-snakewood,Mysteryegg
228-snakewood,Houndsour
229-snakewood,Headdoom
239-snakewood,Houndemon
240-snakewood,Houndecay
249-snakewood,Scar Lugia
272-snakewood,Skylax
290-snakewood,Hyperegg
291-snakewood,Secretegg
324-snakewood,Virodon
322-snakewood,Hombone
323-snakewood,Hombeast
331-snakewood,Kenchira
332-snakewood,Kenchukuo
298-snakewood,X32763
317-snakewood,Kingmadio
280-snakewood,Rancid
281-snakewood,Killia
282-snakewood,Gardevour
371-snakewood,Psypig
373-snakewood,Calfby
377-snakewood,Furi X
378-snakewood,Furi Z
379-snakewood,Furi Q
382-snakewood,Turmur
384-snakewood,Senex
380-snakewood,Luca Zamón
381-snakewood,Téa Barqán
385-snakewood,Shaderu
386-snakewood,Faceleech
13 changes: 12 additions & 1 deletion TPP.Core/config.runmode.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@
"enum": [
"gb",
"gba",
"dualgb"
"nds",
"3ds",
"nes",
"snes",
"n64",
"gc",
"switch",
"dualgb",
"dualnes",
"dualsnes",
"dualn64",
"dualgc"
]
},
"FramesPerSecond": {
Expand Down
74 changes: 72 additions & 2 deletions TPP.Inputting/InputParserBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,26 @@ public InputParserBuilder AnalogStick(string prefix, bool allowSpin)
Conflicts((spinl, up), (spinl, down), (spinl, left), (spinl, right));
Conflicts((spinr, up), (spinr, down), (spinr, left), (spinr, right));
}
return this;
return this.CardinalAnalogStickMapping(prefix);
}

/// <summary>
/// Adds an aliased analog stick, automatically building a stick for an aliased prefix
/// </summary>
/// <param name="aliasPrefix">prefix for the aliased analog stick</param>
/// <param name="mapsToPrefix">prefix for the analog stick that the alias names map to</param>
/// <param name="allowSpin">if enabled, additional prefixed "spinl" and "spinr" buttons are added</param>
public InputParserBuilder SimpleAliasedAnalogStick(string aliasPrefix, string mapsToPrefix, bool allowSpin) =>
AliasedAnalogStick(
up: aliasPrefix + "up",
down: aliasPrefix + "down",
left: aliasPrefix + "left",
right: aliasPrefix + "right",
spinl: allowSpin ? aliasPrefix + "spinl" : null,
spinr: allowSpin ? aliasPrefix + "spinr" : null,
mapsToPrefix
).CardinalAnalogStickAliases(aliasPrefix, mapsToPrefix);

/// <summary>
/// Adds an aliased analog stick. This is a shortcut for adding aliased analog inputs for
/// "up"/"down"/"left"/"right", plus configuring respective conflicts, like inputting opposing directions.
Expand Down Expand Up @@ -321,6 +338,7 @@ public InputParserBuilder RemappedAnalogStick(
/// <summary>
/// Add a D-pad. This is a shortcut for adding buttons for "up"/"down"/"left"/"right",
/// plus configuring respective conflicts, like inputting opposing directions.
/// Also automatically adds N E W S and North East West South remappings for the pad.
/// </summary>
/// <param name="prefix">prefix for the D-pad, which will get prepended to "up"/"down"/"left"/"right"</param>
public InputParserBuilder DPad(string prefix = "")
Expand All @@ -331,9 +349,23 @@ public InputParserBuilder DPad(string prefix = "")
string right = prefix + "right";
Buttons(up, down, left, right);
Conflicts((up, down), (left, right));
return this;
return this.CardinalDPadMapping(prefix);
}

/// <summary>
/// Adds an aliased D-pad, automatically building up/down/left/right buttons for an aliased prefix
/// </summary>
/// <param name="aliasPrefix">prefix for the aliased D-pad</param>
/// <param name="mapsToPrefix">prefix for the D-pad that the alias names map to</param>
public InputParserBuilder SimpleAliasedDPad(string aliasPrefix, string mapsToPrefix) =>
AliasedDPad(
up: aliasPrefix + "up",
down: aliasPrefix + "down",
left: aliasPrefix + "left",
right: aliasPrefix + "right",
mapsToPrefix
).CardinalDPadAliases(aliasPrefix, mapsToPrefix);

/// <summary>
/// Add an aliased D-pad. This is a shortcut for adding aliased buttons for "up"/"down"/"left"/"right",
/// plus configuring respective conflicts, like inputting opposing directions.
Expand Down Expand Up @@ -376,6 +408,44 @@ public InputParserBuilder RemappedDPad(string up, string down, string left, stri
return this;
}

/// <summary>
/// Add N E W S and North East West South remapped D-pad.
/// </summary>
/// <param name="prefix">prefix for the D-pad that the remapping names map to,
/// which will get prepended to "n"/"s"/"w"/"e"</param>
public InputParserBuilder CardinalDPadMapping(string prefix) =>
RemappedDPad(up: prefix + "n", down: prefix + "s", left: prefix + "w", right: prefix + "e", prefix)
.RemappedDPad(up: prefix + "north", down: prefix + "south", left: prefix + "west", right: prefix + "east", prefix);

/// <summary>
/// Add N E W S and North East West South remapped Analog Stick.
/// </summary>
/// <param name="prefix">prefix for the stick that the remapping names map to,
/// which will get prepended to "n"/"s"/"w"/"e"</param>
public InputParserBuilder CardinalAnalogStickMapping(string prefix) =>
RemappedAnalogStick(up: prefix + "n", down: prefix + "s", left: prefix + "w", right: prefix + "e", spinl: null, spinr: null, prefix)
.RemappedAnalogStick(up: prefix + "north", down: prefix + "south", left: prefix + "west", right: prefix + "east", spinl: null, spinr: null, prefix);

/// <summary>
/// Add N E W S and North East West South D-pad aliases.
/// </summary>
/// <param name="prefix">prefix for the aliased D-pad,
/// <param name="mapsToPrefix">prefix that the aliased D-pad maps to</param>
public InputParserBuilder CardinalDPadAliases(string prefix, string mapsToPrefix) =>
AliasedDPad(up: prefix + "n", down: prefix + "s", left: prefix + "w", right: prefix + "e", mapsToPrefix)
.AliasedDPad(up: prefix + "north", down: prefix + "south", left: prefix + "west", right: prefix + "east", mapsToPrefix);


/// <summary>
/// Add N E W S and North East West South Analog Stick aliases.
/// </summary>
/// <param name="prefix">prefix for the aliased stick,
/// <param name="mapsToPrefix">prefix that the aliased stick maps to</param>
public InputParserBuilder CardinalAnalogStickAliases(string prefix, string mapsToPrefix) =>
AliasedAnalogStick(up: prefix + "n", down: prefix + "s", left: prefix + "w", right: prefix + "e", spinl: null, spinr: null, mapsToPrefix)
.AliasedAnalogStick(up: prefix + "north", down: prefix + "south", left: prefix + "west", right: prefix + "east", spinl: null, spinr: null, mapsToPrefix);


public InputParserBuilder LeftRightSidesEnabled(bool enabled)
{
_leftRightSides = enabled;
Expand Down
Loading

0 comments on commit 69c5917

Please sign in to comment.