Merge pull request #243 from TwilitRealm/runtime-data-asset-loader

Runtime rel/dol asset loader
This commit is contained in:
TakaRikka
2026-04-06 23:22:41 -07:00
committed by GitHub
11 changed files with 278 additions and 27 deletions
+22
View File
@@ -10,11 +10,21 @@
#include "d/actor/d_a_b_gnd.h"
#include "d/d_com_inf_game.h"
#if TARGET_PC
#include "dusk/dvd_asset.hpp"
static u8* l_Egnd_mantTEX_get() { alignas(32) static u8 buf[0x4000]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", 0x1C00, 0x4000), true); return buf; }
static u8* l_Egnd_mantTEX_U_get() { alignas(32) static u8 buf[0x4000]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", 0x5C00, 0x4000), true); return buf; }
static u8* l_Egnd_mantPAL_get() { alignas(32) static u8 buf[0x60]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", 0x9C00, 0x60), true); return buf; }
#define l_Egnd_mantTEX (l_Egnd_mantTEX_get())
#define l_Egnd_mantTEX_U (l_Egnd_mantTEX_U_get())
#define l_Egnd_mantPAL (l_Egnd_mantPAL_get())
#else
#include "assets/l_Egnd_mantTEX.h"
#include "assets/l_Egnd_mantTEX_U.h"
#include "assets/l_Egnd_mantPAL.h"
#endif
#include "d/d_s_play.h"
static u32 l_pos[507] = {
@@ -239,20 +249,32 @@ static u32 l_texCoord[338] = {
0x3F800000, 0x00000000,
};
#if TARGET_PC
static u8* l_Egnd_mantDL_get() { alignas(32) static u8 buf[0x3EC]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", 0xA9A0, 0x3EC), true); return buf; }
#define l_Egnd_mantDL (l_Egnd_mantDL_get())
#else
#include "assets/l_Egnd_mantDL.h"
#endif
#if !TARGET_PC
static void* pal_d = (void*)&l_Egnd_mantPAL;
static void* tex_d[2] = {
(void*)&l_Egnd_mantTEX,
(void*)&l_Egnd_mantTEX_U,
};
#endif
static char lbl_277_bss_0;
void daMant_packet_c::draw() {
#if TARGET_PC
void* image = l_Egnd_mantTEX;
void* lut = l_Egnd_mantPAL;
#else
void* image = tex_d[0];
void* lut = pal_d;
#endif
j3dSys.reinitGX();
GXSetNumIndStages(0);
+23
View File
@@ -367,7 +367,30 @@ JKRHeap* daPy_anmHeap_c::setAnimeHeap() {
}
#if !PLATFORM_WII
#if TARGET_PC
#include "dusk/dvd_asset.hpp"
static const u8* l_sightDL_get() {
static u8 buf[0x89];
static bool _ = (
dusk::LoadDolAsset(
buf,
#if VERSION == VERSION_GCN_PAL
0x803BBDA0,
#elif VERSION == VERSION_GCN_JPN
0x803B4220,
#elif VERSION == VERSION_GCN_USA
0x803BA0C0,
#endif
0x89
),
true
);
return buf;
}
#define l_sightDL (l_sightDL_get())
#else
#include "assets/l_sightDL__d_a_player.h"
#endif
void daPy_sightPacket_c::draw() {
TGXTexObj texObj;
+40 -5
View File
@@ -13,7 +13,13 @@ const u16 l_J_Ohana00_64TEX__width = 63;
const u16 l_J_Ohana00_64TEX__height = 63;
#endif
#if TARGET_PC
#include "dusk/dvd_asset.hpp"
static u8* l_J_Ohana00_64TEX_get() { static u8 buf[0x800]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0x9060, 0x800), true); return buf; }
#define l_J_Ohana00_64TEX (l_J_Ohana00_64TEX_get())
#else
#include "assets/l_J_Ohana00_64TEX.h"
#endif
static u8 l_flowerPos[708] = {
0xC0, 0x8C, 0x2C, 0xF7, 0x42, 0x05, 0xBC, 0xDF, 0xC1, 0xA1, 0x00, 0x70, 0xBF, 0x50, 0x51, 0xB9,
@@ -104,6 +110,16 @@ static u8 l_flowerTexCoord[] = {
0x3E, 0xA7, 0x67, 0x4D, 0x3C, 0x14, 0x46, 0x74, 0x3E, 0xA7, 0x73, 0xE2, 0xBC, 0x2F, 0x46, 0xAA,
0x3E, 0xA7, 0x72, 0xD6, 0xBD, 0x2F, 0x46, 0xAA};
#if TARGET_PC
static u8* l_J_hana00DL_get() { static u8 buf[0x150]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0x9D20, 0x150), true); return buf; }
static u8* l_J_hana00_cDL_get() { static u8 buf[0xDE]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0x9E80, 0xDE), true); return buf; }
static u8* l_matDL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0x9F60, 0x99), true); return buf; }
static u8* l_matLight4DL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0xA000, 0x99), true); return buf; }
#define l_J_hana00DL (l_J_hana00DL_get())
#define l_J_hana00_cDL (l_J_hana00_cDL_get())
#define l_matDL (l_matDL_get())
#define l_matLight4DL (l_matLight4DL_get())
#else
#include "assets/l_J_hana00DL.h"
#include "assets/l_J_hana00_cDL.h"
@@ -113,6 +129,7 @@ l_matDL__d_a_grass(l_J_Ohana00_64TEX)
#include "assets/l_matLight4DL.h"
l_matLight4DL(l_J_Ohana00_64TEX)
#endif
#if TARGET_PC
const u16 l_J_Ohana01_64128_0419TEX__width = 64;
@@ -122,7 +139,12 @@ const u16 l_J_Ohana01_64128_0419TEX__width = 63;
const u16 l_J_Ohana01_64128_0419TEX__height = 127;
#endif
#if TARGET_PC
static u8* l_J_Ohana01_64128_0419TEX_get() { static u8 buf[0x1000]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0xA0A0, 0x1000), true); return buf; }
#define l_J_Ohana01_64128_0419TEX (l_J_Ohana01_64128_0419TEX_get())
#else
#include "assets/l_J_Ohana01_64128_0419TEX.h"
#endif
static u8 l_flowerPos2[1224] = {
0x40, 0x25, 0x9F, 0x34, 0x42, 0xC2, 0x95, 0x72, 0xC1, 0x22, 0x34, 0x78, 0x41, 0x4D, 0xF9, 0x63,
@@ -249,6 +271,18 @@ static u8 l_flowerTexCoord2[] = {
0x40, 0x1B, 0x7D, 0x52, 0x3F, 0x97, 0xF6, 0xBA, 0x40, 0x04, 0x26, 0x74, 0x3F, 0x80, 0x3F, 0x79,
0x40, 0x1B, 0x7D, 0x52, 0x3F, 0x80, 0x3F, 0x79, 0x40, 0x1B, 0x7D, 0x52, 0x3F, 0x51, 0x10, 0x6F};
#if TARGET_PC
static u8* l_J_hana01DL_get() { static u8 buf[0x138]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0xB7C0, 0x138), true); return buf; }
static u8* l_J_hana01_c_00DL_get() { static u8 buf[0xDE]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0xB900, 0xDE), true); return buf; }
static u8* l_J_hana01_c_01DL_get() { static u8 buf[0x128]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0xB9E0, 0x128), true); return buf; }
static u8* l_mat2DL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0xBB20, 0x99), true); return buf; }
static u8* l_mat2Light4DL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0xBBC0, 0x99), true); return buf; }
#define l_J_hana01DL (l_J_hana01DL_get())
#define l_J_hana01_c_00DL (l_J_hana01_c_00DL_get())
#define l_J_hana01_c_01DL (l_J_hana01_c_01DL_get())
#define l_mat2DL (l_mat2DL_get())
#define l_mat2Light4DL (l_mat2Light4DL_get())
#else
#include "assets/l_J_hana01DL.h"
#include "assets/l_J_hana01_c_00DL.h"
@@ -260,6 +294,7 @@ l_mat2DL__d_a_grass(l_J_Ohana01_64128_0419TEX)
#include "assets/l_mat2Light4DL.h"
l_mat2Light4DL(l_J_Ohana01_64128_0419TEX)
#endif
void dFlower_data_c::WorkCo(fopAc_ac_c* i_hitActor, u32 i_massFlg, int i_roomNo) {
cXyz sp8;
@@ -610,9 +645,9 @@ void dFlower_packet_c::draw() {
}
if (sp4C <= 2) {
GXCallDisplayList(&l_matLight4DL, 0x80);
GXCallDisplayList(l_matLight4DL, 0x80);
} else {
GXCallDisplayList(&l_matDL, 0x80);
GXCallDisplayList(l_matDL, 0x80);
}
GXSetTevColorS10(GX_TEVREG0, sp80);
@@ -668,9 +703,9 @@ void dFlower_packet_c::draw() {
#endif
if (!cLib_checkBit<u8>(sp44->m_state, 8)) {
GXCallDisplayList(&l_J_hana00DL, 0x140);
GXCallDisplayList(l_J_hana00DL, 0x140);
} else {
GXCallDisplayList(&l_J_hana00_cDL, 0xC0);
GXCallDisplayList(l_J_hana00_cDL, 0xC0);
}
}
}
@@ -817,7 +852,7 @@ void dFlower_packet_c::draw() {
if (!cLib_checkBit<u8>(sp34->m_state, 0x10)) {
GXCallDisplayList(mp_Jhana01DL, m_Jhana01DL_size);
} else {
GXCallDisplayList(&l_J_hana01_c_00DL, 0xC0);
GXCallDisplayList(l_J_hana01_c_00DL, 0xC0);
}
} else {
GXCallDisplayList(mp_Jhana01_cDL, m_Jhana01_cDL_size);
+26 -3
View File
@@ -13,11 +13,19 @@
const u16 l_M_Hijiki00TEX__width = 31;
const u16 l_M_Hijiki00TEX__height = 31;
#include "assets/l_M_kusa05_RGBATEX.h" // ALIGN 32
const u16 l_M_kusa05_RGBATEX__width = 31;
const u16 l_M_kusa05_RGBATEX__height = 31;
#include "assets/l_M_Hijiki00TEX.h" // ALIGN 32
#if TARGET_PC
#include "dusk/dvd_asset.hpp"
static u8* l_M_kusa05_RGBATEX_get() { static u8 buf[0x800]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0x7680, 0x800), true); return buf; }
static u8* l_M_Hijiki00TEX_get() { static u8 buf[0x800]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0x7E80, 0x800), true); return buf; }
#define l_M_kusa05_RGBATEX (l_M_kusa05_RGBATEX_get())
#define l_M_Hijiki00TEX (l_M_Hijiki00TEX_get())
#else
#include "assets/l_M_kusa05_RGBATEX.h" // ALIGN 32
#include "assets/l_M_Hijiki00TEX.h" // ALIGN 32
#endif
static u8 l_pos[960] = {
0x3F, 0x4A, 0x56, 0xEF, 0xC2, 0x20, 0x00, 0x00, 0x41, 0xFB, 0x17, 0xE4, 0x41, 0xAA, 0xBB, 0xEA,
@@ -102,6 +110,20 @@ static u8 l_texCoord[160] = {
0x3F, 0x94, 0x00, 0x00, 0x3F, 0x80, 0x00, 0x00, 0xBD, 0xC0, 0x00, 0x00, 0x3F, 0x80, 0x00, 0x00,
};
#if TARGET_PC
static u8* l_M_Kusa_9qDL_get() { static u8 buf[0xCB]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0x8B00, 0xCB), true); return buf; }
static u8* l_M_Kusa_9q_cDL_get() { static u8 buf[0xCB]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0x8BE0, 0xCB), true); return buf; }
static u8* l_M_TenGusaDL_get() { static u8 buf[0xD4]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0x8CC0, 0xD4), true); return buf; }
static u8* l_Tengusa_matDL_get() { static u8 buf[0xA8]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0x8DA0, 0xA8), true); return buf; }
static u8* l_kusa9q_matDL_get() { static u8 buf[0xA8]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0x8E60, 0xA8), true); return buf; }
static u8* l_kusa9q_l4_matDL_get() { static u8 buf[0xA8]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", 0x8F20, 0xA8), true); return buf; }
#define l_M_Kusa_9qDL (l_M_Kusa_9qDL_get())
#define l_M_Kusa_9q_cDL (l_M_Kusa_9q_cDL_get())
#define l_M_TenGusaDL (l_M_TenGusaDL_get())
#define l_Tengusa_matDL (l_Tengusa_matDL_get())
#define l_kusa9q_matDL (l_kusa9q_matDL_get())
#define l_kusa9q_l4_matDL (l_kusa9q_l4_matDL_get())
#else
#include "assets/l_M_Kusa_9qDL.h"
#include "assets/l_M_Kusa_9q_cDL.h"
@@ -117,6 +139,7 @@ l_kusa9q_matDL(l_M_kusa05_RGBATEX)
#include "assets/l_kusa9q_l4_matDL.h"
l_kusa9q_l4_matDL(l_M_kusa05_RGBATEX)
#endif
void dGrass_data_c::WorkCo(fopAc_ac_c* i_hitActor, u32 i_massFlg, int i_roomNo) {
cXyz sp18;