mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Fix Texture type; add various get_name functions (#945)
Some checks failed
Build coop / build-linux (push) Has been cancelled
Build coop / build-steamos (push) Has been cancelled
Build coop / build-windows-opengl (push) Has been cancelled
Build coop / build-windows-directx (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled
Some checks failed
Build coop / build-linux (push) Has been cancelled
Build coop / build-steamos (push) Has been cancelled
Build coop / build-windows-opengl (push) Has been cancelled
Build coop / build-windows-directx (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled
This commit is contained in:
parent
f80f8eba62
commit
d9f5869fcd
34 changed files with 457 additions and 206 deletions
|
|
@ -4,7 +4,7 @@ from vec_types import *
|
||||||
|
|
||||||
usf_types = ['u8', 'u16', 'u32', 'u64', 's8', 's16', 's32', 's64', 'f32', 'f64']
|
usf_types = ['u8', 'u16', 'u32', 'u64', 's8', 's16', 's32', 's64', 'f32', 'f64']
|
||||||
vec_types = list(VEC_TYPES.keys())
|
vec_types = list(VEC_TYPES.keys())
|
||||||
typedef_pointers = ['BehaviorScript', 'ObjectAnimPointer', 'Collision', 'LevelScript', 'Trajectory']
|
typedef_pointers = ['BehaviorScript', 'ObjectAnimPointer', 'Collision', 'LevelScript', 'Trajectory', 'Texture']
|
||||||
|
|
||||||
type_mappings = {
|
type_mappings = {
|
||||||
'char': 's8',
|
'char': 's8',
|
||||||
|
|
|
||||||
|
|
@ -10776,12 +10776,19 @@ function gfx_get_vertex_count(cmd)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param cmd Pointer_Gfx
|
--- @param cmd Pointer_Gfx
|
||||||
--- @return Pointer_integer
|
--- @return Pointer_Texture
|
||||||
--- Gets the texture from a display list command if it has an image related op
|
--- Gets the texture from a display list command if it has an image related op
|
||||||
function gfx_get_texture(cmd)
|
function gfx_get_texture(cmd)
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @param gfx Pointer_Gfx
|
||||||
|
--- @return string
|
||||||
|
--- Gets the name of a display list
|
||||||
|
function gfx_get_name(gfx)
|
||||||
|
-- ...
|
||||||
|
end
|
||||||
|
|
||||||
--- @param gfx Pointer_Gfx
|
--- @param gfx Pointer_Gfx
|
||||||
--- @return integer
|
--- @return integer
|
||||||
--- Gets the max length of a display list
|
--- Gets the max length of a display list
|
||||||
|
|
@ -10838,6 +10845,13 @@ function gfx_delete_all()
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @param vtx Pointer_Vtx
|
||||||
|
--- @return string
|
||||||
|
--- Gets the name of a vertex buffer
|
||||||
|
function vtx_get_name(vtx)
|
||||||
|
-- ...
|
||||||
|
end
|
||||||
|
|
||||||
--- @param vtx Pointer_Vtx
|
--- @param vtx Pointer_Vtx
|
||||||
--- @return integer
|
--- @return integer
|
||||||
--- Gets the max count of vertices of a vertex buffer
|
--- Gets the max count of vertices of a vertex buffer
|
||||||
|
|
@ -11514,12 +11528,19 @@ function geo_get_current_held_object()
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param tex Pointer_integer
|
--- @param tex Pointer_Texture
|
||||||
--- Converts a texture's pixels to a Lua table. Returns nil if failed. Otherwise, returns a table as a pure memory buffer. Supports rgba16 and rgba32 textures.
|
--- Converts a texture's pixels to a Lua table. Returns nil if failed. Otherwise, returns a table as a pure memory buffer. Supports rgba16 and rgba32 textures
|
||||||
function texture_to_lua_table(tex)
|
function texture_to_lua_table(tex)
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @param tex Pointer_Texture
|
||||||
|
--- @return string
|
||||||
|
--- Gets the name of the provided texture pointer `tex`
|
||||||
|
function get_texture_name(tex)
|
||||||
|
-- ...
|
||||||
|
end
|
||||||
|
|
||||||
--- @param name string
|
--- @param name string
|
||||||
--- @return ModelExtendedId
|
--- @return ModelExtendedId
|
||||||
--- Gets the extended model ID for the `name` of a `GeoLayout`
|
--- Gets the extended model ID for the `name` of a `GeoLayout`
|
||||||
|
|
@ -12318,6 +12339,7 @@ end
|
||||||
--- @alias Pointer_Collision Collision
|
--- @alias Pointer_Collision Collision
|
||||||
--- @alias Pointer_Gfx Gfx
|
--- @alias Pointer_Gfx Gfx
|
||||||
--- @alias Pointer_Vtx Vtx
|
--- @alias Pointer_Vtx Vtx
|
||||||
|
--- @alias Pointer_Texture Texture
|
||||||
--- @alias Vec2fp Vec2f
|
--- @alias Vec2fp Vec2f
|
||||||
--- @alias Vec3fp Vec3f
|
--- @alias Vec3fp Vec3f
|
||||||
--- @alias Vec4fp Vec4f
|
--- @alias Vec4fp Vec4f
|
||||||
|
|
|
||||||
|
|
@ -2357,7 +2357,7 @@
|
||||||
--- @field public object Object
|
--- @field public object Object
|
||||||
|
|
||||||
--- @class TextureInfo
|
--- @class TextureInfo
|
||||||
--- @field public texture Pointer_integer
|
--- @field public texture Pointer_Texture
|
||||||
--- @field public name string
|
--- @field public name string
|
||||||
--- @field public width integer
|
--- @field public width integer
|
||||||
--- @field public height integer
|
--- @field public height integer
|
||||||
|
|
@ -2528,3 +2528,4 @@
|
||||||
--- @alias Pointer_Mat4 Mat4
|
--- @alias Pointer_Mat4 Mat4
|
||||||
--- @alias Pointer_Vec4s Vec4s
|
--- @alias Pointer_Vec4s Vec4s
|
||||||
--- @alias Pointer_BehaviorScript BehaviorScript
|
--- @alias Pointer_BehaviorScript BehaviorScript
|
||||||
|
--- @alias Pointer_Texture Texture
|
||||||
|
|
|
||||||
|
|
@ -90,11 +90,13 @@ void dynos_model_clear_pool(enum ModelPool aModelPool);
|
||||||
// -- gfx -- //
|
// -- gfx -- //
|
||||||
Gfx *dynos_gfx_get_writable_display_list(Gfx* gfx);
|
Gfx *dynos_gfx_get_writable_display_list(Gfx* gfx);
|
||||||
Gfx *dynos_gfx_get(const char *name, u32 *outLength);
|
Gfx *dynos_gfx_get(const char *name, u32 *outLength);
|
||||||
|
const char *dynos_gfx_get_name(Gfx *gfx);
|
||||||
Gfx *dynos_gfx_create(const char *name, u32 length);
|
Gfx *dynos_gfx_create(const char *name, u32 length);
|
||||||
bool dynos_gfx_resize(Gfx *gfx, u32 newLength);
|
bool dynos_gfx_resize(Gfx *gfx, u32 newLength);
|
||||||
bool dynos_gfx_delete(Gfx *gfx);
|
bool dynos_gfx_delete(Gfx *gfx);
|
||||||
void dynos_gfx_delete_all();
|
void dynos_gfx_delete_all();
|
||||||
Vtx *dynos_vtx_get(const char *name, u32 *outCount);
|
Vtx *dynos_vtx_get(const char *name, u32 *outCount);
|
||||||
|
const char *dynos_vtx_get_name(Vtx *vtx);
|
||||||
Vtx *dynos_vtx_create(const char *name, u32 count);
|
Vtx *dynos_vtx_create(const char *name, u32 count);
|
||||||
bool dynos_vtx_resize(Vtx *vtx, u32 newCount);
|
bool dynos_vtx_resize(Vtx *vtx, u32 newCount);
|
||||||
bool dynos_vtx_delete(Vtx *vtx);
|
bool dynos_vtx_delete(Vtx *vtx);
|
||||||
|
|
|
||||||
|
|
@ -996,11 +996,13 @@ void DynOS_Model_ClearPool(enum ModelPool aModelPool);
|
||||||
|
|
||||||
Gfx *DynOS_Gfx_GetWritableDisplayList(Gfx *aGfx);
|
Gfx *DynOS_Gfx_GetWritableDisplayList(Gfx *aGfx);
|
||||||
Gfx *DynOS_Gfx_Get(const char *aName, u32 *outLength);
|
Gfx *DynOS_Gfx_Get(const char *aName, u32 *outLength);
|
||||||
|
const char *DynOS_Gfx_GetName(Gfx *aGfx);
|
||||||
Gfx *DynOS_Gfx_Create(const char *aName, u32 aLength);
|
Gfx *DynOS_Gfx_Create(const char *aName, u32 aLength);
|
||||||
bool DynOS_Gfx_Resize(Gfx *aGfx, u32 aNewLength);
|
bool DynOS_Gfx_Resize(Gfx *aGfx, u32 aNewLength);
|
||||||
bool DynOS_Gfx_Delete(Gfx *aGfx);
|
bool DynOS_Gfx_Delete(Gfx *aGfx);
|
||||||
void DynOS_Gfx_DeleteAll();
|
void DynOS_Gfx_DeleteAll();
|
||||||
Vtx *DynOS_Vtx_Get(const char *aName, u32 *outCount);
|
Vtx *DynOS_Vtx_Get(const char *aName, u32 *outCount);
|
||||||
|
const char *DynOS_Vtx_GetName(Vtx *aVtx);
|
||||||
Vtx *DynOS_Vtx_Create(const char *aName, u32 aCount);
|
Vtx *DynOS_Vtx_Create(const char *aName, u32 aCount);
|
||||||
bool DynOS_Vtx_Resize(Vtx *aVtx, u32 aNewCount);
|
bool DynOS_Vtx_Resize(Vtx *aVtx, u32 aNewCount);
|
||||||
bool DynOS_Vtx_Delete(Vtx *aVtx);
|
bool DynOS_Vtx_Delete(Vtx *aVtx);
|
||||||
|
|
|
||||||
|
|
@ -1213,7 +1213,7 @@ static String ResolveParam(lua_State *L, GfxData *aGfxData, u32 paramIndex, char
|
||||||
case GFX_PARAM_TYPE_TEX: return ConvertParam<Texture *>(
|
case GFX_PARAM_TYPE_TEX: return ConvertParam<Texture *>(
|
||||||
L, aGfxData, paramIndex,
|
L, aGfxData, paramIndex,
|
||||||
"Texture pointer",
|
"Texture pointer",
|
||||||
[] (lua_State *L, u32 paramIndex) { return (Texture *) smlua_to_cpointer(L, paramIndex, LVT_U8_P); },
|
[] (lua_State *L, u32 paramIndex) { return (Texture *) smlua_to_cpointer(L, paramIndex, LVT_TEXTURE_P); },
|
||||||
[&aGfxData] (Texture *texture) { return CreateRawPointerDataNode(aGfxData, texture); }
|
[&aGfxData] (Texture *texture) { return CreateRawPointerDataNode(aGfxData, texture); }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -292,6 +292,10 @@ Gfx *dynos_gfx_get(const char *name, u32 *outLength) {
|
||||||
return DynOS_Gfx_Get(name, outLength);
|
return DynOS_Gfx_Get(name, outLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *dynos_gfx_get_name(Gfx *gfx) {
|
||||||
|
return DynOS_Gfx_GetName(gfx);
|
||||||
|
}
|
||||||
|
|
||||||
Gfx *dynos_gfx_create(const char *name, u32 length) {
|
Gfx *dynos_gfx_create(const char *name, u32 length) {
|
||||||
return DynOS_Gfx_Create(name, length);
|
return DynOS_Gfx_Create(name, length);
|
||||||
}
|
}
|
||||||
|
|
@ -312,6 +316,10 @@ Vtx *dynos_vtx_get(const char *name, u32 *outCount) {
|
||||||
return DynOS_Vtx_Get(name, outCount);
|
return DynOS_Vtx_Get(name, outCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *dynos_vtx_get_name(Vtx *vtx) {
|
||||||
|
return DynOS_Vtx_GetName(vtx);
|
||||||
|
}
|
||||||
|
|
||||||
Vtx *dynos_vtx_create(const char *name, u32 count) {
|
Vtx *dynos_vtx_create(const char *name, u32 count) {
|
||||||
return DynOS_Vtx_Create(name, count);
|
return DynOS_Vtx_Create(name, count);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "pc/lua/smlua.h"
|
#include "pc/lua/smlua.h"
|
||||||
#include "pc/lua/utils/smlua_gfx_utils.h"
|
#include "pc/lua/utils/smlua_gfx_utils.h"
|
||||||
|
#include "pc/mods/mods.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MapNode {
|
struct MapNode {
|
||||||
|
|
@ -13,6 +14,7 @@ struct MapNode {
|
||||||
|
|
||||||
// Maps read-only Gfx and Vtx buffers to their writable duplicates
|
// Maps read-only Gfx and Vtx buffers to their writable duplicates
|
||||||
static std::map<const void *, struct MapNode> sRomToRamGfxVtxMap;
|
static std::map<const void *, struct MapNode> sRomToRamGfxVtxMap;
|
||||||
|
static std::map<const void *, const void *> sRamToRomGfxVtxMap; // Reverse map for duplicate to vanilla lookup
|
||||||
|
|
||||||
static Vtx *DynOS_Vtx_Duplicate(Vtx *aVtx, u32 vtxCount, bool shouldDuplicate) {
|
static Vtx *DynOS_Vtx_Duplicate(Vtx *aVtx, u32 vtxCount, bool shouldDuplicate) {
|
||||||
if (!aVtx) { return NULL; }
|
if (!aVtx) { return NULL; }
|
||||||
|
|
@ -29,6 +31,7 @@ static Vtx *DynOS_Vtx_Duplicate(Vtx *aVtx, u32 vtxCount, bool shouldDuplicate) {
|
||||||
Vtx *vtxDuplicate = vtx_allocate_internal(NULL, vtxCount);
|
Vtx *vtxDuplicate = vtx_allocate_internal(NULL, vtxCount);
|
||||||
memcpy(vtxDuplicate, aVtx, vtxSize);
|
memcpy(vtxDuplicate, aVtx, vtxSize);
|
||||||
sRomToRamGfxVtxMap[aVtx] = { (void *) vtxDuplicate, vtxSize, NULL };
|
sRomToRamGfxVtxMap[aVtx] = { (void *) vtxDuplicate, vtxSize, NULL };
|
||||||
|
sRamToRomGfxVtxMap[vtxDuplicate] = aVtx;
|
||||||
return vtxDuplicate;
|
return vtxDuplicate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -81,6 +84,7 @@ static Gfx *DynOS_Gfx_Duplicate(Gfx *aGfx, bool shouldDuplicate) {
|
||||||
Gfx *gfxCopy = (Gfx *) malloc(gfxSize);
|
Gfx *gfxCopy = (Gfx *) malloc(gfxSize);
|
||||||
memcpy(gfxCopy, gfxDuplicate, gfxSize);
|
memcpy(gfxCopy, gfxDuplicate, gfxSize);
|
||||||
sRomToRamGfxVtxMap[aGfx] = { (void *) gfxDuplicate, gfxSize, gfxCopy };
|
sRomToRamGfxVtxMap[aGfx] = { (void *) gfxDuplicate, gfxSize, gfxCopy };
|
||||||
|
sRamToRomGfxVtxMap[gfxDuplicate] = aGfx;
|
||||||
}
|
}
|
||||||
|
|
||||||
return gfxDuplicate;
|
return gfxDuplicate;
|
||||||
|
|
@ -136,24 +140,20 @@ Gfx *DynOS_Gfx_Get(const char *aName, u32 *outLength) {
|
||||||
|
|
||||||
// Check levels
|
// Check levels
|
||||||
for (auto &lvl : DynOS_Lvl_GetArray()) {
|
for (auto &lvl : DynOS_Lvl_GetArray()) {
|
||||||
if (modIndex == -1 || lvl.second->mModIndex == modIndex) {
|
for (auto &gfx : lvl.second->mDisplayLists) {
|
||||||
for (auto &gfx : lvl.second->mDisplayLists) {
|
if (gfx->mName == aName) {
|
||||||
if (gfx->mName == aName) {
|
*outLength = gfx->mSize;
|
||||||
*outLength = gfx->mSize;
|
return gfx->mData;
|
||||||
return gfx->mData;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check loaded actors
|
// Check loaded actors
|
||||||
for (auto &actor : DynOS_Actor_GetValidActors()) {
|
for (auto &actor : DynOS_Actor_GetValidActors()) {
|
||||||
if (modIndex == -1 || actor.second.mGfxData->mModIndex == modIndex) {
|
for (auto &gfx : actor.second.mGfxData->mDisplayLists) {
|
||||||
for (auto &gfx : actor.second.mGfxData->mDisplayLists) {
|
if (gfx->mName == aName) {
|
||||||
if (gfx->mName == aName) {
|
*outLength = gfx->mSize;
|
||||||
*outLength = gfx->mSize;
|
return gfx->mData;
|
||||||
return gfx->mData;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -176,6 +176,42 @@ Gfx *DynOS_Gfx_Get(const char *aName, u32 *outLength) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *DynOS_Gfx_GetName(Gfx *aGfx) {
|
||||||
|
if (!aGfx) { return NULL; }
|
||||||
|
s32 modIndex = (gLuaActiveMod ? gLuaActiveMod->index : -1);
|
||||||
|
|
||||||
|
// Check mod data
|
||||||
|
static std::string outName;
|
||||||
|
if (sModsDisplayLists.GetName(modIndex, aGfx, outName)) {
|
||||||
|
return outName.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check levels
|
||||||
|
for (auto &lvl : DynOS_Lvl_GetArray()) {
|
||||||
|
for (auto &gfx : lvl.second->mDisplayLists) {
|
||||||
|
if (gfx->mData == aGfx) {
|
||||||
|
return gfx->mName.begin();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check loaded actors
|
||||||
|
for (auto &actor : DynOS_Actor_GetValidActors()) {
|
||||||
|
for (auto &gfx : actor.second.mGfxData->mDisplayLists) {
|
||||||
|
if (gfx->mData == aGfx) {
|
||||||
|
return gfx->mName.begin();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check vanilla display lists
|
||||||
|
auto it = sRamToRomGfxVtxMap.find(aGfx);
|
||||||
|
if (it != sRamToRomGfxVtxMap.end()) {
|
||||||
|
return DynOS_Builtin_Gfx_GetFromData((const Gfx *) it->second);
|
||||||
|
}
|
||||||
|
return DynOS_Builtin_Gfx_GetFromData(aGfx);
|
||||||
|
}
|
||||||
|
|
||||||
Gfx *DynOS_Gfx_Create(const char *aName, u32 aLength) {
|
Gfx *DynOS_Gfx_Create(const char *aName, u32 aLength) {
|
||||||
s32 modIndex = (gLuaActiveMod ? gLuaActiveMod->index : -1);
|
s32 modIndex = (gLuaActiveMod ? gLuaActiveMod->index : -1);
|
||||||
return sModsDisplayLists.Create(modIndex, aName, aLength);
|
return sModsDisplayLists.Create(modIndex, aName, aLength);
|
||||||
|
|
@ -240,24 +276,51 @@ Vtx *DynOS_Vtx_Get(const char *aName, u32 *outCount) {
|
||||||
|
|
||||||
// Check levels
|
// Check levels
|
||||||
for (auto &lvl : DynOS_Lvl_GetArray()) {
|
for (auto &lvl : DynOS_Lvl_GetArray()) {
|
||||||
if (modIndex == -1 || lvl.second->mModIndex == modIndex) {
|
for (auto &vtx : lvl.second->mVertices) {
|
||||||
for (auto &vtx : lvl.second->mVertices) {
|
if (vtx->mName == aName) {
|
||||||
if (vtx->mName == aName) {
|
*outCount = vtx->mSize;
|
||||||
*outCount = vtx->mSize;
|
return vtx->mData;
|
||||||
return vtx->mData;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check loaded actors
|
// Check loaded actors
|
||||||
for (auto &actor : DynOS_Actor_GetValidActors()) {
|
for (auto &actor : DynOS_Actor_GetValidActors()) {
|
||||||
if (modIndex == -1 || actor.second.mGfxData->mModIndex == modIndex) {
|
for (auto &vtx : actor.second.mGfxData->mVertices) {
|
||||||
for (auto &vtx : actor.second.mGfxData->mVertices) {
|
if (vtx->mName == aName) {
|
||||||
if (vtx->mName == aName) {
|
*outCount = vtx->mSize;
|
||||||
*outCount = vtx->mSize;
|
return vtx->mData;
|
||||||
return vtx->mData;
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *DynOS_Vtx_GetName(Vtx *aVtx) {
|
||||||
|
if (!aVtx) { return NULL; }
|
||||||
|
s32 modIndex = (gLuaActiveMod ? gLuaActiveMod->index : -1);
|
||||||
|
|
||||||
|
// Check mod data
|
||||||
|
static std::string outName;
|
||||||
|
if (sModsVertexBuffers.GetName(modIndex, aVtx, outName)) {
|
||||||
|
return outName.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check levels
|
||||||
|
for (auto &lvl : DynOS_Lvl_GetArray()) {
|
||||||
|
for (auto &vtx : lvl.second->mVertices) {
|
||||||
|
if (vtx->mData == aVtx) {
|
||||||
|
return vtx->mName.begin();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check loaded actors
|
||||||
|
for (auto &actor : DynOS_Actor_GetValidActors()) {
|
||||||
|
for (auto &vtx : actor.second.mGfxData->mVertices) {
|
||||||
|
if (vtx->mData == aVtx) {
|
||||||
|
return vtx->mName.begin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,6 @@ public:
|
||||||
mMapNameToItem.clear();
|
mMapNameToItem.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
ModDataResult<ModDataItem<T> *> Find(T *aPointer, std::string &outName) {
|
ModDataResult<ModDataItem<T> *> Find(T *aPointer, std::string &outName) {
|
||||||
if (!aPointer) {
|
if (!aPointer) {
|
||||||
return { NULL, DYNOS_MOD_DATA_ERROR_POINTER_IS_NULL };
|
return { NULL, DYNOS_MOD_DATA_ERROR_POINTER_IS_NULL };
|
||||||
|
|
@ -151,6 +150,7 @@ private:
|
||||||
return { NULL, 0 };
|
return { NULL, 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
ModDataResult<ModDataItem<T> *> FindAvailableItem() {
|
ModDataResult<ModDataItem<T> *> FindAvailableItem() {
|
||||||
|
|
||||||
// Create pool if it doesn't exist yet
|
// Create pool if it doesn't exist yet
|
||||||
|
|
@ -212,6 +212,16 @@ public:
|
||||||
return getResult.first->mBuffer;
|
return getResult.first->mBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GetName(s32 aModIndex, T *aPointer, std::string &outName) {
|
||||||
|
ModDataT *modData = GetModData(aModIndex);
|
||||||
|
auto findResult = modData->Find(aPointer, outName);
|
||||||
|
if (!findResult.first) {
|
||||||
|
gDynosModDataLastError = findResult.second;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
T *Create(s32 aModIndex, const char *aName, u32 aSize) {
|
T *Create(s32 aModIndex, const char *aName, u32 aSize) {
|
||||||
ModDataT *modData = GetModData(aModIndex);
|
ModDataT *modData = GetModData(aModIndex);
|
||||||
auto createResult = modData->Create(aName, aSize);
|
auto createResult = modData->Create(aName, aSize);
|
||||||
|
|
|
||||||
|
|
@ -503,7 +503,7 @@ bool DynOS_Tex_Get(const char* aTexName, struct TextureInfo* aOutTexInfo) {
|
||||||
aOutTexInfo->bitSize = info->bitSize;
|
aOutTexInfo->bitSize = info->bitSize;
|
||||||
aOutTexInfo->width = info->width;
|
aOutTexInfo->width = info->width;
|
||||||
aOutTexInfo->height = info->height;
|
aOutTexInfo->height = info->height;
|
||||||
aOutTexInfo->texture = (u8*)info->pointer;
|
aOutTexInfo->texture = (Texture*)info->pointer;
|
||||||
aOutTexInfo->name = aTexName;
|
aOutTexInfo->name = aTexName;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -522,7 +522,7 @@ bool DynOS_Tex_GetFromData(const Texture *aTex, struct TextureInfo* aOutTexInfo)
|
||||||
aOutTexInfo->bitSize = info->bitSize;
|
aOutTexInfo->bitSize = info->bitSize;
|
||||||
aOutTexInfo->width = info->width;
|
aOutTexInfo->width = info->width;
|
||||||
aOutTexInfo->height = info->height;
|
aOutTexInfo->height = info->height;
|
||||||
aOutTexInfo->texture = (u8*)info->pointer;
|
aOutTexInfo->texture = (Texture*)info->pointer;
|
||||||
aOutTexInfo->name = info->identifier;
|
aOutTexInfo->name = info->identifier;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3446,10 +3446,33 @@ Gets the texture from a display list command if it has an image related op
|
||||||
| cmd | `Pointer` <`Gfx`> |
|
| cmd | `Pointer` <`Gfx`> |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
- `Pointer` <`integer`>
|
- `Pointer` <`Texture`>
|
||||||
|
|
||||||
### C Prototype
|
### C Prototype
|
||||||
`u8 *gfx_get_texture(Gfx *cmd);`
|
`Texture *gfx_get_texture(Gfx *cmd);`
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
## [gfx_get_name](#gfx_get_name)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Gets the name of a display list
|
||||||
|
|
||||||
|
### Lua Example
|
||||||
|
`local stringValue = gfx_get_name(gfx)`
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Field | Type |
|
||||||
|
| ----- | ---- |
|
||||||
|
| gfx | `Pointer` <`Gfx`> |
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
- `string`
|
||||||
|
|
||||||
|
### C Prototype
|
||||||
|
`const char *gfx_get_name(Gfx *gfx);`
|
||||||
|
|
||||||
[:arrow_up_small:](#)
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
|
@ -3642,6 +3665,29 @@ Deletes all display lists created by `gfx_create`
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
## [vtx_get_name](#vtx_get_name)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Gets the name of a vertex buffer
|
||||||
|
|
||||||
|
### Lua Example
|
||||||
|
`local stringValue = vtx_get_name(vtx)`
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Field | Type |
|
||||||
|
| ----- | ---- |
|
||||||
|
| vtx | `Pointer` <`Vtx`> |
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
- `string`
|
||||||
|
|
||||||
|
### C Prototype
|
||||||
|
`const char *vtx_get_name(Vtx *vtx);`
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
## [vtx_get_count](#vtx_get_count)
|
## [vtx_get_count](#vtx_get_count)
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
|
|
@ -5951,7 +5997,7 @@ Gets the current GraphNodeHeldObject
|
||||||
## [texture_to_lua_table](#texture_to_lua_table)
|
## [texture_to_lua_table](#texture_to_lua_table)
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
Converts a texture's pixels to a Lua table. Returns nil if failed. Otherwise, returns a table as a pure memory buffer. Supports rgba16 and rgba32 textures.
|
Converts a texture's pixels to a Lua table. Returns nil if failed. Otherwise, returns a table as a pure memory buffer. Supports rgba16 and rgba32 textures
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
`texture_to_lua_table(tex)`
|
`texture_to_lua_table(tex)`
|
||||||
|
|
@ -5959,13 +6005,36 @@ Converts a texture's pixels to a Lua table. Returns nil if failed. Otherwise, re
|
||||||
### Parameters
|
### Parameters
|
||||||
| Field | Type |
|
| Field | Type |
|
||||||
| ----- | ---- |
|
| ----- | ---- |
|
||||||
| tex | `Pointer` <`integer`> |
|
| tex | `Pointer` <`Texture`> |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
- None
|
- None
|
||||||
|
|
||||||
### C Prototype
|
### C Prototype
|
||||||
`void texture_to_lua_table(const u8 *tex);`
|
`void texture_to_lua_table(const Texture *tex);`
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
## [get_texture_name](#get_texture_name)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Gets the name of the provided texture pointer `tex`
|
||||||
|
|
||||||
|
### Lua Example
|
||||||
|
`local stringValue = get_texture_name(tex)`
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Field | Type |
|
||||||
|
| ----- | ---- |
|
||||||
|
| tex | `Pointer` <`Texture`> |
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
- `string`
|
||||||
|
|
||||||
|
### C Prototype
|
||||||
|
`const char *get_texture_name(const Texture *tex);`
|
||||||
|
|
||||||
[:arrow_up_small:](#)
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
|
@ -8442,80 +8511,6 @@ Gets the closest point of the triangle to `src` and returns it in `out`.
|
||||||
|
|
||||||
[:arrow_up_small:](#)
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
---
|
|
||||||
# functions from surface_load.h
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
|
|
||||||
## [load_object_collision_model](#load_object_collision_model)
|
|
||||||
|
|
||||||
### Description
|
|
||||||
Loads the object's collision data into dynamic collision. You must run this every frame in your object's behavior loop for it to have collision
|
|
||||||
|
|
||||||
### Lua Example
|
|
||||||
`load_object_collision_model()`
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
- None
|
|
||||||
|
|
||||||
### Returns
|
|
||||||
- None
|
|
||||||
|
|
||||||
### C Prototype
|
|
||||||
`void load_object_collision_model(void);`
|
|
||||||
|
|
||||||
[:arrow_up_small:](#)
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
## [obj_get_surface_from_index](#obj_get_surface_from_index)
|
|
||||||
|
|
||||||
### Description
|
|
||||||
Gets a surface corresponding to `index` from the surface pool buffer
|
|
||||||
|
|
||||||
### Lua Example
|
|
||||||
`local SurfaceValue = obj_get_surface_from_index(o, index)`
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
| Field | Type |
|
|
||||||
| ----- | ---- |
|
|
||||||
| o | [Object](structs.md#Object) |
|
|
||||||
| index | `integer` |
|
|
||||||
|
|
||||||
### Returns
|
|
||||||
[Surface](structs.md#Surface)
|
|
||||||
|
|
||||||
### C Prototype
|
|
||||||
`struct Surface *obj_get_surface_from_index(struct Object *o, u32 index);`
|
|
||||||
|
|
||||||
[:arrow_up_small:](#)
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
## [surface_has_force](#surface_has_force)
|
|
||||||
|
|
||||||
### Description
|
|
||||||
Checks if a surface has force
|
|
||||||
|
|
||||||
### Lua Example
|
|
||||||
`local booleanValue = surface_has_force(surfaceType)`
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
| Field | Type |
|
|
||||||
| ----- | ---- |
|
|
||||||
| surfaceType | `integer` |
|
|
||||||
|
|
||||||
### Returns
|
|
||||||
- `boolean`
|
|
||||||
|
|
||||||
### C Prototype
|
|
||||||
`bool surface_has_force(s16 surfaceType);`
|
|
||||||
|
|
||||||
[:arrow_up_small:](#)
|
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,80 @@
|
||||||
[< prev](functions-6.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | [4](functions-4.md) | [5](functions-5.md) | [6](functions-6.md) | 7]
|
[< prev](functions-6.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | [4](functions-4.md) | [5](functions-5.md) | [6](functions-6.md) | 7]
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
# functions from surface_load.h
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
|
||||||
|
## [load_object_collision_model](#load_object_collision_model)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Loads the object's collision data into dynamic collision. You must run this every frame in your object's behavior loop for it to have collision
|
||||||
|
|
||||||
|
### Lua Example
|
||||||
|
`load_object_collision_model()`
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
- None
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
- None
|
||||||
|
|
||||||
|
### C Prototype
|
||||||
|
`void load_object_collision_model(void);`
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
## [obj_get_surface_from_index](#obj_get_surface_from_index)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Gets a surface corresponding to `index` from the surface pool buffer
|
||||||
|
|
||||||
|
### Lua Example
|
||||||
|
`local SurfaceValue = obj_get_surface_from_index(o, index)`
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Field | Type |
|
||||||
|
| ----- | ---- |
|
||||||
|
| o | [Object](structs.md#Object) |
|
||||||
|
| index | `integer` |
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
[Surface](structs.md#Surface)
|
||||||
|
|
||||||
|
### C Prototype
|
||||||
|
`struct Surface *obj_get_surface_from_index(struct Object *o, u32 index);`
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
## [surface_has_force](#surface_has_force)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Checks if a surface has force
|
||||||
|
|
||||||
|
### Lua Example
|
||||||
|
`local booleanValue = surface_has_force(surfaceType)`
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Field | Type |
|
||||||
|
| ----- | ---- |
|
||||||
|
| surfaceType | `integer` |
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
- `boolean`
|
||||||
|
|
||||||
|
### C Prototype
|
||||||
|
`bool surface_has_force(s16 surfaceType);`
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
---
|
---
|
||||||
# functions from sync_object.h
|
# functions from sync_object.h
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1934,6 +1934,7 @@
|
||||||
- [gfx_get_vertex_buffer](functions-6.md#gfx_get_vertex_buffer)
|
- [gfx_get_vertex_buffer](functions-6.md#gfx_get_vertex_buffer)
|
||||||
- [gfx_get_vertex_count](functions-6.md#gfx_get_vertex_count)
|
- [gfx_get_vertex_count](functions-6.md#gfx_get_vertex_count)
|
||||||
- [gfx_get_texture](functions-6.md#gfx_get_texture)
|
- [gfx_get_texture](functions-6.md#gfx_get_texture)
|
||||||
|
- [gfx_get_name](functions-6.md#gfx_get_name)
|
||||||
- [gfx_get_length](functions-6.md#gfx_get_length)
|
- [gfx_get_length](functions-6.md#gfx_get_length)
|
||||||
- [gfx_get_command](functions-6.md#gfx_get_command)
|
- [gfx_get_command](functions-6.md#gfx_get_command)
|
||||||
- [gfx_get_next_command](functions-6.md#gfx_get_next_command)
|
- [gfx_get_next_command](functions-6.md#gfx_get_next_command)
|
||||||
|
|
@ -1942,6 +1943,7 @@
|
||||||
- [gfx_resize](functions-6.md#gfx_resize)
|
- [gfx_resize](functions-6.md#gfx_resize)
|
||||||
- [gfx_delete](functions-6.md#gfx_delete)
|
- [gfx_delete](functions-6.md#gfx_delete)
|
||||||
- [gfx_delete_all](functions-6.md#gfx_delete_all)
|
- [gfx_delete_all](functions-6.md#gfx_delete_all)
|
||||||
|
- [vtx_get_name](functions-6.md#vtx_get_name)
|
||||||
- [vtx_get_count](functions-6.md#vtx_get_count)
|
- [vtx_get_count](functions-6.md#vtx_get_count)
|
||||||
- [vtx_get_vertex](functions-6.md#vtx_get_vertex)
|
- [vtx_get_vertex](functions-6.md#vtx_get_vertex)
|
||||||
- [vtx_get_next_vertex](functions-6.md#vtx_get_next_vertex)
|
- [vtx_get_next_vertex](functions-6.md#vtx_get_next_vertex)
|
||||||
|
|
@ -2053,6 +2055,7 @@
|
||||||
- [geo_get_current_camera](functions-6.md#geo_get_current_camera)
|
- [geo_get_current_camera](functions-6.md#geo_get_current_camera)
|
||||||
- [geo_get_current_held_object](functions-6.md#geo_get_current_held_object)
|
- [geo_get_current_held_object](functions-6.md#geo_get_current_held_object)
|
||||||
- [texture_to_lua_table](functions-6.md#texture_to_lua_table)
|
- [texture_to_lua_table](functions-6.md#texture_to_lua_table)
|
||||||
|
- [get_texture_name](functions-6.md#get_texture_name)
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
|
@ -2185,9 +2188,9 @@
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
- surface_load.h
|
- surface_load.h
|
||||||
- [load_object_collision_model](functions-6.md#load_object_collision_model)
|
- [load_object_collision_model](functions-7.md#load_object_collision_model)
|
||||||
- [obj_get_surface_from_index](functions-6.md#obj_get_surface_from_index)
|
- [obj_get_surface_from_index](functions-7.md#obj_get_surface_from_index)
|
||||||
- [surface_has_force](functions-6.md#surface_has_force)
|
- [surface_has_force](functions-7.md#surface_has_force)
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3240,7 +3240,7 @@
|
||||||
|
|
||||||
| Field | Type | Access |
|
| Field | Type | Access |
|
||||||
| ----- | ---- | ------ |
|
| ----- | ---- | ------ |
|
||||||
| texture | `Pointer` <`integer`> | read-only |
|
| texture | `Pointer` <`Texture`> | read-only |
|
||||||
| name | `string` | read-only |
|
| name | `string` | read-only |
|
||||||
| width | `integer` | read-only |
|
| width | `integer` | read-only |
|
||||||
| height | `integer` | read-only |
|
| height | `integer` | read-only |
|
||||||
|
|
|
||||||
|
|
@ -577,7 +577,7 @@ struct MarioState
|
||||||
|
|
||||||
struct TextureInfo
|
struct TextureInfo
|
||||||
{
|
{
|
||||||
u8 *texture;
|
Texture *texture;
|
||||||
const char *name;
|
const char *name;
|
||||||
u32 width;
|
u32 width;
|
||||||
u32 height;
|
u32 height;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ struct Character gCharacters[CT_MAX] = {
|
||||||
.type = CT_MARIO,
|
.type = CT_MARIO,
|
||||||
.name = "Mario",
|
.name = "Mario",
|
||||||
.hudHead = '(',
|
.hudHead = '(',
|
||||||
.hudHeadTexture = { .texture = (u8*)texture_hud_char_mario_head, .bitSize = 8, .width = 16, .height = 16, .name = "texture_hud_char_mario_head" },
|
.hudHeadTexture = { .texture = (Texture*)texture_hud_char_mario_head, .bitSize = 8, .width = 16, .height = 16, .name = "texture_hud_char_mario_head" },
|
||||||
.cameraHudHead = GLYPH_CAM_MARIO_HEAD,
|
.cameraHudHead = GLYPH_CAM_MARIO_HEAD,
|
||||||
.modelId = MODEL_MARIO,
|
.modelId = MODEL_MARIO,
|
||||||
.capModelId = MODEL_MARIOS_CAP,
|
.capModelId = MODEL_MARIOS_CAP,
|
||||||
|
|
@ -101,7 +101,7 @@ struct Character gCharacters[CT_MAX] = {
|
||||||
.type = CT_LUIGI,
|
.type = CT_LUIGI,
|
||||||
.name = "Luigi",
|
.name = "Luigi",
|
||||||
.hudHead = ')',
|
.hudHead = ')',
|
||||||
.hudHeadTexture = { .texture = (u8*)texture_hud_char_luigi_head, .bitSize = 8, .width = 16, .height = 16, .name = "texture_hud_char_luigi_head" },
|
.hudHeadTexture = { .texture = (Texture*)texture_hud_char_luigi_head, .bitSize = 8, .width = 16, .height = 16, .name = "texture_hud_char_luigi_head" },
|
||||||
.cameraHudHead = GLYPH_CAM_LUIGI_HEAD,
|
.cameraHudHead = GLYPH_CAM_LUIGI_HEAD,
|
||||||
.modelId = MODEL_LUIGI,
|
.modelId = MODEL_LUIGI,
|
||||||
.capModelId = MODEL_LUIGIS_CAP,
|
.capModelId = MODEL_LUIGIS_CAP,
|
||||||
|
|
@ -167,7 +167,7 @@ struct Character gCharacters[CT_MAX] = {
|
||||||
.type = CT_TOAD,
|
.type = CT_TOAD,
|
||||||
.name = "Toad",
|
.name = "Toad",
|
||||||
.hudHead = '|',
|
.hudHead = '|',
|
||||||
.hudHeadTexture = { .texture = (u8*)texture_hud_char_toad_head, .bitSize = 8, .width = 16, .height = 16, .name = "texture_hud_char_toad_head" },
|
.hudHeadTexture = { .texture = (Texture*)texture_hud_char_toad_head, .bitSize = 8, .width = 16, .height = 16, .name = "texture_hud_char_toad_head" },
|
||||||
.cameraHudHead = GLYPH_CAM_TOAD_HEAD,
|
.cameraHudHead = GLYPH_CAM_TOAD_HEAD,
|
||||||
.modelId = MODEL_TOAD_PLAYER,
|
.modelId = MODEL_TOAD_PLAYER,
|
||||||
.capModelId = MODEL_TOADS_CAP,
|
.capModelId = MODEL_TOADS_CAP,
|
||||||
|
|
@ -233,7 +233,7 @@ struct Character gCharacters[CT_MAX] = {
|
||||||
.type = CT_WALUIGI,
|
.type = CT_WALUIGI,
|
||||||
.name = "Waluigi",
|
.name = "Waluigi",
|
||||||
.hudHead = ']',
|
.hudHead = ']',
|
||||||
.hudHeadTexture = { .texture = (u8*)texture_hud_char_waluigi_head, .bitSize = 8, .width = 16, .height = 16, .name = "texture_hud_char_waluigi_head" },
|
.hudHeadTexture = { .texture = (Texture*)texture_hud_char_waluigi_head, .bitSize = 8, .width = 16, .height = 16, .name = "texture_hud_char_waluigi_head" },
|
||||||
.cameraHudHead = GLYPH_CAM_WALUIGI_HEAD,
|
.cameraHudHead = GLYPH_CAM_WALUIGI_HEAD,
|
||||||
.modelId = MODEL_WALUIGI,
|
.modelId = MODEL_WALUIGI,
|
||||||
.capModelId = MODEL_WALUIGIS_CAP,
|
.capModelId = MODEL_WALUIGIS_CAP,
|
||||||
|
|
@ -299,7 +299,7 @@ struct Character gCharacters[CT_MAX] = {
|
||||||
.type = CT_WARIO,
|
.type = CT_WARIO,
|
||||||
.name = "Wario",
|
.name = "Wario",
|
||||||
.hudHead = '[',
|
.hudHead = '[',
|
||||||
.hudHeadTexture = { .texture = (u8*)texture_hud_char_wario_head, .bitSize = 8, .width = 16, .height = 16, .name = "texture_hud_char_wario_head" },
|
.hudHeadTexture = { .texture = (Texture*)texture_hud_char_wario_head, .bitSize = 8, .width = 16, .height = 16, .name = "texture_hud_char_wario_head" },
|
||||||
.cameraHudHead = GLYPH_CAM_WARIO_HEAD,
|
.cameraHudHead = GLYPH_CAM_WARIO_HEAD,
|
||||||
.modelId = MODEL_WARIO,
|
.modelId = MODEL_WARIO,
|
||||||
.capModelId = MODEL_WARIOS_CAP,
|
.capModelId = MODEL_WARIOS_CAP,
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,7 @@ void render_hud_power_meter(void) {
|
||||||
#define HUD_TOP_Y 209
|
#define HUD_TOP_Y 209
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void render_hud_icon(Vtx *vtx, const u8 *texture, u32 fmt, u32 siz, s32 texW, s32 texH, s32 x, s32 y, s32 w, s32 h, s32 tileX, s32 tileY, s32 tileW, s32 tileH) {
|
void render_hud_icon(Vtx *vtx, const Texture *texture, u32 fmt, u32 siz, s32 texW, s32 texH, s32 x, s32 y, s32 w, s32 h, s32 tileX, s32 tileY, s32 tileW, s32 tileH) {
|
||||||
create_dl_ortho_matrix();
|
create_dl_ortho_matrix();
|
||||||
if (!vtx) {
|
if (!vtx) {
|
||||||
vtx = alloc_display_list(sizeof(Vtx) * 4);
|
vtx = alloc_display_list(sizeof(Vtx) * 4);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ enum CameraHUDLut {
|
||||||
|
|
||||||
extern u8 gOverrideHideHud;
|
extern u8 gOverrideHideHud;
|
||||||
|
|
||||||
void render_hud_icon(Vtx *vtx, const u8 *texture, u32 fmt, u32 siz, s32 texW, s32 texH, s32 x, s32 y, s32 w, s32 h, s32 tileX, s32 tileY, s32 tileW, s32 tileH);
|
void render_hud_icon(Vtx *vtx, const Texture *texture, u32 fmt, u32 siz, s32 texW, s32 texH, s32 x, s32 y, s32 w, s32 h, s32 tileX, s32 tileY, s32 tileW, s32 tileH);
|
||||||
|
|
||||||
s16 get_hud_camera_status(void);
|
s16 get_hud_camera_status(void);
|
||||||
void set_hud_camera_status(s16 status);
|
void set_hud_camera_status(s16 status);
|
||||||
|
|
|
||||||
|
|
@ -123,13 +123,13 @@ static u8 djui_gfx_power_of_two(u32 value) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void djui_gfx_render_texture(const u8* texture, u32 w, u32 h, u32 bitSize, bool filter) {
|
void djui_gfx_render_texture(const Texture* texture, u32 w, u32 h, u32 bitSize, bool filter) {
|
||||||
gDPSetTextureFilter(gDisplayListHead++, filter ? G_TF_BILERP : G_TF_POINT);
|
gDPSetTextureFilter(gDisplayListHead++, filter ? G_TF_BILERP : G_TF_POINT);
|
||||||
gDPSetTextureOverrideDjui(gDisplayListHead++, texture, djui_gfx_power_of_two(w), djui_gfx_power_of_two(h), bitSize);
|
gDPSetTextureOverrideDjui(gDisplayListHead++, texture, djui_gfx_power_of_two(w), djui_gfx_power_of_two(h), bitSize);
|
||||||
gSPDisplayList(gDisplayListHead++, dl_djui_image);
|
gSPDisplayList(gDisplayListHead++, dl_djui_image);
|
||||||
}
|
}
|
||||||
|
|
||||||
void djui_gfx_render_texture_tile(const u8* texture, u32 w, u32 h, u32 bitSize, u32 tileX, u32 tileY, u32 tileW, u32 tileH, bool filter, bool font) {
|
void djui_gfx_render_texture_tile(const Texture* texture, u32 w, u32 h, u32 bitSize, u32 tileX, u32 tileY, u32 tileW, u32 tileH, bool filter, bool font) {
|
||||||
if (!gDisplayListHead) {
|
if (!gDisplayListHead) {
|
||||||
LOG_ERROR("Retrieved a null displaylist head");
|
LOG_ERROR("Retrieved a null displaylist head");
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ void djui_gfx_displaylist_end(void);
|
||||||
|
|
||||||
f32 djui_gfx_get_scale(void);
|
f32 djui_gfx_get_scale(void);
|
||||||
|
|
||||||
void djui_gfx_render_texture(const u8* texture, u32 w, u32 h, u32 bitSize, bool filter);
|
void djui_gfx_render_texture(const Texture* texture, u32 w, u32 h, u32 bitSize, bool filter);
|
||||||
void djui_gfx_render_texture_tile(const u8* texture, u32 w, u32 h, u32 bitSize, u32 tileX, u32 tileY, u32 tileW, u32 tileH, bool filter, bool font);
|
void djui_gfx_render_texture_tile(const Texture* texture, u32 w, u32 h, u32 bitSize, u32 tileX, u32 tileY, u32 tileW, u32 tileH, bool filter, bool font);
|
||||||
|
|
||||||
void gfx_get_dimensions(u32* width, u32* height);
|
void gfx_get_dimensions(u32* width, u32* height);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,20 +51,20 @@ extern ALIGNED8 const u8 texture_hud_char_apostrophe[];
|
||||||
extern ALIGNED8 const u8 texture_hud_char_double_quote[];
|
extern ALIGNED8 const u8 texture_hud_char_double_quote[];
|
||||||
|
|
||||||
struct GlobalTextures gGlobalTextures = {
|
struct GlobalTextures gGlobalTextures = {
|
||||||
.camera = { .texture = (u8*)texture_hud_char_camera, "texture_hud_char_camera", .width = 16, .height = 16, .bitSize = 8 },
|
.camera = { .texture = (Texture*)texture_hud_char_camera, "texture_hud_char_camera", .width = 16, .height = 16, .bitSize = 8 },
|
||||||
.lakitu = { .texture = (u8*)texture_hud_char_lakitu, "texture_hud_char_lakitu", .width = 16, .height = 16, .bitSize = 8 },
|
.lakitu = { .texture = (Texture*)texture_hud_char_lakitu, "texture_hud_char_lakitu", .width = 16, .height = 16, .bitSize = 8 },
|
||||||
.no_camera = { .texture = (u8*)texture_hud_char_no_camera, "texture_hud_char_no_camera", .width = 16, .height = 16, .bitSize = 8 },
|
.no_camera = { .texture = (Texture*)texture_hud_char_no_camera, "texture_hud_char_no_camera", .width = 16, .height = 16, .bitSize = 8 },
|
||||||
.arrow_up = { .texture = (u8*)texture_hud_char_arrow_up, "texture_hud_char_arrow_up", .width = 8, .height = 8, .bitSize = 8 },
|
.arrow_up = { .texture = (Texture*)texture_hud_char_arrow_up, "texture_hud_char_arrow_up", .width = 8, .height = 8, .bitSize = 8 },
|
||||||
.arrow_down = { .texture = (u8*)texture_hud_char_arrow_down, "texture_hud_char_arrow_down", .width = 8, .height = 8, .bitSize = 8 },
|
.arrow_down = { .texture = (Texture*)texture_hud_char_arrow_down, "texture_hud_char_arrow_down", .width = 8, .height = 8, .bitSize = 8 },
|
||||||
.coin = { .texture = (u8*)texture_hud_char_coin, "texture_hud_char_coin", .width = 16, .height = 16, .bitSize = 8 },
|
.coin = { .texture = (Texture*)texture_hud_char_coin, "texture_hud_char_coin", .width = 16, .height = 16, .bitSize = 8 },
|
||||||
.star = { .texture = (u8*)texture_hud_char_star, "texture_hud_char_star", .width = 16, .height = 16, .bitSize = 8 },
|
.star = { .texture = (Texture*)texture_hud_char_star, "texture_hud_char_star", .width = 16, .height = 16, .bitSize = 8 },
|
||||||
.apostrophe = { .texture = (u8*)texture_hud_char_apostrophe, "texture_hud_char_apostrophe", .width = 16, .height = 16, .bitSize = 8 },
|
.apostrophe = { .texture = (Texture*)texture_hud_char_apostrophe, "texture_hud_char_apostrophe", .width = 16, .height = 16, .bitSize = 8 },
|
||||||
.double_quote = { .texture = (u8*)texture_hud_char_double_quote, "texture_hud_char_double_quote", .width = 16, .height = 16, .bitSize = 8 },
|
.double_quote = { .texture = (Texture*)texture_hud_char_double_quote, "texture_hud_char_double_quote", .width = 16, .height = 16, .bitSize = 8 },
|
||||||
.mario_head = { .texture = (u8*)texture_hud_char_mario_head, "texture_hud_char_mario_head", .width = 16, .height = 16, .bitSize = 8 },
|
.mario_head = { .texture = (Texture*)texture_hud_char_mario_head, "texture_hud_char_mario_head", .width = 16, .height = 16, .bitSize = 8 },
|
||||||
.luigi_head = { .texture = (u8*)texture_hud_char_luigi_head, "texture_hud_char_luigi_head", .width = 16, .height = 16, .bitSize = 8 },
|
.luigi_head = { .texture = (Texture*)texture_hud_char_luigi_head, "texture_hud_char_luigi_head", .width = 16, .height = 16, .bitSize = 8 },
|
||||||
.toad_head = { .texture = (u8*)texture_hud_char_toad_head, "texture_hud_char_toad_head", .width = 16, .height = 16, .bitSize = 8 },
|
.toad_head = { .texture = (Texture*)texture_hud_char_toad_head, "texture_hud_char_toad_head", .width = 16, .height = 16, .bitSize = 8 },
|
||||||
.waluigi_head = { .texture = (u8*)texture_hud_char_waluigi_head, "texture_hud_char_waluigi_head", .width = 16, .height = 16, .bitSize = 8 },
|
.waluigi_head = { .texture = (Texture*)texture_hud_char_waluigi_head, "texture_hud_char_waluigi_head", .width = 16, .height = 16, .bitSize = 8 },
|
||||||
.wario_head = { .texture = (u8*)texture_hud_char_wario_head, "texture_hud_char_wario_head", .width = 16, .height = 16, .bitSize = 8 }
|
.wario_head = { .texture = (Texture*)texture_hud_char_wario_head, "texture_hud_char_wario_head", .width = 16, .height = 16, .bitSize = 8 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void djui_hud_position_translate(f32* x, f32* y) {
|
static void djui_hud_position_translate(f32* x, f32* y) {
|
||||||
|
|
@ -495,7 +495,7 @@ static inline bool is_power_of_two(u32 n) {
|
||||||
return (n > 0) && ((n & (n - 1)) == 0);
|
return (n > 0) && ((n & (n - 1)) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void djui_hud_render_texture_raw(const u8* texture, u32 bitSize, u32 width, u32 height, f32 x, f32 y, f32 scaleW, f32 scaleH) {
|
void djui_hud_render_texture_raw(const Texture* texture, u32 bitSize, u32 width, u32 height, f32 x, f32 y, f32 scaleW, f32 scaleH) {
|
||||||
if (!is_power_of_two(width) || !is_power_of_two(height)) {
|
if (!is_power_of_two(width) || !is_power_of_two(height)) {
|
||||||
LOG_LUA_LINE("Tried to render DJUI HUD texture with NPOT width or height");
|
LOG_LUA_LINE("Tried to render DJUI HUD texture with NPOT width or height");
|
||||||
return;
|
return;
|
||||||
|
|
@ -534,7 +534,7 @@ void djui_hud_render_texture_raw(const u8* texture, u32 bitSize, u32 width, u32
|
||||||
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
void djui_hud_render_texture_tile_raw(const u8* texture, u32 bitSize, u32 width, u32 height, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH) {
|
void djui_hud_render_texture_tile_raw(const Texture* texture, u32 bitSize, u32 width, u32 height, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH) {
|
||||||
if (!texture) { return; }
|
if (!texture) { return; }
|
||||||
|
|
||||||
gDjuiHudUtilsZ += 0.01f;
|
gDjuiHudUtilsZ += 0.01f;
|
||||||
|
|
|
||||||
|
|
@ -121,10 +121,10 @@ void djui_hud_print_text(const char* message, f32 x, f32 y, f32 scale);
|
||||||
void djui_hud_print_text_interpolated(const char* message, f32 prevX, f32 prevY, f32 prevScale, f32 x, f32 y, f32 scale);
|
void djui_hud_print_text_interpolated(const char* message, f32 prevX, f32 prevY, f32 prevScale, f32 x, f32 y, f32 scale);
|
||||||
/* |description|Renders a DJUI HUD texture onto the screen|descriptionEnd| */
|
/* |description|Renders a DJUI HUD texture onto the screen|descriptionEnd| */
|
||||||
void djui_hud_render_texture(struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH);
|
void djui_hud_render_texture(struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH);
|
||||||
void djui_hud_render_texture_raw(const u8* texture, u32 bitSize, u32 width, u32 height, f32 x, f32 y, f32 scaleW, f32 scaleH);
|
void djui_hud_render_texture_raw(const Texture* texture, u32 bitSize, u32 width, u32 height, f32 x, f32 y, f32 scaleW, f32 scaleH);
|
||||||
/* |description|Renders a DJUI HUD texture tile onto the screen|descriptionEnd| */
|
/* |description|Renders a DJUI HUD texture tile onto the screen|descriptionEnd| */
|
||||||
void djui_hud_render_texture_tile(struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH);
|
void djui_hud_render_texture_tile(struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH);
|
||||||
void djui_hud_render_texture_tile_raw(const u8* texture, u32 bitSize, u32 width, u32 height, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH);
|
void djui_hud_render_texture_tile_raw(const Texture* texture, u32 bitSize, u32 width, u32 height, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH);
|
||||||
/* |description|Renders an interpolated DJUI HUD texture onto the screen|descriptionEnd| */
|
/* |description|Renders an interpolated DJUI HUD texture onto the screen|descriptionEnd| */
|
||||||
void djui_hud_render_texture_interpolated(struct TextureInfo* texInfo, f32 prevX, f32 prevY, f32 prevScaleW, f32 prevScaleH, f32 x, f32 y, f32 scaleW, f32 scaleH);
|
void djui_hud_render_texture_interpolated(struct TextureInfo* texInfo, f32 prevX, f32 prevY, f32 prevScaleW, f32 prevScaleH, f32 x, f32 y, f32 scaleW, f32 scaleH);
|
||||||
/* |description|Renders an interpolated DJUI HUD texture tile onto the screen|descriptionEnd| */
|
/* |description|Renders an interpolated DJUI HUD texture tile onto the screen|descriptionEnd| */
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
// properties //
|
// properties //
|
||||||
////////////////
|
////////////////
|
||||||
|
|
||||||
void djui_image_set_image(struct DjuiImage* image, const u8* texture, u16 textureWidth, u16 textureHeight, u16 textureBitSize) {
|
void djui_image_set_image(struct DjuiImage* image, const Texture* texture, u16 textureWidth, u16 textureHeight, u16 textureBitSize) {
|
||||||
image->texture = texture;
|
image->texture = texture;
|
||||||
image->textureWidth = textureWidth;
|
image->textureWidth = textureWidth;
|
||||||
image->textureHeight = textureHeight;
|
image->textureHeight = textureHeight;
|
||||||
|
|
@ -48,7 +48,7 @@ static void djui_image_destroy(struct DjuiBase* base) {
|
||||||
free(image);
|
free(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DjuiImage* djui_image_create(struct DjuiBase* parent, const u8* texture, u16 textureWidth, u16 textureHeight, u16 textureBitSize) {
|
struct DjuiImage* djui_image_create(struct DjuiBase* parent, const Texture* texture, u16 textureWidth, u16 textureHeight, u16 textureBitSize) {
|
||||||
struct DjuiImage* image = calloc(1, sizeof(struct DjuiImage));
|
struct DjuiImage* image = calloc(1, sizeof(struct DjuiImage));
|
||||||
struct DjuiBase* base = &image->base;
|
struct DjuiBase* base = &image->base;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@
|
||||||
|
|
||||||
struct DjuiImage {
|
struct DjuiImage {
|
||||||
struct DjuiBase base;
|
struct DjuiBase base;
|
||||||
const u8* texture;
|
const Texture* texture;
|
||||||
u16 textureWidth;
|
u16 textureWidth;
|
||||||
u16 textureHeight;
|
u16 textureHeight;
|
||||||
u16 textureBitSize;
|
u16 textureBitSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
void djui_image_set_image(struct DjuiImage* image, const u8* texture, u16 textureWidth, u16 textureHeight, u16 textureBitSize);
|
void djui_image_set_image(struct DjuiImage* image, const Texture* texture, u16 textureWidth, u16 textureHeight, u16 textureBitSize);
|
||||||
|
|
||||||
struct DjuiImage* djui_image_create(struct DjuiBase* parent, const u8* texture, u16 textureWidth, u16 textureHeight, u16 textureBitSize);
|
struct DjuiImage* djui_image_create(struct DjuiBase* parent, const Texture* texture, u16 textureWidth, u16 textureHeight, u16 textureBitSize);
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ bool smlua_valid_lvt(u16 lvt) {
|
||||||
return (lvt < LVT_MAX);
|
return (lvt < LVT_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *sLuaLvtNames[] = {
|
static const char *sLuaLvtNames[] = {
|
||||||
[LVT_BOOL] = "bool",
|
[LVT_BOOL] = "bool",
|
||||||
[LVT_BOOL_P] = "bool Pointer",
|
[LVT_BOOL_P] = "bool Pointer",
|
||||||
[LVT_U8] = "u8",
|
[LVT_U8] = "u8",
|
||||||
|
|
@ -91,16 +91,12 @@ const char *sLuaLvtNames[] = {
|
||||||
[LVT_COBJECT_P] = "CObject Pointer",
|
[LVT_COBJECT_P] = "CObject Pointer",
|
||||||
[LVT_STRING] = "string",
|
[LVT_STRING] = "string",
|
||||||
[LVT_STRING_P] = "string Pointer",
|
[LVT_STRING_P] = "string Pointer",
|
||||||
[LVT_BEHAVIORSCRIPT] = "BehaviorScript",
|
|
||||||
[LVT_BEHAVIORSCRIPT_P] = "BehaviorScript Pointer",
|
[LVT_BEHAVIORSCRIPT_P] = "BehaviorScript Pointer",
|
||||||
[LVT_OBJECTANIMPOINTER] = "ObjectAnimPointer",
|
|
||||||
[LVT_OBJECTANIMPOINTER_P] = "ObjectAnimPointer Pointer",
|
[LVT_OBJECTANIMPOINTER_P] = "ObjectAnimPointer Pointer",
|
||||||
[LVT_COLLISION] = "Collision",
|
|
||||||
[LVT_COLLISION_P] = "Collision Pointer",
|
[LVT_COLLISION_P] = "Collision Pointer",
|
||||||
[LVT_LEVELSCRIPT] = "LevelScript",
|
|
||||||
[LVT_LEVELSCRIPT_P] = "LevelScript Pointer",
|
[LVT_LEVELSCRIPT_P] = "LevelScript Pointer",
|
||||||
[LVT_TRAJECTORY] = "Trajectory",
|
|
||||||
[LVT_TRAJECTORY_P] = "Trajectory Pointer",
|
[LVT_TRAJECTORY_P] = "Trajectory Pointer",
|
||||||
|
[LVT_TEXTURE_P] = "Texture Pointer",
|
||||||
[LVT_LUAFUNCTION] = "LuaFunction",
|
[LVT_LUAFUNCTION] = "LuaFunction",
|
||||||
[LVT_POINTER] = "Pointer",
|
[LVT_POINTER] = "Pointer",
|
||||||
[LVT_MAX] = "Max",
|
[LVT_MAX] = "Max",
|
||||||
|
|
@ -373,24 +369,19 @@ struct LuaObjectField* smlua_get_custom_field(lua_State* L, u32 lot, int keyInde
|
||||||
|
|
||||||
static bool smlua_push_field(lua_State* L, u8* p, struct LuaObjectField *data) {
|
static bool smlua_push_field(lua_State* L, u8* p, struct LuaObjectField *data) {
|
||||||
switch (data->valueType) {
|
switch (data->valueType) {
|
||||||
case LVT_BOOL: lua_pushboolean(L, *(u8* )p); break;
|
case LVT_BOOL: lua_pushboolean(L, *(u8* )p); break;
|
||||||
case LVT_U8: lua_pushinteger(L, *(u8* )p); break;
|
case LVT_U8: lua_pushinteger(L, *(u8* )p); break;
|
||||||
case LVT_U16: lua_pushinteger(L, *(u16*)p); break;
|
case LVT_U16: lua_pushinteger(L, *(u16*)p); break;
|
||||||
case LVT_U32: lua_pushinteger(L, *(u32*)p); break;
|
case LVT_U32: lua_pushinteger(L, *(u32*)p); break;
|
||||||
case LVT_S8: lua_pushinteger(L, *(s8* )p); break;
|
case LVT_S8: lua_pushinteger(L, *(s8* )p); break;
|
||||||
case LVT_S16: lua_pushinteger(L, *(s16*)p); break;
|
case LVT_S16: lua_pushinteger(L, *(s16*)p); break;
|
||||||
case LVT_S32: lua_pushinteger(L, *(s32*)p); break;
|
case LVT_S32: lua_pushinteger(L, *(s32*)p); break;
|
||||||
case LVT_F32: lua_pushnumber( L, *(f32*)p); break;
|
case LVT_F32: lua_pushnumber( L, *(f32*)p); break;
|
||||||
case LVT_U64: lua_pushinteger(L, *(u64*)p); break;
|
case LVT_U64: lua_pushinteger(L, *(u64*)p); break;
|
||||||
case LVT_COBJECT: smlua_push_object(L, data->lot, p, NULL); break;
|
case LVT_COBJECT: smlua_push_object(L, data->lot, p, NULL); break;
|
||||||
case LVT_COBJECT_P: smlua_push_object(L, data->lot, *(u8**)p, NULL); break;
|
case LVT_COBJECT_P: smlua_push_object(L, data->lot, *(u8**)p, NULL); break;
|
||||||
case LVT_STRING: lua_pushstring(L, (char*)p); break;
|
case LVT_STRING: lua_pushstring(L, (char*)p); break;
|
||||||
case LVT_STRING_P: lua_pushstring(L, *(char**)p); break;
|
case LVT_STRING_P: lua_pushstring(L, *(char**)p); break;
|
||||||
case LVT_BEHAVIORSCRIPT: lua_pushinteger(L, *(s32*)p); break;
|
|
||||||
case LVT_OBJECTANIMPOINTER: lua_pushinteger(L, *(s32*)p); break;
|
|
||||||
case LVT_COLLISION: lua_pushinteger(L, *(s32*)p); break;
|
|
||||||
case LVT_LEVELSCRIPT: lua_pushinteger(L, *(s32*)p); break;
|
|
||||||
case LVT_TRAJECTORY: lua_pushinteger(L, *(s16*)p); break;
|
|
||||||
|
|
||||||
// pointers
|
// pointers
|
||||||
case LVT_BOOL_P:
|
case LVT_BOOL_P:
|
||||||
|
|
@ -407,6 +398,7 @@ static bool smlua_push_field(lua_State* L, u8* p, struct LuaObjectField *data) {
|
||||||
case LVT_COLLISION_P:
|
case LVT_COLLISION_P:
|
||||||
case LVT_LEVELSCRIPT_P:
|
case LVT_LEVELSCRIPT_P:
|
||||||
case LVT_TRAJECTORY_P:
|
case LVT_TRAJECTORY_P:
|
||||||
|
case LVT_TEXTURE_P:
|
||||||
smlua_push_pointer(L, data->valueType, *(u8**)p, NULL);
|
smlua_push_pointer(L, data->valueType, *(u8**)p, NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -453,7 +445,9 @@ static bool smlua_set_field(lua_State* L, u8* p, struct LuaObjectField *data) {
|
||||||
case LVT_BEHAVIORSCRIPT_P:
|
case LVT_BEHAVIORSCRIPT_P:
|
||||||
case LVT_OBJECTANIMPOINTER_P:
|
case LVT_OBJECTANIMPOINTER_P:
|
||||||
case LVT_COLLISION_P:
|
case LVT_COLLISION_P:
|
||||||
|
case LVT_LEVELSCRIPT_P:
|
||||||
case LVT_TRAJECTORY_P:
|
case LVT_TRAJECTORY_P:
|
||||||
|
case LVT_TEXTURE_P:
|
||||||
if (lua_isnil(L, 3)) {
|
if (lua_isnil(L, 3)) {
|
||||||
*(u8**)p = NULL;
|
*(u8**)p = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -24,16 +24,12 @@ enum LuaValueType {
|
||||||
LVT_COBJECT_P,
|
LVT_COBJECT_P,
|
||||||
LVT_STRING,
|
LVT_STRING,
|
||||||
LVT_STRING_P,
|
LVT_STRING_P,
|
||||||
LVT_BEHAVIORSCRIPT,
|
|
||||||
LVT_BEHAVIORSCRIPT_P,
|
LVT_BEHAVIORSCRIPT_P,
|
||||||
LVT_OBJECTANIMPOINTER,
|
|
||||||
LVT_OBJECTANIMPOINTER_P,
|
LVT_OBJECTANIMPOINTER_P,
|
||||||
LVT_COLLISION,
|
|
||||||
LVT_COLLISION_P,
|
LVT_COLLISION_P,
|
||||||
LVT_LEVELSCRIPT,
|
|
||||||
LVT_LEVELSCRIPT_P,
|
LVT_LEVELSCRIPT_P,
|
||||||
LVT_TRAJECTORY,
|
|
||||||
LVT_TRAJECTORY_P,
|
LVT_TRAJECTORY_P,
|
||||||
|
LVT_TEXTURE_P,
|
||||||
LVT_LUAFUNCTION,
|
LVT_LUAFUNCTION,
|
||||||
LVT_POINTER,
|
LVT_POINTER,
|
||||||
LVT_MAX,
|
LVT_MAX,
|
||||||
|
|
|
||||||
|
|
@ -2768,11 +2768,11 @@ static struct LuaObjectField sSurfaceFields[LUA_SURFACE_FIELD_COUNT] = {
|
||||||
|
|
||||||
#define LUA_TEXTURE_INFO_FIELD_COUNT 5
|
#define LUA_TEXTURE_INFO_FIELD_COUNT 5
|
||||||
static struct LuaObjectField sTextureInfoFields[LUA_TEXTURE_INFO_FIELD_COUNT] = {
|
static struct LuaObjectField sTextureInfoFields[LUA_TEXTURE_INFO_FIELD_COUNT] = {
|
||||||
{ "bitSize", LVT_U8, offsetof(struct TextureInfo, bitSize), true, LOT_NONE, 1, sizeof(u8) },
|
{ "bitSize", LVT_U8, offsetof(struct TextureInfo, bitSize), true, LOT_NONE, 1, sizeof(u8) },
|
||||||
{ "height", LVT_U32, offsetof(struct TextureInfo, height), true, LOT_NONE, 1, sizeof(u32) },
|
{ "height", LVT_U32, offsetof(struct TextureInfo, height), true, LOT_NONE, 1, sizeof(u32) },
|
||||||
{ "name", LVT_STRING_P, offsetof(struct TextureInfo, name), true, LOT_NONE, 1, sizeof(const char*) },
|
{ "name", LVT_STRING_P, offsetof(struct TextureInfo, name), true, LOT_NONE, 1, sizeof(const char*) },
|
||||||
{ "texture", LVT_U8_P, offsetof(struct TextureInfo, texture), true, LOT_POINTER, 1, sizeof(u8*) },
|
{ "texture", LVT_TEXTURE_P, offsetof(struct TextureInfo, texture), true, LOT_POINTER, 1, sizeof(Texture*) },
|
||||||
{ "width", LVT_U32, offsetof(struct TextureInfo, width), true, LOT_NONE, 1, sizeof(u32) },
|
{ "width", LVT_U32, offsetof(struct TextureInfo, width), true, LOT_NONE, 1, sizeof(u32) },
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LUA_TRANSITION_INFO_FIELD_COUNT 9
|
#define LUA_TRANSITION_INFO_FIELD_COUNT 9
|
||||||
|
|
|
||||||
|
|
@ -434,7 +434,7 @@ int smlua_func_get_texture_info(lua_State* L) {
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
|
|
||||||
lua_pushstring(L, "texture");
|
lua_pushstring(L, "texture");
|
||||||
smlua_push_pointer(L, LVT_U8_P, texInfo.texture, NULL);
|
smlua_push_pointer(L, LVT_TEXTURE_P, texInfo.texture, NULL);
|
||||||
lua_settable(L, -3);
|
lua_settable(L, -3);
|
||||||
|
|
||||||
lua_pushstring(L, "bitSize");
|
lua_pushstring(L, "bitSize");
|
||||||
|
|
|
||||||
|
|
@ -32473,7 +32473,24 @@ int smlua_func_gfx_get_texture(lua_State* L) {
|
||||||
Gfx * cmd = (Gfx *)smlua_to_cobject(L, 1, LOT_GFX);
|
Gfx * cmd = (Gfx *)smlua_to_cobject(L, 1, LOT_GFX);
|
||||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "gfx_get_texture"); return 0; }
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "gfx_get_texture"); return 0; }
|
||||||
|
|
||||||
smlua_push_pointer(L, LVT_U8_P, (void*)gfx_get_texture(cmd), NULL);
|
smlua_push_pointer(L, LVT_TEXTURE_P, (void*)gfx_get_texture(cmd), NULL);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int smlua_func_gfx_get_name(lua_State* L) {
|
||||||
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
int top = lua_gettop(L);
|
||||||
|
if (top != 1) {
|
||||||
|
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "gfx_get_name", 1, top);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Gfx * gfx = (Gfx *)smlua_to_cobject(L, 1, LOT_GFX);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "gfx_get_name"); return 0; }
|
||||||
|
|
||||||
|
lua_pushstring(L, gfx_get_name(gfx));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -32622,6 +32639,23 @@ int smlua_func_gfx_delete_all(UNUSED lua_State* L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int smlua_func_vtx_get_name(lua_State* L) {
|
||||||
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
int top = lua_gettop(L);
|
||||||
|
if (top != 1) {
|
||||||
|
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vtx_get_name", 1, top);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vtx * vtx = (Vtx *)smlua_to_cobject(L, 1, LOT_VTX);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vtx_get_name"); return 0; }
|
||||||
|
|
||||||
|
lua_pushstring(L, vtx_get_name(vtx));
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int smlua_func_vtx_get_count(lua_State* L) {
|
int smlua_func_vtx_get_count(lua_State* L) {
|
||||||
if (L == NULL) { return 0; }
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
|
@ -34367,7 +34401,7 @@ int smlua_func_texture_to_lua_table(lua_State* L) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 * tex = (u8 *)smlua_to_cpointer(L, 1, LVT_U8_P);
|
Texture * tex = (Texture *)smlua_to_cpointer(L, 1, LVT_TEXTURE_P);
|
||||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "texture_to_lua_table"); return 0; }
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "texture_to_lua_table"); return 0; }
|
||||||
|
|
||||||
texture_to_lua_table(tex);
|
texture_to_lua_table(tex);
|
||||||
|
|
@ -34375,6 +34409,23 @@ int smlua_func_texture_to_lua_table(lua_State* L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int smlua_func_get_texture_name(lua_State* L) {
|
||||||
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
int top = lua_gettop(L);
|
||||||
|
if (top != 1) {
|
||||||
|
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_texture_name", 1, top);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Texture * tex = (Texture *)smlua_to_cpointer(L, 1, LVT_TEXTURE_P);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_texture_name"); return 0; }
|
||||||
|
|
||||||
|
lua_pushstring(L, get_texture_name(tex));
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// smlua_model_utils.h //
|
// smlua_model_utils.h //
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
|
|
@ -38365,6 +38416,7 @@ void smlua_bind_functions_autogen(void) {
|
||||||
smlua_bind_function(L, "gfx_get_vertex_buffer", smlua_func_gfx_get_vertex_buffer);
|
smlua_bind_function(L, "gfx_get_vertex_buffer", smlua_func_gfx_get_vertex_buffer);
|
||||||
smlua_bind_function(L, "gfx_get_vertex_count", smlua_func_gfx_get_vertex_count);
|
smlua_bind_function(L, "gfx_get_vertex_count", smlua_func_gfx_get_vertex_count);
|
||||||
smlua_bind_function(L, "gfx_get_texture", smlua_func_gfx_get_texture);
|
smlua_bind_function(L, "gfx_get_texture", smlua_func_gfx_get_texture);
|
||||||
|
smlua_bind_function(L, "gfx_get_name", smlua_func_gfx_get_name);
|
||||||
smlua_bind_function(L, "gfx_get_length", smlua_func_gfx_get_length);
|
smlua_bind_function(L, "gfx_get_length", smlua_func_gfx_get_length);
|
||||||
smlua_bind_function(L, "gfx_get_command", smlua_func_gfx_get_command);
|
smlua_bind_function(L, "gfx_get_command", smlua_func_gfx_get_command);
|
||||||
smlua_bind_function(L, "gfx_get_next_command", smlua_func_gfx_get_next_command);
|
smlua_bind_function(L, "gfx_get_next_command", smlua_func_gfx_get_next_command);
|
||||||
|
|
@ -38373,6 +38425,7 @@ void smlua_bind_functions_autogen(void) {
|
||||||
smlua_bind_function(L, "gfx_resize", smlua_func_gfx_resize);
|
smlua_bind_function(L, "gfx_resize", smlua_func_gfx_resize);
|
||||||
smlua_bind_function(L, "gfx_delete", smlua_func_gfx_delete);
|
smlua_bind_function(L, "gfx_delete", smlua_func_gfx_delete);
|
||||||
smlua_bind_function(L, "gfx_delete_all", smlua_func_gfx_delete_all);
|
smlua_bind_function(L, "gfx_delete_all", smlua_func_gfx_delete_all);
|
||||||
|
smlua_bind_function(L, "vtx_get_name", smlua_func_vtx_get_name);
|
||||||
smlua_bind_function(L, "vtx_get_count", smlua_func_vtx_get_count);
|
smlua_bind_function(L, "vtx_get_count", smlua_func_vtx_get_count);
|
||||||
smlua_bind_function(L, "vtx_get_vertex", smlua_func_vtx_get_vertex);
|
smlua_bind_function(L, "vtx_get_vertex", smlua_func_vtx_get_vertex);
|
||||||
smlua_bind_function(L, "vtx_get_next_vertex", smlua_func_vtx_get_next_vertex);
|
smlua_bind_function(L, "vtx_get_next_vertex", smlua_func_vtx_get_next_vertex);
|
||||||
|
|
@ -38480,6 +38533,7 @@ void smlua_bind_functions_autogen(void) {
|
||||||
smlua_bind_function(L, "geo_get_current_camera", smlua_func_geo_get_current_camera);
|
smlua_bind_function(L, "geo_get_current_camera", smlua_func_geo_get_current_camera);
|
||||||
smlua_bind_function(L, "geo_get_current_held_object", smlua_func_geo_get_current_held_object);
|
smlua_bind_function(L, "geo_get_current_held_object", smlua_func_geo_get_current_held_object);
|
||||||
smlua_bind_function(L, "texture_to_lua_table", smlua_func_texture_to_lua_table);
|
smlua_bind_function(L, "texture_to_lua_table", smlua_func_texture_to_lua_table);
|
||||||
|
smlua_bind_function(L, "get_texture_name", smlua_func_get_texture_name);
|
||||||
|
|
||||||
// smlua_model_utils.h
|
// smlua_model_utils.h
|
||||||
smlua_bind_function(L, "smlua_model_util_get_id", smlua_func_smlua_model_util_get_id);
|
smlua_bind_function(L, "smlua_model_util_get_id", smlua_func_smlua_model_util_get_id);
|
||||||
|
|
|
||||||
|
|
@ -288,7 +288,7 @@ struct TextureInfo *smlua_to_texture_info(lua_State *L, int index) {
|
||||||
|
|
||||||
lua_pushstring(L, "texture");
|
lua_pushstring(L, "texture");
|
||||||
lua_gettable(L, top + 1);
|
lua_gettable(L, top + 1);
|
||||||
const u8 *texPtr = smlua_to_cpointer(L, lua_gettop(L), LVT_U8_P);
|
const Texture *texPtr = smlua_to_cpointer(L, lua_gettop(L), LVT_TEXTURE_P);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
if (!gSmLuaConvertSuccess) { return NULL; }
|
if (!gSmLuaConvertSuccess) { return NULL; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -238,13 +238,19 @@ u16 gfx_get_vertex_count(Gfx *cmd) {
|
||||||
return C0(cmd, 12, 8);
|
return C0(cmd, 12, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 *gfx_get_texture(Gfx *cmd) {
|
Texture *gfx_get_texture(Gfx *cmd) {
|
||||||
if (!cmd) { return 0; }
|
if (!cmd) { return 0; }
|
||||||
u32 op = GFX_OP(cmd);
|
u32 op = GFX_OP(cmd);
|
||||||
if (op != G_SETCIMG && op != G_SETZIMG && op != G_SETTIMG) { return 0; }
|
if (op != G_SETCIMG && op != G_SETZIMG && op != G_SETTIMG) { return 0; }
|
||||||
if (cmd->words.w1 == 0) { return 0; }
|
if (cmd->words.w1 == 0) { return 0; }
|
||||||
|
|
||||||
return (u8 *) cmd->words.w1;
|
return (Texture *) cmd->words.w1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *gfx_get_name(Gfx *gfx) {
|
||||||
|
if (!gfx) { return NULL; }
|
||||||
|
|
||||||
|
return dynos_gfx_get_name(gfx);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 gfx_get_length(Gfx *gfx) {
|
u32 gfx_get_length(Gfx *gfx) {
|
||||||
|
|
@ -349,6 +355,12 @@ void gfx_delete_all() {
|
||||||
dynos_gfx_delete_all();
|
dynos_gfx_delete_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *vtx_get_name(Vtx *vtx) {
|
||||||
|
if (!vtx) { return NULL; }
|
||||||
|
|
||||||
|
return dynos_vtx_get_name(vtx);
|
||||||
|
}
|
||||||
|
|
||||||
u32 vtx_get_count(Vtx *vtx) {
|
u32 vtx_get_count(Vtx *vtx) {
|
||||||
if (!vtx) { return 0; }
|
if (!vtx) { return 0; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,10 @@ Vtx *gfx_get_vertex_buffer(Gfx *cmd);
|
||||||
/* |description|Gets the number of vertices from a display list command if it has the op `G_VTX`|descriptionEnd| */
|
/* |description|Gets the number of vertices from a display list command if it has the op `G_VTX`|descriptionEnd| */
|
||||||
u16 gfx_get_vertex_count(Gfx *cmd);
|
u16 gfx_get_vertex_count(Gfx *cmd);
|
||||||
/* |description|Gets the texture from a display list command if it has an image related op|descriptionEnd| */
|
/* |description|Gets the texture from a display list command if it has an image related op|descriptionEnd| */
|
||||||
u8 *gfx_get_texture(Gfx *cmd);
|
Texture *gfx_get_texture(Gfx *cmd);
|
||||||
|
|
||||||
|
/* |description|Gets the name of a display list|descriptionEnd| */
|
||||||
|
const char *gfx_get_name(Gfx *gfx);
|
||||||
/* |description|Gets the max length of a display list|descriptionEnd| */
|
/* |description|Gets the max length of a display list|descriptionEnd| */
|
||||||
u32 gfx_get_length(Gfx *gfx);
|
u32 gfx_get_length(Gfx *gfx);
|
||||||
/* |description|Gets a command of a display list at position `offset`|descriptionEnd| */
|
/* |description|Gets a command of a display list at position `offset`|descriptionEnd| */
|
||||||
|
|
@ -86,6 +88,8 @@ void gfx_delete(Gfx *gfx);
|
||||||
/* |description|Deletes all display lists created by `gfx_create`|descriptionEnd| */
|
/* |description|Deletes all display lists created by `gfx_create`|descriptionEnd| */
|
||||||
void gfx_delete_all();
|
void gfx_delete_all();
|
||||||
|
|
||||||
|
/* |description|Gets the name of a vertex buffer|descriptionEnd| */
|
||||||
|
const char *vtx_get_name(Vtx *vtx);
|
||||||
/* |description|Gets the max count of vertices of a vertex buffer|descriptionEnd| */
|
/* |description|Gets the max count of vertices of a vertex buffer|descriptionEnd| */
|
||||||
u32 vtx_get_count(Vtx *vtx);
|
u32 vtx_get_count(Vtx *vtx);
|
||||||
/* |description|Gets a vertex of a vertex buffer at position `offset`|descriptionEnd| */
|
/* |description|Gets a vertex of a vertex buffer at position `offset`|descriptionEnd| */
|
||||||
|
|
|
||||||
|
|
@ -241,16 +241,16 @@ extern const u8 texture_power_meter_two_segments[];
|
||||||
extern const u8 texture_power_meter_one_segments[];
|
extern const u8 texture_power_meter_one_segments[];
|
||||||
|
|
||||||
static struct TextureInfo sPowerMeterTexturesInfo[] = {
|
static struct TextureInfo sPowerMeterTexturesInfo[] = {
|
||||||
{ (u8*)texture_power_meter_left_side, "texture_power_meter_left_side", 32, 64, 8 },
|
{ (Texture*)texture_power_meter_left_side, "texture_power_meter_left_side", 32, 64, 8 },
|
||||||
{ (u8*)texture_power_meter_right_side, "texture_power_meter_right_side", 32, 64, 8 },
|
{ (Texture*)texture_power_meter_right_side, "texture_power_meter_right_side", 32, 64, 8 },
|
||||||
{ (u8*)texture_power_meter_one_segments, "texture_power_meter_one_segments", 32, 32, 8 },
|
{ (Texture*)texture_power_meter_one_segments, "texture_power_meter_one_segments", 32, 32, 8 },
|
||||||
{ (u8*)texture_power_meter_two_segments, "texture_power_meter_two_segments", 32, 32, 8 },
|
{ (Texture*)texture_power_meter_two_segments, "texture_power_meter_two_segments", 32, 32, 8 },
|
||||||
{ (u8*)texture_power_meter_three_segments, "texture_power_meter_three_segments", 32, 32, 8 },
|
{ (Texture*)texture_power_meter_three_segments, "texture_power_meter_three_segments", 32, 32, 8 },
|
||||||
{ (u8*)texture_power_meter_four_segments, "texture_power_meter_four_segments", 32, 32, 8 },
|
{ (Texture*)texture_power_meter_four_segments, "texture_power_meter_four_segments", 32, 32, 8 },
|
||||||
{ (u8*)texture_power_meter_five_segments, "texture_power_meter_five_segments", 32, 32, 8 },
|
{ (Texture*)texture_power_meter_five_segments, "texture_power_meter_five_segments", 32, 32, 8 },
|
||||||
{ (u8*)texture_power_meter_six_segments, "texture_power_meter_six_segments", 32, 32, 8 },
|
{ (Texture*)texture_power_meter_six_segments, "texture_power_meter_six_segments", 32, 32, 8 },
|
||||||
{ (u8*)texture_power_meter_seven_segments, "texture_power_meter_seven_segments", 32, 32, 8 },
|
{ (Texture*)texture_power_meter_seven_segments, "texture_power_meter_seven_segments", 32, 32, 8 },
|
||||||
{ (u8*)texture_power_meter_full, "texture_power_meter_full", 32, 32, 8 },
|
{ (Texture*)texture_power_meter_full, "texture_power_meter_full", 32, 32, 8 },
|
||||||
};
|
};
|
||||||
|
|
||||||
void hud_render_power_meter(s32 health, f32 x, f32 y, f32 width, f32 height) {
|
void hud_render_power_meter(s32 health, f32 x, f32 y, f32 width, f32 height) {
|
||||||
|
|
@ -603,7 +603,7 @@ struct GraphNodeHeldObject* geo_get_current_held_object(void) {
|
||||||
return gCurGraphNodeHeldObject;
|
return gCurGraphNodeHeldObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
void texture_to_lua_table(const u8 *tex) {
|
void texture_to_lua_table(const Texture *tex) {
|
||||||
lua_State *L = gLuaState;
|
lua_State *L = gLuaState;
|
||||||
if (!L || !tex) { return; }
|
if (!L || !tex) { return; }
|
||||||
|
|
||||||
|
|
@ -614,7 +614,7 @@ void texture_to_lua_table(const u8 *tex) {
|
||||||
if (bpp != 16 && bpp != 32) { return; }
|
if (bpp != 16 && bpp != 32) { return; }
|
||||||
|
|
||||||
u32 bytesPerPixel = bpp / 8;
|
u32 bytesPerPixel = bpp / 8;
|
||||||
const u8 *data = texInfo.texture;
|
const Texture *data = texInfo.texture;
|
||||||
u32 texSize = texInfo.width * texInfo.height * bytesPerPixel;
|
u32 texSize = texInfo.width * texInfo.height * bytesPerPixel;
|
||||||
|
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
|
|
@ -642,3 +642,11 @@ void texture_to_lua_table(const u8 *tex) {
|
||||||
lua_rawseti(L, -2, i / bytesPerPixel + 1);
|
lua_rawseti(L, -2, i / bytesPerPixel + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *get_texture_name(const Texture *tex) {
|
||||||
|
struct TextureInfo texInfo;
|
||||||
|
if (dynos_texture_get_from_data(tex, &texInfo)) {
|
||||||
|
return texInfo.name;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -252,7 +252,10 @@ struct GraphNodeCamera* geo_get_current_camera(void);
|
||||||
/* |description|Gets the current GraphNodeHeldObject|descriptionEnd|*/
|
/* |description|Gets the current GraphNodeHeldObject|descriptionEnd|*/
|
||||||
struct GraphNodeHeldObject* geo_get_current_held_object(void);
|
struct GraphNodeHeldObject* geo_get_current_held_object(void);
|
||||||
|
|
||||||
/* |description|Converts a texture's pixels to a Lua table. Returns nil if failed. Otherwise, returns a table as a pure memory buffer. Supports rgba16 and rgba32 textures.|descriptionEnd|*/
|
/* |description|Converts a texture's pixels to a Lua table. Returns nil if failed. Otherwise, returns a table as a pure memory buffer. Supports rgba16 and rgba32 textures|descriptionEnd|*/
|
||||||
void texture_to_lua_table(const u8 *tex);
|
void texture_to_lua_table(const Texture *tex);
|
||||||
|
|
||||||
|
/* |description|Gets the name of the provided texture pointer `tex`|descriptionEnd|*/
|
||||||
|
const char *get_texture_name(const Texture *tex);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue