mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Gfx Vtx vanilla only duplicates (#733)
Some changes for gfx vtx duplication: - Only vanilla (read-only) stuff is duplicated - Stuff is duplicated only once, and uses a map rom->ram for next iterations - Stuff is restored to original values on network shutdown also fixes incorrect types in some extern declarations
This commit is contained in:
parent
e46d3185cb
commit
b190ee09fb
15 changed files with 3111 additions and 159 deletions
|
|
@ -1,7 +1,7 @@
|
|||
extern const GeoLayout error_model_geo[];
|
||||
extern Lights1 error_model_f3d_material_lights;
|
||||
extern Vtx error_model_error_bone_mesh_layer_1_vtx_0[336];
|
||||
extern Gfx error_model_error_bone_mesh_layer_1_tri_0[];
|
||||
extern Gfx mat_error_model_f3d_material[];
|
||||
extern Gfx error_model_error_bone_mesh_layer_1[];
|
||||
extern Gfx error_model_material_revert_render_settings[];
|
||||
extern const Lights1 error_model_f3d_material_lights;
|
||||
extern const Vtx error_model_error_bone_mesh_layer_1_vtx_0[336];
|
||||
extern const Gfx error_model_error_bone_mesh_layer_1_tri_0[];
|
||||
extern const Gfx mat_error_model_f3d_material[];
|
||||
extern const Gfx error_model_error_bone_mesh_layer_1[];
|
||||
extern const Gfx error_model_material_revert_render_settings[];
|
||||
|
|
|
|||
|
|
@ -2,3 +2,4 @@
|
|||
python3 ./autogen/convert_structs.py $1
|
||||
python3 ./autogen/convert_functions.py $1
|
||||
python3 ./autogen/convert_constants.py $1
|
||||
python3 ./autogen/extract_display_lists.py $1
|
||||
|
|
|
|||
122
autogen/extract_display_lists.py
Normal file
122
autogen/extract_display_lists.py
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
DIRECTORIES = [
|
||||
"actors",
|
||||
"bin",
|
||||
"levels",
|
||||
]
|
||||
|
||||
FILE_EXTENSIONS = [
|
||||
".c",
|
||||
".h",
|
||||
]
|
||||
|
||||
CUSTOM_DEFINED = [
|
||||
"dl_billboard_num3_0",
|
||||
"dl_billboard_num3_1",
|
||||
"dl_billboard_num3_2",
|
||||
"dl_billboard_num3_3",
|
||||
"dl_billboard_num3_4",
|
||||
"dl_billboard_num3_5",
|
||||
"dl_billboard_num3_6",
|
||||
"dl_billboard_num3_7",
|
||||
"dl_billboard_num3_8",
|
||||
"dl_billboard_num3_9",
|
||||
"dl_billboard_num3_0x",
|
||||
"dl_billboard_num3_1x",
|
||||
"dl_billboard_num3_2x",
|
||||
"dl_billboard_num3_3x",
|
||||
"dl_billboard_num3_4x",
|
||||
"dl_billboard_num3_5x",
|
||||
"dl_billboard_num3_6x",
|
||||
"dl_billboard_num3_7x",
|
||||
"dl_billboard_num3_8x",
|
||||
"dl_billboard_num3_9x",
|
||||
"dl_billboard_num3_x0",
|
||||
"dl_billboard_num3_x1",
|
||||
"dl_billboard_num3_x2",
|
||||
"dl_billboard_num3_x3",
|
||||
"dl_billboard_num3_x4",
|
||||
"dl_billboard_num3_x5",
|
||||
"dl_billboard_num3_x6",
|
||||
"dl_billboard_num3_x7",
|
||||
"dl_billboard_num3_x8",
|
||||
"dl_billboard_num3_x9",
|
||||
"dl_billboard_num3_0xx",
|
||||
"dl_billboard_num3_1xx",
|
||||
"dl_billboard_num3_2xx",
|
||||
"dl_billboard_num3_3xx",
|
||||
"dl_billboard_num3_4xx",
|
||||
"dl_billboard_num3_5xx",
|
||||
"dl_billboard_num3_6xx",
|
||||
"dl_billboard_num3_7xx",
|
||||
"dl_billboard_num3_8xx",
|
||||
"dl_billboard_num3_9xx",
|
||||
"dl_billboard_num3_x0x",
|
||||
"dl_billboard_num3_x1x",
|
||||
"dl_billboard_num3_x2x",
|
||||
"dl_billboard_num3_x3x",
|
||||
"dl_billboard_num3_x4x",
|
||||
"dl_billboard_num3_x5x",
|
||||
"dl_billboard_num3_x6x",
|
||||
"dl_billboard_num3_x7x",
|
||||
"dl_billboard_num3_x8x",
|
||||
"dl_billboard_num3_x9x",
|
||||
"dl_billboard_num3_xx0",
|
||||
"dl_billboard_num3_xx1",
|
||||
"dl_billboard_num3_xx2",
|
||||
"dl_billboard_num3_xx3",
|
||||
"dl_billboard_num3_xx4",
|
||||
"dl_billboard_num3_xx5",
|
||||
"dl_billboard_num3_xx6",
|
||||
"dl_billboard_num3_xx7",
|
||||
"dl_billboard_num3_xx8",
|
||||
"dl_billboard_num3_xx9",
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
verbose = len(sys.argv) > 1 and (sys.argv[1] == "-v" or sys.argv[1] == "--verbose")
|
||||
pattern = re.compile("[\W]+")
|
||||
display_lists = []
|
||||
for dir in DIRECTORIES:
|
||||
for root, _, filenames in os.walk(dir):
|
||||
for filename in filenames:
|
||||
if filename[filename.rfind("."):] in FILE_EXTENSIONS:
|
||||
display_lists_in_file = []
|
||||
filepath = os.path.join(root, filename)
|
||||
lines = open(filepath, "r").readlines()
|
||||
ignore = False
|
||||
for line in lines:
|
||||
if ("#ifdef VERSION_EU" in line or
|
||||
"#ifdef VERSION_SH" in line or
|
||||
"#ifdef VERSION_JP" in line):
|
||||
ignore = True
|
||||
if "#endif" in line:
|
||||
ignore = False
|
||||
if not ignore and "Gfx" in line and "static" not in line and "extern" not in line and "#" not in line:
|
||||
identifiers = pattern.sub(" ", line).split()
|
||||
index_gfx = identifiers.index("Gfx")
|
||||
name = identifiers[index_gfx + 1]
|
||||
if name not in display_lists:
|
||||
display_lists.append(name)
|
||||
if verbose:
|
||||
display_lists_in_file.append(name)
|
||||
if verbose and display_lists_in_file:
|
||||
print("%s\n %s" % (filepath, "\n ".join(display_lists_in_file)))
|
||||
|
||||
# Add these manually because they are defined by a macro
|
||||
display_lists += CUSTOM_DEFINED
|
||||
|
||||
with open("include/display_lists.inl", "w") as f:
|
||||
for name in display_lists:
|
||||
f.write("DISPLAY_LIST(%s)\n" % (name))
|
||||
|
||||
print("Total display lists: %d" % (len(display_lists)))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
@ -79,7 +79,8 @@ struct GraphNode* dynos_model_load_dl(u32* aId, enum ModelPool aModelPool, u8 aL
|
|||
struct GraphNode* dynos_model_store_geo(u32* aId, enum ModelPool aModelPool, void* aAsset, struct GraphNode* aGraphNode);
|
||||
struct GraphNode* dynos_model_get_geo(u32 aId);
|
||||
void dynos_model_overwrite_slot(u32 srcSlot, u32 dstSlot);
|
||||
Gfx *dynos_model_duplicate_displaylist(Gfx* gfx);
|
||||
Gfx *dynos_model_get_writable_display_list(Gfx* gfx);
|
||||
void dynos_model_restore_vanilla_display_lists();
|
||||
u32 dynos_model_get_id_from_asset(void* aAsset);
|
||||
u32 dynos_model_get_id_from_graph_node(struct GraphNode* aGraphNode);
|
||||
void dynos_model_clear_pool(enum ModelPool aModelPool);
|
||||
|
|
|
|||
|
|
@ -865,6 +865,8 @@ const void* DynOS_Builtin_Func_GetFromName(const char* aDataName);
|
|||
const void* DynOS_Builtin_Func_GetFromIndex(s32 aIndex);
|
||||
const char * DynOS_Builtin_Func_GetNameFromIndex(s64 aIndex);
|
||||
s32 DynOS_Builtin_Func_GetIndexFromData(const void* aData);
|
||||
const Gfx * DynOS_Builtin_Gfx_GetFromName(const char *aDataName);
|
||||
const char * DynOS_Builtin_Gfx_GetFromData(const Gfx *aData);
|
||||
|
||||
//
|
||||
// Pack Manager
|
||||
|
|
@ -972,7 +974,8 @@ struct GraphNode* DynOS_Model_GetGeo(u32 aId);
|
|||
u32 DynOS_Model_GetIdFromAsset(void* asset);
|
||||
u32 DynOS_Model_GetIdFromGraphNode(struct GraphNode* aNode);
|
||||
void DynOS_Model_OverwriteSlot(u32 srcSlot, u32 dstSlot);
|
||||
Gfx *DynOS_Model_Duplicate_DisplayList(Gfx* aGfx);
|
||||
Gfx *DynOS_Model_GetWritableDisplayList(Gfx* aGfx);
|
||||
void DynOS_Model_RestoreVanillaDisplayLists();
|
||||
void DynOS_Model_ClearPool(enum ModelPool aModelPool);
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -270,8 +270,12 @@ void dynos_model_overwrite_slot(u32 srcSlot, u32 dstSlot) {
|
|||
DynOS_Model_OverwriteSlot(srcSlot, dstSlot);
|
||||
}
|
||||
|
||||
Gfx *dynos_model_duplicate_displaylist(Gfx* gfx) {
|
||||
return DynOS_Model_Duplicate_DisplayList(gfx);
|
||||
Gfx *dynos_model_get_writable_display_list(Gfx* gfx) {
|
||||
return DynOS_Model_GetWritableDisplayList(gfx);
|
||||
}
|
||||
|
||||
void dynos_model_restore_vanilla_display_lists() {
|
||||
return DynOS_Model_RestoreVanillaDisplayLists();
|
||||
}
|
||||
|
||||
// -- other -- //
|
||||
|
|
|
|||
|
|
@ -126,9 +126,9 @@ extern "C" {
|
|||
} \
|
||||
return NULL;
|
||||
|
||||
///////////////////////
|
||||
// Function Pointers //
|
||||
///////////////////////
|
||||
/////////////////////
|
||||
// Script Pointers //
|
||||
/////////////////////
|
||||
|
||||
static const void* sDynosBuiltinScriptPtrs[] = {
|
||||
define_builtin(level_main_scripts_entry),
|
||||
|
|
@ -2060,3 +2060,21 @@ s32 DynOS_Builtin_Func_GetIndexFromData(const void* aData) {
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
///////////////////
|
||||
// Display Lists //
|
||||
///////////////////
|
||||
|
||||
static const void *sDynosBuiltinDisplayLists[] = {
|
||||
#define DISPLAY_LIST(name) define_builtin(name),
|
||||
#include "include/display_lists.inl"
|
||||
#undef DISPLAY_LIST
|
||||
};
|
||||
|
||||
const Gfx *DynOS_Builtin_Gfx_GetFromName(const char *aDataName) {
|
||||
MGR_FIND_DATA(sDynosBuiltinDisplayLists, (const Gfx *));
|
||||
}
|
||||
|
||||
const char *DynOS_Builtin_Gfx_GetFromData(const Gfx *aData) {
|
||||
MGR_FIND_NAME(sDynosBuiltinDisplayLists);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
#include "include/types.h"
|
||||
|
||||
//////////////
|
||||
// Textures //
|
||||
//////////////
|
||||
|
||||
extern ALIGNED8 const Texture amp_seg8_texture_08000F18[];
|
||||
extern ALIGNED8 const Texture amp_seg8_texture_08001318[];
|
||||
extern ALIGNED8 const Texture amp_seg8_texture_08001B18[];
|
||||
|
|
@ -2359,3 +2364,12 @@ extern ALIGNED8 const Texture cake_end_texture_44[];
|
|||
extern ALIGNED8 const Texture cake_end_texture_45[];
|
||||
extern ALIGNED8 const Texture cake_end_texture_46[];
|
||||
extern ALIGNED8 const Texture cake_end_texture_47[];
|
||||
|
||||
///////////////////
|
||||
// Display lists //
|
||||
///////////////////
|
||||
|
||||
#define DISPLAY_LIST(name) \
|
||||
extern const Gfx name[];
|
||||
#include "include/display_lists.inl"
|
||||
#undef DISPLAY_LIST
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ extern "C" {
|
|||
#include "model_ids.h"
|
||||
#include "pc/lua/utils/smlua_model_utils.h"
|
||||
#include "engine/display_list.h"
|
||||
#include "dynos_mgr_builtin_externs.h"
|
||||
}
|
||||
|
||||
enum ModelLoadType {
|
||||
|
|
@ -21,7 +22,6 @@ struct ModelInfo {
|
|||
void* asset;
|
||||
struct GraphNode* graphNode;
|
||||
enum ModelPool modelPool;
|
||||
std::vector<void*> *duplicates;
|
||||
};
|
||||
|
||||
static struct DynamicPool* sModelPools[MODEL_POOL_MAX] = { 0 };
|
||||
|
|
@ -30,9 +30,8 @@ static std::map<void*, struct ModelInfo> sAssetMap[MODEL_POOL_MAX];
|
|||
static std::map<u32, std::vector<struct ModelInfo>> sIdMap;
|
||||
static std::map<u32, u32> sOverwriteMap;
|
||||
|
||||
// An array of display list and/or vertex buffer duplicates for the current model processed in process_geo_layout
|
||||
static std::vector<void*> *sCurrModelDuplicates = nullptr;
|
||||
static std::vector<void*> sScheduledFree[MODEL_POOL_MAX];
|
||||
// Maps read-only Gfx and Vtx buffers to their writable duplicates
|
||||
static std::map<void *, std::pair<void *, size_t>> sRomToRamGfxVtxMap;
|
||||
|
||||
static u32 find_empty_id(bool aIsPermanent) {
|
||||
u32 id = aIsPermanent ? 9999 : VANILLA_ID_END + 1;
|
||||
|
|
@ -96,8 +95,6 @@ static struct GraphNode* DynOS_Model_LoadCommonInternal(u32* aId, enum ModelPool
|
|||
return found.graphNode;
|
||||
}
|
||||
|
||||
sCurrModelDuplicates = new std::vector<void*>();
|
||||
|
||||
// load geo
|
||||
struct GraphNode* node = NULL;
|
||||
switch (mlt) {
|
||||
|
|
@ -111,14 +108,7 @@ static struct GraphNode* DynOS_Model_LoadCommonInternal(u32* aId, enum ModelPool
|
|||
node = aGraphNode;
|
||||
break;
|
||||
}
|
||||
if (!node) {
|
||||
for (auto &duplicate : *sCurrModelDuplicates) {
|
||||
free(duplicate);
|
||||
}
|
||||
delete sCurrModelDuplicates;
|
||||
sCurrModelDuplicates = nullptr;
|
||||
return NULL;
|
||||
}
|
||||
if (!node) { return NULL; }
|
||||
|
||||
// figure out id
|
||||
if (!*aId) { *aId = find_empty_id(aModelPool == MODEL_POOL_PERMANENT); }
|
||||
|
|
@ -129,9 +119,7 @@ static struct GraphNode* DynOS_Model_LoadCommonInternal(u32* aId, enum ModelPool
|
|||
.asset = aAsset,
|
||||
.graphNode = node,
|
||||
.modelPool = aModelPool,
|
||||
.duplicates = sCurrModelDuplicates,
|
||||
};
|
||||
sCurrModelDuplicates = nullptr;
|
||||
|
||||
// store in maps
|
||||
sIdMap[*aId].push_back(info);
|
||||
|
|
@ -241,54 +229,93 @@ void DynOS_Model_OverwriteSlot(u32 srcSlot, u32 dstSlot) {
|
|||
sOverwriteMap[srcSlot] = dstSlot;
|
||||
}
|
||||
|
||||
// Display lists need to be duplicated so they can be modified by mods
|
||||
// also to prevent trying to write to read only memory for vanilla display lists
|
||||
Gfx *DynOS_Model_Duplicate_DisplayList(Gfx* aGfx) {
|
||||
if (!aGfx) { return nullptr; }
|
||||
static Vtx *DynOS_Model_DuplicateVtx(Vtx *aVtx, u32 vtxCount, bool shouldDuplicate) {
|
||||
if (!aVtx) { return NULL; }
|
||||
|
||||
u32 size = gfx_get_size(aGfx) * sizeof(Gfx);
|
||||
Gfx *gfxDuplicate = (Gfx *) malloc(size);
|
||||
memcpy(gfxDuplicate, aGfx, size);
|
||||
// Return duplicate if it already exists
|
||||
auto it = sRomToRamGfxVtxMap.find((void *) aVtx);
|
||||
if (it != sRomToRamGfxVtxMap.end()) {
|
||||
return (Vtx *) it->second.first;
|
||||
}
|
||||
|
||||
// Duplicate vertex buffer and return the copy
|
||||
if (shouldDuplicate) {
|
||||
size_t vtxSize = vtxCount * sizeof(Vtx);
|
||||
Vtx *vtxDuplicate = (Vtx *) malloc(vtxSize);
|
||||
memcpy(vtxDuplicate, aVtx, vtxSize);
|
||||
DynOS_Find_Pending_Scroll_Target(aVtx, vtxDuplicate);
|
||||
sRomToRamGfxVtxMap[(void *) aVtx] = { (void *) vtxDuplicate, vtxSize };
|
||||
return vtxDuplicate;
|
||||
}
|
||||
|
||||
return aVtx;
|
||||
}
|
||||
|
||||
static Gfx *DynOS_Model_DuplicateDisplayList(Gfx *aGfx, bool shouldDuplicate) {
|
||||
if (!aGfx) { return NULL; }
|
||||
|
||||
// Return duplicate if it already exists
|
||||
auto it = sRomToRamGfxVtxMap.find((void *) aGfx);
|
||||
if (it != sRomToRamGfxVtxMap.end()) {
|
||||
return (Gfx *) it->second.first;
|
||||
}
|
||||
|
||||
// Check if it's vanilla
|
||||
if (!shouldDuplicate) {
|
||||
shouldDuplicate = (DynOS_Builtin_Gfx_GetFromData(aGfx) != NULL);
|
||||
}
|
||||
|
||||
// Duplicate display list
|
||||
Gfx *gfxDuplicate = aGfx;
|
||||
u32 gfxLength = gfx_get_size(aGfx);
|
||||
if (shouldDuplicate) {
|
||||
size_t gfxSize = gfxLength * sizeof(Gfx);
|
||||
gfxDuplicate = (Gfx *) malloc(gfxSize);
|
||||
memcpy(gfxDuplicate, aGfx, gfxSize);
|
||||
sRomToRamGfxVtxMap[(void *) aGfx] = { (void *) gfxDuplicate, gfxSize };
|
||||
}
|
||||
|
||||
// Look for other display lists or vertices
|
||||
for (u32 i = 0; i < size / sizeof(Gfx); i++) {
|
||||
for (u32 i = 0; i < gfxLength; i++) {
|
||||
Gfx *cmd = gfxDuplicate + i;
|
||||
u32 op = cmd->words.w0 >> 24;
|
||||
|
||||
// Duplicate referenced display lists
|
||||
if (op == G_DL) {
|
||||
cmd->words.w1 = (uintptr_t) DynOS_Model_Duplicate_DisplayList((Gfx *) cmd->words.w1);
|
||||
cmd->words.w1 = (uintptr_t) DynOS_Model_DuplicateDisplayList((Gfx *) cmd->words.w1, shouldDuplicate);
|
||||
if (C0(cmd, 16, 1) == G_DL_NOPUSH) { break; } // This is a branch (jump), end of display list
|
||||
}
|
||||
|
||||
// Duplicate referenced vertices
|
||||
if (op == G_VTX) {
|
||||
u32 size = C0(cmd, 12, 8) * sizeof(Vtx);
|
||||
Vtx *vtxDuplicate = (Vtx *) malloc(size);
|
||||
memcpy(vtxDuplicate, (Vtx *) cmd->words.w1, size);
|
||||
DynOS_Find_Pending_Scroll_Target((Vtx *) cmd->words.w1, vtxDuplicate);
|
||||
cmd->words.w1 = (uintptr_t) vtxDuplicate;
|
||||
sCurrModelDuplicates->push_back(vtxDuplicate);
|
||||
cmd->words.w1 = (uintptr_t) DynOS_Model_DuplicateVtx((Vtx *) cmd->words.w1, C0(cmd, 12, 8), shouldDuplicate);
|
||||
}
|
||||
}
|
||||
|
||||
sCurrModelDuplicates->push_back(gfxDuplicate);
|
||||
|
||||
return gfxDuplicate;
|
||||
}
|
||||
|
||||
// Get a writable display list so it can be modified by mods
|
||||
// If it's a vanilla display list, duplicate it, so it can be restored later
|
||||
Gfx *DynOS_Model_GetWritableDisplayList(Gfx *aGfx) {
|
||||
return DynOS_Model_DuplicateDisplayList(aGfx, false);
|
||||
}
|
||||
|
||||
void DynOS_Model_RestoreVanillaDisplayLists() {
|
||||
for (auto &it : sRomToRamGfxVtxMap) {
|
||||
const void *original = it.first;
|
||||
void *duplicate = it.second.first;
|
||||
size_t size = it.second.second;
|
||||
memcpy(duplicate, original, size);
|
||||
}
|
||||
}
|
||||
|
||||
void DynOS_Model_ClearPool(enum ModelPool aModelPool) {
|
||||
if (!sModelPools[aModelPool]) { return; }
|
||||
|
||||
// schedule pool to be freed
|
||||
dynamic_pool_free_pool(sModelPools[aModelPool]);
|
||||
|
||||
// free scheduled duplicates
|
||||
for (auto &duplicate : sScheduledFree[aModelPool]) {
|
||||
free(duplicate);
|
||||
}
|
||||
sScheduledFree[aModelPool].clear();
|
||||
|
||||
// clear overwrite
|
||||
if (aModelPool == MODEL_POOL_LEVEL) {
|
||||
sOverwriteMap.clear();
|
||||
|
|
@ -316,15 +343,6 @@ void DynOS_Model_ClearPool(enum ModelPool aModelPool) {
|
|||
info2++;
|
||||
}
|
||||
}
|
||||
|
||||
// schedule duplicates to be freed
|
||||
if (info.duplicates) {
|
||||
for (auto &duplicate : *info.duplicates) {
|
||||
sScheduledFree[aModelPool].push_back(duplicate);
|
||||
}
|
||||
delete info.duplicates;
|
||||
info.duplicates = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
assetMap.clear();
|
||||
|
|
|
|||
2769
include/display_lists.inl
Normal file
2769
include/display_lists.inl
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -235,7 +235,7 @@ init_graph_node_translation_rotation(struct DynamicPool *pool,
|
|||
vec3s_copy(graphNode->translation, translation);
|
||||
vec3s_copy(graphNode->rotation, rotation);
|
||||
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
|
||||
graphNode->displayList = dynos_model_duplicate_displaylist(displayList);
|
||||
graphNode->displayList = dynos_model_get_writable_display_list(displayList);
|
||||
}
|
||||
|
||||
return graphNode;
|
||||
|
|
@ -257,7 +257,7 @@ struct GraphNodeTranslation *init_graph_node_translation(struct DynamicPool *poo
|
|||
|
||||
vec3s_copy(graphNode->translation, translation);
|
||||
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
|
||||
graphNode->displayList = dynos_model_duplicate_displaylist(displayList);
|
||||
graphNode->displayList = dynos_model_get_writable_display_list(displayList);
|
||||
}
|
||||
|
||||
return graphNode;
|
||||
|
|
@ -278,7 +278,7 @@ struct GraphNodeRotation *init_graph_node_rotation(struct DynamicPool *pool,
|
|||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_ROTATION);
|
||||
vec3s_copy(graphNode->rotation, rotation);
|
||||
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
|
||||
graphNode->displayList = dynos_model_duplicate_displaylist(displayList);
|
||||
graphNode->displayList = dynos_model_get_writable_display_list(displayList);
|
||||
}
|
||||
|
||||
return graphNode;
|
||||
|
|
@ -299,7 +299,7 @@ struct GraphNodeScale *init_graph_node_scale(struct DynamicPool *pool,
|
|||
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
|
||||
graphNode->scale = scale;
|
||||
graphNode->prevScale = scale;
|
||||
graphNode->displayList = dynos_model_duplicate_displaylist(displayList);
|
||||
graphNode->displayList = dynos_model_get_writable_display_list(displayList);
|
||||
}
|
||||
|
||||
return graphNode;
|
||||
|
|
@ -369,7 +369,7 @@ struct GraphNodeAnimatedPart *init_graph_node_animated_part(struct DynamicPool *
|
|||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_ANIMATED_PART);
|
||||
vec3s_copy(graphNode->translation, translation);
|
||||
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
|
||||
graphNode->displayList = dynos_model_duplicate_displaylist(displayList);
|
||||
graphNode->displayList = dynos_model_get_writable_display_list(displayList);
|
||||
}
|
||||
|
||||
return graphNode;
|
||||
|
|
@ -390,7 +390,7 @@ struct GraphNodeBillboard *init_graph_node_billboard(struct DynamicPool *pool,
|
|||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_BILLBOARD);
|
||||
vec3s_copy(graphNode->translation, translation);
|
||||
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
|
||||
graphNode->displayList = dynos_model_duplicate_displaylist(displayList);
|
||||
graphNode->displayList = dynos_model_get_writable_display_list(displayList);
|
||||
}
|
||||
|
||||
return graphNode;
|
||||
|
|
@ -409,7 +409,7 @@ struct GraphNodeDisplayList *init_graph_node_display_list(struct DynamicPool *po
|
|||
if (graphNode != NULL) {
|
||||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_DISPLAY_LIST);
|
||||
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
|
||||
graphNode->displayList = dynos_model_duplicate_displaylist(displayList);
|
||||
graphNode->displayList = dynos_model_get_writable_display_list(displayList);
|
||||
}
|
||||
|
||||
return graphNode;
|
||||
|
|
|
|||
|
|
@ -90,12 +90,12 @@ struct MovtexObject {
|
|||
/// segmented address to movtex mesh with vertices
|
||||
void *movtexVerts;
|
||||
/// display list inserted before moving triangles
|
||||
Gfx *beginDl;
|
||||
const Gfx *beginDl;
|
||||
/// display list inserted after moving triangles
|
||||
Gfx *endDl;
|
||||
const Gfx *endDl;
|
||||
/// display list with the actual moving texture triangles.
|
||||
/// Assumes the animated vertices are buffered and correct texture is set
|
||||
Gfx *triDl;
|
||||
const Gfx *triDl;
|
||||
// if the list does not have per-vertex colors, all vertices have these colors
|
||||
u8 r; /// red
|
||||
u8 g; /// green
|
||||
|
|
@ -134,58 +134,58 @@ u8 *gMovtexIdToTexture[] = { texture_waterbox_water, texture_waterbox_mist,
|
|||
texture_waterbox_lava, ssl_quicksand,
|
||||
ssl_pyramid_sand, ttc_yellow_triangle };
|
||||
|
||||
extern Gfx castle_grounds_dl_waterfall[];
|
||||
extern const Gfx castle_grounds_dl_waterfall[];
|
||||
extern s16 castle_grounds_movtex_tris_waterfall[];
|
||||
extern s16 ssl_movtex_tris_pyramid_sand_pathway_front[];
|
||||
extern Gfx ssl_dl_pyramid_sand_pathway_begin[];
|
||||
extern Gfx ssl_dl_pyramid_sand_pathway_end[];
|
||||
extern Gfx ssl_dl_pyramid_sand_pathway_front_end[];
|
||||
extern const Gfx ssl_dl_pyramid_sand_pathway_begin[];
|
||||
extern const Gfx ssl_dl_pyramid_sand_pathway_end[];
|
||||
extern const Gfx ssl_dl_pyramid_sand_pathway_front_end[];
|
||||
extern s16 ssl_movtex_tris_pyramid_sand_pathway_floor[];
|
||||
extern Gfx ssl_dl_pyramid_sand_pathway_floor_begin[];
|
||||
extern Gfx ssl_dl_pyramid_sand_pathway_floor_end[];
|
||||
extern const Gfx ssl_dl_pyramid_sand_pathway_floor_begin[];
|
||||
extern const Gfx ssl_dl_pyramid_sand_pathway_floor_end[];
|
||||
extern s16 ssl_movtex_tris_pyramid_sand_pathway_side[];
|
||||
extern Gfx ssl_dl_pyramid_sand_pathway_side_end[];
|
||||
extern const Gfx ssl_dl_pyramid_sand_pathway_side_end[];
|
||||
extern s16 bitfs_movtex_tris_lava_first_section[];
|
||||
extern Gfx bitfs_dl_lava_sections[];
|
||||
extern const Gfx bitfs_dl_lava_sections[];
|
||||
extern s16 bitfs_movtex_tris_lava_second_section[];
|
||||
extern s16 bitfs_movtex_tris_lava_floor[];
|
||||
extern Gfx bitfs_dl_lava_floor[];
|
||||
extern const Gfx bitfs_dl_lava_floor[];
|
||||
extern s16 lll_movtex_tris_lava_floor[];
|
||||
extern Gfx lll_dl_lava_floor[];
|
||||
extern const Gfx lll_dl_lava_floor[];
|
||||
extern s16 lll_movtex_tris_lavafall_volcano[];
|
||||
extern Gfx lll_dl_lavafall_volcano[];
|
||||
extern const Gfx lll_dl_lavafall_volcano[];
|
||||
extern s16 cotmc_movtex_tris_water[];
|
||||
extern Gfx cotmc_dl_water_begin[];
|
||||
extern Gfx cotmc_dl_water_end[];
|
||||
extern Gfx cotmc_dl_water[];
|
||||
extern const Gfx cotmc_dl_water_begin[];
|
||||
extern const Gfx cotmc_dl_water_end[];
|
||||
extern const Gfx cotmc_dl_water[];
|
||||
extern s16 ttm_movtex_tris_begin_waterfall[];
|
||||
extern Gfx ttm_dl_waterfall[];
|
||||
extern const Gfx ttm_dl_waterfall[];
|
||||
extern s16 ttm_movtex_tris_end_waterfall[];
|
||||
extern s16 ttm_movtex_tris_begin_puddle_waterfall[];
|
||||
extern Gfx ttm_dl_bottom_waterfall[];
|
||||
extern const Gfx ttm_dl_bottom_waterfall[];
|
||||
extern s16 ttm_movtex_tris_end_puddle_waterfall[];
|
||||
extern s16 ttm_movtex_tris_puddle_waterfall[];
|
||||
extern Gfx ttm_dl_puddle_waterfall[];
|
||||
extern const Gfx ttm_dl_puddle_waterfall[];
|
||||
extern s16 ssl_movtex_tris_pyramid_quicksand[];
|
||||
extern Gfx ssl_dl_quicksand_begin[];
|
||||
extern Gfx ssl_dl_quicksand_end[];
|
||||
extern Gfx ssl_dl_pyramid_quicksand[];
|
||||
extern const Gfx ssl_dl_quicksand_begin[];
|
||||
extern const Gfx ssl_dl_quicksand_end[];
|
||||
extern const Gfx ssl_dl_pyramid_quicksand[];
|
||||
extern s16 ssl_movtex_tris_pyramid_corners_quicksand[];
|
||||
extern Gfx ssl_dl_pyramid_corners_quicksand[];
|
||||
extern const Gfx ssl_dl_pyramid_corners_quicksand[];
|
||||
extern s16 ssl_movtex_tris_sides_quicksand[];
|
||||
extern Gfx ssl_dl_sides_quicksand[];
|
||||
extern const Gfx ssl_dl_sides_quicksand[];
|
||||
extern s16 ttc_movtex_tris_big_surface_treadmill[];
|
||||
extern Gfx ttc_dl_surface_treadmill_begin[];
|
||||
extern Gfx ttc_dl_surface_treadmill_end[];
|
||||
extern Gfx ttc_dl_surface_treadmill[];
|
||||
extern const Gfx ttc_dl_surface_treadmill_begin[];
|
||||
extern const Gfx ttc_dl_surface_treadmill_end[];
|
||||
extern const Gfx ttc_dl_surface_treadmill[];
|
||||
extern s16 ttc_movtex_tris_small_surface_treadmill[];
|
||||
extern s16 ssl_movtex_tris_quicksand_pit[];
|
||||
extern Gfx ssl_dl_quicksand_pit_begin[];
|
||||
extern Gfx ssl_dl_quicksand_pit_end[];
|
||||
extern Gfx ssl_dl_quicksand_pit[];
|
||||
extern const Gfx ssl_dl_quicksand_pit_begin[];
|
||||
extern const Gfx ssl_dl_quicksand_pit_end[];
|
||||
extern const Gfx ssl_dl_quicksand_pit[];
|
||||
extern s16 ssl_movtex_tris_pyramid_quicksand_pit[];
|
||||
extern Gfx ssl_dl_pyramid_quicksand_pit_begin[];
|
||||
extern Gfx ssl_dl_pyramid_quicksand_pit_end[];
|
||||
extern const Gfx ssl_dl_pyramid_quicksand_pit_begin[];
|
||||
extern const Gfx ssl_dl_pyramid_quicksand_pit_end[];
|
||||
|
||||
/**
|
||||
* MovtexObjects that have no color attributes per vertex (though the mesh
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ extern u8* seg2_course_name_table[];
|
|||
extern u8* seg2_course_name_table_original[];
|
||||
extern u8* seg2_act_name_table[];
|
||||
extern u8* seg2_act_name_table_original[];
|
||||
extern Gfx dl_rgba16_text_begin[];
|
||||
extern Gfx dl_rgba16_text_end[];
|
||||
extern Gfx dl_ia_text_begin[];
|
||||
extern Gfx dl_ia_text_end[];
|
||||
extern const Gfx dl_rgba16_text_begin[];
|
||||
extern const Gfx dl_rgba16_text_end[];
|
||||
extern const Gfx dl_ia_text_begin[];
|
||||
extern const Gfx dl_ia_text_end[];
|
||||
extern Texture texture_transition_star_half[];
|
||||
extern Texture texture_transition_circle_half[];
|
||||
extern Texture texture_transition_mario[];
|
||||
|
|
@ -22,51 +22,51 @@ extern Texture texture_waterbox_mist[];
|
|||
extern Texture texture_waterbox_jrb_water[];
|
||||
extern Texture texture_waterbox_unknown_water[];
|
||||
extern Texture texture_waterbox_lava[];
|
||||
extern Gfx dl_proj_mtx_fullscreen[];
|
||||
extern Gfx dl_draw_quad_verts_0123[];
|
||||
extern Gfx dl_screen_transition_end[];
|
||||
extern Gfx dl_transition_draw_filled_region[];
|
||||
extern Gfx dl_shadow_circle[];
|
||||
extern Gfx dl_shadow_square[];
|
||||
extern Gfx dl_shadow_spike_ext[];
|
||||
extern Gfx dl_shadow_9_verts[];
|
||||
extern Gfx dl_shadow_4_verts[];
|
||||
extern Gfx dl_shadow_end[];
|
||||
extern Gfx dl_skybox_begin[];
|
||||
extern Gfx dl_skybox_tile_tex_settings[];
|
||||
extern Gfx dl_skybox_end[];
|
||||
extern Gfx dl_waterbox_ia16_begin[];
|
||||
extern Gfx dl_waterbox_rgba16_begin[];
|
||||
extern Gfx dl_waterbox_end[];
|
||||
extern Gfx dl_paintings_draw_ripples[];
|
||||
extern Gfx dl_paintings_rippling_begin[];
|
||||
extern Gfx dl_paintings_rippling_end[];
|
||||
extern Gfx dl_paintings_env_mapped_begin[];
|
||||
extern Gfx dl_paintings_env_mapped_end[];
|
||||
extern const Gfx dl_proj_mtx_fullscreen[];
|
||||
extern const Gfx dl_draw_quad_verts_0123[];
|
||||
extern const Gfx dl_screen_transition_end[];
|
||||
extern const Gfx dl_transition_draw_filled_region[];
|
||||
extern const Gfx dl_shadow_circle[];
|
||||
extern const Gfx dl_shadow_square[];
|
||||
extern const Gfx dl_shadow_spike_ext[];
|
||||
extern const Gfx dl_shadow_9_verts[];
|
||||
extern const Gfx dl_shadow_4_verts[];
|
||||
extern const Gfx dl_shadow_end[];
|
||||
extern const Gfx dl_skybox_begin[];
|
||||
extern const Gfx dl_skybox_tile_tex_settings[];
|
||||
extern const Gfx dl_skybox_end[];
|
||||
extern const Gfx dl_waterbox_ia16_begin[];
|
||||
extern const Gfx dl_waterbox_rgba16_begin[];
|
||||
extern const Gfx dl_waterbox_end[];
|
||||
extern const Gfx dl_paintings_draw_ripples[];
|
||||
extern const Gfx dl_paintings_rippling_begin[];
|
||||
extern const Gfx dl_paintings_rippling_end[];
|
||||
extern const Gfx dl_paintings_env_mapped_begin[];
|
||||
extern const Gfx dl_paintings_env_mapped_end[];
|
||||
extern u8 seg2_painting_triangle_mesh[];
|
||||
extern u8 seg2_painting_mesh_neighbor_tris[];
|
||||
extern u8* main_hud_lut[58];
|
||||
extern Gfx dl_hud_img_load_tex_block[];
|
||||
extern Gfx dl_hud_img_begin[];
|
||||
extern Gfx dl_hud_img_end[];
|
||||
extern const Gfx dl_hud_img_load_tex_block[];
|
||||
extern const Gfx dl_hud_img_begin[];
|
||||
extern const Gfx dl_hud_img_end[];
|
||||
extern void *main_font_lut[];
|
||||
extern Gfx dl_ia_text_tex_settings[];
|
||||
extern Gfx dl_rgba16_load_tex_block[];
|
||||
extern const Gfx dl_ia_text_tex_settings[];
|
||||
extern const Gfx dl_rgba16_load_tex_block[];
|
||||
extern void *main_credits_font_lut[];
|
||||
extern u8* main_hud_camera_lut[6];
|
||||
extern Gfx dl_draw_text_bg_box[];
|
||||
extern Gfx dl_draw_triangle[];
|
||||
extern const Gfx dl_draw_text_bg_box[];
|
||||
extern const Gfx dl_draw_triangle[];
|
||||
extern const u8* seg2_dialog_original[];
|
||||
extern void *seg2_dialog_table[];
|
||||
extern Gfx dl_billboard_num_0[];
|
||||
extern Gfx dl_billboard_num_1[];
|
||||
extern Gfx dl_billboard_num_2[];
|
||||
extern Gfx dl_billboard_num_3[];
|
||||
extern Gfx dl_billboard_num_4[];
|
||||
extern Gfx dl_billboard_num_5[];
|
||||
extern Gfx dl_billboard_num_6[];
|
||||
extern Gfx dl_billboard_num_7[];
|
||||
extern Gfx dl_billboard_num_8[];
|
||||
extern Gfx dl_billboard_num_9[];
|
||||
extern const Gfx dl_billboard_num_0[];
|
||||
extern const Gfx dl_billboard_num_1[];
|
||||
extern const Gfx dl_billboard_num_2[];
|
||||
extern const Gfx dl_billboard_num_3[];
|
||||
extern const Gfx dl_billboard_num_4[];
|
||||
extern const Gfx dl_billboard_num_5[];
|
||||
extern const Gfx dl_billboard_num_6[];
|
||||
extern const Gfx dl_billboard_num_7[];
|
||||
extern const Gfx dl_billboard_num_8[];
|
||||
extern const Gfx dl_billboard_num_9[];
|
||||
|
||||
#endif // SEGMENT2_H
|
||||
|
|
|
|||
|
|
@ -5,27 +5,27 @@
|
|||
#include <PR/gbi.h>
|
||||
|
||||
// from main menu segment 7
|
||||
extern u8 dl_menu_idle_hand[];
|
||||
extern u8 dl_menu_grabbing_hand[];
|
||||
extern u8 menu_hud_lut[];
|
||||
extern u8 menu_font_lut[];
|
||||
extern u8 dl_menu_ia8_text_begin[];
|
||||
extern u8 dl_menu_ia8_text_end[];
|
||||
extern u8 dl_menu_rgba16_wood_course[];
|
||||
extern const Gfx dl_menu_idle_hand[];
|
||||
extern const Gfx dl_menu_grabbing_hand[];
|
||||
extern const Gfx menu_hud_lut[];
|
||||
extern const Gfx menu_font_lut[];
|
||||
extern const Gfx dl_menu_ia8_text_begin[];
|
||||
extern const Gfx dl_menu_ia8_text_end[];
|
||||
extern const Gfx dl_menu_rgba16_wood_course[];
|
||||
#ifdef VERSION_EU
|
||||
extern u8 dl_menu_rgba16_wood_course_end[];
|
||||
extern u8 dl_menu_texture_course_upper[];
|
||||
extern u8 dl_menu_texture_niveau_upper[];
|
||||
extern u8 dl_menu_texture_kurs_upper[];
|
||||
extern const Gfx dl_menu_rgba16_wood_course_end[];
|
||||
extern const Gfx dl_menu_texture_course_upper[];
|
||||
extern const Gfx dl_menu_texture_niveau_upper[];
|
||||
extern const Gfx dl_menu_texture_kurs_upper[];
|
||||
|
||||
extern const u8 eu_course_strings_en_table[];
|
||||
extern const u8 eu_course_strings_fr_table[];
|
||||
extern const u8 eu_course_strings_de_table[];
|
||||
extern const Gfx eu_course_strings_en_table[];
|
||||
extern const Gfx eu_course_strings_fr_table[];
|
||||
extern const Gfx eu_course_strings_de_table[];
|
||||
#endif
|
||||
|
||||
// from intro_segment7
|
||||
extern Gfx *intro_seg7_dl_0700B3A0;
|
||||
extern Gfx *intro_seg7_dl_0700C6A0;
|
||||
extern const Gfx intro_seg7_dl_0700B3A0[];
|
||||
extern const Gfx intro_seg7_dl_0700C6A0[];
|
||||
extern f32 intro_seg7_table_0700C790[];
|
||||
extern f32 intro_seg7_table_0700C880[];
|
||||
|
||||
|
|
|
|||
|
|
@ -669,6 +669,8 @@ void network_shutdown(bool sendLeaving, bool exiting, bool popup, bool reconnect
|
|||
|
||||
if (exiting) { return; }
|
||||
|
||||
dynos_model_restore_vanilla_display_lists();
|
||||
|
||||
// reset other stuff
|
||||
extern u8* gOverrideEeprom;
|
||||
gOverrideEeprom = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue