mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Header shuffle, cleanup, and fix UB (#661)
* Cleanup and formatting * Fix typos * formatter * Start working on header cleanup * More include changes * WIP MORE * Finished the first pass of include updates. * More include updates * Handle some UB * Formatter
This commit is contained in:
@@ -109,7 +109,7 @@ To make progress in Adventure 2, a function must be properly named (must not sta
|
||||
For example:
|
||||
```c
|
||||
/**
|
||||
* Returns 1 if Drumstick is avaliable to use, or 0 if not.
|
||||
* Returns 1 if Drumstick is available to use, or 0 if not.
|
||||
*/
|
||||
s32 is_drumstick_unlocked(void) {
|
||||
return gActiveMagicCodes & 2;
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
#include "level_object_entries.h"
|
||||
#include "object_properties.h"
|
||||
#include "gbi.h"
|
||||
#include "audio.h"
|
||||
#include "audiosfx.h"
|
||||
|
||||
typedef struct Vec4f {
|
||||
union {
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <stdio.h>
|
||||
#include "initfx.h"
|
||||
#include "src/memory.h"
|
||||
#include "macros.h"
|
||||
|
||||
// TODO: this comes from a header
|
||||
#ident "$Revision: 1.49 $"
|
||||
|
||||
@@ -458,6 +458,6 @@ void __seqpStopOsc(ALSeqPlayer *seqp, ALVoiceState *vs)
|
||||
/**
|
||||
* The voice limit bytes seem to be unique to this game.
|
||||
*/
|
||||
void set_voice_limit(ALCSPlayer *seqp, s8 voiceLimit) {
|
||||
void set_voice_limit(ALCSPlayer *seqp, u8 voiceLimit) {
|
||||
seqp->voiceLimit = voiceLimit;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "common.h"
|
||||
#include "macros.h"
|
||||
#include "ultra64.h"
|
||||
#include "gzip.h"
|
||||
#include "memory.h"
|
||||
|
||||
/************ .bss ************/
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
#define _ASSET_LOADING_H_
|
||||
|
||||
#include "types.h"
|
||||
#include "gzip.h"
|
||||
#include "memory.h"
|
||||
|
||||
void init_PI_mesg_queue(void);
|
||||
u32 *load_asset_section_from_rom(u32 assetIndex);
|
||||
|
||||
+6
-23
@@ -1,8 +1,8 @@
|
||||
#ifndef _AUDIO_H_
|
||||
#define _AUDIO_H_
|
||||
|
||||
#include "types.h"
|
||||
#include "sched.h"
|
||||
#include "audiosfx.h"
|
||||
|
||||
#define AUDIO_CHANNELS 16
|
||||
#define MUSIC_CHAN_MASK_NONE 0xFFFFFFFF
|
||||
@@ -14,8 +14,6 @@ enum AudioVolumeBehaviour {
|
||||
VOLUME_UNK03,
|
||||
};
|
||||
|
||||
typedef struct ALSoundState* SoundHandle;
|
||||
|
||||
/* Size: 0x0A bytes */
|
||||
typedef struct SoundData {
|
||||
u16 soundBite; // Audio file index.
|
||||
@@ -28,7 +26,6 @@ typedef struct SoundData {
|
||||
u8 unk9;
|
||||
} SoundData;
|
||||
|
||||
|
||||
/* Size: 0x03 bytes */
|
||||
typedef struct MusicData {
|
||||
u8 volume;
|
||||
@@ -43,23 +40,11 @@ typedef struct DelayedSound {
|
||||
/* 0x04 */ SoundHandle *handlePtr;
|
||||
} DelayedSound;
|
||||
|
||||
void alCSPNew(ALCSPlayer *seqp, ALSeqpConfig *config); //lib/src/al/csplayer.c
|
||||
void alCSPSetBank(ALCSPlayer *seqp, ALBank *b); //lib/src/unknown_0C8660.c
|
||||
void set_voice_limit(ALCSPlayer *seqp, u8 voiceLimit); //lib/src/mips1/alseqplayer.c
|
||||
void *alHeapDBAlloc(u8 *file, s32 line, ALHeap *hp, s32 num, s32 size); //lib/src/al/alHeapDBAlloc.c
|
||||
void alCSPSetChlPan(ALCSPlayer *seqp, u8 channel, ALPan pan); //lib/src/unknown_0C84E0.c
|
||||
void alCSPSetChlVol(ALCSPlayer *, u8 channel, u8 volume); //lib/src/unknown_0C84E0.c
|
||||
u8 alCSPGetChlVol(ALCSPlayer *seqp, u8 channel); //lib/src/al
|
||||
void alCSPSetFadeIn(ALCSPlayer *seqp, u8 channel, ALPan pan); //lib/src/unknown_0647A0.c
|
||||
u8 alCSPGetFadeIn(ALCSPlayer *seqp, u8 channel); //lib/src/mips1/al/unknown_064800.c
|
||||
u8 alSeqpGetChlFXMix(ALSeqPlayer *seqp, u8 channel); //lib/src/al/alSeqpGetChlFXMix.c
|
||||
void alFxReverbSet(u8 arg0); //lib/src/mips1/al/reverb.c
|
||||
u8 _alFxEnabled(); //lib/src/mips1/al/reverb.c
|
||||
void alHeapInit(ALHeap *hp, u8 *base, s32 len); //lib/src/al/alHeapInit.c
|
||||
void alBnkfNew(ALBankFile *ctl, u8 *tbl); //lib/src/al/global_asm.c
|
||||
void alCSPSetVol(ALCSPlayer *seqp, s16 volume); //lib/src/al/alCSPSetVol.c
|
||||
void alCSPStop(ALCSPlayer *seqp); //lib/src/al/unknown_0C91A0.c
|
||||
s32 alCSPGetState(ALCSPlayer *seqp); //lib/src/unknown_0C8650.c
|
||||
// These are all functions in libultra that seem to have been created by Rare, so they're not in the standard headers.
|
||||
extern void set_voice_limit(ALCSPlayer *seqp, u8 voiceLimit); // seqplayer.c
|
||||
extern void alCSPSetFadeIn(ALCSPlayer *seqp, u8 chan, ALPan pan); // cspsetfadein.c
|
||||
extern void alFxReverbSet(u8 setting); // reverb.c
|
||||
extern u8 alCSPGetFadeIn(ALCSPlayer *seqp, u8 chan); // cspgetfadein.c
|
||||
|
||||
void audio_init(OSSched *sc);
|
||||
void sound_volume_reset(u8 skipReset);
|
||||
@@ -116,12 +101,10 @@ ALCSPlayer *sound_seqplayer_init(s32 maxVoices, s32 maxEvents);
|
||||
void music_sequence_start(u8 seqID, ALCSPlayer *seqPlayer);
|
||||
void music_sequence_stop(ALCSPlayer *seqPlayer);
|
||||
void sound_reverb_set(u8 setting);
|
||||
void alSeqFileNew(ALSeqFile *file, u8 *base);
|
||||
void func_80063A90(ALCSPlayer *seqp, u8 channel);
|
||||
void sound_volume_set_relative(u16 soundID, SoundHandle soundHandle, u8 volume);
|
||||
void music_sequence_init(ALCSPlayer *seqp, void *sequence, u8 *seqID, ALCSeq *seq);
|
||||
void sound_play(u16 soundID, SoundHandle* handlePtr);
|
||||
void sound_play(u16 soundID, SoundHandle* handlePtr);
|
||||
f32 music_animation_fraction(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "audiosfx.h"
|
||||
#include "tracks.h"
|
||||
#include "math_util.h"
|
||||
#include "menu.h"
|
||||
|
||||
#define MAX_AUDIO_POINTS 40
|
||||
#define MAX_AUDIO_LINES 7
|
||||
|
||||
@@ -2,11 +2,8 @@
|
||||
#define _AUDIO_SPATIAL_H_
|
||||
|
||||
#include "types.h"
|
||||
#include "libc/math.h"
|
||||
#include "structs.h"
|
||||
#include "PR/gbi.h"
|
||||
#include "PR/libaudio.h"
|
||||
#include "camera.h"
|
||||
|
||||
#define AUDIO_LINE_TYPE_SOUND 0
|
||||
#define AUDIO_LINE_TYPE_JINGLE 1
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "game_ui.h"
|
||||
#include "math_util.h"
|
||||
#include "printf.h"
|
||||
#include "asset_loading.h"
|
||||
|
||||
/************ .data ************/
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef _AUDIO_VEHICLE_H_
|
||||
#define _AUDIO_VEHICLE_H_
|
||||
|
||||
#include "types.h"
|
||||
#include "structs.h"
|
||||
#include "audio.h"
|
||||
#include "camera.h"
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "PR/abi.h"
|
||||
#include "common.h"
|
||||
#include "stacks.h"
|
||||
#include "rcp_dkr.h"
|
||||
|
||||
/**** type define's for structures unique to audiomgr ****/
|
||||
typedef union {
|
||||
|
||||
+1
-7
@@ -6,6 +6,7 @@
|
||||
#include "asset_enums.h"
|
||||
#include <ultra64.h>
|
||||
#include "sched.h"
|
||||
#include "PR/libaudio.h"
|
||||
|
||||
#define MAX_UPDATES 32
|
||||
#define MAX_EVENTS 32
|
||||
@@ -39,13 +40,6 @@
|
||||
|
||||
#define MAX_SEQ_LENGTH 20000
|
||||
|
||||
extern Acmd *alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen);
|
||||
extern void *alHeapDBAlloc(u8 *file, s32 line, ALHeap *hp, s32 num, s32 size);
|
||||
extern void alInit(ALGlobals *g, ALSynConfig *c);
|
||||
|
||||
extern s8 rspF3DDKRBootStart[];
|
||||
extern s8 rspF3DDKRDramStart[];
|
||||
|
||||
void audioStartThread(void);
|
||||
void audioStopThread(void);
|
||||
void amCreateAudioMgr(ALSynConfig *c, OSPri pri, OSSched *audSched);
|
||||
|
||||
+3
-12
@@ -1,13 +1,8 @@
|
||||
#ifndef _AUDIOSFX_H_
|
||||
#define _AUDIOSFX_H_
|
||||
|
||||
#include "types.h"
|
||||
#include "macros.h"
|
||||
#include "asset_enums.h"
|
||||
#include <ultra64.h>
|
||||
#include "sched.h"
|
||||
#include "structs.h"
|
||||
#include "audio.h"
|
||||
#include "PR/libaudio.h"
|
||||
|
||||
#define AL_SNDP_PLAY_EVT (1 << 0)
|
||||
#define AL_SNDP_RELEASE_EVT (1 << 1)
|
||||
@@ -61,6 +56,8 @@ typedef struct ALSoundState {
|
||||
/* 0x3F */ u8 state;
|
||||
} ALSoundState;
|
||||
|
||||
typedef struct ALSoundState* SoundHandle;
|
||||
|
||||
typedef struct ALSoundStateLists {
|
||||
/* 0x00 */ ALSoundState *allocHead;
|
||||
/* 0x04 */ ALSoundState *allocTail;
|
||||
@@ -109,12 +106,6 @@ typedef struct audioMgrConfig_s{
|
||||
/* 0x10 */ u16 numGroups;
|
||||
} audioMgrConfig;
|
||||
|
||||
extern void *alHeapDBAlloc(u8 *file, s32 line, ALHeap *hp, s32 num, s32 size);
|
||||
extern void alEvtqNew(ALEventQueue *evtq, ALEventListItem *items, s32 itemCount);
|
||||
extern ALMicroTime alEvtqNextEvent(ALEventQueue *evtq, ALEvent *evt);
|
||||
extern void alSynAddPlayer(ALSynth *drvr, ALPlayer *client);
|
||||
extern void alEvtqPostEvent(ALEventQueue *evtq, ALEvent *evt, ALMicroTime delta);
|
||||
|
||||
void sndp_set_global_volume(u32 volume);
|
||||
s32 sndp_get_global_volume(void);
|
||||
void sndp_set_active_sound_limit(s32 numSounds);
|
||||
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
#ifndef _BORDERS_H_
|
||||
#define _BORDERS_H_
|
||||
|
||||
#include "types.h"
|
||||
#include "f3ddkr.h"
|
||||
#include "PR/gbi.h"
|
||||
|
||||
void divider_draw(Gfx **dList);
|
||||
void divider_clear_coverage(Gfx **dList);
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "weather.h"
|
||||
#include "PRinternal/piint.h"
|
||||
#include "PRinternal/viint.h"
|
||||
#include "textures_sprites.h"
|
||||
#include "menu.h"
|
||||
|
||||
#define CAMERA_MODEL_STACK_SIZE 5
|
||||
|
||||
|
||||
@@ -2,12 +2,8 @@
|
||||
#define _CAMERA_H_
|
||||
|
||||
#include "types.h"
|
||||
#include "macros.h"
|
||||
#include "structs.h"
|
||||
#include "f3ddkr.h"
|
||||
#include "menu.h"
|
||||
#include <ultra64.h>
|
||||
#include "libc/math.h"
|
||||
|
||||
#define SCREEN_WIDTH 320
|
||||
#define SCREEN_HEIGHT 240
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "textures_sprites.h"
|
||||
#include "math_util.h"
|
||||
#include "PRinternal/viint.h"
|
||||
#include "camera.h"
|
||||
#include "video.h"
|
||||
|
||||
/************ .data ************/
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
#define _FADE_TRANSITION_H_
|
||||
|
||||
#include "types.h"
|
||||
#include "camera.h"
|
||||
#include "structs.h"
|
||||
#include "PR/gbi.h"
|
||||
|
||||
#define FADE_FULLSCREEN 0
|
||||
#define FADE_BARNDOOR_HORIZONTAL 1
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
#include "textures_sprites.h"
|
||||
#include "camera.h"
|
||||
#include "common.h"
|
||||
#include "video.h"
|
||||
#include "asset_loading.h"
|
||||
#include "memory.h"
|
||||
|
||||
/************ .data ************/
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user