mirror of
https://github.com/zeldaret/ss.git
synced 2024-11-23 13:39:53 +00:00
Separate our inc files
This commit is contained in:
parent
5e73b2b902
commit
50b16f7da4
5
.clangd
Normal file
5
.clangd
Normal file
@ -0,0 +1,5 @@
|
||||
# https://clangd.llvm.org/config
|
||||
CompileFlags:
|
||||
Add: [
|
||||
"-Wno-c++11-compat-deprecated-writable-strings"
|
||||
]
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -15,7 +15,7 @@
|
||||
"files.insertFinalNewline": true,
|
||||
"files.trimFinalNewlines": true,
|
||||
"files.associations": {
|
||||
"*.inc": "c",
|
||||
"*.inc": "cpp",
|
||||
".clangd": "yaml"
|
||||
},
|
||||
// Disable C/C++ IntelliSense, use clangd instead
|
||||
|
@ -199,7 +199,7 @@ d/d_text_writer.cpp:
|
||||
toBeSorted/time_area_mgr.cpp:
|
||||
.text start:0x800B9280 end:0x800BB2A0
|
||||
|
||||
toBeSorted/flag_managers/flag_managers.cpp:
|
||||
d/flag/flag_managers.cpp:
|
||||
.text start:0x800BD8C0 end:0x800C0650
|
||||
.data start:0x80510B88 end:0x80510D10
|
||||
.sbss start:0x805753E0 end:0x80575410
|
||||
|
@ -321,7 +321,7 @@ config.libs = [
|
||||
"progress_category": "game",
|
||||
"host": False,
|
||||
"objects": [
|
||||
Object(Matching, "toBeSorted/flag_managers/flag_managers.cpp"),
|
||||
Object(Matching, "d/flag/flag_managers.cpp"),
|
||||
Object(NonMatching, "toBeSorted/special_item_drop_mgr.cpp"),
|
||||
Object(Matching, "d/d_base.cpp"),
|
||||
Object(Matching, "d/d_dvd.cpp"),
|
||||
|
47
include/d/flag/baseflag_manager.h
Normal file
47
include/d/flag/baseflag_manager.h
Normal file
@ -0,0 +1,47 @@
|
||||
#ifndef D_FLAG_BASEFLAG_MANAGER_H
|
||||
#define D_FLAG_BASEFLAG_MANAGER_H
|
||||
|
||||
#include "d/flag/unk_flag_stuff.h"
|
||||
#include "d/flag/flag_space.h"
|
||||
|
||||
class ItemStoryManagerBase {
|
||||
public:
|
||||
ItemStoryManagerBase();
|
||||
|
||||
/** 0x08 */ virtual ~ItemStoryManagerBase();
|
||||
/** 0x0C */ virtual void setFlagszptr();
|
||||
/** 0x10 */ virtual void onDirty();
|
||||
/** 0x14 */ virtual void copyFlagsFromSave() = 0;
|
||||
/** 0x18 */ virtual void setupUnkFlagsStuff() = 0;
|
||||
/** 0x1C */ virtual void 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) const;
|
||||
/** 0x30 */ virtual u16 getUncommittedValue(u16 flag);
|
||||
/** 0x34 */ virtual u16 unk3(u16 arg);
|
||||
/** 0x38 */ virtual const u16 *getSaveFlagSpace() const = 0;
|
||||
|
||||
|
||||
void init();
|
||||
void setFlagSizes(u16 flagSizeMaybe, u16 anotherFlagSizeMaybe);
|
||||
void copyFlagsFromSave_Priv();
|
||||
void setupUnkFlagStuff(UnkFlagDefinition *def, u16 count);
|
||||
void doCommit_Priv();
|
||||
void setOrClearFlag(u16 flag, u16 value);
|
||||
u16 getFlag(u16 flag) const;
|
||||
void FUN_800bf610(u16 flag);
|
||||
u16 FUN_800bf640(u16 flag);
|
||||
void FUN_800bf690();
|
||||
|
||||
u16 getUncommittedValue_Priv(u16 flag);
|
||||
|
||||
protected:
|
||||
/** 0x04 */ u16 flagSizeMaybe;
|
||||
/** 0x06 */ u16 anotherSizeMaybe;
|
||||
/** 0x08 */ FlagSpace *storyFlagsPtr;
|
||||
/** 0x0C */ UnkFlagStuff *unkFlagsPtr;
|
||||
/** 0x10 */ bool dirty;
|
||||
};
|
||||
|
||||
#endif
|
23
include/d/flag/committable_flag_manager.h
Normal file
23
include/d/flag/committable_flag_manager.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef D_FLAG_COMMITTABLE_FLAG_MANAGER_H
|
||||
#define D_FLAG_COMMITTABLE_FLAG_MANAGER_H
|
||||
|
||||
class CommittableFlagManager {
|
||||
public:
|
||||
bool mNeedsCommit;
|
||||
|
||||
virtual void doCommit() = 0;
|
||||
virtual ~CommittableFlagManager() {}
|
||||
bool commitIfNecessary();
|
||||
void setNeedsCommit(bool commit) {
|
||||
mNeedsCommit = commit;
|
||||
}
|
||||
CommittableFlagManager() {
|
||||
mNeedsCommit = false;
|
||||
}
|
||||
CommittableFlagManager(bool commit) {
|
||||
mNeedsCommit = commit;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
41
include/d/flag/enemyflag_manager.h
Normal file
41
include/d/flag/enemyflag_manager.h
Normal file
@ -0,0 +1,41 @@
|
||||
#ifndef D_FLAG_ENEMYFLAG_MANAGER_H
|
||||
#define D_FLAG_ENEMYFLAG_MANAGER_H
|
||||
|
||||
#include "d/flag/bitwise_flag_helper.h"
|
||||
#include "d/flag/committable_flag_manager.h"
|
||||
#include "d/flag/flag_space.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
|
||||
class EnemyDefeatManager : public CommittableFlagManager {
|
||||
public:
|
||||
FlagSpace mFlagSpace;
|
||||
BitwiseFlagHelper mFlagHelper;
|
||||
u16 mSceneIndex;
|
||||
|
||||
static u16 sEnemyDefeatFlags[4096];
|
||||
|
||||
static EnemyDefeatManager *sInstance;
|
||||
|
||||
void clearSavedFlags();
|
||||
bool checkUncommittedFlag(u16 flag);
|
||||
u16 checkUncommittedFlag2(u16 flag) {
|
||||
return checkUncommittedFlag(flag);
|
||||
}
|
||||
EnemyDefeatManager();
|
||||
void init();
|
||||
void copyFromSave(u16 sceneIndex);
|
||||
void updateFlagIndex(u16 sceneIndex);
|
||||
void clearAll();
|
||||
bool checkIsValidFlag(u16 flag);
|
||||
bool checkFlag(u16 flag);
|
||||
virtual ~EnemyDefeatManager() {}
|
||||
virtual u16 getFlagCount() const;
|
||||
void setFlag(u16 flag);
|
||||
|
||||
virtual void doCommit() override {
|
||||
FileManager *mgr = FileManager::sInstance;
|
||||
mgr->setEnemyDefeatFlags(mFlagSpace.getFlagPtrUnchecked(), 0, 0x1000);
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
60
include/d/flag/itemflag_manager.h
Normal file
60
include/d/flag/itemflag_manager.h
Normal file
@ -0,0 +1,60 @@
|
||||
|
||||
#ifndef D_FLAG_ITEMFLAG_MANAGER_H
|
||||
#define D_FLAG_ITEMFLAG_MANAGER_H
|
||||
|
||||
#include "d/flag/baseflag_manager.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
|
||||
|
||||
class ItemflagManager : public ItemStoryManagerBase {
|
||||
public:
|
||||
FlagSpace itemFlags;
|
||||
|
||||
ItemflagManager();
|
||||
virtual ~ItemflagManager() {}
|
||||
|
||||
bool commit();
|
||||
|
||||
/** 0x0C */ virtual void setFlagszptr() override {
|
||||
storyFlagsPtr = &itemFlags;
|
||||
}
|
||||
/** 0x10 */ virtual void onDirty() override;
|
||||
/** 0x14 */ virtual void copyFlagsFromSave();
|
||||
/** 0x18 */ virtual void setupUnkFlagsStuff();
|
||||
/** 0x1C */ virtual void doCommit() {
|
||||
u16 sz = flagSizeMaybe;
|
||||
u16 *flags = storyFlagsPtr->getFlagPtrUnchecked();
|
||||
FileManager::sInstance->setItemFlags(flags, 0, sz);
|
||||
}
|
||||
/** 0x20 */ virtual void setFlag(u16 flag) {
|
||||
ItemStoryManagerBase::setFlag(flag & ~0x4000);
|
||||
}
|
||||
/** 0x24 */ virtual void unsetFlag(u16 flag) {
|
||||
ItemStoryManagerBase::unsetFlag(flag & ~0x4000);
|
||||
}
|
||||
/** 0x28 */ virtual void setFlagOrCounterToValue(u16 flag, u16 value) {
|
||||
ItemStoryManagerBase::setFlagOrCounterToValue(flag & ~0x4000, value);
|
||||
}
|
||||
/** 0x2C */ virtual u16 getCounterOrFlag(u16 flag) const {
|
||||
return ItemStoryManagerBase::getCounterOrFlag(flag & ~0x4000);
|
||||
}
|
||||
/** 0x30 */ virtual u16 getUncommittedValue(u16 flag) {
|
||||
return ItemStoryManagerBase::getUncommittedValue(flag & ~0x4000);
|
||||
}
|
||||
/** 0x34 */ virtual u16 unk3(u16 arg) {
|
||||
return ItemStoryManagerBase::unk3(arg & ~0x4000);
|
||||
}
|
||||
/** 0x38 */ virtual const u16 *getSaveFlagSpace() const {
|
||||
return FileManager::sInstance->getItemFlagsConst();
|
||||
};
|
||||
|
||||
u16 getFlagDirect(u16 flag) {
|
||||
return ItemStoryManagerBase::getCounterOrFlag(flag);
|
||||
}
|
||||
|
||||
public:
|
||||
static ItemflagManager *sInstance;
|
||||
static u16 sFlags[0x40];
|
||||
};
|
||||
|
||||
#endif
|
@ -2,8 +2,8 @@
|
||||
#define SCENEFLAG_MANAGER_H
|
||||
|
||||
#include "common.h"
|
||||
#include "toBeSorted/bitwise_flag_helper.h"
|
||||
#include "toBeSorted/flag_space.h"
|
||||
#include "d/flag/bitwise_flag_helper.h"
|
||||
#include "d/flag/flag_space.h"
|
||||
|
||||
|
||||
class SceneflagManager {
|
29
include/d/flag/skipflag_manager.h
Normal file
29
include/d/flag/skipflag_manager.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef D_FLAG_SKIPFLAG_MANAGER_H
|
||||
#define D_FLAG_SKIPFLAG_MANAGER_H
|
||||
|
||||
|
||||
#include "d/flag/bitwise_flag_helper.h"
|
||||
#include "d/flag/flag_space.h"
|
||||
|
||||
class SkipflagManager {
|
||||
public:
|
||||
SkipflagManager();
|
||||
void init();
|
||||
|
||||
void copyFromSave();
|
||||
void setCommitFlag(u16 flag);
|
||||
void thunk_copyFromSave();
|
||||
void setFlag(u16 flag);
|
||||
bool checkFlag(u16 flag);
|
||||
bool commitFlags();
|
||||
static SkipflagManager *sInstance;
|
||||
|
||||
private:
|
||||
static u16 sSkipFlags[16];
|
||||
|
||||
bool mShouldCommit;
|
||||
BitwiseFlagHelper mFlagHelper;
|
||||
FlagSpace mFlagSpace;
|
||||
};
|
||||
|
||||
#endif
|
38
include/d/flag/storyflag_manager.h
Normal file
38
include/d/flag/storyflag_manager.h
Normal file
@ -0,0 +1,38 @@
|
||||
#ifndef D_FLAG_STORYFLAG_MANAGER_H
|
||||
#define D_FLAG_STORYFLAG_MANAGER_H
|
||||
|
||||
#include "d/flag/baseflag_manager.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
|
||||
class StoryflagManager : public ItemStoryManagerBase {
|
||||
public:
|
||||
StoryflagManager();
|
||||
|
||||
virtual ~StoryflagManager() {}
|
||||
|
||||
FlagSpace storyFlags;
|
||||
|
||||
bool commit();
|
||||
|
||||
/** 0x0C */ virtual void setFlagszptr() override {
|
||||
storyFlagsPtr = &storyFlags;
|
||||
}
|
||||
/** 0x10 */ virtual void onDirty() override;
|
||||
/** 0x14 */ virtual void copyFlagsFromSave() override;
|
||||
/** 0x18 */ virtual void setupUnkFlagsStuff() override;
|
||||
/** 0x1C */ virtual void doCommit() override {
|
||||
u16 sz = flagSizeMaybe;
|
||||
u16 *flags = storyFlagsPtr->getFlagPtrUnchecked();
|
||||
FileManager::sInstance->setStoryFlags(flags, 0, sz);
|
||||
}
|
||||
/** 0x24 */ virtual void unsetFlag(u16 flag) override;
|
||||
/** 0x38 */ virtual const u16 *getSaveFlagSpace() const override {
|
||||
return FileManager::sInstance->getStoryFlagsConst();
|
||||
};
|
||||
|
||||
public:
|
||||
static StoryflagManager *sInstance;
|
||||
static u16 sFlags[0x80];
|
||||
};
|
||||
|
||||
#endif
|
33
include/d/flag/tboxflag_manager.h
Normal file
33
include/d/flag/tboxflag_manager.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef D_FLAG_TBOXFLAG_MANAGER_H
|
||||
#define D_FLAG_TBOXFLAG_MANAGER_H
|
||||
|
||||
#include "d/flag/bitwise_flag_helper.h"
|
||||
#include "d/flag/committable_flag_manager.h"
|
||||
#include "d/flag/flag_space.h"
|
||||
|
||||
class TBoxFlagManager : public CommittableFlagManager {
|
||||
public:
|
||||
FlagSpace mFlagSpace;
|
||||
u16 mSceneIndex;
|
||||
BitwiseFlagHelper mFlagHelper;
|
||||
|
||||
static u16 sTBoxFlags[2];
|
||||
|
||||
static TBoxFlagManager *sInstance;
|
||||
|
||||
virtual void doCommit() override;
|
||||
bool checkUncommittedFlag(u16 flag);
|
||||
TBoxFlagManager();
|
||||
virtual ~TBoxFlagManager() {}
|
||||
void init();
|
||||
void copyFromSave(u32 sceneIndex);
|
||||
bool checkFlag(u16 sceneIndex, u16 flag);
|
||||
virtual u16 getFlagCount() const;
|
||||
void setFlag(u16 flag);
|
||||
bool checkUncommittedFlag(u16 sceneIndex, u16 flag);
|
||||
u16 checkUncommittedFlag2(u16 flag) {
|
||||
return checkUncommittedFlag(flag);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
@ -1,137 +0,0 @@
|
||||
#ifndef ITEM_STORY_FLAG_MANAGER_H
|
||||
#define ITEM_STORY_FLAG_MANAGER_H
|
||||
|
||||
#include "toBeSorted/flag_space.h"
|
||||
#include "toBeSorted/unk_flag_stuff.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
|
||||
// TODO These classes have an interesting relation and there are like 5 vtables, so
|
||||
// the stuff in this header should not be relied upon for actually implementing these,
|
||||
// but we need the interface
|
||||
|
||||
class ItemStoryManagerBase {
|
||||
public:
|
||||
ItemStoryManagerBase();
|
||||
|
||||
/** 0x08 */ virtual ~ItemStoryManagerBase();
|
||||
/** 0x0C */ virtual void setFlagszptr();
|
||||
/** 0x10 */ virtual void onDirty();
|
||||
/** 0x14 */ virtual void copyFlagsFromSave() = 0;
|
||||
/** 0x18 */ virtual void setupUnkFlagsStuff() = 0;
|
||||
/** 0x1C */ virtual void 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) const;
|
||||
/** 0x30 */ virtual u16 getUncommittedValue(u16 flag);
|
||||
/** 0x34 */ virtual u16 unk3(u16 arg);
|
||||
/** 0x38 */ virtual const u16 *getSaveFlagSpace() const = 0;
|
||||
|
||||
|
||||
void init();
|
||||
void setFlagSizes(u16 flagSizeMaybe, u16 anotherFlagSizeMaybe);
|
||||
void copyFlagsFromSave_Priv();
|
||||
void setupUnkFlagStuff(UnkFlagDefinition *def, u16 count);
|
||||
void doCommit_Priv();
|
||||
void setOrClearFlag(u16 flag, u16 value);
|
||||
u16 getFlag(u16 flag) const;
|
||||
void FUN_800bf610(u16 flag);
|
||||
u16 FUN_800bf640(u16 flag);
|
||||
void FUN_800bf690();
|
||||
|
||||
u16 getUncommittedValue_Priv(u16 flag);
|
||||
|
||||
protected:
|
||||
/** 0x04 */ u16 flagSizeMaybe;
|
||||
/** 0x06 */ u16 anotherSizeMaybe;
|
||||
/** 0x08 */ FlagSpace *storyFlagsPtr;
|
||||
/** 0x0C */ UnkFlagStuff *unkFlagsPtr;
|
||||
/** 0x10 */ bool dirty;
|
||||
};
|
||||
|
||||
class StoryflagManager : public ItemStoryManagerBase {
|
||||
public:
|
||||
StoryflagManager();
|
||||
|
||||
virtual ~StoryflagManager() {}
|
||||
|
||||
FlagSpace storyFlags;
|
||||
|
||||
bool commit();
|
||||
|
||||
/** 0x0C */ virtual void setFlagszptr() override {
|
||||
storyFlagsPtr = &storyFlags;
|
||||
}
|
||||
/** 0x10 */ virtual void onDirty() override;
|
||||
/** 0x14 */ virtual void copyFlagsFromSave() override;
|
||||
/** 0x18 */ virtual void setupUnkFlagsStuff() override;
|
||||
/** 0x1C */ virtual void doCommit() override {
|
||||
u16 sz = flagSizeMaybe;
|
||||
u16 *flags = storyFlagsPtr->getFlagPtrUnchecked();
|
||||
FileManager::sInstance->setStoryFlags(flags, 0, sz);
|
||||
}
|
||||
/** 0x24 */ virtual void unsetFlag(u16 flag) override;
|
||||
/** 0x38 */ virtual const u16 *getSaveFlagSpace() const override {
|
||||
return FileManager::sInstance->getStoryFlagsConst();
|
||||
};
|
||||
|
||||
public:
|
||||
static StoryflagManager *sInstance;
|
||||
static u16 sFlags[0x80];
|
||||
};
|
||||
|
||||
|
||||
class ItemflagManager : public ItemStoryManagerBase {
|
||||
public:
|
||||
FlagSpace itemFlags;
|
||||
|
||||
ItemflagManager();
|
||||
virtual ~ItemflagManager() {}
|
||||
|
||||
bool commit();
|
||||
|
||||
/** 0x0C */ virtual void setFlagszptr() override {
|
||||
storyFlagsPtr = &itemFlags;
|
||||
}
|
||||
/** 0x10 */ virtual void onDirty() override;
|
||||
/** 0x14 */ virtual void copyFlagsFromSave();
|
||||
/** 0x18 */ virtual void setupUnkFlagsStuff();
|
||||
/** 0x1C */ virtual void doCommit() {
|
||||
u16 sz = flagSizeMaybe;
|
||||
u16 *flags = storyFlagsPtr->getFlagPtrUnchecked();
|
||||
FileManager::sInstance->setItemFlags(flags, 0, sz);
|
||||
}
|
||||
/** 0x20 */ virtual void setFlag(u16 flag) {
|
||||
ItemStoryManagerBase::setFlag(flag & ~0x4000);
|
||||
}
|
||||
/** 0x24 */ virtual void unsetFlag(u16 flag) {
|
||||
ItemStoryManagerBase::unsetFlag(flag & ~0x4000);
|
||||
}
|
||||
/** 0x28 */ virtual void setFlagOrCounterToValue(u16 flag, u16 value) {
|
||||
ItemStoryManagerBase::setFlagOrCounterToValue(flag & ~0x4000, value);
|
||||
}
|
||||
/** 0x2C */ virtual u16 getCounterOrFlag(u16 flag) const {
|
||||
return ItemStoryManagerBase::getCounterOrFlag(flag & ~0x4000);
|
||||
}
|
||||
/** 0x30 */ virtual u16 getUncommittedValue(u16 flag) {
|
||||
return ItemStoryManagerBase::getUncommittedValue(flag & ~0x4000);
|
||||
}
|
||||
/** 0x34 */ virtual u16 unk3(u16 arg) {
|
||||
return ItemStoryManagerBase::unk3(arg & ~0x4000);
|
||||
}
|
||||
/** 0x38 */ virtual const u16 *getSaveFlagSpace() const {
|
||||
return FileManager::sInstance->getItemFlagsConst();
|
||||
};
|
||||
|
||||
u16 getFlagDirect(u16 flag) {
|
||||
return ItemStoryManagerBase::getCounterOrFlag(flag);
|
||||
}
|
||||
|
||||
public:
|
||||
static ItemflagManager *sInstance;
|
||||
static u16 sFlags[0x40];
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -1,87 +0,0 @@
|
||||
#ifndef MISC_FLAG_MANAGERS_H
|
||||
#define MISC_FLAG_MANAGERS_H
|
||||
|
||||
#include "common.h"
|
||||
#include "toBeSorted/bitwise_flag_helper.h"
|
||||
#include "toBeSorted/flag_space.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
|
||||
class CommittableFlagManager {
|
||||
public:
|
||||
bool mNeedsCommit;
|
||||
|
||||
virtual void doCommit() = 0;
|
||||
virtual ~CommittableFlagManager() {}
|
||||
bool commitIfNecessary();
|
||||
void setNeedsCommit(bool commit) {
|
||||
mNeedsCommit = commit;
|
||||
}
|
||||
CommittableFlagManager() {
|
||||
mNeedsCommit = false;
|
||||
}
|
||||
CommittableFlagManager(bool commit) {
|
||||
mNeedsCommit = commit;
|
||||
}
|
||||
};
|
||||
|
||||
class TBoxFlagManager : public CommittableFlagManager {
|
||||
public:
|
||||
FlagSpace mFlagSpace;
|
||||
u16 mSceneIndex;
|
||||
BitwiseFlagHelper mFlagHelper;
|
||||
|
||||
static u16 sTBoxFlags[2];
|
||||
|
||||
static TBoxFlagManager *sInstance;
|
||||
|
||||
virtual void doCommit() override;
|
||||
bool checkUncommittedFlag(u16 flag);
|
||||
TBoxFlagManager();
|
||||
virtual ~TBoxFlagManager() {}
|
||||
void init();
|
||||
void copyFromSave(u32 sceneIndex);
|
||||
bool checkFlag(u16 sceneIndex, u16 flag);
|
||||
virtual u16 getFlagCount() const;
|
||||
void setFlag(u16 flag);
|
||||
bool checkUncommittedFlag(u16 sceneIndex, u16 flag);
|
||||
u16 checkUncommittedFlag2(u16 flag) {
|
||||
return checkUncommittedFlag(flag);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// NOTE: Not actually Enemy Defeat.
|
||||
// This is a little more than that, it keeps track of live objects based on their id as a whole
|
||||
class EnemyDefeatManager : public CommittableFlagManager {
|
||||
public:
|
||||
FlagSpace mFlagSpace;
|
||||
BitwiseFlagHelper mFlagHelper;
|
||||
u16 mSceneIndex;
|
||||
|
||||
static u16 sEnemyDefeatFlags[4096];
|
||||
|
||||
static EnemyDefeatManager *sInstance;
|
||||
|
||||
void clearSavedFlags();
|
||||
bool checkUncommittedFlag(u16 flag);
|
||||
u16 checkUncommittedFlag2(u16 flag) {
|
||||
return checkUncommittedFlag(flag);
|
||||
}
|
||||
EnemyDefeatManager();
|
||||
void init();
|
||||
void copyFromSave(u16 sceneIndex);
|
||||
void updateFlagIndex(u16 sceneIndex);
|
||||
void clearAll();
|
||||
bool checkIsValidFlag(u16 flag);
|
||||
bool checkFlag(u16 flag);
|
||||
virtual ~EnemyDefeatManager() {}
|
||||
virtual u16 getFlagCount() const;
|
||||
void setFlag(u16 flag);
|
||||
|
||||
virtual void doCommit() override {
|
||||
FileManager *mgr = FileManager::sInstance;
|
||||
mgr->setEnemyDefeatFlags(mFlagSpace.getFlagPtrUnchecked(), 0, 0x1000);
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
#include "d/a/obj/d_a_obj_bamboo_island.h"
|
||||
|
||||
#include "d/col/bg/d_bg_s.h"
|
||||
#include "toBeSorted/item_story_flag_manager.h"
|
||||
#include "d/flag/storyflag_manager.h"
|
||||
#include "toBeSorted/room_manager.h"
|
||||
|
||||
const f32 dAcObambooIsland_c::unusedFloat1 = 100000.0f;
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "nw4r/g3d/g3d_resnode.h"
|
||||
#include "nw4r/g3d/g3d_scnmdl.h"
|
||||
#include "nw4r/g3d/g3d_scnobj.h"
|
||||
#include "toBeSorted/item_story_flag_manager.h"
|
||||
#include "d/flag/storyflag_manager.h"
|
||||
#include "toBeSorted/room_manager.h"
|
||||
|
||||
const f32 dAcOislandNusi_c::someFloat = 100000.0f;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "d/a/obj/d_a_obj_junk_repairing.h"
|
||||
|
||||
#include "toBeSorted/item_story_flag_manager.h"
|
||||
#include "d/flag/storyflag_manager.h"
|
||||
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(OBJ_JUNK_REPAIR, dAcOJunkRep_c, fProfile::OBJ_JUNK_REPAIR, 0x027B, 0, 3);
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "d/a/obj/d_a_obj_vortex.h"
|
||||
#include "s/s_Math.h"
|
||||
#include "toBeSorted/room_manager.h"
|
||||
#include "toBeSorted/sceneflag_manager.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(OBJ_POOL_COCK, dAcOPoolCock_c, fProfile::OBJ_POOL_COCK, 0x024D, 0, 7);
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "toBeSorted/attention.h"
|
||||
#include "toBeSorted/event.h"
|
||||
#include "toBeSorted/event_manager.h"
|
||||
#include "toBeSorted/item_story_flag_manager.h"
|
||||
#include "d/flag/storyflag_manager.h"
|
||||
#include "toBeSorted/scgame.h"
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "d/col/bg/d_bg_s.h"
|
||||
#include "d/col/c/c_m3d_g_aab.h"
|
||||
#include "toBeSorted/item_story_flag_manager.h"
|
||||
#include "d/flag/storyflag_manager.h"
|
||||
#include "toBeSorted/room_manager.h"
|
||||
|
||||
static const char *const mMdlNames[] = {
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "d/t/d_t_dowsing.h"
|
||||
|
||||
#include "toBeSorted/item_story_flag_manager.h"
|
||||
#include "toBeSorted/room_manager.h"
|
||||
#include "toBeSorted/sceneflag_manager.h"
|
||||
#include "d/flag/itemflag_manager.h"
|
||||
#include "d/flag/storyflag_manager.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(T_DOWSING, dTgDowsing_c, fProfile::T_DOWSING, 0x0293, 0, 0);
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "d/t/d_t_genki_dws_tgt.h"
|
||||
|
||||
#include "toBeSorted/item_story_flag_manager.h"
|
||||
#include "toBeSorted/room_manager.h"
|
||||
#include "toBeSorted/sceneflag_manager.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
#include "d/flag/storyflag_manager.h"
|
||||
#include "toBeSorted/scgame.h"
|
||||
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "d/a/d_a_player.h"
|
||||
#include "d/a/obj/d_a_obj_item.h"
|
||||
#include "d/col/cc/d_cc_mgr.h"
|
||||
#include "toBeSorted/sceneflag_manager.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(TAG_REACTION, dTgReaction_c, fProfile::TAG_REACTION, 0x0151, 0, 0);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "d/t/d_t_ship_window.h"
|
||||
|
||||
#include "toBeSorted/event_manager.h"
|
||||
#include "toBeSorted/sceneflag_manager.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(TAG_SHIP_WINDOW, dTgShipWindow_c, fProfile::TAG_SHIP_WINDOW, 0x0228, 0, 0);
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "d/t/d_t_sw_area.h"
|
||||
#include "d/a/d_a_player.h"
|
||||
#include "toBeSorted/area_math.h"
|
||||
#include "toBeSorted/sceneflag_manager.h"
|
||||
#include "toBeSorted/item_story_flag_manager.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
#include "d/flag/storyflag_manager.h"
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(SW_AREA_TAG, dTgSwArea_c, fProfile::SW_AREA_TAG, 0x292, 0, 0);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "d/t/d_t_time_area_check.h"
|
||||
|
||||
#include "toBeSorted/sceneflag_manager.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
#include "toBeSorted/time_area_mgr.h"
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "d/t/d_t_timer.h"
|
||||
|
||||
#include "toBeSorted/sceneflag_manager.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(TAG_TIMER, dTgTimer_c, fProfile::TAG_TIMER, 0x029F, 0, 0);
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "c/c_math.h"
|
||||
#include "toBeSorted/area_math.h"
|
||||
#include "toBeSorted/sceneflag_manager.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(TOUCH_TAG, dTgTouchTag, fProfile::TOUCH_TAG, 0x028E, 0, 0);
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "toBeSorted/event.h"
|
||||
#include "toBeSorted/event_manager.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
#include "toBeSorted/misc_flag_managers.h"
|
||||
#include "d/flag/enemyflag_manager.h"
|
||||
#include "toBeSorted/room_manager.h"
|
||||
#include "toBeSorted/scgame.h"
|
||||
#include "toBeSorted/special_item_drop_mgr.h"
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "d/col/bg/d_bg_w.h"
|
||||
#include "nw4r/g3d/g3d_resfile.h"
|
||||
#include "s/s_Math.h"
|
||||
#include "toBeSorted/sceneflag_manager.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(OBJ_SW, dAcOsw_c, fProfile::OBJ_SW, 0x12B, 0, 0x1002);
|
||||
|
||||
|
118
src/d/flag/baseflag_manager.inc
Normal file
118
src/d/flag/baseflag_manager.inc
Normal file
@ -0,0 +1,118 @@
|
||||
#include "d/flag/baseflag_manager.h"
|
||||
|
||||
ItemStoryManagerBase::ItemStoryManagerBase(): flagSizeMaybe(0), anotherSizeMaybe(0), storyFlagsPtr(nullptr), unkFlagsPtr(nullptr), dirty(false) {}
|
||||
ItemStoryManagerBase::~ItemStoryManagerBase() {
|
||||
if (unkFlagsPtr != nullptr) {
|
||||
delete unkFlagsPtr;
|
||||
}
|
||||
}
|
||||
|
||||
void ItemStoryManagerBase::setFlagSizes(u16 flagSizeMaybe, u16 anotherFlagSizeMaybe) {
|
||||
this->flagSizeMaybe = flagSizeMaybe;
|
||||
this->anotherSizeMaybe = anotherFlagSizeMaybe;
|
||||
}
|
||||
|
||||
/** 800bf320 */
|
||||
void ItemStoryManagerBase::setupUnkFlagStuff(UnkFlagDefinition *def, u16 count) {
|
||||
UnkFlagStuff *stuff = new UnkFlagStuff(count, def);
|
||||
this->unkFlagsPtr = stuff;
|
||||
}
|
||||
|
||||
/** 800bf380 */
|
||||
void ItemStoryManagerBase::copyFlagsFromSave_Priv() {
|
||||
FlagSpace *current = this->storyFlagsPtr;
|
||||
const u16 *saved = this->getSaveFlagSpace();
|
||||
current->copyFromSaveFile(saved, 0, this->flagSizeMaybe);
|
||||
}
|
||||
|
||||
/** 800bf3e0 */
|
||||
void ItemStoryManagerBase::init() {
|
||||
const u16 *space = this->getSaveFlagSpace();
|
||||
if (space == nullptr || this->unkFlagsPtr == nullptr) {
|
||||
this->setFlagszptr();
|
||||
this->copyFlagsFromSave();
|
||||
this->setupUnkFlagsStuff();
|
||||
}
|
||||
}
|
||||
|
||||
/** 800bf470 */
|
||||
void ItemStoryManagerBase::setFlagszptr() {
|
||||
|
||||
}
|
||||
|
||||
/** 800bf480 */
|
||||
u16 ItemStoryManagerBase::getFlag(u16 flag) const {
|
||||
const u16 *data = this->getSaveFlagSpace();
|
||||
return this->unkFlagsPtr->getCounterOrFlag(flag, data, this->flagSizeMaybe);
|
||||
}
|
||||
|
||||
/** 800bf4e0 */
|
||||
u16 ItemStoryManagerBase::getUncommittedValue_Priv(u16 flag) {
|
||||
u16 *data = this->storyFlagsPtr->getFlagPtrUnchecked();
|
||||
return this->unkFlagsPtr->getCounterOrFlag(flag, data, this->flagSizeMaybe);
|
||||
}
|
||||
|
||||
/** 800bf530 */
|
||||
void ItemStoryManagerBase::setOrClearFlag(u16 flag, u16 value) {
|
||||
FlagSpace *storyFlagsPtr = this->storyFlagsPtr;
|
||||
u16 *pData = storyFlagsPtr->getFlagPtrChecked();
|
||||
this->unkFlagsPtr->setCounterOrFlag(flag, pData, storyFlagsPtr->mCount, value);
|
||||
this->FUN_800bf610(flag);
|
||||
}
|
||||
|
||||
/** 800bf5b0 */
|
||||
void ItemStoryManagerBase::setFlag(u16 flag) {
|
||||
this->setOrClearFlag(flag, true);
|
||||
}
|
||||
|
||||
/** 800bf5c0 */
|
||||
void ItemStoryManagerBase::unsetFlag(u16 flag) {
|
||||
this->setOrClearFlag(flag, false);
|
||||
}
|
||||
|
||||
/** 800bf5d0 */
|
||||
void ItemStoryManagerBase::setFlagOrCounterToValue(u16 flag, u16 value) {
|
||||
this->setOrClearFlag(flag, value);
|
||||
}
|
||||
|
||||
/** 800bf5e0 */
|
||||
u16 ItemStoryManagerBase::getCounterOrFlag(u16 flag) const {
|
||||
return ItemStoryManagerBase::getFlag(flag);
|
||||
}
|
||||
|
||||
/** 800bf5f0 */
|
||||
u16 ItemStoryManagerBase::getUncommittedValue(u16 flag) {
|
||||
return this->getUncommittedValue_Priv(flag);
|
||||
}
|
||||
|
||||
/** 800bf600 */
|
||||
u16 ItemStoryManagerBase::unk3(u16 flag) {
|
||||
return this->FUN_800bf640(flag);
|
||||
}
|
||||
|
||||
/** 800bf610 */
|
||||
void ItemStoryManagerBase::FUN_800bf610(u16 flag) {
|
||||
this->dirty = true;
|
||||
this->onDirty();
|
||||
}
|
||||
|
||||
/** 800bf630 */
|
||||
void ItemStoryManagerBase::onDirty() {
|
||||
|
||||
}
|
||||
|
||||
/** 800bf640 */
|
||||
u16 ItemStoryManagerBase::FUN_800bf640(u16 flag) {
|
||||
return this->unkFlagsPtr->maskForIdx(flag, this->flagSizeMaybe);
|
||||
}
|
||||
|
||||
/** 800bf650 */
|
||||
void ItemStoryManagerBase::doCommit_Priv() {
|
||||
this->doCommit();
|
||||
this->dirty = false;
|
||||
}
|
||||
|
||||
/* 800bf690 */
|
||||
void ItemStoryManagerBase::FUN_800bf690() {
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
#include "toBeSorted/bitwise_flag_helper.h"
|
||||
#include "d/flag/bitwise_flag_helper.h"
|
||||
|
||||
#include "common.h"
|
||||
|
12
src/d/flag/committable_flag_manager.inc
Normal file
12
src/d/flag/committable_flag_manager.inc
Normal file
@ -0,0 +1,12 @@
|
||||
#include "d/flag/committable_flag_manager.h"
|
||||
|
||||
/* 0x800BE7B0 */
|
||||
bool CommittableFlagManager::commitIfNecessary() {
|
||||
if (mNeedsCommit) {
|
||||
doCommit();
|
||||
mNeedsCommit = false;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,8 +1,6 @@
|
||||
#include "libc.h"
|
||||
#include "toBeSorted/bitwise_flag_helper.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
#include "toBeSorted/flag_space.h"
|
||||
#include "toBeSorted/unk_flag_stuff.h"
|
||||
#include "d/flag/flag_space.h"
|
||||
#include "d/flag/unk_flag_stuff.h"
|
||||
|
||||
|
||||
// TODO move
|
@ -1,74 +1,4 @@
|
||||
#include "toBeSorted/misc_flag_managers.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "libc.h"
|
||||
#include "toBeSorted/bitwise_flag_helper.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
#include "toBeSorted/flag_space.h"
|
||||
|
||||
|
||||
/* 0x800BE7B0 */
|
||||
bool CommittableFlagManager::commitIfNecessary() {
|
||||
if (mNeedsCommit) {
|
||||
doCommit();
|
||||
mNeedsCommit = false;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
TBoxFlagManager *TBoxFlagManager::sInstance = nullptr;
|
||||
u16 TBoxFlagManager::sTBoxFlags[2] = {};
|
||||
|
||||
/* 0x800BE810 */
|
||||
void TBoxFlagManager::doCommit() {
|
||||
if (mSceneIndex != 0xFFFF) {
|
||||
FileManager::getInstance()->setTBoxFlags(mFlagSpace.getFlagPtrUnchecked(), mSceneIndex * 2, 2);
|
||||
}
|
||||
}
|
||||
|
||||
/* 0x800BE870 */
|
||||
bool TBoxFlagManager::checkUncommittedFlag(u16 flag) {
|
||||
return mFlagHelper.checkFlag(flag / 16, flag % 16, mFlagSpace.getFlagPtrUnchecked(), mFlagSpace.mCount);
|
||||
}
|
||||
|
||||
/* 0x800BE8E0 */
|
||||
TBoxFlagManager::TBoxFlagManager() : CommittableFlagManager(false), mFlagSpace(sTBoxFlags, ARRAY_LENGTH(sTBoxFlags)) {
|
||||
mSceneIndex = 0xFFFF;
|
||||
}
|
||||
|
||||
/* 0x800BE920 */
|
||||
void TBoxFlagManager::init() {}
|
||||
|
||||
/* 0x800BE930 */
|
||||
void TBoxFlagManager::copyFromSave(u32 sceneIndex) {
|
||||
u16 idx = sceneIndex;
|
||||
mSceneIndex = idx;
|
||||
u16 *flags = FileManager::getInstance()->getTBoxFlagsConst();
|
||||
mFlagSpace.copyFromSaveFile2(flags + (idx * 2), 0, 2);
|
||||
}
|
||||
|
||||
/* 0x800BE990 */
|
||||
bool TBoxFlagManager::checkFlag(u16 sceneIndex, u16 flag) {
|
||||
s32 actualFlag = (flag + sceneIndex * 0x20);
|
||||
return mFlagHelper.checkFlag(
|
||||
actualFlag / 16, flag % 16, FileManager::getInstance()->getTBoxFlagsConst(), getFlagCount()
|
||||
);
|
||||
}
|
||||
|
||||
/* 0x800BEA30 */
|
||||
u16 TBoxFlagManager::getFlagCount() const {
|
||||
return 0x200;
|
||||
}
|
||||
|
||||
/* 0x800BEA40 */
|
||||
void TBoxFlagManager::setFlag(u16 flag) {
|
||||
if (checkUncommittedFlag2(flag) != 1) {
|
||||
mFlagHelper.setFlag(flag / 16, flag % 16, mFlagSpace.getFlagPtrChecked(), mFlagSpace.mCount);
|
||||
setNeedsCommit(true);
|
||||
}
|
||||
}
|
||||
#include "d/flag/enemyflag_manager.h"
|
||||
|
||||
EnemyDefeatManager *EnemyDefeatManager::sInstance = nullptr;
|
||||
u16 EnemyDefeatManager::sEnemyDefeatFlags[4096] = {};
|
125
src/d/flag/flag_managers.cpp
Normal file
125
src/d/flag/flag_managers.cpp
Normal file
@ -0,0 +1,125 @@
|
||||
|
||||
#include "d/flag/flag_managers.h"
|
||||
|
||||
// clang-format off
|
||||
#include "common.h"
|
||||
#include "egg/core/eggHeap.h"
|
||||
#include "m/m_heap.h"
|
||||
// vtable order
|
||||
#include "d/flag/flag_space.h"
|
||||
#include "d/flag/tboxflag_manager.h"
|
||||
#include "d/flag/enemyflag_manager.h"
|
||||
#include "d/flag/storyflag_manager.h"
|
||||
#include "d/flag/itemflag_manager.h"
|
||||
// clang-format on
|
||||
|
||||
#include "d/flag/sceneflag_manager.inc"
|
||||
#include "d/flag/committable_flag_manager.inc"
|
||||
#include "d/flag/tboxflag_manager.inc"
|
||||
#include "d/flag/enemyflag_manager.inc"
|
||||
#include "d/flag/flag_space.inc"
|
||||
#include "d/flag/unk_flag_stuff.inc"
|
||||
#include "d/flag/bitwise_flag_helper.inc"
|
||||
|
||||
#include "d/flag/baseflag_manager.inc"
|
||||
#include "d/flag/storyflag_manager.inc"
|
||||
#include "d/flag/itemflag_manager.inc"
|
||||
#include "d/flag/dungeonflag_manager.inc"
|
||||
#include "d/flag/skipflag_manager.inc"
|
||||
|
||||
|
||||
static void postSetup();
|
||||
|
||||
template <typename T>
|
||||
class MyFlagManager : public T {
|
||||
public:
|
||||
MyFlagManager<T>() {}
|
||||
~MyFlagManager<T>() {}
|
||||
};
|
||||
|
||||
void setupFlagManagers(EGG::Heap *heap) {
|
||||
if (SceneflagManager::sInstance == nullptr) {
|
||||
SceneflagManager::sInstance = new (heap) MyFlagManager<SceneflagManager>();
|
||||
mHeap m(heap);
|
||||
SceneflagManager::sInstance->init();
|
||||
}
|
||||
|
||||
if (TBoxFlagManager::sInstance == nullptr) {
|
||||
TBoxFlagManager::sInstance = new (heap) MyFlagManager<TBoxFlagManager>();
|
||||
mHeap m(heap);
|
||||
TBoxFlagManager::sInstance->init();
|
||||
}
|
||||
|
||||
if (EnemyDefeatManager::sInstance == nullptr) {
|
||||
EnemyDefeatManager::sInstance = new (heap) MyFlagManager<EnemyDefeatManager>();
|
||||
mHeap m(heap);
|
||||
EnemyDefeatManager::sInstance->init();
|
||||
}
|
||||
|
||||
if (StoryflagManager::sInstance == nullptr) {
|
||||
StoryflagManager::sInstance = new (heap) MyFlagManager<StoryflagManager>();
|
||||
mHeap m(heap);
|
||||
StoryflagManager::sInstance->init();
|
||||
}
|
||||
|
||||
if (ItemflagManager::sInstance == nullptr) {
|
||||
ItemflagManager::sInstance = new (heap) MyFlagManager<ItemflagManager>();
|
||||
mHeap m(heap);
|
||||
ItemflagManager::sInstance->init();
|
||||
}
|
||||
|
||||
if (DungeonflagManager::sInstance == nullptr) {
|
||||
DungeonflagManager::sInstance = new (heap) MyFlagManager<DungeonflagManager>();
|
||||
mHeap m(heap);
|
||||
DungeonflagManager::sInstance->init();
|
||||
}
|
||||
|
||||
if (SkipflagManager::sInstance == nullptr) {
|
||||
SkipflagManager::sInstance = new (heap) MyFlagManager<SkipflagManager>();
|
||||
mHeap m(heap);
|
||||
SkipflagManager::sInstance->init();
|
||||
}
|
||||
|
||||
postSetup();
|
||||
}
|
||||
|
||||
static void postSetup() {
|
||||
updateFlagForFlagIndex(0);
|
||||
}
|
||||
|
||||
void copyAllFlagManagersFromSave() {
|
||||
u16 flag = FileManager::sInstance->getSceneFlagIndex();
|
||||
SceneflagManager::sInstance->copyFromSave(flag);
|
||||
TBoxFlagManager::sInstance->copyFromSave(flag);
|
||||
StoryflagManager::sInstance->copyFlagsFromSave_Priv();
|
||||
ItemflagManager::sInstance->copyFlagsFromSave_Priv();
|
||||
DungeonflagManager::sInstance->copyFromSave(flag);
|
||||
SkipflagManager::sInstance->thunk_copyFromSave();
|
||||
EnemyDefeatManager::sInstance->copyFromSave(flag);
|
||||
}
|
||||
|
||||
void updateFlagForFlagIndex(u16 stage) {
|
||||
SceneflagManager::sInstance->updateFlagindex(stage);
|
||||
TBoxFlagManager::sInstance->copyFromSave(stage);
|
||||
EnemyDefeatManager::sInstance->updateFlagIndex(stage);
|
||||
DungeonflagManager::sInstance->copyFromSave(stage);
|
||||
}
|
||||
|
||||
void commitAllFlagManagers() {
|
||||
StoryflagManager::sInstance->commit();
|
||||
ItemflagManager::sInstance->commit();
|
||||
DungeonflagManager::sInstance->doCommit();
|
||||
SkipflagManager::sInstance->commitFlags();
|
||||
SceneflagManager::sInstance->doCommit();
|
||||
TBoxFlagManager::sInstance->commitIfNecessary();
|
||||
EnemyDefeatManager::sInstance->commitIfNecessary();
|
||||
}
|
||||
|
||||
bool checkedMemcpy(void *dest, u32 destLen, const void *src, u32 count) {
|
||||
if (dest == nullptr || src == nullptr || destLen < count || destLen > 0xFFFF) {
|
||||
return true;
|
||||
} else {
|
||||
memcpy(dest, src, count);
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
#include "d/flag/flag_managers.h"
|
||||
#include "toBeSorted/flag_space.h"
|
||||
#include "d/flag/flag_space.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
#include "common.h"
|
||||
|
29
src/d/flag/itemflag_manager.inc
Normal file
29
src/d/flag/itemflag_manager.inc
Normal file
@ -0,0 +1,29 @@
|
||||
#include "d/flag/itemflag_manager.h"
|
||||
|
||||
u16 ItemflagManager::sFlags[0x40];
|
||||
|
||||
ItemflagManager *ItemflagManager::sInstance = nullptr;
|
||||
|
||||
ItemflagManager::ItemflagManager() : itemFlags(sFlags, 0x40) {}
|
||||
|
||||
void ItemflagManager::copyFlagsFromSave() {
|
||||
setFlagSizes(0x40, 0x80);
|
||||
copyFlagsFromSave_Priv();
|
||||
}
|
||||
|
||||
extern "C" UnkFlagDefinition ItemflagManager__ITEMFLAG_DEFINITIONS[];
|
||||
|
||||
void ItemflagManager::setupUnkFlagsStuff() {
|
||||
setupUnkFlagStuff(ItemflagManager__ITEMFLAG_DEFINITIONS, 0x1FE);
|
||||
}
|
||||
|
||||
void ItemflagManager::onDirty() {}
|
||||
|
||||
bool ItemflagManager::commit() {
|
||||
if (dirty) {
|
||||
doCommit_Priv();
|
||||
FUN_800bf690();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
#include "toBeSorted/sceneflag_manager.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "libc.h"
|
@ -1,27 +1,9 @@
|
||||
#include "common.h"
|
||||
#include "d/flag/flag_managers.h"
|
||||
#include "toBeSorted/bitwise_flag_helper.h"
|
||||
#include "d/flag/skipflag_manager.h"
|
||||
#include "d/flag/bitwise_flag_helper.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
#include "toBeSorted/flag_space.h"
|
||||
|
||||
class SkipflagManager {
|
||||
public:
|
||||
bool mShouldCommit;
|
||||
BitwiseFlagHelper mFlagHelper;
|
||||
FlagSpace mFlagSpace;
|
||||
|
||||
static u16 sSkipFlags[16];
|
||||
static SkipflagManager *sInstance;
|
||||
|
||||
void copyFromSave();
|
||||
void setCommitFlag(u16 flag);
|
||||
SkipflagManager();
|
||||
void init();
|
||||
void thunk_copyFromSave();
|
||||
void setFlag(u16 flag);
|
||||
bool checkFlag(u16 flag);
|
||||
bool commitFlags();
|
||||
};
|
||||
#include "d/flag/flag_space.h"
|
||||
|
||||
// 0x80575408
|
||||
SkipflagManager *SkipflagManager::sInstance = nullptr;
|
36
src/d/flag/storyflag_manager.inc
Normal file
36
src/d/flag/storyflag_manager.inc
Normal file
@ -0,0 +1,36 @@
|
||||
#include "d/flag/storyflag_manager.h"
|
||||
|
||||
u16 StoryflagManager::sFlags[0x80];
|
||||
StoryflagManager *StoryflagManager::sInstance = nullptr;
|
||||
|
||||
StoryflagManager::StoryflagManager() : storyFlags(sFlags, 0x80) {
|
||||
|
||||
}
|
||||
|
||||
void StoryflagManager::copyFlagsFromSave() {
|
||||
setFlagSizes(0x80, 0x100);
|
||||
copyFlagsFromSave_Priv();
|
||||
}
|
||||
|
||||
extern "C" UnkFlagDefinition StoryflagManager__STORYFLAG_DEFINITIONS[];
|
||||
|
||||
void StoryflagManager::setupUnkFlagsStuff() {
|
||||
setupUnkFlagStuff(StoryflagManager__STORYFLAG_DEFINITIONS, 0x4B1);
|
||||
}
|
||||
|
||||
void StoryflagManager::onDirty() {
|
||||
|
||||
}
|
||||
|
||||
bool StoryflagManager::commit() {
|
||||
if (dirty) {
|
||||
doCommit_Priv();
|
||||
FUN_800bf690();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void StoryflagManager::unsetFlag(u16 flag) {
|
||||
ItemStoryManagerBase::unsetFlag(flag);
|
||||
}
|
54
src/d/flag/tboxflag_manager.inc
Normal file
54
src/d/flag/tboxflag_manager.inc
Normal file
@ -0,0 +1,54 @@
|
||||
#include "d/flag/tboxflag_manager.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
|
||||
TBoxFlagManager *TBoxFlagManager::sInstance = nullptr;
|
||||
u16 TBoxFlagManager::sTBoxFlags[2] = {};
|
||||
|
||||
/* 0x800BE810 */
|
||||
void TBoxFlagManager::doCommit() {
|
||||
if (mSceneIndex != 0xFFFF) {
|
||||
FileManager::getInstance()->setTBoxFlags(mFlagSpace.getFlagPtrUnchecked(), mSceneIndex * 2, 2);
|
||||
}
|
||||
}
|
||||
|
||||
/* 0x800BE870 */
|
||||
bool TBoxFlagManager::checkUncommittedFlag(u16 flag) {
|
||||
return mFlagHelper.checkFlag(flag / 16, flag % 16, mFlagSpace.getFlagPtrUnchecked(), mFlagSpace.mCount);
|
||||
}
|
||||
|
||||
/* 0x800BE8E0 */
|
||||
TBoxFlagManager::TBoxFlagManager() : CommittableFlagManager(false), mFlagSpace(sTBoxFlags, ARRAY_LENGTH(sTBoxFlags)) {
|
||||
mSceneIndex = 0xFFFF;
|
||||
}
|
||||
|
||||
/* 0x800BE920 */
|
||||
void TBoxFlagManager::init() {}
|
||||
|
||||
/* 0x800BE930 */
|
||||
void TBoxFlagManager::copyFromSave(u32 sceneIndex) {
|
||||
u16 idx = sceneIndex;
|
||||
mSceneIndex = idx;
|
||||
u16 *flags = FileManager::getInstance()->getTBoxFlagsConst();
|
||||
mFlagSpace.copyFromSaveFile2(flags + (idx * 2), 0, 2);
|
||||
}
|
||||
|
||||
/* 0x800BE990 */
|
||||
bool TBoxFlagManager::checkFlag(u16 sceneIndex, u16 flag) {
|
||||
s32 actualFlag = (flag + sceneIndex * 0x20);
|
||||
return mFlagHelper.checkFlag(
|
||||
actualFlag / 16, flag % 16, FileManager::getInstance()->getTBoxFlagsConst(), getFlagCount()
|
||||
);
|
||||
}
|
||||
|
||||
/* 0x800BEA30 */
|
||||
u16 TBoxFlagManager::getFlagCount() const {
|
||||
return 0x200;
|
||||
}
|
||||
|
||||
/* 0x800BEA40 */
|
||||
void TBoxFlagManager::setFlag(u16 flag) {
|
||||
if (checkUncommittedFlag2(flag) != 1) {
|
||||
mFlagHelper.setFlag(flag / 16, flag % 16, mFlagSpace.getFlagPtrChecked(), mFlagSpace.mCount);
|
||||
setNeedsCommit(true);
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
#include "toBeSorted/unk_flag_stuff.h"
|
||||
#include "d/flag/unk_flag_stuff.h"
|
||||
|
||||
u16 UnkFlagStuff::calculateMask(s32 shift) {
|
||||
return (2 << (shift & 0xF)) - 1;
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "c/c_math.h"
|
||||
#include "toBeSorted/event.h"
|
||||
#include "toBeSorted/sceneflag_manager.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
#include "toBeSorted/scgame.h"
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "toBeSorted/counters/counter.h"
|
||||
|
||||
#include "toBeSorted/item_story_flag_manager.h"
|
||||
#include "d/flag/itemflag_manager.h"
|
||||
|
||||
/* 8016cc40 */ s32 Counter::checkedAdd(s32 num) {
|
||||
s32 uncommitted = getUncommittedValue();
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "toBeSorted/counters/counter.h"
|
||||
#include "toBeSorted/item_story_flag_manager.h"
|
||||
#include "d/flag/itemflag_manager.h"
|
||||
|
||||
static u16 getBaseCapacity();
|
||||
static u16 getExtraWalletCapacity();
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
#include "c/c_math.h"
|
||||
#include "m/m_mtx.h"
|
||||
#include "nw4r/ut/ut_LinkList.h"
|
||||
#include "toBeSorted/item_story_flag_manager.h"
|
||||
#include "d/flag/itemflag_manager.h"
|
||||
#include "d/flag/storyflag_manager.h"
|
||||
#include "toBeSorted/tlist.h"
|
||||
|
||||
|
||||
|
@ -1,302 +0,0 @@
|
||||
// clang-format off
|
||||
|
||||
#include "d/flag/flag_managers.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "toBeSorted/sceneflag_manager.h"
|
||||
#include <toBeSorted/flag_space.h>
|
||||
#include <toBeSorted/misc_flag_managers.h>
|
||||
#include <toBeSorted/item_story_flag_manager.h>
|
||||
|
||||
#include <toBeSorted/flag_managers/sceneflag_manager.inc>
|
||||
#include <toBeSorted/item_story_flag_manager.h>
|
||||
#include <toBeSorted/flag_managers/misc_flag_managers.inc>
|
||||
#include <toBeSorted/flag_managers/flag_space.inc>
|
||||
#include <toBeSorted/flag_managers/unk_flag_stuff.inc>
|
||||
#include <toBeSorted/flag_managers/bitwise_flag_helper.inc>
|
||||
|
||||
u16 StoryflagManager::sFlags[0x80];
|
||||
u16 ItemflagManager::sFlags[0x40];
|
||||
|
||||
|
||||
StoryflagManager *StoryflagManager::sInstance = nullptr;
|
||||
ItemflagManager *ItemflagManager::sInstance = nullptr;
|
||||
|
||||
ItemStoryManagerBase::ItemStoryManagerBase(): flagSizeMaybe(0), anotherSizeMaybe(0), storyFlagsPtr(nullptr), unkFlagsPtr(nullptr), dirty(false) {}
|
||||
ItemStoryManagerBase::~ItemStoryManagerBase() {
|
||||
if (unkFlagsPtr != nullptr) {
|
||||
delete unkFlagsPtr;
|
||||
}
|
||||
}
|
||||
|
||||
void ItemStoryManagerBase::setFlagSizes(u16 flagSizeMaybe, u16 anotherFlagSizeMaybe) {
|
||||
this->flagSizeMaybe = flagSizeMaybe;
|
||||
this->anotherSizeMaybe = anotherFlagSizeMaybe;
|
||||
}
|
||||
|
||||
/** 800bf320 */
|
||||
void ItemStoryManagerBase::setupUnkFlagStuff(UnkFlagDefinition *def, u16 count) {
|
||||
UnkFlagStuff *stuff = new UnkFlagStuff(count, def);
|
||||
this->unkFlagsPtr = stuff;
|
||||
}
|
||||
|
||||
/** 800bf380 */
|
||||
void ItemStoryManagerBase::copyFlagsFromSave_Priv() {
|
||||
FlagSpace *current = this->storyFlagsPtr;
|
||||
const u16 *saved = this->getSaveFlagSpace();
|
||||
current->copyFromSaveFile(saved, 0, this->flagSizeMaybe);
|
||||
}
|
||||
|
||||
/** 800bf3e0 */
|
||||
void ItemStoryManagerBase::init() {
|
||||
const u16 *space = this->getSaveFlagSpace();
|
||||
if (space == nullptr || this->unkFlagsPtr == nullptr) {
|
||||
this->setFlagszptr();
|
||||
this->copyFlagsFromSave();
|
||||
this->setupUnkFlagsStuff();
|
||||
}
|
||||
}
|
||||
|
||||
/** 800bf470 */
|
||||
void ItemStoryManagerBase::setFlagszptr() {
|
||||
|
||||
}
|
||||
|
||||
/** 800bf480 */
|
||||
u16 ItemStoryManagerBase::getFlag(u16 flag) const {
|
||||
const u16 *data = this->getSaveFlagSpace();
|
||||
return this->unkFlagsPtr->getCounterOrFlag(flag, data, this->flagSizeMaybe);
|
||||
}
|
||||
|
||||
/** 800bf4e0 */
|
||||
u16 ItemStoryManagerBase::getUncommittedValue_Priv(u16 flag) {
|
||||
u16 *data = this->storyFlagsPtr->getFlagPtrUnchecked();
|
||||
return this->unkFlagsPtr->getCounterOrFlag(flag, data, this->flagSizeMaybe);
|
||||
}
|
||||
|
||||
/** 800bf530 */
|
||||
void ItemStoryManagerBase::setOrClearFlag(u16 flag, u16 value) {
|
||||
FlagSpace *storyFlagsPtr = this->storyFlagsPtr;
|
||||
u16 *pData = storyFlagsPtr->getFlagPtrChecked();
|
||||
this->unkFlagsPtr->setCounterOrFlag(flag, pData, storyFlagsPtr->mCount, value);
|
||||
this->FUN_800bf610(flag);
|
||||
}
|
||||
|
||||
/** 800bf5b0 */
|
||||
void ItemStoryManagerBase::setFlag(u16 flag) {
|
||||
this->setOrClearFlag(flag, true);
|
||||
}
|
||||
|
||||
/** 800bf5c0 */
|
||||
void ItemStoryManagerBase::unsetFlag(u16 flag) {
|
||||
this->setOrClearFlag(flag, false);
|
||||
}
|
||||
|
||||
/** 800bf5d0 */
|
||||
void ItemStoryManagerBase::setFlagOrCounterToValue(u16 flag, u16 value) {
|
||||
this->setOrClearFlag(flag, value);
|
||||
}
|
||||
|
||||
/** 800bf5e0 */
|
||||
u16 ItemStoryManagerBase::getCounterOrFlag(u16 flag) const {
|
||||
return ItemStoryManagerBase::getFlag(flag);
|
||||
}
|
||||
|
||||
/** 800bf5f0 */
|
||||
u16 ItemStoryManagerBase::getUncommittedValue(u16 flag) {
|
||||
return this->getUncommittedValue_Priv(flag);
|
||||
}
|
||||
|
||||
/** 800bf600 */
|
||||
u16 ItemStoryManagerBase::unk3(u16 flag) {
|
||||
return this->FUN_800bf640(flag);
|
||||
}
|
||||
|
||||
/** 800bf610 */
|
||||
void ItemStoryManagerBase::FUN_800bf610(u16 flag) {
|
||||
this->dirty = true;
|
||||
this->onDirty();
|
||||
}
|
||||
|
||||
/** 800bf630 */
|
||||
void ItemStoryManagerBase::onDirty() {
|
||||
|
||||
}
|
||||
|
||||
/** 800bf640 */
|
||||
u16 ItemStoryManagerBase::FUN_800bf640(u16 flag) {
|
||||
return this->unkFlagsPtr->maskForIdx(flag, this->flagSizeMaybe);
|
||||
}
|
||||
|
||||
/** 800bf650 */
|
||||
void ItemStoryManagerBase::doCommit_Priv() {
|
||||
this->doCommit();
|
||||
this->dirty = false;
|
||||
}
|
||||
|
||||
/* 800bf690 */
|
||||
void ItemStoryManagerBase::FUN_800bf690() {
|
||||
|
||||
}
|
||||
|
||||
StoryflagManager::StoryflagManager() : storyFlags(sFlags, 0x80) {
|
||||
|
||||
}
|
||||
|
||||
void StoryflagManager::copyFlagsFromSave() {
|
||||
setFlagSizes(0x80, 0x100);
|
||||
copyFlagsFromSave_Priv();
|
||||
}
|
||||
|
||||
extern "C" UnkFlagDefinition StoryflagManager__STORYFLAG_DEFINITIONS[];
|
||||
|
||||
void StoryflagManager::setupUnkFlagsStuff() {
|
||||
setupUnkFlagStuff(StoryflagManager__STORYFLAG_DEFINITIONS, 0x4B1);
|
||||
}
|
||||
|
||||
void StoryflagManager::onDirty() {
|
||||
|
||||
}
|
||||
|
||||
bool StoryflagManager::commit() {
|
||||
if (dirty) {
|
||||
doCommit_Priv();
|
||||
FUN_800bf690();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void StoryflagManager::unsetFlag(u16 flag) {
|
||||
ItemStoryManagerBase::unsetFlag(flag);
|
||||
}
|
||||
|
||||
ItemflagManager::ItemflagManager() : itemFlags(sFlags, 0x40) {}
|
||||
|
||||
void ItemflagManager::copyFlagsFromSave() {
|
||||
setFlagSizes(0x40, 0x80);
|
||||
copyFlagsFromSave_Priv();
|
||||
}
|
||||
|
||||
extern "C" UnkFlagDefinition ItemflagManager__ITEMFLAG_DEFINITIONS[];
|
||||
|
||||
void ItemflagManager::setupUnkFlagsStuff() {
|
||||
setupUnkFlagStuff(ItemflagManager__ITEMFLAG_DEFINITIONS, 0x1FE);
|
||||
}
|
||||
|
||||
void ItemflagManager::onDirty() {
|
||||
|
||||
}
|
||||
|
||||
bool ItemflagManager::commit() {
|
||||
if (dirty) {
|
||||
doCommit_Priv();
|
||||
FUN_800bf690();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#include <toBeSorted/flag_managers/dungeonflag_manager.inc>
|
||||
#include <toBeSorted/flag_managers/skipflag_manager.inc>
|
||||
// clang-format on
|
||||
|
||||
#include <egg/core/eggHeap.h>
|
||||
#include <m/m_heap.h>
|
||||
|
||||
static void postSetup();
|
||||
|
||||
template <typename T>
|
||||
class MyFlagManager : public T {
|
||||
public:
|
||||
MyFlagManager<T>() {
|
||||
}
|
||||
~MyFlagManager<T>() {}
|
||||
};
|
||||
|
||||
void setupFlagManagers(EGG::Heap *heap) {
|
||||
if (SceneflagManager::sInstance == nullptr) {
|
||||
SceneflagManager::sInstance = new (heap) MyFlagManager<SceneflagManager>();
|
||||
mHeap m(heap);
|
||||
SceneflagManager::sInstance->init();
|
||||
}
|
||||
|
||||
if (TBoxFlagManager::sInstance == nullptr) {
|
||||
TBoxFlagManager::sInstance = new (heap) MyFlagManager<TBoxFlagManager>();
|
||||
mHeap m(heap);
|
||||
TBoxFlagManager::sInstance->init();
|
||||
}
|
||||
|
||||
if (EnemyDefeatManager::sInstance == nullptr) {
|
||||
EnemyDefeatManager::sInstance = new (heap) MyFlagManager<EnemyDefeatManager>();
|
||||
mHeap m(heap);
|
||||
EnemyDefeatManager::sInstance->init();
|
||||
}
|
||||
|
||||
if (StoryflagManager::sInstance == nullptr) {
|
||||
StoryflagManager::sInstance = new (heap) MyFlagManager<StoryflagManager>();
|
||||
mHeap m(heap);
|
||||
StoryflagManager::sInstance->init();
|
||||
}
|
||||
|
||||
if (ItemflagManager::sInstance == nullptr) {
|
||||
ItemflagManager::sInstance = new (heap) MyFlagManager<ItemflagManager>();
|
||||
mHeap m(heap);
|
||||
ItemflagManager::sInstance->init();
|
||||
}
|
||||
|
||||
if (DungeonflagManager::sInstance == nullptr) {
|
||||
DungeonflagManager::sInstance = new (heap) MyFlagManager<DungeonflagManager>();
|
||||
mHeap m(heap);
|
||||
DungeonflagManager::sInstance->init();
|
||||
}
|
||||
|
||||
if (SkipflagManager::sInstance == nullptr) {
|
||||
SkipflagManager::sInstance = new (heap) MyFlagManager<SkipflagManager>();
|
||||
mHeap m(heap);
|
||||
SkipflagManager::sInstance->init();
|
||||
}
|
||||
|
||||
postSetup();
|
||||
}
|
||||
|
||||
static void postSetup() {
|
||||
updateFlagForFlagIndex(0);
|
||||
}
|
||||
|
||||
void copyAllFlagManagersFromSave() {
|
||||
u16 flag = FileManager::sInstance->getSceneFlagIndex();
|
||||
SceneflagManager::sInstance->copyFromSave(flag);
|
||||
TBoxFlagManager::sInstance->copyFromSave(flag);
|
||||
StoryflagManager::sInstance->copyFlagsFromSave_Priv();
|
||||
ItemflagManager::sInstance->copyFlagsFromSave_Priv();
|
||||
DungeonflagManager::sInstance->copyFromSave(flag);
|
||||
SkipflagManager::sInstance->thunk_copyFromSave();
|
||||
EnemyDefeatManager::sInstance->copyFromSave(flag);
|
||||
}
|
||||
|
||||
void updateFlagForFlagIndex(u16 stage) {
|
||||
SceneflagManager::sInstance->updateFlagindex(stage);
|
||||
TBoxFlagManager::sInstance->copyFromSave(stage);
|
||||
EnemyDefeatManager::sInstance->updateFlagIndex(stage);
|
||||
DungeonflagManager::sInstance->copyFromSave(stage);
|
||||
}
|
||||
|
||||
void commitAllFlagManagers() {
|
||||
StoryflagManager::sInstance->commit();
|
||||
ItemflagManager::sInstance->commit();
|
||||
DungeonflagManager::sInstance->doCommit();
|
||||
SkipflagManager::sInstance->commitFlags();
|
||||
SceneflagManager::sInstance->doCommit();
|
||||
TBoxFlagManager::sInstance->commitIfNecessary();
|
||||
EnemyDefeatManager::sInstance->commitIfNecessary();
|
||||
}
|
||||
|
||||
bool checkedMemcpy(void *dest, u32 destLen, const void *src, u32 count) {
|
||||
if (dest == nullptr || src == nullptr || destLen < count || destLen > 0xFFFF) {
|
||||
return true;
|
||||
} else {
|
||||
memcpy(dest, src, count);
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user