mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-06-01 09:48:10 -04:00
uniform GameEngine_OTRSigCheck
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
uint8_t GameEngine_OTRSigCheck(char* imgData);
|
||||
bool GameEngine_OTRSigCheck(char* imgData);
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define ALIGN_ASSET(x) __declspec(align(x))
|
||||
|
||||
+1
-2
@@ -371,8 +371,7 @@ extern "C" uint32_t GameEngine_GetGameVersion() {
|
||||
|
||||
static const char* sOtrSignature = "__OTR__";
|
||||
|
||||
extern "C" uint8_t GameEngine_OTRSigCheck(const char* data) {
|
||||
static const char* sOtrSignaturea = "__OTR__";
|
||||
extern "C" bool GameEngine_OTRSigCheck(const char* data) {
|
||||
return strncmp(data, sOtrSignature, strlen(sOtrSignature)) == 0;
|
||||
}
|
||||
|
||||
|
||||
+8
-2
@@ -53,7 +53,11 @@ class GameEngine {
|
||||
uint32_t OTRGetGameRenderWidth();
|
||||
uint32_t OTRGetGameRenderHeight();
|
||||
};
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void GameEngine_ProcessGfxCommands(Gfx* commands);
|
||||
uint32_t GameEngine_GetSampleRate();
|
||||
uint32_t GameEngine_GetSamplesPerFrame();
|
||||
@@ -65,7 +69,7 @@ struct AudioSequenceData* GameEngine_LoadSequence(uint8_t seqId);
|
||||
uint32_t GameEngine_GetSequenceCount();
|
||||
uint8_t GameEngine_IsSequenceLoaded(uint8_t seqId);
|
||||
void GameEngine_UnloadSequence(uint8_t seqId);
|
||||
uint8_t GameEngine_OTRSigCheck(char* imgData);
|
||||
// bool GameEngine_OTRSigCheck(char* imgData); -> align_asset_macro.h
|
||||
float OTRGetAspectRatio(void);
|
||||
float OTRGetDimensionFromLeftEdge(float v);
|
||||
float OTRGetDimensionFromRightEdge(float v);
|
||||
@@ -73,4 +77,6 @@ int16_t OTRGetRectDimensionFromLeftEdge(float v);
|
||||
int16_t OTRGetRectDimensionFromRightEdge(float v);
|
||||
uint32_t OTRGetGameRenderWidth(void);
|
||||
uint32_t OTRGetGameRenderHeight(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
#include "DisplayList.h"
|
||||
#include "resource/type/ResourceType.h"
|
||||
#include "resource/type/Array.h"
|
||||
|
||||
extern "C" int GameEngine_OTRSigCheck(const char* data);
|
||||
extern "C" {
|
||||
#include <align_asset_macro.h>
|
||||
}
|
||||
|
||||
extern "C" void gSPDisplayList(Gfx* pkt, Gfx* dl) {
|
||||
char* imgData = (char*) dl;
|
||||
|
||||
if (GameEngine_OTRSigCheck(imgData) == 1) {
|
||||
if (GameEngine_OTRSigCheck(imgData)) {
|
||||
auto resource = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(imgData);
|
||||
auto res = std::static_pointer_cast<LUS::DisplayList>(resource);
|
||||
dl = &res->Instructions[0];
|
||||
@@ -21,7 +22,7 @@ extern "C" void gSPDisplayList(Gfx* pkt, Gfx* dl) {
|
||||
|
||||
extern "C" void gSPVertex(Gfx* pkt, uintptr_t v, int n, int v0) {
|
||||
|
||||
if (GameEngine_OTRSigCheck((char*) v) == 1) {
|
||||
if (GameEngine_OTRSigCheck((char*) v)) {
|
||||
v = (uintptr_t) ResourceGetDataByName((char*) v);
|
||||
}
|
||||
|
||||
@@ -31,7 +32,7 @@ extern "C" void gSPVertex(Gfx* pkt, uintptr_t v, int n, int v0) {
|
||||
extern "C" void gSPInvalidateTexCache(Gfx* pkt, uintptr_t texAddr) {
|
||||
auto data = reinterpret_cast<char*>(texAddr);
|
||||
|
||||
if (texAddr != 0 && GameEngine_OTRSigCheck(data) == 1) {
|
||||
if (texAddr != 0 && GameEngine_OTRSigCheck(data)) {
|
||||
const auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(data);
|
||||
const auto type = static_cast<LUS::ResourceType>(res->GetInitData()->Type);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user