summaryrefslogtreecommitdiff
path: root/src/factories/DisplayListFactory.cpp
diff options
context:
space:
mode:
authorMegaMech <MegaMech@users.noreply.github.com>2024-03-11 21:46:15 -0600
committerLywx <kiritodev01@gmail.com>2024-03-12 11:57:30 -0600
commita809755d7da0091f32d021fc24c82200305cb1cc (patch)
tree6433f981eddeec182e320cbffb5ff67c4580bd09 /src/factories/DisplayListFactory.cpp
parente4608e57763f86b8326422c8011db43d8b8d9b95 (diff)
Update DisplayListFactory.cpp
Diffstat (limited to 'src/factories/DisplayListFactory.cpp')
-rw-r--r--src/factories/DisplayListFactory.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/factories/DisplayListFactory.cpp b/src/factories/DisplayListFactory.cpp
index ae6bb80..73cb1b7 100644
--- a/src/factories/DisplayListFactory.cpp
+++ b/src/factories/DisplayListFactory.cpp
@@ -361,6 +361,7 @@ std::optional<std::shared_ptr<IParsedData>> DListFactory::parse(std::vector<uint
if(opcode == GBI(G_MOVEMEM)) {
uint8_t index = 0;
uint8_t offset = 0;
+ bool light = false;
switch (Companion::Instance->GetGBIVersion()) {
case GBIVersion::f3d:
@@ -371,6 +372,22 @@ std::optional<std::shared_ptr<IParsedData>> DListFactory::parse(std::vector<uint
}
break;
+ case GBIVersion::f3dex:
+ index = C0(0, 8);
+ offset = C0(8, 8) * 8;
+
+ /*
+ * Only generate lights on the second gsSPLight.
+ * gsSPSetLights1(name) outputs three macros:
+ *
+ * gsSPNumLights(NUMLIGHTS_1)
+ * gsSPLight(&name.l[0],1)
+ * gsSPLight(&name.a,2) <-- This ptr is used to generate the lights
+ */
+ if (index == GBI(G_MV_L1)) {
+ light = true;
+ }
+ break;
default: {
index = C0(0, 8);
offset = C0(8, 8) * 8;
@@ -381,7 +398,7 @@ std::optional<std::shared_ptr<IParsedData>> DListFactory::parse(std::vector<uint
}
}
- if(const auto decl = Companion::Instance->GetNodeByAddr(w1); !decl.has_value()){
+ if(const auto decl = Companion::Instance->GetNodeByAddr(w1); !decl.has_value() && light){
SPDLOG_INFO("Addr to Lights1 command at 0x{:X} not in yaml, autogenerating it", w1);
auto rom = Companion::Instance->GetRomData();
auto factory = Companion::Instance->GetFactory("LIGHTS")->get();
@@ -486,4 +503,4 @@ std::optional<std::shared_ptr<IParsedData>> DListFactory::parse(std::vector<uint
return std::make_shared<DListData>(gfxs);
-} \ No newline at end of file
+}