Wii U: Now 3D blank screen works

This commit is contained in:
UnknownShadow200 2024-03-26 12:14:31 +11:00
parent 93f2ef9d46
commit bd7f646d6a
4 changed files with 53 additions and 16 deletions

View File

@ -72,17 +72,18 @@ And also runs on:
* BeOS - untested on actual hardware
* IRIX - needs <code>curl</code> and <code>openal</code> packages
* SerenityOS - needs <code>SDL2</code>
* 3DS - unfinished, but usable (can [download from here](https://www.classicube.net/download/3ds))
* Wii - unfinished, but usable (can [download from here](https://www.classicube.net/download/wii))
* GameCube - unfinished, but usable (can [download from here](https://www.classicube.net/download/gamecube))
* Dreamcast - unfinished, but renders (can [download from here](https://www.classicube.net/download/dreamcast))
* Nintendo 64 - unfinished, moderate rendering issues (can [download from here](https://www.classicube.net/download/n64))
* DS/DSi - unfinished, rendering issues (if you have a GitHub account, can [download from here](https://github.com/ClassiCube/ClassiCube/actions/workflows/build_ds.yml))
* GameCube - unfinished, but usable (can [download from here](https://www.classicube.net/download/gamecube))
* Wii - unfinished, but usable (can [download from here](https://www.classicube.net/download/wii))
* 3DS - unfinished, but usable (can [download from here](https://www.classicube.net/download/3ds))
* Switch - unfinished, but usable (if you have a GitHub account, can [download from here](https://github.com/ClassiCube/ClassiCube/actions/workflows/build_switch.yml))
* PSP - unfinished, rendering issues (can [download from here](https://www.classicube.net/download/psp))
* PS Vita - unfinished, rendering issues (can [download from here](https://www.classicube.net/download/vita))
* Xbox - unfinished, major rendering issues (can [download from here](https://www.classicube.net/download/xbox), **untested on real hardware**)
* PS3 - unfinished, rendering issues (can [download from here](https://www.classicube.net/download/ps3), **usually outdated**)
* Nintendo 64 - unfinished, moderate rendering issues (can [download from here](https://www.classicube.net/download/n64))
* PS2 - unfinished, major rendering and **stability issues** (can [download from here](https://www.classicube.net/download/ps2))
* Switch - unfinished, but usable (if you have a GitHub account, can [download from here](https://github.com/ClassiCube/ClassiCube/actions/workflows/build_switch.yml))
* PS3 - unfinished, rendering issues (can [download from here](https://www.classicube.net/download/ps3), **usually outdated**)
* Xbox - unfinished, major rendering issues (can [download from here](https://www.classicube.net/download/xbox), **untested on real hardware**)
# Compiling
@ -303,7 +304,11 @@ Run `make n64`. You'll need the opengl branch of [libdragon](https://github.com/
The Nintendo 64 port needs assistance from someone experienced with Nintendo 64 homebrew development - if you're interested, please get in contact with me. (`unknownshadow200` on Discord)
You'll also need to stub out `WorkerLoop` function in `Http_Worker.c` for now
#### Nintendo DS/DSi
Run `make ds`. You'll need [BlocksDS](https://github.com/blocksds/sdk)
The Nintendo DS port needs assistance from someone experienced with Nintendo DS homebrew development - if you're interested, please get in contact with me. (`unknownshadow200` on Discord)
##### Other

View File

@ -13,7 +13,7 @@ typedef cc_uint32 BitmapCol;
#define BITMAPCOLOR_G_SHIFT 8
#define BITMAPCOLOR_B_SHIFT 16
#define BITMAPCOLOR_A_SHIFT 24
#elif defined CC_BUILD_3DS || defined CC_BUILD_N64
#elif defined CC_BUILD_3DS || defined CC_BUILD_N64 || defined CC_BUILD_WIIU
#define BITMAPCOLOR_R_SHIFT 24
#define BITMAPCOLOR_G_SHIFT 16
#define BITMAPCOLOR_B_SHIFT 8

View File

@ -3,13 +3,26 @@
#include "_GraphicsBase.h"
#include "Errors.h"
#include "Window.h"
#include <gx2/clear.h>
#include <gx2/context.h>
#include <gx2/display.h>
#include <gx2/event.h>
#include <gx2/mem.h>
#include <gx2/registers.h>
#include <gx2/shaders.h>
#include <gx2/state.h>
#include <gx2/surface.h>
#include <gx2/swap.h>
#include <gx2/temp.h>
#include <gx2r/mem.h>
#include <gx2r/buffer.h>
#include <whb/gfx.h>
void Gfx_Create(void) {
Gfx.Created = true;
Gfx.MaxTexWidth = 512;
Gfx.MaxTexHeight = 512;
WHBGfxInit();
}
cc_bool Gfx_TryRestoreContext(void) {
@ -50,6 +63,8 @@ void Gfx_BindTexture(GfxResourceID texId) {
void Gfx_DeleteTexture(GfxResourceID* texId) {
}
void Gfx_SetTexturing(cc_bool enabled) { }
void Gfx_EnableMipmaps(void) { } // TODO
void Gfx_DisableMipmaps(void) { } // TODO
@ -58,6 +73,8 @@ void Gfx_DisableMipmaps(void) { } // TODO
/*########################################################################################################################*
*-----------------------------------------------------State management----------------------------------------------------*
*#########################################################################################################################*/
static float clearR, clearG, clearB;
void Gfx_SetFaceCulling(cc_bool enabled) {
}
@ -91,7 +108,10 @@ void Gfx_SetAlphaArgBlend(cc_bool enabled) {
// TODO
}
void Gfx_ClearColor(PackedCol color) {
void Gfx_ClearColor(PackedCol color) {
clearR = PackedCol_R(color) / 255.0f;
clearG = PackedCol_G(color) / 255.0f;
clearB = PackedCol_B(color) / 255.0f;
}
void Gfx_SetDepthTest(cc_bool enabled) {
@ -180,7 +200,7 @@ void* Gfx_LockDynamicVb(GfxResourceID vb, VertexFormat fmt, int count) {
return Gfx_LockVb(vb, fmt, count);
}
void Gfx_UnlockDynamicVb(GfxResourceID vb) { Gfx_UnlockVb(vb); }
void Gfx_UnlockDynamicVb(GfxResourceID vb) { Gfx_UnlockVb(vb); Gfx_BindVb(vb); }
/*########################################################################################################################*
@ -263,14 +283,26 @@ void Gfx_SetFpsLimit(cc_bool vsync, float minFrameMs) {
}
void Gfx_BeginFrame(void) {
WHBGfxBeginRender();
WHBGfxBeginRenderTV();
}
void Gfx_ClearBuffers(GfxBuffers buffers) {
// TODO
GX2ColorBuffer* buf = WHBGfxGetTVColourBuffer();
GX2DepthBuffer* dph = WHBGfxGetTVDepthBuffer();
if (buffers & GFX_BUFFER_COLOR) {
GX2ClearColor(buf, clearR, clearG, clearB, 1.0f);
}
if (buffers & GFX_BUFFER_DEPTH) {
GX2ClearDepthStencilEx(dph, 1.0f, 0, GX2_CLEAR_FLAGS_DEPTH | GX2_CLEAR_FLAGS_STENCIL);
}
}
void Gfx_EndFrame(void) {
WHBGfxFinishRenderTV();
WHBGfxFinishRender();
if (gfx_minFrameMs) LimitFPS();
}
@ -284,4 +316,4 @@ void Gfx_GetApiInfo(cc_string* info) {
void Gfx_OnWindowResize(void) {
}
#endif
#endif

View File

@ -181,7 +181,7 @@ static struct VertexTextured* real_vertices;
static GfxResourceID modelVB;
void Model_LockVB(struct Entity* entity, int verticesCount) {
#ifdef CC_BUILD_CONSOLE
#ifdef CC_BUILD_LOWMEM
if (!entity->ModelVB) {
entity->ModelVB = Gfx_CreateDynamicVb(VERTEX_FORMAT_TEXTURED, Models.Active->maxVertices);
}