mirror of
https://github.com/zeldaret/ss
synced 2026-05-24 15:20:58 -04:00
Merge pull request #16 from robojumper/single-counters
Match the single-counter files
This commit is contained in:
@@ -131,6 +131,52 @@ toBeSorted/skipflag_manager.cpp:
|
||||
.sbss start:0x80575408 end:0x8057540C
|
||||
.bss start:0x805A9C68 end:0x805A9C88
|
||||
|
||||
toBeSorted/counters/counter.cpp:
|
||||
.text start:0x8016CC40 end:0x8016CD94
|
||||
|
||||
toBeSorted/counters/rupee_counter.cpp:
|
||||
.text start:0x8016DE10 end:0x8016DF98
|
||||
.ctors start:0x804DB7BC end:0x804DB7C0
|
||||
.rodata start:0x804E91B0 end:0x804E91D0
|
||||
.data start:0x80527FF0 end:0x80528010
|
||||
.sbss start:0x80575610 end:0x80575618
|
||||
|
||||
toBeSorted/counters/arrow_counter.cpp:
|
||||
.text start:0x8016DFA0 end:0x8016E018
|
||||
.ctors start:0x804DB7C0 end:0x804DB7C4
|
||||
.data start:0x80528010 end:0x80528030
|
||||
.sbss start:0x80575618 end:0x80575620
|
||||
|
||||
toBeSorted/counters/bomb_counter.cpp:
|
||||
.text start:0x8016E020 end:0x8016E098
|
||||
.ctors start:0x804DB7C4 end:0x804DB7C8
|
||||
.data start:0x80528030 end:0x80528050
|
||||
.sbss start:0x80575620 end:0x80575628
|
||||
|
||||
toBeSorted/counters/tear_counter.cpp:
|
||||
.text start:0x8016E0A0 end:0x8016E118
|
||||
.ctors start:0x804DB7C8 end:0x804DB7CC
|
||||
.data start:0x80528050 end:0x80528070
|
||||
.sbss start:0x80575628 end:0x80575630
|
||||
|
||||
toBeSorted/counters/slingshot_seed_counter.cpp:
|
||||
.text start:0x8016E120 end:0x8016E198
|
||||
.ctors start:0x804DB7CC end:0x804DB7D0
|
||||
.data start:0x80528070 end:0x80528090
|
||||
.sbss start:0x80575630 end:0x80575638
|
||||
|
||||
toBeSorted/counters/key_piece_counter.cpp:
|
||||
.text start:0x8016E1A0 end:0x8016E218
|
||||
.ctors start:0x804DB7D0 end:0x804DB7D4
|
||||
.data start:0x80528090 end:0x805280B0
|
||||
.sbss start:0x80575638 end:0x80575640
|
||||
|
||||
toBeSorted/counters/extra_wallet_counter.cpp:
|
||||
.text start:0x8016E220 end:0x8016E298
|
||||
.ctors start:0x804DB7D4 end:0x804DB7D8
|
||||
.data start:0x805280B0 end:0x805280D0
|
||||
.sbss start:0x80575640 end:0x80575648
|
||||
|
||||
c/c_list.cpp:
|
||||
.text start:0x802E08C0 end:0x802E0A10
|
||||
|
||||
|
||||
+42
-42
@@ -9354,10 +9354,10 @@ fn_8016CB40 = .text:0x8016CB40; // type:function size:0x1C
|
||||
fn_8016CB60 = .text:0x8016CB60; // type:function size:0x78
|
||||
fn_8016CBE0 = .text:0x8016CBE0; // type:function size:0x3C
|
||||
fn_8016CC20 = .text:0x8016CC20; // type:function size:0x14
|
||||
fn_8016CC40 = .text:0x8016CC40; // type:function size:0xF0
|
||||
fn_8016CD30 = .text:0x8016CD30; // type:function size:0x20
|
||||
fn_8016CD50 = .text:0x8016CD50; // type:function size:0x20
|
||||
fn_8016CD70 = .text:0x8016CD70; // type:function size:0x24
|
||||
checkedAdd__7CounterFi = .text:0x8016CC40; // type:function size:0xF0
|
||||
getCommittedValue__7CounterFv = .text:0x8016CD30; // type:function size:0x20
|
||||
getUncommittedValue__7CounterFv = .text:0x8016CD50; // type:function size:0x20
|
||||
setValue__7CounterFUs = .text:0x8016CD70; // type:function size:0x24
|
||||
fn_8016CDA0 = .text:0x8016CDA0; // type:function size:0x64
|
||||
fn_8016CE10 = .text:0x8016CE10; // type:function size:0x10
|
||||
fn_8016CE20 = .text:0x8016CE20; // type:function size:0x14
|
||||
@@ -9432,36 +9432,36 @@ fn_8016D990 = .text:0x8016D990; // type:function size:0x8
|
||||
fn_8016D9A0 = .text:0x8016D9A0; // type:function size:0x8
|
||||
fn_8016D9B0 = .text:0x8016D9B0; // type:function size:0x8
|
||||
fn_8016D9C0 = .text:0x8016D9C0; // type:function size:0x448
|
||||
fn_8016DE10 = .text:0x8016DE10; // type:function size:0xAC
|
||||
fn_8016DEC0 = .text:0x8016DEC0; // type:function size:0x2C
|
||||
fn_8016DEF0 = .text:0x8016DEF0; // type:function size:0x40
|
||||
fn_8016DF30 = .text:0x8016DF30; // type:function size:0x18
|
||||
fn_8016DF50 = .text:0x8016DF50; // type:function size:0x38
|
||||
fn_8016DF90 = .text:0x8016DF90; // type:function size:0x8
|
||||
fn_8016DFA0 = .text:0x8016DFA0; // type:function size:0x40
|
||||
fn_8016DFE0 = .text:0x8016DFE0; // type:function size:0x18
|
||||
fn_8016E000 = .text:0x8016E000; // type:function size:0x8
|
||||
fn_8016E010 = .text:0x8016E010; // type:function size:0x8
|
||||
fn_8016E020 = .text:0x8016E020; // type:function size:0x40
|
||||
fn_8016E060 = .text:0x8016E060; // type:function size:0x18
|
||||
fn_8016E080 = .text:0x8016E080; // type:function size:0x8
|
||||
fn_8016E090 = .text:0x8016E090; // type:function size:0x8
|
||||
fn_8016E0A0 = .text:0x8016E0A0; // type:function size:0x40
|
||||
fn_8016E0E0 = .text:0x8016E0E0; // type:function size:0x18
|
||||
fn_8016E100 = .text:0x8016E100; // type:function size:0x8
|
||||
fn_8016E110 = .text:0x8016E110; // type:function size:0x8
|
||||
fn_8016E120 = .text:0x8016E120; // type:function size:0x40
|
||||
fn_8016E160 = .text:0x8016E160; // type:function size:0x18
|
||||
fn_8016E180 = .text:0x8016E180; // type:function size:0x8
|
||||
fn_8016E190 = .text:0x8016E190; // type:function size:0x8
|
||||
fn_8016E1A0 = .text:0x8016E1A0; // type:function size:0x40
|
||||
fn_8016E1E0 = .text:0x8016E1E0; // type:function size:0x18
|
||||
fn_8016E200 = .text:0x8016E200; // type:function size:0x8
|
||||
fn_8016E210 = .text:0x8016E210; // type:function size:0x8
|
||||
fn_8016E220 = .text:0x8016E220; // type:function size:0x40
|
||||
fn_8016E260 = .text:0x8016E260; // type:function size:0x18
|
||||
fn_8016E280 = .text:0x8016E280; // type:function size:0x8
|
||||
fn_8016E290 = .text:0x8016E290; // type:function size:0x8
|
||||
getBaseCapacity__Fv = .text:0x8016DE10; // type:function size:0xAC
|
||||
getExtraWalletCapacity__Fv = .text:0x8016DEC0; // type:function size:0x2C
|
||||
__dt__12RupeeCounterFv = .text:0x8016DEF0; // type:function size:0x40
|
||||
__ct__12RupeeCounterFv = .text:0x8016DF30; // type:function size:0x18
|
||||
getMax__12RupeeCounterFv = .text:0x8016DF50; // type:function size:0x38
|
||||
__sinit_\rupee_counter_cpp = .text:0x8016DF90; // type:function size:0x8 scope:local
|
||||
__dt__12ArrowCounterFv = .text:0x8016DFA0; // type:function size:0x40
|
||||
__ct__12ArrowCounterFv = .text:0x8016DFE0; // type:function size:0x18
|
||||
getMax__12ArrowCounterFv = .text:0x8016E000; // type:function size:0x8
|
||||
__sinit_\arrow_counter_cpp = .text:0x8016E010; // type:function size:0x8 scope:local
|
||||
__dt__11BombCounterFv = .text:0x8016E020; // type:function size:0x40
|
||||
__ct__11BombCounterFv = .text:0x8016E060; // type:function size:0x18
|
||||
getMax__11BombCounterFv = .text:0x8016E080; // type:function size:0x8
|
||||
__sinit_\bomb_counter_cpp = .text:0x8016E090; // type:function size:0x8 scope:local
|
||||
__dt__11TearCounterFv = .text:0x8016E0A0; // type:function size:0x40
|
||||
__ct__11TearCounterFv = .text:0x8016E0E0; // type:function size:0x18
|
||||
getMax__11TearCounterFv = .text:0x8016E100; // type:function size:0x8
|
||||
__sinit_\tear_counter_cpp = .text:0x8016E110; // type:function size:0x8 scope:local
|
||||
__dt__20SlingshotSeedCounterFv = .text:0x8016E120; // type:function size:0x40
|
||||
__ct__20SlingshotSeedCounterFv = .text:0x8016E160; // type:function size:0x18
|
||||
getMax__20SlingshotSeedCounterFv = .text:0x8016E180; // type:function size:0x8
|
||||
__sinit_\slingshot_seed_counter_cpp = .text:0x8016E190; // type:function size:0x8 scope:local
|
||||
__dt__15KeyPieceCounterFv = .text:0x8016E1A0; // type:function size:0x40
|
||||
__ct__15KeyPieceCounterFv = .text:0x8016E1E0; // type:function size:0x18
|
||||
getMax__15KeyPieceCounterFv = .text:0x8016E200; // type:function size:0x8
|
||||
__sinit_\key_piece_counter_cpp = .text:0x8016E210; // type:function size:0x8 scope:local
|
||||
__dt__18ExtraWalletCounterFv = .text:0x8016E220; // type:function size:0x40
|
||||
__ct__18ExtraWalletCounterFv = .text:0x8016E260; // type:function size:0x18
|
||||
getMax__18ExtraWalletCounterFv = .text:0x8016E280; // type:function size:0x8
|
||||
__sinit_\extra_wallet_counter_cpp = .text:0x8016E290; // type:function size:0x8 scope:local
|
||||
fn_8016E2A0 = .text:0x8016E2A0; // type:function size:0x6C
|
||||
fn_8016E310 = .text:0x8016E310; // type:function size:0x194
|
||||
fn_8016E4B0 = .text:0x8016E4B0; // type:function size:0x1C
|
||||
@@ -28352,7 +28352,7 @@ lbl_804E8D18 = .rodata:0x804E8D18; // type:object size:0x10
|
||||
lbl_804E8D28 = .rodata:0x804E8D28; // type:object size:0x48 data:4byte
|
||||
lbl_804E8D70 = .rodata:0x804E8D70; // type:object size:0x40 data:4byte
|
||||
lbl_804E8DB0 = .rodata:0x804E8DB0; // type:object size:0x400
|
||||
lbl_804E91B0 = .rodata:0x804E91B0; // type:object size:0x20 data:4byte
|
||||
wallet_definitions = .rodata:0x804E91B0; // type:object size:0x20 scope:local data:4byte
|
||||
lbl_804E91D0 = .rodata:0x804E91D0; // type:object size:0xA8
|
||||
lbl_804E9278 = .rodata:0x804E9278; // type:object size:0xA0
|
||||
lbl_804E9318 = .rodata:0x804E9318; // type:object size:0xA8
|
||||
@@ -33327,13 +33327,13 @@ lbl_80527F70 = .data:0x80527F70; // type:object size:0x20
|
||||
lbl_80527F90 = .data:0x80527F90; // type:object size:0x20
|
||||
lbl_80527FB0 = .data:0x80527FB0; // type:object size:0x20
|
||||
lbl_80527FD0 = .data:0x80527FD0; // type:object size:0x20
|
||||
lbl_80527FF0 = .data:0x80527FF0; // type:object size:0x20
|
||||
lbl_80528010 = .data:0x80528010; // type:object size:0x20
|
||||
lbl_80528030 = .data:0x80528030; // type:object size:0x20
|
||||
lbl_80528050 = .data:0x80528050; // type:object size:0x20
|
||||
lbl_80528070 = .data:0x80528070; // type:object size:0x20
|
||||
lbl_80528090 = .data:0x80528090; // type:object size:0x20
|
||||
lbl_805280B0 = .data:0x805280B0; // type:object size:0x20
|
||||
__vt__12RupeeCounter = .data:0x80527FF0; // type:object size:0x20
|
||||
__vt__12ArrowCounter = .data:0x80528010; // type:object size:0x20
|
||||
__vt__11BombCounter = .data:0x80528030; // type:object size:0x20
|
||||
__vt__11TearCounter = .data:0x80528050; // type:object size:0x20
|
||||
__vt__20SlingshotSeedCounter = .data:0x80528070; // type:object size:0x20
|
||||
__vt__15KeyPieceCounter = .data:0x80528090; // type:object size:0x20
|
||||
__vt__18ExtraWalletCounter = .data:0x805280B0; // type:object size:0x20
|
||||
lbl_805280D0 = .data:0x805280D0; // type:object size:0xC
|
||||
lbl_805280DC = .data:0x805280DC; // type:object size:0xC
|
||||
lbl_805280E8 = .data:0x805280E8; // type:object size:0x10
|
||||
|
||||
@@ -287,6 +287,14 @@ config.libs = [
|
||||
Object(NonMatching, "d/a/d_a_base.cpp"),
|
||||
Object(NonMatching, "d/a/obj/d_a_obj_base.cpp"),
|
||||
Object(Matching, "toBeSorted/save_file.cpp"),
|
||||
Object(Matching, "toBeSorted/counters/counter.cpp"),
|
||||
Object(Matching, "toBeSorted/counters/rupee_counter.cpp"),
|
||||
Object(Matching, "toBeSorted/counters/arrow_counter.cpp"),
|
||||
Object(Matching, "toBeSorted/counters/bomb_counter.cpp"),
|
||||
Object(Matching, "toBeSorted/counters/tear_counter.cpp"),
|
||||
Object(Matching, "toBeSorted/counters/slingshot_seed_counter.cpp"),
|
||||
Object(Matching, "toBeSorted/counters/key_piece_counter.cpp"),
|
||||
Object(Matching, "toBeSorted/counters/extra_wallet_counter.cpp"),
|
||||
Object(NonMatching, "toBeSorted/file_manager.cpp"),
|
||||
Object(NonMatching, "toBeSorted/save_manager.cpp"),
|
||||
Object(NonMatching, "f/f_base.cpp"),
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef COUNTER_H
|
||||
#define COUNTER_H
|
||||
|
||||
#include <common.h>
|
||||
|
||||
class Counter {
|
||||
public:
|
||||
Counter(u16 id): counterId(id) {}
|
||||
virtual ~Counter() {};
|
||||
virtual s32 checkedAdd(s32 num);
|
||||
virtual u16 getCommittedValue();
|
||||
virtual u16 getMax() = 0;
|
||||
virtual u16 getUncommittedValue();
|
||||
virtual void setValue(u16 num);
|
||||
|
||||
u16 counterId;
|
||||
};
|
||||
|
||||
#endif COUNTER_H
|
||||
@@ -0,0 +1,14 @@
|
||||
#include <toBeSorted/counters/counter.h>
|
||||
|
||||
class ArrowCounter : public Counter {
|
||||
public:
|
||||
ArrowCounter();
|
||||
/* 8016DFA0 */ ~ArrowCounter() {}
|
||||
/* 8016E000 */ virtual u16 getMax() override {
|
||||
return 20;
|
||||
};
|
||||
};
|
||||
|
||||
/* 80575618 */ ArrowCounter lbl_80575618;
|
||||
|
||||
/* 8016DFE0 */ ArrowCounter::ArrowCounter() : Counter(0x1f2) {}
|
||||
@@ -0,0 +1,14 @@
|
||||
#include <toBeSorted/counters/counter.h>
|
||||
|
||||
class BombCounter : public Counter {
|
||||
public:
|
||||
BombCounter();
|
||||
/* 8016E020 */ ~BombCounter() {}
|
||||
/* 8016E080 */ virtual u16 getMax() override {
|
||||
return 10;
|
||||
}
|
||||
};
|
||||
|
||||
/* 80575620 */ BombCounter lbl_80575620;
|
||||
|
||||
/* 8016E060 */ BombCounter::BombCounter(): Counter(0x1f3) { }
|
||||
@@ -0,0 +1,55 @@
|
||||
#include <toBeSorted/counters/counter.h>
|
||||
|
||||
// TODO use the item flag manager once it exists
|
||||
class ItemFlagManager {
|
||||
public:
|
||||
ItemFlagManager() {}
|
||||
/** 0x08 */ virtual ~ItemFlagManager();
|
||||
/** 0x0C */ virtual void setFlagszptr();
|
||||
/** 0x10 */ virtual void onDirty();
|
||||
/** 0x14 */ virtual void copyFlagsFromSave() = 0;
|
||||
/** 0x18 */ virtual void setupUnkFlagsStuff() = 0;
|
||||
/** 0x1C */ virtual bool doCommit() = 0;
|
||||
/** 0x20 */ virtual void setFlag(u16 flag);
|
||||
/** 0x24 */ virtual void unsetFlag(u16 flag);
|
||||
/** 0x28 */ virtual void setFlagOrCounterToValue(u16 flag, u16 value);
|
||||
/** 0x2C */ virtual u16 getCounterOrFlag(u16 flag);
|
||||
/** 0x30 */ virtual u16 getUncommittedValue(u16 flag);
|
||||
/** 0x34 */ virtual void unk3();
|
||||
/** 0x38 */ virtual u16 *getSaveFlagSpace() = 0;
|
||||
};
|
||||
|
||||
// TODO set up item flag manager
|
||||
extern "C" ItemFlagManager *lbl_80575400;
|
||||
|
||||
|
||||
/* 8016cc40 */ s32 Counter::checkedAdd(s32 num) {
|
||||
s32 uncommitted = getUncommittedValue();
|
||||
s32 max = getMax();
|
||||
s32 result = uncommitted + num;
|
||||
if (result < 0) {
|
||||
setValue(0);
|
||||
} else if (result < max) {
|
||||
setValue(result);
|
||||
} else {
|
||||
setValue(max);
|
||||
}
|
||||
|
||||
if (result < 0) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return result <= max ? 0 : (result - max);
|
||||
}
|
||||
|
||||
/* 8016cd30 */ u16 Counter::getCommittedValue() {
|
||||
return lbl_80575400->getCounterOrFlag(counterId | 0x4000);
|
||||
}
|
||||
|
||||
/* 8016cd50 */ u16 Counter::getUncommittedValue() {
|
||||
return lbl_80575400->getUncommittedValue(counterId | 0x4000);
|
||||
}
|
||||
|
||||
/* 8016cd70 */ void Counter::setValue(u16 num) {
|
||||
lbl_80575400->setFlagOrCounterToValue(counterId | 0x4000, num);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#include <toBeSorted/counters/counter.h>
|
||||
|
||||
class ExtraWalletCounter : public Counter {
|
||||
public:
|
||||
ExtraWalletCounter();
|
||||
/* 8016E220 */ ~ExtraWalletCounter() {}
|
||||
/* 8016E280 */ virtual u16 getMax() override {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* 80575640 */ ExtraWalletCounter lbl_80575640;
|
||||
|
||||
/* 8016E260 */ ExtraWalletCounter::ExtraWalletCounter(): Counter(0x1fc) { }
|
||||
@@ -0,0 +1,14 @@
|
||||
#include <toBeSorted/counters/counter.h>
|
||||
|
||||
class KeyPieceCounter : public Counter {
|
||||
public:
|
||||
KeyPieceCounter();
|
||||
/* 8016E1A0 */ ~KeyPieceCounter() {}
|
||||
/* 8016E200 */ virtual u16 getMax() override {
|
||||
return 5;
|
||||
}
|
||||
};
|
||||
|
||||
/* 80575638 */ KeyPieceCounter lbl_80575638;
|
||||
|
||||
/* 8016E1E0 */ KeyPieceCounter::KeyPieceCounter() : Counter(0x1f9) {}
|
||||
@@ -0,0 +1,50 @@
|
||||
#include <toBeSorted/counters/counter.h>
|
||||
|
||||
static u16 getBaseCapacity();
|
||||
static u16 getExtraWalletCapacity();
|
||||
|
||||
class RupeeCounter : public Counter {
|
||||
public:
|
||||
RupeeCounter();
|
||||
/* 8016DEF0 */ ~RupeeCounter() {}
|
||||
/* 8016DF50 */ virtual u16 getMax() override {
|
||||
return (getBaseCapacity() + getExtraWalletCapacity());
|
||||
}
|
||||
};
|
||||
|
||||
struct WalletStruct {
|
||||
u32 flag;
|
||||
u16 capacity;
|
||||
};
|
||||
|
||||
// TODO set up item flag manager
|
||||
extern "C" void *lbl_80575400;
|
||||
extern "C" u16 fn_800BF5E0(void *data, u16 flag);
|
||||
|
||||
/* 8016DE10 */ static u16 getBaseCapacity() {
|
||||
int i = 0;
|
||||
/* 804E91B0 */ WalletStruct wallet_definitions[4] = {
|
||||
{0x6c, 500},
|
||||
{0x6d, 1000},
|
||||
{0x6e, 5000},
|
||||
{0x6f, 9000},
|
||||
};
|
||||
const WalletStruct *wallet = &wallet_definitions[3];
|
||||
for (; i < 4; i++, wallet--) {
|
||||
if (fn_800BF5E0(lbl_80575400, wallet->flag)) {
|
||||
return wallet->capacity;
|
||||
}
|
||||
}
|
||||
return 300;
|
||||
}
|
||||
|
||||
// TODO main counters class
|
||||
extern "C" u16 fn_8016D730(u16);
|
||||
|
||||
/* 8016DEC0 */ static u16 getExtraWalletCapacity() {
|
||||
return 300 * fn_8016D730(0x27);
|
||||
}
|
||||
|
||||
/* 80575610 */ RupeeCounter lbl_80575610;
|
||||
|
||||
/* 8016DF30 */ RupeeCounter::RupeeCounter() : Counter(0x1f5) {}
|
||||
@@ -0,0 +1,14 @@
|
||||
#include <toBeSorted/counters/counter.h>
|
||||
|
||||
class SlingshotSeedCounter : public Counter {
|
||||
public:
|
||||
SlingshotSeedCounter();
|
||||
/* 8016E120 */ ~SlingshotSeedCounter() {}
|
||||
/* 8016E180 */ virtual u16 getMax() override {
|
||||
return 20;
|
||||
};
|
||||
};
|
||||
|
||||
/* 80575630 */ SlingshotSeedCounter lbl_80575630;
|
||||
|
||||
/* 8016E160 */ SlingshotSeedCounter::SlingshotSeedCounter() : Counter(0x1ed) {}
|
||||
@@ -0,0 +1,14 @@
|
||||
#include <toBeSorted/counters/counter.h>
|
||||
|
||||
class TearCounter : public Counter {
|
||||
public:
|
||||
TearCounter();
|
||||
/* 8016E0A0 */ ~TearCounter() {}
|
||||
/* 8016E100 */ virtual u16 getMax() override {
|
||||
return 15;
|
||||
};
|
||||
};
|
||||
|
||||
/* 80575628 */ TearCounter lbl_80575628;
|
||||
|
||||
/* 8016E0E0 */ TearCounter::TearCounter(): Counter(0x1f4) { }
|
||||
Reference in New Issue
Block a user