On this page
  1. Related
  2. Games
  3. References
  4. Sources

Metaprogression is what survives a run. In Lufia II’s Ancient Cave, entering takes everything from the party but its blue-chest items1, leaving keeps those and the Iris treasures and nothing else2, and a wipe loses that visit’s finds3. Between visits the game also keeps counts of entries and wipes, the time spent inside, and the deepest floor reached4.

Games

GameYearHowNote
Lufia II: Rise of the Sinistrals1995Carried itemsthe Ancient Cave takes all but the blue-chest items at the door; leaving keeps those and the Iris treasures
Every claim about this mechanic, by game (3)

References

  1. ^ abCodevinheim3/lufia2-disasm · “Lufia II - Rise of the Sinistrals (USA)” · Cellenseres/Lufia2Decompbank_004.s 1136–1201, 1205–1235, 1274–1347; default_records.c 162–176; +3 files
    How we know
    code/bank_004.s at aab3894
    Our readingeach of the 96 bag slots: on the blue list: append it to $7F:BF00, empty the slot1136–1154each of the four party slots with a member: each of six equipment words at its record + $66, the same, marked $02001156–1198end the list with a 0 word1200–1201copy each range of the table at $84:8B20 to $7F:B000, then reset ($84:8888)1205–1235zero each range of the table at $84:8B591280–1306first bag slot = $1402: item 2 (Potion), 10 of it1309–1310a normal entry ($7F:E759 = 0): give each saved item back ($82:E746)1312–1340rebuild the members ($81:ED35) and the capsule monsters ($82:C2FD)1344–1345

    In the cartridge (“Lufia II - Rise of the Sinistrals (USA)”): $84:8B20 (the saved ranges) and $84:8B59 (the cleared ranges), five bytes each: address, bank, length. We don't reproduce the bytes.

    162Lufia2ExecutionResult Lufia2PartyResetDefaultRecords(
    163    const Lufia2Memory *memory, Lufia2CpuState *cpu,
    164    Lufia2PushedChildCall child, void *context) {
    165    if (!child || !cpu->accumulator_is_8_bit || cpu->index_is_8_bit || cpu->decimal)
    166        return ExecutionHandoff(cpu, 0x81ed35u);
    167    PushDataBank(memory, cpu);
    168    OpSetDataBank(memory, cpu, DEFAULT_RECORD_DATA_BANK);
    169    SetDefaultRecordPointers(memory, cpu);
    170    OpLdx(cpu, 0xb395u);
    171    OpStz(memory, cpu, OpAbs(cpu, WRAM_PARTY_STAT_MEMBER_INDEX));
    172    const uint32_t unpack_sites[] = {
    173        0x81ed55u, 0x81ed5bu, 0x81ed61u, 0x81ed67u,
    ⋮
    
    src/system/default_records.c lines 162–176 at 6fc15bb · upstream ↗
    src/party/capsule.c at 6fc15bb
    Our readingthe capsule reset returns at once unless $0A7F is 7485–488
    src/cave/cave_entry.c at 6fc15bb
    Our readingthe blue test: the item's low 9 bits against each of the 41 words at $94:EEA023–40
    code/bank_002.s at aab3894
    Our reading$0A7F not 7: skip the capsule reset ($82:C351)10098–10100

    Claim page

  2. ^ abCodevinheim3/lufia2-disasmbank_004.s 1355–1392, 1395–1477, 1479–1617, 1620–1651
    How we know
    code/bank_004.s at aab3894
    Our readingadd the cave's minutes and hours to the cave's total time; add $0B5B to $0B721355–1387$7F:E759 nonzero (a wipe): skip the collecting1389–1392each bag slot against the nine Iris words at $91:FFCA: list it, set flag 200 + index1403–1439each bag slot: list it if blue ($84:8AF4)1441–1451six equipment words of each of seven member records: list them if blue1453–1474keep the count at $7E:E2001476–1477restore every saved range from $7F:B0001479–1513a wipe: give the saved list from the entrance1517–1546else give each collected item, at least 1 of it1548–1583add the cave's time to the restored play time1585–1610
    1620Call_04_8af4:
    1621	sta $54                                                  ; $8af4 : $85, $54
    1622	and #$ff.b                                                  ; $8af6 : $29, $ff
    1623	ora ($18, X)                                                  ; $8af8 : $01, $18
    1624	beq br_04_8b1f                                                  ; $8afa : $f0, $23
    ⋮
    1626	ldx #$0000.w                                                  ; $8afc : $a2, $00, $00
    ⋮
    1628br_04_8aff:
    1629	cmp $94eea0.l, X                                                  ; $8aff : $df, $a0, $ee, $94
    1630	beq br_04_8b0f                                                  ; $8b03 : $f0, $0a
    ⋮
    1632	inx                                                  ; $8b05 : $e8
    1633	inx                                                  ; $8b06 : $e8
    1634	cpx #$0052.w                                                  ; $8b07 : $e0, $52, $00
    ⋮
    
    code/bank_004.s lines 1620–1651 at aab3894 · upstream ↗

    Claim page

  3. ^CodeCellenseres/Lufia2Decomp · vinheim3/lufia2-disasmcave_reset.c 136–170; bank_004.s 1727–1748; +2 files
    How we know
    src/cave/cave_reset.c at 6fc15bb
    Our reading$7F:E759 = $FF, then the reset, which skips the saved items when it is nonzero143–148the defeat count +1, held at $FFFF154–160set the map and the reload flags161–168
    1727	lda #$8fff.w                                                  ; $8b9c : $a9, $ff, $8f
    1728	eor $7fe7.w, Y                                                  ; $8b9f : $59, $e7, $7f
    1729	jsr Call_04_8888.w                                                  ; $8ba2 : $20, $88, $88
    1730	rep #ACCU_8                                                  ; $8ba5 : $c2, $20
    1731	lda $0b6c.w                                                  ; $8ba7 : $ad, $6c, $0b
    1732	ina                                                  ; $8baa : $1a
    1733	bne br_04_8bae                                                  ; $8bab : $d0, $01
    ⋮
    1735	dea                                                  ; $8bad : $3a
    ⋮
    1737br_04_8bae:
    1738	sta $0b6c.w                                                  ; $8bae : $8d, $6c, $0b
    1739	sep #ACCU_8                                                  ; $8bb1 : $e2, $20
    1740	lda #$f0.b                                                  ; $8bb3 : $a9, $f0
    ⋮
    
    code/bank_004.s lines 1727–1748 at aab3894 · upstream ↗
    code/bank_003.s at aab3894
    Our readingafter a battle: result $7F:F8A2 = 1 on map $F1 or $F0: the defeat routine $84:8B9C597–609
    src/battle/battle_outcome.c at 6fc15bb
    Our reading$11 stays $FF only if every party record has status bit $04; $12 the same for the enemies30–56every enemy down: result 0; else every member down: result 166–76

    Claim page

  4. ^ abCodevinheim3/lufia2-disasm · Cellenseres/Lufia2Decomp · “Lufia II - Rise of the Sinistrals (USA)” · Kirvan/Lufia-II-AC-Usb2Snes-Livesplit-Definitionbank_004.s 1121–1128; bank_003.s 4780–4785; +2 files
    How we know
    code/bank_004.s at aab3894
    Our readingentries +1 at $0B6A, held at $FFFF1121–1128
    code/bank_003.s at aab3894
    Our readingfloor count at or above $0B75: store it there4781–4785
    266#define WRAM_ANCIENT_CAVE_TOTAL_HOURS 0x0b68u
    267#define WRAM_ANCIENT_CAVE_TOTAL_MINUTES 0x0b69u
    268#define WRAM_ANCIENT_CAVE_ENTRY_COUNT 0x0b6au
    269#define WRAM_ANCIENT_CAVE_DEFEAT_COUNT 0x0b6cu
    270#define WRAM_FIELD_REWARD_COUNT_A 0x0b6eu
    271#define WRAM_FIELD_REWARD_COUNT_B 0x0b70u
    272#define WRAM_ANCIENT_CAVE_TOTAL_COUNTER 0x0b72u
    
    src/system/wram.h lines 266–272 at 6fc15bb · upstream ↗

    In the cartridge (“Lufia II - Rise of the Sinistrals (USA)”): $84:8B20, the saved ranges: none covers $0B68-$0B75. We don't reproduce the bytes.

    33      "name": "Floor01",
    34      "address": "0x0B75",
    35      "value": "0x02",
    
    lufia-ac.json lines 33–35 at 5e5f556 · upstream ↗

    Claim page

Sources

Code

Secondary