All Changes
This commit is contained in:
committed by
Banjo Kazooie
parent
fd208f77ca
commit
c2dd933d22
@@ -18,7 +18,7 @@ extern u8 soundfont2tbl_ROM_START[];
|
||||
|
||||
/* dependent functions */
|
||||
void func_8024FA98(u8, enum comusic_e);
|
||||
void func_8024FD28(u8, s16);
|
||||
void musicTrack_setVolume(u8, s16);
|
||||
int func_80250074(u8);
|
||||
u8 func_8025F4A0(ALCSPlayer *, u8);
|
||||
|
||||
@@ -27,182 +27,182 @@ u16 func_80250474(s32 arg0);
|
||||
void func_8024FB8C(void);
|
||||
|
||||
/* .data */
|
||||
MusicTrackMeta D_80275D40[0xB0] = {
|
||||
{"Blank", 15000},
|
||||
{"Scrap", 15000},
|
||||
{"Jungle 2", 20000},
|
||||
{"Snow 2", 20000},
|
||||
{"Bells", 21000},
|
||||
{"Beach", 20000},
|
||||
{"Swamp", 15000},
|
||||
{"Crab Cave", 20000},
|
||||
{"Title", 15000},
|
||||
{"Notes", 15000},
|
||||
{"Jinjo", 15000},
|
||||
{"Feather", 15000},
|
||||
{"Egg", 15000},
|
||||
{"Jigpiece", 28000},
|
||||
{"Sky", 0x7FFF},
|
||||
{"Spooky", 21000},
|
||||
{"Training", 15000},
|
||||
{"Lighthouse", 24000},
|
||||
{"Crab", 15000},
|
||||
{"Shell", 0x7FFF},
|
||||
{"Feather Inv", 15000},
|
||||
{"Extra life", 15000},
|
||||
{"Honeycomb", 15000},
|
||||
{"Empty honey piece", 15000},
|
||||
{"Extra honey", 15000},
|
||||
{"Mystery", 15000},
|
||||
{"You lose", 20000},
|
||||
{"Termite nest", 0x7FFF},
|
||||
{"Outside whale", 15000},
|
||||
{"Spell", 15000},
|
||||
{"Witch House", 23000},
|
||||
{"In whale", 0x4650},
|
||||
{"Desert", 20000},
|
||||
{"In spooky", 0x4650},
|
||||
{"Grave", 24000},
|
||||
{"Church", 28000},
|
||||
{"Sphinx", 20000},
|
||||
{"Invulnerabilty", 28000},
|
||||
{"Collapse", 15000},
|
||||
{"Snake", 15000},
|
||||
{"Sandcastle", 15000},
|
||||
{"Summer", 20000},
|
||||
{"Winter", 0x6978},
|
||||
{"Right", 28000},
|
||||
{"Wrong", 0x7D00},
|
||||
{"Achieve", 0x7D00},
|
||||
{"Autumn", 0x55F0},
|
||||
{"Default forest", 0x7530},
|
||||
{"5 Jinjos", 15000},
|
||||
{"Game over", 15000},
|
||||
{"Nintendo", 15000},
|
||||
{"Ship", 24000},
|
||||
{"Shark", 15000},
|
||||
{"Ship inside", 24000},
|
||||
{"100 Notes", 15000},
|
||||
{"Door Open", 15000},
|
||||
{"Organ sequence", 0x4650},
|
||||
{"Advent", 15000},
|
||||
{"Slalom", 15000},
|
||||
{"Race win", 15000},
|
||||
{"Race lose", 15000},
|
||||
{"Jigsaw magic", 15000},
|
||||
{"Oh dear", 15000},
|
||||
{"Up", 15000},
|
||||
{"Down", 15000},
|
||||
{"Shamen Hut", 0x4A38},
|
||||
{"Jig 10", 0x61A8},
|
||||
{"Carpet", 15000},
|
||||
{"Squirrel", 15000},
|
||||
{"Hornet", 15000},
|
||||
{"Treetop", 0x7D00},
|
||||
{"Turtle Shell", 0x61A8},
|
||||
{"House Summer", 15000},
|
||||
{"House Autumn", 15000},
|
||||
{"Out Buildings", 15000},
|
||||
{"Hornet 2", 15000},
|
||||
{"Cabins", 15000},
|
||||
{"Rain", 15000},
|
||||
{"Jigsaw Open", 15000},
|
||||
{"Jigsaw Close", 15000},
|
||||
{"Witch 1", 23000},
|
||||
{"Witch 2", 23000},
|
||||
{"Witch 3", 23000},
|
||||
{"Witch 4", 23000},
|
||||
{"Witch 5", 23000},
|
||||
{"Mr Vile", 15000},
|
||||
{"Bridge", 0x55F0},
|
||||
{"Turbo Talon Trot", 28000},
|
||||
{"Long legs", 28000},
|
||||
{"Witch 6", 23000},
|
||||
{"Boggy sad", 15000},
|
||||
{"Boggy happy", 15000},
|
||||
{"Quit", 15000},
|
||||
{"Witch 7", 23000},
|
||||
{"Witch 8", 23000},
|
||||
{"Spring", 0x4650},
|
||||
{"Squirrel attic", 0x6590},
|
||||
{"Lights", 15000},
|
||||
{"Box", 0x4268},
|
||||
{"Witch 9", 23000},
|
||||
{"Open up", 15000},
|
||||
{"Puzzle complete", 0x61A8},
|
||||
{"Xmas tree", 15000},
|
||||
{"Puzzle in", 15000},
|
||||
{"Lite tune", 15000},
|
||||
{"Open extra", 15000},
|
||||
{"Ouija", 0x7148},
|
||||
{"Wozza", 15000},
|
||||
{"Intro", 20000},
|
||||
{"Gnawty", 15000},
|
||||
{"Banjo's Pad", 15000},
|
||||
{"Pause", 15000},
|
||||
{"Cesspit", 0x61A8},
|
||||
{"Quiz", 15000},
|
||||
{"Frog", 20000},
|
||||
{"GameBoy", 15000},
|
||||
{"Lair", 15000},
|
||||
{"Red Extra", 0x7D00},
|
||||
{"Gold Extra", 0x7D00},
|
||||
{"Egg Extra", 0x7D00},
|
||||
{"Note door", 15000},
|
||||
{"Cheaty", 15000},
|
||||
{"Fairy", 20000},
|
||||
{"Skull", 0x61A8},
|
||||
{"Square Grunty", 0x61A8},
|
||||
{"Square Banjo", 0x61A8},
|
||||
{"Square Joker", 0x7530},
|
||||
{"Square Music", 0x61A8},
|
||||
{"Lab", 20000},
|
||||
{"Fade Up", 0x61A8},
|
||||
{"Puzzle Out", 15000},
|
||||
{"Secret Gobi", 20000},
|
||||
{"Secret Beach", 20000},
|
||||
{"Secret Ice", 20000},
|
||||
{"Secret Spooky", 20000},
|
||||
{"Secret Squirrel", 20000},
|
||||
{"Secret Egg", 20000},
|
||||
{"Jinjup", 0x7D00},
|
||||
{"Turbo Talon Trot short", 28000},
|
||||
{"Fade Down", 0x61A8},
|
||||
{"Big Jinjo", 0x7D00},
|
||||
{"T1000", 15000},
|
||||
{"Credits", 15000},
|
||||
{"T1000x", 20000},
|
||||
{"Big Door", 20000},
|
||||
{"Descent", 20000},
|
||||
{"Wind up", 20000},
|
||||
{"Air", 20000},
|
||||
{"Do jig", 20000},
|
||||
{"Picture", 28000},
|
||||
{"Piece up", 20000},
|
||||
{"Piece down", 20000},
|
||||
{"Spin", 20000},
|
||||
{"BarBQ", 15000},
|
||||
{"Chord1", 20000},
|
||||
{"Chord2", 20000},
|
||||
{"Chord3", 20000},
|
||||
{"Chord4", 20000},
|
||||
{"Chord5", 20000},
|
||||
{"Chord6", 20000},
|
||||
{"Chord7", 20000},
|
||||
{"Chord8", 20000},
|
||||
{"Chord9", 20000},
|
||||
{"Chord10", 20000},
|
||||
{"Shock1", 20000},
|
||||
{"Shock2", 20000},
|
||||
{"Shock3", 20000},
|
||||
{"Shock4", 20000},
|
||||
{"Sad grunt", 20000},
|
||||
{"Podium", 20000},
|
||||
{"Endbit", 20000},
|
||||
{"Rock", 20000},
|
||||
{"Last Bit", 20000},
|
||||
{"Unnamed piece", 15000},
|
||||
{"Unnamed piece", 15000},
|
||||
MusicTrackMeta musicTrackInfo[0xB0] = {
|
||||
{ "Blank", 15000 },
|
||||
{ "Scrap", 15000 },
|
||||
{ "Jungle 2", 20000 },
|
||||
{ "Snow 2", 20000 },
|
||||
{ "Bells", 21000 },
|
||||
{ "Beach", 20000 },
|
||||
{ "Swamp", 15000 },
|
||||
{ "Crab Cave", 20000 },
|
||||
{ "Title", 15000 },
|
||||
{ "Notes", 15000 },
|
||||
{ "Jinjo", 15000 },
|
||||
{ "Feather", 15000 },
|
||||
{ "Egg", 15000 },
|
||||
{ "Jigpiece", 28000 },
|
||||
{ "Sky", 0x7FFF },
|
||||
{ "Spooky", 21000 },
|
||||
{ "Training", 15000 },
|
||||
{ "Lighthouse", 24000 },
|
||||
{ "Crab", 15000 },
|
||||
{ "Shell", 0x7FFF },
|
||||
{ "Feather Inv", 15000 },
|
||||
{ "Extra life", 15000 },
|
||||
{ "Honeycomb", 15000 },
|
||||
{ "Empty honey piece", 15000 },
|
||||
{ "Extra honey", 15000 },
|
||||
{ "Mystery", 15000 },
|
||||
{ "You lose", 20000 },
|
||||
{ "Termite nest", 0x7FFF },
|
||||
{ "Outside whale", 15000 },
|
||||
{ "Spell", 15000 },
|
||||
{ "Witch House", 23000 },
|
||||
{ "In whale", 0x4650 },
|
||||
{ "Desert", 20000 },
|
||||
{ "In spooky", 0x4650 },
|
||||
{ "Grave", 24000 },
|
||||
{ "Church", 28000 },
|
||||
{ "Sphinx", 20000 },
|
||||
{ "Invulnerabilty", 28000 },
|
||||
{ "Collapse", 15000 },
|
||||
{ "Snake", 15000 },
|
||||
{ "Sandcastle", 15000 },
|
||||
{ "Summer", 20000 },
|
||||
{ "Winter", 0x6978 },
|
||||
{ "Right", 28000 },
|
||||
{ "Wrong", 0x7D00 },
|
||||
{ "Achieve", 0x7D00 },
|
||||
{ "Autumn", 0x55F0 },
|
||||
{ "Default forest", 0x7530 },
|
||||
{ "5 Jinjos", 15000 },
|
||||
{ "Game over", 15000 },
|
||||
{ "Nintendo", 15000 },
|
||||
{ "Ship", 24000 },
|
||||
{ "Shark", 15000 },
|
||||
{ "Ship inside", 24000 },
|
||||
{ "100 Notes", 15000 },
|
||||
{ "Door Open", 15000 },
|
||||
{ "Organ sequence", 0x4650 },
|
||||
{ "Advent", 15000 },
|
||||
{ "Slalom", 15000 },
|
||||
{ "Race win", 15000 },
|
||||
{ "Race lose", 15000 },
|
||||
{ "Jigsaw magic", 15000 },
|
||||
{ "Oh dear", 15000 },
|
||||
{ "Up", 15000 },
|
||||
{ "Down", 15000 },
|
||||
{ "Shamen Hut", 0x4A38 },
|
||||
{ "Jig 10", 0x61A8 },
|
||||
{ "Carpet", 15000 },
|
||||
{ "Squirrel", 15000 },
|
||||
{ "Hornet", 15000 },
|
||||
{ "Treetop", 0x7D00 },
|
||||
{ "Turtle Shell", 0x61A8 },
|
||||
{ "House Summer", 15000 },
|
||||
{ "House Autumn", 15000 },
|
||||
{ "Out Buildings", 15000 },
|
||||
{ "Hornet 2", 15000 },
|
||||
{ "Cabins", 15000 },
|
||||
{ "Rain", 15000 },
|
||||
{ "Jigsaw Open", 15000 },
|
||||
{ "Jigsaw Close", 15000 },
|
||||
{ "Witch 1", 23000 },
|
||||
{ "Witch 2", 23000 },
|
||||
{ "Witch 3", 23000 },
|
||||
{ "Witch 4", 23000 },
|
||||
{ "Witch 5", 23000 },
|
||||
{ "Mr Vile", 15000 },
|
||||
{ "Bridge", 0x55F0 },
|
||||
{ "Turbo Talon Trot", 28000 },
|
||||
{ "Long legs", 28000 },
|
||||
{ "Witch 6", 23000 },
|
||||
{ "Boggy sad", 15000 },
|
||||
{ "Boggy happy", 15000 },
|
||||
{ "Quit", 15000 },
|
||||
{ "Witch 7", 23000 },
|
||||
{ "Witch 8", 23000 },
|
||||
{ "Spring", 0x4650 },
|
||||
{ "Squirrel attic", 0x6590 },
|
||||
{ "Lights", 15000 },
|
||||
{ "Box", 0x4268 },
|
||||
{ "Witch 9", 23000 },
|
||||
{ "Open up", 15000 },
|
||||
{ "Puzzle complete", 0x61A8 },
|
||||
{ "Xmas tree", 15000 },
|
||||
{ "Puzzle in", 15000 },
|
||||
{ "Lite tune", 15000 },
|
||||
{ "Open extra", 15000 },
|
||||
{ "Ouija", 0x7148 },
|
||||
{ "Wozza", 15000 },
|
||||
{ "Intro", 20000 },
|
||||
{ "Gnawty", 15000 },
|
||||
{ "Banjo's Pad", 15000 },
|
||||
{ "Pause", 15000 },
|
||||
{ "Cesspit", 0x61A8 },
|
||||
{ "Quiz", 15000 },
|
||||
{ "Frog", 20000 },
|
||||
{ "GameBoy", 15000 },
|
||||
{ "Lair", 15000 },
|
||||
{ "Red Extra", 0x7D00 },
|
||||
{ "Gold Extra", 0x7D00 },
|
||||
{ "Egg Extra", 0x7D00 },
|
||||
{ "Note door", 15000 },
|
||||
{ "Cheaty", 15000 },
|
||||
{ "Fairy", 20000 },
|
||||
{ "Skull", 0x61A8 },
|
||||
{ "Square Grunty", 0x61A8 },
|
||||
{ "Square Banjo", 0x61A8 },
|
||||
{ "Square Joker", 0x7530 },
|
||||
{ "Square Music", 0x61A8 },
|
||||
{ "Lab", 20000 },
|
||||
{ "Fade Up", 0x61A8 },
|
||||
{ "Puzzle Out", 15000 },
|
||||
{ "Secret Gobi", 20000 },
|
||||
{ "Secret Beach", 20000 },
|
||||
{ "Secret Ice", 20000 },
|
||||
{ "Secret Spooky", 20000 },
|
||||
{ "Secret Squirrel", 20000 },
|
||||
{ "Secret Egg", 20000 },
|
||||
{ "Jinjup", 0x7D00 },
|
||||
{ "Turbo Talon Trot short", 28000 },
|
||||
{ "Fade Down", 0x61A8 },
|
||||
{ "Big Jinjo", 0x7D00 },
|
||||
{ "T1000", 15000 },
|
||||
{ "Credits", 15000 },
|
||||
{ "T1000x", 20000 },
|
||||
{ "Big Door", 20000 },
|
||||
{ "Descent", 20000 },
|
||||
{ "Wind up", 20000 },
|
||||
{ "Air", 20000 },
|
||||
{ "Do jig", 20000 },
|
||||
{ "Picture", 28000 },
|
||||
{ "Piece up", 20000 },
|
||||
{ "Piece down", 20000 },
|
||||
{ "Spin", 20000 },
|
||||
{ "BarBQ", 15000 },
|
||||
{ "Chord1", 20000 },
|
||||
{ "Chord2", 20000 },
|
||||
{ "Chord3", 20000 },
|
||||
{ "Chord4", 20000 },
|
||||
{ "Chord5", 20000 },
|
||||
{ "Chord6", 20000 },
|
||||
{ "Chord7", 20000 },
|
||||
{ "Chord8", 20000 },
|
||||
{ "Chord9", 20000 },
|
||||
{ "Chord10", 20000 },
|
||||
{ "Shock1", 20000 },
|
||||
{ "Shock2", 20000 },
|
||||
{ "Shock3", 20000 },
|
||||
{ "Shock4", 20000 },
|
||||
{ "Sad grunt", 20000 },
|
||||
{ "Podium", 20000 },
|
||||
{ "Endbit", 20000 },
|
||||
{ "Rock", 20000 },
|
||||
{ "Last Bit", 20000 },
|
||||
{ "Unnamed piece", 15000 },
|
||||
{ "Unnamed piece", 15000 },
|
||||
0
|
||||
};
|
||||
s32 D_802762C0 = 0;
|
||||
@@ -382,7 +382,7 @@ void func_8024FC1C(u8 arg0, enum comusic_e arg1){
|
||||
D_80281720[arg0].index_cpy = arg1;
|
||||
D_80281720[arg0].unk2 = 1;
|
||||
D_80281720[arg0].unk3 = 0;
|
||||
D_80281720[arg0].unk0 = D_80275D40[arg1].unk4;
|
||||
D_80281720[arg0].unk0 = musicTrackInfo[arg1].volume;
|
||||
}
|
||||
|
||||
void func_8024FC6C(u8 arg0){
|
||||
@@ -408,15 +408,16 @@ void func_8024FCE0(u8 arg0, s16 arg1){
|
||||
}
|
||||
|
||||
//musicTrack_setVolume
|
||||
void func_8024FD28(u8 arg0, s16 arg1){
|
||||
void musicTrack_setVolume(u8 arg0, s16 arg1) {
|
||||
D_80281720[arg0].unk0 = arg1;
|
||||
alCSPSetVol(&D_80281720[arg0].cseqp, arg1);
|
||||
if(D_80281720[arg0].unk3 && arg1){
|
||||
|
||||
if (D_80281720[arg0].unk3 && arg1) {
|
||||
func_8024FCE0(arg0, arg1);
|
||||
}
|
||||
else if(!D_80281720[arg0].unk3 && arg1 == 0){
|
||||
if(func_80250074(arg0) == 0)
|
||||
} else if (!D_80281720[arg0].unk3 && arg1 == 0) {
|
||||
if (func_80250074(arg0) == 0) {
|
||||
func_8024FC6C(arg0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,7 +469,7 @@ void func_8024FF34(void){
|
||||
}
|
||||
D_80281720[i].unk3 = 0;
|
||||
D_80281720[i].unk2 = 0;
|
||||
func_8024FD28(i, D_80281720[i].unk0);
|
||||
musicTrack_setVolume(i, D_80281720[i].unk0);
|
||||
}
|
||||
break;
|
||||
case AL_STOPPING: //L80250008
|
||||
@@ -477,17 +478,16 @@ void func_8024FF34(void){
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_80250034(enum comusic_e track_id){
|
||||
return D_80275D40[track_id].unk4;
|
||||
s32 gcMusic_getDefaultVolumeForTrack(enum comusic_e track_id) {
|
||||
return musicTrackInfo[track_id].volume;
|
||||
}
|
||||
|
||||
void func_80250048(enum comusic_e track_id, u16 arg1){
|
||||
D_80275D40[track_id].unk4 = arg1;
|
||||
void gcMusic_setDefaultVolumeForTrack(enum comusic_e track_id, u16 volume) {
|
||||
musicTrackInfo[track_id].volume = volume;
|
||||
}
|
||||
|
||||
//song_getName
|
||||
char *func_80250060(enum comusic_e track_id){
|
||||
return D_80275D40[track_id].name;
|
||||
char *gcMusic_getNameForTrack(enum comusic_e track_id) {
|
||||
return musicTrackInfo[track_id].name;
|
||||
}
|
||||
|
||||
int func_80250074(u8 arg0){
|
||||
|
@@ -1,639 +0,0 @@
|
||||
#include <ultra64.h>
|
||||
#include "core1/core1.h"
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
#include "version.h"
|
||||
|
||||
extern func_8024FDDC(u8, s32);
|
||||
|
||||
void func_8025AE50(s32, f32);
|
||||
|
||||
bool func_80250074(u8);
|
||||
void func_8024FD28(u8, s32);
|
||||
void func_8024FC1C(u8, s32);
|
||||
void func_8025AC20(enum comusic_e, s32, s32, f32, char*, s32);
|
||||
void func_8025AC7C(enum comusic_e, s32, s32, f32, s32 *, char*, s32);
|
||||
void comusicPlayer_free(void);
|
||||
void func_8025A55C(s32, s32, s32);
|
||||
void func_8025A7DC(enum comusic_e);
|
||||
void func_8025ABB8(enum comusic_e, s32, s32, s32);
|
||||
void *freelist_next(FLA **, s32*);
|
||||
|
||||
/* .bss */
|
||||
CoMusic *D_80276E30 = NULL; //active track ptr
|
||||
int D_80276E34 = 0;
|
||||
|
||||
/* .code */
|
||||
/**
|
||||
* @brief returns a pointer to the CoMusic struct with the corresponding track_id
|
||||
* if it exists OR the first free CoMusic struct.
|
||||
*
|
||||
* @param track_id
|
||||
* @return CoMusic*
|
||||
*/
|
||||
CoMusic *__find_track(enum comusic_e track_id) {
|
||||
CoMusic *iMusPtr;
|
||||
CoMusic *freeSlotPtr;
|
||||
|
||||
freeSlotPtr = NULL;
|
||||
for(iMusPtr = D_80276E30 + 1; iMusPtr < D_80276E30 + 5; iMusPtr++) {
|
||||
if (track_id == iMusPtr->track_id) {
|
||||
return iMusPtr;
|
||||
}
|
||||
if (freeSlotPtr == 0) {
|
||||
if ((s32) iMusPtr->track_id < 0) {
|
||||
freeSlotPtr = iMusPtr;
|
||||
}
|
||||
}
|
||||
}
|
||||
return freeSlotPtr;
|
||||
}
|
||||
|
||||
void func_80259914(CoMusic *this, s32 arg1, s32 arg2){
|
||||
s32 sp2C;
|
||||
s32 i;
|
||||
struct12s *tmp;
|
||||
|
||||
freelist_clear(this->unk18);
|
||||
for(i = 0; i < 0xE; i++){
|
||||
this->unk1C[i] = 0;
|
||||
}
|
||||
tmp = (struct12s *)freelist_next(&this->unk18, &sp2C);
|
||||
tmp->unk0 = arg1;
|
||||
tmp->unk1 = arg2;
|
||||
}
|
||||
|
||||
void func_80259994(CoMusic *this, s32 arg1){
|
||||
func_80259914(this, arg1, arg1);
|
||||
}
|
||||
|
||||
void func_802599B4(CoMusic *this){
|
||||
func_80259994(this, func_80250034(this->track_id));
|
||||
this->track_id = -1;
|
||||
this->unk14 = 0;
|
||||
this->unk15 = 0;
|
||||
func_8024FC1C(this - D_80276E30, -1);
|
||||
}
|
||||
|
||||
void comusicPlayer_init(void){
|
||||
CoMusic * iPtr;
|
||||
s32 i;
|
||||
|
||||
if(D_80276E30 != NULL)
|
||||
comusicPlayer_free();
|
||||
|
||||
D_80276E30 = (CoMusic *) malloc(6*sizeof(CoMusic));
|
||||
for(iPtr = D_80276E30; iPtr < D_80276E30 + 6; iPtr++){
|
||||
iPtr->track_id = -1;
|
||||
iPtr->unk8 = 0;
|
||||
iPtr->unk12 = 0;
|
||||
iPtr->unkC = 0;
|
||||
iPtr->unk4 = 0.0f;
|
||||
iPtr->unk14 = 0;
|
||||
iPtr->unk15 = 0;
|
||||
iPtr->unk0 = 0.0f;
|
||||
iPtr->unk18 = (FREE_LIST(struct12s) *)freelist_new(sizeof(struct12s),4);
|
||||
for(i = 0; i < 0xE; i++){
|
||||
iPtr->unk1C[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//comusic_freeAll
|
||||
void comusicPlayer_free(void){
|
||||
CoMusic *iPtr;
|
||||
func_8024FB8C();
|
||||
func_8024F83C();
|
||||
|
||||
for(iPtr = D_80276E30; iPtr < D_80276E30 + 6; iPtr++){
|
||||
freelist_free(iPtr->unk18);
|
||||
}
|
||||
free(D_80276E30);
|
||||
D_80276E30 = NULL;
|
||||
}
|
||||
|
||||
s32 comusic_active_track_count(void){
|
||||
CoMusic * iPtr;
|
||||
s32 cnt = 0;
|
||||
for(iPtr = D_80276E30; iPtr < D_80276E30 + 6; iPtr++){
|
||||
if(iPtr->track_id >= 0)
|
||||
cnt++;
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
void comusicPlayer_update(void) {
|
||||
s32 temp_lo;
|
||||
CoMusic *var_s0;
|
||||
f32 dt;
|
||||
|
||||
|
||||
dt = time_getDelta();
|
||||
for(var_s0 = D_80276E30; var_s0 < &D_80276E30[6]; var_s0++){
|
||||
if (var_s0->track_id >= 0) {
|
||||
temp_lo = var_s0 - D_80276E30;
|
||||
var_s0->unk4 = ml_min_f(var_s0->unk4 + dt, 600.0f);
|
||||
if ((var_s0->unk4 > 1.0f) && func_80250074(temp_lo)) {
|
||||
func_8025A7DC(var_s0->track_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
func_8024FF34();
|
||||
if (!D_80276E34)
|
||||
return;
|
||||
|
||||
D_80276E34 = FALSE;
|
||||
for(var_s0 = D_80276E30; var_s0 < &D_80276E30[6]; var_s0++){
|
||||
if (var_s0->track_id >= 0) {
|
||||
if (var_s0->unk12 != 0) {
|
||||
temp_lo = var_s0 - D_80276E30;
|
||||
if (var_s0->unk0 > 0.0f) {
|
||||
var_s0->unk0 -= time_getDelta();
|
||||
D_80276E34 = TRUE;
|
||||
} else if (var_s0->unk12 < 0) {
|
||||
var_s0->unk8 += var_s0->unk12;
|
||||
if (var_s0->unk15 && (var_s0->unkC == 0) && (var_s0->unk8 <= 0)) {
|
||||
func_802599B4(var_s0);
|
||||
continue;
|
||||
} else {
|
||||
if (var_s0->unkC >= var_s0->unk8) {
|
||||
var_s0->unk8 = var_s0->unkC;
|
||||
var_s0->unk12 = 0;
|
||||
} else {
|
||||
D_80276E34 = TRUE;
|
||||
}
|
||||
func_8024FD28(temp_lo, (s16)var_s0->unk8);
|
||||
}
|
||||
} else if (var_s0->unk8 < var_s0->unkC) {
|
||||
if (var_s0->unk8 == 0) {
|
||||
var_s0->unk4 = 0.0f;
|
||||
}
|
||||
var_s0->unk8 += var_s0->unk12;
|
||||
if (var_s0->unk8 >= var_s0->unkC) {
|
||||
var_s0->unk8 = var_s0->unkC;
|
||||
var_s0->unk12 = 0;
|
||||
} else {
|
||||
D_80276E34 = TRUE;
|
||||
}
|
||||
func_8024FD28(temp_lo, (s16)var_s0->unk8);
|
||||
} else {
|
||||
var_s0->unk12 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_80259EA8(CoMusic *this, s32 *arg1, s32 *arg2){
|
||||
int i;
|
||||
int cnt = freelist_size(this->unk18);
|
||||
s32 tmp_s1 = 0x7FFF;
|
||||
s32 tmp_s2 = 0x40000000;
|
||||
struct12s *tmp_ptr;
|
||||
|
||||
for(i = 1; i < cnt; i++){
|
||||
if(freelist_elementIsAlive(this->unk18, i)){
|
||||
tmp_ptr = (struct12s*)freelist_at(this->unk18, i);
|
||||
if(tmp_ptr->unk0 < tmp_s1 || (tmp_s1 == tmp_ptr->unk0 && tmp_ptr->unk1 < tmp_s2)){
|
||||
tmp_s1 = tmp_ptr->unk0;
|
||||
tmp_s2 = tmp_ptr->unk1;
|
||||
}//L80259F40
|
||||
}
|
||||
}
|
||||
*arg1 = tmp_s1;
|
||||
*arg2 = tmp_s2;
|
||||
}
|
||||
|
||||
void func_80259F7C(CoMusic *self, s32 *arg1, s32 *arg2, s32 *arg3) {
|
||||
struct12s *temp_v0;
|
||||
f32 pad;
|
||||
s32 sp34;
|
||||
s32 var_s2;
|
||||
|
||||
var_s2 = *arg1;
|
||||
sp34 = *arg2;
|
||||
if ((*arg3 != 0) && !freelist_elementIsAlive(self->unk18, *arg3)) {
|
||||
*arg3 = 0;
|
||||
}
|
||||
|
||||
if (var_s2 < 0) {
|
||||
temp_v0 = (struct12s *)freelist_at(self->unk18, 1);
|
||||
if (temp_v0->unk0 < func_80250034(self->track_id)) {
|
||||
var_s2 = func_80250034(self->track_id);
|
||||
}
|
||||
else{
|
||||
var_s2 = temp_v0->unk0;
|
||||
}
|
||||
if (*arg3 != 0) {
|
||||
temp_v0 = (struct12s *)freelist_at(self->unk18, *arg3);
|
||||
*arg2 = temp_v0->unk1;
|
||||
freelist_freeElement(self->unk18, *arg3);
|
||||
*arg3 = 0;
|
||||
func_80259EA8(self, arg1, &sp34);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (*arg3 == 0) {
|
||||
temp_v0 = (struct12s *)freelist_at(self->unk18, 1);
|
||||
if ((temp_v0->unk0 < var_s2) || ((var_s2 == temp_v0->unk0) && (sp34 >= temp_v0->unk1))) {
|
||||
func_80259914(self, var_s2, sp34);
|
||||
} else {
|
||||
freelist_next(&self->unk18, arg3);
|
||||
}
|
||||
}
|
||||
if (*arg3 != 0) {
|
||||
temp_v0 = (struct12s *)freelist_at(self->unk18, *arg3);
|
||||
temp_v0->unk0 = var_s2;
|
||||
temp_v0->unk1 = sp34;
|
||||
}
|
||||
func_80259EA8(self, arg1, arg2);
|
||||
}
|
||||
|
||||
void func_8025A104(enum comusic_e arg0, s32 arg1){
|
||||
if (arg0 != D_80276E30[0].track_id){
|
||||
func_8024FC1C(0, arg0);
|
||||
}
|
||||
func_8024FD28(0, (s16)arg1);
|
||||
D_80276E30[0].track_id = (s16) arg0;
|
||||
D_80276E30[0].unk8 = arg1;
|
||||
D_80276E30[0].unk0 = 0.0f;
|
||||
D_80276E30[0].unk12 = 0;
|
||||
D_80276E30[0].unk4 = 0.0f;
|
||||
D_80276E30[0].unk15 = 0;
|
||||
func_80259994(&D_80276E30[0], arg1);
|
||||
}
|
||||
|
||||
void func_8025A1A8(enum comusic_e arg0){
|
||||
|
||||
if (arg0 != D_80276E30[0].track_id){
|
||||
func_8024FC1C(0, arg0);
|
||||
D_80276E30[0].track_id = (s16) arg0;
|
||||
D_80276E30[0].unk8 = func_80250034(arg0);
|
||||
D_80276E30[0].unk0 = 0.0f;
|
||||
D_80276E30[0].unk12 = 0;
|
||||
D_80276E30[0].unk4 = 0.0f;
|
||||
D_80276E30[0].unk15 = 0;
|
||||
func_80259994(&D_80276E30[0], D_80276E30[0].unk8);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8025A23C(s32 arg0){
|
||||
CoMusic *music = &D_80276E30[5];
|
||||
s32 temp_v0;
|
||||
|
||||
if (arg0 != music->track_id){
|
||||
func_8024FC1C(5, arg0);
|
||||
music->track_id = (s16) arg0;
|
||||
temp_v0 = func_80250034(arg0);
|
||||
music->unk8 = temp_v0;
|
||||
music->unk12 = 0;
|
||||
music->unk15 = 0;
|
||||
music->unk0 = 0.0f;
|
||||
music->unk4 = 0.0f;
|
||||
func_80259994(music, temp_v0);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8025A2B0(void){
|
||||
func_802599B4(&D_80276E30[5]);
|
||||
}
|
||||
|
||||
void func_8025A2D8(void){
|
||||
func_802599B4(&D_80276E30[0]);
|
||||
}
|
||||
|
||||
void func_8025A2FC(s32 arg0, s32 arg1){
|
||||
s32 i;
|
||||
|
||||
func_8025A55C(arg0, arg1, 1);
|
||||
for (i = 1; i < 5; i++){
|
||||
s16 val = (i + D_80276E30)->track_id; // Doesn't match with D_80276E30[i]
|
||||
if (val >= 0){
|
||||
func_8025ABB8(val, arg0, arg1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_8025A388(s32 arg0, s32 arg1) {
|
||||
s32 i;
|
||||
|
||||
if (D_80276E30->unk14 == 0){
|
||||
func_8025A55C(arg0, arg1, 1);
|
||||
}
|
||||
for (i = 1; i < 5; i++){
|
||||
CoMusic *current = (i + D_80276E30); // Doesn't match with D_80276E30[i]
|
||||
if (current->track_id >= 0 && current->unk14 == 0){
|
||||
func_8025ABB8(current->track_id, arg0, arg1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_8025A430(s32 arg0, s32 arg1, s32 arg2){
|
||||
s32 i;
|
||||
|
||||
func_8025A55C(arg0, arg1, arg2);
|
||||
for (i = 1; i < 5; i++){
|
||||
s16 val = (i + D_80276E30)->track_id; // Doesn't match with D_80276E30[i]
|
||||
if (val >= 0){
|
||||
func_8025ABB8(val, arg0, arg1, arg2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_8025A4C4(s32 arg0, s32 arg1, s32 *arg2){
|
||||
if(D_80276E30[0].track_id >= 0){
|
||||
func_80259F7C(&D_80276E30[0], &arg0, &arg1, arg2);
|
||||
if(arg0 != D_80276E30[0].unk8){
|
||||
if(D_80276E30[0].unk8 < arg0){
|
||||
D_80276E30[0].unk12 = arg1;
|
||||
}
|
||||
else{
|
||||
D_80276E30[0].unk12 = -arg1;
|
||||
}
|
||||
D_80276E30[0].unkC = arg0;
|
||||
D_80276E34 = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_8025A55C(s32 arg0, s32 arg1, s32 arg2){
|
||||
func_8025A4C4(arg0, arg1, &D_80276E30->unk1C[arg2]);
|
||||
}
|
||||
|
||||
void func_8025A58C(s32 arg0, s32 arg1){
|
||||
func_8025A55C(arg0, arg1, 0);
|
||||
}
|
||||
|
||||
|
||||
void func_8025A5AC(enum comusic_e comusic_id, s32 volume, s32 arg2){
|
||||
CoMusic *tmp_a2;
|
||||
s32 sp20;
|
||||
|
||||
if(volume == -1){
|
||||
volume = func_80250034(comusic_id);
|
||||
}
|
||||
|
||||
tmp_a2 = __find_track(comusic_id);
|
||||
if(tmp_a2 == NULL)
|
||||
return;
|
||||
|
||||
sp20 = (tmp_a2 - D_80276E30);
|
||||
if(tmp_a2->track_id < 0 || arg2){
|
||||
switch(comusic_id){
|
||||
case COMUSIC_15_EXTRA_LIFE_COLLECTED:
|
||||
if(map_get() == MAP_10_BGS_MR_VILE){
|
||||
break;
|
||||
}
|
||||
case COMUSIC_3B_MINIGAME_VICTORY:
|
||||
case COMUSIC_3C_MINIGAME_LOSS:
|
||||
func_8025AE50(4000, 2.0f);
|
||||
}
|
||||
tmp_a2->track_id = comusic_id;
|
||||
tmp_a2->unk12 = 0;
|
||||
tmp_a2->unk15 = 0;
|
||||
tmp_a2->unk4 = 0.0f;
|
||||
func_80259994(tmp_a2, volume);
|
||||
func_8024FC1C(sp20, comusic_id);
|
||||
}
|
||||
func_8024FD28(sp20, (s16) volume);
|
||||
tmp_a2->unk8 = volume;
|
||||
|
||||
}
|
||||
|
||||
void func_8025A6CC(enum comusic_e track_id, s32 volume){
|
||||
func_8025A5AC(track_id, volume, 0);
|
||||
}
|
||||
|
||||
void func_8025A6EC(enum comusic_e track_id, s32 volume){
|
||||
func_8025A5AC(track_id, volume, 1);
|
||||
}
|
||||
|
||||
//comusic_queueTrack
|
||||
void comusic_playTrack(enum comusic_e track_id){
|
||||
CoMusic *trackPtr;
|
||||
s32 indx;
|
||||
|
||||
trackPtr = __find_track(track_id);
|
||||
if(trackPtr == NULL)
|
||||
return;
|
||||
|
||||
indx = trackPtr - D_80276E30;
|
||||
if(trackPtr->track_id < 0){
|
||||
trackPtr->track_id = track_id;
|
||||
trackPtr->unk12 = 0;
|
||||
trackPtr->unk4 = 0.0f;
|
||||
func_8024FC1C( indx, track_id);
|
||||
func_80259994(trackPtr, trackPtr->unk8 = func_80250034(track_id));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void func_8025A788(enum comusic_e comusic_id, f32 delay1, f32 delay2){
|
||||
timedFunc_set_1(delay1, (GenFunction_1) comusic_playTrack, comusic_id);
|
||||
timedFunc_set_1(delay1 + delay2, (GenFunction_1) func_8025A7DC, comusic_id);
|
||||
}
|
||||
|
||||
void func_8025A7DC(enum comusic_e track_id){
|
||||
CoMusic *trackPtr;
|
||||
|
||||
trackPtr = __find_track(track_id);
|
||||
if (trackPtr != NULL && trackPtr->track_id >= 0){
|
||||
func_802599B4(trackPtr);
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_8025A818(void){
|
||||
if (D_80276E30[0].unkC == 0 && D_80276E30[0].unk8 <= 0){
|
||||
func_802599B4(&D_80276E30[0]);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 func_8025A864(enum comusic_e track_id){
|
||||
CoMusic *trackPtr;
|
||||
|
||||
trackPtr = __find_track(track_id);
|
||||
if (trackPtr != NULL && trackPtr->unkC == 0 && trackPtr->unk8 <= 0){
|
||||
func_802599B4(trackPtr);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void func_8025A8B8(enum comusic_e track_id, s32 arg1){
|
||||
CoMusic *trackPtr;
|
||||
|
||||
trackPtr = __find_track(track_id);
|
||||
if (trackPtr != NULL){
|
||||
trackPtr->unk14 = arg1;
|
||||
}
|
||||
}
|
||||
|
||||
void func_8025A8E4(s32 arg0) {
|
||||
if (D_80276E30[0].track_id >= 0) {
|
||||
D_80276E30[0].unk14 = arg0;
|
||||
}
|
||||
}
|
||||
|
||||
void func_8025A904(void){
|
||||
CoMusic *trackPtr = &D_80276E30[0];
|
||||
|
||||
while (trackPtr < &D_80276E30[6]){
|
||||
if (trackPtr->track_id >= 0){
|
||||
func_802599B4(trackPtr);
|
||||
}
|
||||
trackPtr++;
|
||||
}
|
||||
}
|
||||
|
||||
//dequeue_allTracks
|
||||
void func_8025A96C(void){
|
||||
CoMusic *iPtr;
|
||||
|
||||
for(iPtr = &D_80276E30[1]; iPtr < &D_80276E30[6]; iPtr++){
|
||||
if(iPtr->track_id >= 0){
|
||||
func_802599B4(iPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//dequeue_allTracks
|
||||
void func_8025A9D4(void){
|
||||
CoMusic *iPtr;
|
||||
|
||||
for(iPtr = &D_80276E30[0]; iPtr < &D_80276E30[6]; iPtr++){
|
||||
if(iPtr->track_id >= 0 && !iPtr->unk14){
|
||||
func_802599B4(iPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//dequeue_nonmainTracks
|
||||
void func_8025AA48(void){
|
||||
CoMusic *iPtr;
|
||||
|
||||
for(iPtr = &D_80276E30[1]; iPtr < &D_80276E30[6]; iPtr++){
|
||||
if(iPtr->track_id >= 0 && !iPtr->unk14){
|
||||
func_802599B4(iPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//dequeue_track?
|
||||
void func_8025AABC(enum comusic_e track_id){
|
||||
CoMusic *trackPtr;
|
||||
|
||||
if(trackPtr = __find_track(track_id)){
|
||||
trackPtr->unk15 = 1;
|
||||
if(!trackPtr->unk8)
|
||||
func_802599B4(trackPtr);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8025AB00(void){
|
||||
D_80276E30[0].unk15 = 1;
|
||||
if (!D_80276E30[0].unk8){
|
||||
func_802599B4(&D_80276E30[0]);
|
||||
}
|
||||
}
|
||||
|
||||
void comusic_8025AB44(enum comusic_e comusic_id, s32 arg1, s32 arg2){
|
||||
func_8025AC20(comusic_id, arg1, arg2, 0.0f, "comusic.c", VER_SELECT(0x39e, 0x39f, 0, 0));
|
||||
|
||||
}
|
||||
|
||||
void comusic_8025AB78(enum comusic_e comusic_id, s32 arg1, s32 arg2, s32 arg3){
|
||||
func_8025AC7C(comusic_id, arg1, arg2, 0.0f, arg3, "comusic.c", VER_SELECT(0x3a3, 0x3a4, 0, 0));
|
||||
}
|
||||
|
||||
void func_8025ABB8(enum comusic_e comusic_id, s32 arg1, s32 arg2, s32 arg3){
|
||||
func_8025AC7C(comusic_id, arg1, arg2, 0.0f, (s32)&(__find_track(comusic_id)->unk1C[arg3]), "comusic.c", VER_SELECT(0x3aa, 0x3ab,0,0));
|
||||
}
|
||||
|
||||
void func_8025AC20(enum comusic_e comusic_id, s32 arg1, s32 arg2, f32 arg3, char* arg4, s32 char5){
|
||||
func_8025AC7C(comusic_id, arg1, arg2, 0.0f, (s32) __find_track(comusic_id)->unk1C, "comusic.c", VER_SELECT(0x3b1, 0x3b2,0,0));
|
||||
}
|
||||
|
||||
void func_8025AC7C(enum comusic_e comusic_id, s32 arg1, s32 arg2, f32 arg3, s32 *arg4, char* arg5, s32 arg6){
|
||||
CoMusic *trackPtr;
|
||||
u32 slot_index;
|
||||
|
||||
//get track location
|
||||
trackPtr = __find_track(comusic_id);
|
||||
if(trackPtr == NULL)
|
||||
return;
|
||||
|
||||
//check if track is loaded in slot
|
||||
if(trackPtr->track_id < 0){ //Track not loaded
|
||||
if(arg1 == 0)
|
||||
return;
|
||||
slot_index = (trackPtr - D_80276E30);
|
||||
func_8024FC1C(slot_index, comusic_id);
|
||||
trackPtr->track_id = comusic_id;
|
||||
trackPtr->unk8 = 0;
|
||||
trackPtr->unk15 = 0;
|
||||
trackPtr->unk4 = 0.0f;
|
||||
func_80259994(trackPtr, 0);
|
||||
func_8024FD28(slot_index, 0);
|
||||
}
|
||||
func_80259F7C(trackPtr,&arg1, &arg2, arg4);
|
||||
trackPtr->unk0 = arg3;
|
||||
trackPtr->unk12 = (trackPtr->unk8 < arg1)? arg2: -arg2;
|
||||
trackPtr->unkC = arg1;
|
||||
D_80276E34 = 1;
|
||||
|
||||
}
|
||||
|
||||
//comusic_trackQueued
|
||||
int func_8025AD7C(enum comusic_e arg0){
|
||||
CoMusic * trackPtr = __find_track(arg0);
|
||||
return (trackPtr == NULL || trackPtr->track_id == -1)? 0 : 1;
|
||||
}
|
||||
|
||||
//comusic_isPrimaryTrack
|
||||
int func_8025ADBC(enum comusic_e arg0){
|
||||
return D_80276E30[0].track_id == arg0;
|
||||
}
|
||||
|
||||
s32 func_8025ADD4(enum comusic_e id){
|
||||
CoMusic * ptr = __find_track(id);
|
||||
return ptr - D_80276E30;
|
||||
}
|
||||
|
||||
void func_8025AE0C(s32 arg0, f32 arg1){
|
||||
func_8025A58C(0, arg0);
|
||||
timedFunc_set_2(arg1, (GenFunction_2)func_8025A58C, -1, arg0);
|
||||
}
|
||||
|
||||
void func_8025AE50(s32 arg0, f32 arg1){
|
||||
func_8025A430(0, arg0, 6);
|
||||
timedFunc_set_3(arg1, (GenFunction_3)func_8025A430, -1, arg0, 6);
|
||||
}
|
||||
|
||||
void func_8025AEA0(enum comusic_e track_id, s32 arg1){
|
||||
CoMusic *ptr = __find_track(track_id);
|
||||
|
||||
if(!ptr) return;
|
||||
func_8024FDDC(ptr - D_80276E30, arg1);
|
||||
}
|
||||
|
||||
int func_8025AEEC(void){
|
||||
s32 out = func_802501A0(0, 0x6A, 0);
|
||||
if(out)
|
||||
func_80250170(0, 0x6A, 0);
|
||||
return out;
|
||||
}
|
||||
|
||||
void comusic_defrag(void){
|
||||
CoMusic *iPtr;
|
||||
|
||||
if(!D_80276E30) return;
|
||||
|
||||
for(iPtr = &D_80276E30[0]; iPtr < &D_80276E30[6]; iPtr++){
|
||||
iPtr->unk18 = (FREE_LIST(struct12s) *)freelist_defrag(iPtr->unk18);
|
||||
}
|
||||
D_80276E30 = (CoMusic *)defrag(D_80276E30);
|
||||
}
|
@@ -394,10 +394,10 @@ bool audioManager_handleFrameMsg(AudioInfo *info, AudioInfo *prev_info){
|
||||
|
||||
#if VERSION == VERSION_USA_1_0
|
||||
if(sp30 == -1){
|
||||
func_80247F24(2, 0x7d2);
|
||||
func_80247F9C(prev_info->frameSamples);
|
||||
func_80247F9C(info->frameSamples);
|
||||
func_802483D8();
|
||||
gcdebugText_showLargeValue(2, 0x7d2);
|
||||
gcdebugText_showValue(prev_info->frameSamples);
|
||||
gcdebugText_showValue(info->frameSamples);
|
||||
gcdebugText_pauseThread();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -419,10 +419,10 @@ bool audioManager_handleFrameMsg(AudioInfo *info, AudioInfo *prev_info){
|
||||
|
||||
#if VERSION == VERSION_USA_1_0
|
||||
if(D_8027DD80 < sp34){
|
||||
func_80247F24(2, 2000);
|
||||
func_80247F9C(sp34);
|
||||
func_80247F9C(D_8027DD80);
|
||||
func_802483D8();
|
||||
gcdebugText_showLargeValue(2, 2000);
|
||||
gcdebugText_showValue(sp34);
|
||||
gcdebugText_showValue(D_8027DD80);
|
||||
gcdebugText_pauseThread();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -469,8 +469,8 @@ s32 func_80240204(s32 addr, s32 len, void *state){
|
||||
}
|
||||
phi_s0 = D_8027D5B0.unk8;
|
||||
if (phi_s0 == NULL) {
|
||||
func_80247F24(2, 0x7D1);
|
||||
func_802483D8();
|
||||
gcdebugText_showLargeValue(2, 0x7D1);
|
||||
gcdebugText_pauseThread();
|
||||
return osVirtualToPhysical(D_8027D5B0.unk4);
|
||||
}
|
||||
D_8027D5B0.unk8 = phi_s0->unk0.next;
|
||||
@@ -577,10 +577,10 @@ void func_802403F0(void) {
|
||||
|
||||
#if VERSION == VERSION_USA_1_0
|
||||
if (osRecvMesg(&D_8027D008, &sp40, 0) == -1) {
|
||||
func_80247F24(2, 0x7D5);
|
||||
func_80247F9C(D_8027DCCC);
|
||||
func_80247F9C(phi_s0);
|
||||
func_802483D8();
|
||||
gcdebugText_showLargeValue(2, 0x7D5);
|
||||
gcdebugText_showValue(D_8027DCCC);
|
||||
gcdebugText_showValue(phi_s0);
|
||||
gcdebugText_pauseThread();
|
||||
}
|
||||
#else
|
||||
osRecvMesg(&D_8027D008, &sp40, 0);
|
||||
|
@@ -26,7 +26,7 @@ void core1_7090_release(void) {
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
if (D_802758E0[i])
|
||||
func_8030E394(D_802758E0[i]);
|
||||
sfxSource_triggerCallbackByIndex(D_802758E0[i]);
|
||||
}
|
||||
|
||||
free(D_802758E0);
|
||||
@@ -43,13 +43,13 @@ void core1_7090_initSfxSource(s32 idx, s32 lookup_idx, s32 sample_rate, f32 volu
|
||||
sfxsource_setSfxId(sfx_source_index, lookup_getSfxId(lookup_idx));
|
||||
sfxsource_playSfxAtVolume(sfx_source_index, volume);
|
||||
sfxsource_setSampleRate(sfx_source_index, sample_rate);
|
||||
func_8030E2C4(sfx_source_index);
|
||||
sfxSource_func_8030E2C4(sfx_source_index);
|
||||
core1_7090_freeSfxSource(idx);
|
||||
D_802758E0[idx] = sfx_source_index;
|
||||
}
|
||||
}
|
||||
else {
|
||||
func_8030E6A4(lookup_getSfxId(lookup_idx), volume, sample_rate);
|
||||
gcsfx_playWithPitch(lookup_getSfxId(lookup_idx), volume, sample_rate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,440 +0,0 @@
|
||||
#include <ultra64.h>
|
||||
#include "core1/core1.h"
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
#include "version.h"
|
||||
|
||||
#if VERSION == VERSION_USA_1_0
|
||||
|
||||
/* .data */
|
||||
u8 D_80275A50[8][3] = {
|
||||
{0xFF, 0x00, 0x00},
|
||||
{0x00, 0xFF, 0x00},
|
||||
{0x00, 0x00, 0xFF},
|
||||
{0xFF, 0xFF, 0x00},
|
||||
{0xFF, 0x00, 0xFF},
|
||||
{0xFF, 0xFF, 0xFF},
|
||||
{0xFF, 0x80, 0x00},
|
||||
{0x00, 0xFF, 0xFF}
|
||||
};
|
||||
s32 D_80275A68 = 0xFF;
|
||||
s32 D_80275A6C = 0xFF;
|
||||
s32 D_80275A70 = 0xFF;
|
||||
u8 D_80275A74[] = {1, 7, 3, 4, 0, 6, 5, 0};
|
||||
u32 D_80275A7C[] = {
|
||||
3, 0x0F6DE000,
|
||||
1, 0x0F800000,
|
||||
3, 0x0C4AE000,
|
||||
3, 0x0E59E000,
|
||||
4, 0x088AF200,
|
||||
3, 0x0F39E000,
|
||||
3, 0x0F3DE000,
|
||||
3, 0x0E4A4000,
|
||||
3, 0x0F7DE000,
|
||||
3, 0x0F79E000,
|
||||
3, 0x0F6FA000,
|
||||
3, 0x0D75C000,
|
||||
3, 0x0F24E000,
|
||||
3, 0x0D6DC000,
|
||||
3, 0x0F34E000,
|
||||
3, 0x0F348000,
|
||||
3, 0x0F25E000,
|
||||
3, 0x0B7DA000,
|
||||
3, 0x0E92E000,
|
||||
3, 0x0E928000,
|
||||
3, 0x0B75A000,
|
||||
3, 0x0924E000,
|
||||
5, 0x08EEB188,
|
||||
4, 0x09DFB900,
|
||||
4, 0x06999600,
|
||||
3, 0x0F7C8000,
|
||||
4, 0x069DB700,
|
||||
3, 0x0F7EA000,
|
||||
3, 0x0F39E000,
|
||||
3, 0x0E924000,
|
||||
4, 0x09999600,
|
||||
5, 0x08C62A20,
|
||||
5, 0x08C63550,
|
||||
3, 0x0B55A000,
|
||||
3, 0x0B79E000,
|
||||
4, 0x0F124F00,
|
||||
1, 0x00800000,
|
||||
1, 0x05000000,
|
||||
3, 0x00380000,
|
||||
2, 0x00000000
|
||||
};
|
||||
|
||||
s16 D_80275BBC = 0;
|
||||
s16 D_80275BC0 = 0;
|
||||
s16 D_80275BC4 = 0;
|
||||
s16 D_80275BC8 = 0;
|
||||
s16 D_80275BCC = 0;
|
||||
s16 D_80275BD0 = 0;
|
||||
s16 D_80275BD4 = 0;
|
||||
s16 D_80275BD8 = 0;
|
||||
s16 D_80275BDC = 0;
|
||||
u8 D_80275BE0 = 0;
|
||||
s32 D_80275BE4 = 0;
|
||||
char D_80275BE8[] = {'a','z','A','Z','0','9','.',':', '-', ' '};
|
||||
|
||||
|
||||
/* .h */
|
||||
void func_802484D0(void);
|
||||
void func_8024856C(void);
|
||||
void func_80248520(void);
|
||||
|
||||
/* code */
|
||||
void func_80247750(s32 r, s32 g, s32 b){
|
||||
D_80275A68 = r;
|
||||
D_80275A6C = g;
|
||||
D_80275A70 = b;
|
||||
}
|
||||
|
||||
void func_8024776C(s32 x, s32 y) {
|
||||
s32 rgba16;
|
||||
if( ((x >= 0) && (x < gFramebufferWidth))
|
||||
&& ((y >= 0) && (y < gFramebufferHeight))
|
||||
) {
|
||||
gFramebuffers[0][x + y*gFramebufferWidth] = _SHIFTL(D_80275A68 >> 3, 11, 5) | _SHIFTL(D_80275A6C >> 3, 6, 5) | _SHIFTL(D_80275A70 >> 3, 1, 5) | _SHIFTL(1, 0, 1);
|
||||
gFramebuffers[1][x + y*gFramebufferWidth] = _SHIFTL(D_80275A68 >> 3, 11, 5) | _SHIFTL(D_80275A6C >> 3, 6, 5) | _SHIFTL(D_80275A70 >> 3, 1, 5) | _SHIFTL(1, 0, 1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void func_80247818(s32 x, s32 y, s32 w, s32 h) {
|
||||
s32 iy;
|
||||
s32 var_s1;
|
||||
s32 ix;
|
||||
|
||||
for(ix = 0; ix < w; ix++){
|
||||
for(iy = 0; iy < h; iy++){
|
||||
func_8024776C(x + ix, y + iy);
|
||||
}
|
||||
}
|
||||
osWriteBackDCacheAll();
|
||||
}
|
||||
|
||||
void func_802478C0(s32 r, s32 g, s32 b) {
|
||||
func_80247750(r, g, b);
|
||||
func_80247818((gFramebufferWidth - 128) / 2, (gFramebufferHeight - 100) / 2, 128, 100);
|
||||
}
|
||||
|
||||
void func_8024792C(void){}
|
||||
|
||||
void func_80247934(void) {
|
||||
s32 var_s0;
|
||||
|
||||
for(var_s0 = 0; var_s0 < 2000000; var_s0++){
|
||||
func_8024792C();
|
||||
}
|
||||
}
|
||||
|
||||
void func_80247978(s32 arg0) {
|
||||
do{
|
||||
func_802478C0(D_80275A50[arg0][0], D_80275A50[arg0][1], D_80275A50[arg0][2]);
|
||||
func_80247934();
|
||||
func_802478C0(0, 0, 0);
|
||||
func_80247934();
|
||||
}
|
||||
while(1);
|
||||
}
|
||||
|
||||
void func_802479E4(s32 arg0) {
|
||||
func_802478C0(D_80275A50[arg0][0], D_80275A50[arg0][1], D_80275A50[arg0][2]);
|
||||
func_80247934();
|
||||
func_802478C0(0, 0, 0);
|
||||
func_80247934();
|
||||
}
|
||||
|
||||
void func_80247A40(s32 arg0) {
|
||||
func_802478C0(D_80275A50[arg0][0], D_80275A50[arg0][1], D_80275A50[arg0][2]);
|
||||
}
|
||||
|
||||
void func_80247A7C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 r, s32 g, s32 b) {
|
||||
s32 var_s3;
|
||||
s32 sp48;
|
||||
u32 sp44;
|
||||
u32 sp40;
|
||||
s32 temp_lo;
|
||||
s32 temp_s1;
|
||||
s32 temp_t8;
|
||||
s32 var_s0;
|
||||
u32 temp_t4;
|
||||
u32 var_s4;
|
||||
u32 *ptr = D_80275A7C + (arg1*2);
|
||||
|
||||
var_s4 = 0x10000000;
|
||||
sp44 = ptr[0];
|
||||
sp40 = ptr[1];
|
||||
for(sp48 = 0; sp48 < 5; sp48++){
|
||||
temp_lo = sp48 * arg2;
|
||||
for(var_s3 = 0; var_s3 != sp44; var_s3++){
|
||||
var_s4 >>= 1;
|
||||
if (sp40 & var_s4) {
|
||||
func_80247750(r, g, b);
|
||||
func_80247818((D_80275BC4 + arg2*var_s3) - arg3, (D_80275BC8 + temp_lo) - arg3, (arg2 + arg3) + arg3, (arg2 + arg3) + arg3);
|
||||
} else {
|
||||
if (arg4 != 0) {
|
||||
func_80247750(0, 0, 0);
|
||||
}
|
||||
func_80247818((D_80275BC4 + arg2*var_s3) - arg3, (D_80275BC8 + temp_lo) - arg3, (arg2 + arg3) + arg3, (arg2 + arg3) + arg3);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (arg3 == 0) {
|
||||
D_80275BC4 += (sp44 * arg2) + 2;
|
||||
}
|
||||
}
|
||||
|
||||
void func_80247C20(void) {
|
||||
s16 *var_v0;
|
||||
s16 *var_v1;
|
||||
s32 temp_lo;
|
||||
void *temp_a0;
|
||||
s32 i;
|
||||
|
||||
if (D_80275BE4 == 0) {
|
||||
D_80275BE4 = globalTimer_getTime();
|
||||
return;
|
||||
}
|
||||
if (globalTimer_getTime() != D_80275BE4) {
|
||||
D_80275BE0 = FALSE;
|
||||
D_80275BE4 = globalTimer_getTime();
|
||||
}
|
||||
|
||||
if (D_80275BE0) {
|
||||
for(i = 0; i < gFramebufferWidth * gFramebufferHeight; i++){
|
||||
gFramebuffers[0][i] = 0;
|
||||
gFramebuffers[1][i] = 0;
|
||||
}
|
||||
osWriteBackDCacheAll();
|
||||
}
|
||||
}
|
||||
|
||||
void func_80247CEC(s32 arg0, s32 arg1, s32 arg2) {
|
||||
func_80247A7C(arg0, arg1, arg2, 1, 1, 0, 0, 0);
|
||||
func_80247A7C(arg0, arg1, arg2, 0, 1, D_80275A50[D_80275A74[arg0]][0], D_80275A50[D_80275A74[arg0]][1], D_80275A50[D_80275A74[arg0]][2]);
|
||||
}
|
||||
|
||||
void func_80247D80(s32 arg0, s32 arg1, s32 arg2) {
|
||||
s16 temp_v0;
|
||||
s32 var_a1;
|
||||
s32 var_s0;
|
||||
s32 var_s1;
|
||||
|
||||
D_80275BC4 = D_80275BBC;
|
||||
D_80275BD4 = arg2;
|
||||
if (arg1 < 0) {
|
||||
func_80247CEC(arg0, 0x26, arg2);
|
||||
arg1 *= -1;
|
||||
}
|
||||
|
||||
for(var_s0 = 1000000000; var_s0 >= 10 && arg1 < var_s0; var_s0 /= 10){
|
||||
continue;
|
||||
}
|
||||
|
||||
for(var_s0 = var_s0; var_s0 >= 10; var_s0 /= 10){
|
||||
for(var_a1 = 0; arg1 >= var_s0; var_a1++){
|
||||
arg1 -= var_s0;
|
||||
}
|
||||
func_80247CEC(arg0, var_a1, arg2);
|
||||
}
|
||||
|
||||
func_80247CEC(arg0, arg1, arg2);
|
||||
func_8024856C();
|
||||
if (arg2 == 7) {
|
||||
D_80275BD8 = D_80275BC4;
|
||||
D_80275BDC = 0;
|
||||
}
|
||||
else if (D_80275BC4 >= D_80275BDC) {
|
||||
D_80275BDC = D_80275BC4;
|
||||
}
|
||||
}
|
||||
|
||||
void func_80247F24(s32 arg0, s32 arg1) {
|
||||
D_80275BD0 = 0;
|
||||
D_80275BCC = arg0;
|
||||
D_80275BBC = 0xE;
|
||||
D_80275BC8 = 0xA;
|
||||
func_80247D80(arg0, arg1, 7);
|
||||
func_802484D0();
|
||||
D_80275BC0 = D_80275BC8;
|
||||
D_80275BDC = D_80275BBC;
|
||||
D_80275BE0 = 1;
|
||||
}
|
||||
|
||||
|
||||
void func_80247F9C(s32 arg0){
|
||||
func_80247D80(D_80275BCC, arg0, 2);
|
||||
func_802484D0();
|
||||
}
|
||||
|
||||
void func_80247FD0(u32 arg0) {
|
||||
s32 var_s0;
|
||||
|
||||
D_80275BC4 = D_80275BBC;
|
||||
D_80275BD4 = 2;
|
||||
func_80247CEC(D_80275BCC, 0x25, 2);
|
||||
var_s0 = (arg0 >= 0x01000000U) ? 0x1C
|
||||
: (arg0 >= 0x10000U) ? 0x14
|
||||
:0xC;
|
||||
if (var_s0 >= 0) {
|
||||
do {
|
||||
func_80247CEC(D_80275BCC, ((s32) arg0 >> var_s0) & 0xF, 2);
|
||||
var_s0 -= 4;
|
||||
} while (var_s0 >= 0);
|
||||
}
|
||||
func_80248520();
|
||||
}
|
||||
|
||||
void func_80248098(f32 arg0) {
|
||||
f32 var_f22;
|
||||
s32 var_s0;
|
||||
|
||||
D_80275BC4 = D_80275BBC;
|
||||
D_80275BD4 = 2;
|
||||
if (arg0 < 0.0f) {
|
||||
func_80247CEC(D_80275BCC, 0x26, 2);
|
||||
arg0 *= -1.0f;
|
||||
}
|
||||
var_f22 = 1e+09;
|
||||
while((var_f22 >= 10.0f) && (arg0 < var_f22)) {
|
||||
var_f22 /= 10.0f;
|
||||
}
|
||||
while (1e-09 <= var_f22) {
|
||||
if ((0.09 < var_f22) && (var_f22 < 0.11)) {
|
||||
func_80247CEC(D_80275BCC, 0x24, 2);
|
||||
}
|
||||
|
||||
var_s0 = 0;
|
||||
while (var_f22 <= arg0) {
|
||||
arg0 -= var_f22;
|
||||
var_s0 += 1;
|
||||
}
|
||||
func_80247CEC(D_80275BCC, var_s0, 2);
|
||||
var_f22 /= 10.0f;
|
||||
}
|
||||
func_80248520();
|
||||
}
|
||||
|
||||
//letter to font index???
|
||||
s32 func_8024824C(s32 arg0) {
|
||||
//lowercase_letter
|
||||
if ((arg0 >= (s32) D_80275BE8[0]) && ((s32) D_80275BE8[1] >= arg0)) {
|
||||
return (arg0 - D_80275BE8[0]) + 0xA;
|
||||
}
|
||||
|
||||
//uppercase_letter
|
||||
if ((arg0 >= (s32) D_80275BE8[2]) && ((s32) D_80275BE8[3] >= arg0)) {
|
||||
return (arg0 - D_80275BE8[2]) + 0xA;
|
||||
}
|
||||
|
||||
//number
|
||||
if ((arg0 >= (s32) D_80275BE8[4]) && ((s32) D_80275BE8[5] >= arg0)) {
|
||||
return (arg0 - D_80275BE8[4]);
|
||||
}
|
||||
|
||||
//.
|
||||
if (arg0 == D_80275BE8[6]) {
|
||||
return 0x24;
|
||||
}
|
||||
|
||||
//:
|
||||
if (arg0 == D_80275BE8[7]) {
|
||||
return 0x25;
|
||||
}
|
||||
|
||||
//-
|
||||
if (arg0 == D_80275BE8[8]) {
|
||||
return 0x26;
|
||||
}
|
||||
//
|
||||
if (arg0 == D_80275BE8[9]) {
|
||||
return 0x27;
|
||||
}
|
||||
return 0x27;
|
||||
}
|
||||
|
||||
|
||||
void func_80248330(u8 *arg0){
|
||||
s32 i;
|
||||
s32 var_v0;
|
||||
|
||||
D_80275BC4 = D_80275BBC;
|
||||
D_80275BD4 = 2;
|
||||
for(i = 0; arg0[i] != 0; i++){
|
||||
var_v0 = arg0[i];
|
||||
func_80247CEC(D_80275BCC, func_8024824C(var_v0), 2);
|
||||
}
|
||||
func_80248520();
|
||||
}
|
||||
|
||||
|
||||
void func_802483B8(void){
|
||||
D_80275BD0 = 1;
|
||||
do{}while(1);
|
||||
}
|
||||
|
||||
void func_802483D8(void){
|
||||
s32 i;
|
||||
D_80275BD0 = 1;
|
||||
for(i = 30000000; i != 0; i--){}
|
||||
D_80275BD0 = 0;
|
||||
}
|
||||
|
||||
void func_80248404(s32 arg0){
|
||||
s32 i;
|
||||
|
||||
D_80275BD0 = 1;
|
||||
while(arg0 != 0){
|
||||
for(i = 30000000; i != 0; i--){}
|
||||
arg0--;
|
||||
}
|
||||
D_80275BD0 = 0;
|
||||
}
|
||||
|
||||
void func_80248444(s32 arg0) {
|
||||
D_80275BC8 += arg0;
|
||||
if (D_80275BC8 >= 0xCD) {
|
||||
D_80275BBC = D_80275BDC + 4;
|
||||
D_80275BC4 = D_80275BBC;
|
||||
D_80275BC8 = (D_80275BD8 < D_80275BC4) ? 0xA : D_80275BC0;
|
||||
D_80275BDC = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void func_802484D0(void){
|
||||
func_80248444( D_80275BD4*5 + 2);
|
||||
}
|
||||
|
||||
void func_80248500(void){
|
||||
func_80248444(2);
|
||||
}
|
||||
|
||||
void func_80248520(void){
|
||||
func_8024856C();
|
||||
if(D_80275BC4 >= D_80275BDC){
|
||||
D_80275BDC = D_80275BC4;
|
||||
}
|
||||
func_802484D0();
|
||||
}
|
||||
|
||||
void func_8024856C(void) {
|
||||
s16 sp1E;
|
||||
s16 temp_v0;
|
||||
|
||||
sp1E = D_80275BC4--;
|
||||
func_80247CEC(D_80275BCC, 0x27, D_80275BD4);
|
||||
D_80275BC4 = sp1E;
|
||||
}
|
||||
|
||||
|
||||
s32 func_802485BC(void){
|
||||
return D_80275BD0;
|
||||
}
|
||||
|
||||
void func_802485C8(UNK_TYPE(s32) arg0){
|
||||
|
||||
}
|
||||
#endif
|
@@ -80,10 +80,10 @@ void core1_ce60_func_8024AAB0(void) {
|
||||
sTrackId[2] = sTrackId[3] = COMUSIC_0_DING_A;
|
||||
|
||||
if (0 <= sTrackId[0])
|
||||
sTrackId[2] = func_80250034(sTrackId[0]);
|
||||
sTrackId[2] = gcMusic_getDefaultVolumeForTrack(sTrackId[0]);
|
||||
|
||||
if (0 <= sTrackId[1])
|
||||
sTrackId[3] = func_80250034(sTrackId[1]);
|
||||
sTrackId[3] = gcMusic_getDefaultVolumeForTrack(sTrackId[1]);
|
||||
|
||||
switch (map_get()) {
|
||||
case MAP_7_TTC_TREASURE_TROVE_COVE:
|
||||
@@ -160,7 +160,7 @@ void core1_ce60_func_8024ADF0(bool arg0) {
|
||||
func_8025A104(sTrackId[0], sTrackId[2]);
|
||||
|
||||
if (0 < sTrackId[1] && 0 < sTrackId[3])
|
||||
func_8025A6CC(sTrackId[1], sTrackId[3]);
|
||||
coMusicPlayer_playMusicWeak(sTrackId[1], sTrackId[3]);
|
||||
}
|
||||
|
||||
void core1_ce60_func_8024AE74(void) {
|
||||
@@ -588,7 +588,7 @@ void core1_ce60_func_8024AF48(void) {
|
||||
break;
|
||||
|
||||
case MAP_91_FILE_SELECT:
|
||||
if (!func_802C5A30()) {
|
||||
if (!gameSelect_getGameNumber()) {
|
||||
core1_ce60_setChanMaskWithValue(0x200, 0.5f);
|
||||
} else {
|
||||
core1_ce60_setChanMaskWithValue(0x1ff, 0.5f);
|
||||
|
493
src/core1/debugtext.c
Normal file
493
src/core1/debugtext.c
Normal file
@@ -0,0 +1,493 @@
|
||||
#include <ultra64.h>
|
||||
#include "core1/core1.h"
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
#include "version.h"
|
||||
|
||||
#if VERSION == VERSION_USA_1_0
|
||||
|
||||
/* .data */
|
||||
u8 RGB_VALUES[8][3] = {
|
||||
{0xFF, 0x00, 0x00}, // Red
|
||||
{0x00, 0xFF, 0x00}, // Green
|
||||
{0x00, 0x00, 0xFF}, // Blue
|
||||
{0xFF, 0xFF, 0x00}, // Yellow
|
||||
{0xFF, 0x00, 0xFF}, // Pink
|
||||
{0xFF, 0xFF, 0xFF}, // White
|
||||
{0xFF, 0x80, 0x00}, // Orange
|
||||
{0x00, 0xFF, 0xFF} // Cyan
|
||||
};
|
||||
|
||||
s32 red = 0xFF;
|
||||
s32 green = 0xFF;
|
||||
s32 blue = 0xFF;
|
||||
|
||||
// Orders the above RGB values: Green, Cyan, Yellow, Pink, Red, Orange, White, Red.
|
||||
// Curiously, blue is missing. No idea why there's an intermediary to the RGB values!
|
||||
u8 COLOR_SELECTOR[] = { 1, 7, 3, 4, 0, 6, 5, 0 };
|
||||
|
||||
// Each pair of 2 values here corresponds to the width of a character and the "encoding" of a character so it can draw
|
||||
u32 CHARACTER_ENCODING[] = {
|
||||
3, 0x0F6DE000, // 0
|
||||
1, 0x0F800000, // 1
|
||||
3, 0x0C4AE000, // 2
|
||||
3, 0x0E59E000, // 3
|
||||
4, 0x088AF200, // 4
|
||||
3, 0x0F39E000, // 5
|
||||
3, 0x0F3DE000, // 6
|
||||
3, 0x0E4A4000, // 7
|
||||
3, 0x0F7DE000, // 8
|
||||
3, 0x0F79E000, // 9
|
||||
3, 0x0F6FA000, // A
|
||||
3, 0x0D75C000, // B
|
||||
3, 0x0F24E000, // C
|
||||
3, 0x0D6DC000, // D
|
||||
3, 0x0F34E000, // E
|
||||
3, 0x0F348000, // F
|
||||
3, 0x0F25E000, // G
|
||||
3, 0x0B7DA000, // H
|
||||
3, 0x0E92E000, // I
|
||||
3, 0x0E928000, // J
|
||||
3, 0x0B75A000, // K
|
||||
3, 0x0924E000, // L
|
||||
5, 0x08EEB188, // M
|
||||
4, 0x09DFB900, // N
|
||||
4, 0x06999600, // O
|
||||
3, 0x0F7C8000, // P
|
||||
4, 0x069DB700, // Q
|
||||
3, 0x0F7EA000, // R
|
||||
3, 0x0F39E000, // S
|
||||
3, 0x0E924000, // T
|
||||
4, 0x09999600, // U
|
||||
5, 0x08C62A20, // V
|
||||
5, 0x08C63550, // W
|
||||
3, 0x0B55A000, // X
|
||||
3, 0x0B79E000, // Y
|
||||
4, 0x0F124F00, // Z
|
||||
1, 0x00800000, // .
|
||||
1, 0x05000000, // :
|
||||
3, 0x00380000, // -
|
||||
2, 0x00000000 //
|
||||
};
|
||||
|
||||
s16 startingXCoordinate = 0;
|
||||
s16 largeYCoordinate = 0;
|
||||
s16 cursorPosition = 0;
|
||||
s16 startingYCoordinate = 0;
|
||||
s16 currentColor = 0;
|
||||
s16 isThreadLocked = FALSE;
|
||||
s16 currentFontSize = 0; // "Font size", but really it's closer to pixel size
|
||||
s16 largeValueCursorPosition = 0;
|
||||
s16 longestLineLengthPosition = 0;
|
||||
u8 shouldClearText = FALSE;
|
||||
s32 clearTime = 0;
|
||||
|
||||
char CHARACTER_RANGE[] = { 'a','z','A','Z','0','9','.',':', '-', ' ' };
|
||||
|
||||
/* .h */
|
||||
void gcdebugText_wrapToTop(void);
|
||||
void gcdebugText_printSpace(void);
|
||||
void gcdebugText_endLine(void);
|
||||
|
||||
/* code */
|
||||
void setRGB(s32 r, s32 g, s32 b) {
|
||||
red = r;
|
||||
green = g;
|
||||
blue = b;
|
||||
}
|
||||
|
||||
void setPixelInFrameBuffer(s32 x, s32 y) {
|
||||
if (((x >= 0) && (x < gFramebufferWidth))
|
||||
&& ((y >= 0) && (y < gFramebufferHeight))) {
|
||||
|
||||
gFramebuffers[0][x + y * gFramebufferWidth] = _SHIFTL(red >> 3, 11, 5) | _SHIFTL(green >> 3, 6, 5) | _SHIFTL(blue >> 3, 1, 5) | _SHIFTL(1, 0, 1);
|
||||
gFramebuffers[1][x + y * gFramebufferWidth] = _SHIFTL(red >> 3, 11, 5) | _SHIFTL(green >> 3, 6, 5) | _SHIFTL(blue >> 3, 1, 5) | _SHIFTL(1, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Starts the drawing of the pixel at the x and y coordinates, and continues drawing until the w and h coordinates
|
||||
void drawPixel(s32 x, s32 y, s32 w, s32 h) {
|
||||
s32 iy;
|
||||
s32 ix;
|
||||
|
||||
for (ix = 0; ix < w; ix++) {
|
||||
for (iy = 0; iy < h; iy++) {
|
||||
setPixelInFrameBuffer(x + ix, y + iy);
|
||||
}
|
||||
}
|
||||
|
||||
osWriteBackDCacheAll();
|
||||
}
|
||||
|
||||
// Sets the color and draws a square
|
||||
void drawSquare(s32 r, s32 g, s32 b) {
|
||||
setRGB(r, g, b);
|
||||
drawPixel((gFramebufferWidth - 128) / 2, (gFramebufferHeight - 100) / 2, 128, 100);
|
||||
}
|
||||
|
||||
void gcdebugText_empty(void) { }
|
||||
|
||||
// Wastes time, and doesn't trigger isThreadLocked
|
||||
void gcdebugText_stallOnThread(void) {
|
||||
s32 i;
|
||||
for (i = 0; i < 2000000; i++) {
|
||||
gcdebugText_empty();
|
||||
}
|
||||
}
|
||||
|
||||
// Flashes a colored square in the middle of the screen permanently
|
||||
void gcdebugText_flashSquare(s32 color) {
|
||||
do {
|
||||
drawSquare(RGB_VALUES[color][0], RGB_VALUES[color][1], RGB_VALUES[color][2]);
|
||||
gcdebugText_stallOnThread();
|
||||
drawSquare(0, 0, 0);
|
||||
gcdebugText_stallOnThread();
|
||||
} while (TRUE);
|
||||
}
|
||||
|
||||
// Draws a colored square in the middle of the screen and replaces it with black
|
||||
void gcdebugText_drawSquare(s32 color) {
|
||||
drawSquare(RGB_VALUES[color][0], RGB_VALUES[color][1], RGB_VALUES[color][2]);
|
||||
gcdebugText_stallOnThread();
|
||||
drawSquare(0, 0, 0);
|
||||
gcdebugText_stallOnThread();
|
||||
}
|
||||
|
||||
// Draws a square, but doesn't replace with black and doesn't hold it on screen
|
||||
void gcdebugText_drawSquareOnly(s32 color) {
|
||||
drawSquare(RGB_VALUES[color][0], RGB_VALUES[color][1], RGB_VALUES[color][2]);
|
||||
}
|
||||
|
||||
// Draws the character and the background.
|
||||
// keepCursor: When true, does not advance to the next character and keeps an imaginary "cursor" in place before drawing the next
|
||||
// setBackgroundColorBlack: When true, sets the color to black for the background. Kind of just draws boxes otherwise
|
||||
void drawCharacter(s32 colorSelect, s32 displayCharacter, s32 fontSize, s32 keepCursor, bool setBackgroundColorBlack, s32 r, s32 g, s32 b) {
|
||||
s32 j;
|
||||
s32 i;
|
||||
u32 char_width;
|
||||
u32 encoding;
|
||||
s32 y_position;
|
||||
u32 encoding_mask;
|
||||
u32 *encoding_ptr = CHARACTER_ENCODING + (displayCharacter * 2);
|
||||
|
||||
encoding_mask = 0x10000000;
|
||||
char_width = encoding_ptr[0];
|
||||
encoding = encoding_ptr[1];
|
||||
|
||||
for (i = 0; i < 5; i++) { // For each column; the height of these characters is 5 "pixels"
|
||||
y_position = i * fontSize;
|
||||
for (j = 0; j != char_width; j++) {
|
||||
encoding_mask >>= 1; // Bitwise right shift 1
|
||||
if (encoding & encoding_mask) {
|
||||
setRGB(r, g, b);
|
||||
drawPixel((cursorPosition + fontSize * j) - keepCursor,
|
||||
(startingYCoordinate + y_position) - keepCursor,
|
||||
(fontSize + keepCursor) + keepCursor,
|
||||
(fontSize + keepCursor) + keepCursor);
|
||||
} else {
|
||||
if (setBackgroundColorBlack != 0) { // Set color to black for the background
|
||||
setRGB(0, 0, 0);
|
||||
}
|
||||
|
||||
drawPixel((cursorPosition + fontSize * j) - keepCursor,
|
||||
(startingYCoordinate + y_position) - keepCursor,
|
||||
(fontSize + keepCursor) + keepCursor,
|
||||
(fontSize + keepCursor) + keepCursor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Advance to the next character
|
||||
if (keepCursor == 0) {
|
||||
cursorPosition += (char_width * fontSize) + 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Seems unneeded, since text is cleared anyway
|
||||
void gcdebugText_clearText(void) {
|
||||
s32 i;
|
||||
|
||||
if (clearTime == 0) {
|
||||
clearTime = globalTimer_getTime();
|
||||
return;
|
||||
}
|
||||
|
||||
if (globalTimer_getTime() != clearTime) {
|
||||
shouldClearText = FALSE;
|
||||
clearTime = globalTimer_getTime();
|
||||
}
|
||||
|
||||
if (shouldClearText) {
|
||||
for (i = 0; i < gFramebufferWidth * gFramebufferHeight; i++) {
|
||||
gFramebuffers[0][i] = 0;
|
||||
gFramebuffers[1][i] = 0;
|
||||
}
|
||||
osWriteBackDCacheAll();
|
||||
}
|
||||
}
|
||||
|
||||
// Draw both the character and the background
|
||||
void printCharacter(s32 colorSelect, s32 displayCharacter, s32 fontSize) {
|
||||
drawCharacter(colorSelect, displayCharacter, fontSize, TRUE, TRUE, 0, 0, 0);
|
||||
drawCharacter(colorSelect, displayCharacter, fontSize, FALSE, TRUE,
|
||||
RGB_VALUES[COLOR_SELECTOR[colorSelect]][0],
|
||||
RGB_VALUES[COLOR_SELECTOR[colorSelect]][1],
|
||||
RGB_VALUES[COLOR_SELECTOR[colorSelect]][2]);
|
||||
}
|
||||
|
||||
void printValue(s32 colorSelect, s32 displayValue, s32 fontSize) {
|
||||
s32 j, i;
|
||||
|
||||
cursorPosition = startingXCoordinate;
|
||||
currentFontSize = fontSize;
|
||||
|
||||
if (displayValue < 0) {
|
||||
printCharacter(colorSelect, 0x26, fontSize); // Print - character
|
||||
displayValue *= -1; // Convert to positive for the next calculation
|
||||
}
|
||||
|
||||
// Sets i to a power of 10 with length equal to the given.
|
||||
// IE: 150 sets i to 100, 3500 sets i to 1000
|
||||
for (i = 1000000000; i >= 10 && displayValue < i; i /= 10) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Print each individual digit in the given value
|
||||
for (i = i; i >= 10; i /= 10) {
|
||||
for (j = 0; displayValue >= i; j++) {
|
||||
displayValue -= i;
|
||||
}
|
||||
|
||||
printCharacter(colorSelect, j, fontSize);
|
||||
}
|
||||
|
||||
printCharacter(colorSelect, displayValue, fontSize);
|
||||
gcdebugText_printSpace();
|
||||
|
||||
if (fontSize == 7) { // Corresponds to largeValue
|
||||
largeValueCursorPosition = cursorPosition;
|
||||
longestLineLengthPosition = 0;
|
||||
} else if (cursorPosition >= longestLineLengthPosition) {
|
||||
longestLineLengthPosition = cursorPosition;
|
||||
}
|
||||
}
|
||||
|
||||
// Prints a value to the screen, but always in the same place in the upper left.
|
||||
// Subsequent calls in the same frame will overwrite what's there
|
||||
void gcdebugText_showLargeValue(s32 colorSelect, s32 displayValue) {
|
||||
isThreadLocked = FALSE;
|
||||
currentColor = colorSelect;
|
||||
startingXCoordinate = 0xE;
|
||||
startingYCoordinate = 0xA;
|
||||
printValue(colorSelect, displayValue, 7);
|
||||
gcdebugText_wrapToTop();
|
||||
largeYCoordinate = startingYCoordinate;
|
||||
longestLineLengthPosition = startingXCoordinate;
|
||||
shouldClearText = TRUE;
|
||||
}
|
||||
|
||||
void gcdebugText_showValue(s32 displayValue) {
|
||||
printValue(currentColor, displayValue, 2);
|
||||
gcdebugText_wrapToTop();
|
||||
}
|
||||
|
||||
// Given a value such as 0x0F64 will print on screen ":0F64"
|
||||
void gcdebugText_showHexValue(u32 displayValue) {
|
||||
s32 display_character;
|
||||
|
||||
cursorPosition = startingXCoordinate;
|
||||
currentFontSize = 2;
|
||||
printCharacter(currentColor, 0x25, 2); // Print :
|
||||
display_character =
|
||||
(displayValue >= 0x01000000U) ? 0x1C
|
||||
: (displayValue >= 0x10000U) ? 0x14
|
||||
: 0xC;
|
||||
|
||||
if (display_character >= 0) {
|
||||
do {
|
||||
printCharacter(currentColor, ((s32) displayValue >> display_character) & 0xF, 2);
|
||||
display_character -= 4;
|
||||
} while (display_character >= 0);
|
||||
}
|
||||
|
||||
gcdebugText_endLine();
|
||||
}
|
||||
|
||||
// Possibly bugged
|
||||
void gcdebugText_showFloat(f32 displayValue) {
|
||||
f32 display_position;
|
||||
s32 display_character;
|
||||
|
||||
cursorPosition = startingXCoordinate;
|
||||
currentFontSize = 2;
|
||||
|
||||
// If a negative number, print the - symbol and convert the number to positive
|
||||
if (displayValue < 0.0f) {
|
||||
printCharacter(currentColor, 0x26, 2);
|
||||
displayValue *= -1.0f;
|
||||
}
|
||||
|
||||
display_position = 1e+09;
|
||||
|
||||
while ((display_position >= 10.0f) && (displayValue < display_position)) {
|
||||
display_position /= 10.0f;
|
||||
}
|
||||
|
||||
while (1e-09 <= display_position) {
|
||||
if ((0.09 < display_position) && (display_position < 0.11)) {
|
||||
printCharacter(currentColor, 0x24, 2); // . character
|
||||
}
|
||||
|
||||
display_character = 0;
|
||||
while (display_position <= displayValue) {
|
||||
displayValue -= display_position;
|
||||
display_character += 1;
|
||||
}
|
||||
printCharacter(currentColor, display_character, 2);
|
||||
display_position /= 10.0f;
|
||||
}
|
||||
|
||||
gcdebugText_endLine();
|
||||
}
|
||||
|
||||
// Turns characters into the corresponding number for CHARACTER_ENCODING
|
||||
s32 encodeCharacter(s32 character) {
|
||||
|
||||
// Lowercase letters
|
||||
if ((character >= (s32) CHARACTER_RANGE[0]) && ((s32) CHARACTER_RANGE[1] >= character)) {
|
||||
return (character - CHARACTER_RANGE[0]) + 0xA;
|
||||
}
|
||||
|
||||
// Uppercase letters
|
||||
if ((character >= (s32) CHARACTER_RANGE[2]) && ((s32) CHARACTER_RANGE[3] >= character)) {
|
||||
return (character - CHARACTER_RANGE[2]) + 0xA;
|
||||
}
|
||||
|
||||
// Numbers
|
||||
if ((character >= (s32) CHARACTER_RANGE[4]) && ((s32) CHARACTER_RANGE[5] >= character)) {
|
||||
return (character - CHARACTER_RANGE[4]);
|
||||
}
|
||||
|
||||
// .
|
||||
if (character == CHARACTER_RANGE[6]) {
|
||||
return 0x24;
|
||||
}
|
||||
|
||||
// :
|
||||
if (character == CHARACTER_RANGE[7]) {
|
||||
return 0x25;
|
||||
}
|
||||
|
||||
// -
|
||||
if (character == CHARACTER_RANGE[8]) {
|
||||
return 0x26;
|
||||
}
|
||||
|
||||
// (space)
|
||||
if (character == CHARACTER_RANGE[9]) {
|
||||
return 0x27;
|
||||
}
|
||||
|
||||
return 0x27;
|
||||
}
|
||||
|
||||
// Prints text to the screen. Note that it uses the current color value and isn't set here. Example usage:
|
||||
// u8 str[] = " Banjo Kazooie";
|
||||
// gcdebugText_showText(str);
|
||||
void gcdebugText_showText(u8 *text) {
|
||||
s32 i;
|
||||
s32 character;
|
||||
|
||||
cursorPosition = startingXCoordinate;
|
||||
currentFontSize = 2;
|
||||
|
||||
for (i = 0; text[i] != 0; i++) {
|
||||
character = text[i];
|
||||
printCharacter(currentColor, encodeCharacter(character), 2);
|
||||
}
|
||||
|
||||
gcdebugText_endLine();
|
||||
}
|
||||
|
||||
// Lock up the thread and show what's on the screen permanently.
|
||||
// Likely used for showing a value and keeping it there.
|
||||
void gcdebugText_lockScreen(void) {
|
||||
isThreadLocked = TRUE;
|
||||
do { } while (1);
|
||||
}
|
||||
|
||||
// Temporarily stop the thread, presumably to show the value
|
||||
void gcdebugText_pauseThread(void) {
|
||||
s32 i;
|
||||
|
||||
isThreadLocked = TRUE;
|
||||
|
||||
for (i = 30000000; i != 0; i--) { }
|
||||
|
||||
isThreadLocked = FALSE;
|
||||
}
|
||||
|
||||
void gcdebugText_pauseThreadForTime(s32 time) {
|
||||
s32 i;
|
||||
|
||||
isThreadLocked = TRUE;
|
||||
|
||||
while (time != 0) {
|
||||
for (i = 30000000; i != 0; i--) { }
|
||||
time--;
|
||||
}
|
||||
|
||||
isThreadLocked = FALSE;
|
||||
}
|
||||
|
||||
void checkYAndgcdebugText_wrapToTop(s32 lineHeight) {
|
||||
startingYCoordinate += lineHeight;
|
||||
|
||||
// Only continue if the y coordinate is about to go off screen
|
||||
if (startingYCoordinate < 0xCD) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Back the cursor to the top of the screen, and move it to the end of the existing line
|
||||
startingXCoordinate = longestLineLengthPosition + 4;
|
||||
cursorPosition = startingXCoordinate;
|
||||
startingYCoordinate = (largeValueCursorPosition < cursorPosition) ? 0xA : largeYCoordinate;
|
||||
longestLineLengthPosition = 0;
|
||||
}
|
||||
|
||||
// Calculate line height and wrap
|
||||
void gcdebugText_wrapToTop(void) {
|
||||
checkYAndgcdebugText_wrapToTop(currentFontSize * 5 + 2);
|
||||
}
|
||||
|
||||
// Unused, but possibly used for very tiny debugs
|
||||
void gcdebugText_wrapToTopSmall(void) {
|
||||
checkYAndgcdebugText_wrapToTop(2);
|
||||
}
|
||||
|
||||
void gcdebugText_endLine(void) {
|
||||
gcdebugText_printSpace();
|
||||
|
||||
if (cursorPosition >= longestLineLengthPosition) {
|
||||
longestLineLengthPosition = cursorPosition;
|
||||
}
|
||||
|
||||
gcdebugText_wrapToTop();
|
||||
}
|
||||
|
||||
void gcdebugText_printSpace(void) {
|
||||
s16 tempCursorPosition;
|
||||
|
||||
tempCursorPosition = cursorPosition--;
|
||||
printCharacter(currentColor, 0x27, currentFontSize);
|
||||
cursorPosition = tempCursorPosition;
|
||||
}
|
||||
|
||||
s32 gcdebugText_isThreadLocked(void) {
|
||||
return isThreadLocked;
|
||||
}
|
||||
|
||||
void gcdebugText_unused(s32 arg0) { }
|
||||
|
||||
#endif
|
@@ -371,7 +371,7 @@ void *malloc(s32 size){
|
||||
|
||||
if(!(v1 = func_80254B84(0))){
|
||||
if(!func_80254B84(0))
|
||||
func_802F1294(); //particleEmitters
|
||||
pem_freeEmitters(); //particleEmitters
|
||||
|
||||
if(!func_80254B84(0))
|
||||
animBinCache_flushStale(1); //persistent anim
|
||||
@@ -462,7 +462,7 @@ void _heap_sortEmptyBlock(EmptyHeapBlock * arg0){
|
||||
}
|
||||
}
|
||||
|
||||
void free(void * ptr){
|
||||
void free(void * ptr) {
|
||||
HeapHeader *sPtr; //stack_ptr
|
||||
|
||||
if(ptr){
|
||||
|
718
src/core1/musicplayer.c
Normal file
718
src/core1/musicplayer.c
Normal file
@@ -0,0 +1,718 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "musicplayer.h"
|
||||
|
||||
#include "core1/core1.h"
|
||||
|
||||
extern func_8024FDDC(u8, s32);
|
||||
|
||||
void func_8025AE50(s32, f32);
|
||||
|
||||
bool func_80250074(u8);
|
||||
void musicTrack_setVolume(u8, s32);
|
||||
void func_8024FC1C(u8, s32);
|
||||
void func_8025AC20(enum comusic_e, s32, s32, f32, char*, s32);
|
||||
void func_8025AC7C(enum comusic_e, s32, s32, f32, s32 *, char*, s32);
|
||||
void coMusicPlayer_free(void);
|
||||
void func_8025A55C(s32, s32, s32);
|
||||
void func_8025A7DC(enum comusic_e);
|
||||
void func_8025ABB8(enum comusic_e, s32, s32, s32);
|
||||
void *freelist_next(FLA **, s32*);
|
||||
|
||||
CoMusic *musicTracks = NULL; // Pointer to the first CoMusic struct. Additional are saved after in memory. The first track is the primary track.
|
||||
int D_80276E34 = 0;
|
||||
|
||||
/**
|
||||
* @brief returns a pointer to the CoMusic struct with the corresponding trackId
|
||||
* if it exists OR the first free CoMusic struct. This also skips the first CoMusic in the search.
|
||||
*
|
||||
* @param trackId
|
||||
* @return CoMusic*
|
||||
*/
|
||||
CoMusic *findTrack(enum comusic_e trackId) {
|
||||
CoMusic *music_track;
|
||||
CoMusic *free_music_track;
|
||||
|
||||
free_music_track = NULL;
|
||||
|
||||
for (music_track = musicTracks + 1; music_track < musicTracks + MAX_MUSIC_STRUCT_COUNT - 1; music_track++) {
|
||||
if (trackId == music_track->track_id) {
|
||||
return music_track;
|
||||
}
|
||||
|
||||
if (free_music_track == NULL && (s32) music_track->track_id < 0) {
|
||||
free_music_track = music_track;
|
||||
}
|
||||
}
|
||||
|
||||
return free_music_track;
|
||||
}
|
||||
|
||||
void func_80259914(CoMusic *this, s32 arg1, s32 arg2) {
|
||||
s32 sp2C;
|
||||
s32 i;
|
||||
struct12s *tmp;
|
||||
|
||||
freelist_clear(this->unk18);
|
||||
|
||||
for (i = 0; i < 0xE; i++) {
|
||||
this->unk1C[i] = 0;
|
||||
}
|
||||
|
||||
tmp = (struct12s *)freelist_next(&this->unk18, &sp2C);
|
||||
tmp->unk0 = arg1;
|
||||
tmp->unk1 = arg2;
|
||||
}
|
||||
|
||||
void func_80259994(CoMusic *this, s32 arg1){
|
||||
func_80259914(this, arg1, arg1);
|
||||
}
|
||||
|
||||
void func_802599B4(CoMusic *this){
|
||||
func_80259994(this, gcMusic_getDefaultVolumeForTrack(this->track_id));
|
||||
|
||||
this->track_id = -1;
|
||||
this->unk14 = 0;
|
||||
this->unk15 = 0;
|
||||
|
||||
func_8024FC1C(this - musicTracks, -1);
|
||||
}
|
||||
|
||||
void coMusicPlayer_init(void) {
|
||||
CoMusic * iPtr;
|
||||
s32 i;
|
||||
|
||||
if (musicTracks != NULL) {
|
||||
coMusicPlayer_free();
|
||||
}
|
||||
|
||||
musicTracks = (CoMusic *) malloc(MAX_MUSIC_STRUCT_COUNT * sizeof(CoMusic));
|
||||
for (iPtr = musicTracks; iPtr < musicTracks + MAX_MUSIC_STRUCT_COUNT; iPtr++) {
|
||||
iPtr->track_id = -1;
|
||||
iPtr->volume = 0;
|
||||
iPtr->unk12 = 0;
|
||||
iPtr->unkC = 0;
|
||||
iPtr->unk4 = 0.0f;
|
||||
iPtr->unk14 = 0;
|
||||
iPtr->unk15 = 0;
|
||||
iPtr->unk0 = 0.0f;
|
||||
iPtr->unk18 = (FREE_LIST(struct12s) *)freelist_new(sizeof(struct12s),4);
|
||||
|
||||
for (i = 0; i < 0xE; i++) {
|
||||
iPtr->unk1C[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void coMusicPlayer_free(void){
|
||||
CoMusic *iPtr;
|
||||
|
||||
func_8024FB8C();
|
||||
func_8024F83C();
|
||||
|
||||
for (iPtr = musicTracks; iPtr < musicTracks + MAX_MUSIC_STRUCT_COUNT; iPtr++) {
|
||||
freelist_free(iPtr->unk18);
|
||||
}
|
||||
|
||||
free(musicTracks);
|
||||
musicTracks = NULL;
|
||||
}
|
||||
|
||||
s32 coMusicPlayer_getTrackCount(void) {
|
||||
CoMusic *track;
|
||||
s32 count = 0;
|
||||
|
||||
for (track = musicTracks; track < musicTracks + MAX_MUSIC_STRUCT_COUNT; track++) {
|
||||
if (track->track_id >= 0) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
void coMusicPlayer_update(void) {
|
||||
s32 temp_lo;
|
||||
CoMusic *var_s0;
|
||||
f32 dt;
|
||||
|
||||
dt = time_getDelta();
|
||||
|
||||
for (var_s0 = musicTracks; var_s0 < &musicTracks[MAX_MUSIC_STRUCT_COUNT]; var_s0++) {
|
||||
if (var_s0->track_id >= 0) {
|
||||
temp_lo = var_s0 - musicTracks;
|
||||
var_s0->unk4 = ml_min_f(var_s0->unk4 + dt, 600.0f);
|
||||
|
||||
if ((var_s0->unk4 > 1.0f) && func_80250074(temp_lo)) {
|
||||
func_8025A7DC(var_s0->track_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func_8024FF34();
|
||||
|
||||
if (!D_80276E34) {
|
||||
return;
|
||||
}
|
||||
|
||||
D_80276E34 = FALSE;
|
||||
|
||||
for (var_s0 = musicTracks; var_s0 < &musicTracks[6]; var_s0++) {
|
||||
if (var_s0->track_id < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (var_s0->unk12 != 0) {
|
||||
temp_lo = var_s0 - musicTracks;
|
||||
|
||||
if (var_s0->unk0 > 0.0f) {
|
||||
var_s0->unk0 -= time_getDelta();
|
||||
D_80276E34 = TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (var_s0->unk12 < 0) {
|
||||
var_s0->volume += var_s0->unk12;
|
||||
|
||||
if (var_s0->unk15 && (var_s0->unkC == 0) && (var_s0->volume <= 0)) {
|
||||
func_802599B4(var_s0);
|
||||
continue;
|
||||
} else {
|
||||
if (var_s0->unkC >= var_s0->volume) {
|
||||
var_s0->volume = var_s0->unkC;
|
||||
var_s0->unk12 = 0;
|
||||
} else {
|
||||
D_80276E34 = TRUE;
|
||||
}
|
||||
musicTrack_setVolume(temp_lo, (s16)var_s0->volume);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (var_s0->volume < var_s0->unkC) {
|
||||
if (var_s0->volume == 0) {
|
||||
var_s0->unk4 = 0.0f;
|
||||
}
|
||||
var_s0->volume += var_s0->unk12;
|
||||
if (var_s0->volume >= var_s0->unkC) {
|
||||
var_s0->volume = var_s0->unkC;
|
||||
var_s0->unk12 = 0;
|
||||
} else {
|
||||
D_80276E34 = TRUE;
|
||||
}
|
||||
musicTrack_setVolume(temp_lo, (s16)var_s0->volume);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
var_s0->unk12 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_80259EA8(CoMusic *this, s32 *arg1, s32 *arg2){
|
||||
int i;
|
||||
int cnt = freelist_size(this->unk18);
|
||||
s32 tmp_s1 = 0x7FFF;
|
||||
s32 tmp_s2 = 0x40000000;
|
||||
struct12s *tmp_ptr;
|
||||
|
||||
for (i = 1; i < cnt; i++) {
|
||||
if (freelist_elementIsAlive(this->unk18, i)) {
|
||||
tmp_ptr = (struct12s*)freelist_at(this->unk18, i);
|
||||
|
||||
if (tmp_ptr->unk0 < tmp_s1 || (tmp_s1 == tmp_ptr->unk0 && tmp_ptr->unk1 < tmp_s2)) {
|
||||
tmp_s1 = tmp_ptr->unk0;
|
||||
tmp_s2 = tmp_ptr->unk1;
|
||||
}//L80259F40
|
||||
}
|
||||
}
|
||||
|
||||
*arg1 = tmp_s1;
|
||||
*arg2 = tmp_s2;
|
||||
}
|
||||
|
||||
void func_80259F7C(CoMusic *self, s32 *arg1, s32 *arg2, s32 *arg3) {
|
||||
struct12s *temp_v0;
|
||||
f32 pad;
|
||||
s32 sp34;
|
||||
s32 var_s2;
|
||||
|
||||
var_s2 = *arg1;
|
||||
sp34 = *arg2;
|
||||
if ((*arg3 != 0) && !freelist_elementIsAlive(self->unk18, *arg3)) {
|
||||
*arg3 = 0;
|
||||
}
|
||||
|
||||
if (var_s2 < 0) {
|
||||
temp_v0 = (struct12s *)freelist_at(self->unk18, 1);
|
||||
if (temp_v0->unk0 < gcMusic_getDefaultVolumeForTrack(self->track_id)) {
|
||||
var_s2 = gcMusic_getDefaultVolumeForTrack(self->track_id);
|
||||
} else {
|
||||
var_s2 = temp_v0->unk0;
|
||||
}
|
||||
|
||||
if (*arg3 != 0) {
|
||||
temp_v0 = (struct12s *)freelist_at(self->unk18, *arg3);
|
||||
*arg2 = temp_v0->unk1;
|
||||
freelist_freeElement(self->unk18, *arg3);
|
||||
*arg3 = 0;
|
||||
func_80259EA8(self, arg1, &sp34);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (*arg3 == 0) {
|
||||
temp_v0 = (struct12s *)freelist_at(self->unk18, 1);
|
||||
if ((temp_v0->unk0 < var_s2) || ((var_s2 == temp_v0->unk0) && (sp34 >= temp_v0->unk1))) {
|
||||
func_80259914(self, var_s2, sp34);
|
||||
} else {
|
||||
freelist_next(&self->unk18, arg3);
|
||||
}
|
||||
}
|
||||
|
||||
if (*arg3 != 0) {
|
||||
temp_v0 = (struct12s *)freelist_at(self->unk18, *arg3);
|
||||
temp_v0->unk0 = var_s2;
|
||||
temp_v0->unk1 = sp34;
|
||||
}
|
||||
|
||||
func_80259EA8(self, arg1, arg2);
|
||||
}
|
||||
|
||||
void func_8025A104(enum comusic_e arg0, s32 arg1){
|
||||
if (arg0 != musicTracks[0].track_id){
|
||||
func_8024FC1C(0, arg0);
|
||||
}
|
||||
|
||||
musicTrack_setVolume(0, (s16)arg1);
|
||||
musicTracks[0].track_id = (s16) arg0;
|
||||
musicTracks[0].volume = arg1;
|
||||
musicTracks[0].unk0 = 0.0f;
|
||||
musicTracks[0].unk12 = 0;
|
||||
musicTracks[0].unk4 = 0.0f;
|
||||
musicTracks[0].unk15 = 0;
|
||||
func_80259994(&musicTracks[0], arg1);
|
||||
}
|
||||
|
||||
void func_8025A1A8(enum comusic_e arg0){
|
||||
if (arg0 == musicTracks[0].track_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
func_8024FC1C(0, arg0);
|
||||
|
||||
musicTracks[0].track_id = (s16) arg0;
|
||||
musicTracks[0].volume = gcMusic_getDefaultVolumeForTrack(arg0);
|
||||
musicTracks[0].unk0 = 0.0f;
|
||||
musicTracks[0].unk12 = 0;
|
||||
musicTracks[0].unk4 = 0.0f;
|
||||
musicTracks[0].unk15 = 0;
|
||||
|
||||
func_80259994(&musicTracks[0], musicTracks[0].volume);
|
||||
}
|
||||
|
||||
void func_8025A23C(s32 arg0){
|
||||
CoMusic *music = &musicTracks[5];
|
||||
s32 temp_v0;
|
||||
|
||||
if (arg0 == music->track_id){
|
||||
return;
|
||||
}
|
||||
|
||||
func_8024FC1C(5, arg0);
|
||||
music->track_id = (s16) arg0;
|
||||
temp_v0 = gcMusic_getDefaultVolumeForTrack(arg0);
|
||||
music->volume = temp_v0;
|
||||
music->unk12 = 0;
|
||||
music->unk15 = 0;
|
||||
music->unk0 = 0.0f;
|
||||
music->unk4 = 0.0f;
|
||||
func_80259994(music, temp_v0);
|
||||
}
|
||||
|
||||
void func_8025A2B0(void) {
|
||||
func_802599B4(&musicTracks[5]);
|
||||
}
|
||||
|
||||
void func_8025A2D8(void) {
|
||||
func_802599B4(&musicTracks[0]);
|
||||
}
|
||||
|
||||
void func_8025A2FC(s32 arg0, s32 arg1){
|
||||
s32 i;
|
||||
|
||||
func_8025A55C(arg0, arg1, 1);
|
||||
for (i = 1; i < 5; i++){
|
||||
s16 val = (i + musicTracks)->track_id; // Doesn't match with musicTracks[i]
|
||||
if (val >= 0){
|
||||
func_8025ABB8(val, arg0, arg1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_8025A388(s32 arg0, s32 arg1) {
|
||||
s32 i;
|
||||
|
||||
if (musicTracks->unk14 == 0){
|
||||
func_8025A55C(arg0, arg1, 1);
|
||||
}
|
||||
|
||||
for (i = 1; i < 5; i++) {
|
||||
CoMusic *current = (i + musicTracks); // Doesn't match with musicTracks[i]
|
||||
|
||||
if (current->track_id >= 0 && current->unk14 == 0) {
|
||||
func_8025ABB8(current->track_id, arg0, arg1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_8025A430(s32 arg0, s32 arg1, s32 arg2){
|
||||
s32 i;
|
||||
|
||||
func_8025A55C(arg0, arg1, arg2);
|
||||
|
||||
for (i = 1; i < 5; i++) {
|
||||
s16 val = (i + musicTracks)->track_id; // Doesn't match with musicTracks[i]
|
||||
|
||||
if (val >= 0) {
|
||||
func_8025ABB8(val, arg0, arg1, arg2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_8025A4C4(s32 arg0, s32 arg1, s32 *arg2) {
|
||||
if (musicTracks[0].track_id < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
func_80259F7C(&musicTracks[0], &arg0, &arg1, arg2);
|
||||
|
||||
if (arg0 != musicTracks[0].volume) {
|
||||
if (musicTracks[0].volume < arg0) {
|
||||
musicTracks[0].unk12 = arg1;
|
||||
} else {
|
||||
musicTracks[0].unk12 = -arg1;
|
||||
}
|
||||
|
||||
musicTracks[0].unkC = arg0;
|
||||
D_80276E34 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void func_8025A55C(s32 arg0, s32 arg1, s32 arg2) {
|
||||
func_8025A4C4(arg0, arg1, &musicTracks->unk1C[arg2]);
|
||||
}
|
||||
|
||||
void func_8025A58C(s32 arg0, s32 arg1) {
|
||||
func_8025A55C(arg0, arg1, 0);
|
||||
}
|
||||
|
||||
void playMusic(enum comusic_e comusic_id, s32 volume, s32 forceReInit) {
|
||||
CoMusic *track;
|
||||
s32 index;
|
||||
|
||||
if (volume == -1) {
|
||||
volume = gcMusic_getDefaultVolumeForTrack(comusic_id);
|
||||
}
|
||||
|
||||
track = findTrack(comusic_id);
|
||||
|
||||
if (track == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
index = track - musicTracks;
|
||||
|
||||
// Initialize the track if findTrack returned an empty
|
||||
if (track->track_id < 0 || forceReInit) {
|
||||
switch (comusic_id) {
|
||||
case COMUSIC_15_EXTRA_LIFE_COLLECTED:
|
||||
if (map_get() == MAP_10_BGS_MR_VILE) {
|
||||
break;
|
||||
}
|
||||
case COMUSIC_3B_MINIGAME_VICTORY:
|
||||
case COMUSIC_3C_MINIGAME_LOSS:
|
||||
func_8025AE50(4000, 2.0f);
|
||||
}
|
||||
|
||||
track->track_id = comusic_id;
|
||||
track->unk12 = 0;
|
||||
track->unk15 = 0;
|
||||
track->unk4 = 0.0f;
|
||||
func_80259994(track, volume);
|
||||
func_8024FC1C(index, comusic_id);
|
||||
}
|
||||
|
||||
musicTrack_setVolume(index, (s16) volume);
|
||||
track->volume = volume;
|
||||
}
|
||||
|
||||
// If findTrack returns the track, then do not re-initialize; just adust the volume
|
||||
void coMusicPlayer_playMusicWeak(enum comusic_e track_id, s32 volume) {
|
||||
playMusic(track_id, volume, FALSE);
|
||||
}
|
||||
|
||||
// Plays the track and reinitializes it
|
||||
void coMusicPlayer_playMusic(enum comusic_e track_id, s32 volume) {
|
||||
playMusic(track_id, volume, TRUE);
|
||||
}
|
||||
|
||||
//comusic_queueTrack
|
||||
void comusic_playTrack(enum comusic_e track_id) {
|
||||
CoMusic *trackPtr;
|
||||
s32 indx;
|
||||
|
||||
trackPtr = findTrack(track_id);
|
||||
|
||||
if (trackPtr == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
indx = trackPtr - musicTracks;
|
||||
|
||||
if (trackPtr->track_id < 0) {
|
||||
trackPtr->track_id = track_id;
|
||||
trackPtr->unk12 = 0;
|
||||
trackPtr->unk4 = 0.0f;
|
||||
func_8024FC1C( indx, track_id);
|
||||
func_80259994(trackPtr, trackPtr->volume = gcMusic_getDefaultVolumeForTrack(track_id));
|
||||
}
|
||||
}
|
||||
|
||||
void func_8025A788(enum comusic_e comusic_id, f32 delay1, f32 delay2) {
|
||||
timedFunc_set_1(delay1, (GenFunction_1) comusic_playTrack, comusic_id);
|
||||
timedFunc_set_1(delay1 + delay2, (GenFunction_1) func_8025A7DC, comusic_id);
|
||||
}
|
||||
|
||||
void func_8025A7DC(enum comusic_e track_id) {
|
||||
CoMusic *trackPtr;
|
||||
|
||||
trackPtr = findTrack(track_id);
|
||||
|
||||
if (trackPtr != NULL && trackPtr->track_id >= 0){
|
||||
func_802599B4(trackPtr);
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_8025A818(void) {
|
||||
if (musicTracks[0].unkC == 0 && musicTracks[0].volume <= 0){
|
||||
func_802599B4(&musicTracks[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 func_8025A864(enum comusic_e track_id){
|
||||
CoMusic *trackPtr;
|
||||
|
||||
trackPtr = findTrack(track_id);
|
||||
|
||||
if (trackPtr != NULL && trackPtr->unkC == 0 && trackPtr->volume <= 0){
|
||||
func_802599B4(trackPtr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void func_8025A8B8(enum comusic_e track_id, s32 arg1){
|
||||
CoMusic *trackPtr;
|
||||
|
||||
trackPtr = findTrack(track_id);
|
||||
|
||||
if (trackPtr != NULL){
|
||||
trackPtr->unk14 = arg1;
|
||||
}
|
||||
}
|
||||
|
||||
void func_8025A8E4(s32 arg0) {
|
||||
if (musicTracks[0].track_id < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
musicTracks[0].unk14 = arg0;
|
||||
}
|
||||
|
||||
void func_8025A904(void){
|
||||
CoMusic *trackPtr = &musicTracks[0];
|
||||
|
||||
while (trackPtr < &musicTracks[6]) {
|
||||
if (trackPtr->track_id >= 0) {
|
||||
func_802599B4(trackPtr);
|
||||
}
|
||||
|
||||
trackPtr++;
|
||||
}
|
||||
}
|
||||
|
||||
//dequeue_allTracks
|
||||
void func_8025A96C(void){
|
||||
CoMusic *iPtr;
|
||||
|
||||
for (iPtr = &musicTracks[1]; iPtr < &musicTracks[MAX_MUSIC_STRUCT_COUNT]; iPtr++) {
|
||||
if (iPtr->track_id >= 0) {
|
||||
func_802599B4(iPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//dequeue_allTracks
|
||||
void func_8025A9D4(void){
|
||||
CoMusic *iPtr;
|
||||
|
||||
for (iPtr = &musicTracks[0]; iPtr < &musicTracks[MAX_MUSIC_STRUCT_COUNT]; iPtr++) {
|
||||
if (iPtr->track_id >= 0 && !iPtr->unk14) {
|
||||
func_802599B4(iPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//dequeue_nonmainTracks
|
||||
void func_8025AA48(void){
|
||||
CoMusic *iPtr;
|
||||
|
||||
for (iPtr = &musicTracks[1]; iPtr < &musicTracks[6]; iPtr++) {
|
||||
if (iPtr->track_id >= 0 && !iPtr->unk14) {
|
||||
func_802599B4(iPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//dequeue_track?
|
||||
void func_8025AABC(enum comusic_e track_id) {
|
||||
CoMusic *trackPtr;
|
||||
|
||||
trackPtr = findTrack(track_id);
|
||||
|
||||
if (!trackPtr) {
|
||||
return;
|
||||
}
|
||||
|
||||
trackPtr->unk15 = 1;
|
||||
|
||||
if (!trackPtr->volume) {
|
||||
func_802599B4(trackPtr);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8025AB00(void) {
|
||||
musicTracks[0].unk15 = 1;
|
||||
|
||||
if (musicTracks[0].volume){
|
||||
return;
|
||||
}
|
||||
|
||||
func_802599B4(&musicTracks[0]);
|
||||
}
|
||||
|
||||
void comusic_8025AB44(enum comusic_e comusic_id, s32 arg1, s32 arg2){
|
||||
func_8025AC20(comusic_id, arg1, arg2, 0.0f, "comusic.c", VER_SELECT(0x39e, 0x39f, 0, 0));
|
||||
}
|
||||
|
||||
void comusic_8025AB78(enum comusic_e comusic_id, s32 arg1, s32 arg2, s32 arg3){
|
||||
func_8025AC7C(comusic_id, arg1, arg2, 0.0f, arg3, "comusic.c", VER_SELECT(0x3a3, 0x3a4, 0, 0));
|
||||
}
|
||||
|
||||
void func_8025ABB8(enum comusic_e comusic_id, s32 arg1, s32 arg2, s32 arg3){
|
||||
func_8025AC7C(comusic_id, arg1, arg2, 0.0f, (s32)&(findTrack(comusic_id)->unk1C[arg3]), "comusic.c", VER_SELECT(0x3aa, 0x3ab,0,0));
|
||||
}
|
||||
|
||||
void func_8025AC20(enum comusic_e comusic_id, s32 arg1, s32 arg2, f32 arg3, char* arg4, s32 char5){
|
||||
func_8025AC7C(comusic_id, arg1, arg2, 0.0f, (s32) findTrack(comusic_id)->unk1C, "comusic.c", VER_SELECT(0x3b1, 0x3b2,0,0));
|
||||
}
|
||||
|
||||
void func_8025AC7C(enum comusic_e comusic_id, s32 arg1, s32 arg2, f32 arg3, s32 *arg4, char* arg5, s32 arg6){
|
||||
CoMusic *trackPtr;
|
||||
u32 slot_index;
|
||||
|
||||
//get track location
|
||||
trackPtr = findTrack(comusic_id);
|
||||
if(trackPtr == NULL)
|
||||
return;
|
||||
|
||||
//check if track is loaded in slot
|
||||
if(trackPtr->track_id < 0){ //Track not loaded
|
||||
if(arg1 == 0)
|
||||
return;
|
||||
slot_index = (trackPtr - musicTracks);
|
||||
func_8024FC1C(slot_index, comusic_id);
|
||||
trackPtr->track_id = comusic_id;
|
||||
trackPtr->volume = 0;
|
||||
trackPtr->unk15 = 0;
|
||||
trackPtr->unk4 = 0.0f;
|
||||
func_80259994(trackPtr, 0);
|
||||
musicTrack_setVolume(slot_index, 0);
|
||||
}
|
||||
func_80259F7C(trackPtr,&arg1, &arg2, arg4);
|
||||
trackPtr->unk0 = arg3;
|
||||
trackPtr->unk12 = (trackPtr->volume < arg1)? arg2: -arg2;
|
||||
trackPtr->unkC = arg1;
|
||||
D_80276E34 = 1;
|
||||
}
|
||||
|
||||
//comusic_trackQueued
|
||||
int func_8025AD7C(enum comusic_e arg0) {
|
||||
CoMusic * trackPtr = findTrack(arg0);
|
||||
return (trackPtr == NULL || trackPtr->track_id == -1)? 0 : 1;
|
||||
}
|
||||
|
||||
//comusic_isPrimaryTrack
|
||||
int func_8025ADBC(enum comusic_e arg0) {
|
||||
return musicTracks[0].track_id == arg0;
|
||||
}
|
||||
|
||||
s32 func_8025ADD4(enum comusic_e id) {
|
||||
CoMusic * ptr = findTrack(id);
|
||||
return ptr - musicTracks;
|
||||
}
|
||||
|
||||
void func_8025AE0C(s32 arg0, f32 arg1) {
|
||||
func_8025A58C(0, arg0);
|
||||
timedFunc_set_2(arg1, (GenFunction_2)func_8025A58C, -1, arg0);
|
||||
}
|
||||
|
||||
void func_8025AE50(s32 arg0, f32 arg1) {
|
||||
func_8025A430(0, arg0, 6);
|
||||
timedFunc_set_3(arg1, (GenFunction_3)func_8025A430, -1, arg0, 6);
|
||||
}
|
||||
|
||||
void func_8025AEA0(enum comusic_e track_id, s32 arg1) {
|
||||
CoMusic *ptr = findTrack(track_id);
|
||||
|
||||
if (!ptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
func_8024FDDC(ptr - musicTracks, arg1);
|
||||
}
|
||||
|
||||
int func_8025AEEC(void) {
|
||||
s32 out = func_802501A0(0, 0x6A, 0);
|
||||
|
||||
if (out) {
|
||||
func_80250170(0, 0x6A, 0);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
void comusic_defrag(void) {
|
||||
CoMusic *iPtr;
|
||||
|
||||
if (!musicTracks) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (iPtr = &musicTracks[0]; iPtr < &musicTracks[MAX_MUSIC_STRUCT_COUNT]; iPtr++) {
|
||||
iPtr->unk18 = (FREE_LIST(struct12s) *)freelist_defrag(iPtr->unk18);
|
||||
}
|
||||
|
||||
musicTracks = (CoMusic *)defrag(musicTracks);
|
||||
}
|
1
src/core1/musicplayer.h
Normal file
1
src/core1/musicplayer.h
Normal file
@@ -0,0 +1 @@
|
||||
#define MAX_MUSIC_STRUCT_COUNT 6
|
@@ -94,7 +94,7 @@ s32 func_8024E5E8(s32 arg0, s32 arg1){
|
||||
return D_802810E0[arg0][arg1];
|
||||
}
|
||||
|
||||
s32 func_8024E60C(s32 controller_index, s32 dst[3]){
|
||||
s32 controller_copySideButtons(s32 controller_index, s32 dst[3]){
|
||||
dst[SIDE_BUTTON(BUTTON_Z)] = D_80281138[controller_index].side_button[SIDE_BUTTON(BUTTON_Z)];
|
||||
dst[SIDE_BUTTON(BUTTON_L)] = D_80281138[controller_index].side_button[SIDE_BUTTON(BUTTON_L)];
|
||||
dst[SIDE_BUTTON(BUTTON_R)] = D_80281138[controller_index].side_button[SIDE_BUTTON(BUTTON_R)];
|
||||
|
@@ -226,7 +226,7 @@ void viMgr_entry(void *arg0){
|
||||
D_802808D8++;
|
||||
if(D_802808D8 == 420){
|
||||
#if VERSION == VERSION_USA_1_0
|
||||
func_802485BC();
|
||||
gcdebugText_isThreadLocked();
|
||||
#endif
|
||||
}
|
||||
osSendMesg(&sMesgQueue3, NULL, OS_MESG_NOBLOCK);
|
||||
|
Reference in New Issue
Block a user