From 41e0420c482002307b8d0e72998287d7bdeb2364 Mon Sep 17 00:00:00 2001 From: Extrems Date: Fri, 22 Dec 2023 16:17:55 -0500 Subject: [PATCH] - Improve Wii detection somewhat. --- cube/swiss/include/main.h | 8 +++++--- cube/swiss/source/gui/info.c | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cube/swiss/include/main.h b/cube/swiss/include/main.h index b6dec9f9..c2a26c2d 100644 --- a/cube/swiss/include/main.h +++ b/cube/swiss/include/main.h @@ -93,13 +93,15 @@ enum setupStream #define DVD_STACK_SIZE 1024 //Console Version Type Helpers -#define GC_CPU_VERSION01 0x00083214 -#define GC_CPU_VERSION02 0x00083410 #ifndef mfpvr #define mfpvr() ({unsigned int rval; asm volatile("mfpvr %0" : "=r" (rval)); rval;}) #endif -#define is_gamecube() (((mfpvr() == GC_CPU_VERSION01)||((mfpvr() == GC_CPU_VERSION02)))) +static inline bool is_gamecube(void) +{ + u32 pvr = mfpvr(); + return ((pvr >> 16) & 0xFFFF) == 0x0008 && ((pvr >> 12) & 0xF) != 0x7; +} #define MAX_MULTIGAME 128 #define MULTIGAME_TABLE_OFFSET 64 diff --git a/cube/swiss/source/gui/info.c b/cube/swiss/source/gui/info.c index 63179ff3..97fdf088 100644 --- a/cube/swiss/source/gui/info.c +++ b/cube/swiss/source/gui/info.c @@ -28,7 +28,7 @@ uiDrawObj_t * info_draw_page(int page_num) { DrawAddChild(container, DrawLabel(30, 55, "System Info (1/3):")); // Model DrawAddChild(container, DrawStyledLabel(640/2, 90, (char*)"MODEL", 0.65f, true, defaultColor)); - if(is_gamecube()) { + if(!strncmp(IPLInfo, "(C) ", 4)) { if(driveInfo.dev_code == 0x0201) { strcpy(topStr, "NPDP-GDEV (GCT-0100)"); } @@ -77,7 +77,7 @@ uiDrawObj_t * info_draw_page(int page_num) { DrawAddChild(container, DrawStyledLabel(640/2, 106, topStr, 0.75f, true, defaultColor)); // IPL version string DrawAddChild(container, DrawStyledLabel(640/2, 130, (char*)"IPL VERSION", 0.65f, true, defaultColor)); - if(is_gamecube()) { + if(!strncmp(IPLInfo, "(C) ", 4)) { if(!IPLInfo[0x55]) { strcpy(topStr, "NTSC Revision 1.0"); }