mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Validated and tested (#438)
This commit is contained in:
+16
-11
@@ -1,18 +1,23 @@
|
||||
IndentWidth: 4
|
||||
Language: Cpp
|
||||
AlignAfterOpenBracket: Align
|
||||
SortIncludes: false
|
||||
ColumnLimit: 104
|
||||
UseTab: Never
|
||||
ColumnLimit: 120
|
||||
PointerAlignment: Right
|
||||
AllowShortFunctionsOnASingleLine: false
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
SpaceAfterCStyleCast: true
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
SpaceAfterCStyleCast: true
|
||||
Cpp11BracedListStyle: false
|
||||
IndentCaseLabels: true
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignOperands: true
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
AllowShortBlocksOnASingleLine: true
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: false
|
||||
AlignEscapedNewlines: Left
|
||||
AlignTrailingComments: true
|
||||
UseTab: Never
|
||||
SortIncludes: false
|
||||
+7
-2
@@ -1,5 +1,10 @@
|
||||
Checks: '-*,readability-braces-around-statements'
|
||||
Checks: '-*,readability-braces-around-statements,readability-inconsistent-declaration-parameter-name'
|
||||
WarningsAsErrors: ''
|
||||
HeaderFilterRegex: '(src|include)\/.*\.h$'
|
||||
FormatStyle: 'file'
|
||||
CheckOptions:
|
||||
CheckOptions:
|
||||
# Require argument names to match exactly (instead of allowing a name to be a prefix/suffix of another)
|
||||
# Note: 'true' is expected by clang-tidy 12+ but '1' is used for compatibility with older versions
|
||||
- key: readability-inconsistent-declaration-parameter-name.Strict
|
||||
value: 1
|
||||
|
||||
|
||||
+5
-5
@@ -26,7 +26,7 @@ extern u8 __ASSETS_LUT_START[], __ASSETS_LUT_END[]; // __ASSETS_LUT_START = 0xEC
|
||||
* This will send messages when DMA reads are finished.
|
||||
* After, allocate space and load the asset table into RAM.
|
||||
* Official Name: piInit
|
||||
*/
|
||||
*/
|
||||
void init_PI_mesg_queue(void) {
|
||||
u32 assetTableSize;
|
||||
osCreateMesgQueue(&gPIMesgQueue, gPIMesgBuf, ARRAY_COUNT(gPIMesgBuf));
|
||||
@@ -58,7 +58,7 @@ u32 *load_asset_section_from_rom(u32 assetIndex) {
|
||||
if (out == 0) {
|
||||
return 0;
|
||||
}
|
||||
dmacopy((u32) (start + __ASSETS_LUT_END), (u32)out, size);
|
||||
dmacopy((u32) (start + __ASSETS_LUT_END), (u32) out, size);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ UNUSED u8 *load_compressed_asset_from_rom(u32 assetIndex, s32 extraMemory) {
|
||||
totalSpace = byteswap32(gzipHeaderRamPos) + extraMemory;
|
||||
free_from_memory_pool(gzipHeaderRamPos);
|
||||
out = (u8 *) allocate_from_main_pool_safe(totalSpace + extraMemory, COLOUR_TAG_GREY);
|
||||
if (out == NULL){
|
||||
if (out == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
gzipHeaderRamPos = (out + totalSpace) - size;
|
||||
@@ -95,7 +95,6 @@ UNUSED u8 *load_compressed_asset_from_rom(u32 assetIndex, s32 extraMemory) {
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads an asset section to a specific memory address.
|
||||
* Returns the size of asset section.
|
||||
@@ -185,7 +184,8 @@ void dmacopy(u32 romOffset, u32 ramAddress, s32 numBytes) {
|
||||
if (numBytes < numBytesToDMA) {
|
||||
numBytesToDMA = numBytes;
|
||||
}
|
||||
osPiStartDma(&gAssetsDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, romOffset, (u32 *) ramAddress, numBytesToDMA, &gDmaMesgQueue);
|
||||
osPiStartDma(&gAssetsDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, romOffset, (u32 *) ramAddress, numBytesToDMA,
|
||||
&gDmaMesgQueue);
|
||||
osRecvMesg(&gDmaMesgQueue, &dmaMesg, OS_MESG_BLOCK);
|
||||
numBytes -= numBytesToDMA;
|
||||
romOffset += numBytesToDMA;
|
||||
|
||||
+89
-83
File diff suppressed because it is too large
Load Diff
+13
-13
@@ -61,9 +61,9 @@ 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
|
||||
|
||||
void audio_init(OSSched *arg0);
|
||||
void audio_init(OSSched *sc);
|
||||
void sound_volume_reset(u8 skipReset);
|
||||
void sound_volume_change(s32 arg0);
|
||||
void sound_volume_change(s32 behaviour);
|
||||
void music_change_off(void);
|
||||
void music_change_on(void);
|
||||
void music_play(u8 seqID);
|
||||
@@ -77,20 +77,20 @@ void sound_update_queue(u8 updateRate);
|
||||
void sound_play_delayed(u16 soundId, SoundMask *soundMask, f32 delayTime);
|
||||
void sound_clear_delayed(void);
|
||||
u16 music_channel_get_mask(void);
|
||||
void music_dynamic_set(u16 arg0);
|
||||
void music_dynamic_set(u16 channelMask);
|
||||
void music_channel_off(u8 channel);
|
||||
s32 music_channel_active(s32 channel);
|
||||
void music_channel_on(u8 channel);
|
||||
void music_channel_pan_set(u8 channel, ALPan pan);
|
||||
void music_channel_volume_set(u8 channel, u8 volume);
|
||||
void music_channel_fade_set(u8 channel, ALPan pan);
|
||||
u8 music_channel_fade(u8 arg0);
|
||||
void music_channel_fade_set(u8 channel, ALPan fade);
|
||||
u8 music_channel_fade(u8 channel);
|
||||
void music_channel_reset_all(void);
|
||||
void music_tempo_set_relative(f32 tempo);
|
||||
void music_tempo_set(s32 tempo);
|
||||
s16 music_tempo(void);
|
||||
u8 music_is_playing(void);
|
||||
void music_jingle_play_safe(u8 a0);
|
||||
void music_jingle_play_safe(u8 jingleID);
|
||||
void sound_jingle_tempo_set(s32 tempo);
|
||||
void music_stop(void);
|
||||
u8 music_can_play(void);
|
||||
@@ -106,22 +106,22 @@ void music_jingle_pan_set(ALPan pan);
|
||||
void music_jingle_play(u8 seqID);
|
||||
u32 music_jingle_playing(void);
|
||||
u16 sound_distance(u16 soundId);
|
||||
void sound_play_spatial(u16 soundID, f32 x, f32 y, f32 z, s32 **arg4);
|
||||
void sound_play_spatial(u16 soundID, f32 x, f32 y, f32 z, s32 **soundMask);
|
||||
void func_80001F14(u16 soundID, s32 *soundMask);
|
||||
u16 sound_count(void);
|
||||
u8 music_sequence_count(void);
|
||||
void sound_table_properties(SoundData **table, s32 *size, s32 *count);
|
||||
u8 gSoundBank_GetSoundDecayTime(u16 soundID);
|
||||
ALSeqPlayer *sound_seqplayer_init(s32 _max_voices, s32 _max_events);
|
||||
void music_sequence_start(u8 arg0, ALSeqPlayer *arg1);
|
||||
void music_sequence_stop(ALSeqPlayer *seqp);
|
||||
void sound_reverb_set(u8 arg0);
|
||||
ALSeqPlayer *sound_seqplayer_init(s32 maxVoices, s32 maxEvents);
|
||||
void music_sequence_start(u8 seqID, ALSeqPlayer *seqPlayer);
|
||||
void music_sequence_stop(ALSeqPlayer *seqPlayer);
|
||||
void sound_reverb_set(u8 setting);
|
||||
void alSeqFileNew(ALSeqFile *file, u8 *base);
|
||||
void func_80063A90(ALSeqPlayer *seqp, u8 channel);
|
||||
void sound_volume_set_relative(u16 soundID, void *soundState, u8 volume);
|
||||
void music_sequence_init(ALSeqPlayer* arg0, void* arg1, u8* arg2, ALCSeq* arg3);
|
||||
void music_sequence_init(ALSeqPlayer *seqp, void *sequence, u8 *seqID, ALCSeq *seq);
|
||||
void sound_play(u16 soundID, s32* soundMask);
|
||||
f32 music_animation_fraction(void);
|
||||
void func_80009B7C(s32 *SoundMask, f32 x, f32 y, f32 z);
|
||||
void func_80009B7C(s32 *soundState, f32 x, f32 y, f32 z);
|
||||
|
||||
#endif
|
||||
|
||||
+5
-3
@@ -3,12 +3,14 @@
|
||||
|
||||
#include "audio_assert.h"
|
||||
|
||||
UNUSED void func_800B6F30(UNUSED int arg0, UNUSED int arg1, UNUSED int arg2) {}
|
||||
UNUSED void func_800B6F30(UNUSED int arg0, UNUSED int arg1, UNUSED int arg2) {
|
||||
}
|
||||
|
||||
// Only called from two libultra funcs for some reason.
|
||||
// Only called from two libultra funcs for some reason.
|
||||
// This is likely an assert gone wrong.
|
||||
// Called from alEnvMixerPull, and _pullSubFrame
|
||||
// assert_stub("samples >= 0", "env.c", 104);
|
||||
// assert_stub("samples <= AL_MAX_RSP_SAMPLES", "env.c", 105);
|
||||
// assert_stub("source", "env.c", 373);
|
||||
void assert_stub(UNUSED char *message, UNUSED char *fileName, UNUSED s32 lineNumber) {}
|
||||
void assert_stub(UNUSED char *message, UNUSED char *fileName, UNUSED s32 lineNumber) {
|
||||
}
|
||||
|
||||
+27
-31
@@ -79,7 +79,7 @@ void func_80008168(void) {
|
||||
|
||||
#ifdef NON_EQUIVALENT
|
||||
extern f32 D_80119C60[672];
|
||||
extern f32 D_8011A6E0[336];//[7][48];
|
||||
extern f32 D_8011A6E0[336]; //[7][48];
|
||||
extern unk8011A6D8 **D_8011A6DC;
|
||||
void func_80008174(void) {
|
||||
s32 i;
|
||||
@@ -123,7 +123,7 @@ void func_80008174(void) {
|
||||
// D_8011A6E0[i][j] = -100000.0;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
D_8011AC18 = 0;
|
||||
}
|
||||
#else
|
||||
@@ -159,7 +159,7 @@ s32 func_800090C0(f32 arg0, f32 arg1, s32 arg2) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
//Best I can figure, this measures the distance between XYZ values.
|
||||
// Best I can figure, this measures the distance between XYZ values.
|
||||
s32 func_800092A8(f32 inX, f32 inY, f32 inZ, floatXYZVals *floatXYZ, f32 *outX, f32 *outY, f32 *outZ) {
|
||||
f32 dx, dy, dz;
|
||||
f32 x1, y1, z1;
|
||||
@@ -183,8 +183,7 @@ s32 func_800092A8(f32 inX, f32 inY, f32 inZ, floatXYZVals *floatXYZ, f32 *outX,
|
||||
if (dx == 0.0 && dy == 0.0 && dz == 0.0) {
|
||||
temp = 0.0f;
|
||||
} else {
|
||||
temp = ((inX - x1) * dx + (inY - y1) * dy + (inZ - z1) * dz) /
|
||||
(dx * dx + dy * dy + dz * dz);
|
||||
temp = ((inX - x1) * dx + (inY - y1) * dy + (inZ - z1) * dz) / (dx * dx + dy * dy + dz * dz);
|
||||
}
|
||||
|
||||
if (temp < 0.0f) {
|
||||
@@ -205,8 +204,7 @@ s32 func_800092A8(f32 inX, f32 inY, f32 inZ, floatXYZVals *floatXYZ, f32 *outX,
|
||||
ret = sqrtf(dx * dx + dy * dy + dz * dz);
|
||||
} else {
|
||||
*outX = temp * dx + x1, // Comma required here as this was likely all one line.
|
||||
*outY = temp * dy + y1,
|
||||
*outZ = temp * dz + z1;
|
||||
*outY = temp * dy + y1, *outZ = temp * dz + z1;
|
||||
|
||||
ret = sqrtf((*outX - inX) * (*outX - inX) + (*outY - inY) * (*outY - inY) + (*outZ - inZ) * (*outZ - inZ));
|
||||
}
|
||||
@@ -215,12 +213,11 @@ s32 func_800092A8(f32 inX, f32 inY, f32 inZ, floatXYZVals *floatXYZ, f32 *outX,
|
||||
}
|
||||
|
||||
/**
|
||||
* Play Sound at position
|
||||
* Play Sound at position
|
||||
*/
|
||||
void play_sound_at_position(u16 soundId, f32 x, f32 y, f32 z, u8 arg4, SoundMask **soundMask) {
|
||||
func_8000974C(D_80119C40[soundId].soundBite, x, y, z, arg4, D_80119C40[soundId].unk3,
|
||||
D_80119C40[soundId].volume, D_80119C40[soundId].distance, 0, D_80119C40[soundId].pitch,
|
||||
D_80119C40[soundId].unk8, soundMask);
|
||||
func_8000974C(D_80119C40[soundId].soundBite, x, y, z, arg4, D_80119C40[soundId].unk3, D_80119C40[soundId].volume,
|
||||
D_80119C40[soundId].distance, 0, D_80119C40[soundId].pitch, D_80119C40[soundId].unk8, soundMask);
|
||||
}
|
||||
|
||||
void func_800095E8(u16 soundId, f32 x, f32 y, f32 z, u8 arg4, u8 arg5, f32 arg6, SoundMask **soundMask) {
|
||||
@@ -244,7 +241,8 @@ void func_800096F8(SoundMask *arg0) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_8000974C(u16 soundBite, f32 x, f32 y, f32 z, u8 arg4, u8 arg5, u8 volume, u16 distance, u8 arg8, u8 pitch, u8 argA, SoundMask **soundMask) {
|
||||
void func_8000974C(u16 soundBite, f32 x, f32 y, f32 z, u8 arg4, u8 arg5, u8 volume, u16 distance, u8 arg8, u8 pitch,
|
||||
u8 argA, SoundMask **soundMask) {
|
||||
SoundMask *newMask;
|
||||
|
||||
if (soundMask != NULL) {
|
||||
@@ -277,14 +275,14 @@ void func_8000974C(u16 soundBite, f32 x, f32 y, f32 z, u8 arg4, u8 arg5, u8 volu
|
||||
}
|
||||
}
|
||||
|
||||
void func_800098A4(u8 arg0, u16 soundId, f32 x, f32 y, f32 z, u8 arg5, u8 arg6,
|
||||
u8 arg7, u8 arg8, u16 arg9, u8 argA, u8 argB, u8 argC) {
|
||||
void func_800098A4(u8 arg0, u16 soundId, f32 x, f32 y, f32 z, u8 arg5, u8 arg6, u8 arg7, u8 arg8, u16 arg9, u8 argA,
|
||||
u8 argB, u8 argC) {
|
||||
Vec3f *temp_a0;
|
||||
unk80119C58 *temp_v1;
|
||||
|
||||
if ((argB < 7) && (argC < 30)) {
|
||||
temp_v1 = &D_80119C58[argB];
|
||||
temp_a0 = (Vec3f *) (((u32 *) &temp_v1->unk4) + argC * 3); //This can't be right...
|
||||
temp_a0 = (Vec3f *) (((u32 *) &temp_v1->unk4) + argC * 3); // This can't be right...
|
||||
temp_a0->x = x;
|
||||
temp_a0->y = y;
|
||||
temp_a0->z = z;
|
||||
@@ -319,7 +317,7 @@ void func_80009968(f32 x, f32 y, f32 z, u8 arg3, u8 arg4, u8 arg5) {
|
||||
D_8011A6D8[arg4].unk0.unk0_02 = arg3 & 0xFF;
|
||||
}
|
||||
if (D_8011A6D8[arg4].unkB8 < tempArg5) {
|
||||
D_8011A6D8[arg4].unkB8 = tempArg5;
|
||||
D_8011A6D8[arg4].unkB8 = tempArg5;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -356,8 +354,8 @@ s32 func_80009AB4(u8 arg0) {
|
||||
s32 ret;
|
||||
s32 i;
|
||||
unk8011A6D8 *levelHeader;
|
||||
unk8011A6D8_04 *var_a2; //Probably a Vec3f
|
||||
|
||||
unk8011A6D8_04 *var_a2; // Probably a Vec3f
|
||||
|
||||
ret = 1;
|
||||
levelHeader = &D_8011A6D8[arg0];
|
||||
var_a2 = (unk8011A6D8_04 *) &levelHeader->unk4;
|
||||
@@ -367,9 +365,7 @@ s32 func_80009AB4(u8 arg0) {
|
||||
}
|
||||
|
||||
for (i = 0; i < levelHeader->unkB8; i++, var_a2++) {
|
||||
if ((var_a2->unk0 == -100000.0) ||
|
||||
(var_a2->unk0 + 1 == -100000.0) ||
|
||||
(var_a2->unk0 + 2 == -100000.0)) {
|
||||
if ((var_a2->unk0 == -100000.0) || (var_a2->unk0 + 1 == -100000.0) || (var_a2->unk0 + 2 == -100000.0)) {
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
@@ -475,7 +471,7 @@ void func_8000A2E8(s32 arg0) {
|
||||
/**
|
||||
* Generates and renders a coloured line visible from anywhere.
|
||||
* Allows use of a colour, that interpolates from bright to dark from the beginning to the end of the line.
|
||||
*/
|
||||
*/
|
||||
void debug_render_line(Gfx **dlist, Vertex **verts, Triangle **tris, floatXYZVals *coords, u8 red, u8 green, u8 blue) {
|
||||
Gfx *temp_dlist;
|
||||
Vertex *temp_verts;
|
||||
@@ -487,14 +483,14 @@ void debug_render_line(Gfx **dlist, Vertex **verts, Triangle **tris, floatXYZVal
|
||||
s16 y2;
|
||||
s16 z2;
|
||||
|
||||
x1 = coords->x1;
|
||||
y1 = coords->y1;
|
||||
z1 = coords->z1;
|
||||
x2 = coords->x2;
|
||||
y2 = coords->y2;
|
||||
z2 = coords->z2;
|
||||
x1 = coords->x1;
|
||||
y1 = coords->y1;
|
||||
z1 = coords->z1;
|
||||
x2 = coords->x2;
|
||||
y2 = coords->y2;
|
||||
z2 = coords->z2;
|
||||
temp_dlist = *dlist;
|
||||
|
||||
|
||||
temp_verts = *verts;
|
||||
temp_tris = *tris;
|
||||
load_and_set_texture_no_offset(&temp_dlist, NULL, RENDER_NONE);
|
||||
@@ -529,7 +525,7 @@ void debug_render_line(Gfx **dlist, Vertex **verts, Triangle **tris, floatXYZVal
|
||||
temp_verts[3].b = 255;
|
||||
temp_verts[3].a = 255;
|
||||
temp_verts += 4;
|
||||
|
||||
|
||||
temp_tris[0].flags = 0x40; // 0x40 = Draw backface.
|
||||
temp_tris[0].vi0 = 2;
|
||||
temp_tris[0].vi1 = 1;
|
||||
@@ -551,7 +547,7 @@ void debug_render_line(Gfx **dlist, Vertex **verts, Triangle **tris, floatXYZVal
|
||||
temp_tris[1].uv2.u = 1;
|
||||
temp_tris[1].uv2.v = 0;
|
||||
temp_tris += 2;
|
||||
|
||||
|
||||
*dlist = temp_dlist;
|
||||
*verts = temp_verts;
|
||||
*tris = temp_tris;
|
||||
|
||||
+3
-2
@@ -53,7 +53,8 @@ typedef struct unk800A414_arg3 {
|
||||
void func_80008168(void);
|
||||
void func_800096F8(SoundMask *);
|
||||
void func_80008140(void);
|
||||
void func_8000974C(u16 soundId, f32 x, f32 y, f32 z, u8 arg4, u8 arg5, u8 arg6, u16 arg7, u8 arg8, u8 arg9, u8 argA, SoundMask **soundMask);
|
||||
void func_8000974C(u16 soundBite, f32 x, f32 y, f32 z, u8 arg4, u8 arg5, u8 volume, u16 distance, u8 arg8, u8 pitch,
|
||||
u8 argA, SoundMask **soundMask);
|
||||
void play_sound_at_position(u16 soundId, f32 x, f32 y, f32 z, u8 arg4, SoundMask **soundMask);
|
||||
void func_8000A2E8(s32 arg0);
|
||||
s32 func_800090C0(f32, f32, s32);
|
||||
@@ -71,6 +72,6 @@ void func_80009968(f32, f32, f32, u8, u8, u8); // Non Matching
|
||||
void func_80008174(void); // Non Matching
|
||||
void func_80008040(void); // Non Matching
|
||||
void func_80008438(Object **arg0, s32 numRacers, s32 updateRate); // Non Matching
|
||||
void func_80006FC8(Object **arg0, s32 numRacers, ObjectSegment *arg2, u8 arg3, s32 updateRate); // Non Matching
|
||||
void func_80006FC8(Object **objs, s32 numRacers, ObjectSegment *segment, u8 arg3, s32 updateRate); // Non Matching
|
||||
|
||||
#endif
|
||||
|
||||
+100
-68
@@ -30,14 +30,14 @@ VehicleSoundData *gRacerSound;
|
||||
Object_Racer *gSoundRacerObj;
|
||||
SoundData *D_80119C40; // This should be in audio_spatial?
|
||||
SoundMask **gSoundMaskHeapUsed;
|
||||
unk80119C48 **gSoundMaskHeap; //0x24 struct size - 0x5A0 total size - should be 40 elements
|
||||
unk80119C48 **gSoundMaskHeap; // 0x24 struct size - 0x5A0 total size - should be 40 elements
|
||||
u8 gFreeMasks;
|
||||
SoundMask **gSoundMaskHeapFree;
|
||||
s32 D_80119C54; //Padding?
|
||||
unk80119C58 **D_80119C58; //Struct of size in func_8000A184 = 0x180 = 384 bytes | Ambient Sounds
|
||||
unk80119C58 **D_80119C5C; //Struct of size in func_8000A184 = 0x180 = 384 bytes Likely the same as above
|
||||
f32 D_80119C60[670]; //array size of 672 looks to be required for func_80008174
|
||||
unk8011A6D8 *D_8011A6D8; //unk8011A6D8[] | Reverb stuff
|
||||
s32 D_80119C54; // Padding?
|
||||
unk80119C58 **D_80119C58; // Struct of size in func_8000A184 = 0x180 = 384 bytes | Ambient Sounds
|
||||
unk80119C58 **D_80119C5C; // Struct of size in func_8000A184 = 0x180 = 384 bytes Likely the same as above
|
||||
f32 D_80119C60[670]; // array size of 672 looks to be required for func_80008174
|
||||
unk8011A6D8 *D_8011A6D8; // unk8011A6D8[] | Reverb stuff
|
||||
unk8011A6D8 **D_8011A6DC; // Struct of size 0xC0
|
||||
f32 D_8011A6E0[334];
|
||||
s32 D_8011AC18;
|
||||
@@ -68,7 +68,7 @@ VehicleSoundData *func_80004B40(s8 characterId, s8 vehicleId) {
|
||||
if (characterId >= 11) {
|
||||
characterId = 11;
|
||||
}
|
||||
|
||||
|
||||
if (D_800DC6D8 != 0) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
D_80119C30[i] = NULL;
|
||||
@@ -81,8 +81,8 @@ VehicleSoundData *func_80004B40(s8 characterId, s8 vehicleId) {
|
||||
temp_v0_2 = (unkAudioAsset *) allocate_from_main_pool_safe(sizeof(unkAudioAsset), COLOUR_TAG_CYAN);
|
||||
load_asset_to_address(ASSET_AUDIO, (u32) temp_v0_2, temp_s1, sizeof(unkAudioAsset));
|
||||
temp_v0_3 = (VehicleSoundData *) allocate_from_main_pool_safe(sizeof(VehicleSoundData), COLOUR_TAG_CYAN);
|
||||
|
||||
//Not really sure this is right...
|
||||
|
||||
// Not really sure this is right...
|
||||
memset = temp_v0_3;
|
||||
for (var_a3 = 0; var_a3 < sizeof(VehicleSoundData); var_a3++) {
|
||||
memset[var_a3] = 0;
|
||||
@@ -114,7 +114,7 @@ VehicleSoundData *func_80004B40(s8 characterId, s8 vehicleId) {
|
||||
temp_v0_3->unkC[0][0] = temp_v0_2->unkC;
|
||||
var_a2 = &temp_v0_3->unk0[1];
|
||||
temp_v0_3->unk2C[0] = temp_v0_2->unk2C;
|
||||
loop_10:
|
||||
loop_10:
|
||||
var_a3_2 += 2;
|
||||
var_a0->unk4[0][0] = (u8) var_v1_2->unk4[0];
|
||||
var_v1_2 += 2;
|
||||
@@ -154,10 +154,12 @@ loop_10:
|
||||
} else {
|
||||
temp_v0_3->unk5C[0] = temp_v0_3->basePitch;
|
||||
temp_a1 = temp_v0_3->unk5C[0] * 10000.0f;
|
||||
for (var_a0_2 = 0; temp_a1 >= temp_v0_3->unk18[var_a0_2] && var_a0_2 < 4; var_a0_2++) { }
|
||||
for (var_a0_2 = 0; temp_a1 >= temp_v0_3->unk18[var_a0_2] && var_a0_2 < 4; var_a0_2++) {}
|
||||
var_a0_2--;
|
||||
new_var = (temp_a1 - temp_v0_3->unk18[var_a0_2]) / ((f32) (temp_v0_3->unk18[var_a0_2 + 1] - temp_v0_3->unk18[var_a0_2]));
|
||||
temp_v0_3->unk54[0] = temp_v0_3->unk2C[var_a0_2] + (temp_v0_3->unk2C[var_a0_2 + 1] - temp_v0_3->unk2C[var_a0_2]) * new_var;
|
||||
new_var = (temp_a1 - temp_v0_3->unk18[var_a0_2]) /
|
||||
((f32) (temp_v0_3->unk18[var_a0_2 + 1] - temp_v0_3->unk18[var_a0_2]));
|
||||
temp_v0_3->unk54[0] =
|
||||
temp_v0_3->unk2C[var_a0_2] + (temp_v0_3->unk2C[var_a0_2 + 1] - temp_v0_3->unk2C[var_a0_2]) * new_var;
|
||||
}
|
||||
free_from_memory_pool(addrPtr);
|
||||
free_from_memory_pool((void *) temp_v0_2);
|
||||
@@ -171,7 +173,7 @@ GLOBAL_ASM("asm/non_matchings/audio_vehicle/func_80004B40.s")
|
||||
* Update the sound of the engine and braking during gameplay, for later.
|
||||
* Check which vehicle is being used, update the position of the audio,
|
||||
* then call a function to handle that particular vehicles audio.
|
||||
*/
|
||||
*/
|
||||
void racer_sound_update(Object *obj, u32 buttonsPressed, u32 buttonsHeld, s32 updateRate) {
|
||||
if (gVehicleSounds) {
|
||||
gSoundRacerObj = &obj->unk64->racer;
|
||||
@@ -208,7 +210,7 @@ void racer_sound_update(Object *obj, u32 buttonsPressed, u32 buttonsHeld, s32 up
|
||||
}
|
||||
|
||||
#ifdef NON_EQUIVALENT
|
||||
//Scratch: https://decomp.me/scratch/w3w2c
|
||||
// Scratch: https://decomp.me/scratch/w3w2c
|
||||
void func_80005254(Object *obj, u32 buttonsPressed, u32 buttonsHeld, s32 updateRate) {
|
||||
f32 sp6C;
|
||||
f32 temp_f14;
|
||||
@@ -242,25 +244,31 @@ void func_80005254(Object *obj, u32 buttonsPressed, u32 buttonsHeld, s32 updateR
|
||||
for (outerLoop = 0; outerLoop < 1; outerLoop++) {
|
||||
if ((gRacerSound->unk0[outerLoop]) != 0) {
|
||||
innerLoop = 0;
|
||||
while ((var_s0 < gRacerSound->unkC[outerLoop][innerLoop] || var_s0 > gRacerSound->unkC[outerLoop][innerLoop + 1] ) && innerLoop < 4) {
|
||||
while ((var_s0 < gRacerSound->unkC[outerLoop][innerLoop] ||
|
||||
var_s0 > gRacerSound->unkC[outerLoop][innerLoop + 1]) &&
|
||||
innerLoop < 4) {
|
||||
innerLoop++;
|
||||
}
|
||||
|
||||
temp_f14 = (var_s0 - gRacerSound->unkC[0][innerLoop] ) / ((f32) (gRacerSound->unkC[0][innerLoop + 1] - gRacerSound->unkC[0][innerLoop] ));
|
||||
temp_f4 = gRacerSound->unk2C[outerLoop] + (gRacerSound->unk2C[outerLoop + 1] - gRacerSound->unk2C[outerLoop]) * temp_f14;
|
||||
|
||||
|
||||
temp_f14 = (var_s0 - gRacerSound->unkC[0][innerLoop]) /
|
||||
((f32) (gRacerSound->unkC[0][innerLoop + 1] - gRacerSound->unkC[0][innerLoop]));
|
||||
temp_f4 = gRacerSound->unk2C[outerLoop] +
|
||||
(gRacerSound->unk2C[outerLoop + 1] - gRacerSound->unk2C[outerLoop]) * temp_f14;
|
||||
|
||||
innerLoop = 0;
|
||||
while ((var_s0 < gRacerSound->unk4[0][innerLoop] || var_s0 > gRacerSound->unk4[0][innerLoop + 1]) && innerLoop < 4) {
|
||||
while ((var_s0 < gRacerSound->unk4[0][innerLoop] || var_s0 > gRacerSound->unk4[0][innerLoop + 1]) &&
|
||||
innerLoop < 4) {
|
||||
innerLoop++;
|
||||
}
|
||||
|
||||
temp_f14 = (var_s0 - gRacerSound->unk4[0][innerLoop]) / ((f32) (gRacerSound->unk4[0][innerLoop + 1] - gRacerSound->unk4[0][innerLoop]));
|
||||
|
||||
temp_f14 = (var_s0 - gRacerSound->unk4[0][innerLoop]) /
|
||||
((f32) (gRacerSound->unk4[0][innerLoop + 1] - gRacerSound->unk4[0][innerLoop]));
|
||||
temp_f16 = gRacerSound->unk18[innerLoop] / 10000.0f;
|
||||
temp_f18 = gRacerSound->unk18[innerLoop + 1] / 10000.0f;
|
||||
if (var_s0 > 50 && gSoundRacerObj->bananas != 0) {
|
||||
if (gSoundRacerObj->bananas <= 10) {
|
||||
var_v1_3 = gSoundRacerObj->bananas;
|
||||
} else {
|
||||
} else {
|
||||
var_v1_3 = 10;
|
||||
}
|
||||
if (gRacerSound->bananaPitch < (0.05 * var_v1_3)) {
|
||||
@@ -316,12 +324,11 @@ void func_80005254(Object *obj, u32 buttonsPressed, u32 buttonsHeld, s32 updateR
|
||||
}
|
||||
}
|
||||
}
|
||||
if (((gSoundRacerObj->unk10 != 0) || (gSoundRacerObj->unk14 != 0) ||
|
||||
!(buttonsHeld & B_BUTTON) || (gSoundRacerObj->velocity > -0.1) ||
|
||||
(gSoundRacerObj->vehicleID == 4)) && (gRacerSound->unkA8 != 0)
|
||||
) {
|
||||
func_8000488C(gRacerSound->unkA8);
|
||||
gRacerSound->unkA8 = 0;
|
||||
if (((gSoundRacerObj->unk10 != 0) || (gSoundRacerObj->unk14 != 0) || !(buttonsHeld & B_BUTTON) ||
|
||||
(gSoundRacerObj->velocity > -0.1) || (gSoundRacerObj->vehicleID == 4)) &&
|
||||
(gRacerSound->unkA8 != 0)) {
|
||||
func_8000488C(gRacerSound->unkA8);
|
||||
gRacerSound->unkA8 = 0;
|
||||
} else if ((buttonsPressed & B_BUTTON) && (gRacerSound->unkA8 == 0) && (gSoundRacerObj->playerIndex >= 0)) {
|
||||
if (gSoundRacerObj->velocity < 0.0f) {
|
||||
var_f20 = -gSoundRacerObj->velocity;
|
||||
@@ -335,7 +342,7 @@ void func_80005254(Object *obj, u32 buttonsPressed, u32 buttonsHeld, s32 updateR
|
||||
sp6C = (((var_f20 * 0.5) / 12.0) + 0.5);
|
||||
temp_a0_4 = gRacerSound->unkA8;
|
||||
if (temp_a0_4 != 0) {
|
||||
sound_event_update(temp_a0_4, 16, *((u32*) &sp6C));
|
||||
sound_event_update(temp_a0_4, 16, *((u32 *) &sp6C));
|
||||
}
|
||||
gRacerSound->unkAC = 110;
|
||||
gRacerSound->unkD0 = 0;
|
||||
@@ -350,7 +357,8 @@ void func_80005254(Object *obj, u32 buttonsPressed, u32 buttonsHeld, s32 updateR
|
||||
sound_event_update(gRacerSound->unkA8, 8, 0);
|
||||
} else {
|
||||
sound_event_update(gRacerSound->unkA8, 8, gRacerSound->unkAC << 8);
|
||||
func_80009B7C((s32 *) gRacerSound->unkA8, obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position);
|
||||
func_80009B7C((s32 *) gRacerSound->unkA8, obj->segment.trans.x_position, obj->segment.trans.y_position,
|
||||
obj->segment.trans.z_position);
|
||||
}
|
||||
}
|
||||
gRacerSound->unkA0 = var_s0;
|
||||
@@ -366,7 +374,7 @@ GLOBAL_ASM("asm/non_matchings/audio_vehicle/func_80005254.s")
|
||||
* Update the engine sounds for the hovercraft.
|
||||
* Uses velocity, banana count and ground contact to decide what pitch to use.
|
||||
* Those values are calculated in this function.
|
||||
*/
|
||||
*/
|
||||
void racer_sound_hovercraft(Object *obj, UNUSED u32 buttonsPressed, u32 buttonsHeld, s32 updateRate) {
|
||||
UNUSED s32 pad;
|
||||
f32 velocity;
|
||||
@@ -381,7 +389,8 @@ void racer_sound_hovercraft(Object *obj, UNUSED u32 buttonsPressed, u32 buttonsH
|
||||
u8 i;
|
||||
|
||||
if (get_race_countdown() == 0) {
|
||||
velocity = sqrtf((obj->segment.x_velocity * obj->segment.x_velocity) + (obj->segment.z_velocity * obj->segment.z_velocity));
|
||||
velocity = sqrtf((obj->segment.x_velocity * obj->segment.x_velocity) +
|
||||
(obj->segment.z_velocity * obj->segment.z_velocity));
|
||||
} else {
|
||||
velocity = 0.0f;
|
||||
}
|
||||
@@ -433,17 +442,18 @@ void racer_sound_hovercraft(Object *obj, UNUSED u32 buttonsPressed, u32 buttonsH
|
||||
pitch += gRacerSound->bananaPitch;
|
||||
}
|
||||
pitch += ((velocity * gRacerSound->unkCC) + var_f18 + gRacerSound->throttlePitch);
|
||||
if (gSoundRacerObj->playerIndex != PLAYER_COMPUTER && gSoundRacerObj->groundedWheels == 0 && gSoundRacerObj->waterTimer < 4) {
|
||||
if (gSoundRacerObj->playerIndex != PLAYER_COMPUTER && gSoundRacerObj->groundedWheels == 0 &&
|
||||
gSoundRacerObj->waterTimer < 4) {
|
||||
if (get_race_countdown() == 0) {
|
||||
pitch += 0.3;
|
||||
}
|
||||
}
|
||||
gRacerSound->unk5C[0] += ((pitch - gRacerSound->unk5C[0]) / 8);
|
||||
if (gRacerSound->unk5C[0] > (0x7FFF / 5000.0)) {
|
||||
gRacerSound->unk5C[0] = (0x7FFF / 5000.0); //6.5534
|
||||
gRacerSound->unk5C[0] = (0x7FFF / 5000.0); // 6.5534
|
||||
}
|
||||
temp_f10 = gRacerSound->unk5C[0] * 10000.0f;
|
||||
for (i = 0; temp_f10 >= gRacerSound->unk18[i] && i < 4; i++) { }
|
||||
for (i = 0; temp_f10 >= gRacerSound->unk18[i] && i < 4; i++) {}
|
||||
if (i == 4) {
|
||||
var_t0 = gRacerSound->unk2C[i];
|
||||
} else {
|
||||
@@ -461,7 +471,7 @@ void racer_sound_hovercraft(Object *obj, UNUSED u32 buttonsPressed, u32 buttonsH
|
||||
#ifdef NON_EQUIVALENT
|
||||
void func_800063EC(Object *obj, UNUSED u32 buttonsPressed, u32 buttonsHeld, s32 updateRate) {
|
||||
f32 sp28;
|
||||
f32 var_f2;
|
||||
f32 var_f2;
|
||||
u16 temp_f10;
|
||||
f32 var_f14;
|
||||
f32 temp_f8;
|
||||
@@ -478,7 +488,8 @@ void func_800063EC(Object *obj, UNUSED u32 buttonsPressed, u32 buttonsHeld, s32
|
||||
zVel = obj->segment.z_velocity;
|
||||
yVel = obj->segment.y_velocity;
|
||||
var_f18 = sqrtf((xVel * xVel) + (zVel * zVel) + (yVel * yVel));
|
||||
//var_f18 = sqrtf((obj->segment.x_velocity * obj->segment.x_velocity) + (obj->segment.z_velocity * obj->segment.z_velocity) + (obj->segment.y_velocity * obj->segment.y_velocity));
|
||||
// var_f18 = sqrtf((obj->segment.x_velocity * obj->segment.x_velocity) + (obj->segment.z_velocity *
|
||||
// obj->segment.z_velocity) + (obj->segment.y_velocity * obj->segment.y_velocity));
|
||||
} else {
|
||||
var_f18 = 0.0f;
|
||||
}
|
||||
@@ -486,7 +497,7 @@ void func_800063EC(Object *obj, UNUSED u32 buttonsPressed, u32 buttonsHeld, s32
|
||||
gRacerSound->unk54[0] += ((gRacerSound->unk37 - gRacerSound->unk54[0]) / 8);
|
||||
} else {
|
||||
temp_f10 = gRacerSound->unk5C[0] * 10000.0f;
|
||||
for (i = 0; temp_f10 >= gRacerSound->unk18[i] && i < 4; i++) { }
|
||||
for (i = 0; temp_f10 >= gRacerSound->unk18[i] && i < 4; i++) {}
|
||||
if (i == 4) {
|
||||
var_t0 = gRacerSound->unk2C[i];
|
||||
} else {
|
||||
@@ -544,11 +555,12 @@ void func_800063EC(Object *obj, UNUSED u32 buttonsPressed, u32 buttonsHeld, s32
|
||||
}
|
||||
gRacerSound->unk5C[0] += ((var_f14 - gRacerSound->unk5C[0]) / 8);
|
||||
if (gRacerSound->unk5C[0] > (0x7FFF / 5000.0)) {
|
||||
gRacerSound->unk5C[0] = (0x7FFF / 5000.0); //6.5534
|
||||
gRacerSound->unk5C[0] = (0x7FFF / 5000.0); // 6.5534
|
||||
}
|
||||
gRacerSound->unk5C[1] = 1.0f;
|
||||
gRacerSound->unk54[1] = 0.0f;
|
||||
if ((gSoundRacerObj->playerIndex != PLAYER_COMPUTER) && (gSoundRacerObj->spinout_timer != 0) && !gRacerSound->brakeSound) {
|
||||
if ((gSoundRacerObj->playerIndex != PLAYER_COMPUTER) && (gSoundRacerObj->spinout_timer != 0) &&
|
||||
!gRacerSound->brakeSound) {
|
||||
gRacerSound->brakeSound = TRUE;
|
||||
sound_play(SOUND_UNK_13D, &gRacerSound->brakeSoundMask);
|
||||
} else if (gSoundRacerObj->spinout_timer == 0) {
|
||||
@@ -564,7 +576,7 @@ GLOBAL_ASM("asm/non_matchings/audio_vehicle/func_800063EC.s")
|
||||
|
||||
/**
|
||||
* Stops all associated sounds and then frees the vehicle sound data from RAM.
|
||||
*/
|
||||
*/
|
||||
void racer_sound_free(Object *obj) {
|
||||
s32 i;
|
||||
|
||||
@@ -631,10 +643,13 @@ void func_80006BFC(Object *obj, ObjectSegment *segment, Object *obj2, s32 update
|
||||
}
|
||||
break;
|
||||
case VEHICLE_HOVERCRAFT:
|
||||
velocity = sqrtf((obj->segment.x_velocity * obj->segment.x_velocity) + (obj->segment.z_velocity * obj->segment.z_velocity));
|
||||
velocity = sqrtf((obj->segment.x_velocity * obj->segment.x_velocity) +
|
||||
(obj->segment.z_velocity * obj->segment.z_velocity));
|
||||
break;
|
||||
default:
|
||||
velocity = sqrtf((obj->segment.x_velocity * obj->segment.x_velocity) + (obj->segment.z_velocity * obj->segment.z_velocity) + (obj->segment.y_velocity * obj->segment.y_velocity));
|
||||
velocity = sqrtf((obj->segment.x_velocity * obj->segment.x_velocity) +
|
||||
(obj->segment.z_velocity * obj->segment.z_velocity) +
|
||||
(obj->segment.y_velocity * obj->segment.y_velocity));
|
||||
break;
|
||||
}
|
||||
if (velocity > 15.0f) {
|
||||
@@ -653,7 +668,10 @@ void func_80006BFC(Object *obj, ObjectSegment *segment, Object *obj2, s32 update
|
||||
var_f2_2 = -15.0f;
|
||||
}
|
||||
new_var = func_80007FA4(gRacerSound->unk5C[0]) * 1731.23404;
|
||||
gRacerSound->unk68 += (((alCents2Ratio((((70.0f + var_f2_2) / (70.0f - var_f2_2)) * new_var)) - gRacerSound->unk5C[0]) - gRacerSound->unk68) / 2);
|
||||
gRacerSound->unk68 +=
|
||||
(((alCents2Ratio((((70.0f + var_f2_2) / (70.0f - var_f2_2)) * new_var)) - gRacerSound->unk5C[0]) -
|
||||
gRacerSound->unk68) /
|
||||
2);
|
||||
gRacerSound->unk68 *= sp1C;
|
||||
if (gRacerSound->unk68 > 0.8) {
|
||||
gRacerSound->unk68 = 0.8;
|
||||
@@ -665,7 +683,7 @@ void func_80006BFC(Object *obj, ObjectSegment *segment, Object *obj2, s32 update
|
||||
}
|
||||
|
||||
#ifdef NON_EQUIVALENT
|
||||
//https://decomp.me/scratch/utYpK
|
||||
// https://decomp.me/scratch/utYpK
|
||||
void func_80006FC8(Object **objs, s32 numRacers, ObjectSegment *segment, u8 arg3, s32 updateRate) {
|
||||
f32 tempxPos;
|
||||
f32 tempyPos;
|
||||
@@ -692,7 +710,7 @@ void func_80006FC8(Object **objs, s32 numRacers, ObjectSegment *segment, u8 arg3
|
||||
} else {
|
||||
gRacerSound = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (gRacerSound != NULL && gRacerSound->unk0[0] != 0) {
|
||||
if (racer->raceFinished || check_if_showing_cutscene_camera()) {
|
||||
tempxPos = objs[loopCount1]->segment.trans.x_position - segment[loopCount1].trans.x_position;
|
||||
@@ -716,7 +734,8 @@ void func_80006FC8(Object **objs, s32 numRacers, ObjectSegment *segment, u8 arg3
|
||||
gRacerSound->unk91[0] = 64;
|
||||
gRacerSound->unk68 = 0.0f;
|
||||
}
|
||||
if ((gRacerSound->unkA0 < 70) && (gRacerSound->unk36) && (arg3 < 3) && (var_f26 != 0.0) && !(gRacerSound->unk44[0] & 1)) {
|
||||
if ((gRacerSound->unkA0 < 70) && (gRacerSound->unk36) && (arg3 < 3) && (var_f26 != 0.0) &&
|
||||
!(gRacerSound->unk44[0] & 1)) {
|
||||
temp_f20_2 = gRacerSound->unkA0 / 70.0f;
|
||||
temp_s3 = (gRacerSound->unk37 - (gRacerSound->unk37 * temp_f20_2)) * var_f26;
|
||||
if (temp_s3 >= 16) {
|
||||
@@ -726,9 +745,11 @@ void func_80006FC8(Object **objs, s32 numRacers, ObjectSegment *segment, u8 arg3
|
||||
temp_f0_3 = gRacerSound->unk38 / 100.0f;
|
||||
sp8C = temp_f0_3 + ((((f32) gRacerSound->unk39 / 100.0f) - temp_f0_3) * temp_f20_2);
|
||||
if (gRacerSound->unk50 != NULL) {
|
||||
func_80009B7C((s32 *) gRacerSound->unk50, objs[loopCount1]->segment.trans.x_position, objs[loopCount1]->segment.trans.y_position, objs[loopCount1]->segment.trans.z_position);
|
||||
func_80009B7C((s32 *) gRacerSound->unk50, objs[loopCount1]->segment.trans.x_position,
|
||||
objs[loopCount1]->segment.trans.y_position,
|
||||
objs[loopCount1]->segment.trans.z_position);
|
||||
sound_event_update(gRacerSound->unk50, 8, temp_s3 << 8);
|
||||
sound_event_update(gRacerSound->unk50, 16, *((u32*) &sp8C));
|
||||
sound_event_update(gRacerSound->unk50, 16, *((u32 *) &sp8C));
|
||||
func_80004604(gRacerSound->unk50, 80);
|
||||
sound_event_update(gRacerSound->unk50, 4, gRacerSound->unk91[0]);
|
||||
}
|
||||
@@ -741,8 +762,9 @@ void func_80006FC8(Object **objs, s32 numRacers, ObjectSegment *segment, u8 arg3
|
||||
gRacerSound->unk50 = 0;
|
||||
}
|
||||
for (loopCount2 = 0; loopCount2 < 2 && gRacerSound->unk0[loopCount2] != 0 && var_f26 != 0.0; loopCount2++) {
|
||||
temp_s3 = gRacerSound->unk54[loopCount2] * var_f26;
|
||||
sp8C = gRacerSound->unk5C[loopCount2] + gRacerSound->bananaPitch + gRacerSound->enginePitch + gRacerSound->unk68;
|
||||
temp_s3 = gRacerSound->unk54[loopCount2] * var_f26;
|
||||
sp8C = gRacerSound->unk5C[loopCount2] + gRacerSound->bananaPitch + gRacerSound->enginePitch +
|
||||
gRacerSound->unk68;
|
||||
if (sp8C < 0.05) {
|
||||
sp8C = 0.05f;
|
||||
}
|
||||
@@ -760,9 +782,11 @@ void func_80006FC8(Object **objs, s32 numRacers, ObjectSegment *segment, u8 arg3
|
||||
func_80001F14(gRacerSound->unk0[loopCount2], (s32 *) &gRacerSound->unk48[loopCount2]);
|
||||
}
|
||||
if (gRacerSound->unk48[loopCount2] != NULL) {
|
||||
func_80009B7C((s32 *) gRacerSound->unk48[loopCount2], objs[loopCount1]->segment.trans.x_position, objs[loopCount1]->segment.trans.y_position, objs[loopCount1]->segment.trans.z_position);
|
||||
func_80009B7C(
|
||||
(s32 *) gRacerSound->unk48[loopCount2], objs[loopCount1]->segment.trans.x_position,
|
||||
objs[loopCount1]->segment.trans.y_position, objs[loopCount1]->segment.trans.z_position);
|
||||
sound_event_update(gRacerSound->unk48[loopCount2], 8, temp_s3 << 8);
|
||||
sound_event_update(gRacerSound->unk48[loopCount2], 16, *((u32*) &sp8C));
|
||||
sound_event_update(gRacerSound->unk48[loopCount2], 16, *((u32 *) &sp8C));
|
||||
func_80004604(gRacerSound->unk48[loopCount2], 80);
|
||||
if (arg3 != 1) {
|
||||
gRacerSound->unk91[0] = 64;
|
||||
@@ -790,16 +814,23 @@ void func_80006FC8(Object **objs, s32 numRacers, ObjectSegment *segment, u8 arg3
|
||||
if (objs[loopCount2]->unk64 != NULL) {
|
||||
gRacerSound = (VehicleSoundData *) objs[loopCount2]->unk64->racer.cameraYaw;
|
||||
if (gRacerSound != 0) {
|
||||
if (racer->raceFinished != 0) {
|
||||
tempxPos = objs[loopCount2]->segment.trans.x_position - segment[loopCount1].trans.x_position;
|
||||
tempyPos = objs[loopCount2]->segment.trans.y_position - segment[loopCount1].trans.y_position;
|
||||
tempzPos = objs[loopCount2]->segment.trans.z_position - segment[loopCount1].trans.z_position;
|
||||
if (racer->raceFinished != 0) {
|
||||
tempxPos =
|
||||
objs[loopCount2]->segment.trans.x_position - segment[loopCount1].trans.x_position;
|
||||
tempyPos =
|
||||
objs[loopCount2]->segment.trans.y_position - segment[loopCount1].trans.y_position;
|
||||
tempzPos =
|
||||
objs[loopCount2]->segment.trans.z_position - segment[loopCount1].trans.z_position;
|
||||
} else {
|
||||
tempxPos = objs[loopCount2]->segment.trans.x_position - objs[loopCount1]->segment.trans.x_position;
|
||||
tempyPos = objs[loopCount2]->segment.trans.y_position - objs[loopCount1]->segment.trans.y_position;
|
||||
tempzPos = objs[loopCount2]->segment.trans.z_position - objs[loopCount1]->segment.trans.z_position;
|
||||
tempxPos =
|
||||
objs[loopCount2]->segment.trans.x_position - objs[loopCount1]->segment.trans.x_position;
|
||||
tempyPos =
|
||||
objs[loopCount2]->segment.trans.y_position - objs[loopCount1]->segment.trans.y_position;
|
||||
tempzPos =
|
||||
objs[loopCount2]->segment.trans.z_position - objs[loopCount1]->segment.trans.z_position;
|
||||
}
|
||||
gRacerSound->unk84 = sqrtf((tempxPos * tempxPos) + (tempyPos * tempyPos) + (tempzPos * tempzPos));
|
||||
gRacerSound->unk84 =
|
||||
sqrtf((tempxPos * tempxPos) + (tempyPos * tempyPos) + (tempzPos * tempzPos));
|
||||
if (gRacerSound->unk84 < 1500.0f) {
|
||||
var_f26 = 2250000.0f; //(1500.0f * 1500.0f)
|
||||
var_f26 = (var_f26 - (gRacerSound->unk84 * gRacerSound->unk84)) / var_f26;
|
||||
@@ -892,9 +923,10 @@ void func_80006FC8(Object **objs, s32 numRacers, ObjectSegment *segment, u8 arg3
|
||||
func_80001F14(temp->unk0[0], (s32 *) &temp->unk48[0]);
|
||||
}
|
||||
if (temp->unk48[0] != NULL) {
|
||||
func_80009B7C((s32 *) temp->unk48[0], temp->racerPos.x, temp->racerPos.y, temp->racerPos.z);
|
||||
func_80009B7C((s32 *) temp->unk48[0], temp->racerPos.x, temp->racerPos.y,
|
||||
temp->racerPos.z);
|
||||
sound_event_update(temp->unk48[0], 8, temp->unk88 << 8);
|
||||
sound_event_update(temp->unk48[0], 16, *((u32*) &temp->unk8C));
|
||||
sound_event_update(temp->unk48[0], 16, *((u32 *) &temp->unk8C));
|
||||
if (arg3 != 1) {
|
||||
temp->unk91[0] = 64;
|
||||
}
|
||||
@@ -914,21 +946,21 @@ GLOBAL_ASM("asm/non_matchings/audio_vehicle/func_80006FC8.s")
|
||||
|
||||
/**
|
||||
* Enable the vehicle sounds made during gameplay.
|
||||
*/
|
||||
*/
|
||||
UNUSED void sound_vehicle_enable(void) {
|
||||
gVehicleSounds = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the vehicle sounds made during gameplay.
|
||||
*/
|
||||
*/
|
||||
UNUSED void sound_vehicle_disable(void) {
|
||||
gVehicleSounds = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether vehicle sounds should be playing during gameplay.
|
||||
*/
|
||||
*/
|
||||
UNUSED u8 sound_vehicle_check(void) {
|
||||
return gVehicleSounds;
|
||||
}
|
||||
|
||||
+1
-2
@@ -138,8 +138,7 @@ extern SoundMask **gSoundMaskHeapUsed;
|
||||
extern SoundMask **gSoundMaskHeapFree;
|
||||
extern u8 gFreeMasks;
|
||||
|
||||
|
||||
void racer_sound_update(Object* obj, u32 buttonsPressed, u32 carInput, s32 updateRate);
|
||||
void racer_sound_update(Object *obj, u32 buttonsPressed, u32 buttonsHeld, s32 updateRate);
|
||||
void racer_sound_free(Object *);
|
||||
|
||||
f32 func_80007FA4(f32 arg0);
|
||||
|
||||
+123
-131
@@ -14,44 +14,43 @@
|
||||
typedef union {
|
||||
|
||||
struct {
|
||||
short type;
|
||||
short type;
|
||||
} gen;
|
||||
|
||||
struct {
|
||||
short type;
|
||||
struct AudioInfo_s *info;
|
||||
short type;
|
||||
struct AudioInfo_s *info;
|
||||
} done;
|
||||
|
||||
OSScMsg app;
|
||||
OSScMsg app;
|
||||
|
||||
} AudioMsg;
|
||||
|
||||
// TODO: Rare likely modified this struct as evidenced by __amHandleFrameMsg
|
||||
// using *data when it should have been using msg.
|
||||
typedef struct AudioInfo_s {
|
||||
short *data; /* Output data pointer */
|
||||
short frameSamples; /* # of samples synthesized in this frame */
|
||||
OSScTask task; /* scheduler structure */
|
||||
AudioMsg msg; /* completion message */
|
||||
short *data; /* Output data pointer */
|
||||
short frameSamples; /* # of samples synthesized in this frame */
|
||||
OSScTask task; /* scheduler structure */
|
||||
AudioMsg msg; /* completion message */
|
||||
} AudioInfo;
|
||||
|
||||
typedef struct {
|
||||
Acmd *ACMDList[NUM_ACMD_LISTS];
|
||||
AudioInfo *audioInfo[NUM_OUTPUT_BUFFERS];
|
||||
OSThread thread;
|
||||
OSMesgQueue audioFrameMsgQ;
|
||||
OSMesg audioFrameMsgBuf[MAX_MESGS];
|
||||
OSMesgQueue audioReplyMsgQ;
|
||||
OSMesg audioReplyMsgBuf[MAX_MESGS];
|
||||
ALGlobals g;
|
||||
Acmd *ACMDList[NUM_ACMD_LISTS];
|
||||
AudioInfo *audioInfo[NUM_OUTPUT_BUFFERS];
|
||||
OSThread thread;
|
||||
OSMesgQueue audioFrameMsgQ;
|
||||
OSMesg audioFrameMsgBuf[MAX_MESGS];
|
||||
OSMesgQueue audioReplyMsgQ;
|
||||
OSMesg audioReplyMsgBuf[MAX_MESGS];
|
||||
ALGlobals g;
|
||||
} AMAudioMgr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ALLink node;
|
||||
u32 startAddr;
|
||||
u32 lastFrame;
|
||||
char *ptr;
|
||||
typedef struct {
|
||||
ALLink node;
|
||||
u32 startAddr;
|
||||
u32 lastFrame;
|
||||
char *ptr;
|
||||
} AMDMABuffer;
|
||||
|
||||
typedef struct {
|
||||
@@ -60,35 +59,34 @@ typedef struct {
|
||||
AMDMABuffer *firstFree;
|
||||
} AMDMAState;
|
||||
|
||||
|
||||
/**** audio manager globals ****/
|
||||
|
||||
OSSched *gAudioSched;
|
||||
ALHeap *gAudioHeap; // Set but not used
|
||||
|
||||
AMAudioMgr __am;
|
||||
static u64 audioStack[AUDIO_STACKSIZE/sizeof(u64)];
|
||||
AMAudioMgr __am;
|
||||
static u64 audioStack[AUDIO_STACKSIZE / sizeof(u64)];
|
||||
|
||||
AMDMAState dmaState;
|
||||
AMDMABuffer dmaBuffs[NUM_DMA_BUFFERS];
|
||||
u32 audFrameCt = 0;
|
||||
u32 nextDMA = 0;
|
||||
u32 curAcmdList = 0;
|
||||
u32 minFrameSize;
|
||||
u32 frameSize;
|
||||
u32 maxFrameSize;
|
||||
s32 gAudioCmdLen; // Set but not used
|
||||
AMDMAState dmaState;
|
||||
AMDMABuffer dmaBuffs[NUM_DMA_BUFFERS];
|
||||
u32 audFrameCt = 0;
|
||||
u32 nextDMA = 0;
|
||||
u32 curAcmdList = 0;
|
||||
u32 minFrameSize;
|
||||
u32 frameSize;
|
||||
u32 maxFrameSize;
|
||||
s32 gAudioCmdLen; // Set but not used
|
||||
|
||||
/**** Anti Piracy - Sets random audio frequency ****/
|
||||
s16 gAntiPiracyCRCStart;
|
||||
s8 gAntiPiracyAudioFreq = FALSE;
|
||||
s32 gFunc80019808Checksum = 0x35281;
|
||||
s32 gFunc80019808Length = 0xFD0;
|
||||
s16 gAntiPiracyCRCStart;
|
||||
s8 gAntiPiracyAudioFreq = FALSE;
|
||||
s32 gFunc80019808Checksum = 0x35281;
|
||||
s32 gFunc80019808Length = 0xFD0;
|
||||
|
||||
/** Queues and storage for use with audio DMA's ****/
|
||||
OSIoMesg audDMAIOMesgBuf[NUM_DMA_MESSAGES];
|
||||
OSMesgQueue audDMAMessageQ;
|
||||
OSMesg audDMAMessageBuf[NUM_DMA_MESSAGES];
|
||||
OSIoMesg audDMAIOMesgBuf[NUM_DMA_MESSAGES];
|
||||
OSMesgQueue audDMAMessageQ;
|
||||
OSMesg audDMAMessageBuf[NUM_DMA_MESSAGES];
|
||||
|
||||
/**** Not really sure why these are here. They are set, but never used. ****/
|
||||
static s16 *gLastAudioPtr = 0;
|
||||
@@ -98,13 +96,13 @@ static s32 gLastAudioFrameSamples = 0;
|
||||
static void __amMain(UNUSED void *arg);
|
||||
static s32 __amDMA(s32 addr, s32 len, void *state);
|
||||
static ALDMAproc __amDmaNew(AMDMAState **state);
|
||||
static u32 __amHandleFrameMsg(AudioInfo *info, AudioInfo *lastInfo);
|
||||
static u32 __amHandleFrameMsg(AudioInfo *info, AudioInfo *lastInfo);
|
||||
static void __amHandleDoneMsg(AudioInfo *info);
|
||||
static void __clearAudioDMA(void);
|
||||
|
||||
|
||||
/**** Debug strings ****/
|
||||
const char D_800E49F0[] = "audio manager: RCP audio interface bug caused DMA from bad address - move audiomgr.c in the makelist!\n";
|
||||
const char D_800E49F0[] =
|
||||
"audio manager: RCP audio interface bug caused DMA from bad address - move audiomgr.c in the makelist!\n";
|
||||
const char D_800E4A58[] = "audio: ai out of samples\n";
|
||||
const char D_800E4A74[] = "OH DEAR - No audio DMA buffers left\n";
|
||||
const char D_800E4A9C[] = "Dma not done\n";
|
||||
@@ -190,10 +188,11 @@ void amCreateAudioMgr(ALSynConfig *c, OSPri pri, OSSched *audSched) {
|
||||
}
|
||||
|
||||
for (i = 0; i < NUM_ACMD_LISTS; i++) {
|
||||
__am.ACMDList[i] = (Acmd *) alHeapAlloc(c->heap, 1, 0xA000); //sizeof(Acmd) * DMA_BUFFER_LENGTH * 5?
|
||||
__am.ACMDList[i] = (Acmd *) alHeapAlloc(c->heap, 1, 0xA000); // sizeof(Acmd) * DMA_BUFFER_LENGTH * 5?
|
||||
}
|
||||
|
||||
asset = allocate_at_address_in_main_pool((maxFrameSize * 12), (u8 *)(0x803FFE00 - (maxFrameSize * 12)), COLOUR_TAG_CYAN);
|
||||
asset = allocate_at_address_in_main_pool((maxFrameSize * 12), (u8 *) (0x803FFE00 - (maxFrameSize * 12)),
|
||||
COLOUR_TAG_CYAN);
|
||||
|
||||
/**** initialize the done messages ****/
|
||||
for (i = 0; i < NUM_ACMD_LISTS + 1; i++) {
|
||||
@@ -206,13 +205,12 @@ void amCreateAudioMgr(ALSynConfig *c, OSPri pri, OSSched *audSched) {
|
||||
osCreateMesgQueue(&__am.audioFrameMsgQ, __am.audioFrameMsgBuf, MAX_MESGS);
|
||||
osCreateMesgQueue(&audDMAMessageQ, audDMAMessageBuf, NUM_DMA_MESSAGES);
|
||||
|
||||
osCreateThread(&__am.thread, 4, __amMain, 0,
|
||||
(void *)(audioStack+AUDIO_STACKSIZE/sizeof(u64)), pri);
|
||||
osCreateThread(&__am.thread, 4, __amMain, 0, (void *) (audioStack + AUDIO_STACKSIZE / sizeof(u64)), pri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Official Name: amGo
|
||||
*/
|
||||
*/
|
||||
void audioStartThread(void) {
|
||||
osStartThread(&__am.thread);
|
||||
}
|
||||
@@ -249,21 +247,21 @@ static void __amMain(UNUSED void *arg) {
|
||||
while (!done) {
|
||||
(void) osRecvMesg(&__am.audioFrameMsgQ, (OSMesg *) &msg, OS_MESG_BLOCK);
|
||||
switch (msg->gen.type) {
|
||||
case OS_SC_RETRACE_MSG:
|
||||
//TODO: Check type of ACMDList?
|
||||
__amHandleFrameMsg((AudioInfo *) __am.ACMDList[(((u32) audFrameCt % 3))+2], lastInfo);
|
||||
/* wait for done message */
|
||||
osRecvMesg(&__am.audioReplyMsgQ, (OSMesg *) &lastInfo, OS_MESG_BLOCK);
|
||||
__amHandleDoneMsg(lastInfo);
|
||||
break;
|
||||
case OS_SC_PRE_NMI_MSG:
|
||||
/* what should we really do here? quit? ramp down volume? */
|
||||
break;
|
||||
case QUIT_MSG:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case OS_SC_RETRACE_MSG:
|
||||
// TODO: Check type of ACMDList?
|
||||
__amHandleFrameMsg((AudioInfo *) __am.ACMDList[(((u32) audFrameCt % 3)) + 2], lastInfo);
|
||||
/* wait for done message */
|
||||
osRecvMesg(&__am.audioReplyMsgQ, (OSMesg *) &lastInfo, OS_MESG_BLOCK);
|
||||
__amHandleDoneMsg(lastInfo);
|
||||
break;
|
||||
case OS_SC_PRE_NMI_MSG:
|
||||
/* what should we really do here? quit? ramp down volume? */
|
||||
break;
|
||||
case QUIT_MSG:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,13 +270,13 @@ static void __amMain(UNUSED void *arg) {
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* __amHandleFrameMsg. First, clear the past audio dma's, then calculate
|
||||
* __amHandleFrameMsg. First, clear the past audio dma's, then calculate
|
||||
* the number of samples you will need for this frame. This value varies
|
||||
* due to the fact that audio is synchronised off of the video interupt
|
||||
* which can have a small amount of jitter in it. Varying the number of
|
||||
* due to the fact that audio is synchronised off of the video interupt
|
||||
* which can have a small amount of jitter in it. Varying the number of
|
||||
* samples slightly will allow you to stay in synch with the video. This
|
||||
* is an advantageous thing to do, since if you are in synch with the
|
||||
* video, you will have fewer graphics yields. After you've calculated
|
||||
* is an advantageous thing to do, since if you are in synch with the
|
||||
* video, you will have fewer graphics yields. After you've calculated
|
||||
* the number of frames needed, call alAudioFrame, which will call all
|
||||
* of the synthesizer's players (sequence player and sound player) to
|
||||
* generate the audio task list. If you get a valid task list back, put
|
||||
@@ -293,11 +291,10 @@ static u32 __amHandleFrameMsg(AudioInfo *info, AudioInfo *lastInfo) {
|
||||
OSScTask *t;
|
||||
u32 ret;
|
||||
|
||||
|
||||
__clearAudioDMA(); /* call once a frame, before doing alAudioFrame */
|
||||
|
||||
audioPtr = (s16 *) osVirtualToPhysical(info->data);
|
||||
|
||||
|
||||
if (lastInfo) {
|
||||
s16 *outputDataPointer;
|
||||
s32 frameSamples;
|
||||
@@ -312,37 +309,35 @@ static u32 __amHandleFrameMsg(AudioInfo *info, AudioInfo *lastInfo) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* calculate how many samples needed for this frame to keep the DAC full */
|
||||
/* this will vary slightly frame to frame, must recalculate every frame */
|
||||
samplesLeft = osAiGetLength() >> 2; /* divide by four, to convert bytes */
|
||||
/* to stereo 16 bit samples */
|
||||
info->frameSamples = (16 + (frameSize - samplesLeft + EXTRA_SAMPLES)) & ~0xf;
|
||||
if ((u32)info->frameSamples < minFrameSize)
|
||||
if ((u32) info->frameSamples < minFrameSize) {
|
||||
info->frameSamples = minFrameSize;
|
||||
}
|
||||
|
||||
cmdp = alAudioFrame(__am.ACMDList[curAcmdList], &gAudioCmdLen, audioPtr,
|
||||
info->frameSamples);
|
||||
cmdp = alAudioFrame(__am.ACMDList[curAcmdList], &gAudioCmdLen, audioPtr, info->frameSamples);
|
||||
|
||||
t = &info->task;
|
||||
|
||||
t->next = 0; /* paranoia */
|
||||
t->msgQ = &__am.audioReplyMsgQ; /* reply to when finished */
|
||||
//TODO: This should be &info->msg, but the struct is likely modified.
|
||||
t->msg = (OSMesg) &info->data; /* reply with this message */
|
||||
t->flags = OS_SC_NEEDS_RSP;
|
||||
|
||||
t->next = 0; /* paranoia */
|
||||
t->msgQ = &__am.audioReplyMsgQ; /* reply to when finished */
|
||||
// TODO: This should be &info->msg, but the struct is likely modified.
|
||||
t->msg = (OSMesg) &info->data; /* reply with this message */
|
||||
t->flags = OS_SC_NEEDS_RSP;
|
||||
t->unk58 = -1;
|
||||
t->unk60 = 0xFF;
|
||||
t->unk5C = 0;
|
||||
t->unk64 = 0;
|
||||
|
||||
t->list.t.data_ptr = (u64 *) __am.ACMDList[curAcmdList];
|
||||
t->list.t.data_size = (cmdp - __am.ACMDList[curAcmdList]) * sizeof(Acmd);
|
||||
t->list.t.type = M_AUDTASK;
|
||||
t->list.t.ucode_boot = (u64 *)rspF3DDKRBootStart;
|
||||
t->list.t.ucode_boot_size =
|
||||
((int) rspF3DDKRDramStart - (int) rspF3DDKRBootStart);
|
||||
t->list.t.flags = OS_TASK_DP_WAIT;
|
||||
|
||||
t->list.t.data_ptr = (u64 *) __am.ACMDList[curAcmdList];
|
||||
t->list.t.data_size = (cmdp - __am.ACMDList[curAcmdList]) * sizeof(Acmd);
|
||||
t->list.t.type = M_AUDTASK;
|
||||
t->list.t.ucode_boot = (u64 *) rspF3DDKRBootStart;
|
||||
t->list.t.ucode_boot_size = ((int) rspF3DDKRDramStart - (int) rspF3DDKRBootStart);
|
||||
t->list.t.flags = OS_TASK_DP_WAIT;
|
||||
t->list.t.ucode = (u64 *) aspMainTextStart;
|
||||
t->list.t.ucode_data = (u64 *) aspMainDataStart;
|
||||
t->list.t.ucode_data_size = SP_UCODE_DATA_SIZE;
|
||||
@@ -351,9 +346,9 @@ static u32 __amHandleFrameMsg(AudioInfo *info, AudioInfo *lastInfo) {
|
||||
t->unk6C = 1;
|
||||
|
||||
ret = osSendMesg(osScGetCmdQ(gAudioSched), (OSMesg) t, OS_MESG_NOBLOCK);
|
||||
|
||||
curAcmdList ^= 1; /* swap which acmd list you use each frame */
|
||||
|
||||
|
||||
curAcmdList ^= 1; /* swap which acmd list you use each frame */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -364,12 +359,12 @@ static u32 __amHandleFrameMsg(AudioInfo *info, AudioInfo *lastInfo) {
|
||||
*
|
||||
*****************************************************************************/
|
||||
static void __amHandleDoneMsg(UNUSED AudioInfo *info) {
|
||||
s32 samplesLeft;
|
||||
s32 samplesLeft;
|
||||
static int firstTime = 1;
|
||||
|
||||
samplesLeft = osAiGetLength()>>2;
|
||||
samplesLeft = osAiGetLength() >> 2;
|
||||
if (samplesLeft == 0 && !firstTime) {
|
||||
//stubbed_printf("audio: ai out of samples\n");
|
||||
// stubbed_printf("audio: ai out of samples\n");
|
||||
firstTime = 0;
|
||||
}
|
||||
}
|
||||
@@ -389,31 +384,31 @@ static void __amHandleDoneMsg(UNUSED AudioInfo *info) {
|
||||
*
|
||||
*****************************************************************************/
|
||||
static s32 __amDMA(s32 addr, s32 len, UNUSED void *state) {
|
||||
void *foundBuffer;
|
||||
s32 delta, addrEnd, buffEnd;
|
||||
AMDMABuffer *dmaPtr, *lastDmaPtr;
|
||||
void *foundBuffer;
|
||||
s32 delta, addrEnd, buffEnd;
|
||||
AMDMABuffer *dmaPtr, *lastDmaPtr;
|
||||
UNUSED s32 pad;
|
||||
|
||||
lastDmaPtr = 0;
|
||||
delta = addr & 1;
|
||||
dmaPtr = dmaState.firstUsed;
|
||||
addrEnd = addr+len;
|
||||
addrEnd = addr + len;
|
||||
|
||||
/* first check to see if a currently existing buffer contains the
|
||||
sample that you need. */
|
||||
|
||||
while (dmaPtr) {
|
||||
buffEnd = dmaPtr->startAddr + DMA_BUFFER_LENGTH;
|
||||
if(dmaPtr->startAddr > (u32)addr) /* since buffers are ordered */
|
||||
break; /* abort if past possible */
|
||||
if (dmaPtr->startAddr > (u32) addr) { /* since buffers are ordered */
|
||||
break; /* abort if past possible */
|
||||
|
||||
else if(addrEnd <= buffEnd) { /* yes, found a buffer with samples */
|
||||
} else if (addrEnd <= buffEnd) { /* yes, found a buffer with samples */
|
||||
dmaPtr->lastFrame = audFrameCt; /* mark it used */
|
||||
foundBuffer = dmaPtr->ptr + addr - dmaPtr->startAddr;
|
||||
return (int) osVirtualToPhysical(foundBuffer);
|
||||
}
|
||||
lastDmaPtr = dmaPtr;
|
||||
dmaPtr = (AMDMABuffer * )dmaPtr->node.next;
|
||||
dmaPtr = (AMDMABuffer *) dmaPtr->node.next;
|
||||
}
|
||||
|
||||
/* get here, and you didn't find a buffer, so dma a new one */
|
||||
@@ -430,7 +425,7 @@ static s32 __amDMA(s32 addr, s32 len, UNUSED void *state) {
|
||||
* pointer, it's better than nothing
|
||||
*/
|
||||
if (!dmaPtr) {
|
||||
return (int) osVirtualToPhysical(lastDmaPtr->ptr) + delta;
|
||||
return (int) osVirtualToPhysical(lastDmaPtr->ptr) + delta;
|
||||
}
|
||||
|
||||
dmaState.firstFree = (AMDMABuffer *) dmaPtr->node.next;
|
||||
@@ -438,18 +433,16 @@ static s32 __amDMA(s32 addr, s32 len, UNUSED void *state) {
|
||||
|
||||
/* add it to the used list */
|
||||
if (lastDmaPtr) { /* if you have other dmabuffers used, add this one */
|
||||
/* to the list, after the last one checked above */
|
||||
/* to the list, after the last one checked above */
|
||||
alLink((ALLink *) dmaPtr, (ALLink *) lastDmaPtr);
|
||||
}
|
||||
else if (dmaState.firstUsed) { /* if this buffer is before any others */
|
||||
/* jam at begining of list */
|
||||
} else if (dmaState.firstUsed) { /* if this buffer is before any others */
|
||||
/* jam at begining of list */
|
||||
lastDmaPtr = dmaState.firstUsed;
|
||||
dmaState.firstUsed = dmaPtr;
|
||||
dmaPtr->node.next = (ALLink *) lastDmaPtr;
|
||||
dmaPtr->node.prev = 0;
|
||||
lastDmaPtr->node.prev = (ALLink *) dmaPtr;
|
||||
}
|
||||
else { /* no buffers in list, this is the first one */
|
||||
} else { /* no buffers in list, this is the first one */
|
||||
dmaState.firstUsed = dmaPtr;
|
||||
dmaPtr->node.next = 0;
|
||||
dmaPtr->node.prev = 0;
|
||||
@@ -458,10 +451,10 @@ static s32 __amDMA(s32 addr, s32 len, UNUSED void *state) {
|
||||
foundBuffer = dmaPtr->ptr;
|
||||
addr -= delta;
|
||||
dmaPtr->startAddr = addr;
|
||||
dmaPtr->lastFrame = audFrameCt; /* mark it */
|
||||
dmaPtr->lastFrame = audFrameCt; /* mark it */
|
||||
|
||||
osPiStartDma(&audDMAIOMesgBuf[nextDMA++], OS_MESG_PRI_HIGH, OS_READ,
|
||||
addr, foundBuffer, DMA_BUFFER_LENGTH, &audDMAMessageQ);
|
||||
osPiStartDma(&audDMAIOMesgBuf[nextDMA++], OS_MESG_PRI_HIGH, OS_READ, addr, foundBuffer, DMA_BUFFER_LENGTH,
|
||||
&audDMAMessageQ);
|
||||
|
||||
return (int) osVirtualToPhysical(foundBuffer) + delta;
|
||||
}
|
||||
@@ -479,13 +472,13 @@ static s32 __amDMA(s32 addr, s32 len, UNUSED void *state) {
|
||||
*****************************************************************************/
|
||||
static ALDMAproc __amDmaNew(AMDMAState **state) {
|
||||
|
||||
if(!dmaState.initialized) { /* only do this once */
|
||||
if (!dmaState.initialized) { /* only do this once */
|
||||
dmaState.firstUsed = 0;
|
||||
dmaState.firstFree = &dmaBuffs[0];
|
||||
dmaState.initialized = 1;
|
||||
}
|
||||
|
||||
*state = &dmaState; /* state is never used in this case */
|
||||
*state = &dmaState; /* state is never used in this case */
|
||||
|
||||
return __amDMA;
|
||||
}
|
||||
@@ -495,42 +488,41 @@ static ALDMAproc __amDmaNew(AMDMAState **state) {
|
||||
* __clearAudioDMA. Routine to move dma buffers back to the unused list.
|
||||
* First clear out your dma messageQ. Then check each buffer to see when
|
||||
* it was last used. If that was more than FRAME_LAG frames ago, move it
|
||||
* back to the unused list.
|
||||
* back to the unused list.
|
||||
*
|
||||
*****************************************************************************/
|
||||
static void __clearAudioDMA(void) {
|
||||
u32 i;
|
||||
OSIoMesg *iomsg = 0;
|
||||
AMDMABuffer *dmaPtr,*nextPtr;
|
||||
|
||||
u32 i;
|
||||
OSIoMesg *iomsg = 0;
|
||||
AMDMABuffer *dmaPtr, *nextPtr;
|
||||
|
||||
/*
|
||||
* Don't block here. If dma's aren't complete, you've had an audio
|
||||
* overrun. (Bad news, but go for it anyway, and try and recover.
|
||||
*/
|
||||
for (i = 0; i < nextDMA; i++) {
|
||||
if (osRecvMesg(&audDMAMessageQ, (OSMesg *) &iomsg, OS_MESG_NOBLOCK) == -1)
|
||||
{ /* stubbed_printf("Dma not done\n"); */ }
|
||||
if (osRecvMesg(&audDMAMessageQ, (OSMesg *) &iomsg, OS_MESG_NOBLOCK) ==
|
||||
-1) { /* stubbed_printf("Dma not done\n"); */
|
||||
}
|
||||
// if (logging)
|
||||
// osLogEvent(log, 17, 2, iomsg->devAddr, iomsg->size);
|
||||
}
|
||||
|
||||
|
||||
dmaPtr = dmaState.firstUsed;
|
||||
while(dmaPtr) {
|
||||
while (dmaPtr) {
|
||||
nextPtr = (AMDMABuffer *) dmaPtr->node.next;
|
||||
|
||||
/* remove old dma's from list */
|
||||
/* Can change FRAME_LAG value. Should be at least one. */
|
||||
/* Larger values mean more buffers needed, but fewer DMA's */
|
||||
if(dmaPtr->lastFrame + FRAME_LAG < audFrameCt) {
|
||||
if(dmaState.firstUsed == dmaPtr) {
|
||||
if (dmaPtr->lastFrame + FRAME_LAG < audFrameCt) {
|
||||
if (dmaState.firstUsed == dmaPtr) {
|
||||
dmaState.firstUsed = (AMDMABuffer *) dmaPtr->node.next;
|
||||
}
|
||||
alUnlink((ALLink *) dmaPtr);
|
||||
if(dmaState.firstFree) {
|
||||
if (dmaState.firstFree) {
|
||||
alLink((ALLink *) dmaPtr, (ALLink *) dmaState.firstFree);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dmaState.firstFree = dmaPtr;
|
||||
dmaPtr->node.next = 0;
|
||||
dmaPtr->node.prev = 0;
|
||||
@@ -538,7 +530,7 @@ static void __clearAudioDMA(void) {
|
||||
}
|
||||
dmaPtr = nextPtr;
|
||||
}
|
||||
|
||||
nextDMA = 0; /* reset */
|
||||
|
||||
nextDMA = 0; /* reset */
|
||||
audFrameCt++;
|
||||
}
|
||||
|
||||
+32
-29
@@ -11,7 +11,7 @@
|
||||
#include "PR/libaudio.h"
|
||||
|
||||
ALSoundState *D_800DC6B0 = NULL;
|
||||
s32 D_800DC6B4 = 0; // Currently unknown, might be a different type.
|
||||
s32 D_800DC6B4 = 0; // Currently unknown, might be a different type.
|
||||
unk800DC6BC_40 *D_800DC6B8 = NULL; // Set but not used.
|
||||
unk800DC6BC gAlSndPlayer;
|
||||
unk800DC6BC *gAlSndPlayerPtr = &gAlSndPlayer;
|
||||
@@ -46,7 +46,7 @@ void set_sound_channel_count(s32 numChannels) {
|
||||
|
||||
/**
|
||||
* Initialise a sound player and ready it for use with the sound event system.
|
||||
*/
|
||||
*/
|
||||
void alSndPNew(audioMgrConfig *c) {
|
||||
u32 i;
|
||||
unk800DC6BC_40 *tmp1;
|
||||
@@ -58,9 +58,8 @@ void alSndPNew(audioMgrConfig *c) {
|
||||
gAlSndPlayerPtr->soundChannelsMax = c->maxChannels;
|
||||
gAlSndPlayerPtr->soundChannels = c->maxChannels;
|
||||
gAlSndPlayerPtr->unk3C = 0;
|
||||
gAlSndPlayerPtr->frameTime = 33000; //AL_USEC_PER_FRAME /* time between API events */
|
||||
gAlSndPlayerPtr->unk40 = (unk800DC6BC_40 *) alHeapAlloc(c->hp, 1,
|
||||
c->unk00 * sizeof(unk800DC6BC_40));
|
||||
gAlSndPlayerPtr->frameTime = 33000; // AL_USEC_PER_FRAME /* time between API events */
|
||||
gAlSndPlayerPtr->unk40 = (unk800DC6BC_40 *) alHeapAlloc(c->hp, 1, c->unk00 * sizeof(unk800DC6BC_40));
|
||||
alEvtqNew(&(gAlSndPlayerPtr->evtq), alHeapAlloc(c->hp, 1, (c->unk04) * 28), c->unk04);
|
||||
D_800DC6B8 = gAlSndPlayerPtr->unk40;
|
||||
for (i = 1; i < c->unk00; i++) {
|
||||
@@ -131,36 +130,37 @@ void func_8000418C(ALVoiceState *voiceState) {
|
||||
ALEvent_unk8000418C evt;
|
||||
f32 sp1C;
|
||||
|
||||
sp1C = alCents2Ratio(((ALLink_unk8000418C*)voiceState->voice.node.prev->prev)->unk5) * voiceState->vibrato;
|
||||
sp1C = alCents2Ratio(((ALLink_unk8000418C *) voiceState->voice.node.prev->prev)->unk5) * voiceState->vibrato;
|
||||
evt.type = AL_SEQP_STOP_EVT;
|
||||
evt.unk4 = voiceState;
|
||||
evt.unk8 = *((s32*)&sp1C); // But why tho?
|
||||
evt.unk8 = *((s32 *) &sp1C); // But why tho?
|
||||
alEvtqPostEvent(&gAlSndPlayerPtr->evtq, (ALEvent *) &evt, 33333);
|
||||
}
|
||||
|
||||
static void _removeEvents(ALEventQueue *evtq, ALSoundState *state, u16 eventType) {
|
||||
ALLink *thisNode;
|
||||
ALLink *nextNode;
|
||||
ALEventListItem *thisItem;
|
||||
ALEventListItem *nextItem;
|
||||
ALSndpEvent *thisEvent;
|
||||
OSIntMask mask;
|
||||
ALLink *thisNode;
|
||||
ALLink *nextNode;
|
||||
ALEventListItem *thisItem;
|
||||
ALEventListItem *nextItem;
|
||||
ALSndpEvent *thisEvent;
|
||||
OSIntMask mask;
|
||||
|
||||
mask = osSetIntMask(OS_IM_NONE);
|
||||
|
||||
thisNode = evtq->allocList.next;
|
||||
while( thisNode != 0 ) {
|
||||
nextNode = thisNode->next;
|
||||
while (thisNode != 0) {
|
||||
nextNode = thisNode->next;
|
||||
thisItem = (ALEventListItem *) thisNode;
|
||||
nextItem = (ALEventListItem *) nextNode;
|
||||
thisEvent = (ALSndpEvent *) &thisItem->evt;
|
||||
if (thisEvent->common.state == state && (u16)thisEvent->msg.type & eventType){
|
||||
if( nextItem )
|
||||
if (thisEvent->common.state == state && (u16) thisEvent->msg.type & eventType) {
|
||||
if (nextItem) {
|
||||
nextItem->delta += thisItem->delta;
|
||||
}
|
||||
alUnlink(thisNode);
|
||||
alLink(thisNode, &evtq->freeList);
|
||||
}
|
||||
thisNode = nextNode;
|
||||
thisNode = nextNode;
|
||||
}
|
||||
|
||||
osSetIntMask(mask);
|
||||
@@ -206,13 +206,15 @@ GLOBAL_ASM("asm/non_matchings/audiosfx/func_80004384.s")
|
||||
GLOBAL_ASM("asm/non_matchings/audiosfx/func_80004520.s")
|
||||
|
||||
void func_80004604(u8 *arg0, u8 arg1) {
|
||||
if (arg0)
|
||||
if (arg0) {
|
||||
arg0[0x36] = arg1;
|
||||
}
|
||||
}
|
||||
|
||||
UNUSED u8 func_8000461C(u8 *arg0) {
|
||||
if (arg0)
|
||||
if (arg0) {
|
||||
return arg0[0x3F];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -227,13 +229,13 @@ s32 func_80004668(ALBank *bnk, s16 sndIndx, u8 arg2, SoundMask *soundMask) {
|
||||
GLOBAL_ASM("asm/non_matchings/audiosfx/func_80004668.s")
|
||||
#endif
|
||||
|
||||
//input typing not right (some type of struct)
|
||||
// 99% sure this function will clear the audio buffer associated with a given sound mask.
|
||||
// input typing not right (some type of struct)
|
||||
// 99% sure this function will clear the audio buffer associated with a given sound mask.
|
||||
void func_8000488C(u8 *arg0) {
|
||||
ALEvent sp_18;
|
||||
sp_18.type = 1024;
|
||||
//((u32 *)(&sp_18))[1] = (u32)arg0;
|
||||
sp_18.msg.osc.vs = (ALVoiceState *) arg0; //Not really a voice state, but not sure what else it is.
|
||||
sp_18.msg.osc.vs = (ALVoiceState *) arg0; // Not really a voice state, but not sure what else it is.
|
||||
if (arg0) {
|
||||
arg0[0x3e] &= ~(1 << 4);
|
||||
alEvtqPostEvent(&(gAlSndPlayerPtr->evtq), &sp_18, 0);
|
||||
@@ -269,14 +271,14 @@ UNUSED void func_800049B8(void) {
|
||||
|
||||
/**
|
||||
* Stops all sounds from playing.
|
||||
*/
|
||||
*/
|
||||
void sound_stop_all(void) {
|
||||
func_800048D8(AL_SNDP_PLAY_EVT | AL_SNDP_STOP_EVT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to the sound player to update an existing property of the sound entry.
|
||||
*/
|
||||
*/
|
||||
void sound_event_update(s32 soundMask, s16 type, u32 volume) {
|
||||
ALEvent2 sndEvt;
|
||||
sndEvt.snd_event.type = type;
|
||||
@@ -290,16 +292,17 @@ void sound_event_update(s32 soundMask, s16 type, u32 volume) {
|
||||
/**
|
||||
* Returns the volume level of the channel ID.
|
||||
* Official Name: gsSndpGetMasterVolume
|
||||
*/
|
||||
*/
|
||||
u16 get_sound_channel_volume(u8 channel) {
|
||||
return gSoundChannelVolume[channel];
|
||||
}
|
||||
|
||||
//TODO: The structs used here are almost definitely wrong, but they do match, so it can at least show the pattern we're looking for.
|
||||
// TODO: The structs used here are almost definitely wrong, but they do match, so it can at least show the pattern we're
|
||||
// looking for.
|
||||
/**
|
||||
* Looks for the intended audio channel in the main buffer and adjusts its volume
|
||||
* Official Name: gsSndpSetMasterVolume
|
||||
*/
|
||||
*/
|
||||
void set_sound_channel_volume(u8 channel, u16 volume) {
|
||||
OSIntMask mask;
|
||||
ALEventQueue *queue;
|
||||
@@ -311,7 +314,7 @@ void set_sound_channel_volume(u8 channel, u16 volume) {
|
||||
gSoundChannelVolume[channel] = volume;
|
||||
|
||||
while (queue != NULL) {
|
||||
//This is almost definitely the wrong struct list, but it matches so I'm not going to complain
|
||||
// This is almost definitely the wrong struct list, but it matches so I'm not going to complain
|
||||
if ((((ALInstrument *) queue->allocList.next->prev)->priority & 0x3F) == channel) {
|
||||
evt.type = AL_SNDP_UNK_11_EVT;
|
||||
evt.msg.spseq.seq = (void *) queue;
|
||||
|
||||
+4
-3
@@ -26,7 +26,7 @@ void render_borders_for_multiplayer(Gfx **dlist) {
|
||||
width = GET_VIDEO_WIDTH(widthAndHeight);
|
||||
height = GET_VIDEO_HEIGHT(widthAndHeight);
|
||||
xOffset = width / 256;
|
||||
width += 0; //Fake match?
|
||||
width += 0; // Fake match?
|
||||
yOffset = height / 128;
|
||||
gDPSetCycleType((*dlist)++, G_CYC_FILL);
|
||||
gDPSetFillColor((*dlist)++, GPACK_RGBA5551(0, 0, 0, 1) << 16 | GPACK_RGBA5551(0, 0, 0, 1)); // Black fill color
|
||||
@@ -46,7 +46,8 @@ void render_borders_for_multiplayer(Gfx **dlist) {
|
||||
case VIEWPORTS_COUNT_4_PLAYERS:
|
||||
x = (width >> 1) - xOffset;
|
||||
// Draws 2 black lines in the middle of the screen. One vertical, another horizontal.
|
||||
gDPFillRectangle((*dlist)++, height * 0, (height >> 1) - yOffset, width, ((height >> 1) - yOffset) + yOffset);
|
||||
gDPFillRectangle((*dlist)++, height * 0, (height >> 1) - yOffset, width,
|
||||
((height >> 1) - yOffset) + yOffset);
|
||||
gDPFillRectangle((*dlist)++, x, 0, x + xOffset, height);
|
||||
break;
|
||||
}
|
||||
@@ -75,7 +76,7 @@ void render_second_multiplayer_borders(Gfx **dlist) {
|
||||
gDPSetCombineMode((*dlist)++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
|
||||
gDPSetRenderMode((*dlist)++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
|
||||
gDPSetPrimColor((*dlist)++, 0, 0, 0, 0, 0, 0);
|
||||
switch(get_viewport_count()) {
|
||||
switch (get_viewport_count()) {
|
||||
case VIEWPORTS_COUNT_2_PLAYERS:
|
||||
tempY = (screenHeight / 2) - (height / 2);
|
||||
gDPFillRectangle((*dlist)++, 0, tempY, screenWidth, tempY + height);
|
||||
|
||||
+236
-186
File diff suppressed because it is too large
Load Diff
+14
-14
@@ -79,8 +79,8 @@ typedef struct unk80068514_arg4 {
|
||||
Gfx *unk8[1];
|
||||
} unk80068514_arg4;
|
||||
|
||||
void func_80066060(s32 arg0, s32 arg1);
|
||||
void set_viewport_tv_type(s8 arg0);
|
||||
void func_80066060(s32 cameraID, s32 zoomLevel);
|
||||
void set_viewport_tv_type(s8 setting);
|
||||
void func_800660C0(void);
|
||||
void func_800660D0(void);
|
||||
UNUSED f32 get_current_camera_fov(void);
|
||||
@@ -88,28 +88,28 @@ void update_camera_fov(f32 camFieldOfView);
|
||||
Matrix *matrix_get_model_s16(void);
|
||||
s32 get_viewport_count(void);
|
||||
s32 get_current_viewport(void);
|
||||
void camera_init_tracks_menu(Gfx **dlist, MatrixS **arg1);
|
||||
void camera_init_tracks_menu(Gfx **dList, MatrixS **mtxS);
|
||||
f32 get_distance_to_active_camera(f32 xPos, f32 yPos, f32 zPos);
|
||||
void camera_reset(s32 xPos, s32 yPos, s32 zPos, s32 arg3, s32 arg4, s32 arg5);
|
||||
void write_to_object_render_stack(s32 arg0, f32 xPos, f32 yPos, f32 zPos, s16 arg4, s16 arg5, s16 arg6);
|
||||
void camera_reset(s32 xPos, s32 yPos, s32 zPos, s32 angleZ, s32 angleX, s32 angleY);
|
||||
void write_to_object_render_stack(s32 stackPos, f32 xPos, f32 yPos, f32 zPos, s16 arg4, s16 arg5, s16 arg6);
|
||||
void disable_cutscene_camera(void);
|
||||
s8 check_if_showing_cutscene_camera(void);
|
||||
s32 set_active_viewports_and_max(s32 num);
|
||||
void set_active_camera(s32 arg0);
|
||||
void set_active_camera(s32 num);
|
||||
void camEnableUserView(s32 viewPortIndex, s32 arg1);
|
||||
void camDisableUserView(s32 viewPortIndex, s32 arg1);
|
||||
s32 check_viewport_background_flag(s32 viewPortIndex);
|
||||
void viewport_menu_set(s32 viewPortIndex, s32 x1, s32 y1, s32 x2, s32 y2);
|
||||
void set_viewport_properties(s32 viewPortIndex, s32 x1, s32 x2, s32 y1, s32 y2);
|
||||
void set_viewport_properties(s32 viewPortIndex, s32 posX, s32 posY, s32 width, s32 height);
|
||||
s32 copy_viewport_background_size_to_coords(s32 viewPortIndex, s32 *x1, s32 *y1, s32 *x2, s32 *y2);
|
||||
void copy_viewport_frame_size_to_coords(s32 viewPortIndex, s32 *x1, s32 *y1, s32 *x2, s32 *y2);
|
||||
void copy_framebuffer_size_to_coords(s32 *x1, s32 *y1, s32 *x2, s32 *y2);
|
||||
void set_ortho_matrix_height(f32 value);
|
||||
void set_ortho_matrix_view(Gfx **dlist, MatrixS **mats);
|
||||
void func_8006807C(Gfx **dlist, MatrixS **mats);
|
||||
void viewport_rsp_set(Gfx **dlist, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
|
||||
void set_ortho_matrix_view(Gfx **dlist, MatrixS **mtx);
|
||||
void func_8006807C(Gfx **dlist, MatrixS **mtx);
|
||||
void viewport_rsp_set(Gfx **dlist, s32 width, s32 height, s32 posX, s32 posY);
|
||||
void viewport_reset(Gfx **dlist);
|
||||
void matrix_world_origin(Gfx **dlist, MatrixS **mats);
|
||||
void matrix_world_origin(Gfx **dlist, MatrixS **mtx);
|
||||
void func_80068508(s32 bool);
|
||||
ObjectSegment *get_active_camera_segment_no_cutscenes(void);
|
||||
ObjectSegment *get_active_camera_segment(void);
|
||||
@@ -123,12 +123,12 @@ void set_camera_shake(f32 magnitude);
|
||||
void func_80067D3C(Gfx **dlist, MatrixS **mats);
|
||||
void render_ortho_triangle_image(Gfx **dList, MatrixS **mtx, Vertex **vtx, ObjectSegment *segment, Sprite *sprite, s32 flags);
|
||||
s32 render_sprite_billboard(Gfx **dlist, MatrixS **mtx, Vertex **vertexList, Object *obj, unk80068514_arg4 *arg4, s32 flags);
|
||||
void camera_push_model_mtx(Gfx **arg0, MatrixS **arg1, ObjectTransform *arg2, f32 scale, f32 scaleY);
|
||||
void camera_push_model_mtx(Gfx **dList, MatrixS **mtx, ObjectTransform *trans, f32 scale, f32 scaleY);
|
||||
void viewport_scissor(Gfx **dlist);
|
||||
void apply_matrix_from_stack(Gfx **dlist);
|
||||
void copy_viewports_to_stack(void);
|
||||
void apply_head_turning_matrix(Gfx **dlist, MatrixS **mtx, Object_68 *obj68, s16 headAngle);
|
||||
void apply_object_shear_matrix(Gfx **dlist, MatrixS **mtx, Object *arg2, Object *arg3, f32 shear);
|
||||
void apply_head_turning_matrix(Gfx **dlist, MatrixS **mtx, Object_68 *objGfx, s16 headAngle);
|
||||
void apply_object_shear_matrix(Gfx **dList, MatrixS **mtx, Object *arg2, Object *arg3, f32 shear);
|
||||
|
||||
// Non Matching
|
||||
void camera_init(void);
|
||||
|
||||
+35
-24
@@ -15,42 +15,51 @@ GLOBAL_ASM("asm/collision/func_80031130.s")
|
||||
|
||||
// Might be segment related.
|
||||
#ifdef NON_EQUIVALENT
|
||||
s32 func_800314DC(LevelModelSegmentBoundingBox *a0, s32 a1, s32 a2, s32 a3, s32 t5) {
|
||||
s32 func_800314DC(LevelModelSegmentBoundingBox *segment, s32 x1, s32 z1, s32 x2, s32 z2) {
|
||||
s32 v0 = 0;
|
||||
s32 v1;
|
||||
s32 t0, t1, t2, t3, t4;
|
||||
|
||||
if (a0 == NULL)
|
||||
if (segment == NULL) {
|
||||
return v0;
|
||||
}
|
||||
|
||||
t0 = a0->x1;
|
||||
t1 = a0->z1;
|
||||
t2 = a0->x2;
|
||||
t3 = a0->z2;
|
||||
t0 = segment->x1;
|
||||
t1 = segment->z1;
|
||||
t2 = segment->x2;
|
||||
t3 = segment->z2;
|
||||
|
||||
if (a3 < t0)
|
||||
a3 = t0;
|
||||
if (x2 < t0) {
|
||||
x2 = t0;
|
||||
}
|
||||
|
||||
if (a1 < t0)
|
||||
a1 = t0;
|
||||
if (x1 < t0) {
|
||||
x1 = t0;
|
||||
}
|
||||
|
||||
if (t5 < t1)
|
||||
t5 = t1;
|
||||
if (z2 < t1) {
|
||||
z2 = t1;
|
||||
}
|
||||
|
||||
if (a2 < t1)
|
||||
a2 = t1;
|
||||
if (z1 < t1) {
|
||||
z1 = t1;
|
||||
}
|
||||
|
||||
if (t2 < a3)
|
||||
a3 = t2;
|
||||
if (t2 < x2) {
|
||||
x2 = t2;
|
||||
}
|
||||
|
||||
if (t2 < a1)
|
||||
a1 = t2;
|
||||
if (t2 < x1) {
|
||||
x1 = t2;
|
||||
}
|
||||
|
||||
if (t3 < t5)
|
||||
t5 = t3;
|
||||
if (t3 < z2) {
|
||||
z2 = t3;
|
||||
}
|
||||
|
||||
if (t3 < a2)
|
||||
a2 = t3;
|
||||
if (t3 < z1) {
|
||||
z1 = t3;
|
||||
}
|
||||
|
||||
v1 = 1;
|
||||
|
||||
@@ -58,8 +67,9 @@ s32 func_800314DC(LevelModelSegmentBoundingBox *a0, s32 a1, s32 a2, s32 a3, s32
|
||||
t4 = t2 + t0;
|
||||
|
||||
while (v1 < (1 << 8)) {
|
||||
if (t4 >= a1 && a3 >= t0)
|
||||
if (t4 >= x1 && x2 >= t0) {
|
||||
v0 |= v1;
|
||||
}
|
||||
|
||||
v1 <<= 1;
|
||||
t4 += t2;
|
||||
@@ -70,8 +80,9 @@ s32 func_800314DC(LevelModelSegmentBoundingBox *a0, s32 a1, s32 a2, s32 a3, s32
|
||||
t4 = t2 + t1;
|
||||
|
||||
while (v1 < (1 << 16)) {
|
||||
if (t4 >= a2 && t5 >= t1)
|
||||
if (t4 >= z1 && z2 >= t1) {
|
||||
v0 |= v1;
|
||||
}
|
||||
|
||||
v1 <<= 1;
|
||||
t4 += t2;
|
||||
|
||||
+13
-7
@@ -4,8 +4,9 @@
|
||||
#include "controller.h"
|
||||
#include "game.h"
|
||||
|
||||
s32 sNoControllerPluggedIn = FALSE; // Looks to be a boolean for whether a controller is plugged in. FALSE if plugged in, and TRUE if not.
|
||||
u16 gButtonMask = 0xFFFF; //Used when anti-cheat/anti-tamper has failed in init_level_globals()
|
||||
s32 sNoControllerPluggedIn =
|
||||
FALSE; // Looks to be a boolean for whether a controller is plugged in. FALSE if plugged in, and TRUE if not.
|
||||
u16 gButtonMask = 0xFFFF; // Used when anti-cheat/anti-tamper has failed in init_level_globals()
|
||||
|
||||
OSMesgQueue sSIMesgQueue;
|
||||
OSMesg sSIMesgBuf;
|
||||
@@ -65,7 +66,7 @@ s32 handle_save_data_and_read_controller(s32 saveDataFlags, s32 updateRate) {
|
||||
s32 i;
|
||||
|
||||
if (osRecvMesg(&sSIMesgQueue, &unusedMsg, OS_MESG_NOBLOCK) == 0) {
|
||||
//Back up old controller data
|
||||
// Back up old controller data
|
||||
for (i = 0; i < MAXCONTROLLERS; i++) {
|
||||
gControllerPrevData[i] = gControllerCurrData[i];
|
||||
}
|
||||
@@ -101,7 +102,7 @@ s32 handle_save_data_and_read_controller(s32 saveDataFlags, s32 updateRate) {
|
||||
if (saveDataFlags & SAVE_DATA_FLAG_WRITE_EEPROM_SETTINGS) {
|
||||
write_eeprom_settings(get_eeprom_settings_pointer());
|
||||
}
|
||||
//Reset all flags
|
||||
// Reset all flags
|
||||
saveDataFlags = 0;
|
||||
}
|
||||
rumble_controllers(updateRate);
|
||||
@@ -111,9 +112,14 @@ s32 handle_save_data_and_read_controller(s32 saveDataFlags, s32 updateRate) {
|
||||
if (sNoControllerPluggedIn) {
|
||||
gControllerCurrData[i].button = 0;
|
||||
}
|
||||
//XOR the diff between the last read of the controller data with the current read to see what buttons have been pushed and released.
|
||||
gControllerButtonsPressed[i] = ((gControllerCurrData[i].button ^ gControllerPrevData[i].button) & gControllerCurrData[i].button) & gButtonMask;
|
||||
gControllerButtonsReleased[i] = ((gControllerCurrData[i].button ^ gControllerPrevData[i].button) & gControllerPrevData[i].button) & gButtonMask;
|
||||
// XOR the diff between the last read of the controller data with the current read to see what buttons have been
|
||||
// pushed and released.
|
||||
gControllerButtonsPressed[i] =
|
||||
((gControllerCurrData[i].button ^ gControllerPrevData[i].button) & gControllerCurrData[i].button) &
|
||||
gButtonMask;
|
||||
gControllerButtonsReleased[i] =
|
||||
((gControllerCurrData[i].button ^ gControllerPrevData[i].button) & gControllerPrevData[i].button) &
|
||||
gButtonMask;
|
||||
}
|
||||
return saveDataFlags;
|
||||
}
|
||||
|
||||
+131
-159
File diff suppressed because it is too large
Load Diff
@@ -65,7 +65,8 @@ void process_transition_disabled(s32 updateRate);
|
||||
s32 transition_begin(FadeTransition *transition);
|
||||
void render_fade_circle(Gfx **dList, MatrixS **mats, Vertex **verts);
|
||||
void process_transition_shape(s32 updateRate);
|
||||
void init_transition_shape(FadeTransition *transition, s32 numVerts, s32 numTris, s16 *arg3, u8 *arg4, u8 *arg5, u8 *arg6, u8 *arg7, u8 *arg8);
|
||||
void init_transition_shape(FadeTransition *transition, s32 numVerts, s32 numTris, s16 *coords, u8 *nextPos,
|
||||
u8 *targetPos, u8 *nextAlpha, u8 *targetAlpha, u8 *vertIndices);
|
||||
void func_800C1EE8(s32 updateRate);
|
||||
void render_fade_waves(Gfx **dlist, UNUSED MatrixS **mats, UNUSED Vertex **verts);
|
||||
|
||||
|
||||
+34
-23
@@ -39,9 +39,10 @@ s32 gDescPowsOf10[9] = {
|
||||
// The dialogue box will draw in pieces, using properties from each line. It starts with a box
|
||||
// and goes inwards or outwards depending on the direction, set by the define.
|
||||
|
||||
#define INWARDS 0
|
||||
#define INWARDS 0
|
||||
#define OUTWARDS 1
|
||||
|
||||
// clang-format off
|
||||
s8 sDialogueBoxDimensions[48] = {
|
||||
/*X Offset*/ 4, INWARDS, /*Y Start*/ 0, INWARDS, /*Y end*/ 1,
|
||||
/*X Offset*/ 2, INWARDS, /*Y Start*/ 1, INWARDS, /*Y end*/ 2,
|
||||
@@ -53,6 +54,7 @@ s8 sDialogueBoxDimensions[48] = {
|
||||
/*X Offset*/ -1, 0, 0, 0, 0, // End of Data
|
||||
/*X Offset*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
#undef INWARDS
|
||||
#undef OUTWARDS
|
||||
@@ -66,10 +68,11 @@ OSDevMgr __osPiDevMgr = {
|
||||
/************ .bss ************/
|
||||
|
||||
s32 gNumberOfFonts;
|
||||
FontData *gFonts; //Official Name: Font
|
||||
DialogueBoxBackground *gDialogueBoxBackground; //Official Name: Window
|
||||
DialogueTextElement *gDialogueText; //Official Name: String
|
||||
s32 gCompactKerning; // Official Name: squash - Boolean value, seems to be related to X placement of menus on the X Axis?
|
||||
FontData *gFonts; // Official Name: Font
|
||||
DialogueBoxBackground *gDialogueBoxBackground; // Official Name: Window
|
||||
DialogueTextElement *gDialogueText; // Official Name: String
|
||||
s32 gCompactKerning; // Official Name: squash - Boolean value, seems to be related to X placement of menus on the X
|
||||
// Axis?
|
||||
s8 sDialogueBoxCloseTimer;
|
||||
|
||||
/******************************/
|
||||
@@ -144,7 +147,7 @@ void load_fonts(void) {
|
||||
/**
|
||||
* Sets text kerning to true or false.
|
||||
* If false, text displayed will be monospaced.
|
||||
*/
|
||||
*/
|
||||
void set_kerning(s32 setting) {
|
||||
gCompactKerning = setting;
|
||||
}
|
||||
@@ -152,7 +155,7 @@ void set_kerning(s32 setting) {
|
||||
/**
|
||||
* Load the texture assets of the given font into RAM.
|
||||
* This is required before any text using this font can be displayed in a scene.
|
||||
*/
|
||||
*/
|
||||
void load_font(s32 fontID) {
|
||||
if (fontID < gNumberOfFonts) {
|
||||
FontData *fontData = &gFonts[fontID];
|
||||
@@ -170,7 +173,7 @@ void load_font(s32 fontID) {
|
||||
/**
|
||||
* Free a font's assets from RAM.
|
||||
* Highly recommended to do for any existing font when unloading a scene to prevent leaks.
|
||||
*/
|
||||
*/
|
||||
void unload_font(s32 fontID) {
|
||||
if (fontID < gNumberOfFonts) {
|
||||
FontData *fontData = &gFonts[fontID];
|
||||
@@ -274,7 +277,8 @@ UNUSED void draw_dialogue_text_unused(Gfx **displayList, s32 dialogueBoxID, char
|
||||
* Unused text draw function that would draw text in the current dialogue box while overriding position.
|
||||
* Official Name: fontPrintWindowXY
|
||||
*/
|
||||
UNUSED void draw_dialogue_text_pos_unused(Gfx **displayList, s32 dialogueBoxID, s32 xpos, s32 ypos, char *text, AlignmentFlags alignmentFlags) {
|
||||
UNUSED void draw_dialogue_text_pos_unused(Gfx **displayList, s32 dialogueBoxID, s32 xpos, s32 ypos, char *text,
|
||||
AlignmentFlags alignmentFlags) {
|
||||
if (dialogueBoxID >= 0 && dialogueBoxID < DIALOGUEBOXBACKGROUND_COUNT) {
|
||||
DialogueBoxBackground *temp = &gDialogueBoxBackground[dialogueBoxID];
|
||||
temp->xpos = (xpos == POS_CENTRED) ? temp->width >> 1 : xpos;
|
||||
@@ -287,7 +291,8 @@ UNUSED void draw_dialogue_text_pos_unused(Gfx **displayList, s32 dialogueBoxID,
|
||||
* Loops through a string, then draws each character onscreen.
|
||||
* Will also draw a fillrect if text backgrounds are enabled.
|
||||
*/
|
||||
void render_text_string(Gfx **dList, DialogueBoxBackground *box, char *text, AlignmentFlags alignmentFlags, f32 scisScale) {
|
||||
void render_text_string(Gfx **dList, DialogueBoxBackground *box, char *text, AlignmentFlags alignmentFlags,
|
||||
f32 scisScale) {
|
||||
s32 scisOffset;
|
||||
s32 scisPos;
|
||||
s32 ypos;
|
||||
@@ -356,8 +361,7 @@ void render_text_string(Gfx **dList, DialogueBoxBackground *box, char *text, Ali
|
||||
gDPPipeSync((*dList)++);
|
||||
xpos += box->textOffsetX;
|
||||
ypos += box->textOffsetY;
|
||||
for (charIndex = 0; (text[charIndex] != '\0') && (box->y2 >= ypos);
|
||||
xpos += charSpace, charIndex++) {
|
||||
for (charIndex = 0; (text[charIndex] != '\0') && (box->y2 >= ypos); xpos += charSpace, charIndex++) {
|
||||
curChar = text[charIndex];
|
||||
newData = FALSE;
|
||||
charSpace = 0;
|
||||
@@ -399,8 +403,7 @@ void render_text_string(Gfx **dList, DialogueBoxBackground *box, char *text, Ali
|
||||
textureT = fontData->letter[curChar].t;
|
||||
xAlignmentDiff = fontData->letter[curChar].lrx;
|
||||
yAlignmentDiff = fontData->letter[curChar].lry;
|
||||
charSpace =
|
||||
(fontData->x == 0) ? (fontData->letter[curChar].ulx) : (fontData->x);
|
||||
charSpace = (fontData->x == 0) ? (fontData->letter[curChar].ulx) : (fontData->x);
|
||||
newData = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -419,7 +422,8 @@ void render_text_string(Gfx **dList, DialogueBoxBackground *box, char *text, Ali
|
||||
textureT += -textureUly * 8;
|
||||
textureUly = 0;
|
||||
}
|
||||
gSPTextureRectangle((*dList)++, textureUlx, textureUly, textureLrx, newTempY, 0, textureS, textureT, 1 << 10, 1 << 10);
|
||||
gSPTextureRectangle((*dList)++, textureUlx, textureUly, textureLrx, newTempY, 0, textureS, textureT,
|
||||
1 << 10, 1 << 10);
|
||||
if (lastTextureIndex) {} // Fakematch
|
||||
}
|
||||
if (gCompactKerning && charSpace) {
|
||||
@@ -808,7 +812,7 @@ UNUSED void enable_dialogue_box_vertices(s32 dialogueBoxID) {
|
||||
|
||||
/**
|
||||
* Clears the open flag from the dialogue box.
|
||||
*/
|
||||
*/
|
||||
void clear_dialogue_box_open_flag(s32 dialogueBoxID) {
|
||||
gDialogueBoxBackground[dialogueBoxID].flags &= (DIALOGUE_BOX_VERTS + DIALOGUE_BOX_CLOSED);
|
||||
}
|
||||
@@ -925,12 +929,17 @@ void render_dialogue_box(Gfx **dlist, MatrixS **mat, Vertex **verts, s32 dialogu
|
||||
gDkrDmaDisplayList((*dlist)++, OS_K0_TO_PHYSICAL(&dDialogueBoxDrawModes[1]), 2);
|
||||
gDPSetEnvColor((*dlist)++, 0, 0, 0, 0);
|
||||
if (dialogueBox->x2 - dialogueBox->x1 < 10 || dialogueBox->y2 - dialogueBox->y1 < 10) {
|
||||
render_fill_rectangle(dlist, dialogueBox->x1 - 2, dialogueBox->y1 - 2, dialogueBox->x2 + 2, dialogueBox->y2 + 2);
|
||||
render_fill_rectangle(dlist, dialogueBox->x1 - 2, dialogueBox->y1 - 2, dialogueBox->x2 + 2,
|
||||
dialogueBox->y2 + 2);
|
||||
} else {
|
||||
render_fill_rectangle(dlist, dialogueBox->x1 - 2, dialogueBox->y1 + 2, dialogueBox->x1 + 2, dialogueBox->y2 - 2);
|
||||
render_fill_rectangle(dlist, dialogueBox->x1 - 2, dialogueBox->y1 - 2, dialogueBox->x2 + 2, dialogueBox->y1 + 2);
|
||||
render_fill_rectangle(dlist, dialogueBox->x2 - 2, dialogueBox->y1 + 2, dialogueBox->x2 + 2, dialogueBox->y2 - 2);
|
||||
render_fill_rectangle(dlist, dialogueBox->x1 - 2, dialogueBox->y2 - 2, dialogueBox->x2 + 2, dialogueBox->y2 + 2);
|
||||
render_fill_rectangle(dlist, dialogueBox->x1 - 2, dialogueBox->y1 + 2, dialogueBox->x1 + 2,
|
||||
dialogueBox->y2 - 2);
|
||||
render_fill_rectangle(dlist, dialogueBox->x1 - 2, dialogueBox->y1 - 2, dialogueBox->x2 + 2,
|
||||
dialogueBox->y1 + 2);
|
||||
render_fill_rectangle(dlist, dialogueBox->x2 - 2, dialogueBox->y1 + 2, dialogueBox->x2 + 2,
|
||||
dialogueBox->y2 - 2);
|
||||
render_fill_rectangle(dlist, dialogueBox->x1 - 2, dialogueBox->y2 - 2, dialogueBox->x2 + 2,
|
||||
dialogueBox->y2 + 2);
|
||||
}
|
||||
gDPPipeSync((*dlist)++);
|
||||
gDPSetEnvColor((*dlist)++, dialogueBox->backgroundColourR, dialogueBox->backgroundColourG,
|
||||
@@ -939,9 +948,11 @@ void render_dialogue_box(Gfx **dlist, MatrixS **mat, Vertex **verts, s32 dialogu
|
||||
// The array determines the width and height of each entry before drawing it.
|
||||
for (i = 0; sDialogueBoxDimensions[i] >= 0; i += 5) {
|
||||
x1 = sDialogueBoxDimensions[i] + dialogueBox->x1;
|
||||
y1 = (sDialogueBoxDimensions[i + 1]) ? sDialogueBoxDimensions[i + 2] + dialogueBox->y2 : sDialogueBoxDimensions[i + 2] + dialogueBox->y1;
|
||||
y1 = (sDialogueBoxDimensions[i + 1]) ? sDialogueBoxDimensions[i + 2] + dialogueBox->y2
|
||||
: sDialogueBoxDimensions[i + 2] + dialogueBox->y1;
|
||||
x2 = dialogueBox->x2 - sDialogueBoxDimensions[i];
|
||||
y2 = (sDialogueBoxDimensions[i + 3]) ? sDialogueBoxDimensions[i + 4] + dialogueBox->y2 : sDialogueBoxDimensions[i + 4] + dialogueBox->y1;
|
||||
y2 = (sDialogueBoxDimensions[i + 3]) ? sDialogueBoxDimensions[i + 4] + dialogueBox->y2
|
||||
: sDialogueBoxDimensions[i + 4] + dialogueBox->y1;
|
||||
render_fill_rectangle(dlist, x1, y1, x2, y2);
|
||||
}
|
||||
gDPPipeSync((*dlist)++);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user