Skip to content

Implement PokePara system, WazaData, Item, and PokeParty#5

Open
AstrandPallas wants to merge 3 commits intomainfrom
implement-pokepara
Open

Implement PokePara system, WazaData, Item, and PokeParty#5
AstrandPallas wants to merge 3 commits intomainfrom
implement-pokepara

Conversation

@AstrandPallas
Copy link
Contributor

@AstrandPallas AstrandPallas commented Feb 7, 2026

Summary

  • Ported all TODO stub implementations from Dpr (PR #10) to opendpr
  • Verified all implementations against Ghidra decompilation of the original binary
  • 18 files changed across PokePara, WazaData, Item, and PokeParty systems
  • Unity batch build verified: zero compile errors

Changes

PokePara (15 files):

  • Accessor: ~160 getters/setters with Decode/Encode lifecycle in every getter/setter, block shuffling, encoding, serialization
  • CoreParam: ~100 higher-level Pokemon parameter methods
  • CoreDataBlock A/B/D: bitfield properties using (field & mask) >> loc pattern
  • CalcTool: level calc, shiny check, Hidden Power, evolution forms
  • EvolveManager: evolution conditions (simple ones implemented, complex ones left as TODO)
  • BoxMarkController, SavePokeParty, serialization helpers

WazaData (2 files):

  • WazaDataSystem: ~27 methods (move stats, flags, rank effects, weather, recover/reaction ratios)
  • SickContParam: bitfield properties

Item (3 files):

  • ItemManager: WazaMachine lookups, ball ID mapping, item queries
  • ItemTableExtensions: ~20 extension methods using ItemGroup constants
  • ItemData: ~26 static wrapper methods

PokeParty:

  • Party management (add/remove/swap/copy members)
  • Count/search with type filters (battle-enable with HaveCalcParam check, eggs, etc.)
  • Pokerus mechanics, serialization, recovery, trade eligibility

Round 2 Review Fixes

  • Accessor: DecodeAndCheckIllegalWrite/UpdateChecksumAndEncode moved from GetCoreDataBlockX infrastructure into every individual getter/setter
  • Accessor: Static fields initialized to null per .cctor, BLOCK_POS_TABLE inlined as static field init
  • Accessor: ClearCalcData fast mode checks, StartFastMode/EndFastMode asserts
  • Accessor: Serialize/Deserialize rewritten with UnsafeUtility.MemCpy, byte[] overloads call unsafe versions with asserts
  • Accessor: CalcData getters null check m_pCalcData, GFL.ASSERT on error/default paths
  • Accessor: GetBankUniqueID uses pointer cast, CompareOyaName uses .Equals()
  • Accessor: GetNickName implements egg name by language logic from Ghidra
  • CoreDataBlockA: Boolean getters fixed to use (field & mask) >> loc instead of field >> loc & sz
  • CoreDataBlockB: Removed unnecessary (uint) casts, added bitshift to boolean getters, unchecked for negative mask
  • Item: IsValid, IsSale, IsWazaRecord, GetWorkRecoverItem, and other methods cleaned up

Still TODO

  • Accessor.Initialize() — needs dependencies not yet available
  • CoreParam: ChangeMonsNo, UpdateOwnerInfo, InheriteTamagoWaza, CollectRemindableWaza, ChangeEgg, Birth, Evolve
  • EvolveManager: Most evolution condition methods
  • ItemTableExtensions: GetHealingItemType (900+ line method), IsNeedSelectSkill

Test plan

  • Unity 2019.4.27f1 batch build passes with zero errors
  • Method signatures match IL2CPP dump
  • All implementations verified against Ghidra decompilation
  • Complex methods with incorrect logic reverted to TODO stubs rather than shipping wrong code

Copy link
Contributor

@SaltContainer SaltContainer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only checked Pml.Item classes for now. Will look at the rest later

AstrandPallas added a commit that referenced this pull request Feb 8, 2026
- ItemManager.Get(): Remove null check before ID comparison (match Ghidra)
- ItemManager.ItemID2BallID(): Remove null check on Get() result
- ItemManager.BallID2ItemID(): Add GFL.ASSERT on lookup failure
- ItemManager.ItemNoToWazaMachineID(): Remove null check, return 0xFF on error
- ItemManager.IsGroupOf(): Remove null check on Get() result
- ItemManager.GroupIdToItemNo(): Move o_pItemNo=0 to before return false
- ItemTableExtensions.IsEventItem(): Use Pml.ItemType.EVENT instead of magic 9
- ItemData: Remove all null checks on Get() results (Get returns item[0] fallback)
@AstrandPallas AstrandPallas force-pushed the implement-pokepara branch 3 times, most recently from a070415 to 516da5d Compare February 9, 2026 21:05
- PokePara: CoreParam, CoreDataBlocks A/B/D, Accessor, CalcTool, EvolveManager,
  BoxMarkController, SavePokeParty, SerializedPokemon (Core/Extensions/Full)
- WazaData: WazaDataSystem, SickContParam
- Item: ItemData, ItemManager, ItemTableExtensions (incl. GetHealingItemType)
- PokeParty with member management and pokerus stubs
- Battle/Logic: WAZADATA wrappers, BTL_ACTION, calc utilities
Copy link
Contributor

@SaltContainer SaltContainer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked at the getters on Accessor and the CoreDataBlocks behind it. Will continue later.


// TODO
public static void Initialize() { }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is missing its entire implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea this one is still todo, needs some dependencies we dont have yet like the illegal egg data setup

- CoreDataBlockA: fix all boolean getters from >> loc & sz to (& mask) >> loc
- CoreDataBlockA: remove unnecessary casts from camp_friendship
- CoreDataBlockB: remove unnecessary casts from talent getters
- CoreDataBlockB: add right bitshift to tamagoFlag/nicknameFlag getters
- Accessor: init static fields to null per .cctor
- Accessor: inline BLOCK_POS_TABLE as 32-entry static array
- Accessor: add fast mode checks to ClearCalcData
- Accessor: add GFL.ASSERT to StartFastMode/EndFastMode
- Accessor: add asserts + delegate to unsafe in Serialize/Deserialize byte[] overloads
- Accessor: simplify unsafe Serialize/Deserialize pointer arithmetic
- Accessor: rewrite private Serialize/Deserialize with UnsafeUtility.MemCpy
- Accessor: remove Decode/Encode from GetCoreDataBlockX infrastructure
- Accessor: add DecodeAndCheckIllegalWrite/UpdateChecksumAndEncode to all getters/setters
- Accessor: add m_pCalcData null checks to all CalcData getters
- Accessor: fix GetDprIllegalFlag to use forWrite=true
- Accessor: add GFL.ASSERT(false) to error/default paths
- Accessor: replace GetBankUniqueID loop with pointer cast
- Accessor: use .Equals() for CompareOyaName
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.

2 participants