From 7bacb3ee2b781ad5a183c74c7f132dc5be73b1dc Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Sat, 18 Apr 2026 15:59:25 -0500 Subject: [PATCH] Testing on real wii hardware some more --- src/dusk/display/spritebatch/spritebatch.h | 2 +- src/dusk/engine/engine.c | 32 +++++++++++----------- src/dusk/scene/scene.c | 5 ++-- src/duskdolphin/display/mesh/meshdolphin.c | 1 + 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/dusk/display/spritebatch/spritebatch.h b/src/dusk/display/spritebatch/spritebatch.h index d7a4f878..c4e4e38f 100644 --- a/src/dusk/display/spritebatch/spritebatch.h +++ b/src/dusk/display/spritebatch/spritebatch.h @@ -8,7 +8,7 @@ #pragma once #include "display/mesh/quad.h" -#define SPRITEBATCH_SPRITES_MAX 32 +#define SPRITEBATCH_SPRITES_MAX 240 #define SPRITEBATCH_VERTEX_COUNT (SPRITEBATCH_SPRITES_MAX * QUAD_VERTEX_COUNT) #define SPRITEBATCH_FLUSH_COUNT 4 #define SPRITEBATCH_SPRITES_MAX_PER_FLUSH (\ diff --git a/src/dusk/engine/engine.c b/src/dusk/engine/engine.c index eef022c4..956a327c 100644 --- a/src/dusk/engine/engine.c +++ b/src/dusk/engine/engine.c @@ -41,13 +41,13 @@ void onNetworkConnected(void *user) { networkinfo_t info = networkGetInfo(); if(info.type == NETWORK_TYPE_IPV4) { - printf( + sceneLog( "Connected to network with IPv4 address: " NETWORK_INFO_FORMAT_IPV4 "\n", info.ipv4.ip[0], info.ipv4.ip[1], info.ipv4.ip[2], info.ipv4.ip[3] ); #ifdef DUSK_NETWORK_IPV6 } else if(info.type == NETWORK_TYPE_IPV6) { - printf( + sceneLog( "Connected to network with IPv6 address: " NETWORK_INFO_FORMAT_IPV6 "\n", info.ipv6.ip[0], info.ipv6.ip[1], info.ipv6.ip[2], info.ipv6.ip[3], info.ipv6.ip[4], info.ipv6.ip[5], info.ipv6.ip[6], info.ipv6.ip[7], @@ -57,27 +57,27 @@ void onNetworkConnected(void *user) { #endif } - printf("Network connected, I will disconnect at: %.2f1.\n", onlineSwapTime); + sceneLog("Network connected, I will disconnect at: %.2f1.\n", onlineSwapTime); } void onNetworkFailed(errorret_t error, void *user) { onlineSwapTime = TIME.time + 3.0f; - printf("Failed to connect to network, will try again at %.2f1.\n", onlineSwapTime); + sceneLog("Failed to connect to network, will try again at %.2f1.\n", onlineSwapTime); } void onNetworkDisconnected(errorret_t error, void *user) { onlineSwapTime = TIME.time + 3.0f; - printf("Network disconnected, will go online at %.2f1.\n", onlineSwapTime); + sceneLog("Network disconnected, will go online at %.2f1.\n", onlineSwapTime); errorCatch(errorPrint(error)); } void onNetworkDisconnectFinished(void *user) { onlineSwapTime = TIME.time + 3.0f; - printf("Finished disconnecting from network, will go online at %.2f1.\n", onlineSwapTime); + sceneLog("Finished disconnecting from network, will go online at %.2f1.\n", onlineSwapTime); } void goOnline() { - printf("Going online...\n"); + sceneLog("Going online...\n"); networkRequestConnection( onNetworkConnected, onNetworkFailed, @@ -87,7 +87,7 @@ void goOnline() { } void goOffline() { - printf("Going offline...\n"); + sceneLog("Going offline...\n"); networkRequestDisconnection(onNetworkDisconnectFinished, NULL); } @@ -113,8 +113,8 @@ errorret_t engineInit(const int32_t argc, const char_t **argv) { errorChain(networkInit()); errorChain(gameInit()); - // printf("Init done, going to queue online in 3 seconds...\n"); - // onlineSwapTime = TIME.time + 3.0f; + sceneLog("Init done, going to queue online in 3 seconds...\n"); + onlineSwapTime = TIME.time + 3.0f; // Camera entityid_t cam = entityManagerAdd(); @@ -178,12 +178,12 @@ errorret_t engineUpdate(void) { uiUpdate(); errorChain(sceneUpdate()); - // /* Reset the box to its start position on demand. */ - // if(inputIsDown(INPUT_ACTION_ACCEPT)) { - // componentid_t posComp = entityGetComponent(phBoxEnt, COMPONENT_TYPE_POSITION); - // entityPositionSetPosition(phBoxEnt, posComp, (vec3){ 0.0f, 4.0f, 0.0f }); - // entityPhysicsSetVelocity(phBoxEnt, phBoxPhys, (vec3){ 0.0f, 0.0f, 0.0f }); - // } + /* Reset the box to its start position on demand. */ + if(inputIsDown(INPUT_ACTION_ACCEPT)) { + componentid_t posComp = entityGetComponent(phBoxEnt, COMPONENT_TYPE_POSITION); + entityPositionSetPosition(phBoxEnt, posComp, (vec3){ 0.0f, 4.0f, 0.0f }); + entityPhysicsSetVelocity(phBoxEnt, phBoxPhys, (vec3){ 0.0f, 0.0f, 0.0f }); + } /* Step physics: positions are updated directly on POSITION components. */ physicsManagerUpdate(); diff --git a/src/dusk/scene/scene.c b/src/dusk/scene/scene.c index 50ddc5c0..6aaf9158 100644 --- a/src/dusk/scene/scene.c +++ b/src/dusk/scene/scene.c @@ -180,8 +180,9 @@ errorret_t sceneRender(void) { // errorChain(shaderSetTexture(&SHADER_UNLIT, SHADER_UNLIT_0TEXTURE, &DEFAULT_FONT_TEXTURE)); // errorChain(shaderSetColor(&SHADER_UNLIT, SHADER_UNLIT_COLOR, COLOR_WHITE)); errorChain(textDraw( - 100, 100, - "Hello World", + 32, 32, + // "Hello World", + SCENE_LOG, COLOR_WHITE, &DEFAULT_FONT_TILESET, &DEFAULT_FONT_TEXTURE diff --git a/src/duskdolphin/display/mesh/meshdolphin.c b/src/duskdolphin/display/mesh/meshdolphin.c index 99455be6..1a4cd056 100644 --- a/src/duskdolphin/display/mesh/meshdolphin.c +++ b/src/duskdolphin/display/mesh/meshdolphin.c @@ -52,6 +52,7 @@ errorret_t meshDrawDolphin( assertTrue(offsetof(meshvertex_t, pos) == 8, "pos offset wrong"); #endif + // Flush vertex data to GPU. This is required before drawing with GX. DCFlushRange( (void*)&mesh->vertices[vertexOffset], sizeof(meshvertex_t) * vertexCount