ksys/chm: Add SystemConfig

This commit is contained in:
Léo Lam 2021-06-20 16:27:37 +02:00
parent b3acc6a393
commit 3c01b50afc
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
5 changed files with 270 additions and 23 deletions

View File

@ -52939,7 +52939,7 @@
0x000000710089cc88,ActorCaptureMgr::init,332,_ZN4ksys3act15ActorCaptureMgr4initERKNS1_7InitArgE 0x000000710089cc88,ActorCaptureMgr::init,332,_ZN4ksys3act15ActorCaptureMgr4initERKNS1_7InitArgE
0x000000710089cdd4,ActorCaptureMgr::init2,12,_ZN4ksys3act15ActorCaptureMgr9setCameraEPNS0_6CameraE 0x000000710089cdd4,ActorCaptureMgr::init2,12,_ZN4ksys3act15ActorCaptureMgr9setCameraEPNS0_6CameraE
0x000000710089cde0,sub_710089CDE0,4112, 0x000000710089cde0,sub_710089CDE0,4112,
0x000000710089ddf0,_ZN4sead21FormatFixedSafeStringILi1024EEC2EPKcz,224, 0x000000710089ddf0,_ZN4sead21FormatFixedSafeStringILi1024EEC2EPKcz,224,_ZN4sead21FormatFixedSafeStringILi1024EEC2EPKcz
0x000000710089ded0,sub_710089DED0,572, 0x000000710089ded0,sub_710089DED0,572,
0x000000710089e10c,sub_710089E10C,804, 0x000000710089e10c,sub_710089E10C,804,
0x000000710089e430,sub_710089E430,1028, 0x000000710089e430,sub_710089E430,1028,
@ -75118,22 +75118,22 @@
0x0000007100d97abc,sub_7100D97ABC,64, 0x0000007100d97abc,sub_7100D97ABC,64,
0x0000007100d97afc,_ZN3aal19SpatialPlayingParamD0Ev,60, 0x0000007100d97afc,_ZN3aal19SpatialPlayingParamD0Ev,60,
0x0000007100d97b38,sub_7100D97B38,364, 0x0000007100d97b38,sub_7100D97B38,364,
0x0000007100d97ca4,sub_7100D97CA4,100, 0x0000007100d97ca4,sub_7100D97CA4,100,_ZN4ksys3chm12SystemConfig18SingletonDisposer_D1Ev
0x0000007100d97d08,sub_7100D97D08,108, 0x0000007100d97d08,sub_7100D97D08,108,_ZN4ksys3chm12SystemConfig18SingletonDisposer_D0Ev
0x0000007100d97d74,Chmres::createInstance,324, 0x0000007100d97d74,Chmres::createInstance,324,_ZN4ksys3chm12SystemConfig14createInstanceEPN4sead4HeapE
0x0000007100d97eb8,_ZN6xlink211SystemELink14deleteInstanceEv,88, 0x0000007100d97eb8,_ZN4ksys3chm12SystemConfig14deleteInstanceEv,88,_ZN4ksys3chm12SystemConfig14deleteInstanceEv
0x0000007100d97f10,sub_7100D97F10,264, 0x0000007100d97f10,sub_7100D97F10,264,_ZN4ksys3chm12SystemConfigD1Ev
0x0000007100d98018,sub_7100D98018,36, 0x0000007100d98018,sub_7100D98018,36,_ZN4ksys3chm12SystemConfigD0Ev
0x0000007100d9803c,Chmres::c,704, 0x0000007100d9803c,Chmres::c,704,_ZN4ksys3chm12SystemConfig4initEPN4sead4HeapE
0x0000007100d982fc,_ZNK3agl3env10CubeMapMgr22searchIlluminantEntityERKN4sead14SafeStringBaseIcEE,296, 0x0000007100d982fc,_ZNK3agl3env10CubeMapMgr22searchIlluminantEntityERKN4sead14SafeStringBaseIcEE,296,_ZNK4ksys3chm12SystemConfig8getWorldERKN4sead14SafeStringBaseIcEE
0x0000007100d98424,_ZNK3agl3env10CubeMapMgr23searchIlluminantTextureERKN4sead14SafeStringBaseIcEE,296, 0x0000007100d98424,_ZNK3agl3env10CubeMapMgr23searchIlluminantTextureERKN4sead14SafeStringBaseIcEE,296,_ZNK4ksys3chm12SystemConfig11getMaterialERKN4sead14SafeStringBaseIcEE
0x0000007100d9854c,_ZNK2al10CubeMapMgr23searchIlluminantTextureERKN4sead14SafeStringBaseIcEE,296, 0x0000007100d9854c,_ZNK2al10CubeMapMgr23searchIlluminantTextureERKN4sead14SafeStringBaseIcEE,296,_ZNK4ksys3chm12SystemConfig10getElementERKN4sead14SafeStringBaseIcEE
0x0000007100d98674,sub_7100D98674,36, 0x0000007100d98674,sub_7100D98674,36,_ZN4ksys3chm12SystemConfig4ListD2Ev
0x0000007100d98698,j__ZdlPv_867,4, 0x0000007100d98698,j__ZdlPv_867,4,_ZN4ksys3chm12SystemConfig4ListD0Ev
0x0000007100d9869c,Chmres::Material::c,2232, 0x0000007100d9869c,Chmres::Material::c,2232,_ZN4ksys3chm12SystemConfig5WorldC1Ev
0x0000007100d98f54,_ZN4sead19FixedSafeStringBaseIcLi47EEaSERKNS_14SafeStringBaseIcEE,400, 0x0000007100d98f54,_ZN4sead19FixedSafeStringBaseIcLi47EEaSERKNS_14SafeStringBaseIcEE,400,_ZN3agl3utl9ParameterIN4sead15FixedSafeStringILi256EEEEC1ERKS4_RKNS2_14SafeStringBaseIcEESB_PNS0_13IParameterObjE?
0x0000007100d990e4,sub_7100D990E4,136, 0x0000007100d990e4,sub_7100D990E4,136,_ZN4ksys3chm12SystemConfig5WorldD1Ev
0x0000007100d9916c,j__ZdlPv_868,4, 0x0000007100d9916c,j__ZdlPv_868,4,_ZN4ksys3chm12SystemConfig5WorldD0Ev
0x0000007100d99170,sub_7100D99170,100, 0x0000007100d99170,sub_7100D99170,100,
0x0000007100d991d4,sub_7100D991D4,108, 0x0000007100d991d4,sub_7100D991D4,108,
0x0000007100d99240,Chemical::createInstance,180, 0x0000007100d99240,Chemical::createInstance,180,
@ -94356,12 +94356,12 @@
0x0000007101265a6c,sub_7101265A6C,64, 0x0000007101265a6c,sub_7101265A6C,64,
0x0000007101265aac,nullsub_4745,4, 0x0000007101265aac,nullsub_4745,4,
0x0000007101265ab0,j__ZdlPv_1265,4, 0x0000007101265ab0,j__ZdlPv_1265,4,
0x0000007101265ab4,Chmres::Material::b,1460, 0x0000007101265ab4,Chmres::Material::b,1460,_ZN4ksys3chm12SystemConfig7ElementC1Ev
0x0000007101266068,sub_7101266068,96, 0x0000007101266068,sub_7101266068,96,_ZN4ksys3chm12SystemConfig7ElementD1Ev
0x00000071012660c8,j__ZdlPv_1266,4, 0x00000071012660c8,j__ZdlPv_1266,4,_ZN4ksys3chm12SystemConfig7ElementD0Ev
0x00000071012660cc,Chmres::Material::a,3380, 0x00000071012660cc,Chmres::Material::a,3380,_ZN4ksys3chm12SystemConfig8MaterialC1Ev
0x0000007101266e00,sub_7101266E00,124, 0x0000007101266e00,sub_7101266E00,124,_ZN4ksys3chm12SystemConfig8MaterialD1Ev
0x0000007101266e7c,j__ZdlPv_1267,4, 0x0000007101266e7c,j__ZdlPv_1267,4,_ZN4ksys3chm12SystemConfig8MaterialD0Ev
0x0000007101266e80,sub_7101266E80,24, 0x0000007101266e80,sub_7101266E80,24,
0x0000007101266e98,nullsub_4746,4, 0x0000007101266e98,nullsub_4746,4,
0x0000007101266e9c,j__ZdlPv_1268,4, 0x0000007101266e9c,j__ZdlPv_1268,4,

Can't render this file because it is too large.

View File

@ -5,4 +5,7 @@ target_sources(uking PRIVATE
chmRoot.h chmRoot.h
chmShape.cpp chmShape.cpp
chmShape.h chmShape.h
chmSystemConfig.cpp
chmSystemConfig.h
chmSystemConfigObjs.cpp
) )

View File

@ -0,0 +1,53 @@
#include "KingSystem/Chemical/chmSystemConfig.h"
namespace ksys::chm {
SEAD_SINGLETON_DISPOSER_IMPL(SystemConfig)
SystemConfig::~SystemConfig() {
mMaterials.freeBuffer();
mWorlds.freeBuffer();
}
void SystemConfig::init(sead::Heap* heap) {
mMaterials.allocBufferAssert(128, heap);
mElements.allocBufferAssert(128, heap);
mWorlds.allocBufferAssert(8, heap);
addList(&mWorldList, "world");
addList(&mMaterialList, "material");
addList(&mElementList, "element");
for (auto it = mWorlds.begin(), end = mWorlds.end(); it != end; ++it)
mWorldList.addObj(&*it, sead::FormatFixedSafeString<1024>("%d", it.getIndex()));
for (auto it = mMaterials.begin(), end = mMaterials.end(); it != end; ++it)
mMaterialList.addObj(&*it, sead::FormatFixedSafeString<1024>("%d", it.getIndex()));
for (auto it = mElements.begin(), end = mElements.end(); it != end; ++it)
mElementList.addObj(&*it, sead::FormatFixedSafeString<1024>("%d", it.getIndex()));
}
const SystemConfig::World& SystemConfig::getWorld(const sead::SafeString& name) const {
for (auto it = mWorlds.begin(), end = mWorlds.end(); it != end; ++it) {
if (name == it->id.ref())
return *it;
}
return mDummyWorld;
}
const SystemConfig::Material& SystemConfig::getMaterial(const sead::SafeString& name) const {
for (auto it = mMaterials.begin(), end = mMaterials.end(); it != end; ++it) {
if (name == it->id.ref())
return *it;
}
return mDummyMaterial;
}
const SystemConfig::Element& SystemConfig::getElement(const sead::SafeString& name) const {
for (auto it = mElements.begin(), end = mElements.end(); it != end; ++it) {
if (name == it->name.ref())
return *it;
}
return mDummyElement;
}
} // namespace ksys::chm

View File

@ -0,0 +1,116 @@
#pragma once
#include <agl/Utils/aglParameter.h>
#include <agl/Utils/aglParameterIO.h>
#include <agl/Utils/aglParameterList.h>
#include <agl/Utils/aglParameterObj.h>
#include <basis/seadTypes.h>
#include <container/seadBuffer.h>
#include <heap/seadDisposer.h>
#include <hostio/seadHostIONode.h>
namespace ksys::chm {
class SystemConfig : public agl::utl::IParameterIO, public sead::hostio::Node {
SEAD_SINGLETON_DISPOSER(SystemConfig)
SystemConfig() : agl::utl::IParameterIO("chmres", 0) {}
~SystemConfig() override;
public:
struct Element : agl::utl::IParameterObj, sead::hostio::Node {
Element();
~Element() override;
agl::utl::Parameter<sead::FixedSafeString<64>> name;
agl::utl::Parameter<sead::FixedSafeString<256>> label;
agl::utl::Parameter<int> effect_type;
agl::utl::Parameter<u32> attribute;
agl::utl::Parameter<float> life_frames;
agl::utl::Parameter<float> temperature;
agl::utl::Parameter<int> type;
agl::utl::Parameter<float> wetting_rate;
agl::utl::Parameter<float> wind_speed;
agl::utl::Parameter<float> electric_charge;
agl::utl::Parameter<float> shock_wave_speed;
agl::utl::Parameter<int> fire_level;
agl::utl::Parameter<float> moisture;
};
struct Material : agl::utl::IParameterObj, sead::hostio::Node {
Material();
~Material() override;
agl::utl::Parameter<sead::FixedSafeString<64>> id;
agl::utl::Parameter<sead::FixedSafeString<256>> label;
agl::utl::Parameter<u32> attribute;
agl::utl::Parameter<float> heat_capacity;
agl::utl::Parameter<float> thermal_conductivity;
agl::utl::Parameter<float> electrical_resistivity;
agl::utl::Parameter<float> electrical_capacitance;
agl::utl::Parameter<float> electromotive_force;
agl::utl::Parameter<int> fire_proof_level;
agl::utl::Parameter<float> ignition_point;
agl::utl::Parameter<float> burn_speed;
agl::utl::Parameter<float> wetting_amount;
agl::utl::Parameter<float> wind_force_remain_rate;
agl::utl::Parameter<sead::FixedSafeString<64>> burn_res_element_name;
agl::utl::Parameter<sead::FixedSafeString<64>> warm_res_element_name;
agl::utl::Parameter<sead::FixedSafeString<64>> exp_res_element_name;
agl::utl::Parameter<sead::FixedSafeString<64>> exp_res_element_name1;
agl::utl::Parameter<sead::FixedSafeString<64>> electricity_res_element_name;
agl::utl::Parameter<sead::FixedSafeString<64>> ice_magic_res_element_name;
agl::utl::Parameter<sead::FixedSafeString<64>> water_res_element_name;
};
struct World : agl::utl::IParameterObj, sead::hostio::Node {
World();
~World() override;
agl::utl::Parameter<sead::FixedSafeString<64>> id;
agl::utl::Parameter<sead::FixedSafeString<256>> label;
agl::utl::Parameter<float> evaporation_speed_rate;
agl::utl::Parameter<float> heat_transfer_speed_rate;
agl::utl::Parameter<float> fire_heat_transfer_speed_rate;
agl::utl::Parameter<float> conduction_speed_rate_log;
agl::utl::Parameter<float> burn_speed_rate;
agl::utl::Parameter<float> fire_extra_radius;
agl::utl::Parameter<float> player_fire_margin;
agl::utl::Parameter<float> electricity_extra_radius_rate;
agl::utl::Parameter<float> electric_water_extra_radius_rate;
agl::utl::Parameter<float> min_ice_size;
agl::utl::Parameter<float> ice_heat_cheat_threshold;
agl::utl::Parameter<float> ice_heat_cheat_rate;
agl::utl::Parameter<float> ice_melt_ratio_env_temp;
agl::utl::Parameter<float> ice_melt_ratio_warm_air;
agl::utl::Parameter<float> ice_melt_ratio_fire;
agl::utl::Parameter<float> ice_melt_ratio_fire2;
agl::utl::Parameter<float> wind_lift_rate;
agl::utl::Parameter<float> lightning_distance;
agl::utl::Parameter<float> character_ignition_count;
agl::utl::Parameter<float> object_ignition_count;
agl::utl::Parameter<float> offensive_rigid_radius;
};
struct List : agl::utl::IParameterList, sead::hostio::Node {
~List() override { ; }
};
void init(sead::Heap* heap);
const World& getWorld(const sead::SafeString& name) const;
const Material& getMaterial(const sead::SafeString& name) const;
const Element& getElement(const sead::SafeString& name) const;
private:
sead::Buffer<Material> mMaterials;
sead::Buffer<Element> mElements;
sead::Buffer<World> mWorlds;
Material mDummyMaterial;
Element mDummyElement;
World mDummyWorld;
List mWorldList;
List mMaterialList;
List mElementList;
};
} // namespace ksys::chm

View File

@ -0,0 +1,75 @@
#include "KingSystem/Chemical/chmSystemConfig.h"
namespace ksys::chm {
SystemConfig::Element::Element()
: name({"----"}, "name", "ID", this), label({"名称未設定"}, "label", "名前", this),
effect_type(0, "effect_type", "エフェクトタイプ", this),
attribute(0, "attribute", "ビットフラグ", this),
life_frames(0.0, "life_frames", "寿命(フレーム)", "Min=0.0 ,Max=300", this),
temperature(0.0, "temperature", "温度", this), type(2, "type", "タイプ", this),
wetting_rate(0.0, "wetting_rate", "濡れ率", this),
wind_speed(0.0, "wind_speed", "風速", this),
electric_charge(0.0, "electric_charge", "電荷", this),
shock_wave_speed(0.0, "shock_wave_speed", "衝撃波の速度", this),
fire_level(2, "fire_level", "炎レベル", this), moisture(0.0, "moisture", "湿度", this) {}
SystemConfig::Element::~Element() = default;
SystemConfig::Material::Material()
: id({"untitled"}, "id", "ID", this), label({"名称未設定材質"}, "label", "名前", this),
attribute(0, "attribute", "属性フラグ", this),
heat_capacity(1.0, "heat_capacity", "比熱容量[J/gK]", "Min=0, Max=10", this),
thermal_conductivity(1.0, "thermal_conductivity", "熱伝導率[W/m・K]", "Min=0, Max=100", this),
electrical_resistivity(1.0, "electrical_resistivity", "電気抵抗率[Ω・m]", "Min=-10, Max=10",
this),
electrical_capacitance(1.0, "electrical_capacitance", "静電容量[F]", "Min=0, Max=1", this),
electromotive_force(0.0, "electromotive_force", "起電力[V]", "Min=0, Max=10", this),
fire_proof_level(0, "fire_proof_level", "耐火性能[Lv]", "Min=0, Max=5", this),
ignition_point(100.0, "ignition_point", "発火点(度)", "Min=0 ,Max=1000", this),
burn_speed(1.0, "burn_speed", "燃える速度", "Min=0 ,Max=1.0", this),
wetting_amount(1.0, "wetting_amount", "単位面積あたりの塗れ量[kg/m2]", "Min=0, Max=100",
this),
wind_force_remain_rate(0.0, "wind_force_remain_rate", "風力影響の残り率", "Min=0,Max=1",
this),
burn_res_element_name({"----"}, "burn_res_element_name", "", this),
warm_res_element_name({"----"}, "warm_res_element_name", "暖気", this),
exp_res_element_name({"----"}, "exp_res_element_name", "爆発(slot0)", this),
exp_res_element_name1({"----"}, "exp_res_element_name1", "爆発(slot1)", this),
electricity_res_element_name({"----"}, "electricity_res_element_name", "帯電", this),
ice_magic_res_element_name({"----"}, "ice_magic_res_element_name", "氷魔法", this),
water_res_element_name({"----"}, "water_res_element_name", "", this) {}
SystemConfig::Material::~Material() = default;
SystemConfig::World::World()
: id({"untitled"}, "id", "ID", this), label({"名称未設定"}, "label", "ラベル", this),
evaporation_speed_rate(24.0, "evaporation_speed_rate", "温度に対する蒸発係数",
"Min=0 ,Max=100", this),
heat_transfer_speed_rate(24.0, "heat_transfer_speed_rate", "伝熱速度倍率(全体)", this),
fire_heat_transfer_speed_rate(2.0, "fire_heat_transfer_speed_rate", "伝熱速度倍率(炎)", this),
conduction_speed_rate_log(-5.0, "conduction_speed_rate_log", "電気伝導速度倍率", this),
burn_speed_rate(0.1, "burn_speed_rate", "燃焼速度倍率", this),
fire_extra_radius(0.3, "fire_extra_radius", "炎は何m離れてても当たるか", this),
player_fire_margin(0.3, "player_fire_margin", "プレイヤーの直火大丈夫距離[m]", this),
electricity_extra_radius_rate(50.0, "electricity_extra_radius_rate", "放電距離倍率", this),
electric_water_extra_radius_rate(500.0, "electric_water_extra_radius_rate",
"放電距離倍率(水の漏電)", this),
min_ice_size(0.15, "min_ice_size", "最少の氷サイズ[m]", this),
ice_heat_cheat_threshold(10000.0, "ice_heat_cheat_threshold",
"氷を溶けやすくするチートの発動重要[kg]", this),
ice_heat_cheat_rate(0.5, "ice_heat_cheat_rate", "氷を溶けやすくするチートの割合", this),
ice_melt_ratio_env_temp(0.05, "ice_melt_ratio_env_temp", "氷解率vs気温", this),
ice_melt_ratio_warm_air(0.5, "ice_melt_ratio_warm_air", "氷解率vs暖気", this),
ice_melt_ratio_fire(1.0, "ice_melt_ratio_fire", "氷解率vs火", this),
ice_melt_ratio_fire2(10.0, "ice_melt_ratio_fire2", "氷解率vs炎", this),
wind_lift_rate(0.1, "wind_lift_rate", "揚抗比", this),
lightning_distance(25.0, "lightning_distance", "落雷の範囲[m]", this),
character_ignition_count(90.0, "character_ignition_count", "キャラクタ着火時間(フレーム)",
this),
object_ignition_count(90.0, "object_ignition_count", "キャラクタ着火時間(フレーム)", this),
offensive_rigid_radius(1.0, "offensive_rigid_radius", "攻撃状態のケミカルサイズ", this) {}
SystemConfig::World::~World() = default;
} // namespace ksys::chm