mirror of
https://github.com/zeldaret/botw
synced 2026-07-06 13:11:07 -04:00
ksys/res: Implement AttClient
This commit is contained in:
@@ -4,6 +4,57 @@
|
||||
|
||||
namespace ksys::res {
|
||||
|
||||
AttClientList::~AttClientList() {
|
||||
mClients.freeBuffer();
|
||||
}
|
||||
|
||||
void AttClientList::doCreate_(u8* buffer, u32 buffer_size, sead::Heap* heap) {}
|
||||
|
||||
bool AttClientList::parse_(u8* data, size_t size, sead::Heap* heap) {
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
agl::utl::ResParameterArchive archive{data};
|
||||
const auto root = archive.getRootList();
|
||||
|
||||
mAttPos.init(&mAttPosObj);
|
||||
mForceEdit.init(false, "ForceEdit", "強制編集", "", &mAttPosObj);
|
||||
addObj(&mAttPosObj, "AttPos");
|
||||
|
||||
const auto AttClients = agl::utl::getResParameterList(root, "AttClients");
|
||||
if (int num; AttClients && (num = AttClients.getResParameterObjNum()) != 0) {
|
||||
mClients.allocBufferAssert(num, heap);
|
||||
for (auto it = mClients.begin(), end = mClients.end(); it != end; ++it) {
|
||||
it->client = nullptr;
|
||||
it->name.init("", "Name", "クライアントのキー名", "", &it->obj);
|
||||
it->file_name.init("", "FileName", "クライアントのデータファイル名", "", &it->obj);
|
||||
it->is_valid.init(true, "IsValid", "デフォルトの有効・無効状態", "", &it->obj);
|
||||
|
||||
mAttClientsList.addObj(
|
||||
&it->obj, sead::FormatFixedSafeString<32>("%s%d", "AttClient_", it.getIndex()));
|
||||
}
|
||||
}
|
||||
|
||||
addList(&mAttClientsList, "AttClients");
|
||||
|
||||
applyResParameterArchive(archive);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AttClientList::finishParsing_() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AttClientList::m7_() {
|
||||
for (auto& client : mClients)
|
||||
client.client = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AttClientList::isForceEdit() const {
|
||||
return mForceEdit.ref();
|
||||
}
|
||||
|
||||
AttClient::~AttClient() {
|
||||
for (int i = 0; i < mChecks.size(); ++i) {
|
||||
if (mChecks[i]) {
|
||||
|
||||
@@ -70,9 +70,11 @@ public:
|
||||
auto operator=(const AttClientList&) = delete;
|
||||
|
||||
const AttPos& getAttPos() const { return mAttPos; }
|
||||
bool isForceEdit() const { return mForceEdit.ref(); }
|
||||
bool isForceEdit() const;
|
||||
const sead::Buffer<Client>& getClients() const { return mClients; }
|
||||
|
||||
// TODO: one more function
|
||||
|
||||
void addClient_(s32 index, AttClient* client) { mClients[index].client = client; }
|
||||
|
||||
void doCreate_(u8* buffer, u32 buffer_size, sead::Heap* heap) override;
|
||||
|
||||
Reference in New Issue
Block a user