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
+1 -3
View File
@@ -104,9 +104,7 @@ set(GAME_INCLUDE_DIRS
libs/JSystem/include
libs
extern/aurora/include/dolphin
extern
${CMAKE_SOURCE_DIR}/build/${DUSK_TP_VERSION}/include
build/${DUSK_TP_VERSION}/include)
extern)
set(GAME_LIBS aurora::core aurora::gx aurora::gd aurora::si aurora::vi aurora::pad aurora::mtx aurora::os aurora::dvd
aurora::card freeverb cxxopts::cxxopts absl::flat_hash_map nlohmann_json::nlohmann_json)
+6 -7
View File
@@ -37,25 +37,24 @@
sudo dnf groupinstall "Development Tools" "Development Libraries"
```
#### Setup
1. Clone and initialize the Dusk repository
Clone and initialize the Dusk repository
```sh
git clone --recursive https://github.com/TakaRikka/dusk.git
cd dusk
git pull
git submodule update --recursive
```
2. Generate assets
```sh
cp /path/to/GZ2E01.iso orig/GZ2E01/.
python3 ./configure.py
ninja
```
#### Building
**Visual Studio (Recommended for Windows)**
```sh
cmake -B build/dusk -G "Visual Studio 17 2022" -A x64 # Win32 for 32bit
```
**Visual Studio Code with ninja**
Project has support for the CMakeTools extension with variants and has a debug launch target
**ninja (Windows/macOS/Linux)**
```sh
cmake -B build/dusk -GNinja
+2
View File
@@ -1333,6 +1333,8 @@ set(DOLPHIN_FILES
set(DUSK_FILES
include/dusk/endian_gx.hpp
include/dusk/config.hpp
include/dusk/dvd_asset.hpp
src/dusk/dvd_asset.cpp
src/d/actor/d_a_alink_dusk.cpp
src/dusk/asserts.cpp
src/dusk/config.cpp
+22
View File
@@ -0,0 +1,22 @@
#pragma once
#include "dolphin/types.h"
namespace dusk {
/**
* Load bytes from the main DOL by GameCube virtual address
*/
bool LoadDolAsset(void* dst, u32 virtualAddress, s32 size);
/**
* Load bytes from a REL file in the ISO filesystem, dst must be 32-byte aligned
*/
bool LoadRelAsset(void* dst, const char* dvdPath, s32 offset, s32 size);
/**
* Load bytes from a REL inside RELS.arc
*/
bool LoadArchivedRelAsset(void* dst, u32 memType, const char* relFileName, s32 offset, s32 size);
} // namespace dusk
+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;
+8 -9
View File
@@ -15,6 +15,7 @@
#include "m_Do/m_Do_Reset.h"
#include "m_Do/m_Do_graphic.h"
#if !TARGET_PC
#include "assets/black_tex.h"
#include "assets/msg_data.h"
#if VERSION == VERSION_GCN_PAL
@@ -24,6 +25,7 @@
#include "assets/msg_data_it.h"
#endif
#include "assets/font_data.h"
#endif
#define MSG_READING_DISC 0
#define MSG_COVER_OPEN 1
@@ -49,6 +51,7 @@ struct BMG_INF1 : JUTDataBlockHeader {
#endif
static void messageSet(u32 status, bool i_drawBg) {
#if !TARGET_PC
BMG_INF1* inf1;
const char* msg_p;
@@ -177,9 +180,11 @@ static void messageSet(u32 status, bool i_drawBg) {
tpane.draw(x, y + 10.0f, FB_WIDTH, HBIND_LEFT);
#endif
#endif
#endif
}
void dDvdErrorMsg_c::draw(s32 status) {
#if !TARGET_PC
JUtility::TColor backColor = g_clearColor;
JFWDisplay::getManager()->setClearColor(backColor);
mDoGph_gInf_c::beginRender();
@@ -207,6 +212,7 @@ void dDvdErrorMsg_c::draw(s32 status) {
mDoGph_gInf_c::endRender();
JFWDisplay::getManager()->resetFader();
#endif
}
bool dDvdErrorMsg_c::execute() {
@@ -237,16 +243,12 @@ bool dDvdErrorMsg_c::execute() {
static u8 l_captureAlpha = 0xFF;
static void drawCapture(u8 alpha) {
#if !TARGET_PC
static bool l_texCopied = false;
if (!l_texCopied) {
#if TARGET_PC
GXSetTexCopySrc(0, 0, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight());
GXSetTexCopyDst(mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), (GXTexFmt)mDoGph_gInf_c::getFrameBufferTimg()->format, GX_TRUE);
#else
GXSetTexCopySrc(0, 0, FB_WIDTH, FB_HEIGHT);
GXSetTexCopyDst(FB_WIDTH / 2, FB_HEIGHT / 2, (GXTexFmt)mDoGph_gInf_c::getFrameBufferTimg()->format, GX_TRUE);
#endif
GXCopyTex(mDoGph_gInf_c::getFrameBufferTex(), GX_FALSE);
l_texCopied = true;
}
@@ -256,9 +258,6 @@ static void drawCapture(u8 alpha) {
GXSetAlphaUpdate(GX_FALSE);
j3dSys.drawInit();
#ifdef TARGET_PC
mDoGph_gInf_c::getFrameBufferTexObj()->reset();
#endif
GXInitTexObj(mDoGph_gInf_c::getFrameBufferTexObj(), mDoGph_gInf_c::getFrameBufferTex(), FB_WIDTH / 2, FB_HEIGHT / 2, (GXTexFmt)mDoGph_gInf_c::getFrameBufferTimg()->format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GXInitTexObjLOD(mDoGph_gInf_c::getFrameBufferTexObj(), GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1);
GXLoadTexObj(mDoGph_gInf_c::getFrameBufferTexObj(), GX_TEXMAP0);
@@ -298,6 +297,7 @@ static void drawCapture(u8 alpha) {
mDoGph_drawFilterQuad(1, 1);
mDoGph_gInf_c::endRender();
JFWDisplay::getManager()->resetFader();
#endif
}
bool dShutdownErrorMsg_c::execute() {
@@ -325,6 +325,5 @@ bool dShutdownErrorMsg_c::execute() {
mDoRst_reset(1, 1, 1);
}
}
return true;
}
+125
View File
@@ -0,0 +1,125 @@
#include "dusk/dvd_asset.hpp"
#include "dusk/logging.h"
#include "dusk/endian.h"
#include "dolphin/dvd.h"
#include "DynamicLink.h"
#include "JSystem/JKernel/JKRArchive.h"
#include "JSystem/JKernel/JKRDvdRipper.h"
#include <cstring>
namespace dusk {
static const u8* s_dolData = nullptr; // pointer to dol data
static size_t s_dolSize = 0;
struct DolHeader {
BE(u32) textOffset[7];
BE(u32) dataOffset[11];
BE(u32) textAddr[7];
BE(u32) dataAddr[11];
BE(u32) textSize[7];
BE(u32) dataSize[11];
};
struct DolSection {
u32 fileOffset;
u32 vaddr;
u32 size;
};
static DolSection s_dolSections[18]; // 7 text + 11 data
static int s_dolSectionCount = 0;
static bool EnsureDolParsed() {
if (s_dolData) return true;
s32 sz = 0;
const u8* p = DVDGetDOLLocation(&sz);
if (!p || sz < 256) {
DuskLog.fatal("dvd_asset: DVDGetDOLLocation failed (size={})", sz);
return false;
}
s_dolData = p;
s_dolSize = sz;
const auto* hdr = (const DolHeader*)s_dolData;
s_dolSectionCount = 0;
for (int i = 0; i < 7; i++) {
u32 off = hdr->textOffset[i];
u32 addr = hdr->textAddr[i];
u32 sz = hdr->textSize[i];
if (sz > 0 && off > 0) {
s_dolSections[s_dolSectionCount++] = {off, addr, sz};
}
}
for (int i = 0; i < 11; i++) {
u32 off = hdr->dataOffset[i];
u32 addr = hdr->dataAddr[i];
u32 sz = hdr->dataSize[i];
if (sz > 0 && off > 0) {
s_dolSections[s_dolSectionCount++] = {off, addr, sz};
}
}
return true;
}
static s32 DolVaToFileOffset(u32 va) {
if (!EnsureDolParsed()) return -1;
for (int i = 0; i < s_dolSectionCount; i++) {
const auto& sec = s_dolSections[i];
if (va >= sec.vaddr && va < sec.vaddr + sec.size) {
return static_cast<s32>(sec.fileOffset + (va - sec.vaddr));
}
}
DuskLog.fatal("dvd_asset: VA 0x{:08X} not found in any DOL section", va);
return -1;
}
bool LoadDolAsset(void* dst, u32 virtualAddress, s32 size) {
s32 fileOffset = DolVaToFileOffset(virtualAddress);
if (fileOffset < 0) {
return false;
}
if (size <= 0 || (size_t)(fileOffset + size) > s_dolSize) {
DuskLog.fatal("dvd_asset: DOL read out of range (offset={:#x} size={:#x} dolSize={})", fileOffset, size, s_dolSize);
return false;
}
std::memcpy(dst, s_dolData + fileOffset, size);
return true;
}
bool LoadRelAsset(void* dst, const char* dvdPath, s32 offset, s32 size) {
void* p = JKRDvdRipper::loadToMainRAM(dvdPath, (u8*)dst, EXPAND_SWITCH_UNKNOWN1, (u32)size, nullptr, JKRDvdRipper::ALLOC_DIRECTION_FORWARD, (u32)offset, nullptr, nullptr);
if (!p) DuskLog.fatal("dvd_asset: failed to load {} (offset={:#x} size={:#x})", dvdPath, offset, size);
return p != nullptr;
}
bool LoadArchivedRelAsset(void* dst, u32 memType, const char* relFileName, s32 offset, s32 size) {
// On TARGET_PC, cDyl_InitCallback skips DynamicModuleControl::initialize() due to static linking
// Mount RELS.arc on first use so sArchive is available
static bool s_mountAttempted = false;
if (!DynamicModuleControl::sArchive && !s_mountAttempted) {
s_mountAttempted = true; DynamicModuleControl::initialize();
}
if (!DynamicModuleControl::sArchive) {
DuskLog.fatal("dvd_asset: RELS archive not mounted"); return false;
}
const u8* rel = static_cast<const u8*>(DynamicModuleControl::sArchive->getResource(memType, relFileName));
if (!rel) {
DuskLog.fatal("dvd_asset: {} not found in RELS archive", relFileName); return false;
}
std::memcpy(dst, rel + offset, size);
return true;
}
} // namespace dusk
+3
View File
@@ -2873,7 +2873,10 @@ void mDoExt_3DlineMat1_c::update(int param_0, f32 param_1, GXColor& param_2, u16
sp_38++;
}
}
#if !TARGET_PC
#include "assets/l_mat2DL__d_a_grass.h"
#endif
void mDoExt_3DlineMat2_c::setMaterial() {
j3dSys.reinitGX();