From a645f407bcd9b37fc5d78fc1015d135320d2e67e Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Fri, 3 Nov 2023 22:14:27 +1100 Subject: [PATCH] Fix console builds and integrate N64 backend files into the main .sln file --- src/ClassiCube.vcxproj | 3 +++ src/ClassiCube.vcxproj.filters | 9 +++++++++ src/Graphics_3DS.c | 2 ++ src/Graphics_Dreamcast.c | 4 +++- src/Graphics_GCWii.c | 2 ++ src/Graphics_N64.c | 15 +++++++++------ src/Graphics_PS3.c | 2 ++ src/Graphics_PSP.c | 2 ++ src/Graphics_PSVita.c | 2 ++ src/Graphics_Xbox.c | 2 ++ 10 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/ClassiCube.vcxproj b/src/ClassiCube.vcxproj index f0e8ee76c..d306ed5fb 100644 --- a/src/ClassiCube.vcxproj +++ b/src/ClassiCube.vcxproj @@ -471,6 +471,7 @@ + @@ -493,6 +494,7 @@ + @@ -533,6 +535,7 @@ + diff --git a/src/ClassiCube.vcxproj.filters b/src/ClassiCube.vcxproj.filters index e9ed4d0e5..7434b907a 100644 --- a/src/ClassiCube.vcxproj.filters +++ b/src/ClassiCube.vcxproj.filters @@ -677,6 +677,15 @@ Source Files\Entities + + Source Files\Graphics + + + Source Files\Platform + + + Source Files\Window + diff --git a/src/Graphics_3DS.c b/src/Graphics_3DS.c index f12287ea9..87f3d6888 100644 --- a/src/Graphics_3DS.c +++ b/src/Graphics_3DS.c @@ -447,6 +447,8 @@ void Gfx_SetDynamicVbData(GfxResourceID vb, void* vertices, int vCount) { Mem_Copy(vb, vertices, vCount * gfx_stride); } +void Gfx_DeleteDynamicVb(GfxResourceID* vb) { Gfx_DeleteVb(vb); } + /*########################################################################################################################* *-----------------------------------------------------State management----------------------------------------------------* diff --git a/src/Graphics_Dreamcast.c b/src/Graphics_Dreamcast.c index 0181f73cb..73cff8e5b 100644 --- a/src/Graphics_Dreamcast.c +++ b/src/Graphics_Dreamcast.c @@ -117,7 +117,7 @@ static void* gfx_vertices; static int vb_size; GfxResourceID Gfx_CreateIb2(int count, Gfx_FillIBFunc fillFunc, void* obj) { - return 1; + return (void*)1; } void Gfx_BindIb(GfxResourceID ib) { } @@ -172,6 +172,8 @@ void Gfx_SetDynamicVbData(GfxResourceID vb, void* vertices, int vCount) { //dcache_flush_range(vertices, vCount * gfx_stride); } +void Gfx_DeleteDynamicVb(GfxResourceID* vb) { Gfx_DeleteVb(vb); } + /*########################################################################################################################* *---------------------------------------------------------Textures--------------------------------------------------------* diff --git a/src/Graphics_GCWii.c b/src/Graphics_GCWii.c index b211e5357..92a69bb07 100644 --- a/src/Graphics_GCWii.c +++ b/src/Graphics_GCWii.c @@ -340,6 +340,8 @@ void Gfx_SetDynamicVbData(GfxResourceID vb, void* vertices, int vCount) { DCFlushRange(vertices, vCount * gfx_stride); } +void Gfx_DeleteDynamicVb(GfxResourceID* vb) { Gfx_DeleteVb(vb); } + /*########################################################################################################################* *-----------------------------------------------------State management----------------------------------------------------* diff --git a/src/Graphics_N64.c b/src/Graphics_N64.c index 0efe563a4..fd2793e69 100644 --- a/src/Graphics_N64.c +++ b/src/Graphics_N64.c @@ -114,13 +114,12 @@ Platform_LogConst("GFX END"); /*########################################################################################################################* *---------------------------------------------------------Textures--------------------------------------------------------* *#########################################################################################################################*/ - typedef struct CCTexture { surface_t surface; GLuint textureID; } CCTexture; -GfxResourceID Gfx_CreateTexture(struct Bitmap* bmp, cc_uint8 flags, cc_bool mipmaps) { +static GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, cc_uint8 flags, cc_bool mipmaps) { Platform_Log2("make texture %i x %i", &bmp->width, &bmp->height); if (bmp->width > 32 || bmp->height > 32) return NULL; @@ -266,8 +265,8 @@ void Gfx_BindIb(GfxResourceID ib) { } void Gfx_DeleteIb(GfxResourceID* ib) { } -GfxResourceID Gfx_CreateVb(VertexFormat fmt, int count) { - return Mem_Alloc(count, strideSizes[fmt], "GFX VB"); +static GfxResourceID Gfx_AllocStaticVb(VertexFormat fmt, int count) { + return Mem_TryAlloc(count, strideSizes[fmt]); } void Gfx_BindVb(GfxResourceID vb) { gfx_vertices = vb; } @@ -288,10 +287,12 @@ void Gfx_UnlockVb(GfxResourceID vb) { } -GfxResourceID Gfx_CreateDynamicVb(VertexFormat fmt, int maxVertices) { - return Mem_Alloc(maxVertices, strideSizes[fmt], "GFX VB"); +static GfxResourceID Gfx_AllocDynamicVb(VertexFormat fmt, int maxVertices) { + return Mem_TryAlloc(maxVertices, strideSizes[fmt]); } +void Gfx_BindDynamicVb(GfxResourceID vb) { Gfx_BindVb(vb); } + void* Gfx_LockDynamicVb(GfxResourceID vb, VertexFormat fmt, int count) { vb_size = count * strideSizes[fmt]; return vb; @@ -306,6 +307,8 @@ void Gfx_SetDynamicVbData(GfxResourceID vb, void* vertices, int vCount) { Mem_Copy(vb, vertices, vCount * gfx_stride); } +void Gfx_DeleteDynamicVb(GfxResourceID* vb) { Gfx_DeleteVb(vb); } + /*########################################################################################################################* *-----------------------------------------------------State management----------------------------------------------------* diff --git a/src/Graphics_PS3.c b/src/Graphics_PS3.c index 408ca52fe..4cdc7300c 100644 --- a/src/Graphics_PS3.c +++ b/src/Graphics_PS3.c @@ -556,6 +556,8 @@ void Gfx_SetDynamicVbData(GfxResourceID vb, void* vertices, int vCount) { rsxInvalidateVertexCache(context); // TODO needed? } +void Gfx_DeleteDynamicVb(GfxResourceID* vb) { Gfx_DeleteVb(vb); } + /*########################################################################################################################* *---------------------------------------------------------Textures--------------------------------------------------------* diff --git a/src/Graphics_PSP.c b/src/Graphics_PSP.c index 30461db8c..ceec1c593 100644 --- a/src/Graphics_PSP.c +++ b/src/Graphics_PSP.c @@ -329,6 +329,8 @@ void Gfx_SetDynamicVbData(GfxResourceID vb, void* vertices, int vCount) { sceKernelDcacheWritebackInvalidateRange(vertices, vCount * gfx_stride); } +void Gfx_DeleteDynamicVb(GfxResourceID* vb) { Gfx_DeleteVb(vb); } + /*########################################################################################################################* *-----------------------------------------------------State management----------------------------------------------------* diff --git a/src/Graphics_PSVita.c b/src/Graphics_PSVita.c index 88dbe685e..bc2cd7a32 100644 --- a/src/Graphics_PSVita.c +++ b/src/Graphics_PSVita.c @@ -930,6 +930,8 @@ void Gfx_SetDynamicVbData(GfxResourceID vb, void* vertices, int vCount) { Gfx_BindVb(vb); } +void Gfx_DeleteDynamicVb(GfxResourceID* vb) { Gfx_DeleteVb(vb); } + /*########################################################################################################################* *-----------------------------------------------------State management----------------------------------------------------* diff --git a/src/Graphics_Xbox.c b/src/Graphics_Xbox.c index 25ffa4074..0c247cc1f 100644 --- a/src/Graphics_Xbox.c +++ b/src/Graphics_Xbox.c @@ -466,6 +466,8 @@ void Gfx_SetDynamicVbData(GfxResourceID vb, void* vertices, int vCount) { Gfx_BindVb(vb); } +void Gfx_DeleteDynamicVb(GfxResourceID* vb) { Gfx_DeleteVb(vb); } + /*########################################################################################################################* *-----------------------------------------------------State management----------------------------------------------------*