Skip to content

Add portable Gen-2 mart definitions and native bargain purchases - #168

Closed
Roxas2712 wants to merge 64 commits into
UNDERdecoded:mainfrom
Roxas2712:codex/portable-mart-content
Closed

Roxas2712 wants to merge 64 commits into
UNDERdecoded:mainfrom
Roxas2712:codex/portable-mart-content

Conversation

@Roxas2712

@Roxas2712 Roxas2712 commented Oct 24, 2026 •

Copy link
Copy Markdown

Gen1Recomp mods can replace native Gen-2 mart shelves through mod.content.marts. Gen2Recomped lacks that registry, and its ROM-script lowering also discards the shop type needed to select independent bargain prices.

Add the native API-1/2 and unified API-2/3 contract for IDs "0"–"33" and "bargain": get/each/register/override/patch/remove, whole-list patches including empty lists, ordered contributions, frozen writes, detached public reads, rollback and reload retirement. Resolve common item IDs through mounted data to actual imported ITEM_* keys, including forward references after ordinary item merges. Keep this a virtual projection over the existing script pool.

Preserve the native shop type when lowering pokemart. Type 2 uses independent 16-bit bargain prices, sells one of each item and retains sold state when reopened; ordinary shops still use item prices. Read optional ROM bargain rows on fresh imports and retain IDs/types on fallback clerk markers so those markers can resolve live shelves. A mod can supply bargain rows to an older cache.

The registry is honestly unavailable on GB/GBA/DS, matching the reference. Legacy marker-only cache fallbacks need reimport for the new ID annotations; the normal ROM-script path uses the live pool directly. Daily bargain reset and special-shop pixel/presentation equivalence are outside this contract. Includes a public consumer, docs, pinned cross-engine CI and an isolated native driver.

Validation

Feature fbb21ba43e64e35562a30d9f1f1aff8ba22d6aa6; combined testfork eaf9882ddd54fd2139d99e51bddaaf5ecfe941e8:

  • Public records, native purchases and all registered host generation boundaries: 1,485/1,485 checks.
  • Ownership, rollback, reload, unrelated in-place edits, frozen/detached records, malformed/closed IDs and lists, bargain bounds, forward item IDs, native VM lowering/import and actual UI-input/runner close paths: 234/234.
  • 48 isolated SDK workers / 168 paired observations, using the same unchanged public consumer. Gold/Silver/Crystal compare records and actual native purchase results; Red/FireRed/Emerald verify unavailable accessors. API 1/native, API 2/native, host API 2/unified and API 3/unified. Reference API 2 remains native.
  • Gen1 pinned clean at 535a5ec088c1ae1bf4d91dd3e35a56f64cf46d91, which contains the mart contract. Earlier contract families retain their own reference pins.
  • Final feature: 127/137 engine suites, SDK 3/3, B30 passed. The same ten baseline suites fail with exactly the same 26 FAIL lines as Add portable Gen-2 held-item content definitions #167; independent repairs are in test: repair Gen2 updater asset fixtures #128–134. Final combined testfork: 182/182 engine suites, SDK 3/3, B30 passed.
  • Native LÖVE 11.5 / imported Gold at combined runtime 89fc602240a607a9cee3b2c575828c17970842ee: unchanged installed consumer, actual ROM-IR lowering, real script coroutines and UI input, ordinary purchase/item price, bargain purchase/independent price, sold-out and reopen protection, close/resume, detached reads and frozen writes. Production code, example and driver are unchanged at the final combined ref; its later commit only corrects a shared test to use reads available in native API 1/2.
  • The native driver uses an isolated identity and an in-memory New Game; no normal SAVE action, full-playthrough or pixel-equivalence claim. The temporary example was removed with content-hash guards.
  • Negative control against unchanged Add portable Gen-2 held-item content definitions #167: registry unavailable, native shelf remains POTION instead of requested ULTRA_BALL, and the native compiler discards the bargain type.
  • Imported Red regressions: battle 468/468, save conversion 95/95, parity J 73/73, K 22/22, mart stock 45/45. No external binary save fixture supplied.
  • New Lua formatting, actionlint, Python compile and diff whitespace checks pass. No ROM, imported cache, save or private mod is included.

Stack

Depends on #167 and the prerequisite portability series. Incremental comparison against #167. The combined testing branch also includes the independent baseline repairs. All 28 hosted PR workflows report action_required pending maintainer approval. The mart workflow has no jobs; the local passing results above do not imply hosted CI passed.

# Conflicts:
#	src/mods/Loader.lua
# Conflicts:
#	docs/modding.md
#	src/mods/Loader.lua
#	src/world/WorldAPI.lua
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