summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKiritoDv <kiritodev01@gmail.com>2024-04-07 18:01:42 -0600
committerKiritoDv <kiritodev01@gmail.com>2024-04-07 18:01:42 -0600
commitf9449fa185a8789bdfd2c81ccfeebaed0f8686cc (patch)
treedc640af380a814eb5354672c7f0a4c1bc1cd8dfa /src
parent1507de12439a7b59093120e721b9677828bb83b2 (diff)
Fixed Solar and Zoness
Diffstat (limited to 'src')
-rw-r--r--src/engine/fox_edata_info.c4
-rw-r--r--src/engine/fox_std_lib.c2
-rw-r--r--src/port/Engine.cpp8
-rw-r--r--src/port/Engine.h2
-rw-r--r--src/port/GBIMiddleware.cpp3
-rw-r--r--src/port/resource/importers/GenericArrayFactory.cpp55
-rw-r--r--src/port/resource/importers/MessageLookupFactory.cpp3
-rw-r--r--src/port/resource/type/GenericArray.cpp4
-rw-r--r--src/port/resource/type/GenericArray.h9
9 files changed, 42 insertions, 48 deletions
diff --git a/src/engine/fox_edata_info.c b/src/engine/fox_edata_info.c
index 3a2f8611..59e9d7f2 100644
--- a/src/engine/fox_edata_info.c
+++ b/src/engine/fox_edata_info.c
@@ -145,7 +145,7 @@ ObjectInfo D_edata_800CC124[0x190] = {
/* OBJ_80_50, */ {(void*) D_VE1_6007410, 0, (ObjectFunc) NULL, D_VE1_601B518, 2500.0f, 0, 0, 40, 0, 0.0f, 0 },
/* OBJ_80_51, */ {(void*) D_VE1_6006F50, 0, (ObjectFunc) NULL, D_VE1_601B584, 2500.0f, 0, 0, 40, 0, 0.0f, 0 },
/* OBJ_80_52, */ {(void*) D_VE1_6005780, 0, (ObjectFunc) Venom1_80193540, D_VE1_601B5F4, 2500.0f, 0, 0, 40, 0, 0.0f, 0 },
- /* OBJ_80_53, */ {(void*) D_AQ_6003610, 0, (ObjectFunc) NULL, D_VE1_601B644, 2500.0f, 0, 0, 40, 0, 0.0f, 0 },
+ /* OBJ_80_53, */ {(void*) D_VE1_6003610, 0, (ObjectFunc) NULL, D_VE1_601B644, 2500.0f, 0, 0, 40, 0, 0.0f, 0 },
/* OBJ_80_54, */ {(void*) D_CO_6000E00, 0, (ObjectFunc) Obj54_Update, D_CO_603E0EC, 1000.0f, 0, 0, 40, 0, 0.0f, 0 },
/* OBJ_80_55, */ {(void*) D_CO_6013B50, 0, (ObjectFunc) NULL, D_CO_603E88C, 1000.0f, 0, 0, 41, 0, 0.0f, 0 },
/* OBJ_80_56, */ {(void*) Corneria_8018F31C, 2, (ObjectFunc) Corneria_8018F044, D_CO_603E8A8, 1000.0f, 0, 0, 39, 0, 0.0f, 0 },
@@ -243,7 +243,7 @@ ObjectInfo D_edata_800CC124[0x190] = {
/* OBJ_80_148 */ {(void*) D_FO_60079B0, 0, (ObjectFunc) NULL, D_FO_600FF80, 0.0f, 0, 0, 40, 0, 0.0f, 0 },
/* OBJ_80_149 */ {(void*) D_FO_6007D80, 0, (ObjectFunc) NULL, D_FO_600FFA0, 0.0f, 0, 0, 40, 0, 0.0f, 0 },
/* OBJ_80_150 */ {(void*) D_FO_6006310, 0, (ObjectFunc) NULL, D_FO_600FFC0, 0.0f, 0, 0, 40, 0, 0.0f, 0 },
- /* OBJ_80_151 */ {(void*) D_TI_60066E0, 0, (ObjectFunc) NULL, D_FO_600FEB8, 0.0f, 0, 0, 40, 0, 0.0f, 0 },
+ /* OBJ_80_151 */ {(void*) D_FO_60066E0, 0, (ObjectFunc) NULL, D_FO_600FEB8, 0.0f, 0, 0, 40, 0, 0.0f, 0 },
/* OBJ_80_152 */ {(void*) D_BO_600F4C0, 0, (ObjectFunc) NULL, D_BO_6011C10, 0.0f, 0, 0, 40, 0, 0.0f, 0 },
/* OBJ_80_153 */ {(void*) D_BO_600B8B0, 0, (ObjectFunc) NULL, D_BO_6011C48, 0.0f, 0, 0, 40, 0, 0.0f, 0 },
/* OBJ_80_154 */ {(void*) D_KA_600BAF0, 0, (ObjectFunc) NULL, D_KA_601115C, 0.0f, 0, 0, 40, 0, 0.0f, 0 },
diff --git a/src/engine/fox_std_lib.c b/src/engine/fox_std_lib.c
index fd2704fc..4754b7a6 100644
--- a/src/engine/fox_std_lib.c
+++ b/src/engine/fox_std_lib.c
@@ -26,7 +26,7 @@ s32 Graphics_Printf(const char* fmt, ...) {
}
void Texture_Scroll(u16* texture, s32 width, s32 height, u8 mode) {
- return;
+ // LTodo: [HD-Textures] This is broken
u16* temp_t0 = LOAD_ASSET(texture);
u16 temp_a3;
s32 var_a0;
diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp
index 7dd9da8c..c77bdb75 100644
--- a/src/port/Engine.cpp
+++ b/src/port/Engine.cpp
@@ -144,8 +144,12 @@ extern "C" uint32_t GameEngine_GetGameVersion() {
return 0x00000001;
}
-extern "C" int GameEngine_OTRSigCheck(const char* data) {
- static const char* sOtrSignature = "__OTR__";
+static const char* sOtrSignature = "__OTR__";
+
+extern "C" uint8_t GameEngine_OTRSigCheck(const char* data) {
+ if(data == nullptr) {
+ return 0;
+ }
return strncmp(data, sOtrSignature, strlen(sOtrSignature)) == 0;
}
diff --git a/src/port/Engine.h b/src/port/Engine.h
index 489b3a11..79c29533 100644
--- a/src/port/Engine.h
+++ b/src/port/Engine.h
@@ -31,5 +31,5 @@ class GameEngine {
#else
void GameEngine_ProcessGfxCommands(Gfx* commands);
float GameEngine_GetAspectRatio();
-int GameEngine_OTRSigCheck(char* imgData);
+uint8_t GameEngine_OTRSigCheck(char* imgData);
#endif \ No newline at end of file
diff --git a/src/port/GBIMiddleware.cpp b/src/port/GBIMiddleware.cpp
index 24f423fc..37b86004 100644
--- a/src/port/GBIMiddleware.cpp
+++ b/src/port/GBIMiddleware.cpp
@@ -13,6 +13,9 @@ extern "C" void gSPDisplayList(Gfx* pkt, Gfx* dl) {
auto resource = LUS::Context::GetInstance()->GetResourceManager()->LoadResource(imgData);
auto res = std::static_pointer_cast<LUS::DisplayList>(resource);
dl = &res->Instructions[0];
+ dl->words.trace.file = imgData;
+ dl->words.trace.idx = 0;
+ dl->words.trace.valid = true;
}
__gSPDisplayList(pkt, dl);
diff --git a/src/port/resource/importers/GenericArrayFactory.cpp b/src/port/resource/importers/GenericArrayFactory.cpp
index 3c0efc80..64608f44 100644
--- a/src/port/resource/importers/GenericArrayFactory.cpp
+++ b/src/port/resource/importers/GenericArrayFactory.cpp
@@ -23,90 +23,77 @@ std::shared_ptr<LUS::IResource> ResourceFactoryBinaryGenericArrayV0::ReadResourc
switch (static_cast<ArrayType>(type)) {
case ArrayType::u8: {
auto x = reader->ReadUByte();
- arr->mData.emplace_back(x);
+ arr->mData.push_back(x);
break;
}
case ArrayType::s8: {
auto x = reader->ReadInt8();
- arr->mData.emplace_back(x);
+ arr->mData.push_back(x);
break;
}
case ArrayType::u16: {
auto x = reader->ReadUInt16();
- arr->mData.emplace_back(x);
+ std::copy_n(reinterpret_cast<uint8_t*>(&x), 2, std::back_inserter(arr->mData));
break;
}
case ArrayType::s16: {
auto x = reader->ReadInt16();
- arr->mData.emplace_back(x);
+ std::copy_n(reinterpret_cast<uint8_t*>(&x), 2, std::back_inserter(arr->mData));
break;
}
case ArrayType::u32: {
auto x = reader->ReadUInt32();
- arr->mData.emplace_back(x);
+ std::copy_n(reinterpret_cast<uint8_t*>(&x), 4, std::back_inserter(arr->mData));
break;
}
case ArrayType::s32: {
auto x = reader->ReadInt32();
- arr->mData.emplace_back(x);
+ std::copy_n(reinterpret_cast<uint8_t*>(&x), 4, std::back_inserter(arr->mData));
break;
}
case ArrayType::u64: {
auto x = reader->ReadUInt64();
- arr->mData.emplace_back(x);
+ std::copy_n(reinterpret_cast<uint8_t*>(&x), 8, std::back_inserter(arr->mData));
break;
}
case ArrayType::f32: {
auto x = reader->ReadFloat();
- arr->mData.emplace_back(x);
+ std::copy_n(reinterpret_cast<uint8_t*>(&x), 4, std::back_inserter(arr->mData));
break;
}
case ArrayType::f64: {
auto x = reader->ReadDouble();
- arr->mData.emplace_back(x);
+ std::copy_n(reinterpret_cast<uint8_t*>(&x), 8, std::back_inserter(arr->mData));
break;
}
case ArrayType::Vec2f: {
- auto x = reader->ReadFloat();
- auto y = reader->ReadFloat();
- arr->mData.emplace_back(Vec2f(x, y));
+ Vec2f vec(reader->ReadFloat(), reader->ReadFloat());
+ std::copy_n(reinterpret_cast<uint8_t*>(&vec), sizeof(Vec2f), std::back_inserter(arr->mData));
break;
}
case ArrayType::Vec3f: {
- auto x = reader->ReadFloat();
- auto y = reader->ReadFloat();
- auto z = reader->ReadFloat();
- arr->mData.emplace_back(Vec3f(x, y, z));
+ Vec3f vec(reader->ReadFloat(), reader->ReadFloat(), reader->ReadFloat());
+ std::copy_n(reinterpret_cast<uint8_t*>(&vec), sizeof(Vec3f), std::back_inserter(arr->mData));
break;
}
case ArrayType::Vec3s: {
- auto x = reader->ReadInt16();
- auto y = reader->ReadInt16();
- auto z = reader->ReadInt16();
- arr->mData.emplace_back(Vec3s(x, y, z));
+ Vec3s vec(reader->ReadInt16(), reader->ReadInt16(), reader->ReadInt16());
+ std::copy_n(reinterpret_cast<uint8_t*>(&vec), sizeof(Vec3s), std::back_inserter(arr->mData));
break;
}
case ArrayType::Vec3i: {
- auto x = reader->ReadInt32();
- auto y = reader->ReadInt32();
- auto z = reader->ReadInt32();
- arr->mData.emplace_back(Vec3i(x, y, z));
+ Vec3i vec(reader->ReadInt32(), reader->ReadInt32(), reader->ReadInt32());
+ std::copy_n(reinterpret_cast<uint8_t*>(&vec), sizeof(Vec3i), std::back_inserter(arr->mData));
break;
}
case ArrayType::Vec4f: {
- auto x = reader->ReadFloat();
- auto y = reader->ReadFloat();
- auto z = reader->ReadFloat();
- auto w = reader->ReadFloat();
- arr->mData.emplace_back(Vec4f(x, y, z, w));
+ Vec4f vec(reader->ReadFloat(), reader->ReadFloat(), reader->ReadFloat(), reader->ReadFloat());
+ std::copy_n(reinterpret_cast<uint8_t*>(&vec), sizeof(Vec4f), std::back_inserter(arr->mData));
break;
}
case ArrayType::Vec4s: {
- auto x = reader->ReadInt16();
- auto y = reader->ReadInt16();
- auto z = reader->ReadInt16();
- auto w = reader->ReadInt16();
- arr->mData.emplace_back(Vec4s(x, y, z, w));
+ Vec4s vec(reader->ReadInt16(), reader->ReadInt16(), reader->ReadInt16(), reader->ReadInt16());
+ std::copy_n(reinterpret_cast<uint8_t*>(&vec), sizeof(Vec4s), std::back_inserter(arr->mData));
break;
}
}
diff --git a/src/port/resource/importers/MessageLookupFactory.cpp b/src/port/resource/importers/MessageLookupFactory.cpp
index 8cda5527..d1d20ac6 100644
--- a/src/port/resource/importers/MessageLookupFactory.cpp
+++ b/src/port/resource/importers/MessageLookupFactory.cpp
@@ -14,9 +14,10 @@ std::shared_ptr<LUS::IResource> ResourceFactoryBinaryMessageLookupV0::ReadResour
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
auto count = reader->ReadUInt32();
- for (uint32_t i = 0; i < count; i++) {
+ for (uint32_t i = 0; i < count - 1; i++) {
SPDLOG_INFO("Reading message lookup table entry {}", i);
auto id = reader->ReadInt32();
+
uint16_t* ptr = static_cast<uint16_t*>(ResourceGetDataByCrc(reader->ReadUInt64()));
table->mLookupTable.push_back({ id, ptr });
}
diff --git a/src/port/resource/type/GenericArray.cpp b/src/port/resource/type/GenericArray.cpp
index e7005d9c..74332a7e 100644
--- a/src/port/resource/type/GenericArray.cpp
+++ b/src/port/resource/type/GenericArray.cpp
@@ -1,11 +1,11 @@
#include "GenericArray.h"
namespace SF64 {
-GenericArrayData* GenericArray::GetPointer() {
+uint8_t* GenericArray::GetPointer() {
return mData.data();
}
size_t GenericArray::GetPointerSize() {
- return sizeof(mData);
+ return mData.size();
}
} \ No newline at end of file
diff --git a/src/port/resource/type/GenericArray.h b/src/port/resource/type/GenericArray.h
index ba2edcc4..576c6015 100644
--- a/src/port/resource/type/GenericArray.h
+++ b/src/port/resource/type/GenericArray.h
@@ -36,21 +36,20 @@ struct Vec4s {
Vec4s(int16_t x, int16_t y, int16_t z, int16_t w) : x(x), y(y), z(z), w(w) {}
};
-typedef std::variant<uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, float, double, Vec2f, Vec3f, Vec3s, Vec3i, Vec4f, Vec4s> GenericArrayData;
-
enum class ArrayType {
u8, s8, u16, s16, u32, s32, u64, f32, f64, Vec2f, Vec3f, Vec3s, Vec3i, Vec4f, Vec4s,
};
-class GenericArray : public LUS::Resource<GenericArrayData> {
+class GenericArray : public LUS::Resource<uint8_t> {
public:
using Resource::Resource;
GenericArray() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
- GenericArrayData* GetPointer();
+ uint8_t* GetPointer();
size_t GetPointerSize();
- std::vector<GenericArrayData> mData;
+ std::vector<uint8_t> mData;
+ size_t mSize;
};
} \ No newline at end of file