diff --git a/1.patch b/1.patch new file mode 100644 index 0000000..532688e --- /dev/null +++ b/1.patch @@ -0,0 +1,175 @@ +diff --git a/src/common/types.cpp b/src/common/types.cpp +index 81d3b92..27ac4bc 100644 +--- a/src/common/types.cpp ++++ b/src/common/types.cpp +@@ -73,15 +73,6 @@ void weather::load(const buffer &b) + } + } + +-void weather_group::load(const buffer &b) +-{ +- READ(b, n_segs); +- segments.resize(n_segs); +- READ_STRING_N(b, name, 0xA0); +- for (auto &s : segments) +- s.load(b); +-} +- + void water::load(const buffer &b) + { + READ(b, unk0); +diff --git a/src/common/types.h b/src/common/types.h +index d525607..cea88c4 100644 +--- a/src/common/types.h ++++ b/src/common/types.h +@@ -135,11 +135,21 @@ struct weather + + struct weather_group + { ++ uint32_t unk0; // racing + uint32_t n_segs; + std::string name; + std::vector segments; + +- void load(const buffer &b); ++ void load(const buffer &b, bool aim_racing = false) { ++ if (aim_racing) { ++ READ(b, unk0); ++ } ++ READ(b, n_segs); ++ segments.resize(n_segs); ++ READ_STRING_N(b, name, 0xA0); ++ for (auto &s : segments) ++ s.load(b); ++ } + }; + + struct water +diff --git a/src/mmp_extractor/mmp.cpp b/src/mmp_extractor/mmp.cpp +index 1a251c2..3da1598 100644 +--- a/src/mmp_extractor/mmp.cpp ++++ b/src/mmp_extractor/mmp.cpp +@@ -42,19 +42,16 @@ void water_segment::load(const buffer &b) + wg.load(b); + } + +-void weather_segment::load(const buffer &b) +-{ +- wg.load(b); +-} +- + header_segment *header::create_segment(const buffer &b) + { + HeaderSegmentType type; + READ(b, type); + + header_segment *segment = 0; +- switch (type) +- { ++ switch (type) { ++ /*case HeaderSegmentType::unk0: ++ segment = new unk_segment; ++ break;*/ + case HeaderSegmentType::water: + segment = new water_segment; + break; +@@ -76,7 +73,7 @@ header_segment *header::create_segment(const buffer &b) + + void header::load(const buffer &b) + { +- READ(b, unk0); ++ READ(b, version); + READ_WSTRING(b, name1); + READ_WSTRING(b, name2); + READ(b, width); +@@ -84,6 +81,10 @@ void header::load(const buffer &b) + READ(b, n_header_segs); + segments.resize(n_header_segs); + READ_STRING_N(b, name, 0xA0); ++ if (version == ver::aim_racing) { ++ uint32_t unk0[4]; ++ READ(b, unk0); ++ } + for (auto &s : segments) + { + s = create_segment(b); +diff --git a/src/mmp_extractor/mmp.h b/src/mmp_extractor/mmp.h +index c444c2b..c152656 100644 +--- a/src/mmp_extractor/mmp.h ++++ b/src/mmp_extractor/mmp.h +@@ -34,6 +34,7 @@ using Height = float; + + enum class HeaderSegmentType : uint32_t + { ++ //unk0 = 0, + water = 1, + weather = 2, + }; +@@ -41,29 +42,47 @@ enum class HeaderSegmentType : uint32_t + struct header_segment + { + HeaderSegmentType type; +- uint32_t unk0; ++ uint32_t unk0; // version? + uint32_t len; + + virtual void load(const buffer &b) = 0; + }; + ++struct unk_segment : public header_segment { ++ std::string name; ++ ++ void load(const buffer &b) override { ++ uint32_t unk0[6]; ++ ++ READ(b, unk0); ++ READ_STRING_N(b, name, 0xA0); ++ } ++}; ++ + struct water_segment : public header_segment + { + water_group wg; + +- virtual void load(const buffer &b) override; ++ void load(const buffer &b) override; + }; + + struct weather_segment : public header_segment + { + weather_group wg; + +- virtual void load(const buffer &b) override; ++ void load(const buffer &b) override { ++ wg.load(b); ++ } + }; + + struct header + { +- uint32_t unk0; ++ enum class ver : uint32_t { ++ aim12 = 0x100, ++ aim_racing = 0x101, ++ }; ++ ++ ver version; + std::wstring name1; + std::wstring name2; + uint32_t width; +diff --git a/src/model/model.cpp b/src/model/model.cpp +index f113c7d..f63cdcc 100644 +--- a/src/model/model.cpp ++++ b/src/model/model.cpp +@@ -475,6 +475,11 @@ void block::header::load(const buffer &b) + else + READ(b, unk2[2]); // unk4_0 - related to unk4 - some vector3f + READ(b, unk4); ++ if (gameType == GameType::AimR) { ++ // not always? ++ float unk; ++ READ(b, unk); ++ } + } + + void block::load(const buffer &b) diff --git a/src/aim1_mod_maker/aim1_mod_maker.cpp b/src/aim1_mod_maker/aim1_mod_maker.cpp new file mode 100644 index 0000000..883e5e1 --- /dev/null +++ b/src/aim1_mod_maker/aim1_mod_maker.cpp @@ -0,0 +1,60 @@ +#include "aim1_mod_maker.h" + +#include +#include +#include + +int main(int argc, char *argv[]) { + mod_maker mod{"my_mod"}; + + mod.patch("location4.mmo", 0x7F599, 0x31, 0x33); // rename second FINSWIL-1 to FINSWIL-3 to make it appear + mod.patch("location4.mmo", 0x7FA34, 1, 0); // make SWIRE appear + mod.patch("location4.mmo", 0x7F913, 1, 0); // make SWILHUN appear + mod.patch("location4.mmo", 0x7F528, 0x40, 0xB1); // reposition SWILHUN-3 + mod.patch("location4.mmo", 0x7EE62, 0xA1, 0xA0); // reposition SWILHUN-1 + mod.patch("location5.mmo", 0xBAFF7, 0x18, 0x17); // reposition SACREFI-2 + mod.patch("location6.mmo", 0x575DD, 'R', 'F'); // set correct model for a plant + + mod.replace("Script/bin/B_L1_BASE1.scr", "_ADDBALANCE(300)", R"( +_ADDBALANCE(300 ) + + //_ADDOBJECT(GL_M4_S_FIRST2) + //_ADDOBJECT(EQP_VACUUM_DRIVE_S4) + //_ADDOBJECT(EQP_MEZON_REACTOR_S4) + //_ADDOBJECT(EQP_MESON_REACTOR_S4) + //_ADDOBJECT(EQP_NUCLON_REACTOR_S4) + //_ADDOBJECT(EQP_ZERO_ARMOR_S4) + //_ADDOBJECT(EQP_SHIELD_GENERATOR4_S4) + //_ADDOBJECT(GUN_MICROWAVE_OSCILLATOR) + //_ADDOBJECT(GUN_RAILGUN) + _ADDRATING(300000000) + _ADDBALANCE(30000000) + + _SETEVENT(SECTOR1.VISIT) + _SETEVENT(SECTOR1.ACCESS) + _SETEVENT(SECTOR2.VISIT) + _SETEVENT(SECTOR2.ACCESS) + _SETEVENT(SECTOR3.VISIT) + _SETEVENT(SECTOR3.ACCESS) + _SETEVENT(SECTOR4.VISIT) + _SETEVENT(SECTOR4.ACCESS) + _SETEVENT(SECTOR5.VISIT) + _SETEVENT(SECTOR5.ACCESS) + _SETEVENT(SECTOR6.VISIT) + _SETEVENT(SECTOR6.ACCESS) + _SETEVENT(SECTOR7.VISIT) + _SETEVENT(SECTOR7.ACCESS) + //_SETEVENT(SECTOR8.VISIT) + _SETEVENT(SECTOR8.ACCESS) +)"); + + mod.replace("ORG_FIRST.scr", "IF(_PLAYERHAS(GL_M3_A_FIRST1)||_PLAYERHAS(GL_M3_A_FIRST1))", "IF(_PLAYERHAS(GL_M3_A_FIRST1)||_PLAYERHAS(GL_M3_A_FIRST2))"); + mod.replace("ORG_FIRST.scr", "IF(_PLAYERHAS(GL_M4_A_FIRST1)||_PLAYERHAS(GL_M4_A_FIRST1))", "IF(_PLAYERHAS(GL_M4_S_FIRST1)||_PLAYERHAS(GL_M4_S_FIRST2))"); + mod.replace("location5.scr", "TOV_POLYMER_PLATES", "TOV_POLYMER_PLATE"); + mod.replace("location6.scr", "TOV_POLYMER_PLATES", "TOV_POLYMER_PLATE"); + mod.enable_free_camera(); + mod.enable_win_key(); + mod.apply(); + + return 0; +} diff --git a/sw.cpp b/sw.cpp index 9ea02ac..67b3a80 100644 --- a/sw.cpp +++ b/sw.cpp @@ -54,6 +54,9 @@ void build(Solution &s) add_exe_with_common("tm_converter"); add_exe("name_generator"); add_exe_with_common("save_loader"); + add_exe_with_common("aim1_mod_maker") += + "pub.egorpugin.primitives.command"_dep + ; add_exe_with_common("unpaker") += "org.sw.demo.oberhumer.lzo.lzo"_dep, "org.sw.demo.xz_utils.lzma"_dep