Merge branch 'core1_errors' into 'master'

Create header files, give better names and fix compiler warnings for core1

See merge request banjo.decomp/banjo-kazooie!167
This commit is contained in:
Cyrus Kashef
2026-08-05 00:31:11 +00:00
81 changed files with 869 additions and 761 deletions
+1 -1
View File
@@ -187,7 +187,7 @@ segments:
- [0xF59F90, hasm, bkgetsr]
- [0xF59FA0, c, code_1D5D0]
- [0xF5AD30, c, sns]
- [0xF5B0B0, c, crccalc]
- [0xF5B0B0, c, glcrc]
- [0xF5B1F0, hasm, code_1E820]
- [0xF5B290, c, n_audio/n_sl]
- [0xF5B320, c, n_audio/n_synthesizer]
+1 -1
View File
@@ -188,7 +188,7 @@ segments:
- [0xF36810, hasm, bkgetsr]
- [0xF36820, c, code_1D5D0]
- [0xF375B0, c, sns]
- [0xF37930, c, crccalc]
- [0xF37930, c, glcrc]
- [0xF37A70, hasm, code_1E820]
- [0xF37B10, c, n_audio/n_sl]
- [0xF37BA0, c, n_audio/n_synthesizer]
+16
View File
@@ -0,0 +1,16 @@
#ifndef BANJO_KAZOOIE_CORE1_AUDIOMANAGER_H
#define BANJO_KAZOOIE_CORE1_AUDIOMANAGER_H
#include <ultra64.h>
#define AUDIOMANAGER_THREAD_ID 4
#define AUDIOMANAGER_THREAD_PRI 50
void audioManager_setupSeqp(ALSeqpConfig *config);
void audioManager_init(void);
ALHeap *audioManager_getALHeapInfo(void);
OSMesgQueue *audioManager_getDMANotifyMesgQueue(void);
OSIoMesg *audioManager_getExtraDMAMesg(void);
OSMesgQueue *audioManager_getFrameMesgQueue(void);
#endif
+22
View File
@@ -0,0 +1,22 @@
#ifndef BANJO_KAZOOIE_CORE1_BAMOTOR_H
#define BANJO_KAZOOIE_CORE1_BAMOTOR_H
#include <ultra64.h>
#define BAMOTOR_THREAD_ID 8
#define BAMOTOR_THREAD_PRI 25
void baMotor_startMotor(void);
void baMotor_stopMotor(void);
void baMotor_reinitialize(void);
void baMotor_entry(void *arg);
void baMotor_80250BA4(s32 arg0, s32 arg1, s32 arg2);
void baMotor_80250C08(void);
void baMotor_init(void);
void baMotor_stub(void);
void baMotor_80250D94(f32 arg0, f32 arg1, f32 arg2);
void baMotor_80250E6C(f32 arg0, f32 arg1);
void baMotor_80250E94(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5);
void baMotor_forceStop(void);
#endif
+12 -134
View File
@@ -7,19 +7,31 @@
#include "structs.h"
#include "prop.h"
#include "core1/audiomanager.h"
#include "core1/bamotor.h"
#include "core1/debugtext.h"
#include "core1/defragthread.h"
#include "core1/depthbuffer.h"
#include "core1/eeprom.h"
#include "core1/framebufferdraw.h"
#include "core1/glcrc.h"
#include "core1/initthread.h"
#include "core1/lookup.h"
#include "core1/main.h"
#include "core1/mem.h"
#include "core1/ml.h"
#include "core1/mlmtx.h"
#include "core1/midichannel.h"
#include "core1/music.h"
#include "core1/musicplayer.h"
#include "core1/overlay.h"
#include "core1/overlaymanager.h"
#include "core1/parallel.h"
#include "core1/pfsmanager.h"
#include "core1/rarezip.h"
#include "core1/sns.h"
#include "core1/sprite.h"
#include "core1/stub_1D590.h"
#include "core1/thread5.h"
#include "core1/ucode.h"
#include "core1/viewport.h"
@@ -30,94 +42,12 @@
//void *defrag(void *);
void glcrc_calc_checksum(void *start, void *end, u32 checksum[2]);
void func_8025A104(enum comusic_e arg0, s32 arg1);
void func_8025A55C(s32 arg0, s32 arg1, s32 arg2);
s32 func_8025A864(enum comusic_e track_id);
void func_8025ABB8(enum comusic_e track_id, s32 arg1, s32 arg2, s32 arg3);
int comusic_isTrackQueued(enum comusic_e arg0);
void piMgr_read(void *vaddr, s32 devaddr, s32 size);
/* src/core1/code_1D00.c */
void audioManager_setupSeqp(ALSeqpConfig *config);
void audioManager_init(void);
ALHeap *audioManager_getALHeapInfo(void);
OSMesgQueue *audioManager_getDMANotifyMesgQueue(void);
OSIoMesg *audioManager_getExtraDMAMesg(void);
OSMesgQueue *audioManager_getFrameMesgQueue(void);
/* src/core1/overlay.c */
void overlay_load(
s32 id,
u8 *ram_start, u8 *ram_end,
u32 rom_start, u32 rom_end,
u8 *code_start, u8 *code_end,
u8 *data_start, u8 *data_end,
u8 *bss_start, u8 *bss_end
);
/* src/core1/overlaymanager.c */
#define MAKE_OVERLAY_SEGMENT_EXTERNS(segname) \
extern u8 segname##_VRAM[]; \
extern u8 segname##_VRAM_END[]; \
extern u8 segname##_ROM_START[]; \
extern u8 segname##_ROM_END[]; \
extern u8 segname##_TEXT_START[]; \
extern u8 segname##_TEXT_END[]; \
extern u8 segname##_DATA_START[]; \
extern u8 segname##_DATA_END[]; \
extern u8 segname##_RODATA_START[]; \
extern u8 segname##_RODATA_END[]; \
extern u8 segname##_BSS_START[]; \
extern u8 segname##_BSS_END[];
#define MAKE_SEGMENT_ENTRY(segname, realname) \
{#realname, segname##_VRAM, segname##_VRAM_END, (u32) segname##_ROM_START, (u32) segname##_ROM_END, segname##_TEXT_START, segname##_TEXT_END, segname##_DATA_START, segname##_RODATA_END, segname##_BSS_START, segname##_BSS_END}
#define MAKE_DUMMY_SEGMENT_ENTRY(segname, realname) \
{#realname, segname##_VRAM, segname##_VRAM_END, (u32) segname##_ROM_START, (u32) segname##_ROM_END, NULL, NULL, NULL, NULL, NULL, NULL}
struct overlay_address_map_s {
char *name;
u8 *ram_start, *ram_end;
u32 rom_start;
u32 rom_end;
u8 *code_start, *code_end;
u8 *data_start, *data_end;
u8 *bss_start, *bss_end;
};
MAKE_OVERLAY_SEGMENT_EXTERNS(core2)
MAKE_OVERLAY_SEGMENT_EXTERNS(emptyLvl)
MAKE_OVERLAY_SEGMENT_EXTERNS(CC)
MAKE_OVERLAY_SEGMENT_EXTERNS(MMM)
MAKE_OVERLAY_SEGMENT_EXTERNS(GV)
MAKE_OVERLAY_SEGMENT_EXTERNS(TTC)
MAKE_OVERLAY_SEGMENT_EXTERNS(MM)
MAKE_OVERLAY_SEGMENT_EXTERNS(BGS)
MAKE_OVERLAY_SEGMENT_EXTERNS(RBB)
MAKE_OVERLAY_SEGMENT_EXTERNS(FP)
MAKE_OVERLAY_SEGMENT_EXTERNS(CCW)
MAKE_OVERLAY_SEGMENT_EXTERNS(SM)
MAKE_OVERLAY_SEGMENT_EXTERNS(cutscenes)
MAKE_OVERLAY_SEGMENT_EXTERNS(lair)
MAKE_OVERLAY_SEGMENT_EXTERNS(fight)
enum overlay_e overlayManager_getLoadedID(void);
bool overlayManager_isOverlayLoaded(enum overlay_e id);
bool overlayManager_load(enum overlay_e id);
void overlayManager_clearLoadedId(void);
void overlayManager_loadCore2(void);
void overlayManager_debug(void);
/* src/core1/code_7090.c */
@@ -127,40 +57,6 @@ void core1_7090_initSfxSource(s32 idx, s32 lookup_idx, s32 sample_rate, f32 volu
void core1_7090_freeSfxSource(int idx);
/* src/core1/code_CE60.c */
void core1_ce60_setChanMask(s32 chan_mask);
void core1_ce60_setChanMaskWithTransitionSpeed(s32 chan_mask, f32 transition_speed);
bool core1_ce60_isPlayerInRange(s32 x, s32 z, s32 distance);
f32 core1_ce60_getPlayerDistance(f32 x, f32 z);
bool core1_ce60_isPlayerInsideBoundingBox(s32 box_idx);
void core1_ce60_func_8024A9EC(s32 arg0);
void core1_ce60_func_8024AAB0(void);
void core1_ce60_func_8024ADF0(bool arg0);
void core1_ce60_func_8024AE74(void);
void core1_ce60_resetState(void);
void core1_ce60_setChanMaskFromWaterState(s32 chan_mask_underwater, s32 chan_mask_surface);
void core1_ce60_func_8024AF48(void);
void core1_ce60_incOrDecCounter(bool increment);
void core1_ce60_func_8024BD40(s32 arg0, s32 arg1);
/* src/core1/depthbuffer.c */
extern u8 D_8000E800[];
void depthbuffer_clear(Gfx **gfx);
void depthbuffer_clearRegion(Gfx **gfx, s32 x, s32 y, s32 w, s32 h, void *color_buffer);
bool depthbuffer_getUnk4(void);
bool depthbuffer_isDataPtrSet(void);
void depthbuffer_stub(void);
void depthbuffer_enable(bool enable);
void depthbuffer_setUnk4(bool value);
void depthbuffer_set(Gfx **gfx);
void *depthbuffer_getDataPtr(void);
/* src/core1/code_15B30.c */
@@ -214,22 +110,4 @@ void core1_15B30_toggleTexturePointFilter(void);
void graphicscache_swapAndGetStacks(Gfx **gfx, Mtx **mtx, Vtx **vtx);
void dummy_func_80254464(void);
/* src/core1/defragmanager.c */
#define DEFRAGMANAGER_THREAD_STACK_SIZE 2048
#define DEFRAGMANAGER_THREAD_ID 2
#define DEFRAGMANAGER_THREAD_PRIORITY 10
#define DEFRAGMANAGER_THREAD_PRIORITY_HIGH 30
void defragManager_init(void);
void defragManager_free(void);
void defragManager_resume(void);
void defragManager_pause(void);
void defragManager_setPriority(OSPri pri);
/* src/core1/pimanager.c */
void piMgr_read(void *vaddr, s32 devaddr, s32 size);
void piMgr_init(void);
#endif
+39
View File
@@ -0,0 +1,39 @@
#ifndef BANJO_KAZOOIE_CORE1_DEBUGTEXT_H
#define BANJO_KAZOOIE_CORE1_DEBUGTEXT_H
#include <ultra64.h>
#include "version.h"
#if VERSION == VERSION_USA_1_0
void gcdebugtext_setRGB(s32 r, s32 g, s32 b);
void gcdebugtext_setPixelInFrameBuffer(s32 x, s32 y);
void gcdebugtext_drawPixel(s32 x, s32 y, s32 w, s32 h);
void gcdebugtext_drawSquare(s32 r, s32 g, s32 b);
void gcdebugtext_stub1(void);
void gcdebugtext_stallOnThread(void);
void gcdebugtext_flashSquare(s32 color);
void gcdebugtext_drawSquare2(s32 color);
void gcdebugtext_drawSquareOnly(s32 color);
void gcdebugtext_drawCharacter(s32 colorSelect, s32 displayCharacter, s32 fontSize, s32 keepCursor, bool setBackgroundColorBlack, s32 r, s32 g, s32 b);
void gcdebugtext_clearText(void);
void gcdebugtext_printCharacter(s32 colorSelect, s32 displayCharacter, s32 fontSize);
void gcdebugtext_printValue(s32 colorSelect, s32 displayValue, s32 fontSize);
void gcdebugtext_showLargeValue(s32 colorSelect, s32 displayValue);
void gcdebugtext_showValue(s32 displayValue);
void gcdebugtext_showHexValue(u32 displayValue);
void gcdebugtext_showFloat(f32 displayValue);
s32 gcdebugtext_encodeCharacter(s32 character);
void gcdebugtext_showText(u8 *text);
void gcdebugtext_lockScreen(void);
void gcdebugtext_pauseThread(void);
void gcdebugtext_pauseThreadForTime(s32 time);
void gcdebugtext_checkYAndgcdebugtext_wrapToTop(s32 lineHeight);
void gcdebugtext_wrapToTop(void);
void gcdebugtext_wrapToTopSmall(void);
void gcdebugtext_endLine(void);
void gcdebugtext_printSpace(void);
bool gcdebugtext_isThreadLocked(void);
void gcdebugtext_stub2(s32 arg0);
#endif
#endif
+17
View File
@@ -0,0 +1,17 @@
#ifndef BANJO_KAZOOIE_CORE1_DEFRAGTHREAD_H
#define BANJO_KAZOOIE_CORE1_DEFRAGTHREAD_H
#include <ultra64.h>
#define DEFRAGMANAGER_THREAD_ID 2
#define DEFRAGMANAGER_THREAD_PRI 10
#define DEFRAGMANAGER_THREAD_PRI_HIGH 30
void defragthread_init(void);
void defragthread_free(void);
void defragthread_resume(void);
void defragthread_pause(void);
void defragthread_setPriority(OSPri pri);
void defragthread_entry(void *arg);
#endif
+18
View File
@@ -0,0 +1,18 @@
#ifndef BANJO_KAZOOIE_CORE1_DEPTHBUFFER_H
#define BANJO_KAZOOIE_CORE1_DEPTHBUFFER_H
#include <ultra64.h>
extern u8 D_8000E800[];
void depthbuffer_clear(Gfx **gfx);
void depthbuffer_clearRegion(Gfx **gfx, s32 x, s32 y, s32 w, s32 h, void *color_buffer);
bool depthbuffer_getUnk4(void);
bool depthbuffer_isDataPtrSet(void);
void depthbuffer_stub(void);
void depthbuffer_enable(bool enable);
void depthbuffer_setUnk4(bool value);
void depthbuffer_set(Gfx **gfx);
void *depthbuffer_getDataPtr(void);
#endif
+11 -9
View File
@@ -1,19 +1,21 @@
#ifndef BANJO_KAZOOIE_CORE1_FRAMEBUFFERDRAW_H
#define BANJO_KAZOOIE_CORE1_FRAMEBUFFERDRAW_H
void framebufferdraw_drawSpriteCI4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled);
void framebufferdraw_drawSpriteCI8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled);
void framebufferdraw_drawSpriteRGBA16(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabled);
void framebufferdraw_drawSpriteI4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabled);
void framebufferdraw_drawSpriteIA4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabled);
void framebufferdraw_drawSpriteI8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled);
void framebufferdraw_drawSpriteIA8(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabled);
void framebufferdraw_drawSpriteRGBA32(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled);
#include <ultra64.h>
void framebufferdraw_draw_CI4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled);
void framebufferdraw_draw_CI8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled);
void framebufferdraw_draw_RGBA16(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabled);
void framebufferdraw_draw_I4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabled);
void framebufferdraw_draw_IA4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabled);
void framebufferdraw_draw_I8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled);
void framebufferdraw_draw_IA8(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabled);
void framebufferdraw_draw_RGBA32(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled);
void framebufferdraw_stub1(s32 arg0, s32 arg1, s32 arg2, s32 arg3);
void framebufferdraw_stub2(s32 arg0, s32 arg1, s32 arg2, s32 arg3);
void framebufferdraw_drawTexture_CI4(s32 x, s32 y, void *tmem, s32 w, s32 h, bool alpha_enabled);
void framebufferdraw_draw(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled);
void framebufferdraw_func_80249DE0(s32 x, s32 y, s16 *arg2, s32 arg3, s32 arg4);
void framebufferdraw_func_80249DE0(s32 x, s32 y, Struct84s *arg2, s32 arg3, s32 arg4);
void framebufferdraw_func_80249F34(s32 x, s32 y, Struct84s* maskList, s32 maskIndex, s32 mX, s32 mY, s32 mW, s32 mH, s32 maskColor, s32 mStride, bool dim, s32 replacementColor);
void framebufferdraw_drawGrid(s32 x, s32 y, s32 arg2, s32 arg3, s32 horz_spacing, s32 vert_spacing);
void framebufferdraw_setPixel(s32 x, s32 y);
+9
View File
@@ -0,0 +1,9 @@
#ifndef BANJO_KAZOOIE_CORE1_GLCRC_H
#define BANJO_KAZOOIE_CORE1_GLCRC_H
#include <ultra64.h>
s32 func_8025C29C(u64 *seed); // transform seed (in mips3 file)
void glcrc_calcChecksum(void *start, void *end, u32 checksum[2]);
#endif
+12
View File
@@ -0,0 +1,12 @@
#ifndef BANJO_KAZOOIE_CORE1_INITTHREAD_H
#define BANJO_KAZOOIE_CORE1_INITTHREAD_H
#include <ultra64.h>
#define INITTHREAD_ID 1
#define INITTHREAD_PRI OS_PRIORITY_IDLE
void initThread_create(void);
void initThread_entry(void *arg);
#endif
+5 -2
View File
@@ -4,9 +4,12 @@
#include <ultra64.h>
#include "enums.h"
void core1_main(s32 arg0);
#define MAINTHREAD_ID 6
#define MAINTHREAD_PRI 20
void core1_main(void *arg);
void func_8023DA74(void);
void func_8023DA9C(s32 arg0);
void func_8023DA9C(s32 next_state);
s32 globalTimer_getTimeMasked(s32 mask);
s32 globalTimer_getTime(void);
void globalTimer_reset(void);
+21
View File
@@ -0,0 +1,21 @@
#ifndef BANJO_KAZOOIE_CORE1_MIDICHANNEL_H
#define BANJO_KAZOOIE_CORE1_MIDICHANNEL_H
#include <ultra64.h>
void midichannel_setChanMask(s32 chan_mask);
void midichannel_setChanMaskWithTransitionSpeed(s32 chan_mask, f32 transition_speed);
bool midichannel_isPlayerInRange(s32 x, s32 z, s32 distance);
f32 midichannel_getPlayerDistance(f32 x, f32 z);
bool midichannel_isPlayerInsideBoundingBox(s32 box_idx);
void midichannel_func_8024A9EC(s32 arg0);
void midichannel_func_8024AAB0(void);
void midichannel_func_8024ADF0(bool arg0);
void midichannel_func_8024AE74(void);
void midichannel_resetState(void);
void midichannel_setChanMaskFromWaterState(s32 chan_mask_underwater, s32 chan_mask_surface);
void midichannel_func_8024AF48(void);
void midichannel_incOrDecCounter(bool increment);
void midichannel_func_8024BD40(s32 arg0, s32 arg1);
#endif
+8
View File
@@ -0,0 +1,8 @@
#ifndef BANJO_KAZOOIE_CORE1_OVERLAY_H
#define BANJO_KAZOOIE_CORE1_OVERLAY_H
#include <ultra64.h>
void overlay_load(s32 id, u8 *ram_start, u8 *ram_end, u32 rom_start, u32 rom_end, u8 *code_start, u8 *code_end, u8 *data_start, u8 *data_end, u8 *bss_start, u8 *bss_end);
#endif
+60
View File
@@ -0,0 +1,60 @@
#ifndef BANJO_KAZOOIE_CORE1_OVERLAYMANAGER_H
#define BANJO_KAZOOIE_CORE1_OVERLAYMANAGER_H
#include <ultra64.h>
#include "enums.h"
#define MAKE_OVERLAY_SEGMENT_EXTERNS(segname) \
extern u8 segname##_VRAM[]; \
extern u8 segname##_VRAM_END[]; \
extern u8 segname##_ROM_START[]; \
extern u8 segname##_ROM_END[]; \
extern u8 segname##_TEXT_START[]; \
extern u8 segname##_TEXT_END[]; \
extern u8 segname##_DATA_START[]; \
extern u8 segname##_DATA_END[]; \
extern u8 segname##_RODATA_START[]; \
extern u8 segname##_RODATA_END[]; \
extern u8 segname##_BSS_START[]; \
extern u8 segname##_BSS_END[];
#define MAKE_SEGMENT_ENTRY(segname, realname) \
{#realname, segname##_VRAM, segname##_VRAM_END, (u32) segname##_ROM_START, (u32) segname##_ROM_END, segname##_TEXT_START, segname##_TEXT_END, segname##_DATA_START, segname##_RODATA_END, segname##_BSS_START, segname##_BSS_END}
#define MAKE_DUMMY_SEGMENT_ENTRY(segname, realname) \
{#realname, segname##_VRAM, segname##_VRAM_END, (u32) segname##_ROM_START, (u32) segname##_ROM_END, NULL, NULL, NULL, NULL, NULL, NULL}
struct overlay_address_map_s {
char *name;
u8 *ram_start, *ram_end;
u32 rom_start;
u32 rom_end;
u8 *code_start, *code_end;
u8 *data_start, *data_end;
u8 *bss_start, *bss_end;
};
MAKE_OVERLAY_SEGMENT_EXTERNS(core2)
MAKE_OVERLAY_SEGMENT_EXTERNS(emptyLvl)
MAKE_OVERLAY_SEGMENT_EXTERNS(CC)
MAKE_OVERLAY_SEGMENT_EXTERNS(MMM)
MAKE_OVERLAY_SEGMENT_EXTERNS(GV)
MAKE_OVERLAY_SEGMENT_EXTERNS(TTC)
MAKE_OVERLAY_SEGMENT_EXTERNS(MM)
MAKE_OVERLAY_SEGMENT_EXTERNS(BGS)
MAKE_OVERLAY_SEGMENT_EXTERNS(RBB)
MAKE_OVERLAY_SEGMENT_EXTERNS(FP)
MAKE_OVERLAY_SEGMENT_EXTERNS(CCW)
MAKE_OVERLAY_SEGMENT_EXTERNS(SM)
MAKE_OVERLAY_SEGMENT_EXTERNS(cutscenes)
MAKE_OVERLAY_SEGMENT_EXTERNS(lair)
MAKE_OVERLAY_SEGMENT_EXTERNS(fight)
enum overlay_e overlayManager_getLoadedID(void);
bool overlayManager_isOverlayLoaded(enum overlay_e id);
bool overlayManager_load(enum overlay_e id);
void overlayManager_clearLoadedId(void);
void overlayManager_loadCore2(void);
void overlayManager_debug(void);
#endif
+9
View File
@@ -0,0 +1,9 @@
#ifndef BANJO_KAZOOIE_CORE1_PARALLEL_H
#define BANJO_KAZOOIE_CORE1_PARALLEL_H
#include <ultra64.h>
void parallel_readDMA(void *vaddr, s32 devaddr, s32 size);
void parallel_init(void);
#endif
+4 -1
View File
@@ -1,6 +1,9 @@
#ifndef BANJO_KAZOOIE_CORE1_PFSMANAGER_H
#define BANJO_KAZOOIE_CORE1_PFSMANAGER_H
#define CONTROLLER_THREAD_ID 7
#define CONTROLLER_THREAD_PRI 40
typedef struct pfs_manager_face_buttons_s {
bool button_a;
bool button_b;
@@ -57,7 +60,7 @@ void func_8024F2E4(s32 arg0, Struct_core1_10A00_1 *arg1);
void func_8024F328(s32 controller_index, s32 arg1);
OSMesgQueue * pfsManager_getFrameReplyQ(void);
OSMesgQueue *pfsManager_getFrameMesgQ(void);
void func_8024F35C(s32 arg0);
void controller_func_8024F35C(s32 arg0);
bool pfsManager_isBusy(void);
int func_8024F3C4(int arg0);
OSContPad *func_8024F3F4(void);
+1 -1
View File
@@ -6,6 +6,6 @@ u32 sprite_getUnkA(BKSprite *this);
u32 sprite_getUnk6(BKSprite *this);
u32 sprite_getUnk4(BKSprite *this);
s32 sprite_getFrameCount(BKSprite *this);
BKSpriteFrame *sprite_getFramePtr(BKSprite *this, u32 frame_id);
BKSpriteFrame *sprite_getFramePtr(BKSprite *this, s32 frame_id);
#endif
+11
View File
@@ -0,0 +1,11 @@
#ifndef BANJO_KAZOOIE_CORE1_STUB_1D590_H
#define BANJO_KAZOOIE_CORE1_STUB_1D590_H
#include <ultra64.h>
void core1_1D590_func_8025AFB0(void);
void core1_1D590_func_8025AFB8(void);
void core1_1D590_func_8025AFC0(Gfx **gfx, Mtx **mtx, Vtx **vtx);
s32 core1_1D590_func_8025AFD0(void);
#endif
+4 -1
View File
@@ -1,6 +1,9 @@
#ifndef BANJO_KAZOOIE_CORE1_VIMGR_H
#define BANJO_KAZOOIE_CORE1_VIMGR_H
#define VI_THREAD_ID 0
#define VI_THREAD_PRI 80
typedef struct struct_1_s{
OSMesgQueue *messageQueue;
OSMesg message;
@@ -19,7 +22,7 @@ void viMgr_func_8024C1B4(void);
void viMgr_func_8024C1DC(void);
void viMgr_unregisterSignalMesg(OSMesgQueue *mq, OSMesg msg);
void viMgr_setActiveFramebuffer(s32 arg0);
void viMgr_entry(void *arg0);
void viMgr_entry(void *arg);
void viMgr_setScreenBlack(s32 active);
void viMgr_clearFramebuffers(void);
s32 viMgr_func_8024C4E8(void);
+4
View File
@@ -102,4 +102,8 @@ void playerPosition_getOffset(f32 offset[3]);
void playerPosition_setOffset(f32 offset[3]);
void playerPosition_applyOffset(void);
s32 getGameMode(void);
s16 *picturebox_getColorBuffer(void);
BKSpriteTextureBlock *func_8033EFB0(Struct84s *arg0, s32 arg1);
#endif
-4
View File
@@ -212,8 +212,6 @@ void particleEmitter_setSpawnInterval(ParticleEmitter *, f32);
OSContPad *func_8024F3F4(void);
OSMesgQueue *pfsManager_getFrameReplyQ(void);
void baMotor_80250D94(f32, f32, f32);
void coMusicPlayer_playMusic(enum comusic_e, s32);
void comusic_playTrack(enum comusic_e);
void comusic_8025AB44(enum comusic_e track_id, s32 arg1, s32 arg2);
@@ -431,8 +429,6 @@ void timed_setStaticCameraToNode(f32, s32);
void timed_exitStaticCamera(f32 time);
int actor_animationIsAt(Actor*, f32);
void baMotor_80250E94(f32, f32, f32, f32, f32, f32);
void bundle_setYaw(f32);
void func_802F9DB8(s32, f32, f32, f32);
+1
View File
@@ -70,6 +70,7 @@ typedef struct bk_sprite_frame_s{
s16 unkE;
s16 unk10;
s16 unk12;
u16 palette[];
} BKSpriteFrame;
typedef struct bk_sprite_texture_block_s{
+1 -1
View File
@@ -84,7 +84,7 @@ void func_8038A318(ActorMarker *caller, enum asset_e text_id, s32 arg1){
coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 32000);
coMusicPlayer_playMusic(COMUSIC_5B_FP_IGLOO_HAPPY, 25000);
func_8025A58C(0, 4000);
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
}
}
+1 -1
View File
@@ -201,7 +201,7 @@ void func_80388D70(ActorMarker *caller, enum asset_e text_id, s32 arg2){
case VER_SELECT(ASSET_C29_DIALOG_BOGGY_SLED_BEAR_SECOND_START, 0x9A3, 0, 0)://L80388DC4
coMusicPlayer_playMusic(COMUSIC_3A_FP_BOGGY_RACE, 25000);
func_8025A58C(0, 4000);
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
func_802BE720();
local->unk0 = partEmitMgr_newEmitter(16);
local->unk4 = partEmitMgr_newEmitter(16);
+2 -2
View File
@@ -199,7 +199,7 @@ void func_8038D3D8(void){
comusic_8025AB44(COMUSIC_68_TWINKLY_MINIGAME, 0, 4000);
func_8025AABC(COMUSIC_68_TWINKLY_MINIGAME);
func_8025A58C(-1, 4000);
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
}
void chTwinklyBox_spawnSecondAndThirdMuncher(ActorMarker *marker){
@@ -265,7 +265,7 @@ void chTwinklyBox_activateBox(ActorMarker *this_marker, ActorMarker *other_marke
this->unk1C[1] = 0.0f;
coMusicPlayer_playMusic(COMUSIC_68_TWINKLY_MINIGAME, 25000);
func_8025A58C(0, 4000);
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
this->unk1C[2] = 428571.0f;
func_8025AEA0(0x68, (s32)this->unk1C[2]);
subaddie_set_state_with_direction(this, 3, 0.001f, 1);
+1 -1
View File
@@ -79,7 +79,7 @@ void func_8038ABDC(void){
comusic_8025AB44(COMUSIC_3A_FP_BOGGY_RACE, 0, 4000);
func_8025AABC(COMUSIC_3A_FP_BOGGY_RACE);
func_8025A58C(-1, 4000);
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
}
void func_8038AC20(s32 gate_indx, s32 arg1){
+2 -2
View File
@@ -213,13 +213,13 @@ static void __chNipper_updateFunc(Actor *this){
if(0.0f == this->velocity_x && xVelocity){
comusic_8025AB44(COMUSIC_12_TTC_NIPPER, -1, 5000);
func_8032BB88(this, 0, 4000);
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
}
else if(!xVelocity && 0.0f != this->velocity_x){
comusic_8025AB44(COMUSIC_12_TTC_NIPPER, 0, 300);
func_8025AABC(COMUSIC_12_TTC_NIPPER);
func_8032BB88(this, -1, 300);
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
}
this->velocity_x = xVelocity;
}
+2 -2
View File
@@ -13,7 +13,7 @@ extern u8 core1_VRAM[];
/// @brief Entry point of the game
/// @param arg0 unused/unknown parameter
void func_80000450(s32 arg0) {
void func_80000450(void *arg) {
u8 *in = gHeapBase;
u8 *out = core1_VRAM;
@@ -34,5 +34,5 @@ void func_80000450(s32 arg0) {
overlaytable_init();
(&core1_main)(arg0);
(&core1_main)(arg);
}
+92 -93
View File
@@ -1,65 +1,58 @@
#include <ultra64.h>
#include <PRinternal/macros.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "core2/core2.h"
#include "time.h"
#include "version.h"
#define RUMBLE_THREAD_STACK_SIZE 0x200
void func_8024F35C(s32);
OSMesgQueue D_80282390;
OSMesg D_802823A8;
s32 D_802823AC;
s32 D_802823B0;
OSMesgQueue *D_802823B4;
OSPfs D_802823B8;
f32 D_80282420;
f32 D_80282424;
f32 D_80282428;
f32 D_8028242C;
OSThread sRumbleThread;
u8 sRumbleThreadStack[RUMBLE_THREAD_STACK_SIZE];
OSMesgQueue sbaMotorThreadMesgQ;
OSMesg sbaMotorThreadMesgBuf;
bool sbaMotorAvialable;
bool sbaMotorGood;
OSMesgQueue *sbaMotorPfsMesgQ;
OSPfs sbaMotorPfsHandle;
f32 D_80282420;
f32 D_80282424;
f32 D_80282428;
f32 D_8028242C;
OSThread sbaMotorThread;
STACK(sbaMotorThreadStrack, 0x200);
/* .code */
void baMotor_80250D94(f32, f32, f32);
void baMotor_startMotor(void) {
s32 status;
void __baMotor_startRumble(void){
u32 motor_status;
if(D_802823B0){
func_8024F35C(4);
motor_status = osMotorStart(&D_802823B8);
D_802823B0 = (motor_status == 0);
func_8024F35C(0);
if (sbaMotorGood) {
controller_func_8024F35C(4);
status = osMotorStart(&sbaMotorPfsHandle);
sbaMotorGood = (status == 0);
controller_func_8024F35C(0);
}
}
void __baMotor_stopRumble(void){
u32 motor_status;
void baMotor_stopMotor(void) {
s32 status;
if(D_802823B0){
func_8024F35C(4);
motor_status = osMotorStop(&D_802823B8);
D_802823B0 = (motor_status == 0);
func_8024F35C(0);
if (sbaMotorGood) {
controller_func_8024F35C(4);
status = osMotorStop(&sbaMotorPfsHandle);
sbaMotorGood = (status == 0);
controller_func_8024F35C(0);
}
}
void func_80250930(void){
u32 motor_status;
void baMotor_reinitialize(void) {
s32 status;
if(!D_802823B0){
func_8024F35C(4);
motor_status = osMotorInit(D_802823B4, &D_802823B8, 0);
D_802823B0 = (motor_status == 0);
func_8024F35C(0);
if (!sbaMotorGood) {
controller_func_8024F35C(4);
status = osMotorInit(sbaMotorPfsMesgQ, &sbaMotorPfsHandle, 0);
sbaMotorGood = (status == 0);
controller_func_8024F35C(0);
}
}
void rumbleThread_entry(void *arg) {
static s32 D_802827E0;
void baMotor_entry(void *arg) {
static s32 frame_count;
static s32 rumble_state;
f32 temp_f2;
f32 temp_f0;
@@ -69,20 +62,23 @@ void rumbleThread_entry(void *arg) {
s32 var_v0;
s32 var_v1;
do{
osRecvMesg(&D_80282390, NULL, 1);
D_802827E0++;
if (!D_802823B0 && ((D_802827E0 % FRAMERATE) == 0)) {
func_80250930();
do {
osRecvMesg(&sbaMotorThreadMesgQ, NULL, OS_MESG_BLOCK);
frame_count++;
if (!sbaMotorGood && ((frame_count % FRAMERATE) == 0)) {
baMotor_reinitialize();
}
prev_state = rumble_state;
if (D_80282424 != D_80282420) {
temp_f2 = D_80282428 + ((D_8028242C - D_80282428) * D_80282424 / D_80282420);
var_v0 = (s32) (((1.0 - temp_f2) * 8.0) + 1);
if (var_v0 < 2) {
rumble_state = var_v0;
} else {
rumble_state = (D_802827E0 % var_v0) == 0;
rumble_state = (frame_count % var_v0) == 0;
}
} else {
rumble_state = 0;
@@ -90,51 +86,53 @@ void rumbleThread_entry(void *arg) {
if (rumble_state != prev_state) {
if (rumble_state) {
__baMotor_startRumble(); //start_motor
}
else{
__baMotor_stopRumble(); //stop_motor
baMotor_startMotor();
} else {
baMotor_stopMotor();
}
}
}while(1);
} while (TRUE);
}
void __baMotor_80250BA4(s32 arg0, s32 arg1, s32 arg2){
void baMotor_80250BA4(s32 arg0, s32 arg1, s32 arg2) {
f64 f0 = 524288.0;
baMotor_80250D94(arg0/f0, arg1/f0, arg2/f0);
baMotor_80250D94(arg0 / f0, arg1 / f0, arg2 / f0);
}
void baMotor_80250C08(void) {
if (D_802823AC != 0) {
if (sbaMotorAvialable) {
D_80282424 = MIN(D_80282420, D_80282424 + time_getDelta());
}
}
void baMotor_init(void) {
s32 pfs_status;
s32 status;
func_8024F35C(4);
D_802823B4 = pfsManager_getFrameReplyQ();
pfs_status = osPfsInit(D_802823B4, &D_802823B8, 0);
if(pfs_status == PFS_ERR_ID_FATAL || pfs_status == PFS_ERR_DEVICE){
pfs_status = osMotorInit(D_802823B4, &D_802823B8, 0);
controller_func_8024F35C(4);
sbaMotorPfsMesgQ = pfsManager_getFrameReplyQ();
status = osPfsInit(sbaMotorPfsMesgQ, &sbaMotorPfsHandle, 0);
if ((status == PFS_ERR_ID_FATAL) || (status == PFS_ERR_DEVICE)) {
// The rumble pack is only initialized, if no Pfs (Transfer Pak) is inserted into the Controller
status = osMotorInit(sbaMotorPfsMesgQ, &sbaMotorPfsHandle, 0);
}
func_8024F35C(0);
D_802823AC = (pfs_status == 0);
D_802823B0 = D_802823AC;
if(D_802823AC){
osCreateMesgQueue(&D_80282390, &D_802823A8, 1);
osCreateThread(&sRumbleThread, 8, rumbleThread_entry, NULL, sRumbleThreadStack + RUMBLE_THREAD_STACK_SIZE, 25);
osStartThread(&sRumbleThread);
viMgr_registerSignalMesg(&D_80282390, 0);
controller_func_8024F35C(0);
sbaMotorAvialable = (status == 0);
sbaMotorGood = sbaMotorAvialable;
if (sbaMotorAvialable) {
osCreateMesgQueue(&sbaMotorThreadMesgQ, &sbaMotorThreadMesgBuf, 1);
osCreateThread(&sbaMotorThread, BAMOTOR_THREAD_ID, baMotor_entry, NULL, STACK_START(sbaMotorThreadStrack), BAMOTOR_THREAD_PRI);
osStartThread(&sbaMotorThread);
viMgr_registerSignalMesg(&sbaMotorThreadMesgQ, NULL);
}
}
void __baMotor_80250D8C(void){}
void baMotor_stub(void) {}
void baMotor_80250D94(f32 arg0, f32 arg1, f32 arg2){
void baMotor_80250D94(f32 arg0, f32 arg1, f32 arg2) {
f32 f4;
if(arg2 != 0.0f && D_802823AC){
if ((arg2 != 0.0f) && sbaMotorAvialable) {
if(func_802E4A08() == 0){
if(!(0.1 < D_80282420 - D_80282424) || !(arg0 + arg1 < D_80282428 + D_8028242C)){
D_80282420 = arg2;
@@ -146,30 +144,31 @@ void baMotor_80250D94(f32 arg0, f32 arg1, f32 arg2){
}
}
void baMotor_80250E6C(f32 arg0, f32 arg1){
void baMotor_80250E6C(f32 arg0, f32 arg1) {
baMotor_80250D94(arg0, arg0, arg1);
}
void baMotor_80250E94(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5){
if(D_802823AC){
timedFunc_set_3(0.0f, (GenFunction_3) __baMotor_80250BA4, 0, (s32) (arg0 * 524288.0f), (s32) (arg2*524288.0f));
timedFunc_set_3(arg2, (GenFunction_3) __baMotor_80250BA4, (s32) (arg0 * 524288.0f), (s32) (arg1 * 524288.0f), (s32) (arg3*524288.0f));
timedFunc_set_3(arg2 + arg3, (GenFunction_3) __baMotor_80250BA4, (s32) (arg1 * 524288.0f), (s32) (arg1 * 524288.0f), (s32) (arg4*524288.0f));
timedFunc_set_3(arg2 + arg3 + arg4, (GenFunction_3) __baMotor_80250BA4, (s32) (arg1 * 524288.0f), 0, (s32) (arg5*524288.0f));
void baMotor_80250E94(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5) {
if (sbaMotorAvialable) {
timedFunc_set_3(0.0f, baMotor_80250BA4, 0, (s32) (arg0 * 524288.0f), (s32) (arg2*524288.0f));
timedFunc_set_3(arg2, baMotor_80250BA4, (s32) (arg0 * 524288.0f), (s32) (arg1 * 524288.0f), (s32) (arg3*524288.0f));
timedFunc_set_3(arg2 + arg3, baMotor_80250BA4, (s32) (arg1 * 524288.0f), (s32) (arg1 * 524288.0f), (s32) (arg4*524288.0f));
timedFunc_set_3(arg2 + arg3 + arg4, baMotor_80250BA4, (s32) (arg1 * 524288.0f), 0, (s32) (arg5*524288.0f));
}
}
void baMotor_80250FC0(void){
void baMotor_forceStop(void) {
int i;
u32 motor_status;
if(D_802823B0){
func_8024F35C(4);
motor_status = osMotorInit(D_802823B4, &D_802823B8, 0);
D_802823B0 = (motor_status == 0);
for(i=0; i < 3 && D_802823B0; i++){
motor_status = osMotorStop(&D_802823B8);
D_802823B0 = (motor_status == 0);
s32 status;
if (sbaMotorGood) {
controller_func_8024F35C(4);
status = osMotorInit(sbaMotorPfsMesgQ, &sbaMotorPfsHandle, 0);
sbaMotorGood = (status == 0);
for (i = 0; (i < 3) && sbaMotorGood; i++) {
status = osMotorStop(&sbaMotorPfsHandle);
sbaMotorGood = (status == 0);
}
func_8024F35C(0);
controller_func_8024F35C(0);
}
}
+72 -60
View File
@@ -1,17 +1,12 @@
#include <ultra64.h>
#include <PRinternal/macros.h>
#include <PRinternal/viint.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "version.h"
#include "gc/gctransition.h"
#define MAIN_THREAD_STACK_SIZE 0x17F0
#if VERSION == VERSION_PAL
extern s32 D_80000300;
#endif
s32 D_80275610 = 0;
s32 D_80275610 = 0; // always set to 0
s32 D_80275614 = 0;
s32 gGlobalTimer = 0;
u32 sDebugVar_8027561C[] = { 0x9, 0x4, 0xA, 0x3, 0xB, 0x2, 0xC, 0x5, 0x0, 0x1, 0x6, 0xD, -1 }; // never used
@@ -19,49 +14,55 @@ s32 D_80275650 = VER_SELECT(0xAD019D3C, 0xA371A8F3, 0, 0); //SM_DATA_CRC2
s32 D_80275654 = VER_SELECT(0xD381B72F, 0xD0709154, 0, 0); //MM_DATA_CRC2
char sDebugVar_80275658[] = VER_SELECT("HjunkDire:218755", "HjunkDire:300875", "HjunkDire:", "HjunkDire:");
/* .bss */
u32 D_8027A130;
u32 D_8027A130; // always set to 3
u8 pad_8027A138[0x400];
u64 sDebugVar_8027A538; // never used
u64 sDebugVar_8027A540; // never used
u8 sMainThreadStack[MAIN_THREAD_STACK_SIZE]; // The real size of the stack is unclear yet, maybe there are some out-optimized debug variables below the stack
STACK(sMainThreadStack, 6128); // The real size of the stack is unclear yet, maybe there are some out-optimized debug variables below the stack
OSThread sMainThread;
s32 gBootMap;
static bool sDisableInput;
static u64 sDebugVar_8027BEF0; // never used
bool sDisableInput;
u64 sDebugVar_8027BEF0; // never used
extern u8 core2_TEXT_START[];
extern u8 core1_BSS_START[];
extern u8 core1_BSS_END[];
void core1_main(s32 arg0){
bzero(&D_8027A130, core2_TEXT_START - (u8*)&D_8027A130);
void core1_main(void *arg) {
bzero(core1_BSS_START, core1_BSS_END - core1_BSS_START);
osWritebackDCacheAll();
sns_find_and_parse_payload();
osInitialize();
initThread_create();
}
void func_8023DA74(void){
void func_8023DA74(void) {
func_8033BD6C();
func_80255198(); //heap_flush_free_queue
}
void func_8023DA9C(s32 arg0){
void func_8023DA9C(s32 next_state) {
core1_15B30_sendMesg3ToRenderThread();
viMgr_clearFramebuffers();
if (D_8027A130 == 4){
if (D_8027A130 == 4) {
func_802E3580();
}
if (D_8027A130 == 3){
if (D_8027A130 == 3) {
func_802E4170();
}
func_8023DA74();
D_8027A130 = arg0;
if (D_8027A130 == 3){
D_8027A130 = next_state;
if (D_8027A130 == 3) {
func_802E4214(gBootMap);
}
if (D_8027A130 == 4){
if (D_8027A130 == 4) {
dummy_func_802E35D0();
}
ucode_stub1();
}
@@ -77,27 +78,27 @@ void globalTimer_reset(void) {
gGlobalTimer = 0;
}
enum map_e getSpecialBootMap(void){
return (DEBUG_use_special_bootmap())? MAP_80_GL_FF_ENTRANCE : MAP_91_FILE_SELECT;
enum map_e getSpecialBootMap(void) {
return DEBUG_use_special_bootmap() ? MAP_80_GL_FF_ENTRANCE : MAP_91_FILE_SELECT;
}
enum map_e getDefaultBootMap(void){
enum map_e getDefaultBootMap(void) {
return MAP_1F_CS_START_RAREWARE;
}
void func_8023DBAC(void){
void func_8023DBAC(void) {
setBootMap(getDefaultBootMap());
func_8023DFF0(3);
}
void func_8023DBDC(void){
void func_8023DBDC(void) {
setBootMap(getSpecialBootMap());
func_8023DFF0(3);
}
void core1_init(void) {
#if VERSION == VERSION_PAL
osTvType = 0;
osTvType = OS_TV_TYPE_PAL;
#endif
ucode_load();
setBootMap(getDefaultBootMap());
@@ -107,7 +108,7 @@ void core1_init(void) {
sDebugVar_8027BEF0 = sDebugVar_8027A538;
heap_init();
core1_15B30_init();
dummy_func_8025AFB0();
core1_1D590_func_8025AFB0();
allocUnusedBlock();
assetCache_init();
pfsManager_init();
@@ -129,7 +130,7 @@ void globalTimer_decTimer(void) {
gGlobalTimer--;
}
void mainLoop(void){
void mainLoop(void) {
s32 x, y;
s32 r, g, b, a;
u16 tmp;
@@ -142,7 +143,7 @@ void mainLoop(void){
func_8023DA74();
if (D_8027A130 != 3 || getGameMode() != GAME_MODE_4_PAUSED) {
if ((D_8027A130 != 3) || (getGameMode() != GAME_MODE_4_PAUSED)) {
globalTimer_incTimer();
}
@@ -154,53 +155,63 @@ void mainLoop(void){
baMotor_80250C08();
#if ANTI_TAMPER
if(!mapSpecificFlags_validateCRC1()){
#if ANTI_TAMPER
if (!mapSpecificFlags_validateCRC1()) {
eeprom_writeBlocks(0, 0, (void *) PHYS_TO_K0(0x00397AD0), EEPROM_MAXBLOCKS);
}
#endif
#endif
switch(D_8027A130){
/* D_8027A130 seems to be always 3 during the game, it is only ever changed when calling
* func_8023DA9C, which only happens in core1_init and after this switch statement, when the
* following if statement is true (which is never be the case, see below).
*/
switch (D_8027A130) {
case 4:
func_802E35D8();
break;
case 3:
func_80255524();
func_80255ACC();
spawnQueue_func_802C3A18();
if(func_802E4424())
if (func_802E4424()) {
game_draw(FALSE);
}
spawnQueue_flush();
break;
}//L8023DE34
}
if(D_80275610){
/* This if block is never executed, because D_80275610 seems to be 0 forever.
* D_80275610 is only changed in func_8023DFF0, which is only called in a few places, that
* never execute:
* - func_8023DBAC and func_8023DBDC: Never gets called
* - func_802E35D8: Only would be called in the above switch block if D_8027A130 was 4 (never happens, see above)
* - func_802E4424: When D_8037E8E0.transition was 2 or 3, which is never the case
*/
if (D_80275610) {
func_8023DA9C(D_80275610 - 1);
D_80275610 = 0;
}//L8023DE54
if( !func_8032056C()
|| !levelSpecificFlags_validateCRC1()
|| !dummy_func_80320240()
){
s32 offset;
}
if (!func_8032056C() || !levelSpecificFlags_validateCRC1() || !dummy_func_80320240()) {
//render weird CRC failure image
for(y= 0x1e; y < gFramebufferHeight - 0x1e; y++){//L8023DEB4
for(x = 0x14; x < 0xeb; x++){
for (y = 30; y < gFramebufferHeight - 30; y++) {
for (x = 20; x < 235; x++) {
tmp = ((globalTimer_getTime() << 3) + x * x + y * y);
r = _SHIFTL(x>>3, 11, 5);
g = _SHIFTL(y>>3, 6, 5);
b = _SHIFTL(tmp>>3, 1, 5);
r = _SHIFTL(x >> 3, 11, 5);
g = _SHIFTL(y >> 3, 6, 5);
b = _SHIFTL(tmp >> 3, 1, 5);
a = 1;
rgba = b | r | g | a;
offset = ((gFramebufferWidth - 0xFF) / 2) + x + (y*gFramebufferWidth);
offset = ((gFramebufferWidth - 0xFF) / 2) + x + (y * gFramebufferWidth);
gFramebuffers[0][offset] = (s32) rgba;
gFramebuffers[1][offset] = (s32) rgba;
}
}
}//L8023DF70
}
}
void mainThread_entry(void *arg) {
@@ -212,26 +223,27 @@ void mainThread_entry(void *arg) {
}
}
void func_8023DFF0(s32 arg0){
// Calling with 3 causes the game to soft reboot, every other value causes a black screen and hang
void func_8023DFF0(s32 arg0) {
D_80275610 = arg0 + 1;
}
s32 func_8023E000(void){
s32 func_8023E000(void) {
return D_8027A130;
}
void setBootMap(enum map_e map_id){
void setBootMap(enum map_e map_id) {
gBootMap = map_id;
}
void mainThread_create(void) {
osCreateThread(&sMainThread, 6, mainThread_entry, NULL, sMainThreadStack + MAIN_THREAD_STACK_SIZE, 20);
osCreateThread(&sMainThread, MAINTHREAD_ID, mainThread_entry, NULL, STACK_START(sMainThreadStack), MAINTHREAD_PRI);
}
OSThread *mainThread_get(void) {
return &sMainThread;
}
void disableInput_set(void){
void disableInput_set(void) {
sDisableInput = TRUE;
}
+1 -1
View File
@@ -600,7 +600,7 @@ u16 musicSlot_func_80250474(s32 index) {
}
osSetIntMask(old_int_mask);
core1_ce60_func_8024AF48();
midichannel_func_8024AF48();
if (D_802762C0 == -1) {
D_802762C0 = 0xFFFF;
+1
View File
@@ -1,5 +1,6 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "core2/core2.h"
static Gfx *sGfxStack[2] = { NULL, NULL };
s32 gFramebufferWidth = DEFAULT_FRAMEBUFFER_WIDTH;
+17 -17
View File
@@ -1,4 +1,5 @@
#include <ultra64.h>
#include <PRinternal/macros.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
@@ -8,7 +9,6 @@
#define DMA_BLOCK_SIZE VER_SELECT(0x200, 0x270, 0x200, 0x200)
#define AUDIO_HEAP_SIZE VER_SELECT(0x21000, 0x23A00, 0x21000, 0x21000)
#define AUDIOMANAGER_THREAD_STACK_SIZE 3704
#define NUM_SAMPLES 184 // n_audio has fixed sample count of 184
#define NUM_OSC_STATES 48
#define NUM_AUDIO_CMDS_PER_SECOND 150000
@@ -126,7 +126,7 @@ struct {
OSMesg audioFrameMsgBuf[8];
OSMesgQueue audioReplyMsgQ;
OSMesg audioReplyMsgBuf[8];
u8 thread_stack[AUDIOMANAGER_THREAD_STACK_SIZE];
u8 thread_stack[3704];
} audioManager;
ALHeap sALHeapInfo;
u8 *sALHeapBuffer;
@@ -329,7 +329,7 @@ void audioManager_create(void) {
audioManager.audio_info[i]->data = malloc(4 * sMaxFrameSize);
}
osCreateThread(&audioManager.thread, 4, &audioManagerThread_entry, 0, audioManager.thread_stack + AUDIOMANAGER_THREAD_STACK_SIZE, 50);
osCreateThread(&audioManager.thread, AUDIOMANAGER_THREAD_ID, audioManagerThread_entry, NULL, STACK_START(audioManager.thread_stack), AUDIOMANAGER_THREAD_PRI);
}
void audioManagerThread_entry(void *arg) {
@@ -375,10 +375,10 @@ bool audioManager_handleFrameMsg(AudioInfo *info, AudioInfo *prev_info){
#if VERSION == VERSION_USA_1_0
if (ret == -1) {
gcdebugText_showLargeValue(2, 2002);
gcdebugText_showValue(prev_info->frame_samples);
gcdebugText_showValue(info->frame_samples);
gcdebugText_pauseThread();
gcdebugtext_showLargeValue(2, 2002);
gcdebugtext_showValue(prev_info->frame_samples);
gcdebugtext_showValue(info->frame_samples);
gcdebugtext_pauseThread();
}
#endif
@@ -399,10 +399,10 @@ bool audioManager_handleFrameMsg(AudioInfo *info, AudioInfo *prev_info){
#if VERSION == VERSION_USA_1_0
if (sNumAudioCmdsPerFrame < command_list_len) {
gcdebugText_showLargeValue(2, 2000);
gcdebugText_showValue(command_list_len);
gcdebugText_showValue(sNumAudioCmdsPerFrame);
gcdebugText_pauseThread();
gcdebugtext_showLargeValue(2, 2000);
gcdebugtext_showValue(command_list_len);
gcdebugtext_showValue(sNumAudioCmdsPerFrame);
gcdebugtext_pauseThread();
}
#endif
@@ -462,8 +462,8 @@ s32 func_80240204(s32 addr, s32 len, void *state) {
phi_s0 = sDMAState.unk8;
if (phi_s0 == NULL) {
#if VERSION == VERSION_USA_1_0
gcdebugText_showLargeValue(2, 2001);
gcdebugText_pauseThread();
gcdebugtext_showLargeValue(2, 2001);
gcdebugtext_pauseThread();
return osVirtualToPhysical(sDMAState.unk4);
#elif VERSION == VERSION_PAL
return osVirtualToPhysical(phi_v0);
@@ -517,10 +517,10 @@ void audioManager_func_802403F0(void) {
for (i = 0; i < sNumDMATransfers; i++) {
#if VERSION == VERSION_USA_1_0
if (osRecvMesg(&audioDMANotifyMsgQ, &temp_mesg, OS_MESG_NOBLOCK) == -1) {
gcdebugText_showLargeValue(2, 2005);
gcdebugText_showValue(sNumDMATransfers);
gcdebugText_showValue(i);
gcdebugText_pauseThread();
gcdebugtext_showLargeValue(2, 2005);
gcdebugtext_showValue(sNumDMATransfers);
gcdebugtext_showValue(i);
gcdebugtext_pauseThread();
}
#else
osRecvMesg(&audioDMANotifyMsgQ, &temp_mesg, OS_MESG_NOBLOCK);
+7 -7
View File
@@ -157,10 +157,10 @@ void func_802451A4(f32 arg0[3], f32 arg1[3], f32 arg2[3], f32 arg3[3], f32 arg4[
arg1[2] += phi_f12 * sp48[2];
}
bool func_80245314(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3, s32 arg4) {
BKCollisionTriangle *func_80245314(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3, s32 arg4) {
f32 sp2C[3];
f32 sp20[3];
bool temp_v0;
BKCollisionTriangle *temp_v0;
ml_vec3f_copy(sp2C, arg0);
ml_vec3f_copy(sp20, arg0);
@@ -173,14 +173,14 @@ bool func_80245314(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3, s32 arg4) {
return temp_v0;
}
bool func_802453A0(f32 arg0[3], f32 arg1[3], f32 arg2[3]){
BKCollisionTriangle *func_802453A0(f32 arg0[3], f32 arg1[3], s32 arg2){
f32 sp24[3];
f32 sp18[3];
ml_vec3f_copy(sp18, arg1);
return func_80320B98(arg0, sp18, sp24, arg2);
}
f32 func_802453DC(f32 arg0[3], f32 arg1, f32 arg2[3], s32 arg3) {
f32 func_802453DC(struct56s *arg0, f32 arg1, f32 arg2[3], s32 arg3) {
f32 sp24[3];
f32 phi_f0;
@@ -201,19 +201,19 @@ f32 func_802453DC(f32 arg0[3], f32 arg1, f32 arg2[3], s32 arg3) {
}
//over_water?
int func_8024549C(f32 arg0[3], f32 arg1){
BKCollisionTriangle *func_8024549C(f32 arg0[3], f32 arg1){
f32 sp44[3];
f32 sp38[3];
f32 sp2C[3];
f32 sp20[3];
int sp1C;
BKCollisionTriangle *sp1C;
sp20[0] = sp20[1] = sp20[2] = 0.0f;
sp20[1] = arg1;
ml_vec3f_diff_copy(sp2C, arg0, sp20);
ml_vec3f_add(sp38, arg0, sp20);
sp1C = func_80309B48(sp2C, sp38, sp44, 0xf800ff0f);
sp1C = (BKCollisionTriangle *) func_80309B48(sp2C, sp38, sp44, 0xf800ff0f);
if(sp1C){
ml_vec3f_copy(arg0, sp38);
}
+3 -3
View File
@@ -219,7 +219,7 @@ void thread5_handleVIRetraceEvent(void) {
osDpSetStatus(DPC_CLR_FREEZE);
sUnkFlag2_Saved = sUnkFlag2;
dummy_func_8025AFB8();
core1_1D590_func_8025AFB8();
if (sUnkFlag2_Saved & 0x01) {
sUnkCounter3 = 30;
@@ -449,7 +449,7 @@ void thread5_handlePreNMIEvent(void) {
#elif VERSION == VERSION_PAL
osViSetMode(&osViModePalLpn1);
#endif
baMotor_80250FC0();
baMotor_forceStop();
while (TRUE) {
osDpSetStatus(DPC_STATUS_FLUSH);
@@ -537,7 +537,7 @@ void thread5_create(void) {
for (yield_data_ptr = (u8 *) sYieldData; (u32) yield_data_ptr % 0x10; yield_data_ptr++);
sGfxTask.t.yield_data_ptr = (u64 *) yield_data_ptr;
osCreateThread(&sThread5, THREAD5_ID,thread5_entry, NULL, STACK_START(sThread5Stack), THREAD5_PRI);
osCreateThread(&sThread5, THREAD5_ID, thread5_entry, NULL, STACK_START(sThread5Stack), THREAD5_PRI);
osStartThread(&sThread5);
}
+149 -149
View File
@@ -31,30 +31,30 @@ static bool D_802806F4;
static s32 sPlayerPosition[4];
static enum comusic_e sTrackId[4]; // 0 - enum comusic_e, 1 - enum comusic_e, 2 - s32 volume for [0], 3 - s32 volume for [1]
void core1_ce60_setChanMask(s32 chan_mask) {
void midichannel_setChanMask(s32 chan_mask) {
musicSlot_stepToChannelMask(0, chan_mask, 3.0f);
}
void core1_ce60_setChanMaskWithTransitionSpeed(s32 chan_mask, f32 transition_speed) {
void midichannel_setChanMaskWithTransitionSpeed(s32 chan_mask, f32 transition_speed) {
musicSlot_stepToChannelMask(0, chan_mask, transition_speed);
}
bool core1_ce60_isPlayerInRange(s32 x, s32 z, s32 distance) {
bool midichannel_isPlayerInRange(s32 x, s32 z, s32 distance) {
return (x - sPlayerPosition[0]) * (x - sPlayerPosition[0]) + (z - sPlayerPosition[2]) * (z - sPlayerPosition[2]) < distance * distance;
}
f32 core1_ce60_getPlayerDistance(f32 x, f32 z) {
f32 midichannel_getPlayerDistance(f32 x, f32 z) {
return sqrtf((x - sPlayerPosition[0]) * (x - sPlayerPosition[0]) + (z - sPlayerPosition[2]) * (z - sPlayerPosition[2]));
}
bool core1_ce60_isPlayerInsideBoundingBox(s32 box_idx) {
bool midichannel_isPlayerInsideBoundingBox(s32 box_idx) {
return ml_vec3w_inside_box_w(sPlayerPosition,
sBoundingBoxes[box_idx].x_min, sBoundingBoxes[box_idx].y_min, sBoundingBoxes[box_idx].z_min,
sBoundingBoxes[box_idx].x_max, sBoundingBoxes[box_idx].y_max, sBoundingBoxes[box_idx].z_max
);
}
void core1_ce60_func_8024A9EC(s32 arg0) {
void midichannel_func_8024A9EC(s32 arg0) {
if (!comusic_isPrimaryTrack(sTrackId[0]) && sTrackId[2]) {
func_8025A104(sTrackId[0], 0);
}
@@ -68,7 +68,7 @@ void core1_ce60_func_8024A9EC(s32 arg0) {
func_8025A864(sTrackId[1]);
}
void core1_ce60_func_8024AAB0(void) {
void midichannel_func_8024AAB0(void) {
f32 player_position[3];
f32 player_distance;
@@ -92,13 +92,13 @@ void core1_ce60_func_8024AAB0(void) {
break;
case MAP_B_CC_CLANKERS_CAVERN:
player_distance = core1_ce60_getPlayerDistance(13909.0f, -26.0f);
player_distance = midichannel_getPlayerDistance(13909.0f, -26.0f);
sTrackId[2] = ml_map_f(player_distance, 1500.0f, 1800.0f, 0.0f, sTrackId[2]);
sTrackId[3] = ml_map_f(player_distance, 1500.0f, 1800.0f, sTrackId[3], 0.0f);
break;
case MAP_1_SM_SPIRAL_MOUNTAIN:
if (core1_ce60_isPlayerInsideBoundingBox(4)) {
if (midichannel_isPlayerInsideBoundingBox(4)) {
sTrackId[2] = 0;
} else {
sTrackId[3] = 0;
@@ -132,7 +132,7 @@ void core1_ce60_func_8024AAB0(void) {
break;
case MAP_7F_FP_WOZZAS_CAVE:
if (sns_get_item_state(SNS_ITEM_ICE_KEY, 1) && core1_ce60_isPlayerInRange(0x619, 0x97a, 0x69a)) {
if (sns_get_item_state(SNS_ITEM_ICE_KEY, 1) && midichannel_isPlayerInRange(0x619, 0x97a, 0x69a)) {
sTrackId[2] = 0;
} else {
sTrackId[3] = 0;
@@ -141,7 +141,7 @@ void core1_ce60_func_8024AAB0(void) {
case MAP_45_CCW_AUTUMN:
case MAP_46_CCW_WINTER:
if (core1_ce60_isPlayerInsideBoundingBox(5)) {
if (midichannel_isPlayerInsideBoundingBox(5)) {
sTrackId[2] = 0;
} else {
sTrackId[3] = 0;
@@ -150,8 +150,8 @@ void core1_ce60_func_8024AAB0(void) {
}
}
void core1_ce60_func_8024ADF0(bool arg0) {
core1_ce60_func_8024AAB0();
void midichannel_func_8024ADF0(bool arg0) {
midichannel_func_8024AAB0();
if (arg0)
func_8025A9D4();
@@ -163,29 +163,29 @@ void core1_ce60_func_8024ADF0(bool arg0) {
coMusicPlayer_playMusicWeak(sTrackId[1], sTrackId[3]);
}
void core1_ce60_func_8024AE74(void) {
void midichannel_func_8024AE74(void) {
sUnusedCounter = 0;
D_80275C10 = -1;
D_80275C14 = 0;
D_80275C1C = D_80275C18 = core1_ce60_isPlayerInRange(2883, -10520, 6480) ? TRUE : FALSE;
D_80275C1C = D_80275C18 = midichannel_isPlayerInRange(2883, -10520, 6480) ? TRUE : FALSE;
}
void core1_ce60_resetState(void) {
void midichannel_resetState(void) {
D_80275C10 = -1;
D_80275C14 = 0;
D_80275C18 = FALSE;
D_80275C1C = FALSE;
}
void core1_ce60_setChanMaskFromWaterState(s32 chan_mask_underwater, s32 chan_mask_surface) {
void midichannel_setChanMaskFromWaterState(s32 chan_mask_underwater, s32 chan_mask_surface) {
if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) {
core1_ce60_setChanMask(chan_mask_underwater);
midichannel_setChanMask(chan_mask_underwater);
} else {
core1_ce60_setChanMask(chan_mask_surface);
midichannel_setChanMask(chan_mask_surface);
}
}
void core1_ce60_func_8024AF48(void) {
void midichannel_func_8024AF48(void) {
if (!D_802806F4 ||
volatileFlag_get(VOLATILE_FLAG_1) ||
volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE) ||
@@ -198,92 +198,92 @@ void core1_ce60_func_8024AF48(void) {
}
player_getPosition_s32(sPlayerPosition);
core1_ce60_func_8024AAB0();
midichannel_func_8024AAB0();
switch(gsworld_getMap()){
case MAP_2_MM_MUMBOS_MOUNTAIN:
if (core1_ce60_isPlayerInRange(-4450, 4550, 1900) || core1_ce60_isPlayerInRange(-6007, 6176, 620)) {
core1_ce60_setChanMask(0x1cc0);
} else if (core1_ce60_isPlayerInRange(4511, -1888, 2000)) {
core1_ce60_setChanMask(0xb0c0);
} else if (core1_ce60_isPlayerInRange(300, -858, 2200)) {
core1_ce60_setChanMask(0x513f);
if (midichannel_isPlayerInRange(-4450, 4550, 1900) || midichannel_isPlayerInRange(-6007, 6176, 620)) {
midichannel_setChanMask(0x1cc0);
} else if (midichannel_isPlayerInRange(4511, -1888, 2000)) {
midichannel_setChanMask(0xb0c0);
} else if (midichannel_isPlayerInRange(300, -858, 2200)) {
midichannel_setChanMask(0x513f);
} else {
core1_ce60_setChanMaskFromWaterState(0x200, 0x103f);
midichannel_setChanMaskFromWaterState(0x200, 0x103f);
}
break;
case MAP_7_TTC_TREASURE_TROVE_COVE:
core1_ce60_func_8024A9EC(0);
midichannel_func_8024A9EC(0);
if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) {
core1_ce60_setChanMask(0x600);
} else if (core1_ce60_isPlayerInRange(-300, 1420, 2150) ||
(core1_ce60_isPlayerInRange(-300, 1420, 3100) &&
midichannel_setChanMask(0x600);
} else if (midichannel_isPlayerInRange(-300, 1420, 2150) ||
(midichannel_isPlayerInRange(-300, 1420, 3100) &&
sPlayerPosition[1] < 1300 &&
!core1_ce60_isPlayerInRange(-73, 11331, 7180) &&
!core1_ce60_isPlayerInRange(1736, 3588, 455) &&
!core1_ce60_isPlayerInRange(1380, 3994, 400)))
!midichannel_isPlayerInRange(-73, 11331, 7180) &&
!midichannel_isPlayerInRange(1736, 3588, 455) &&
!midichannel_isPlayerInRange(1380, 3994, 400)))
{
core1_ce60_setChanMask(0x7800);
midichannel_setChanMask(0x7800);
} else {
core1_ce60_setChanMask(0x60ff);
midichannel_setChanMask(0x60ff);
}
break;
case MAP_B_CC_CLANKERS_CAVERN:
core1_ce60_func_8024A9EC(0);
midichannel_func_8024A9EC(0);
if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) {
if(!(sPlayerPosition[1] < 651)) {
core1_ce60_setChanMaskWithTransitionSpeed(0x8180, 5.0f);
midichannel_setChanMaskWithTransitionSpeed(0x8180, 5.0f);
} else {
core1_ce60_setChanMaskWithTransitionSpeed(0x3e00, 5.0f);
midichannel_setChanMaskWithTransitionSpeed(0x3e00, 5.0f);
}
} else {
core1_ce60_setChanMask(0x407f);
midichannel_setChanMask(0x407f);
}
break;
case MAP_12_GV_GOBIS_VALLEY:
if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){
core1_ce60_setChanMask(0x8020);
} else if (core1_ce60_isPlayerInRange(-3990, 5670, 3700)){
core1_ce60_setChanMask(0x797f);
midichannel_setChanMask(0x8020);
} else if (midichannel_isPlayerInRange(-3990, 5670, 3700)){
midichannel_setChanMask(0x797f);
} else {
core1_ce60_setChanMask(0x67fe);
midichannel_setChanMask(0x67fe);
}
break;
case MAP_3_UNUSED:
core1_ce60_setChanMaskFromWaterState(0x1800, 0x67fe);
midichannel_setChanMaskFromWaterState(0x1800, 0x67fe);
break;
case MAP_5_TTC_BLUBBERS_SHIP:
core1_ce60_setChanMaskFromWaterState(0x600, 0x7800);
midichannel_setChanMaskFromWaterState(0x600, 0x7800);
break;
case MAP_1_SM_SPIRAL_MOUNTAIN:
if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) {
core1_ce60_setChanMask(0x9000);
midichannel_setChanMask(0x9000);
} else {
if (chmole_learnedAllSpiralMountainAbilities()) {
core1_ce60_func_8024A9EC(0);
midichannel_func_8024A9EC(0);
}
core1_ce60_setChanMask(0x6fff);
midichannel_setChanMask(0x6fff);
}
break;
case MAP_21_CC_WITCH_SWITCH_ROOM:
case MAP_22_CC_INSIDE_CLANKER:
case MAP_23_CC_GOLDFEATHER_ROOM:
core1_ce60_setChanMaskFromWaterState(0x3c00, 0x61ff);
midichannel_setChanMaskFromWaterState(0x3c00, 0x61ff);
break;
case MAP_25_MMM_WELL:
case MAP_2F_MMM_WATERDRAIN_BARREL:
core1_ce60_setChanMaskFromWaterState(0x1000, 0xcfff);
midichannel_setChanMaskFromWaterState(0x1000, 0xcfff);
break;
case MAP_13_GV_MEMORY_GAME:
@@ -291,30 +291,30 @@ void core1_ce60_func_8024AF48(void) {
case MAP_15_GV_WATER_PYRAMID:
case MAP_16_GV_RUBEES_CHAMBER:
case MAP_1A_GV_INSIDE_JINXY:
core1_ce60_setChanMaskFromWaterState(0x3ffe, 0x4ffe);
midichannel_setChanMaskFromWaterState(0x3ffe, 0x4ffe);
break;
case MAP_1B_MMM_MAD_MONSTER_MANSION:
if (!mapSpecificFlags_get(1) && !comusic_isTrackQueued(COMUSIC_4_MMM_CLOCK_VERSION) && !comusic_isTrackQueued(COMUSIC_3C_MINIGAME_LOSS)) {
core1_ce60_func_8024A9EC(0);
midichannel_func_8024A9EC(0);
}
core1_ce60_setChanMask((mapSpecificFlags_get(1) ? 0x2000 : 0) + 0xcfff);
midichannel_setChanMask((mapSpecificFlags_get(1) ? 0x2000 : 0) + 0xcfff);
break;
case MAP_D_BGS_BUBBLEGLOOP_SWAMP:
if (core1_ce60_isPlayerInRange(1890, -1346, 1400) || core1_ce60_isPlayerInRange(-133, 2008, 900) || core1_ce60_isPlayerInRange(-3629, -535, 1400)) {
core1_ce60_setChanMaskWithTransitionSpeed(0x2f4f, 2.0f);
if (midichannel_isPlayerInRange(1890, -1346, 1400) || midichannel_isPlayerInRange(-133, 2008, 900) || midichannel_isPlayerInRange(-3629, -535, 1400)) {
midichannel_setChanMaskWithTransitionSpeed(0x2f4f, 2.0f);
} else {
core1_ce60_setChanMaskWithTransitionSpeed(0x6f4f, 2.0f);
midichannel_setChanMaskWithTransitionSpeed(0x6f4f, 2.0f);
}
break;
case MAP_31_RBB_RUSTY_BUCKET_BAY:
if ((-4200 <= sPlayerPosition[0] && sPlayerPosition[0] < -3700) && (-900 <= sPlayerPosition[2] && sPlayerPosition[2] < 900)) {
core1_ce60_setChanMask(0x51ff);
midichannel_setChanMask(0x51ff);
} else {
core1_ce60_setChanMaskFromWaterState(0x800, 0x71bf);
midichannel_setChanMaskFromWaterState(0x800, 0x71bf);
}
break;
@@ -323,37 +323,37 @@ void core1_ce60_func_8024AF48(void) {
case MAP_37_RBB_CONTAINER_1:
case MAP_38_RBB_CONTAINER_3:
case MAP_3E_RBB_CONTAINER_2:
core1_ce60_setChanMaskFromWaterState(0x800, 0xfe);
midichannel_setChanMaskFromWaterState(0x800, 0xfe);
break;
case MAP_40_CCW_HUB:
if (core1_ce60_isPlayerInRange(0, 0, 2050)) {
core1_ce60_setChanMaskWithTransitionSpeed(7, 2.0f);
if (midichannel_isPlayerInRange(0, 0, 2050)) {
midichannel_setChanMaskWithTransitionSpeed(7, 2.0f);
} else if (1450 <= sPlayerPosition[2]){
core1_ce60_setChanMaskWithTransitionSpeed(0x407, 2.0f);
midichannel_setChanMaskWithTransitionSpeed(0x407, 2.0f);
} else if (sPlayerPosition[0] < -1449) {
core1_ce60_setChanMaskWithTransitionSpeed(0x707, 2.0f);
midichannel_setChanMaskWithTransitionSpeed(0x707, 2.0f);
} else if (sPlayerPosition[2] < -1449) {
core1_ce60_setChanMaskWithTransitionSpeed(0x1067, 2.0f);
midichannel_setChanMaskWithTransitionSpeed(0x1067, 2.0f);
} else if (1450 <= sPlayerPosition[0]) {
core1_ce60_setChanMaskWithTransitionSpeed(0x7007, 2.0f);
midichannel_setChanMaskWithTransitionSpeed(0x7007, 2.0f);
}
break;
case MAP_A_TTC_SANDCASTLE:
core1_ce60_setChanMaskFromWaterState(0xCE, 0x3C);
midichannel_setChanMaskFromWaterState(0xCE, 0x3C);
break;
case MAP_43_CCW_SPRING:
core1_ce60_setChanMaskFromWaterState(0x400, 0x7bbf);
midichannel_setChanMaskFromWaterState(0x400, 0x7bbf);
break;
case MAP_45_CCW_AUTUMN:
if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER) {
core1_ce60_setChanMask(0x600);
midichannel_setChanMask(0x600);
} else {
core1_ce60_func_8024A9EC(0);
core1_ce60_setChanMask(0x7BEF);
midichannel_func_8024A9EC(0);
midichannel_setChanMask(0x7BEF);
}
break;
@@ -362,148 +362,148 @@ void core1_ce60_func_8024AF48(void) {
case MAP_57_UNUSED:
case MAP_58_UNUSED:
case MAP_59_UNUSED:
core1_ce60_setChanMaskFromWaterState(0xc, 0x307b);
midichannel_setChanMaskFromWaterState(0xc, 0x307b);
break;
case MAP_56_UNUSED:
core1_ce60_setChanMaskFromWaterState(0x10, 0x4f6f);
midichannel_setChanMaskFromWaterState(0x10, 0x4f6f);
break;
case MAP_27_FP_FREEZEEZY_PEAK:
if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) {
core1_ce60_setChanMask(0x400);
midichannel_setChanMask(0x400);
} else if (mapSpecificFlags_get(0) && !jiggyscore_isCollected(JIGGY_2F_FP_XMAS_TREE)) {
core1_ce60_setChanMask(0x4bff);
midichannel_setChanMask(0x4bff);
} else {
core1_ce60_setChanMask(0x43ff);
midichannel_setChanMask(0x43ff);
}
break;
case MAP_65_CCW_SPRING_WHIPCRACK_ROOM:
core1_ce60_setChanMask(0x107);
midichannel_setChanMask(0x107);
break;
case MAP_66_CCW_SUMMER_WHIPCRACK_ROOM:
core1_ce60_setChanMask(0x1C7);
midichannel_setChanMask(0x1C7);
break;
case MAP_67_CCW_AUTUMN_WHIPCRACK_ROOM:
core1_ce60_setChanMask(0xC07);
midichannel_setChanMask(0xC07);
break;
case MAP_68_CCW_WINTER_WHIPCRACK_ROOM:
core1_ce60_setChanMask(0x1407);
midichannel_setChanMask(0x1407);
break;
case MAP_5E_CCW_SPRING_NABNUTS_HOUSE:
core1_ce60_setChanMask(0x41fe);
midichannel_setChanMask(0x41fe);
break;
case MAP_5F_CCW_SUMMER_NABNUTS_HOUSE:
core1_ce60_setChanMask(0x71fe);
midichannel_setChanMask(0x71fe);
break;
case MAP_60_CCW_AUTUMN_NABNUTS_HOUSE:
core1_ce60_setChanMask(0x7fe);
midichannel_setChanMask(0x7fe);
break;
case MAP_61_CCW_WINTER_NABNUTS_HOUSE:
core1_ce60_setChanMask(0xbfe);
midichannel_setChanMask(0xbfe);
break;
case MAP_63_CCW_AUTUMN_NABNUTS_WATER_SUPPLY:
core1_ce60_setChanMaskFromWaterState(1, 0x7fe);
midichannel_setChanMaskFromWaterState(1, 0x7fe);
break;
case MAP_64_CCW_WINTER_NABNUTS_WATER_SUPPLY:
core1_ce60_setChanMaskFromWaterState(1, 0xbfe);
midichannel_setChanMaskFromWaterState(1, 0xbfe);
break;
case MAP_69_GL_MM_LOBBY:
if (core1_ce60_isPlayerInRange(3510, -1630, 1250)) {
core1_ce60_setChanMask(0x7c00);
if (midichannel_isPlayerInRange(3510, -1630, 1250)) {
midichannel_setChanMask(0x7c00);
} else {
core1_ce60_setChanMask(0x41ff);
midichannel_setChanMask(0x41ff);
}
break;
case MAP_6A_GL_TTC_AND_CC_PUZZLE:
if (696 <= sPlayerPosition[1] && core1_ce60_isPlayerInRange(-1557, -905, 477)) {
core1_ce60_setChanMask(0x8e40);
} else if (core1_ce60_isPlayerInRange(1500, -890, 550) || core1_ce60_isPlayerInRange(1876, -1107, 370)) {
core1_ce60_setChanMask(0xf040);
if (696 <= sPlayerPosition[1] && midichannel_isPlayerInRange(-1557, -905, 477)) {
midichannel_setChanMask(0x8e40);
} else if (midichannel_isPlayerInRange(1500, -890, 550) || midichannel_isPlayerInRange(1876, -1107, 370)) {
midichannel_setChanMask(0xf040);
} else {
core1_ce60_setChanMask(0x81ff);
midichannel_setChanMask(0x81ff);
}
break;
case MAP_6B_GL_180_NOTE_DOOR:
if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) {
core1_ce60_setChanMask(0x8800);
} else if (core1_ce60_isPlayerInRange(4331, 1269, 1840)) {
core1_ce60_setChanMask(0x8640);
} else if (core1_ce60_isPlayerInRange(-1318, 1911, 293) || core1_ce60_isPlayerInRange(-1301, 2168, 234)) {
core1_ce60_setChanMask(0xf000);
midichannel_setChanMask(0x8800);
} else if (midichannel_isPlayerInRange(4331, 1269, 1840)) {
midichannel_setChanMask(0x8640);
} else if (midichannel_isPlayerInRange(-1318, 1911, 293) || midichannel_isPlayerInRange(-1301, 2168, 234)) {
midichannel_setChanMask(0xf000);
} else {
core1_ce60_setChanMask(0x81bf);
midichannel_setChanMask(0x81bf);
}
break;
case MAP_6C_GL_RED_CAULDRON_ROOM:
core1_ce60_setChanMask(0x81bf);
midichannel_setChanMask(0x81bf);
break;
case MAP_6D_GL_TTC_LOBBY:
core1_ce60_setChanMask(0xf000);
midichannel_setChanMask(0xf000);
break;
case MAP_70_GL_CC_LOBBY:
if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) {
core1_ce60_setChanMask(0x8100);
} else if (core1_ce60_isPlayerInRange(-6614, -467, 1822)) {
core1_ce60_setChanMask(0xf047);
midichannel_setChanMask(0x8100);
} else if (midichannel_isPlayerInRange(-6614, -467, 1822)) {
midichannel_setChanMask(0xf047);
} else {
core1_ce60_setChanMask(0x8e41);
midichannel_setChanMask(0x8e41);
}
break;
case MAP_6E_GL_GV_LOBBY:
if (core1_ce60_isPlayerInRange(0, -6550, 3650)) {
core1_ce60_setChanMask(0xfe00);
if (midichannel_isPlayerInRange(0, -6550, 3650)) {
midichannel_setChanMask(0xfe00);
} else {
core1_ce60_setChanMask(0x81ff);
midichannel_setChanMask(0x81ff);
}
break;
case MAP_6F_GL_FP_LOBBY:
if (3701 <= sPlayerPosition[2]){
core1_ce60_setChanMask(0xe040);
midichannel_setChanMask(0xe040);
} else {
core1_ce60_setChanMask(0x81bf);
midichannel_setChanMask(0x81bf);
}
break;
case MAP_74_GL_GV_PUZZLE:
if (core1_ce60_isPlayerInRange(-2633, -31, 515)) {
core1_ce60_setChanMask(0xe600);
if (midichannel_isPlayerInRange(-2633, -31, 515)) {
midichannel_setChanMask(0xe600);
} else {
core1_ce60_setChanMask(0x81ff);
midichannel_setChanMask(0x81ff);
}
break;
case MAP_75_GL_MMM_LOBBY:
case MAP_7A_GL_CRYPT:
core1_ce60_setChanMask(0xd800);
midichannel_setChanMask(0xd800);
break;
case MAP_71_GL_STATUE_ROOM:
if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) {
core1_ce60_setChanMask(0x200);
} else if (core1_ce60_isPlayerInRange(-3854, -346, 770)) {
core1_ce60_setChanMask(0x9c00);
midichannel_setChanMask(0x200);
} else if (midichannel_isPlayerInRange(-3854, -346, 770)) {
midichannel_setChanMask(0x9c00);
} else {
core1_ce60_setChanMask(0x81bf);
midichannel_setChanMask(0x81bf);
}
break;
@@ -528,88 +528,88 @@ void core1_ce60_func_8024AF48(void) {
}
}
if (core1_ce60_isPlayerInRange(2883, -10520, 6480)) {
if (midichannel_isPlayerInRange(2883, -10520, 6480)) {
D_80275C18 = TRUE;
core1_ce60_setChanMask(0xe040);
midichannel_setChanMask(0xe040);
} else {
D_80275C18 = FALSE;
core1_ce60_setChanMask(0x9c00);
midichannel_setChanMask(0x9c00);
}
break;
case MAP_76_GL_640_NOTE_DOOR:
core1_ce60_setChanMaskFromWaterState(0x8200, 0x81bf);
midichannel_setChanMaskFromWaterState(0x8200, 0x81bf);
break;
case MAP_77_GL_RBB_LOBBY:
core1_ce60_setChanMaskFromWaterState(0x8200, 0xf000);
midichannel_setChanMaskFromWaterState(0x8200, 0xf000);
break;
case MAP_78_GL_RBB_AND_MMM_PUZZLE:
if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) {
core1_ce60_setChanMask(0x8200);
} else if (346 <= sPlayerPosition[1] && core1_ce60_isPlayerInRange(-2202, 538, 872)) {
core1_ce60_setChanMask(0x8C00);
} else if (core1_ce60_isPlayerInRange(-54, 20, 2652)) {
core1_ce60_setChanMask(0x81bf);
midichannel_setChanMask(0x8200);
} else if (346 <= sPlayerPosition[1] && midichannel_isPlayerInRange(-2202, 538, 872)) {
midichannel_setChanMask(0x8C00);
} else if (midichannel_isPlayerInRange(-54, 20, 2652)) {
midichannel_setChanMask(0x81bf);
} else {
core1_ce60_setChanMask(0xf000);
midichannel_setChanMask(0xf000);
}
break;
case MAP_79_GL_CCW_LOBBY:
if(796 <= sPlayerPosition[1] && sPlayerPosition[1] < 1100 && core1_ce60_isPlayerInRange(28, 4553, 1073)) {
core1_ce60_setChanMask(0x81bf);
} else if (-4 <= sPlayerPosition[1] && sPlayerPosition[1] < 360 && core1_ce60_isPlayerInRange(135, 4979, 2156)) {
core1_ce60_setChanMask(0x81bf);
if(796 <= sPlayerPosition[1] && sPlayerPosition[1] < 1100 && midichannel_isPlayerInRange(28, 4553, 1073)) {
midichannel_setChanMask(0x81bf);
} else if (-4 <= sPlayerPosition[1] && sPlayerPosition[1] < 360 && midichannel_isPlayerInRange(135, 4979, 2156)) {
midichannel_setChanMask(0x81bf);
} else {
core1_ce60_setChanMask(0x9e00);
midichannel_setChanMask(0x9e00);
}
break;
case MAP_80_GL_FF_ENTRANCE:
if(sPlayerPosition[2] < 0x4e2)
core1_ce60_setChanMask(0xe040);
midichannel_setChanMask(0xe040);
else
core1_ce60_setChanMask(0x9e00);
midichannel_setChanMask(0x9e00);
break;
case MAP_7F_FP_WOZZAS_CAVE:
core1_ce60_func_8024A9EC((sns_get_item_state(SNS_ITEM_ICE_KEY, 1) && core1_ce60_isPlayerInRange(1561, 2426, 1690)) ? 0x7ff8 : 0);
core1_ce60_setChanMaskFromWaterState(0x20, 0x1f);
midichannel_func_8024A9EC((sns_get_item_state(SNS_ITEM_ICE_KEY, 1) && midichannel_isPlayerInRange(1561, 2426, 1690)) ? 0x7ff8 : 0);
midichannel_setChanMaskFromWaterState(0x20, 0x1f);
break;
case MAP_8B_RBB_ANCHOR_ROOM:
core1_ce60_setChanMaskFromWaterState(0x800, 0x51ff);
midichannel_setChanMaskFromWaterState(0x800, 0x51ff);
break;
case MAP_34_RBB_ENGINE_ROOM:
core1_ce60_setChanMaskFromWaterState(0x800, 0x43fe);
midichannel_setChanMaskFromWaterState(0x800, 0x43fe);
break;
case MAP_91_FILE_SELECT:
if (!gameSelect_getGameNumber()) {
core1_ce60_setChanMaskWithTransitionSpeed(0x200, 0.5f);
midichannel_setChanMaskWithTransitionSpeed(0x200, 0.5f);
} else {
core1_ce60_setChanMaskWithTransitionSpeed(0x1ff, 0.5f);
midichannel_setChanMaskWithTransitionSpeed(0x1ff, 0.5f);
}
break;
case MAP_8C_SM_BANJOS_HOUSE:
core1_ce60_setChanMaskWithTransitionSpeed(0x1ff, 0.5f);
midichannel_setChanMaskWithTransitionSpeed(0x1ff, 0.5f);
break;
case MAP_1D_MMM_CELLAR:
core1_ce60_func_8024A9EC((sns_get_item_state(SNS_ITEM_EGG_CYAN, 1) && !(sPlayerPosition[0] < 570)) ? 0x7ff8 : 0);
midichannel_func_8024A9EC((sns_get_item_state(SNS_ITEM_EGG_CYAN, 1) && !(sPlayerPosition[0] < 570)) ? 0x7ff8 : 0);
break;
case MAP_46_CCW_WINTER:
core1_ce60_func_8024A9EC(0);
midichannel_func_8024A9EC(0);
break;
}
}
void core1_ce60_incOrDecCounter(bool increment) {
void midichannel_incOrDecCounter(bool increment) {
if (increment) {
sUnusedCounter++;
}
@@ -618,7 +618,7 @@ void core1_ce60_incOrDecCounter(bool increment) {
}
}
void core1_ce60_func_8024BD40(s32 arg0, s32 arg1) {
void midichannel_func_8024BD40(s32 arg0, s32 arg1) {
if (arg1 == 3)
return;
+71 -80
View File
@@ -1,8 +1,5 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "version.h"
#if VERSION == VERSION_USA_1_0
@@ -85,19 +82,13 @@ 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) {
void gcdebugtext_setRGB(s32 r, s32 g, s32 b) {
red = r;
green = g;
blue = b;
}
void setPixelInFrameBuffer(s32 x, s32 y) {
void gcdebugtext_setPixelInFrameBuffer(s32 x, s32 y) {
if (((x >= 0) && (x < gFramebufferWidth))
&& ((y >= 0) && (y < gFramebufferHeight))) {
@@ -107,13 +98,13 @@ void setPixelInFrameBuffer(s32 x, s32 y) {
}
// 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) {
void gcdebugtext_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);
gcdebugtext_setPixelInFrameBuffer(x + ix, y + iy);
}
}
@@ -121,48 +112,48 @@ void drawPixel(s32 x, s32 y, s32 w, s32 h) {
}
// 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_drawSquare(s32 r, s32 g, s32 b) {
gcdebugtext_setRGB(r, g, b);
gcdebugtext_drawPixel((gFramebufferWidth - 128) / 2, (gFramebufferHeight - 100) / 2, 128, 100);
}
void gcdebugText_empty(void) { }
void gcdebugtext_stub1(void) {}
// Wastes time, and doesn't trigger isThreadLocked
void gcdebugText_stallOnThread(void) {
void gcdebugtext_stallOnThread(void) {
s32 i;
for (i = 0; i < 2000000; i++) {
gcdebugText_empty();
gcdebugtext_stub1();
}
}
// Flashes a colored square in the middle of the screen permanently
void gcdebugText_flashSquare(s32 color) {
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();
gcdebugtext_drawSquare(RGB_VALUES[color][0], RGB_VALUES[color][1], RGB_VALUES[color][2]);
gcdebugtext_stallOnThread();
gcdebugtext_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();
void gcdebugtext_drawSquare2(s32 color) {
gcdebugtext_drawSquare(RGB_VALUES[color][0], RGB_VALUES[color][1], RGB_VALUES[color][2]);
gcdebugtext_stallOnThread();
gcdebugtext_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]);
void gcdebugtext_drawSquareOnly(s32 color) {
gcdebugtext_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) {
void gcdebugtext_drawCharacter(s32 colorSelect, s32 displayCharacter, s32 fontSize, s32 keepCursor, bool setBackgroundColorBlack, s32 r, s32 g, s32 b) {
s32 j;
s32 i;
u32 char_width;
@@ -180,17 +171,17 @@ void drawCharacter(s32 colorSelect, s32 displayCharacter, s32 fontSize, s32 keep
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,
gcdebugtext_setRGB(r, g, b);
gcdebugtext_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);
gcdebugtext_setRGB(0, 0, 0);
}
drawPixel((cursorPosition + fontSize * j) - keepCursor,
gcdebugtext_drawPixel((cursorPosition + fontSize * j) - keepCursor,
(startingYCoordinate + y_position) - keepCursor,
(fontSize + keepCursor) + keepCursor,
(fontSize + keepCursor) + keepCursor);
@@ -205,7 +196,7 @@ void drawCharacter(s32 colorSelect, s32 displayCharacter, s32 fontSize, s32 keep
}
// Seems unneeded, since text is cleared anyway
void gcdebugText_clearText(void) {
void gcdebugtext_clearText(void) {
s32 i;
if (clearTime == 0) {
@@ -228,22 +219,22 @@ void gcdebugText_clearText(void) {
}
// 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,
void gcdebugtext_printCharacter(s32 colorSelect, s32 displayCharacter, s32 fontSize) {
gcdebugtext_drawCharacter(colorSelect, displayCharacter, fontSize, TRUE, TRUE, 0, 0, 0);
gcdebugtext_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) {
void gcdebugtext_printValue(s32 colorSelect, s32 displayValue, s32 fontSize) {
s32 j, i;
cursorPosition = startingXCoordinate;
currentFontSize = fontSize;
if (displayValue < 0) {
printCharacter(colorSelect, 0x26, fontSize); // Print - character
gcdebugtext_printCharacter(colorSelect, 0x26, fontSize); // Print - character
displayValue *= -1; // Convert to positive for the next calculation
}
@@ -259,11 +250,11 @@ void printValue(s32 colorSelect, s32 displayValue, s32 fontSize) {
displayValue -= i;
}
printCharacter(colorSelect, j, fontSize);
gcdebugtext_printCharacter(colorSelect, j, fontSize);
}
printCharacter(colorSelect, displayValue, fontSize);
gcdebugText_printSpace();
gcdebugtext_printCharacter(colorSelect, displayValue, fontSize);
gcdebugtext_printSpace();
if (fontSize == 7) { // Corresponds to largeValue
largeValueCursorPosition = cursorPosition;
@@ -275,30 +266,30 @@ void printValue(s32 colorSelect, s32 displayValue, s32 fontSize) {
// 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) {
void gcdebugtext_showLargeValue(s32 colorSelect, s32 displayValue) {
isThreadLocked = FALSE;
currentColor = colorSelect;
startingXCoordinate = 0xE;
startingYCoordinate = 0xA;
printValue(colorSelect, displayValue, 7);
gcdebugText_wrapToTop();
gcdebugtext_printValue(colorSelect, displayValue, 7);
gcdebugtext_wrapToTop();
largeYCoordinate = startingYCoordinate;
longestLineLengthPosition = startingXCoordinate;
shouldClearText = TRUE;
}
void gcdebugText_showValue(s32 displayValue) {
printValue(currentColor, displayValue, 2);
gcdebugText_wrapToTop();
void gcdebugtext_showValue(s32 displayValue) {
gcdebugtext_printValue(currentColor, displayValue, 2);
gcdebugtext_wrapToTop();
}
// Given a value such as 0x0F64 will print on screen ":0F64"
void gcdebugText_showHexValue(u32 displayValue) {
void gcdebugtext_showHexValue(u32 displayValue) {
s32 display_character;
cursorPosition = startingXCoordinate;
currentFontSize = 2;
printCharacter(currentColor, 0x25, 2); // Print :
gcdebugtext_printCharacter(currentColor, 0x25, 2); // Print :
display_character =
(displayValue >= 0x01000000U) ? 0x1C
: (displayValue >= 0x10000U) ? 0x14
@@ -306,16 +297,16 @@ void gcdebugText_showHexValue(u32 displayValue) {
if (display_character >= 0) {
do {
printCharacter(currentColor, ((s32) displayValue >> display_character) & 0xF, 2);
gcdebugtext_printCharacter(currentColor, ((s32) displayValue >> display_character) & 0xF, 2);
display_character -= 4;
} while (display_character >= 0);
}
gcdebugText_endLine();
gcdebugtext_endLine();
}
// Possibly bugged
void gcdebugText_showFloat(f32 displayValue) {
void gcdebugtext_showFloat(f32 displayValue) {
f32 display_position;
s32 display_character;
@@ -324,7 +315,7 @@ void gcdebugText_showFloat(f32 displayValue) {
// If a negative number, print the - symbol and convert the number to positive
if (displayValue < 0.0f) {
printCharacter(currentColor, 0x26, 2);
gcdebugtext_printCharacter(currentColor, 0x26, 2);
displayValue *= -1.0f;
}
@@ -336,7 +327,7 @@ void gcdebugText_showFloat(f32 displayValue) {
while (1e-09 <= display_position) {
if ((0.09 < display_position) && (display_position < 0.11)) {
printCharacter(currentColor, 0x24, 2); // . character
gcdebugtext_printCharacter(currentColor, 0x24, 2); // . character
}
display_character = 0;
@@ -344,15 +335,15 @@ void gcdebugText_showFloat(f32 displayValue) {
displayValue -= display_position;
display_character += 1;
}
printCharacter(currentColor, display_character, 2);
gcdebugtext_printCharacter(currentColor, display_character, 2);
display_position /= 10.0f;
}
gcdebugText_endLine();
gcdebugtext_endLine();
}
// Turns characters into the corresponding number for CHARACTER_ENCODING
s32 encodeCharacter(s32 character) {
s32 gcdebugtext_encodeCharacter(s32 character) {
// Lowercase letters
if ((character >= (s32) CHARACTER_RANGE[0]) && ((s32) CHARACTER_RANGE[1] >= character)) {
@@ -394,8 +385,8 @@ s32 encodeCharacter(s32 character) {
// 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) {
// gcdebugtext_showText(str);
void gcdebugtext_showText(u8 *text) {
s32 i;
s32 character;
@@ -404,21 +395,21 @@ void gcdebugText_showText(u8 *text) {
for (i = 0; text[i] != 0; i++) {
character = text[i];
printCharacter(currentColor, encodeCharacter(character), 2);
gcdebugtext_printCharacter(currentColor, gcdebugtext_encodeCharacter(character), 2);
}
gcdebugText_endLine();
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) {
void gcdebugtext_lockScreen(void) {
isThreadLocked = TRUE;
do { } while (1);
}
// Temporarily stop the thread, presumably to show the value
void gcdebugText_pauseThread(void) {
void gcdebugtext_pauseThread(void) {
s32 i;
isThreadLocked = TRUE;
@@ -428,7 +419,7 @@ void gcdebugText_pauseThread(void) {
isThreadLocked = FALSE;
}
void gcdebugText_pauseThreadForTime(s32 time) {
void gcdebugtext_pauseThreadForTime(s32 time) {
s32 i;
isThreadLocked = TRUE;
@@ -441,7 +432,7 @@ void gcdebugText_pauseThreadForTime(s32 time) {
isThreadLocked = FALSE;
}
void checkYAndgcdebugText_wrapToTop(s32 lineHeight) {
void gcdebugtext_checkYAndgcdebugtext_wrapToTop(s32 lineHeight) {
startingYCoordinate += lineHeight;
// Only continue if the y coordinate is about to go off screen
@@ -457,37 +448,37 @@ void checkYAndgcdebugText_wrapToTop(s32 lineHeight) {
}
// Calculate line height and wrap
void gcdebugText_wrapToTop(void) {
checkYAndgcdebugText_wrapToTop(currentFontSize * 5 + 2);
void gcdebugtext_wrapToTop(void) {
gcdebugtext_checkYAndgcdebugtext_wrapToTop(currentFontSize * 5 + 2);
}
// Unused, but possibly used for very tiny debugs
void gcdebugText_wrapToTopSmall(void) {
checkYAndgcdebugText_wrapToTop(2);
void gcdebugtext_wrapToTopSmall(void) {
gcdebugtext_checkYAndgcdebugtext_wrapToTop(2);
}
void gcdebugText_endLine(void) {
gcdebugText_printSpace();
void gcdebugtext_endLine(void) {
gcdebugtext_printSpace();
if (cursorPosition >= longestLineLengthPosition) {
longestLineLengthPosition = cursorPosition;
}
gcdebugText_wrapToTop();
gcdebugtext_wrapToTop();
}
void gcdebugText_printSpace(void) {
void gcdebugtext_printSpace(void) {
s16 tempCursorPosition;
tempCursorPosition = cursorPosition--;
printCharacter(currentColor, 0x27, currentFontSize);
gcdebugtext_printCharacter(currentColor, 0x27, currentFontSize);
cursorPosition = tempCursorPosition;
}
s32 gcdebugText_isThreadLocked(void) {
bool gcdebugtext_isThreadLocked(void) {
return isThreadLocked;
}
void gcdebugText_unused(s32 arg0) { }
void gcdebugtext_stub2(s32 arg0) {}
#endif
+9 -10
View File
@@ -1,47 +1,46 @@
#include <ultra64.h>
#include <PRinternal/macros.h>
#include "core1/core1.h"
#include "functions.h"
static void defragThread_entry(void *args);
static OSMesgQueue sDefragThreadResumeSyncQueue;
static OSMesg sDefragThreadResumeSyncMesg;
static OSMesgQueue sDefragThreadPauseSyncQueue;
static OSMesg sDefragThreadPauseSyncMesg;
static OSThread sDefragThread;
static u8 sDefragThreadStack[DEFRAGMANAGER_THREAD_STACK_SIZE];
STACK(sDefragThreadStack, 2048);
void defragManager_init(void) {
void defragthread_init(void) {
osCreateMesgQueue(&sDefragThreadResumeSyncQueue, &sDefragThreadResumeSyncMesg, 1);
osCreateMesgQueue(&sDefragThreadPauseSyncQueue, &sDefragThreadPauseSyncMesg, 1);
osCreateThread(&sDefragThread, DEFRAGMANAGER_THREAD_ID, defragThread_entry, NULL, sDefragThreadStack + DEFRAGMANAGER_THREAD_STACK_SIZE, DEFRAGMANAGER_THREAD_PRIORITY);
osCreateThread(&sDefragThread, DEFRAGMANAGER_THREAD_ID, defragthread_entry, NULL, STACK_START(sDefragThreadStack), DEFRAGMANAGER_THREAD_PRI);
osStartThread(&sDefragThread);
}
void defragManager_free(void) {
void defragthread_free(void) {
osStopThread(&sDefragThread);
osDestroyThread(&sDefragThread);
}
void defragManager_resume(void) {
void defragthread_resume(void) {
if (func_8023E000() == 3) {
osSendMesg(&sDefragThreadResumeSyncQueue, NULL, OS_MESG_BLOCK);
}
}
void defragManager_pause(void) {
void defragthread_pause(void) {
if (func_8023E000() == 3) {
osSendMesg(&sDefragThreadPauseSyncQueue, NULL, OS_MESG_BLOCK);
}
}
void defragManager_setPriority(OSPri pri) {
void defragthread_setPriority(OSPri pri) {
if (func_8023E000() == 3) {
osSetThreadPri(&sDefragThread, pri);
}
}
static void defragThread_entry(void *args) {
void defragthread_entry(void *arg) {
s32 defrag_flag;
do {
+4 -4
View File
@@ -11,9 +11,9 @@ s32 eeprom_writeBlocks(s32 file, s32 offset, void *buffer, s32 count) {
s32 address = file * GAMEFILE_NUM_BLOCKS + offset;
s32 ret;
func_8024F35C(3);
controller_func_8024F35C(3);
ret = osEepromLongWrite(pfsManager_getFrameReplyQ(), address, buffer, count * EEPROM_BLOCK_SIZE);
func_8024F35C(0);
controller_func_8024F35C(0);
return ret;
}
@@ -22,9 +22,9 @@ s32 eeprom_readBlocks(s32 file, s32 offset, void *buffer, s32 count) {
s32 address = file * GAMEFILE_NUM_BLOCKS + offset;
s32 ret;
func_8024F35C(3);
controller_func_8024F35C(3);
ret = osEepromLongRead(pfsManager_getFrameReplyQ(), address, buffer, count * EEPROM_BLOCK_SIZE);
func_8024F35C(0);
controller_func_8024F35C(0);
return ret;
}
+20 -23
View File
@@ -1,5 +1,6 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "core2/core2.h"
#define IA8_I(ia) ((ia) >> 4)
#define IA8_A(ia) ((ia) & 0xF)
@@ -37,7 +38,7 @@ void framebufferdraw_draw_CI4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alp
s32 color2;
framebuffer = gFramebuffers[sBufferIndex];
sprite_frame = sprite_getFramePtr(sprite, (u32) frame);
sprite_frame = sprite_getFramePtr(sprite, frame);
if (!alpha_enabled){
framebufferdraw_setPrimColor(0, 0, 0x80);
framebufferdraw_drawRect(x, y, sprite_frame->w, sprite_frame->h);
@@ -55,7 +56,7 @@ void framebufferdraw_draw_CI4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alp
tmem = (u8 *) (chunk + 1);
while (((s32) tmem) % 8)
{
tmem = ((s32) tmem) + 1;
tmem++;
}
//copy texture to framebuffer
@@ -75,7 +76,7 @@ void framebufferdraw_draw_CI4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alp
*pxl_ptr = color1;
} else if (!alpha_enabled) {
*pxl_ptr = (unsigned long) 1;
palette_offset = (u16 *) (sprite_frame + 1); //THIS IS GARBAGE for correct reg alloc
palette_offset = (s32) sprite_frame->palette;
}
if (palette[indx2] & 1) {
pxl_ptr[1] = palette[indx2];
@@ -113,24 +114,20 @@ void framebufferdraw_draw_CI8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alp
D_80275C00 = 0;
}
framebuffer = gFramebuffers[sBufferIndex];
sprite_frame = sprite_getFramePtr(sprite, (u32) frame);
sprite_frame = sprite_getFramePtr(sprite, frame);
if (!alpha_enabled){
framebufferdraw_setPrimColor(0, 0, 0x80);
framebufferdraw_drawRect(x, y, sprite_frame->w, sprite_frame->h);
}
palette = (u16 *) (sprite_frame + 1);
for (palette_unaligned = palette; ((s32) palette_unaligned) % 8; palette_unaligned++){
;
}
palette = palette_unaligned;
palette = sprite_frame->palette;
for (palette_unaligned = (s32) palette; palette_unaligned % 8; palette_unaligned++);
palette = (u16 *) palette_unaligned;
chunk = (BKSpriteTextureBlock *) (palette + 0x100);
for (i_chunk = 0; i_chunk < sprite_frame->chunkCnt; i_chunk++){
palette_unaligned = (u16 *) (chunk + 1);
for (tmem = (u16 *) (chunk + 1); ((s32) tmem) % 8; tmem++){
;
}
palette_unaligned = (s32) ((u16 *) (chunk + 1));
for (tmem = (u8 *) ((u16 *) (chunk + 1)); ((s32) tmem) % 8; tmem++);
for (iy = 0; iy < chunk->h; iy++){
for (ix = 0; ix < chunk->w; ix++){
@@ -186,7 +183,7 @@ void framebufferdraw_draw_RGBA16(s32 x, s32 y, BKSprite *sprite, s32 frame, bool
}
chunk_ptr = (BKSpriteTextureBlock *)(sprite_ptr + 1);
for(i_chunk = 0; i_chunk < sprite_ptr->chunkCnt; i_chunk++) {
for(tmem = (u16 *)(chunk_ptr + 1); (s32)tmem % 8; tmem++);
for(tmem = (s16 *)(chunk_ptr + 1); (s32)tmem % 8; tmem++);
for(txtr_y = 0; txtr_y < chunk_ptr->h; txtr_y++) {
for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x++) {
@@ -327,7 +324,7 @@ void framebufferdraw_draw_IA4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool ap
void framebufferdraw_draw_I8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled) {
BKSpriteFrame *frame_ptr;
BKSpriteTextureBlock *chunk_ptr;
s16 *pixel_ptr;
u16 *pixel_ptr;
u8 *txtr_ptr;
s32 fb_y;
u16 *framebuffer_ptr;
@@ -368,14 +365,14 @@ void framebufferdraw_draw_I8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alph
txtr_ptr += 1;
}
}
chunk_ptr = (BKSpriteFrame *) txtr_ptr;
chunk_ptr = (BKSpriteTextureBlock *) txtr_ptr;
}
}
void framebufferdraw_draw_IA8(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabled) {
BKSpriteFrame *sprite_frame;
BKSpriteTextureBlock *chunk_ptr;
s16 *temp_a1;
u16 *temp_a1;
s16 *temp_v0;
u8 *var_t2;
u16 *framebuffer_ptr;
@@ -415,7 +412,7 @@ void framebufferdraw_draw_IA8(s32 x, s32 y, BKSprite *sprite, s32 frame, bool al
var_t2++;
}
}
chunk_ptr = (BKSpriteFrame *) var_t2;
chunk_ptr = (BKSpriteTextureBlock *) var_t2;
}
}
@@ -488,7 +485,7 @@ void framebufferdraw_draw_RGBA32(s32 x, s32 y, BKSprite *sprite, s32 frame, s32
}
}
chunk_ptr = (BKSpriteFrame *) tmem;
chunk_ptr = (BKSpriteTextureBlock *) tmem;
}
}
}
@@ -542,7 +539,7 @@ void framebufferdraw_draw(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_e
}
//arg4 = alpha enabled?
void framebufferdraw_func_80249DE0(s32 x, s32 y, s16 *arg2, s32 arg3, s32 arg4) {
void framebufferdraw_func_80249DE0(s32 x, s32 y, Struct84s *arg2, s32 arg3, s32 arg4) {
s32 ix;
s32 var_t2;
s32 iy;
@@ -553,7 +550,7 @@ void framebufferdraw_func_80249DE0(s32 x, s32 y, s16 *arg2, s32 arg3, s32 arg4)
temp_v0 = func_8033EFB0(arg2, arg3);
texture_ptr = (u16*)(temp_v0 + 1);
if (*arg2 == SPRITE_TYPE_CI4) {
if (arg2->texture_type == SPRITE_TYPE_CI4) {
framebufferdraw_drawTexture_CI4(x, y, temp_v0 + 1, temp_v0->w, temp_v0->h, arg4);
return;
}
@@ -652,8 +649,8 @@ void framebufferdraw_func_8024A564(s32 x, s32 y, u16 *arg2, s32 arg3, s32 arg4,
s32 var_t3;
s32 var_v0;
s32 fb_width;
s16 *pixel;
s16 *var_t2;
u16 *pixel;
u16 *var_t2;
var_v0 = 0;
fb_width = gFramebufferWidth;
+2 -5
View File
@@ -1,16 +1,13 @@
#include <ultra64.h>
#include "core1/core1.h"
// transform seed (in mips3 file)
u32 func_8025C29C(u32 *seed); // TODO: This function does not exist in source code, why does it work?
void glcrc_calc_checksum(void *start, void *end, u32 checksum[2]) {
void glcrc_calcChecksum(void *start, void *end, u32 checksum[2]) {
u8 *p;
u32 shift = 0;
u64 seed = 0x8F809F473108B3C1;
u32 crc1 = 0;
u32 crc2 = 0;
u32 tmp;
s32 tmp;
// CRC1: Iterate forwards over bytes
for (p = start; (void *)p < end; p++) {
+5 -13
View File
@@ -1,27 +1,19 @@
#include <ultra64.h>
#include <PRinternal/macros.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#define INIT_THREAD_STACK_SIZE 0x200
u8 sInitThreadStack[INIT_THREAD_STACK_SIZE]; // Size based on the previous symbol's address
STACK(sInitThreadStack, 512); // Size based on the previous symbol's address
OSThread sInitThread;
void initThread_entry(void *arg);
void initThread_create(void) {
osCreateThread(&sInitThread, 1, initThread_entry, NULL, sInitThreadStack + INIT_THREAD_STACK_SIZE, OS_PRIORITY_IDLE);
osCreateThread(&sInitThread, INITTHREAD_ID, initThread_entry, NULL, STACK_START(sInitThreadStack), OS_PRIORITY_IDLE);
osStartThread(&sInitThread);
}
void piMgr_init(void);
void mainThread_create(void);
OSThread *mainThread_get(void);
void initThread_entry(void *arg)
{
piMgr_init();
void initThread_entry(void *arg) {
parallel_init();
mainThread_create();
osStartThread(mainThread_get());
while (1);
+3 -3
View File
@@ -601,16 +601,16 @@ void comusic_8025AB44(enum comusic_e track_id, s32 arg1, s32 arg2) {
func_8025AC20(track_id, arg1, arg2, 0.0f, "comusic.c", VER_SELECT(926, 927, 0, 0));
}
void comusic_8025AB78(enum comusic_e track_id, s32 arg1, s32 arg2, s32 arg3) {
void comusic_8025AB78(enum comusic_e track_id, s32 arg1, s32 arg2, s32 *arg3) {
func_8025AC7C(track_id, arg1, arg2, 0.0f, arg3, "comusic.c", VER_SELECT(931, 932, 0, 0));
}
void func_8025ABB8(enum comusic_e track_id, s32 arg1, s32 arg2, s32 arg3) {
func_8025AC7C(track_id, arg1, arg2, 0.0f, (s32)&(comusic_findTrack(track_id)->unk1C[arg3]), "comusic.c", VER_SELECT(938, 939, 0, 0));
func_8025AC7C(track_id, arg1, arg2, 0.0f, &(comusic_findTrack(track_id)->unk1C[arg3]), "comusic.c", VER_SELECT(938, 939, 0, 0));
}
void func_8025AC20(enum comusic_e track_id, s32 arg1, s32 arg2, f32 arg3, char* arg4, s32 char5) {
func_8025AC7C(track_id, arg1, arg2, 0.0f, (s32) comusic_findTrack(track_id)->unk1C, "comusic.c", VER_SELECT(945, 946, 0, 0));
func_8025AC7C(track_id, arg1, arg2, 0.0f, comusic_findTrack(track_id)->unk1C, "comusic.c", VER_SELECT(945, 946, 0, 0));
}
void func_8025AC7C(enum comusic_e track_id, s32 arg1, s32 arg2, f32 arg3, s32 *arg4, const char *filename, s32 arg6){
+4 -13
View File
@@ -3,18 +3,9 @@
#include "core1/core1.h"
#include "checksums.h"
extern u8 gHeapBase;
extern u32 D_8027BF2C;
extern u32 D_8027BF30;
extern u8 gHeapBase[];
void overlay_load(
s32 id,
u8 *ram_start, u8 *ram_end,
u32 rom_start, u32 rom_end,
u8 *code_start, u8 *code_end,
u8 *data_start, u8 *data_end,
u8 *bss_start, u8 *bss_end
) {
void overlay_load(s32 id, u8 *ram_start, u8 *ram_end, u32 rom_start, u32 rom_end, u8 *code_start, u8 *code_end, u8 *data_start, u8 *data_end, u8 *bss_start, u8 *bss_end) {
void *compressed_buffer;
u32 crc2, crc1;
struct overlay_checksums_s *checksums;
@@ -34,10 +25,10 @@ void overlay_load(
core1_15B30_sendMesg3ToRenderThread();
compressed_buffer = &D_8000E800;
} else {
compressed_buffer = &gHeapBase;
compressed_buffer = gHeapBase;
}
piMgr_read(compressed_buffer, rom_start, rom_end - rom_start);
parallel_readDMA(compressed_buffer, rom_start, rom_end - rom_start);
rarezip_uncompress(&compressed_buffer, &ram_start);
crc1 = D_8027BF2C;
crc2 = D_8027BF30;
+7 -9
View File
@@ -1,4 +1,5 @@
#include <ultra64.h>
#include <PRinternal/macros.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
@@ -7,9 +8,6 @@
#include "version.h"
#include "checksums.h"
#define PFSMANAGER_THREAD_STACK_SIZE 0x200
s32 D_80275D30 = VER_SELECT(0xC3A68832, 0xED7BCDB7, 0, 0); // CCW_DATA_CRC2
s32 D_80275D34 = VER_SELECT(0xDDC3A724, 0xF82DC7AC, 0, 0); // FIGHT_DATA_CRC2
@@ -32,7 +30,7 @@ OSContStatus pfsManagerContStatus;
u8 pad_D_80281320[0x8];
volatile s32 pfsManagerBusy;
OSThread sPfsManagerThread;
u8 sPfsManagerThreadStack[PFSMANAGER_THREAD_STACK_SIZE];
STACK(sPfsManagerThreadStack, 512);
f32 D_802816E0;
OSMesgQueue D_802816E8;
OSMesg D_80281700[4];
@@ -255,7 +253,7 @@ void pfsManager_update(void) {
}
void pfsManager_readData(){
func_8024F35C(0);
controller_func_8024F35C(0);
if(!pfsManagerContStatus.errno)
osContGetReadData(pfsManagerContPadData);
}
@@ -276,7 +274,7 @@ void pfsManager_entry(void *arg) {
void pfsManager_init(void) {
osCreateMesgQueue(&pfsManagerContPollingMsqQ, &pfsManagerContPollingMsqBuf, 1);
osCreateMesgQueue(&pfsManagerContReplyMsgQ, &pfsManagerContReplyMsgBuf, 1);
osCreateThread(&sPfsManagerThread, 7, pfsManager_entry, NULL, sPfsManagerThreadStack + PFSMANAGER_THREAD_STACK_SIZE, 40);
osCreateThread(&sPfsManagerThread, CONTROLLER_THREAD_ID, pfsManager_entry, NULL, STACK_START(sPfsManagerThreadStack), CONTROLLER_THREAD_PRI);
osSetEventMesg(OS_EVENT_SI, &pfsManagerContPollingMsqQ, &pfsManagerContPollingMsqBuf);
osContInit(&pfsManagerContPollingMsqQ, &pfsManagerBitPattern, &pfsManagerContStatus);
osContSetCh(1);
@@ -301,7 +299,7 @@ void func_8024F180(void){
void pfsManager_getStartReadData(void){
if(pfsManagerBusy == 0){
func_8024F35C(1);
controller_func_8024F35C(1);
osContStartReadData(&pfsManagerContPollingMsqQ);
}
}
@@ -353,7 +351,7 @@ OSMesgQueue *pfsManager_getFrameMesgQ(void){
return &pfsManagerContPollingMsqQ;
}
void func_8024F35C(s32 arg0) {
void controller_func_8024F35C(s32 arg0) {
if(!arg0)
func_8024F4AC();
else
@@ -379,7 +377,7 @@ OSContPad *func_8024F3F4(void){
/* initilizes D_802816E8 message queue */
void func_8024F400(void) {
D_80275D38 = TRUE;
osCreateMesgQueue(&D_802816E8, &D_80281700, 5);
osCreateMesgQueue(&D_802816E8, D_80281700, 5);
osSendMesg(&D_802816E8, 0, OS_MESG_NOBLOCK);
}
+26 -22
View File
@@ -1,45 +1,49 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "version.h"
#define PIMGR_MESGBUFFER_SIZE 16
#define PIMANAGER_MESGBUFFER_SIZE 16
OSIoMesg sPiMgrIOMesg;
#if VERSION == VERSION_USA_1_0
#define BLOCK_SIZE 0x20000
#elif VERSION == VERSION_PAL
#define BLOCK_SIZE 0x8000
#endif
struct {
OSIoMesg io_mesg;
OSMesg mesg;
OSMesgQueue queue;
} sPiMgrReadMesg;
} sPiManagerDMAData;
OSMesg sPiMgrMesgBuffer[PIMGR_MESGBUFFER_SIZE];
OSMesgQueue sPiMgrMesgQueue;
struct {
OSMesg mesg[PIMANAGER_MESGBUFFER_SIZE];
OSMesgQueue queue;
} sPiManagerData;
void piMgr_read(void *vaddr, s32 devaddr, s32 size) {
void parallel_readDMA(void *vaddr, s32 devaddr, s32 size) {
s32 block_cnt;
s32 block_remainder;
s32 block_size = VER_SELECT(0x20000, 0x8000, 0, 0);
int i;
osWritebackDCache(vaddr, size);
block_cnt = size / block_size;
block_remainder = size % block_size;
block_cnt = size / BLOCK_SIZE;
block_remainder = size % BLOCK_SIZE;
for(i = 0; i < block_cnt; i++){
osPiStartDma(&sPiMgrIOMesg, OS_MESG_PRI_NORMAL, OS_READ, devaddr, vaddr, VER_SELECT(0x20000, 0x8000, 0, 0), &sPiMgrReadMesg.queue);
osRecvMesg(&sPiMgrReadMesg.queue, NULL, 1);
devaddr += VER_SELECT(0x20000, 0x8000, 0, 0);
vaddr = (u32 *) vaddr + VER_SELECT(0x8000, 0x2000, 0, 0);
for (i = 0; i < block_cnt; i++) {
osPiStartDma(&sPiManagerDMAData.io_mesg, OS_MESG_PRI_NORMAL, OS_READ, devaddr, vaddr, BLOCK_SIZE, &sPiManagerDMAData.queue);
osRecvMesg(&sPiManagerDMAData.queue, NULL, OS_MESG_BLOCK);
devaddr += BLOCK_SIZE;
vaddr = (u8 *) vaddr + BLOCK_SIZE;
}
osPiStartDma(&sPiMgrIOMesg, OS_MESG_PRI_NORMAL, OS_READ, devaddr, vaddr, block_remainder, &sPiMgrReadMesg.queue);
osRecvMesg(&sPiMgrReadMesg.queue, NULL, 1);
osPiStartDma(&sPiManagerDMAData.io_mesg, OS_MESG_PRI_NORMAL, OS_READ, devaddr, vaddr, block_remainder, &sPiManagerDMAData.queue);
osRecvMesg(&sPiManagerDMAData.queue, NULL, OS_MESG_BLOCK);
osInvalDCache(vaddr, size);
}
void piMgr_init(void) {
osCreateMesgQueue(&sPiMgrReadMesg.queue, &sPiMgrReadMesg.mesg, 1);
osCreateMesgQueue(&sPiMgrMesgQueue, sPiMgrMesgBuffer, PIMGR_MESGBUFFER_SIZE);
osCreatePiManager(OS_PRIORITY_PIMGR, &sPiMgrMesgQueue, sPiMgrMesgBuffer, PIMGR_MESGBUFFER_SIZE);
void parallel_init(void) {
osCreateMesgQueue(&sPiManagerDMAData.queue, &sPiManagerDMAData.mesg, 1);
osCreateMesgQueue(&sPiManagerData.queue, sPiManagerData.mesg, PIMANAGER_MESGBUFFER_SIZE);
osCreatePiManager(OS_PRIORITY_PIMGR, &sPiManagerData.queue, sPiManagerData.mesg, PIMANAGER_MESGBUFFER_SIZE);
}
+2 -2
View File
@@ -42,14 +42,14 @@ void snspayload_set_key_at_idx(struct SnsPayload *payload, s32 idx, s32 key)
void snspayload_calc_checksum(struct SnsPayload *payload)
{
glcrc_calc_checksum(payload, &payload->checksum, payload->checksum);
glcrc_calcChecksum(payload, &payload->checksum, payload->checksum);
}
bool snspayload_validate(struct SnsPayload *payload)
{
u32 checksum[2];
glcrc_calc_checksum(payload, payload->checksum, checksum);
glcrc_calcChecksum(payload, payload->checksum, checksum);
if ((payload->checksum[0] == checksum[0]) && (payload->checksum[1] == checksum[1]))
return TRUE;
+1 -1
View File
@@ -21,7 +21,7 @@ s32 sprite_getFrameCount(BKSprite *this) {
return this->frameCnt;
}
BKSpriteFrame *sprite_getFramePtr(BKSprite *this, u32 frame_id) {
BKSpriteFrame *sprite_getFramePtr(BKSprite *this, s32 frame_id) {
BKSpriteFrame *sprite_frame;
sprite_frame = (BKSpriteFrame *) (this->offsets[frame_id] + ((s32) ((*this).offsets + this->frameCnt)));
return sprite_frame;
+3 -3
View File
@@ -7,7 +7,7 @@ void stub_13640_set(s32 value);
static s32 sUnused;
s32 stubVar_13640_get(void) {
s32 stub_13640_get(void) {
return sUnused;
}
@@ -15,6 +15,6 @@ void stub_13640_init(void) {
stub_13640_set(0);
}
void stub_13640_set(s32 arg0) {
sUnused = arg0;
void stub_13640_set(s32 value) {
sUnused = value;
}
+4 -4
View File
@@ -1,7 +1,7 @@
#include <ultra64.h>
#include "core1/core1.h"
void dummy_func_8025AFB0(void) {}
void dummy_func_8025AFB8(void) {}
void dummy_func_8025AFC0(Gfx **gfx, Mtx **mtx, Vtx **vtx) {}
s32 dummy_func_8025AFD0(void) { return 0; }
void core1_1D590_func_8025AFB0(void) {}
void core1_1D590_func_8025AFB8(void) {}
void core1_1D590_func_8025AFC0(Gfx **gfx, Mtx **mtx, Vtx **vtx) {}
s32 core1_1D590_func_8025AFD0(void) { return 0; }
+1 -1
View File
@@ -18,7 +18,7 @@ void ucode_load(void) {
sStatus |= sIMEMdword ? 0x02 : 0x00;
if (sStatus == 0) {
piMgr_read(sUcodeData, PHYS_TO_K1(PI_DOM1_ADDR2 + IPL3FONT_ROM_ADDR), UCODE_SIZE);
parallel_readDMA(sUcodeData, PHYS_TO_K1(PI_DOM1_ADDR2 + IPL3FONT_ROM_ADDR), UCODE_SIZE);
}
}
+10 -11
View File
@@ -1,11 +1,10 @@
#include <ultra64.h>
#include <PRinternal/macros.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "version.h"
#define VIMANAGER_THREAD_STACK_SIZE 0x400
// Used in US 1.0 NTSC
static OSViMode sViMode_US10_NTSC = {
OS_VI_NTSC_LPN1,
@@ -84,7 +83,7 @@ static OSMesg sMesgBuffer3[FRAMERATE];
volatile s32 D_802808D8;
s32 D_802808DC;
static OSThread sViManagerThread;
static u8 sViManagerThreadStack[VIMANAGER_THREAD_STACK_SIZE];
STACK(sViManagerThreadStack, 1024);
u32 getOtherFramebuffer(void) {
return NOT(sActiveFramebuffer);
@@ -145,7 +144,7 @@ void viMgr_init(void) {
D_802808D8 = 0;
viMgr_func_8024BF94(2);
osCreateThread(&sViManagerThread, 0, viMgr_entry, NULL, sViManagerThreadStack + VIMANAGER_THREAD_STACK_SIZE, 80);
osCreateThread(&sViManagerThread, VI_THREAD_ID, viMgr_entry, NULL, STACK_START(sViManagerThreadStack), VI_THREAD_PRI);
osStartThread(&sViManagerThread);
}
@@ -165,8 +164,8 @@ void viMgr_func_8024BFD8(s32 arg0){
static s32 D_80280E90;
osSetThreadPri(NULL, 0x7f);
defragManager_setPriority(DEFRAGMANAGER_THREAD_PRIORITY_HIGH);
defragManager_resume();
defragthread_setPriority(DEFRAGMANAGER_THREAD_PRI_HIGH);
defragthread_resume();
if(arg0){
osRecvMesg(&sMesgQueue2, NULL, OS_MESG_BLOCK);
}
@@ -187,14 +186,14 @@ void viMgr_func_8024BFD8(s32 arg0){
}//L8024C178
D_80280724 = D_802808D8;
D_802808D8 = 0;
defragManager_pause();
defragthread_pause();
osSetThreadPri(NULL, 0x14);
defragManager_setPriority(DEFRAGMANAGER_THREAD_PRIORITY);
defragthread_setPriority(DEFRAGMANAGER_THREAD_PRI);
}
void viMgr_func_8024C1B4(void){
viMgr_func_8024BFD8(0);
dummy_func_8025AFB8();
core1_1D590_func_8025AFB8();
}
void viMgr_func_8024C1DC(void){
@@ -217,7 +216,7 @@ void viMgr_setActiveFramebuffer(s32 fb_idx) {
osViSwapBuffer(gFramebuffers[sActiveFramebuffer]);
}
void viMgr_entry(void *arg0){
void viMgr_entry(void *arg){
s32 i;
OSMesg sp48;
do{
@@ -226,7 +225,7 @@ void viMgr_entry(void *arg0){
D_802808D8++;
if(D_802808D8 == 420){
#if VERSION == VERSION_USA_1_0
gcdebugText_isThreadLocked();
gcdebugtext_isThreadLocked();
#endif
}
osSendMesg(&sMesgQueue3, NULL, OS_MESG_NOBLOCK);
-1
View File
@@ -2,7 +2,6 @@
#include "functions.h"
#include "variables.h"
extern void baMotor_80250E6C(f32, f32);
extern void func_802BB360(s32, f32);
extern void func_802BB378(s32, f32, f32);
extern void func_802BB3AC(s32, f32);
+1 -1
View File
@@ -441,7 +441,7 @@ void bsant_die_update(void){
}
void bsant_die_end(void){
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
baphysics_reset_gravity();
pitch_setIdeal(0.0f);
roll_setIdeal(0.0f);
+1 -1
View File
@@ -465,7 +465,7 @@ void bsbswim_die_update(void) {
void bsbswim_die_end(void) {
func_802906A4(1);
func_80291548();
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
baMarker_collisionOn();
if (bs_getNextState() != BS_5A_LOADZONE) {
func_80346CE8();
+2 -2
View File
@@ -40,7 +40,7 @@ static void __bsbwhirl_end(void){
bastick_resetZones();
modelAppendages_setKazooiesUpperHalfVisibility(FALSE);
func_8025A55C(-1, 0xfa0, 0xd);
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
func_8025A7DC(COMUSIC_25_USING_GOLD_FEATHERS);
}
baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL);
@@ -87,7 +87,7 @@ void bsbwhirl_enter_init(void){
bastick_setZoneMax(1, 1.0f);
modelAppendages_setKazooiesUpperHalfVisibility(TRUE);
D_8037D3B0 = 0.0f;
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
func_8025A55C(0, 0xfa0, 0xd);
coMusicPlayer_playMusic(0x25, 0x6d60);
basfx_80299BD4();
+3 -3
View File
@@ -469,7 +469,7 @@ void bsbeemain_die_update(void){
}
void bsbeemain_die_end(void){
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
baphysics_reset_gravity();
func_80291548();
baeyes_open();
@@ -508,7 +508,7 @@ void bsbee_locked_end(void){
void func_802A2054(void){
baMarker_collisionOn();
func_8025A2FC(-1, 0xFA0);
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
func_80291548();
balookat_end();
}
@@ -519,7 +519,7 @@ void func_802A2098(void){
yaw_setIdeal(func_8029B41C());
code_14420_setUpdateTypes(1, YAW_STATE_1_DEFAULT, 3, BA_PHYSICS_NORMAL);
baphysics_set_target_horizontal_velocity(0.0f);
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
func_8025A2FC(0, 0xFA0);
coMusicPlayer_playMusic(COMUSIC_42_NOTEDOOR_OPENING_FANFARE, -1);
func_8029151C(0xC);
+1 -1
View File
@@ -492,7 +492,7 @@ void bscroc_die_update(void){
}
void bscroc_die_end(void){
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
baphysics_reset_gravity();
pitch_setIdeal(0.0f);
roll_setIdeal(0.0f);
+1 -1
View File
@@ -125,7 +125,7 @@ void bsdie_update(void){
}
void bsdie_end(void){
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
baphysics_reset_gravity();
modelAppendages_setKazooiesUpperHalfVisibility(FALSE);
pitch_setIdeal(0.0f);
+4 -4
View File
@@ -33,7 +33,7 @@ void bsjig_jiggy_init(void){
yaw_setIdeal(func_8029B41C()); //face camera
code_14420_setUpdateTypes(1, YAW_STATE_1_DEFAULT, 3, BA_PHYSICS_NORMAL);
baphysics_set_target_horizontal_velocity(0.0f);
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
func_8025A2FC(0,0xfa0);
tmp = (item_getCount(ITEM_E_JIGGY) == 9);
if(tmp == 0) //weird if...
@@ -107,7 +107,7 @@ void bsjig_jiggy_end(void){
if(bs_getNextState() != BS_34_JIG_NOTEDOOR){
func_8025A2FC(-1, 0xfa0);
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
}
baMarker_collisionOn();
if( jiggyscore_total() == 100
@@ -155,7 +155,7 @@ void bsjig_jiggy_interrupt(void){
void bsjig_notedoor_end(void){
baMarker_collisionOn();
func_8025A2FC(-1, 0xfa0);
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
modelAppendages_setKazooiesUpperHalfVisibility(FALSE);
func_80291548();
if( D_8037D4B2
@@ -181,7 +181,7 @@ void bsjig_notedoor_init(void){
code_14420_setUpdateTypes(1, YAW_STATE_1_DEFAULT, 3, BA_PHYSICS_NORMAL);
baphysics_set_target_horizontal_velocity(0.0f);
if(bs_getPrevState() != BS_44_JIG_JIGGY){
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
func_8025A2FC(0,0xfa0);
}
coMusicPlayer_playMusic(COMUSIC_42_NOTEDOOR_OPENING_FANFARE,-1);
+1 -1
View File
@@ -525,7 +525,7 @@ void bspumpkin_die_update(void){
void bspumpkin_die_end(void) {
func_802B229C();
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
baphysics_reset_gravity();
pitch_setIdeal(0.0f);
roll_setIdeal(0.0f);
-1
View File
@@ -7,7 +7,6 @@
#include "core2/yaw.h"
void func_80292900(f32, f32);
void baMotor_80250D94(f32, f32, f32);
/* .bss */
u8 D_8037D530;
-1
View File
@@ -12,7 +12,6 @@ void yaw_setVelocityBounded(f32, f32);
void anctrl_start(AnimCtrl *, char*, s32);
void func_802900B4(void);
void baMotor_80250D94(f32, f32, f32);
/* .data */
u8 D_80364D20[] = {
+4 -4
View File
@@ -18,7 +18,7 @@ void timeout_banjo_init(void){
ncbadie_func_802BF2C0(80.0f);
func_8025A58C(0, 4000);
comusic_playTrack(COMUSIC_3C_MINIGAME_LOSS);
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
modelAppendages_setKazooiesUpperHalfVisibility(TRUE);
baMarker_collisionOff();
}
@@ -43,7 +43,7 @@ void timeout_banjo_update(void){
void timeout_banjo_end(void){
baeyes_open();
func_80291548();
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
}
void timeout_transformation_init(void){
@@ -59,7 +59,7 @@ void timeout_transformation_init(void){
ncbadie_func_802BF2C0(80.0f);
func_8025A58C(0, 4000);
comusic_playTrack(COMUSIC_3C_MINIGAME_LOSS);
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
baMarker_collisionOff();
batimer_set(0, 2.9f);
}
@@ -72,6 +72,6 @@ void timeout_transformation_update(void){
void timeout_transformation_end(void){
modelAppendages_setKazooiesUpperHalfVisibility(FALSE);
func_80291548();
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
func_8025A904();
}
+3 -3
View File
@@ -510,7 +510,7 @@ void bswalrus_die_update(void){
}
void bswalrus_die_end(void){
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
baphysics_reset_gravity();
pitch_setIdeal(0.0f);
roll_setIdeal(0.0f);
@@ -734,7 +734,7 @@ void bswalrus_timeout_init(void) {
ncbadie_func_802BF2C0(60.0f);
func_8025A58C(0, 4000);
comusic_playTrack(COMUSIC_3C_MINIGAME_LOSS);
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
baMarker_collisionOff();
batimer_set(0, 2.9f);
func_802B813C();
@@ -751,7 +751,7 @@ void bswalrus_timeout_update(void) {
void bswalrus_timeout_end(void) {
func_80291548();
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
func_8025A904();
baeyes_open();
func_802B80D0();
+3 -3
View File
@@ -191,7 +191,7 @@ void chJinjo_update(Actor * this){
jiggy_position[1] += 50.0f;
jiggy_spawn(10 * level_get() - 9, jiggy_position);
}//L802CE0CC
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
func_8032BB88(this, 0, 4000);
if(local->unk4){
coMusicPlayer_playMusic(COMUSIC_30_5TH_JINJO_COLLECTED, 28000);
@@ -266,7 +266,7 @@ void chJinjo_update(Actor * this){
func_80326310(this);
if(local->unk4 == 0){
func_8032BB88(this, -1, 4000);
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
}
}//L802CE518
@@ -281,7 +281,7 @@ void chJinjo_update(Actor * this){
if(local->unk4 && actor_animationIsAt(this, 0.95f)){
func_8032BB88(this, -1, 4000);
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
}
}//L802CE598
+2 -2
View File
@@ -373,10 +373,10 @@ void chSnacker_spawn(void) {
}
if (volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE) == 0) {
func_8032BB88(snacker, 5000, 750);
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
coMusicPlayer_playMusic(COMUSIC_34_SNACKER_DANGER, 0);
comusic_8025AB44(COMUSIC_34_SNACKER_DANGER, 0x7FFF, 750);
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
}
s_chSnacker_spawnTimer = 0.0f;
func_8032CA80(snacker, s_chSnacker_inRbb ? 15 : 9);
+3 -3
View File
@@ -839,7 +839,7 @@ void func_8029C984(void){
func_8025AB00();
func_8025A2FC(0, 4000);
comusic_playTrack(COMUSIC_1A_DEATH);
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
}
s32 func_8029C9C0(s32 arg0){
@@ -901,7 +901,7 @@ void func_8029CB84(void){
void func_8029CBC4(void){
func_8025A55C(-1, 4000, 0xc);
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
}
void func_8029CBF4(void){
@@ -936,7 +936,7 @@ void func_8029CCC4(void){
if(jiggyscore_total() == 100 && fileProgressFlag_get(FILEPROG_FC_DEFEAT_GRUNTY)){
func_8028F918(2);
}
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
func_8025A55C(0, 4000, 0xC);
coMusicPlayer_playMusic(COMUSIC_D_JINGLE_JIGGY_COLLECTED, -1);
timedFunc_set_0(4.0f, func_8029CBF4);
-1
View File
@@ -3,7 +3,6 @@
#include "variables.h"
extern void baMotor_80250E6C(f32, f32);
extern void func_802BE720(void);
typedef struct {
+2 -2
View File
@@ -31,7 +31,7 @@ void func_802E31D0(s32 arg0) {
temp_v0 = D_8037E8C0.unk14;
if ((temp_v0 == 0) || (temp_v0 == 3)) {
framebufferdraw_setBufferIndex(arg0);
framebufferdraw_func_80249DE0(0, 0, D_8037E8C0.unkC, 0, 0);
framebufferdraw_func_80249DE0(0, 0, (Struct84s *) D_8037E8C0.unkC, 0, 0);
osWritebackDCache(gFramebuffers[arg0], (s32) ((f32) gFramebufferWidth * (f32) gFramebufferHeight * sizeof(s16)));
}
}
@@ -135,7 +135,7 @@ void func_802E35D8(void ) {
}
} else if (D_8037E8C0.unk14 == 3) {
sp38 = 0;
controller_copyFaceButtons(0, &sp40);
controller_copyFaceButtons(0, sp40);
for(i = 0; i < 6; i++){
if (sp40[i] == 1) {
sp38++;
+3 -3
View File
@@ -140,7 +140,7 @@ void func_802E39D0(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 framebuffer_idx, bool ar
gcpausemenu_draw(gfx, mtx, vtx);
if (!game_is_frozen()) {
dummy_func_8025AFC0(gfx, mtx, vtx);
core1_1D590_func_8025AFC0(gfx, mtx, vtx);
}
gcdialog_draw(gfx, mtx, vtx);
@@ -351,7 +351,7 @@ void func_802E412C(s32 arg0, s32 arg1){
void func_802E4170(void){
game_setMode(GAME_MODE_2_UNKNOWN,0);
defragManager_free();
defragthread_free();
func_802E5F68();
if(!func_802E4A08())
print_free();
@@ -386,7 +386,7 @@ void func_802E4214(enum map_e map_id){
if(!func_802E4A08())
print_init();
func_802E5F38();
defragManager_init();
defragthread_init();
modelRender_init();
depthbuffer_enable(TRUE);
animCache_init();
+1 -1
View File
@@ -126,7 +126,7 @@ void func_8031CB50(enum map_e map_id, s32 exit_id, s32 arg2) {
if ((core2_9B650_getMusicTrackFromMap(map_id) != sp1C) && (func_80322914() == 0)) {
func_8025A388(0, 0x4E2);
func_8025AB00();
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
}
if (func_802E4A08()) {
func_802E40D0(map_id, exit_id);
+6 -6
View File
@@ -34,12 +34,12 @@ void func_803219F4(s32 arg0){
switch(D_80383310){
case 2: //L80321A30
func_8025A55C(-1, 4000, 7);
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
comusic_8025AB44(COMUSIC_58_WADING_BOOTS, 0, 4000);
func_8025AABC(COMUSIC_58_WADING_BOOTS);
break;
case 4: //L80321A6C
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
if(D_80383314 == COMUSIC_57_TURBO_TRAINERS){
func_8025A55C(-1, 4000, 7);
}
@@ -48,7 +48,7 @@ void func_803219F4(s32 arg0){
break;
case 3: //L80321AC0
func_8025A55C(-1, 4000, 7);
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
comusic_8025AB44(COMUSIC_95_BBONUS_A, 0, 4000);
func_8025AABC(COMUSIC_95_BBONUS_A);
break;
@@ -60,7 +60,7 @@ void func_803219F4(s32 arg0){
switch(D_80383310){
case 2: //L80321B28
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
func_8025A55C(0, 4000, 7);
coMusicPlayer_playMusic(COMUSIC_58_WADING_BOOTS, -1);
func_8025A8B8(COMUSIC_58_WADING_BOOTS, 1);
@@ -72,7 +72,7 @@ void func_803219F4(s32 arg0){
else{
D_80383314 = COMUSIC_57_TURBO_TRAINERS;
}
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
if(D_80383314 == COMUSIC_57_TURBO_TRAINERS){
func_8025A55C(0, 4000, 7);
}
@@ -81,7 +81,7 @@ void func_803219F4(s32 arg0){
break;
case 3: //L80321BDC
musicKeepsPlaying();
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
func_8025A55C(0, 4000, 7);
coMusicPlayer_playMusic(COMUSIC_95_BBONUS_A, -1);
func_8025A8B8(COMUSIC_95_BBONUS_A, 1);
+4 -4
View File
@@ -233,13 +233,13 @@ void func_8032278C(s32 arg0, s32 arg1) {
D_8036E2B4 = 0;
if (D_80383348 == 0) {
if ((temp_v0 & 1) != 0) {
core1_ce60_func_8024ADF0(FALSE);
midichannel_func_8024ADF0(FALSE);
} else {
core1_ce60_func_8024ADF0(TRUE);
midichannel_func_8024ADF0(TRUE);
}
} else {
D_80383348 = 0;
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
}
}
if ((arg0 == 1) && (arg1 == 2)) {
@@ -253,7 +253,7 @@ void func_8032278C(s32 arg0, s32 arg1) {
void musicKeepsPlaying(void){
if(!D_80383348){
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
D_80383348 = TRUE;
}
}
+4 -4
View File
@@ -7,20 +7,20 @@ u8 D_80383370;
/* .code */
void func_80323100(void){
core1_ce60_resetState();
midichannel_resetState();
}
void func_80323120(void){
core1_ce60_func_8024AE74();
midichannel_func_8024AE74();
}
void func_80323140(s32 arg0, s32 arg1){
core1_ce60_func_8024BD40(arg0, arg1);
midichannel_func_8024BD40(arg0, arg1);
func_8032278C(arg0, arg1);
}
void func_80323170(void){
core1_ce60_func_8024AF48();
midichannel_func_8024AF48();
}
void func_80323190(void){
+2 -2
View File
@@ -142,7 +142,7 @@ s32 s_jiggylist_current_index;
/* .code */
void func_80332B90(void){
core1_ce60_incOrDecCounter(TRUE);
midichannel_incOrDecCounter(TRUE);
}
void func_80332BB0(void) {
@@ -245,7 +245,7 @@ void jiggy_spawn(enum jiggy_e jiggy_id, f32 pos[3]) {
temp_v0->init(&temp_v0->unk10);
jiggyscore_setSpawned(jiggy_id, TRUE);
if (!jiggyscore_isCollected(jiggy_id) && (jiggy_id != JIGGY_3E_GV_GRABBA) && (jiggy_id != JIGGY_0B_TTC_JINJO)) {
core1_ce60_incOrDecCounter(FALSE);
midichannel_incOrDecCounter(FALSE);
func_8025A55C(0, 4000, 5);
coMusicPlayer_playMusic(COMUSIC_3D_JIGGY_SPAWN, 0x7FFF);
timedFunc_set_0(3.5f, func_80332BB0);
+5 -5
View File
@@ -404,7 +404,7 @@ void *assetcache_get(enum asset_e assetId) {
uncompressed_file = malloc(comp_size);
compressed_file = uncompressed_file;
}
piMgr_read(compressed_file, assetSectionRomMetaList[assetId].offset + D_80383CCC, sp3C);
parallel_readDMA(compressed_file, assetSectionRomMetaList[assetId].offset + D_80383CCC, sp3C);
if(assetSectionRomMetaList[assetId].compFlag & 0x0001){//decompress
rarezip_inflate(compressed_file, uncompressed_file);
realloc(uncompressed_file, assetCacheCurrentSize);
@@ -423,7 +423,7 @@ void *assetcache_get(enum asset_e assetId) {
}
void func_8033BAB0(enum asset_e asset_id, s32 offset, s32 size, void *dst_ptr) {
piMgr_read(dst_ptr, assetSectionRomMetaList[asset_id].offset + D_80383CCC + offset, size);
parallel_readDMA(dst_ptr, assetSectionRomMetaList[asset_id].offset + D_80383CCC + offset, size);
}
void assetCache_resizeAsset(void *assetPtr, s32 size){
@@ -444,9 +444,9 @@ void assetCache_init(void){
assetCacheLength = 0;
assetSectionRomHeader = (AssetROMHead *)malloc(sizeof(AssetROMHead));
D_80383CC8 = (u32)assets_ROM_START;
piMgr_read(assetSectionRomHeader, D_80383CC8, sizeof(AssetROMHead));
parallel_readDMA(assetSectionRomHeader, D_80383CC8, sizeof(AssetROMHead));
assetSectionRomMetaList = (AssetFileMeta *)malloc(assetSectionRomHeader->count*sizeof(AssetFileMeta));
piMgr_read(assetSectionRomMetaList, D_80383CC8 + sizeof(AssetROMHead),assetSectionRomHeader->count*sizeof(AssetFileMeta));
parallel_readDMA(assetSectionRomMetaList, D_80383CC8 + sizeof(AssetROMHead),assetSectionRomHeader->count*sizeof(AssetFileMeta));
D_80383CCC = D_80383CC8 + sizeof(AssetROMHead) + assetSectionRomHeader->count*sizeof(AssetFileMeta);
}
@@ -537,7 +537,7 @@ s32 code_B3A80_func_8033BDAC(enum asset_e id, void *dst, s32 size) {
}
}
comp_size = assetSectionRomMetaList[id].offset + D_80383CCC;
piMgr_read((void *)comp_ptr, comp_size, sp34);
parallel_readDMA((void *)comp_ptr, comp_size, sp34);
if (assetSectionRomMetaList[id].compFlag & 1) {
rarezip_inflate(comp_ptr, dst);
osWritebackDCache(dst, assetCacheCurrentSize);
+2 -2
View File
@@ -73,7 +73,7 @@ u8 D_80383D18[8];
void savedata_update_crc(s32 buffer, s32 size){
u32 sp20[2];
u32 sum;
glcrc_calc_checksum(buffer, buffer + size - 4, sp20);
glcrc_calcChecksum(buffer, buffer + size - 4, sp20);
sum = sp20[0] ^ sp20[1];
*(u32*)(buffer + size - 4) = sum;
}
@@ -85,7 +85,7 @@ int _savedata_verify(SaveData *savedata, s32 size){
crc_ptr = (u32*)((s32)savedata + size) - 1;
expect_crc = *crc_ptr;
glcrc_calc_checksum(savedata, crc_ptr, result);
glcrc_calcChecksum(savedata, crc_ptr, result);
*crc_ptr = expect_crc;
if((result[0]^result[1]) != expect_crc)
return 0x6e382;
+1 -1
View File
@@ -769,7 +769,7 @@ void gcpausemenu_init(void) {
D_80383010.b_button_frame = D_80383010.unk3_0 = D_80383010.b_button_alpha = 0;
D_80383010.page_cnt = gcpausemenu_initLargestPageIndex();
D_80383010.sns_alpha = D_80383010.sns_visible = D_80383010.unk70_31 = D_80383010.unk70_30 = 0;
baMotor_80250FC0();
baMotor_forceStop();
gcPauseMenu_setState(PAUSE_STATE_0_MENU_INIT);
}
+1 -1
View File
@@ -277,7 +277,7 @@ void func_8030AFD8(s32 arg0){
func_8033301C();
}
func_8034789C();
baMotor_80250FC0(); //stop controller motor
baMotor_forceStop();
gcpausemenu_80314B24();
func_80347A70();
}