Format gbi.h, move ucode defines to makefile (#1650)

* Format gbi.h, move ucode defines to makefile, correct usage of gDPSetDither

* UCODE_DEFS -> GBI_DEFINES, add GBI_DOWHILE toggle

* Define GBI_DOWHILE for bss calculations

* Makefile thing
This commit is contained in:
Tharo 2024-06-23 17:51:44 +01:00 committed by GitHub
parent 4c201ff47f
commit 3682a13ec5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 3626 additions and 3202 deletions

View File

@ -127,7 +127,7 @@ CC_CHECK_WARNINGS := -Wall -Wextra -Wno-unknown-pragmas -Wno-unused-parameter -W
# Have CC_CHECK pretend to be a MIPS compiler
MIPS_BUILTIN_DEFS := -DMIPSEB -D_MIPS_FPSET=16 -D_MIPS_ISA=2 -D_ABIO32=1 -D_MIPS_SIM=_ABIO32 -D_MIPS_SZINT=32 -D_MIPS_SZPTR=32
# The -MMD flags additionaly creates a .d file with the same name as the .o file.
CC_CHECK_FLAGS := -MMD -MP -fno-builtin -fsyntax-only -funsigned-char -fdiagnostics-color -std=gnu89 -m32 -DNON_MATCHING -DAVOID_UB -DCC_CHECK=1
CC_CHECK_FLAGS := -MMD -MP -fno-builtin -fsyntax-only -funsigned-char -fdiagnostics-color -std=gnu89 -m32 -DNON_MATCHING -DAVOID_UB -DCC_CHECK=1
ifneq ($(WERROR), 0)
CC_CHECK_WARNINGS += -Werror
@ -168,8 +168,9 @@ CFLAGS += -G 0 -non_shared -Xcpluscomm -nostdinc -Wab,-r4300_mul
WARNINGS := -fullwarn -verbose -woff 624,649,838,712,516,513,596,564,594
ASFLAGS := -march=vr4300 -32 -G0
COMMON_DEFINES := -D_MIPS_SZLONG=32
AS_DEFINES := $(COMMON_DEFINES) -DMIPSEB -D_LANGUAGE_ASSEMBLY -D_ULTRA64
C_DEFINES := $(COMMON_DEFINES) -DLANGUAGE_C -D_LANGUAGE_C
GBI_DEFINES := -DF3DEX_GBI_2 -DF3DEX_GBI_PL -DGBI_DOWHILE
AS_DEFINES := $(COMMON_DEFINES) $(GBI_DEFINES) -DMIPSEB -D_LANGUAGE_ASSEMBLY -D_ULTRA64
C_DEFINES := $(COMMON_DEFINES) $(GBI_DEFINES) -DLANGUAGE_C -D_LANGUAGE_C
ENDIAN := -EB
OPTFLAGS := -O2 -g3

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
#include "prevent_bss_reordering.h"
#include "prevent_bss_reordering2.h" // bumps the bss index by 65
// clang-format off
// Partial structs taken from "prevent_bss_reordering.h"
// Partial structs taken from "prevent_bss_reordering.h", bumps the bss index by 56
struct Dummy200 { int x; };
struct Dummy201 { int x; };
struct Dummy202 { int x; };
@ -14,12 +14,29 @@ struct Dummy209 { int x; };
struct Dummy210 { int x; };
struct Dummy211 { int x; };
struct Dummy212 { int x; };
struct Dummy213 { int x; };
struct Dummy214 { int x; };
struct Dummy215 { int x; };
struct Dummy216 { int x; };
struct Dummy217 { int x; };
struct Dummy218 { int x; };
struct Dummy219 { int x; };
struct Dummy220 { int x; };
struct Dummy221 { int x; };
struct Dummy222 { int x; };
struct Dummy223 { int x; };
struct Dummy224 { int x; };
struct Dummy225 { int x; };
struct Dummy226 { int x; };
struct Dummy227 { int x; };
// clang-format on
// Headers are currently valued at 63 mod 256 (./tools/calc_bss.sh <headers>)
#include "z64math.h"
#include "libc/stdbool.h"
#include "PR/gu.h"
// The bss index at this point should be 184
Vec3f gZeroVec3f = { 0.0f, 0.0f, 0.0f };
Vec3s gZeroVec3s = { 0, 0, 0 };

View File

@ -1,3 +1,4 @@
#include "prevent_bss_reordering.h"
#include "z64bgcheck.h"
#include "libc64/fixed_point.h"

View File

@ -428,7 +428,7 @@ void Lights_DrawGlow(PlayState* play) {
gfx = Gfx_SetupDL65_NoCD(POLY_XLU_DISP);
gDPSetDither(gfx++, G_CD_NOISE);
gDPSetDither(gfx++, G_AD_PATTERN | G_CD_NOISE);
gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE,
0);

View File

@ -1,3 +1,4 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "gfx.h"
#include "sys_cmpdma.h"

View File

@ -1,3 +1,4 @@
#include "prevent_bss_reordering.h"
#include "z64message.h"
#include "global.h"

View File

@ -1083,7 +1083,7 @@ void DmChar00_Draw(Actor* thisx, PlayState* play2) {
gDPSetEnvColor(POLY_XLU_DISP++, (u8)(s8)this->unk_250.r, (u8)(s8)this->unk_250.g, (u8)(s8)this->unk_250.b,
(u8)(s8)((f32)phi_a0 * 1));
gDPSetDither(POLY_XLU_DISP++, G_CD_BAYER);
gDPSetDither(POLY_XLU_DISP++, G_AD_PATTERN | G_CD_BAYER);
POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable,
DmChar00_OverrideLimbDraw, NULL, &this->actor, POLY_XLU_DISP);

View File

@ -156,7 +156,7 @@ void DmChar04_Draw(Actor* thisx, PlayState* play) {
gSPEndDisplayList(gfx);
gDPSetEnvColor(POLY_XLU_DISP++, (u8)(s8)this->envColors.r, (u8)(s8)this->envColors.g, (u8)(s8)this->envColors.b,
(u8)(s8)((f32)alpha * 1));
gDPSetDither(POLY_XLU_DISP++, G_CD_BAYER);
gDPSetDither(POLY_XLU_DISP++, G_AD_PATTERN | G_CD_BAYER);
POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable,
DmChar04_OverrideLimbDraw, NULL, &this->actor, POLY_XLU_DISP);

View File

@ -5267,7 +5267,7 @@ void EnInvadepoh_Alien_Draw(Actor* thisx, PlayState* play2) {
gfx = POLY_XLU_DISP;
gfx = Gfx_SetupDL20_NoCD(gfx);
gDPSetDither(gfx++, G_CD_NOISE);
gDPSetDither(gfx++, G_AD_PATTERN | G_CD_NOISE);
gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE,
0);

View File

@ -671,7 +671,7 @@ void EnInvadepohDemo_Alien_Draw(EnInvadepohDemo* this, PlayState* play) {
gfx = POLY_XLU_DISP;
gfx = Gfx_SetupDL20_NoCD(gfx);
gDPSetDither(gfx++, G_CD_NOISE);
gDPSetDither(gfx++, G_AD_PATTERN | G_CD_NOISE);
gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE,
0);
Matrix_Mult(&play->billboardMtxF, MTXMODE_NEW);

View File

@ -4,7 +4,6 @@
* Description: Keaton grass
*/
#include "prevent_bss_reordering.h"
#include "z_en_kusa2.h"
#include "objects/gameplay_field_keep/gameplay_field_keep.h"
#include "objects/gameplay_keep/gameplay_keep.h"

View File

@ -630,7 +630,7 @@ void EnOsk_Draw(Actor* thisx, PlayState* play) {
gfx = POLY_XLU_DISP;
gfx = Gfx_SetupDL20_NoCD(gfx);
gDPSetDither(gfx++, G_CD_NOISE);
gDPSetDither(gfx++, G_AD_PATTERN | G_CD_NOISE);
gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0);
gSPDisplayList(gfx++, gameplay_keep_DL_029CB0);
gDPSetPrimColor(gfx++, 0, 0, 130, 0, 255, 100);

View File

@ -1086,7 +1086,7 @@ void EnOt_Draw(Actor* thisx, PlayState* play) {
gfx = Gfx_SetupDL65_NoCD(POLY_XLU_DISP);
gDPSetDither(&gfx[0], G_CD_NOISE);
gDPSetDither(&gfx[0], G_AD_PATTERN | G_CD_NOISE);
gDPSetCombineLERP(&gfx[1], 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE,
0);
gSPDisplayList(&gfx[2], gameplay_keep_DL_029CB0);

View File

@ -701,7 +701,7 @@ void func_80B32F04(Actor* thisx, PlayState* play) {
gfx = POLY_XLU_DISP;
gfx = Gfx_SetupDL20_NoCD(gfx);
gDPSetDither(gfx++, G_CD_NOISE);
gDPSetDither(gfx++, G_AD_PATTERN | G_CD_NOISE);
gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0);
gSPDisplayList(gfx++, gameplay_keep_DL_029CB0);

View File

@ -3,7 +3,6 @@
* Overlay: ovl_Obj_Flowerpot
* Description: Breakable Pot With Grass
*/
#include "prevent_bss_reordering.h"
#include "z_obj_flowerpot.h"
#include "objects/object_flowerpot/object_flowerpot.h"

View File

@ -34,7 +34,8 @@ echo "char measurement;" >> $TEMPC
$(pwd)/tools/ido_recomp/linux/7.1/cc -G 0 -non_shared \
-Xfullwarn -Xcpluscomm -O2 -g3 -Xcpluscomm -mips2 \
-I $(pwd)/ -I $(pwd)/include/ -I $(pwd)/src/ -I $(pwd)/assets/ -I $(pwd)/build/n64-us/ \
-D_LANGUAGE_C -DF3DEX_GBI_2 -DF3DEX_GBI_PL -DGBI_DOWHILE \
-I $(pwd)/ -I $(pwd)/include/ -I $(pwd)/include/libc/ -I $(pwd)/src/ -I $(pwd)/assets/ -I $(pwd)/build/n64-us/ \
-Wab,-r4300_mul -woff 624,649,838,712 -c $TEMPC -o $TEMPO
LINE=$(${CROSS}objdump -t $TEMPO | grep measurement | cut -d' ' -f1)