From 3ed32772ac19a5ae1877164f2e860bfebb6e4671 Mon Sep 17 00:00:00 2001 From: Adam Bird Date: Wed, 29 May 2024 21:39:06 -0400 Subject: [PATCH 1/2] Fix Skybox star colors --- mm/src/code/z_kankyo.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/mm/src/code/z_kankyo.c b/mm/src/code/z_kankyo.c index f391ff0952..0ae4e00e10 100644 --- a/mm/src/code/z_kankyo.c +++ b/mm/src/code/z_kankyo.c @@ -3161,17 +3161,24 @@ void Environment_DrawSkyboxStarsImpl(PlayState* play, Gfx** gfxP) { { 0xD058, 0x4C2C, 0x3A98 }, { 0xD8F0, 0x36B0, 0x47E0 }, { 0xD954, 0x3264, 0x3E1C }, { 0xD8F0, 0x3070, 0x37DC }, { 0xD8F0, 0x1F40, 0x5208 }, { 0xD760, 0x1838, 0x27D8 }, { 0x0000, 0x4E20, 0x4A38 }, { 0x076C, 0x2328, 0xDCD8 }, }; + // 2S2H [Port] Added designator field names to preserve the order of the union in Color_RGBA8_u32 for little endian static const Color_RGBA8_u32 D_801DD8E0[] = { - { 65, 164, 255, 255 }, { 131, 164, 230, 255 }, { 98, 205, 255, 255 }, { 82, 82, 255, 255 }, - { 123, 164, 164, 255 }, { 98, 205, 255, 255 }, { 98, 164, 230, 255 }, { 255, 90, 0, 255 }, + { .r = 65, .g = 164, .b = 255, .a = 255 }, { .r = 131, .g = 164, .b = 230, .a = 255 }, + { .r = 98, .g = 205, .b = 255, .a = 255 }, { .r = 82, .g = 82, .b = 255, .a = 255 }, + { .r = 123, .g = 164, .b = 164, .a = 255 }, { .r = 98, .g = 205, .b = 255, .a = 255 }, + { .r = 98, .g = 164, .b = 230, .a = 255 }, { .r = 255, .g = 90, .b = 0, .a = 255 }, }; // 2S2H [Port] This originally had `UNALIGNED` however we don't need that for PC and it was causing warnings in the // header file static const Color_RGBA8_u32 D_801DD900[] = { - { 64, 80, 112, 255 }, { 96, 96, 128, 255 }, { 128, 112, 144, 255 }, { 160, 128, 160, 255 }, - { 192, 144, 168, 255 }, { 224, 160, 176, 255 }, { 224, 160, 176, 255 }, { 104, 104, 136, 255 }, - { 136, 120, 152, 255 }, { 168, 136, 168, 255 }, { 200, 152, 184, 255 }, { 232, 168, 184, 255 }, - { 224, 176, 184, 255 }, { 240, 192, 192, 255 }, { 232, 184, 192, 255 }, { 248, 200, 192, 255 }, + { .r = 64, .g = 80, .b = 112, .a = 255 }, { .r = 96, .g = 96, .b = 128, .a = 255 }, + { .r = 128, .g = 112, .b = 144, .a = 255 }, { .r = 160, .g = 128, .b = 160, .a = 255 }, + { .r = 192, .g = 144, .b = 168, .a = 255 }, { .r = 224, .g = 160, .b = 176, .a = 255 }, + { .r = 224, .g = 160, .b = 176, .a = 255 }, { .r = 104, .g = 104, .b = 136, .a = 255 }, + { .r = 136, .g = 120, .b = 152, .a = 255 }, { .r = 168, .g = 136, .b = 168, .a = 255 }, + { .r = 200, .g = 152, .b = 184, .a = 255 }, { .r = 232, .g = 168, .b = 184, .a = 255 }, + { .r = 224, .g = 176, .b = 184, .a = 255 }, { .r = 240, .g = 192, .b = 192, .a = 255 }, + { .r = 232, .g = 184, .b = 192, .a = 255 }, { .r = 248, .g = 200, .b = 192, .a = 255 }, }; Vec3f pos; f32 temp; From 0d298c358cc59322d1d3d8ca2456a07fba3e3892 Mon Sep 17 00:00:00 2001 From: Adam Bird Date: Wed, 29 May 2024 22:59:38 -0400 Subject: [PATCH 2/2] switch to Color_RGBA8 solution --- mm/src/code/z_kankyo.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/mm/src/code/z_kankyo.c b/mm/src/code/z_kankyo.c index 0ae4e00e10..ec169e4d3f 100644 --- a/mm/src/code/z_kankyo.c +++ b/mm/src/code/z_kankyo.c @@ -3161,24 +3161,18 @@ void Environment_DrawSkyboxStarsImpl(PlayState* play, Gfx** gfxP) { { 0xD058, 0x4C2C, 0x3A98 }, { 0xD8F0, 0x36B0, 0x47E0 }, { 0xD954, 0x3264, 0x3E1C }, { 0xD8F0, 0x3070, 0x37DC }, { 0xD8F0, 0x1F40, 0x5208 }, { 0xD760, 0x1838, 0x27D8 }, { 0x0000, 0x4E20, 0x4A38 }, { 0x076C, 0x2328, 0xDCD8 }, }; - // 2S2H [Port] Added designator field names to preserve the order of the union in Color_RGBA8_u32 for little endian - static const Color_RGBA8_u32 D_801DD8E0[] = { - { .r = 65, .g = 164, .b = 255, .a = 255 }, { .r = 131, .g = 164, .b = 230, .a = 255 }, - { .r = 98, .g = 205, .b = 255, .a = 255 }, { .r = 82, .g = 82, .b = 255, .a = 255 }, - { .r = 123, .g = 164, .b = 164, .a = 255 }, { .r = 98, .g = 205, .b = 255, .a = 255 }, - { .r = 98, .g = 164, .b = 230, .a = 255 }, { .r = 255, .g = 90, .b = 0, .a = 255 }, + // 2S2H [Port] Switched from Color_RGBA8_u32 to Color_RGBA8 to avoid endianenes struct union ordering issues + static const Color_RGBA8 D_801DD8E0[] = { + { 65, 164, 255, 255 }, { 131, 164, 230, 255 }, { 98, 205, 255, 255 }, { 82, 82, 255, 255 }, + { 123, 164, 164, 255 }, { 98, 205, 255, 255 }, { 98, 164, 230, 255 }, { 255, 90, 0, 255 }, }; // 2S2H [Port] This originally had `UNALIGNED` however we don't need that for PC and it was causing warnings in the // header file - static const Color_RGBA8_u32 D_801DD900[] = { - { .r = 64, .g = 80, .b = 112, .a = 255 }, { .r = 96, .g = 96, .b = 128, .a = 255 }, - { .r = 128, .g = 112, .b = 144, .a = 255 }, { .r = 160, .g = 128, .b = 160, .a = 255 }, - { .r = 192, .g = 144, .b = 168, .a = 255 }, { .r = 224, .g = 160, .b = 176, .a = 255 }, - { .r = 224, .g = 160, .b = 176, .a = 255 }, { .r = 104, .g = 104, .b = 136, .a = 255 }, - { .r = 136, .g = 120, .b = 152, .a = 255 }, { .r = 168, .g = 136, .b = 168, .a = 255 }, - { .r = 200, .g = 152, .b = 184, .a = 255 }, { .r = 232, .g = 168, .b = 184, .a = 255 }, - { .r = 224, .g = 176, .b = 184, .a = 255 }, { .r = 240, .g = 192, .b = 192, .a = 255 }, - { .r = 232, .g = 184, .b = 192, .a = 255 }, { .r = 248, .g = 200, .b = 192, .a = 255 }, + static const Color_RGBA8 D_801DD900[] = { + { 64, 80, 112, 255 }, { 96, 96, 128, 255 }, { 128, 112, 144, 255 }, { 160, 128, 160, 255 }, + { 192, 144, 168, 255 }, { 224, 160, 176, 255 }, { 224, 160, 176, 255 }, { 104, 104, 136, 255 }, + { 136, 120, 152, 255 }, { 168, 136, 168, 255 }, { 200, 152, 184, 255 }, { 232, 168, 184, 255 }, + { 224, 176, 184, 255 }, { 240, 192, 192, 255 }, { 232, 184, 192, 255 }, { 248, 200, 192, 255 }, }; Vec3f pos; f32 temp; @@ -3275,9 +3269,12 @@ void Environment_DrawSkyboxStarsImpl(PlayState* play, Gfx** gfxP) { } if ((i < 15) || ((i == 15) && ((((void)0, gSaveContext.save.day) % 7) == 0))) { - gDPSetColor(gfx++, G_SETPRIMCOLOR, D_801DD8E0[i % ARRAY_COUNTU(D_801DD8E0)].rgba); + // 2S2H [Port] Switched from gDPSetColor to gDPSetPrimColor for Color_RGBA8 individual fields + Color_RGBA8 color = D_801DD8E0[i % ARRAY_COUNTU(D_801DD8E0)]; + gDPSetPrimColor(gfx++, 0, 0, color.r, color.g, color.b, color.a); } else if (((i & 0x3F) == 0) || (i == 16)) { - gDPSetColor(gfx++, G_SETPRIMCOLOR, D_801DD900[phi_v1 % ARRAY_COUNTU(D_801DD900)].rgba); + Color_RGBA8 color = D_801DD900[phi_v1 % ARRAY_COUNTU(D_801DD900)]; + gDPSetPrimColor(gfx++, 0, 0, color.r, color.g, color.b, color.a); phi_v1++; }