Skip to content

Platinum stability, EU/German Platinum and Renegade Platinum support, gamepad lower-screen cursor - #407

Open
Darkatek7 wants to merge 74 commits into
UNDERdecoded:mainfrom
Darkatek7:platinum-stable
Open

Darkatek7 wants to merge 74 commits into
UNDERdecoded:mainfrom
Darkatek7:platinum-stable

Conversation

@Darkatek7

Copy link
Copy Markdown

Summary

A stability pass on Gen 4 Platinum, plus three new supported dumps and gamepad play on the DS lower screen:

  • Platinum (Europe) and Platin Edition (Germany) import as alternates of platinum.
  • Renegade Platinum is its own version, renegadeplatinum, on the Platinum engine.
  • Xbox/SDL gamepads can now reach the DS lower screen.

Every change to Gen 4 behaviour is gated so Gen 1–3, HGSS and BW stay as they were. A US Rev 1 import is byte-identical to one made before this branch, except for one new field, constants.shinyUnder = 8.

Platinum stability

Story

  • tools/gen4_playthrough/platinum.lua now runs the whole story and post-game to Heatran: 91/91 beats.
  • It also passes with PT_CONTINUE=1, which saves, encodes, restores and continues between every beat.
  • Fixed:
    • Lifts in the Distortion World now carry Cynthia across floors.
    • Gen 4 Pokémon now record their met location, from the map label.
    • BattleState.metHere uses the live map rather than the last save.

Battles

  • New fuzzer tools/gen4_battle_fuzz. It plays whole battles through the real BattleState, menus, bag and party screens, with random parties.
  • Thousands of battles now run with no Lua error, hang or invalid state: all 927 trainers, doubles, wild battles and catches.
  • Fixed:
    • In doubles, locked actions (Bide, charge, recharge) went to the wrong slot.
    • In doubles, using an item took the whole turn.
    • Torment, or Taunt on an all-status moveset, softlocked the menu instead of falling back to Struggle.
    • The experience award could crash with an empty player slot.
    • Spread moves announced the move once per target.
    • A simultaneous wipe is now a draw, played as a loss, as on the cartridge.
    • Encore'd Pokémon lost their turn.
    • A Pokémon fainting from end-of-turn damage in doubles was not replaced, which could leave both player slots empty.
  • Trainer Pokémon now get the cartridge's deterministic personality (TrainerData_BuildParty): nature, first ability slot, class-based gender and IVs. Platinum family only; Frontier trainers keep their own rules.

Field and menus

  • New sweep tools/gen4_field_sweep.py covers all 593 map headers. It warps in, walks, rides, takes warps, talks to every NPC and sign, and fuzzes every start-menu, party, bag and Pokétch action. It now reports 0 failures.
  • Fixed:
    • The party picker for move tutors, NPC trades and the daycare froze behind a fade when cancelled with B.
    • A trainer's walk-up crashed on Route 207 while a map script was still running.
    • The Battle Factory rental screen could not be closed, and resuming a Factory save could crash.

Check suite

  • Roamer calls are now gated to Gen 4. Sweet Scent and Teleport were the two ungated ones, and escorted steps could fall through to Johto's roaming check.
  • 14 stale checks and stubs were updated.
  • Hard-coded G:/ paths now come from GEN4_DATA or %APPDATA%.

New dumps

Dump SHA-1 How
Platinum (Europe), CPUE rev 10 8d15cd44… Same ARM9 and overlays as US Rev 1. Only 5 files differ, and its Game Corner has no slot machines. No mapping needed.
Platin Edition (Germany), CPUD 5d009a17… Every ARM9/overlay table is found by content. Gen4Regions and the generated Gen4RegionMap (paths and member counts only) alias the 32 moved language archives. Runtime lookups that compared English text (HM prefix, Pokétch apps, "Mystery Zone", bag pockets, items, natures in saves) now key on ids. German battle text comes from the cartridge's own bank 368, through a generated table that holds entry numbers only.
Renegade Platinum 381f9eef… Its own version, renegadeplatinum. Fairy is slot 9, using the hack's 18x18 chart from overlay 21 and its icons. The import reads the hack's shiny threshold, intro Pokémon, party-icon palettes, prizes and the dialogue of its 138 added trainers. tools/gen4_playthrough passes 100/100 beats on it, with the hack's story changes added to the beats.

tools/gen4_region_check.lua diffs every generated table between two caches. EU and DE show no data differences outside text and the known cartridge differences. See docs/rom-revisions.md and docs/renegade-platinum.md.

Gamepad

  • New src/core/PadPointer.lua: RT toggles a cursor on the DS lower screen. The stick or D-pad moves it, and A taps or drags through the same touchpressed path as a mouse.
    • It reaches the Pokétch apps, the battle bag and party, the Underground, contests and dress-up, Poffins and mining.
    • It works in every second-screen display mode.
  • The stick has diagonal hysteresis.
  • Input is tracked per pad, so two pads don't double-press.
  • Hotplug is supported.
  • The TOUCH binding can be rebound.
  • The mapping is documented in docs/controller.md.

Testing

  • Imports: fresh headless imports of all four dumps complete.
  • Every cache (US, EU, DE, Renegade):
    • command audit (85)
    • gameplay regression (35)
    • trainer messages
    • met location
    • Distortion World surfaces
  • Platinum (US, DE) and Renegade: trainer personality, 4,787 checks.
  • Single checks:
    • German battle text, 96/0
    • pad injection, 83/83
    • tools/rom_revisions_check.lua, 169/169
  • Battle fuzzer: 300 mixed battles each on US, DE and Renegade, plus 700 doubles on US, all clean.
  • Field sweep: 593/593 maps each on US, DE and Renegade.
  • Hardware: played by hand with an Xbox One controller on Windows, on the German dump and on Renegade.

Not covered

  • Rarer German battle lines (under 1%) stay in English where the cartridge has no matching line.
  • Renegade's optional content has not been walked.
  • The shared Gen 3 doubles code has the same bugs as above and was left alone.
  • HGSS and BW were not run.
  • The French, Italian and Spanish cartridges would need their own region maps.

1F's lift (progress 2) and B6F's (progress 7) carry Cynthia down as the
same map object, renumbered for the next floor (ov9 ElevatorPlatform
BeginMovement/ChangeMaps). Neither next floor lists her for that moment,
so B1F's and B7F's first-entry scenes moved a missing local id 128 and
played to an empty platform. Take the passenger at the ride's start and
place her on the arrival floor at the world tile she rode on.
…oded G: drive; resolve repo files independent of cwd
… demand (Pal Park, BW transfer rows were already handled)
…en4 like the other call sites; check now pins five
…check; tag battle check follows the current roamer guard
…ng the Underground (reload next trip, re-roll after a day); pin that instead of a clear
…written gsubs; machine check argues the two legitimate exceptions
… under battle/trainer_back (the art is right; the check named the old DP-outfit path)
…s (the plate moves with the buttons), not the bare BDHC
…Commands.install; classify the shadowed source row
Twelve post-game beats: the credits to the title and a continue at
home (Mom's post-game scene), the National Dex at Rowan's lab, the
S.S. Spiral to the Fight Area, Barry and Buck there, Route 227, Stark
Mountain (the grunts, Mars and Jupiter, Buck as the partner through
room 2 with Rock Smash and Strength, Charon's arrest), the
Battleground's Buck and Heatran. Trainer-defeated flags are read from
save.gen4TrainerFlags, where the port keeps that bank.
…t_bug563 doubles follow Game:step/_step split, ensureStack and per-button overlay images
… 8-to-4 hysteresis, per-pad input sources, hotplug
…ssenger

Cheryl joins as the partner at the forest's south entrance and leaves
with the Soothe Bell at the east exit (VAR 0x40B1, FLAG 0xE3); the
forest's trainers are fought two on two. The Distortion World lift
passenger is now only ever placed on the floor the ride lands on.
The Elite Four and Champion beats no longer teleport into each room:
they leave by the door the last win removed, ride each lift room's
platform (TriggerPlatformLift) and are walked in by the next room's
frame script, as a player is.
Register renegadeplatinum (Drayano's hack of Platinum USA Rev 1, trimmed
patched file 381f9eef...) with its own cache, saves, manifest, launcher
chip and ROM-hack sidebar group, family = platinum. Add
GameVersion.isPlatinumFamily for the runtime checks that meant 'the
Platinum code path' rather than the retail id.

Import what the hack changes:
- Fairy: slot 9 is named from Gen4Versions.TYPE_SLOTS, so species, moves
  and the chart speak FAIRY. Gen4TypeChart.follow reads the chart the
  battle overlay actually points at (Renegade repoints overlay 16 to a
  dense 18x18 chart appended to overlay 21). Battle and summary type
  icons are also saved under the slot's name; the Pokedex maps FAIRY to
  the hack's 19th icon sequence; Gen4AI knows TYPE.FAIRY.
- constants.shinyUnder from Pokemon_IsPersonalityShiny (8 retail, 128 in
  Renegade), applied through Stats.setShinyUnder.
- Icon palette anchors per version (the hack recolours 86 entries).
- Game Corner prizes found by rows 1..3 when the first prize changed.
- constants.trainerOrder covers all trainers (1066 in Renegade).

A Platinum USA import is byte-identical apart from shinyUnder = 8.
tools/rom_revisions_check.lua keeps GameVersion, RomRevisions and the
manifests in step.
docs/renegade-platinum.md: the accepted file, what the hack changes
against Platinum Rev 1 and how each change is handled, and what is not
verified (overlay 73's species swap, trainers 928+ dialogue, story).
README supported-games table and What's New, docs/rom-revisions.md row.
tools/gen4_battle_harness: SLOT=n holds the move cursor on slot n so a
chosen matchup can be fought.
With PT_CONTINUE=1 every passed beat is followed by the field's
captureSave, the save through the codec and Game:restoreSave, as the
title's CONTINUE does, so the next beat runs on what a reload brings
back. All 91 Platinum beats pass that way too. Notes in
docs/platinum-parity-progress.md.
Gen4Origin.stamp got BattleState.metHere, a Gen 3 region-map section
that is nil on every Gen 4 map, so every Platinum Pokemon was met
nowhere: the Hall of Fame printed "Met at ." and the summary dropped
the line. Stamp the label of the map the player stands on (the
cartridge's MapHeader_GetMapLabelTextID, a bank 433 index) and name
numeric locations in the Hall of Fame and the summary. HGSS keeps its
behaviour (another place-name bank).
…spread announce, draw, Struggle on Taunt/Torment, Encore
…gh an English reference, not the destination's names
… Pillar

Renegade-only beat changes (retail's path is untouched):
- the training cheat leads with a level-100 Mewtwo and keeps a second
  able Pokemon (Floaroma Meadow's grunts are one double battle that refuses
  a party of one; Maylene's gym trainers outlast a level-75 starter)
- Pastoria: Crasher Wake is met on Route 212 first (the gym guide stands on
  Barry's coord cell until he returns)
- Canalave gate: the policeman wants Pal Park's Tea (Oak, then Darach's
  battle); the Pokedex-upgrade scientist is gone
- Iron Island: HM04 comes after Riley's tag battle inside the island
- Mt. Coronet 2F: the Strength boulder is gone

runner.lua: PT_BATTLELOG=1 prints every battle line.
…through cartridge ids on a non-English Gen 4 cache
…ge recorded in the cache for the translation layer
… of the engine's English; bag close row; check
Renegade-only beats and moves (retail's 91 beats are unchanged):
- Victory Road needs the counterpart beaten on Route 224 first; VR 2F has
  no boulders; the six Mewtwo are healed between its legs (the hack's own
  nurses stand inside)
- Buck on Route 227 wants the six Battle Zone leaders' badges, then battles
- Stark Mountain room 2 has no rock or boulder; the Battleground sets
  0x125 on entry; Mom's post-game scene takes the National Dex branch (the
  hack enables it in Rowan's first scene)
- moves chosen for the hack's teams: Psychic for Volkner's Rotom, Barry at
  the League and Floaroma's Croagunk; Flamethrower for Stark Mountain's
  Sableye; the double-battle partner is rebuilt with the beat's move

docs/renegade-platinum.md lists the hack's story edits.
The hack lists Toxicroak's Dry Skin first, so the default Surf can be
drunk for the whole battle. docs: note that trainer Pokemon still get a
random personality where the cartridge seeds one (ability slot 0).
… deterministic personality

Seed the LCRNG from ivScale+level+species+trainerId, advance once per trainer class, (rnd<<8)+0x78/0x88 by class gender; nature, ability slot, gender, IVs and stats follow. Never shiny. HGSS and Battle Frontier sets untouched. Adds a pure-Lua and a lovec end-to-end check.
…nes from the cartridge's bank 368

Gen4BattleText now also fills the generated table src/battle/Gen4BattleTextMap.lua
(tools/gen4_battle_text_map.py aligns the engine's English templates with the USA
bank 368 and writes only entry numbers; a hand table covers the Red/Blue and
Black/White phrasings), stat changes from the battle's stat bank (551), the charge
turn of two-turn moves and the vortex trap lines. The fuzzer's --trace de prints
the translated line, the harness has SAY= to put lines in the box.
… journal read a non-English cache's own words
endOfTurn called fillEmptySlots immediately, but a burn/poison/weather faint in
the residual sweep queues doubleFaint with actNext, which runs after that call.
The replacement was left pending until the next turn's end, so with both player
slots empty and a living bench mon (e.g. Revived) the battle sat in an
unanswerable command menu. Queue the fill behind the faints (Platinum/HGSS
doubles only). Adds tools/gen4_double_residual_faint_check.sh (fuzz seed 58).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant