mirror of
https://github.com/izzy2lost/Ghostship.git
synced 2026-06-19 01:17:03 -07:00
Added wip dlist loading
This commit is contained in:
+2
-2
@@ -50,9 +50,9 @@ set(USE_NETWORKING ON)
|
||||
# Add compile definitions for the target
|
||||
add_compile_definitions(
|
||||
VERSION_US=1
|
||||
F3DEX_GBI_2=1
|
||||
GBI_FLOATS=1
|
||||
ENABLE_RUMBLE=1
|
||||
F3D_OLD=1
|
||||
GBI_FLOATS=1
|
||||
_LANGUAGE_C
|
||||
_USE_MATH_DEFINES
|
||||
CIMGUI_DEFINE_ENUMS_AND_STRUCTS
|
||||
|
||||
@@ -515,6 +515,14 @@ extern void patch_interpolated_paintings(void);
|
||||
extern void patch_interpolated_bubble_particles(void);
|
||||
extern void patch_interpolated_snow_particles(void);
|
||||
|
||||
// LUS
|
||||
|
||||
void gSPSegmentLoadRes(void* value, int segNum, uintptr_t target);
|
||||
void gSPDisplayList(Gfx* pkt, Gfx* dl);
|
||||
void gSPDisplayListOffset(Gfx* pkt, Gfx* dl, int offset);
|
||||
void gSPVertex(Gfx* pkt, uintptr_t v, int n, int v0);
|
||||
void gSPInvalidateTexCache(Gfx* pkt, uintptr_t texAddr);
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ const GeoLayout intro_geo_0002D0[] = {
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_ZBUFFER(0),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_ASM(0, geo_intro_tm_copyright),
|
||||
// GEO_ASM(0, geo_intro_tm_copyright),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_END(),
|
||||
|
||||
@@ -10,8 +10,6 @@ extern const GeoLayout intro_geo_mario_head_dizzy[];
|
||||
extern const GeoLayout intro_geo_000414[];
|
||||
|
||||
// leveldata
|
||||
extern const Gfx intro_seg7_dl_0700B3A0[];
|
||||
extern const Gfx intro_seg7_dl_0700C6A0[];
|
||||
extern const f32 intro_seg7_table_0700C790[];
|
||||
extern const f32 intro_seg7_table_0700C880[];
|
||||
|
||||
|
||||
+3
-751
File diff suppressed because it is too large
Load Diff
+1
-1
Submodule libultraship updated: e75054e386...2933b629dd
@@ -5,6 +5,7 @@
|
||||
#include "math_util.h"
|
||||
#include "game/memory.h"
|
||||
#include "graph_node.h"
|
||||
#include "port/Engine.h"
|
||||
|
||||
typedef void (*GeoLayoutCommandProc)(void);
|
||||
|
||||
@@ -780,7 +781,11 @@ struct GraphNode *process_geo_layout(struct AllocOnlyPool *pool, void *segptr) {
|
||||
gGeoLayoutStackIndex = 2;
|
||||
gGeoLayoutReturnIndex = 2; // stack index is often copied here?
|
||||
|
||||
gGeoLayoutCommand = segmented_to_virtual(segptr);
|
||||
if(GameEngine_OTRSigCheck(segptr) == 1){
|
||||
gGeoLayoutCommand = ResourceGetDataByName(segptr);
|
||||
} else {
|
||||
gGeoLayoutCommand = segmented_to_virtual(segptr);
|
||||
}
|
||||
|
||||
gGraphNodePool = pool;
|
||||
|
||||
@@ -788,7 +793,8 @@ struct GraphNode *process_geo_layout(struct AllocOnlyPool *pool, void *segptr) {
|
||||
gGeoLayoutStack[1] = 0;
|
||||
|
||||
while (gGeoLayoutCommand != NULL) {
|
||||
GeoLayoutJumpTable[gGeoLayoutCommand[0x00]]();
|
||||
uint8_t cmdId = gGeoLayoutCommand[0x00];
|
||||
GeoLayoutJumpTable[cmdId]();
|
||||
}
|
||||
|
||||
return gCurRootGraphNode;
|
||||
|
||||
@@ -25,8 +25,6 @@ extern const u8 eu_course_strings_de_table[];
|
||||
#endif
|
||||
|
||||
// from intro_segment7
|
||||
extern Gfx *intro_seg7_dl_0700B3A0;
|
||||
extern Gfx *intro_seg7_dl_0700C6A0;
|
||||
extern f32 intro_seg7_table_0700C790[];
|
||||
extern f32 intro_seg7_table_0700C880[];
|
||||
|
||||
|
||||
@@ -50,6 +50,9 @@ void patch_title_screen_scales(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static const u8 intro_seg7_dl_0700B3A0[] = "__OTR__levels/intro/intro_seg7_dl_0700B3A0";
|
||||
static const u8 intro_seg7_dl_0700C6A0[] = "__OTR__levels/intro/intro_seg7_dl_0700C6A0";
|
||||
|
||||
/**
|
||||
* Geo callback to render the "Super Mario 64" logo on the title screen
|
||||
*/
|
||||
@@ -104,7 +107,7 @@ Gfx *geo_intro_super_mario_64_logo(s32 state, struct GraphNode *node, UNUSED voi
|
||||
sIntroScalePos = dlIter;
|
||||
|
||||
gSPMatrix(dlIter++, scaleMat, G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_PUSH);
|
||||
gSPDisplayList(dlIter++, &intro_seg7_dl_0700B3A0); // draw model
|
||||
gSPDisplayList(dlIter++, intro_seg7_dl_0700B3A0); // draw model
|
||||
gSPPopMatrix(dlIter++, G_MTX_MODELVIEW);
|
||||
gSPEndDisplayList(dlIter);
|
||||
|
||||
@@ -138,7 +141,7 @@ Gfx *geo_intro_tm_copyright(s32 state, struct GraphNode *node, UNUSED void *cont
|
||||
gDPSetRenderMode(dlIter++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2);
|
||||
break;
|
||||
}
|
||||
gSPDisplayList(dlIter++, &intro_seg7_dl_0700C6A0); // draw model
|
||||
gSPDisplayList(dlIter++, intro_seg7_dl_0700C6A0); // draw model
|
||||
gSPEndDisplayList(dlIter);
|
||||
|
||||
// Once the "Super Mario 64" logo has just about zoomed fully, fade in the "TM" and copyright text
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "port/Enhancements/mods.h"
|
||||
#include <Fast3D/gfx_pc.h>
|
||||
#include <Fast3D/gfx_rendering_api.h>
|
||||
#include <SDL2/SDL_net.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
@@ -326,4 +327,18 @@ extern "C" uint8_t* GameEngine_LoadTranslation(const char* key) {
|
||||
assert(engine->dictionary->contains(key));
|
||||
|
||||
return engine->dictionary->at(key).data();
|
||||
}
|
||||
|
||||
extern "C" int GameEngine_OTRSigCheck(const char* data) {
|
||||
auto i = (uintptr_t)(data);
|
||||
if ((i & 1) == 1)
|
||||
return 0;
|
||||
|
||||
if (i != 0) {
|
||||
if (data[0] == '_' && data[1] == '_' && data[2] == 'O' && data[3] == 'T' && data[4] == 'R' &&
|
||||
data[5] == '_' && data[6] == '_')
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -59,4 +59,5 @@ uint8_t* GameEngine_LoadActName(uint32_t actId);
|
||||
uint8_t* GameEngine_LoadLevelName(uint32_t levelId);
|
||||
struct DialogEntry* GameEngine_LoadDialog(uint32_t dialogId);
|
||||
uint8_t* GameEngine_LoadTranslation(const char* key);
|
||||
int GameEngine_OTRSigCheck(char* imgData);
|
||||
#endif
|
||||
@@ -0,0 +1,46 @@
|
||||
#include <libultraship.h>
|
||||
|
||||
#include "Engine.h"
|
||||
#include "DisplayList.h"
|
||||
#include "Array.h"
|
||||
|
||||
extern "C" int GameEngine_OTRSigCheck(const char* data);
|
||||
|
||||
extern "C" void gSPDisplayList(Gfx* pkt, Gfx* dl) {
|
||||
char* imgData = (char*)dl;
|
||||
|
||||
if (GameEngine_OTRSigCheck(imgData) == 1) {
|
||||
auto resource = LUS::Context::GetInstance()->GetResourceManager()->LoadResource(imgData);
|
||||
auto res = std::static_pointer_cast<LUS::DisplayList>(resource);
|
||||
dl = (Gfx*)&res->Instructions[0];
|
||||
}
|
||||
|
||||
__gSPDisplayList(pkt, dl);
|
||||
}
|
||||
|
||||
extern "C" void gSPVertex(Gfx* pkt, uintptr_t v, int n, int v0) {
|
||||
|
||||
if (GameEngine_OTRSigCheck((char*)v) == 1) {
|
||||
v = (uintptr_t) ResourceGetDataByName((char *) v);
|
||||
}
|
||||
|
||||
__gSPVertex(pkt, v, n, v0);
|
||||
}
|
||||
|
||||
extern "C" void gSPInvalidateTexCache(Gfx* pkt, uintptr_t texAddr) {
|
||||
char* imgData = (char*)texAddr;
|
||||
|
||||
if (texAddr != 0 && GameEngine_OTRSigCheck(imgData)) {
|
||||
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResource(imgData);
|
||||
|
||||
if (res->GetInitData()->Type == LUS::ResourceType::DisplayList)
|
||||
texAddr = (uintptr_t)&((std::static_pointer_cast<LUS::DisplayList>(res))->Instructions[0]);
|
||||
else if (res->GetInitData()->Type == LUS::ResourceType::Array)
|
||||
texAddr = (uintptr_t)(std::static_pointer_cast<LUS::Array>(res))->Vertices.data();
|
||||
else {
|
||||
texAddr = (uintptr_t) res->GetRawPointer();
|
||||
}
|
||||
}
|
||||
// OTRTODO:
|
||||
// __gSPInvalidateTexCache(pkt, texAddr);
|
||||
}
|
||||
Reference in New Issue
Block a user