mirror of https://github.com/zeldaret/botw.git
resResourceShop decompiled
This commit is contained in:
parent
6c3158c057
commit
c562d67fab
|
@ -85887,26 +85887,26 @@
|
|||
0x000000710109b454,sub_710109B454,8,
|
||||
0x000000710109b45c,sub_710109B45C,208,
|
||||
0x000000710109b52c,sub_710109B52C,196,
|
||||
0x000000710109b764,nullsub_4475,4,
|
||||
0x000000710109b768,nullsub_4476,4,
|
||||
0x000000710109b76c,Bshop::parse,1404,
|
||||
0x000000710109bce8,sub_710109BCE8,872,
|
||||
0x000000710109c050,ResourceBshop::parse,28,
|
||||
0x000000710109c06c,sub_710109C06C,588,
|
||||
0x000000710109c2b8,sub_710109C2B8,336,
|
||||
0x000000710109c408,sub_710109C408,124,
|
||||
0x000000710109c484,sub_710109C484,112,
|
||||
0x000000710109c4f4,sub_710109C4F4,8,
|
||||
0x000000710109c4fc,sub_710109C4FC,8,
|
||||
0x000000710109c504,sub_710109C504,92,
|
||||
0x000000710109c560,sub_710109C560,8,
|
||||
0x000000710109c568,sub_710109C568,8,
|
||||
0x000000710109c570,sub_710109C570,92,
|
||||
0x000000710109c5cc,sub_710109C5CC,120,
|
||||
0x000000710109c644,sub_710109C644,108,
|
||||
0x000000710109c6b0,sub_710109C6B0,8,
|
||||
0x000000710109c6b8,sub_710109C6B8,128,
|
||||
0x000000710109c738,sub_710109C738,116,
|
||||
0x000000710109b764,nullsub_4475,4,_ZN4ksys3res4Shop9doCreate_EPhjPN4sead4HeapE
|
||||
0x000000710109b768,nullsub_4476,4,_ZThn632_N4ksys3res4Shop9doCreate_EPhjPN4sead4HeapE
|
||||
0x000000710109b76c,Bshop::parse,1404,_ZN4ksys3res4Shop6parse_EPhmPN4sead4HeapE
|
||||
0x000000710109bce8,sub_710109BCE8,872,_ZN4ksys3res4Shop11parseTable_ERKi
|
||||
0x000000710109c050,ResourceBshop::parse,28,_ZThn632_N4ksys3res4Shop6parse_EPhmPN4sead4HeapE
|
||||
0x000000710109c06c,sub_710109C06C,588,_ZNK4ksys3res4Shop22findTableIndexOrNormalERKN4sead14SafeStringBaseIcEE
|
||||
0x000000710109c2b8,sub_710109C2B8,336,_ZNK4ksys3res4Shop14findTableIndexERKN4sead14SafeStringBaseIcEE
|
||||
0x000000710109c408,sub_710109C408,124,_ZN4ksys3res4ShopD2Ev
|
||||
0x000000710109c484,sub_710109C484,112,_ZN4ksys3res4ShopD0Ev
|
||||
0x000000710109c4f4,sub_710109C4F4,8,_ZN4ksys3res4Shop10ParamIO_m0Ev
|
||||
0x000000710109c4fc,sub_710109C4FC,8,_ZNK4ksys3res4Shop27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE?
|
||||
0x000000710109c504,sub_710109C504,92,_ZNK4ksys3res4Shop18getRuntimeTypeInfoEv
|
||||
0x000000710109c560,sub_710109C560,8,_ZNK4ksys3res4Shop10needsParseEv
|
||||
0x000000710109c568,sub_710109C568,8,_ZThn632_NK4ksys3res4Shop27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE?
|
||||
0x000000710109c570,sub_710109C570,92,_ZThn632_NK4ksys3res4Shop18getRuntimeTypeInfoEv
|
||||
0x000000710109c5cc,sub_710109C5CC,120,_ZThn632_N4ksys3res4ShopD1Ev
|
||||
0x000000710109c644,sub_710109C644,108,_ZThn632_N4ksys3res4ShopD0Ev
|
||||
0x000000710109c6b0,sub_710109C6B0,8,_ZThn632_NK4ksys3res4Shop10needsParseEv
|
||||
0x000000710109c6b8,sub_710109C6B8,128,_ZThn664_N4ksys3res4ShopD1Ev
|
||||
0x000000710109c738,sub_710109C738,116,_ZThn664_N4ksys3res4ShopD0Ev
|
||||
0x000000710109c920,sub_710109C920,244,
|
||||
0x000000710109ca14,sub_710109CA14,8,
|
||||
0x000000710109cb20,sub_710109CB20,84,
|
||||
|
|
Can't render this file because it is too large.
|
|
@ -140,4 +140,6 @@ target_sources(uking PRIVATE
|
|||
resResourceLod.h
|
||||
resResourceRecipe.cpp
|
||||
resResourceRecipe.h
|
||||
resResourceShop.cpp
|
||||
resResourceShop.h
|
||||
)
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
#include "KingSystem/Resource/resResourceShop.h"
|
||||
|
||||
namespace ksys::res {
|
||||
|
||||
bool Shop::parse_(u8* data, size_t, sead::Heap* heap) {
|
||||
mTableNum.init(0, "TableNum", "テーブルの数", &mObj);
|
||||
addObj(&mObj, "Header");
|
||||
|
||||
if (!data)
|
||||
return true;
|
||||
|
||||
applyResParameterArchive(agl::utl::ResParameterArchive{data});
|
||||
|
||||
const s32 num_tables = mTableNum.ref();
|
||||
if (num_tables < 1)
|
||||
return true;
|
||||
|
||||
mTables.allocBufferAssert(num_tables, heap);
|
||||
|
||||
const agl::utl::ResParameterArchive archive{data};
|
||||
const auto root = archive.getRootList();
|
||||
const auto header_obj = root.getResParameterObj(0);
|
||||
|
||||
for (s32 i = 0; i < num_tables; ++i) {
|
||||
sead::FormatFixedSafeString<64> name;
|
||||
name.format("Table%02d", i + 1);
|
||||
mTables[i].name.init("", name, "テーブル名", &mObj);
|
||||
}
|
||||
|
||||
mObj.applyResParameterObj(header_obj, nullptr);
|
||||
|
||||
for (s32 i = 0; i < num_tables; ++i) {
|
||||
const auto obj = root.getResParameterObj(i + 1);
|
||||
mTables[i].column_num.init(0, "ColumnNum", "行数", &mTables[i].obj);
|
||||
|
||||
addObj(&mTables[i].obj, mTables[i].name.ref());
|
||||
applyResParameterArchive(agl::utl::ResParameterArchive{data});
|
||||
mTables[i].obj.applyResParameterObj(obj, nullptr);
|
||||
|
||||
if (mTables[i].column_num.ref() > 0) {
|
||||
mTables[i].items.allocBufferAssert(mTables[i].column_num.ref(), heap);
|
||||
}
|
||||
}
|
||||
|
||||
for (s32 i = 0; i < num_tables; ++i) {
|
||||
parseTable_(i);
|
||||
}
|
||||
|
||||
applyResParameterArchive(agl::utl::ResParameterArchive{data});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Shop::parseTable_(const s32& table_idx) {
|
||||
const s32 num = mTables[table_idx].column_num.ref();
|
||||
for (s32 i = 0; i < num; ++i) {
|
||||
sead::FormatFixedSafeString<64> name;
|
||||
name.format("ItemSort%03d", i + 1);
|
||||
mTables[table_idx].items[i].sort_value.init(0, name, "ソート値", &mTables[table_idx].obj);
|
||||
|
||||
sead::FormatFixedSafeString<64> name2;
|
||||
name2.format("ItemName%03d", i + 1);
|
||||
mTables[table_idx].items[i].name.init("", name2, "アイテム名", &mTables[table_idx].obj);
|
||||
|
||||
sead::FormatFixedSafeString<64> name3;
|
||||
name3.format("ItemNum%03d", i + 1);
|
||||
mTables[table_idx].items[i].num_stock.init(0, name3, "販売個数", &mTables[table_idx].obj);
|
||||
|
||||
sead::FormatFixedSafeString<64> name4;
|
||||
name4.format("ItemAdjustPrice%03d", i + 1);
|
||||
mTables[table_idx].items[i].price_adjustment.init(0, name4, "値段調整値",
|
||||
&mTables[table_idx].obj);
|
||||
|
||||
sead::FormatFixedSafeString<64> name5;
|
||||
name5.format("ItemLookGetFlg%03d", i + 1);
|
||||
mTables[table_idx].items[i].demo_flag.init(false, name5, "ゲットフラグを見るか",
|
||||
&mTables[table_idx].obj);
|
||||
|
||||
sead::FormatFixedSafeString<64> name6;
|
||||
name6.format("ItemAmount%03d", i + 1);
|
||||
mTables[table_idx].items[i].price.init(0, name6, "価値", &mTables[table_idx].obj);
|
||||
}
|
||||
}
|
||||
|
||||
s32 Shop::findTableIndex(const sead::SafeString& table_name) const {
|
||||
if (!mTables.isBufferReady())
|
||||
return -1;
|
||||
|
||||
const s32 num = mTableNum.ref();
|
||||
for (s32 i = 0; i < num; ++i) {
|
||||
if (mTables[i].name.ref() == table_name)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
s32 Shop::findTableIndexOrNormal(const sead::SafeString& table_name) const {
|
||||
if (!mTables.isBufferReady())
|
||||
return -1;
|
||||
|
||||
s32 normal_idx = -1;
|
||||
const s32 num = mTableNum.ref();
|
||||
for (s32 i = 0; i < num; ++i) {
|
||||
if (mTables[i].name.ref() == table_name)
|
||||
return i;
|
||||
|
||||
if (normal_idx < 0 && mTables[i].name.ref() == "Normal")
|
||||
normal_idx = i;
|
||||
}
|
||||
|
||||
return normal_idx;
|
||||
}
|
||||
|
||||
} // namespace ksys::res
|
|
@ -0,0 +1,55 @@
|
|||
#pragma once
|
||||
|
||||
#include <agl/Utils/aglParameter.h>
|
||||
#include <agl/Utils/aglParameterObj.h>
|
||||
#include <container/seadBuffer.h>
|
||||
#include "KingSystem/Resource/resResource.h"
|
||||
#include "KingSystem/Utils/ParamIO.h"
|
||||
|
||||
namespace ksys::res {
|
||||
|
||||
class Shop : public ParamIO, public Resource {
|
||||
SEAD_RTTI_OVERRIDE(Shop, Resource)
|
||||
|
||||
public:
|
||||
struct Item {
|
||||
agl::utl::Parameter<s32> sort_value;
|
||||
agl::utl::Parameter<sead::SafeString> name;
|
||||
agl::utl::Parameter<s32> num_stock;
|
||||
agl::utl::Parameter<s32> price_adjustment;
|
||||
agl::utl::Parameter<bool> demo_flag;
|
||||
agl::utl::Parameter<s32> price;
|
||||
};
|
||||
KSYS_CHECK_SIZE_NX150(Item, 0xC8);
|
||||
|
||||
struct Table {
|
||||
agl::utl::ParameterObj obj;
|
||||
agl::utl::Parameter<sead::SafeString> name;
|
||||
agl::utl::Parameter<s32> column_num;
|
||||
sead::Buffer<Item> items;
|
||||
};
|
||||
KSYS_CHECK_SIZE_NX150(Table, 0x88);
|
||||
|
||||
Shop() : ParamIO("shop", 0) {}
|
||||
|
||||
s32 findTableIndexOrNormal(const sead::SafeString& table_name) const;
|
||||
s32 findTableIndex(const sead::SafeString& table_name) const;
|
||||
|
||||
bool ParamIO_m0() override { return true; }
|
||||
void doCreate_(u8*, u32, sead::Heap*) override {}
|
||||
bool needsParse() const override { return true; }
|
||||
|
||||
const sead::Buffer<Table>& getTables() const { return mTables; }
|
||||
|
||||
private:
|
||||
bool parse_(u8* data, size_t size, sead::Heap* heap) override;
|
||||
void parseTable_(const s32& table_idx);
|
||||
|
||||
agl::utl::ParameterObj mObj;
|
||||
agl::utl::Parameter<s32> mTableNum;
|
||||
sead::Buffer<void*> _300;
|
||||
sead::Buffer<Table> mTables;
|
||||
};
|
||||
KSYS_CHECK_SIZE_NX150(Shop, 0x320);
|
||||
|
||||
} // namespace ksys::res
|
Loading…
Reference in New Issue