diff --git a/readme.md b/readme.md index 926de7789..efc2bcb45 100644 --- a/readme.md +++ b/readme.md @@ -72,17 +72,18 @@ And also runs on: * BeOS - untested on actual hardware * IRIX - needs curl and openal packages * SerenityOS - needs SDL2 -* 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 diff --git a/src/Bitmap.h b/src/Bitmap.h index 6089577e0..ca7cc6d81 100644 --- a/src/Bitmap.h +++ b/src/Bitmap.h @@ -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 diff --git a/src/Graphics_WiiU.c b/src/Graphics_WiiU.c index c98a0d4f2..7be0f073e 100644 --- a/src/Graphics_WiiU.c +++ b/src/Graphics_WiiU.c @@ -3,13 +3,26 @@ #include "_GraphicsBase.h" #include "Errors.h" #include "Window.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include 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 \ No newline at end of file +#endif diff --git a/src/Model.c b/src/Model.c index 84891d09b..1d0dd2678 100644 --- a/src/Model.c +++ b/src/Model.c @@ -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); }