diff options
| author | MegaMech <MegaMech@users.noreply.github.com> | 2024-04-06 15:36:03 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-06 15:36:03 -0600 |
| commit | 24633ebd7cc6866da3e3d06fddc6f0f49a741f1d (patch) | |
| tree | 357a563fae006b04ded941ee534b1d6522f3fc32 /src/factories/DisplayListFactory.cpp | |
| parent | ad667b705dad3476a1ae803f23588c55baab2ee4 (diff) | |
Introduce Metadata and ItemCurve Factories (#27)
* Introduce metadata
* Metadata works now
* Cleanup
* Fixes
* Cleanup 2
* yaml improvement
* Comment update
* Rename tables to metadata
* Update
* Fix warnings
* Implement ItemCurve
* Remove unused enum
* Replace static with const
* Fix bug
* Add const
* More fixes
* Fix quote bug in IncludeFactory
* Fix header in ItemCurve
* Fixes
* Fix texture factory
* updates
* Clearer debug info
* Fixes
* Working ci8 png
* Fix size output
* Fix
* Add gitignore for modding
* Fix precision for mtx
* Remove header exporter from metadata
* Remove hardcoded enum
* Remove tabs
* Remove tabs
* tlut temp fix
---------
Co-authored-by: = <=>
Diffstat (limited to 'src/factories/DisplayListFactory.cpp')
| -rw-r--r-- | src/factories/DisplayListFactory.cpp | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/src/factories/DisplayListFactory.cpp b/src/factories/DisplayListFactory.cpp index b5d71dd..965645e 100644 --- a/src/factories/DisplayListFactory.cpp +++ b/src/factories/DisplayListFactory.cpp @@ -313,32 +313,35 @@ std::optional<std::shared_ptr<IParsedData>> DListFactory::parse(std::vector<uint } if(opcode == GBI(G_DL)) { + if (SEGMENT_NUMBER(node["offset"].as<uint32_t>()) == SEGMENT_NUMBER(w1)) { - std::optional<uint32_t> segment; + std::optional<uint32_t> segment; - if ((w0 >> 16) & G_DL_NO_PUSH) { - SPDLOG_INFO("Branch List Command Found"); - processing = false; - } + if ((w0 >> 16) & G_DL_NO_PUSH) { + SPDLOG_INFO("Branch List Command Found"); + processing = false; + } - YAML::Node gfx; - gfx["type"] = "GFX"; - gfx["offset"] = w1; - Companion::Instance->AddAsset(gfx); + YAML::Node gfx; + gfx["type"] = "GFX"; + gfx["offset"] = w1; + + Companion::Instance->AddAsset(gfx); + } } - // This opcode is generally used as part of multiple macros such as gsSPSetLights1. - // We need to process gsSPLight which is a subcommand inside G_MOVEMEM (0x03). + // This opcode is generally used as part of multiple macros such as gsSPSetLights1. + // We need to process gsSPLight which is a subcommand inside G_MOVEMEM (0x03). if(opcode == GBI(G_MOVEMEM)) { - // 0x03860000 or 0x03880000 subcommand will contain 0x86/0x88 for G_MV_L0 and G_MV_L1. Other subcommands also exist. - uint8_t subcommand = (w0 >> 16) & 0xFF; + // 0x03860000 or 0x03880000 subcommand will contain 0x86/0x88 for G_MV_L0 and G_MV_L1. Other subcommands also exist. + uint8_t subcommand = (w0 >> 16) & 0xFF; uint8_t index = 0; uint8_t offset = 0; bool light = false; switch (Companion::Instance->GetGBIVersion()) { - // If needing light generation on G_MV_L0 then we'll need to walk the DL ptr forward/backward to check for 0xBC - // Otherwise mk64 will break. + // If needing light generation on G_MV_L0 then we'll need to walk the DL ptr forward/backward to check for 0xBC + // Otherwise mk64 will break. // PD: Mega, this works for sm64 too, why you didn't implement it? >:( // PD: Im jk, <3 case GBIVersion::f3d: @@ -347,9 +350,9 @@ std::optional<std::shared_ptr<IParsedData>> DListFactory::parse(std::vector<uint * Only generate lights on the second gsSPLight. * gsSPSetLights1(name) outputs three macros: * - * gsSPNumLights(NUMLIGHTS_1) - * gsSPLight(&name.l[0], G_MV_L0) - * gsSPLight(&name.a, G_MV_L1) <-- This ptr is used to generate the lights + * gsSPNumLights(NUMLIGHTS_1) + * gsSPLight(&name.l[0], G_MV_L0) + * gsSPLight(&name.a, G_MV_L1) <-- This ptr is used to generate the lights */ if (subcommand == GBI(G_MV_L1)) { light = true; |
