mirror of https://github.com/zeldaret/botw.git
ksys/res: Add Recipe
It's mostly the same as Drop. *shrug*
This commit is contained in:
parent
6af5dfd747
commit
59c91970f6
|
@ -69,6 +69,8 @@ add_executable(uking
|
|||
src/KingSystem/Resource/resResourceDrop.h
|
||||
src/KingSystem/Resource/resResourceLod.cpp
|
||||
src/KingSystem/Resource/resResourceLod.h
|
||||
src/KingSystem/Resource/resResourceRecipe.cpp
|
||||
src/KingSystem/Resource/resResourceRecipe.h
|
||||
|
||||
src/KingSystem/Terrain/teraSystem.h
|
||||
|
||||
|
|
|
@ -94385,24 +94385,24 @@
|
|||
0x00000071012fc31c,sub_71012FC31C,8,
|
||||
0x00000071012fc324,sub_71012FC324,92,
|
||||
0x00000071012fc380,sub_71012FC380,8,
|
||||
0x00000071012fc4fc,nullsub_4845,4,
|
||||
0x00000071012fc500,nullsub_4846,4,
|
||||
0x00000071012fc504,Brecipe::parse,1328,
|
||||
0x00000071012fca34,sub_71012FCA34,408,
|
||||
0x00000071012fcbcc,ResourceBrecipe::parse,28,
|
||||
0x00000071012fcbe8,sub_71012FCBE8,124,
|
||||
0x00000071012fcc64,sub_71012FCC64,112,
|
||||
0x00000071012fccd4,sub_71012FCCD4,8,
|
||||
0x00000071012fccdc,sub_71012FCCDC,8,
|
||||
0x00000071012fcce4,sub_71012FCCE4,92,
|
||||
0x00000071012fcd40,sub_71012FCD40,8,
|
||||
0x00000071012fcd48,sub_71012FCD48,8,
|
||||
0x00000071012fcd50,sub_71012FCD50,92,
|
||||
0x00000071012fcdac,sub_71012FCDAC,120,
|
||||
0x00000071012fce24,sub_71012FCE24,108,
|
||||
0x00000071012fce90,sub_71012FCE90,8,
|
||||
0x00000071012fce98,sub_71012FCE98,128,
|
||||
0x00000071012fcf18,sub_71012FCF18,116,
|
||||
0x00000071012fc4fc,nullsub_4845,4,_ZN4ksys3res6Recipe9doCreate_EPhjPN4sead4HeapE
|
||||
0x00000071012fc500,nullsub_4846,4,_ZThn632_N4ksys3res6Recipe9doCreate_EPhjPN4sead4HeapE
|
||||
0x00000071012fc504,Brecipe::parse,1328,_ZN4ksys3res6Recipe6parse_EPhmPN4sead4HeapE?
|
||||
0x00000071012fca34,sub_71012FCA34,408,_ZN4ksys3res6Recipe11parseTable_ERKi
|
||||
0x00000071012fcbcc,ResourceBrecipe::parse,28,_ZThn632_N4ksys3res6Recipe6parse_EPhmPN4sead4HeapE
|
||||
0x00000071012fcbe8,sub_71012FCBE8,124,_ZN4ksys3res6RecipeD2Ev
|
||||
0x00000071012fcc64,sub_71012FCC64,112,_ZN4ksys3res6RecipeD0Ev
|
||||
0x00000071012fccd4,sub_71012FCCD4,8,_ZN4ksys3res6Recipe10ParamIO_m0Ev
|
||||
0x00000071012fccdc,sub_71012FCCDC,8,_ZNK4ksys3res6Recipe27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE?
|
||||
0x00000071012fcce4,sub_71012FCCE4,92,_ZNK4ksys3res6Recipe18getRuntimeTypeInfoEv
|
||||
0x00000071012fcd40,sub_71012FCD40,8,_ZNK4ksys3res6Recipe10needsParseEv
|
||||
0x00000071012fcd48,sub_71012FCD48,8,_ZThn632_NK4ksys3res6Recipe27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE?
|
||||
0x00000071012fcd50,sub_71012FCD50,92,_ZThn632_NK4ksys3res6Recipe18getRuntimeTypeInfoEv
|
||||
0x00000071012fcdac,sub_71012FCDAC,120,_ZThn632_N4ksys3res6RecipeD1Ev
|
||||
0x00000071012fce24,sub_71012FCE24,108,_ZThn632_N4ksys3res6RecipeD0Ev
|
||||
0x00000071012fce90,sub_71012FCE90,8,_ZThn632_NK4ksys3res6Recipe10needsParseEv
|
||||
0x00000071012fce98,sub_71012FCE98,128,_ZThn664_N4ksys3res6RecipeD1Ev
|
||||
0x00000071012fcf18,sub_71012FCF18,116,_ZThn664_N4ksys3res6RecipeD0Ev
|
||||
0x00000071012fd100,sub_71012FD100,232,
|
||||
0x00000071012fd1e8,sub_71012FD1E8,52,
|
||||
0x00000071012fd21c,sub_71012FD21C,48,
|
||||
|
|
Can't render this file because it is too large.
|
|
@ -0,0 +1,67 @@
|
|||
#include "KingSystem/Resource/resResourceRecipe.h"
|
||||
|
||||
namespace ksys::res {
|
||||
|
||||
// NON_MATCHING: first line (see also Drop::parse_)
|
||||
bool Recipe::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 Recipe::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("ItemName%02d", i + 1);
|
||||
mTables[table_idx].items[i].name.init("", name, "アイテム名", &mTables[table_idx].obj);
|
||||
|
||||
sead::FormatFixedSafeString<64> name2;
|
||||
name2.format("ItemNum%02d", i + 1);
|
||||
mTables[table_idx].items[i].num.init(0, name2, "個数", &mTables[table_idx].obj);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ksys::res
|
|
@ -0,0 +1,48 @@
|
|||
#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"
|
||||
#include "KingSystem/Utils/Types.h"
|
||||
|
||||
namespace ksys::res {
|
||||
|
||||
class Recipe : public ParamIO, public Resource {
|
||||
SEAD_RTTI_OVERRIDE(Recipe, Resource)
|
||||
public:
|
||||
struct Item {
|
||||
agl::utl::Parameter<sead::SafeString> name;
|
||||
agl::utl::Parameter<s32> num;
|
||||
};
|
||||
KSYS_CHECK_SIZE_NX150(Item, 0x48);
|
||||
|
||||
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);
|
||||
|
||||
Recipe() : ParamIO("recipe", 0) {}
|
||||
|
||||
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(Recipe, 0x320);
|
||||
|
||||
} // namespace ksys::res
|
Loading…
Reference in New Issue