Update gbi.h to use one found in libultra E version (#699)

* Fix some asm size stuff, really only impacts the elf binary.

* Change the gbi.h to one found in libultra version E, and run formatter

* Update m2c submodule
This commit is contained in:
Ryan Myers
2025-08-14 09:29:46 -04:00
committed by GitHub
parent 89e15fb720
commit 055f9db867
12 changed files with 165 additions and 999 deletions
+122 -965
View File
File diff suppressed because it is too large Load Diff
-11
View File
@@ -256,15 +256,4 @@ typedef struct {
u32 paddr;
} guDLPrintCB;
void guSprite2DInit(uSprite *SpritePointer,
void *SourceImagePointer,
void *TlutPointer,
int Stride,
int SubImageWidth,
int SubImageHeight,
int SourceImageType,
int SourceImageBitSize,
int SourceImageOffsetS,
int SourceImageOffsetT);
#endif /* !_GU_H_ */
+14 -5
View File
@@ -200,10 +200,19 @@
_g->words.w1 = rgba; \
}
#if defined(F3DDKR_GBI)
// ?????? - Needed to modify this to work with matching material_init
#undef TXL2WORDS_4b
#define TXL2WORDS_4b(txls) ((txls)/16)
#endif
// DKR Uses these macros, from later gbi.h files
#define gDPSetOtherMode(pkt, mode0, mode1) \
{ \
Gfx *_g = (Gfx *)(pkt); \
\
_g->words.w0 = _SHIFTL(G_RDPSETOTHERMODE,24,8)|_SHIFTL(mode0,0,24);\
_g->words.w1 = (unsigned int)(mode1); \
}
#define gsDPSetOtherMode(mode0, mode1) \
{{ \
_SHIFTL(G_RDPSETOTHERMODE,24,8)|_SHIFTL(mode0,0,24), \
(unsigned int)(mode1) \
}}
#endif
+5 -4
View File
@@ -7,9 +7,10 @@
.section .bss
.equ entrypointThreadStackSize, 0x1000
glabel entrypointThreadStack
.space 0x1000
glabel entrypointThreadStackEnd
.space entrypointThreadStackSize
.size entrypointThreadStack, entrypointThreadStackSize
.section .text, "ax"
@@ -25,10 +26,10 @@ sw $zero, 0x4($t0)
bnez $t1, .clear_bytes
addi $t0, $t0, 0x8
lui $t2, %hi(mainproc)
lui $sp, %hi(entrypointThreadStackEnd)
lui $sp, %hi(entrypointThreadStack + entrypointThreadStackSize)
addiu $t2, $t2, %lo(mainproc)
jr $t2
addiu $sp, $sp, %lo(entrypointThreadStackEnd)
addiu $sp, $sp, %lo(entrypointThreadStack + entrypointThreadStackSize)
nop
nop
nop
+2
View File
@@ -1576,6 +1576,7 @@ negu $v0, $v0
jr $ra
nop
.end coss_s16
.size sins_s16, . - sins_s16
/* Official Name: mathCos */
leaf coss_2
@@ -1603,6 +1604,7 @@ negu $v0, $v0
jr $ra
nop
.end coss_2
.size sins_2, . - sins_2
leaf calc_dyn_lighting_for_level_segment
lw $t1, 0x0($a1)
+7 -4
View File
@@ -57,7 +57,8 @@ void lights_init(s32 count) {
lights_free();
gMaxLights = count;
buffer = (u8 *) mempool_alloc_safe(
gMaxLights * (sizeof(s32 *) + sizeof(ObjectLight) + sizeof(ObjectLightShadeProperties) + sizeof(Vec3f)), COLOUR_TAG_MAGENTA);
gMaxLights * (sizeof(s32 *) + sizeof(ObjectLight) + sizeof(ObjectLightShadeProperties) + sizeof(Vec3f)),
COLOUR_TAG_MAGENTA);
temp = gMaxLights;
gActiveLights = (ObjectLight **) buffer;
@@ -239,7 +240,8 @@ UNUSED void light_toggle(ObjectLight *light) {
/**
* Initialises a gradual change of colour for a light source.
*/
UNUSED void light_setup_colour_change(ObjectLight *light, s32 targetR, s32 diffR, s32 targetG, s32 diffG, s32 targetB, s32 diffB) {
UNUSED void light_setup_colour_change(ObjectLight *light, s32 targetR, s32 diffR, s32 targetG, s32 diffG, s32 targetB,
s32 diffB) {
if (diffR > 0) {
light->targetColourDiffR = diffR;
light->targetColourChangeRateR = ((targetR << 0x10) - light->colourR) / diffR;
@@ -484,8 +486,9 @@ void light_update_shading(Object *object) {
for (i = 0; i < gNumActiveLights; i++) {
light = gActiveLights[i];
if ((light->unk2 & objTypeMask) && (light->enabled == TRUE) && (objX >= light->minX) && (light->maxX >= objX) &&
(objY >= light->minY) && (light->maxY >= objY) && (objZ >= light->minZ) && (light->maxZ >= objZ)) {
if ((light->unk2 & objTypeMask) && (light->enabled == TRUE) && (objX >= light->minX) &&
(light->maxX >= objX) && (objY >= light->minY) && (light->maxY >= objY) && (objZ >= light->minZ) &&
(light->maxZ >= objZ)) {
if (light->unk0 == 0) {
if (light->intensity >= 0x10000) {
gShadeBuffer[numLights].lightObj = light;
+4 -2
View File
@@ -5443,10 +5443,12 @@ void obj_init_audio(Object *obj, LevelObjectEntry_Audio *entry) {
audio->soundMask = NULL;
if (sound_is_looped(audio->soundId)) {
audspat_point_create(audio->soundId, entry->common.x, entry->common.y, entry->common.z, 9, audio->minVolume,
audio->volume, audio->range, audio->fastFalloff, audio->pitch, audio->priority, &audio->soundMask);
audio->volume, audio->range, audio->fastFalloff, audio->pitch, audio->priority,
&audio->soundMask);
} else {
audspat_point_create(audio->soundId, entry->common.x, entry->common.y, entry->common.z, 10, audio->minVolume,
audio->volume, audio->range, audio->fastFalloff, audio->pitch, audio->priority, &audio->soundMask);
audio->volume, audio->range, audio->fastFalloff, audio->pitch, audio->priority,
&audio->soundMask);
}
free_object(obj);
}
+7 -6
View File
@@ -352,7 +352,7 @@ u8 has_ghost_to_save(void);
void set_ghost_none(void);
f32 racer_calc_distance_to_opponent(Object_Racer *racer1, Object_Racer *racer2);
CheckpointNode *get_checkpoint_node(s32 checkpointID);
CheckpointNode *find_next_checkpoint_node(s32 splinePos, s32 arg1);
CheckpointNode *find_next_checkpoint_node(s32 splinePos, s32 isAlternate);
s32 get_checkpoint_count(void);
Object **get_racer_objects(s32 *numRacers);
Object **get_racer_objects_by_port(s32 *numRacers);
@@ -368,8 +368,8 @@ void set_world_shading(f32 ambient, f32 diffuse, s16 angleX, s16 angleY, s16 ang
void set_shading_properties(ShadeProperties *arg0, f32 ambient, f32 diffuse, s16 angleX, s16 angleY, s16 angleZ);
void obj_shade_fancy(ObjectModel *model, Object *object, s32 arg2, f32 intensity);
s32 *get_misc_asset(s32 index);
s32 is_bridge_raised(s32 arg0);
void start_bridge_timer(s32 arg0);
s32 is_bridge_raised(s32 index);
void start_bridge_timer(s32 index);
void obj_bridge_pos(s32 timing, f32 *x, f32 *y, f32 *z);
s16 cutscene_id(void);
void cutscene_id_set(s32 cutsceneID);
@@ -437,8 +437,8 @@ void obj_init_animobject(Object *, Object *);
Object *obj_butterfly_node(f32 x, f32 y, f32 z, f32 maxDistCheck, s32 dontCheckYAxis);
void func_8002125C(Object *obj, LevelObjectEntry_Animation *entry, Object_AnimatedObject *animObj, UNUSED s32 index);
void func_80021104(Object *obj, Object_AnimatedObject *animObj, LevelObjectEntry_Animation *entry);
s32 homing_rocket_get_next_direction(Object *obj, s32 checkpoint, u8 arg2, s32 arg3, s32 arg4, f32 checkpointDist, f32 *outX, f32 *outY,
f32 *outZ);
s32 homing_rocket_get_next_direction(Object *obj, s32 checkpoint, u8 isOnAlternateRoute, s32 arg3, s32 arg4,
f32 checkpointDist, f32 *outX, f32 *outY, f32 *outZ);
void func_80016500(Object *obj, Object_Racer *racer);
void track_spawn_objects(s32, s32);
u8 timetrial_init_staff_ghost(s32 trackId);
@@ -487,7 +487,8 @@ Object *spawn_object(LevelObjectEntryCommon *entry, s32);
s32 func_8001F460(Object *, s32, Object *);
void func_8000B750(Object *racerObj, s32 racerIndex, s32 vehicleIDPrev, s32 boostType, s32 arg4);
void func_80018CE0(Object *racerObj, f32 xPos, f32 yPos, f32 zPos, s32 updateRate);
s32 checkpoint_is_passed(s32 checkpointIndex, Object *obj, f32 objX, f32 objY, f32 objZ, f32 *arg5, u8 *arg6);
s32 checkpoint_is_passed(s32 checkpointIndex, Object *obj, f32 objX, f32 objY, f32 objZ, f32 *checkpointDistance,
u8 *isOnAlternateRoute);
void obj_tex_animate(Object *, s32);
Object *find_furthest_telepoint(f32 x, f32 z);
void model_init_collision(ObjectModel *);
+1
View File
@@ -2,6 +2,7 @@
#include "PR/gbi.h"
#include "PR/mbi.h"
#include "PR/R4300.h"
#include <PR/ultratypes.h>
/**
* Set the offset for the given address, so the RSP can get the correct physical address.
+1
View File
@@ -2,6 +2,7 @@
#define _SET_RSP_SEGMENT_H_
#include "PR/gbi.h"
#include <PR/ultratypes.h>
/**
* Normally, in F3D, RSP segments go up to 16.
+1 -1
View File
@@ -4344,7 +4344,7 @@ void update_fog(s32 viewportCount, s32 updateRate) {
void apply_fog(s32 playerID) {
gDPSetFogColor(gTrackDL++, gFogData[playerID].fog.r >> 0x10, gFogData[playerID].fog.g >> 0x10,
gFogData[playerID].fog.b >> 0x10, 0xFF);
gSPFogPosition(gTrackDL++, gFogData[playerID].fog.near >> 0x10, gFogData[playerID].fog.far >> 0x10);
gSPFogPosition(gTrackDL++, (gFogData[playerID].fog.near >> 0x10), (gFogData[playerID].fog.far >> 0x10));
}
/**