You've already forked HackerSM64
mirror of
https://github.com/HackerN64/HackerSM64.git
synced 2026-01-21 10:35:32 -08:00
Compare commits
32 Commits
develop/ar
...
v2.0.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83fea6d310 | ||
|
|
8698cc0f89 | ||
|
|
62d6ee135f | ||
|
|
3d330e0b84 | ||
|
|
1691e48326 | ||
|
|
e5af0e8ca5 | ||
|
|
cf570b4406 | ||
|
|
1012fb7957 | ||
|
|
aa1a48afeb | ||
|
|
5e1258e806 | ||
|
|
c938bbf407 | ||
|
|
a1ab7c51f0 | ||
|
|
4cfbc656a9 | ||
|
|
fe6aee22e1 | ||
|
|
ad3aa42eff | ||
|
|
031cc24fa6 | ||
|
|
8d06db06e1 | ||
|
|
642a85fec6 | ||
|
|
3092929822 | ||
|
|
51f8ccfbb0 | ||
|
|
2118234f9b | ||
|
|
ac0299e5b5 | ||
|
|
f98d43c9de | ||
|
|
bf8ea238e5 | ||
|
|
b3cb639e6e | ||
|
|
12595397cd | ||
|
|
65eb5a755f | ||
|
|
eaf9d3e4f9 | ||
|
|
8cfd9af4ee | ||
|
|
3f0143ec0f | ||
|
|
33b2a07759 | ||
|
|
ad91c636ad |
2126
.gitignore
vendored
2126
.gitignore
vendored
File diff suppressed because it is too large
Load Diff
3
Makefile
3
Makefile
@@ -630,7 +630,8 @@ $(BUILD_DIR)/src/usb/usb.o: CFLAGS += -Wno-unused-variable -Wno-sign-compare -Wn
|
||||
$(BUILD_DIR)/src/usb/debug.o: OPT_FLAGS := -O0
|
||||
$(BUILD_DIR)/src/usb/debug.o: CFLAGS += -Wno-unused-parameter -Wno-maybe-uninitialized
|
||||
# File specific opt flags
|
||||
$(BUILD_DIR)/src/audio/*.o: OPT_FLAGS := -Os -fno-jump-tables
|
||||
$(BUILD_DIR)/src/audio/heap.o: OPT_FLAGS := -Os -fno-jump-tables
|
||||
$(BUILD_DIR)/src/audio/synthesis.o: OPT_FLAGS := -Os -fno-jump-tables
|
||||
|
||||
$(BUILD_DIR)/src/engine/surface_collision.o: OPT_FLAGS := $(COLLISION_OPT_FLAGS)
|
||||
$(BUILD_DIR)/src/engine/math_util.o: OPT_FLAGS := $(MATH_UTIL_OPT_FLAGS)
|
||||
|
||||
@@ -29,11 +29,12 @@ This is a fork of the ultrasm64 repo by CrashOveride which includes the followin
|
||||
- **CrashOveride**: creating the [ultrasm64](https://github.com/CrashOveride95/ultrasm64) repo
|
||||
- **falcobuster**: Original coordinate overflow fix (world scale), ASM version of extended bounds
|
||||
- **anonymous_moose**: porting falco's extended bounds to decomp
|
||||
- **tuxlovesyou**: `LOAD_MIO0_TEXTURE` macro and moral support
|
||||
|
||||
Thanks to Frame#5375 and AloXado320 for also helping with silhouette stuff
|
||||
|
||||
**Lighting Engine by Wiseguy**
|
||||
- Lighting Engine is available on a separate branch ([base/lighting-engine-wip](https://github.com/Reonu/HackerSM64/tree/base/lighting-engine-wip)). Instructions on how to use it are in the readme of that branch.
|
||||
- Lighting Engine is available on a separate branch ([base/lighting-engine](https://github.com/Reonu/HackerSM64/tree/base/lighting-engine)). Instructions on how to use it are in the readme of that branch.
|
||||
- Alternatively, the main repo has `Puppylights` available, which is a more lightweight, but limited lighting library intended to be used to modify existing light properties. You can look at `puppylights.c` to find out how to use it.
|
||||
|
||||
**Puppycam**
|
||||
|
||||
@@ -1 +1 @@
|
||||
v2.0.1
|
||||
v2.0.3
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
// Disables all debug options (except PUPPYPRINT).
|
||||
#define DISABLE_ALL
|
||||
|
||||
// Enables a comprehensive standalone profiler. Automatically enabled by PUPPYPRINT_DEBUG.
|
||||
// If not using PUPPYPRINT_DEBUG, press L to toggle the profiler.
|
||||
// #define USE_PROFILER
|
||||
|
||||
// TEST LEVEL
|
||||
// Uncomment this define and set a test level in order to boot straight into said level.
|
||||
// This allows you to quickly test the level you're working on.
|
||||
|
||||
@@ -40,9 +40,8 @@
|
||||
|
||||
// -- WATER RING --
|
||||
|
||||
// Fix DDD water rings by checking for interaction rather than normals.
|
||||
//! NOT IMPLEMENTED
|
||||
// #define FIX_WATER_RINGS
|
||||
// Fix the water rings in DDD by checking for interaction rather than normals.
|
||||
#define FIX_WATER_RINGS
|
||||
|
||||
// -- POWER STAR --
|
||||
|
||||
|
||||
@@ -33,15 +33,21 @@
|
||||
* config_debug.h
|
||||
*/
|
||||
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
#undef PUPPYPRINT
|
||||
#define PUPPYPRINT
|
||||
#endif // PUPPYPRINT_DEBUG
|
||||
|
||||
#ifdef COMPLETE_SAVE_FILE
|
||||
#ifdef DISABLE_ALL
|
||||
#undef DEBUG_ALL
|
||||
#undef TEST_LEVEL
|
||||
#undef DEBUG_LEVEL_SELECT
|
||||
#undef ENABLE_DEBUG_FREE_MOVE
|
||||
#undef VANILLA_DEBUG
|
||||
#undef VANILLA_STYLE_CUSTOM_DEBUG
|
||||
#undef PUPPYPRINT_DEBUG
|
||||
#undef PUPPYPRINT_DEBUG_CYCLES
|
||||
#undef VISUAL_DEBUG
|
||||
#undef UNLOCK_ALL
|
||||
#define UNLOCK_ALL
|
||||
#endif // COMPLETE_SAVE_FILE
|
||||
#undef COMPLETE_SAVE_FILE
|
||||
#undef DEBUG_FORCE_CRASH_ON_BOOT
|
||||
#undef USE_PROFILER
|
||||
#endif // DISABLE_ALL
|
||||
|
||||
#ifdef DEBUG_ALL
|
||||
#undef DEBUG_LEVEL_SELECT
|
||||
@@ -66,20 +72,17 @@
|
||||
#define COMPLETE_SAVE_FILE
|
||||
#endif // DEBUG_ALL
|
||||
|
||||
#ifdef DISABLE_ALL
|
||||
#undef DEBUG_ALL
|
||||
#undef TEST_LEVEL
|
||||
#undef DEBUG_LEVEL_SELECT
|
||||
#undef ENABLE_DEBUG_FREE_MOVE
|
||||
#undef VANILLA_DEBUG
|
||||
#undef VANILLA_STYLE_CUSTOM_DEBUG
|
||||
#undef PUPPYPRINT_DEBUG
|
||||
#undef PUPPYPRINT_DEBUG_CYCLES
|
||||
#undef VISUAL_DEBUG
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
#undef PUPPYPRINT
|
||||
#define PUPPYPRINT
|
||||
#undef USE_PROFILER
|
||||
#define USE_PROFILER
|
||||
#endif // PUPPYPRINT_DEBUG
|
||||
|
||||
#ifdef COMPLETE_SAVE_FILE
|
||||
#undef UNLOCK_ALL
|
||||
#undef COMPLETE_SAVE_FILE
|
||||
#undef DEBUG_FORCE_CRASH_ON_BOOT
|
||||
#endif // DISABLE_ALL
|
||||
#define UNLOCK_ALL
|
||||
#endif // COMPLETE_SAVE_FILE
|
||||
|
||||
|
||||
/*****************
|
||||
|
||||
@@ -310,6 +310,9 @@ enum GoddardScene {
|
||||
CMD_PTR(romEnd)
|
||||
#endif
|
||||
|
||||
#undef LOAD_MIO0_TEXTURE
|
||||
#define LOAD_MIO0_TEXTURE(a,b,c) LOAD_YAY0_TEXTURE(a,b,c)
|
||||
|
||||
#define CHANGE_AREA_SKYBOX(area, segStart, segEnd) \
|
||||
CMD_BBH(LEVEL_CMD_CHANGE_AREA_SKYBOX, 0x0C, area), \
|
||||
CMD_PTR(segStart), \
|
||||
|
||||
@@ -973,11 +973,7 @@
|
||||
#define /*0x104*/ oSnufitBodyScalePeriod OBJECT_FIELD_S32(0x1F)
|
||||
#define /*0x108*/ oSnufitBodyBaseScale OBJECT_FIELD_S32(0x20)
|
||||
#define /*0x10C*/ oSnufitBullets OBJECT_FIELD_S32(0x21)
|
||||
#define /*0x1AC*/ oSnufitOffsetVec OBJECT_FIELD_S16(0x49, 0) // start pos of s16 vec
|
||||
#define /*0x1AC*/ oSnufitXOffset OBJECT_FIELD_S16(0x49, 0)
|
||||
#define /*0x1AE*/ oSnufitYOffset OBJECT_FIELD_S16(0x49, 1)
|
||||
#define /*0x1B0*/ oSnufitZOffset OBJECT_FIELD_S16(0x4A, 0)
|
||||
#define /*0x1B2*/ oSnufitBodyScale OBJECT_FIELD_S16(0x4A, 1)
|
||||
#define /*0x1AC*/ oSnufitBodyScale OBJECT_FIELD_S16(0x49, 0)
|
||||
|
||||
/* Spindel */
|
||||
#define /*0x0F4*/ oSpindelMoveTimer OBJECT_FIELD_S32(0x1B)
|
||||
@@ -1047,7 +1043,6 @@
|
||||
#define /*0x0F4*/ oTiltingPyramidNormalX OBJECT_FIELD_F32(O_TILTING_PYRAMID_NORMAL_X_INDEX)
|
||||
#define /*0x0F8*/ oTiltingPyramidNormalY OBJECT_FIELD_F32(O_TILTING_PYRAMID_NORMAL_Y_INDEX)
|
||||
#define /*0x0FC*/ oTiltingPyramidNormalZ OBJECT_FIELD_F32(O_TILTING_PYRAMID_NORMAL_Z_INDEX)
|
||||
#define /*0x10C*/ oTiltingPyramidMarioOnPlatform OBJECT_FIELD_S32(0x21)
|
||||
|
||||
/* Toad Message */
|
||||
#define /*0x108*/ oToadMessageDialogId OBJECT_FIELD_U32(0x20)
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#ifdef VERSION_EU
|
||||
#include "levels/ending/cake_eu.inc.c"
|
||||
|
||||
#ifndef EU_CUSTOM_CAKE_FIX
|
||||
// 0x07023000 - 0x07023FFF
|
||||
ALIGNED8 static const Texture cake_end_texture_eu_35_thank_you[] = {
|
||||
#include "levels/ending/eu_023000.rgba16.inc.c"
|
||||
@@ -38,6 +39,7 @@ ALIGNED8 static const Texture cake_end_texture_eu_39_fin[] = {
|
||||
ALIGNED8 static const Texture cake_end_texture_eu_40_ende[] = {
|
||||
#include "levels/ending/eu_028000.rgba16.inc.c"
|
||||
};
|
||||
#endif // !EU_CUSTOM_CAKE_FIX
|
||||
|
||||
// 0x07029000 - 0x070296D8
|
||||
const Gfx dl_cake_end_screen[] = {
|
||||
|
||||
@@ -72,11 +72,11 @@ const GeoLayout intro_geo_mario_head_regular[] = {
|
||||
GEO_CLOSE_NODE(),
|
||||
#endif
|
||||
GEO_CLOSE_NODE(),
|
||||
#if defined(VERSION_SH)
|
||||
GEO_ZBUFFER(0),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_ASM(INTRO_CONTEXT_NORMAL, geo_intro_rumble_pak_graphic),
|
||||
GEO_CLOSE_NODE(),
|
||||
#if defined(ENABLE_RUMBLE)
|
||||
GEO_ZBUFFER(0),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_ASM(INTRO_CONTEXT_NORMAL, geo_intro_rumble_pak_graphic),
|
||||
GEO_CLOSE_NODE(),
|
||||
#endif
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_END(),
|
||||
@@ -105,7 +105,7 @@ const GeoLayout intro_geo_mario_head_dizzy[] = {
|
||||
GEO_CLOSE_NODE(),
|
||||
#endif
|
||||
GEO_CLOSE_NODE(),
|
||||
#if defined(VERSION_SH)
|
||||
#if defined(ENABLE_RUMBLE)
|
||||
GEO_ZBUFFER(0),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_ASM(INTRO_CONTEXT_GAME_OVER, geo_intro_rumble_pak_graphic),
|
||||
|
||||
@@ -343,16 +343,12 @@ f32 adsr_update(struct AdsrState *adsr) {
|
||||
s32 adsr_update(struct AdsrState *adsr) {
|
||||
#endif
|
||||
u8 action = adsr->action;
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
u8 state = adsr->state;
|
||||
switch (state) {
|
||||
#else
|
||||
switch (adsr->state) {
|
||||
#endif
|
||||
case ADSR_STATE_DISABLED:
|
||||
return 0;
|
||||
|
||||
case ADSR_STATE_INITIAL: {
|
||||
case ADSR_STATE_INITIAL:
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
adsr->current = adsr->initial;
|
||||
adsr->target = adsr->initial;
|
||||
@@ -361,8 +357,7 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
adsr->state = ADSR_STATE_HANG;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// fallthrough
|
||||
// fallthrough
|
||||
|
||||
case ADSR_STATE_START_LOOP:
|
||||
adsr->envIndex = 0;
|
||||
@@ -370,11 +365,12 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
adsr->currentHiRes = (adsr->current << 0x10);
|
||||
#endif
|
||||
adsr->state = ADSR_STATE_LOOP;
|
||||
|
||||
#ifdef VERSION_SH
|
||||
// fallthrough
|
||||
restart:
|
||||
#endif
|
||||
// fallthrough
|
||||
|
||||
case ADSR_STATE_LOOP:
|
||||
adsr->delay = BSWAP16(adsr->envelope[adsr->envIndex].delay);
|
||||
switch (adsr->delay) {
|
||||
@@ -399,25 +395,23 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
if (adsr->delay >= 4) {
|
||||
adsr->delay = adsr->delay * gAudioBufferParameters.updatesPerFrame
|
||||
#ifdef VERSION_SH
|
||||
#ifdef VERSION_SH
|
||||
/ gAudioBufferParameters.presetUnk4
|
||||
#endif
|
||||
#endif
|
||||
/ 4;
|
||||
}
|
||||
#if defined(VERSION_SH)
|
||||
#ifdef VERSION_SH
|
||||
if (adsr->delay == 0) {
|
||||
adsr->delay = 1;
|
||||
}
|
||||
#endif
|
||||
adsr->target = (f32) BSWAP16(adsr->envelope[adsr->envIndex].arg) / 32767.0f;
|
||||
#elif defined(VERSION_EU)
|
||||
adsr->target = (f32) BSWAP16(adsr->envelope[adsr->envIndex].arg) / 32767.0;
|
||||
#endif
|
||||
adsr->target = adsr->target * adsr->target;
|
||||
adsr->velocity = (adsr->target - adsr->current) / adsr->delay;
|
||||
#else
|
||||
#else // !(VERSION_EU || VERSION_SH)
|
||||
adsr->target = BSWAP16(adsr->envelope[adsr->envIndex].arg);
|
||||
adsr->velocity = ((adsr->target - adsr->current) << 0x10) / adsr->delay;
|
||||
#endif
|
||||
#endif // !(VERSION_EU || VERSION_SH)
|
||||
adsr->state = ADSR_STATE_FADE;
|
||||
adsr->envIndex++;
|
||||
break;
|
||||
|
||||
@@ -1262,7 +1262,7 @@ static void update_game_sound(void) {
|
||||
#endif
|
||||
} else {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad728((x04020000 | ((channelIndex & 0xff) << 8),
|
||||
func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8),
|
||||
get_sound_freq_scale(bank, soundIndex) + ((f32) sSoundMovingSpeed[bank] / 400.0f));
|
||||
#else
|
||||
value = get_sound_freq_scale(bank, soundIndex);
|
||||
|
||||
@@ -169,7 +169,7 @@ void reset_bank_and_seq_load_status(void) {
|
||||
#ifdef VERSION_SH
|
||||
bzero(&gBankLoadStatus, sizeof(gBankLoadStatus));
|
||||
bzero(&gUnkLoadStatus, sizeof(gUnkLoadStatus));
|
||||
bzero(&gSeqLoadStatus, sizeof(gBankLoadStatus));
|
||||
bzero(&gSeqLoadStatus, sizeof(gSeqLoadStatus));
|
||||
#else
|
||||
bzero(&gBankLoadStatus, sizeof(gBankLoadStatus)); // Setting this array to zero is equivilent to SOUND_LOAD_STATUS_NOT_LOADED
|
||||
bzero(&gSeqLoadStatus, sizeof(gSeqLoadStatus)); // Same dealio
|
||||
@@ -274,7 +274,7 @@ void sound_alloc_pool_init(struct SoundAllocPool *pool, void *memAddr, u32 size)
|
||||
#ifdef VERSION_SH
|
||||
pool->size = size - ((uintptr_t) memAddr & 0xf);
|
||||
#else
|
||||
pool->size = size;
|
||||
pool->size = ALIGN16(size);
|
||||
#endif
|
||||
pool->numAllocatedEntries = 0;
|
||||
}
|
||||
@@ -380,7 +380,7 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
// arg3 = 0, 1 or 2?
|
||||
|
||||
#ifdef VERSION_SH
|
||||
struct SoundMultiPool *arg0;
|
||||
struct SoundMultiPool *arg0 = NULL;
|
||||
#define isSound poolIdx
|
||||
#endif
|
||||
struct TemporaryPool *tp;
|
||||
@@ -408,6 +408,8 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
u32 leftAvail, rightAvail;
|
||||
#endif
|
||||
|
||||
size = ALIGN16(size);
|
||||
|
||||
#ifdef VERSION_SH
|
||||
switch (poolIdx) {
|
||||
case 0:
|
||||
@@ -656,7 +658,7 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
#if defined(VERSION_SH)
|
||||
tp->entries[1].ptr = (u8 *) ((uintptr_t) (pool->start + pool->size - size) & ~0x0f);
|
||||
#else
|
||||
tp->entries[1].ptr = pool->start + pool->size - size - 0x10;
|
||||
tp->entries[1].ptr = pool->start + pool->size - size;
|
||||
#endif
|
||||
tp->entries[1].id = id;
|
||||
tp->entries[1].size = size;
|
||||
@@ -758,7 +760,7 @@ void *get_bank_or_seq(s32 poolIdx, s32 arg1, s32 id) {
|
||||
}
|
||||
void *get_bank_or_seq_inner(s32 poolIdx, s32 arg1, s32 bankId) {
|
||||
u32 i;
|
||||
struct SoundMultiPool* loadedPool;
|
||||
struct SoundMultiPool* loadedPool = NULL;
|
||||
struct TemporaryPool* temporary;
|
||||
struct PersistentPool* persistent;
|
||||
|
||||
@@ -931,7 +933,7 @@ void decrease_reverb_gain(void) {
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
s32 audio_shut_down_and_reset_step(void) {
|
||||
s32 i, j;
|
||||
s32 i;
|
||||
|
||||
switch (gAudioResetStatus) {
|
||||
case 5:
|
||||
@@ -1007,7 +1009,7 @@ void init_reverb_eu(void) {
|
||||
gNumSynthesisReverbs = preset->numReverbs;
|
||||
for (j = 0; j < gNumSynthesisReverbs; j++) {
|
||||
reverb = &gSynthesisReverbs[j];
|
||||
reverbSettings = &sReverbSettings[MIN((gAudioResetPresetIdToLoad + j), (sizeof(sReverbSettings) / sizeof(struct ReverbSettingsEU)) - 1)];
|
||||
reverbSettings = &sReverbSettings[MIN((u32)(gAudioResetPresetIdToLoad + j), (sizeof(sReverbSettings) / sizeof(struct ReverbSettingsEU)) - 1)];
|
||||
reverb->windowSize = (reverbSettings->windowSize * 0x40);
|
||||
reverb->downsampleRate = reverbSettings->downsampleRate;
|
||||
reverb->reverbGain = reverbSettings->gain;
|
||||
|
||||
@@ -38,8 +38,14 @@ struct SeqOrBankEntry {
|
||||
struct PersistentPool {
|
||||
/*0x00*/ u32 numEntries;
|
||||
/*0x04*/ struct SoundAllocPool pool;
|
||||
#ifdef EXPAND_AUDIO_HEAP // TODO: Make this a configurable define rather than using static values
|
||||
/*0x14*/ struct SeqOrBankEntry entries[64];
|
||||
// size = 0x314
|
||||
#else
|
||||
/*0x14*/ struct SeqOrBankEntry entries[32];
|
||||
}; // size = 0x194
|
||||
// size = 0x194
|
||||
#endif
|
||||
};
|
||||
|
||||
struct TemporaryPool {
|
||||
/*EU, SH*/
|
||||
@@ -64,9 +70,14 @@ struct SoundMultiPool {
|
||||
/* */ u32 pad2[4];
|
||||
}; // size = 0x1D0
|
||||
|
||||
#ifdef VERSION_SH
|
||||
struct Unk1Pool {
|
||||
struct SoundAllocPool pool;
|
||||
#ifdef EXPAND_AUDIO_HEAP
|
||||
struct SeqOrBankEntry entries[64];
|
||||
#else
|
||||
struct SeqOrBankEntry entries[32];
|
||||
#endif
|
||||
};
|
||||
|
||||
struct UnkEntry {
|
||||
@@ -85,6 +96,7 @@ struct UnkPool {
|
||||
/*0x510*/ s32 numEntries;
|
||||
/*0x514*/ u32 unk514;
|
||||
};
|
||||
#endif
|
||||
|
||||
extern u8 gAudioHeap[];
|
||||
extern s16 gVolume;
|
||||
|
||||
@@ -24,6 +24,8 @@ struct SharedDma {
|
||||
// EU only
|
||||
void port_eu_init(void);
|
||||
|
||||
ALIGNED16 u32 dmaTempBuffer[4];
|
||||
|
||||
struct Note *gNotes;
|
||||
|
||||
struct SequencePlayer gSequencePlayers[SEQUENCE_PLAYERS];
|
||||
@@ -137,14 +139,8 @@ u8 audioString49[] = "BANK LOAD MISS! FOR %d\n";
|
||||
* Performs an asynchronus (normal priority) DMA copy
|
||||
*/
|
||||
void audio_dma_copy_async(uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQueue *queue, OSIoMesg *mesg) {
|
||||
#if PUPPYPRINT_DEBUG
|
||||
OSTime first = osGetTime();
|
||||
#endif
|
||||
osInvalDCache(vAddr, nbytes);
|
||||
osPiStartDma(mesg, OS_MESG_PRI_NORMAL, OS_READ, devAddr, vAddr, nbytes, queue);
|
||||
#if PUPPYPRINT_DEBUG
|
||||
dmaAudioTime[perfIteration] += (osGetTime() - first);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,18 +148,12 @@ void audio_dma_copy_async(uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQ
|
||||
* to 0x1000 bytes transfer at once.
|
||||
*/
|
||||
void audio_dma_partial_copy_async(uintptr_t *devAddr, u8 **vAddr, ssize_t *remaining, OSMesgQueue *queue, OSIoMesg *mesg) {
|
||||
#if PUPPYPRINT_DEBUG
|
||||
OSTime first = osGetTime();
|
||||
#endif
|
||||
ssize_t transfer = MIN(*remaining, 0x1000);
|
||||
*remaining -= transfer;
|
||||
osInvalDCache(*vAddr, transfer);
|
||||
osPiStartDma(mesg, OS_MESG_PRI_NORMAL, OS_READ, *devAddr, *vAddr, transfer, queue);
|
||||
*devAddr += transfer;
|
||||
*vAddr += transfer;
|
||||
#if PUPPYPRINT_DEBUG
|
||||
dmaAudioTime[perfIteration] += (osGetTime() - first);
|
||||
#endif
|
||||
}
|
||||
|
||||
void decrease_sample_dma_ttls() {
|
||||
@@ -208,17 +198,10 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
|
||||
u32 i;
|
||||
u32 dmaIndex;
|
||||
ssize_t bufferPos;
|
||||
#if PUPPYPRINT_DEBUG
|
||||
OSTime first = osGetTime();
|
||||
#endif
|
||||
|
||||
if (arg2 != 0 || *dmaIndexRef >= sSampleDmaListSize1) {
|
||||
for (i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++) {
|
||||
#if defined(VERSION_EU)
|
||||
dma = &sSampleDmas[i];
|
||||
#else
|
||||
dma = sSampleDmas + i;
|
||||
#endif
|
||||
bufferPos = devAddr - dma->source;
|
||||
if (0 <= bufferPos && (size_t) bufferPos <= dma->bufSize - size) {
|
||||
// We already have a DMA request for this memory range.
|
||||
@@ -235,14 +218,7 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
|
||||
}
|
||||
dma->ttl = 60;
|
||||
*dmaIndexRef = (u8) i;
|
||||
#if PUPPYPRINT_DEBUG
|
||||
dmaAudioTime[perfIteration] += (osGetTime() - first);
|
||||
#endif
|
||||
#if defined(VERSION_EU)
|
||||
return &dma->buffer[(devAddr - dma->source)];
|
||||
#else
|
||||
return (devAddr - dma->source) + dma->buffer;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,12 +231,7 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
|
||||
hasDma = TRUE;
|
||||
}
|
||||
} else {
|
||||
#if defined(VERSION_EU)
|
||||
dma = sSampleDmas;
|
||||
dma += *dmaIndexRef;
|
||||
#else
|
||||
dma = sSampleDmas + *dmaIndexRef;
|
||||
#endif
|
||||
bufferPos = devAddr - dma->source;
|
||||
if (0 <= bufferPos && (size_t) bufferPos <= dma->bufSize - size) {
|
||||
// We already have DMA for this memory range.
|
||||
@@ -276,17 +247,7 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
|
||||
sSampleDmaReuseQueueTail1++;
|
||||
}
|
||||
dma->ttl = 2;
|
||||
#if defined(VERSION_EU)
|
||||
#if PUPPYPRINT_DEBUG
|
||||
dmaAudioTime[perfIteration] += (osGetTime() - first);
|
||||
#endif
|
||||
return dma->buffer + (devAddr - dma->source);
|
||||
#else
|
||||
#if PUPPYPRINT_DEBUG
|
||||
dmaAudioTime[perfIteration] += (osGetTime() - first);
|
||||
#endif
|
||||
return (devAddr - dma->source) + dma->buffer;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,27 +264,13 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
|
||||
dma->ttl = 2;
|
||||
dma->source = dmaDevAddr;
|
||||
dma->sizeUnused = transfer;
|
||||
#ifdef VERSION_US
|
||||
#ifdef VERSION_US // TODO: Is there a reason this only exists in US?
|
||||
osInvalDCache(dma->buffer, transfer);
|
||||
#endif
|
||||
#if defined(VERSION_EU)
|
||||
osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount++], OS_MESG_PRI_NORMAL,
|
||||
OS_READ, dmaDevAddr, dma->buffer, transfer, &gCurrAudioFrameDmaQueue);
|
||||
*dmaIndexRef = dmaIndex;
|
||||
#if PUPPYPRINT_DEBUG
|
||||
dmaAudioTime[perfIteration] += (osGetTime() - first);
|
||||
#endif
|
||||
return (devAddr - dmaDevAddr) + dma->buffer;
|
||||
#else
|
||||
gCurrAudioFrameDmaCount++;
|
||||
osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount - 1], OS_MESG_PRI_NORMAL,
|
||||
OS_READ, dmaDevAddr, dma->buffer, transfer, &gCurrAudioFrameDmaQueue);
|
||||
*dmaIndexRef = dmaIndex;
|
||||
#if PUPPYPRINT_DEBUG
|
||||
dmaAudioTime[perfIteration] += (osGetTime() - first);
|
||||
#endif
|
||||
return dma->buffer + (devAddr - dmaDevAddr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -556,8 +503,6 @@ void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32
|
||||
}
|
||||
|
||||
struct AudioBank *bank_load_immediate(s32 bankId, s32 arg1) {
|
||||
u32 buf[4];
|
||||
|
||||
// (This is broken if the length is 1 (mod 16), but that never happens --
|
||||
// it's always divisible by 4.)
|
||||
s32 alloc = gAlCtlHeader->seqArray[bankId].len + 0xf;
|
||||
@@ -569,9 +514,9 @@ struct AudioBank *bank_load_immediate(s32 bankId, s32 arg1) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
audio_dma_copy_immediate((uintptr_t) ctlData, buf, 0x10);
|
||||
u32 numInstruments = buf[0];
|
||||
u32 numDrums = buf[1];
|
||||
audio_dma_copy_immediate((uintptr_t) ctlData, dmaTempBuffer, 0x10);
|
||||
u32 numInstruments = dmaTempBuffer[0];
|
||||
u32 numDrums = dmaTempBuffer[1];
|
||||
audio_dma_copy_immediate((uintptr_t)(ctlData + 0x10), ret, alloc);
|
||||
patch_audio_bank(ret, gAlTbl->seqArray[bankId].offset, numInstruments, numDrums);
|
||||
gCtlEntries[bankId].numInstruments = (u8) numInstruments;
|
||||
@@ -583,8 +528,6 @@ struct AudioBank *bank_load_immediate(s32 bankId, s32 arg1) {
|
||||
}
|
||||
|
||||
struct AudioBank *bank_load_async(s32 bankId, s32 arg1, struct SequencePlayer *seqPlayer) {
|
||||
u32 buf[4];
|
||||
|
||||
size_t alloc = gAlCtlHeader->seqArray[bankId].len + 0xf;
|
||||
alloc = ALIGN16(alloc);
|
||||
alloc -= 0x10;
|
||||
@@ -594,9 +537,9 @@ struct AudioBank *bank_load_async(s32 bankId, s32 arg1, struct SequencePlayer *s
|
||||
return NULL;
|
||||
}
|
||||
|
||||
audio_dma_copy_immediate((uintptr_t) ctlData, buf, 0x10);
|
||||
u32 numInstruments = buf[0];
|
||||
u32 numDrums = buf[1];
|
||||
audio_dma_copy_immediate((uintptr_t) ctlData, dmaTempBuffer, 0x10);
|
||||
u32 numInstruments = dmaTempBuffer[0];
|
||||
u32 numDrums = dmaTempBuffer[1];
|
||||
seqPlayer->loadingBankId = (u8) bankId;
|
||||
#if defined(VERSION_EU)
|
||||
gCtlEntries[bankId].numInstruments = numInstruments;
|
||||
@@ -860,11 +803,8 @@ void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) {
|
||||
|
||||
// (void) must be omitted from parameters to fix stack with -framepointer
|
||||
void audio_init() {
|
||||
#if defined(VERSION_JP) || defined(VERSION_US) || defined(VERSION_EU)
|
||||
u8 buf[0x10];
|
||||
#endif
|
||||
s32 i, /*j,*/ k;
|
||||
UNUSED u32 size;
|
||||
u32 size;
|
||||
void *data;
|
||||
|
||||
gAudioLoadLock = AUDIO_LOCK_UNINITIALIZED;
|
||||
@@ -939,10 +879,6 @@ void audio_init() {
|
||||
bzero(&gAiBuffers, sizeof(gAiBuffers));
|
||||
for (i = 0; i < NUMAIBUFFERS; i++) {
|
||||
gAiBuffers[i] = soundAlloc(&gAudioInitPool, AIBUFFER_LEN);
|
||||
|
||||
/*for (j = 0; j < (s32) (AIBUFFER_LEN / sizeof(s16)); j++) {
|
||||
gAiBuffers[i][j] = 0;
|
||||
}*/
|
||||
}
|
||||
|
||||
#if defined(VERSION_EU)
|
||||
@@ -959,7 +895,7 @@ void audio_init() {
|
||||
eu_stubbed_printf_0("Main Heap Initialize.\n");
|
||||
|
||||
// Load headers for sounds and sequences
|
||||
gSeqFileHeader = (ALSeqFile *) buf;
|
||||
gSeqFileHeader = (ALSeqFile *) dmaTempBuffer;
|
||||
data = gMusicData;
|
||||
audio_dma_copy_immediate((uintptr_t) data, gSeqFileHeader, 0x10);
|
||||
gSequenceCount = gSeqFileHeader->seqCount;
|
||||
@@ -970,7 +906,7 @@ void audio_init() {
|
||||
alSeqFileNew(gSeqFileHeader, data);
|
||||
|
||||
// Load header for CTL (instrument metadata)
|
||||
gAlCtlHeader = (ALSeqFile *) buf;
|
||||
gAlCtlHeader = (ALSeqFile *) dmaTempBuffer;
|
||||
data = gSoundDataADSR;
|
||||
audio_dma_copy_immediate((uintptr_t) data, gAlCtlHeader, 0x10);
|
||||
size = gAlCtlHeader->seqCount * sizeof(ALSeqData) + 4;
|
||||
@@ -981,7 +917,7 @@ void audio_init() {
|
||||
alSeqFileNew(gAlCtlHeader, data);
|
||||
|
||||
// Load header for TBL (raw sound data)
|
||||
gAlTbl = (ALSeqFile *) buf;
|
||||
gAlTbl = (ALSeqFile *) dmaTempBuffer;
|
||||
audio_dma_copy_immediate((uintptr_t) data, gAlTbl, 0x10);
|
||||
size = gAlTbl->seqCount * sizeof(ALSeqData) + 4;
|
||||
size = ALIGN16(size);
|
||||
|
||||
@@ -315,7 +315,7 @@ struct AudioBank *load_banks_immediate(s32 seqId, s32 *outDefaultBank) {
|
||||
u8 bank;
|
||||
s32 offset;
|
||||
s32 i;
|
||||
void *ret;
|
||||
void *ret = NULL;
|
||||
|
||||
offset = ((u16 *)gAlBankSets)[canonicalize_index(0, seqId)];
|
||||
bank = 0xFF;
|
||||
@@ -471,7 +471,6 @@ void load_sequence_internal(s32 player, s32 seqId, UNUSED s32 loadAsync) {
|
||||
u32 s0;
|
||||
s32 count;
|
||||
u8 bank;
|
||||
s32 i;
|
||||
|
||||
seqPlayer = &gSequencePlayers[player];
|
||||
|
||||
@@ -569,7 +568,7 @@ void *func_sh_802f3688(s32 bankId) {
|
||||
patchInfo.baseAddr2 = NULL;
|
||||
}
|
||||
|
||||
ret = func_sh_802f3764(1, bankId, &sp38)
|
||||
ret = func_sh_802f3764(1, bankId, &sp38);
|
||||
|
||||
if (ret != NULL && sp38 == 1) {
|
||||
func_sh_802f5310(bankId, ret, &patchInfo, 0);
|
||||
@@ -796,8 +795,7 @@ void func_sh_802f3c38(uintptr_t devAddr, void *vAddr, size_t nbytes, s32 medium)
|
||||
}
|
||||
}
|
||||
|
||||
void func_sh_802f3d78(uintptr_t devAddr, void *vAddr, size_t nbytes, s32 arg3) {
|
||||
uintptr_t sp1C = devAddr;
|
||||
void func_sh_802f3d78(UNUSED uintptr_t devAddr, void *vAddr, size_t nbytes, UNUSED s32 arg3) {
|
||||
osInvalDCache(vAddr, nbytes);
|
||||
}
|
||||
|
||||
@@ -1168,8 +1166,7 @@ void func_sh_802f4bd8(struct PendingDmaSample *arg0, s32 len) { // len must be s
|
||||
func_sh_802f3dd0(&arg0->ioMesg, 0, 0, arg0->devAddr, arg0->vAddr, len, &arg0->queue, arg0->medium, shindouDebugPrint102);
|
||||
}
|
||||
|
||||
void func_sh_802f4c5c(uintptr_t devAddr, void *vAddr, size_t nbytes, s32 arg3) {
|
||||
uintptr_t sp1C = devAddr;
|
||||
void func_sh_802f4c5c(UNUSED uintptr_t devAddr, void *vAddr, size_t nbytes, UNUSED s32 arg3) {
|
||||
osInvalDCache(vAddr, nbytes);
|
||||
}
|
||||
|
||||
@@ -1319,8 +1316,7 @@ void func_sh_802f50ec(struct PendingDmaAudioBank *arg0, size_t len) {
|
||||
}
|
||||
|
||||
|
||||
void func_sh_802f517c(uintptr_t devAddr, void *vAddr, size_t nbytes, s32 arg3) {
|
||||
uintptr_t sp1C = devAddr;
|
||||
void func_sh_802f517c(UNUSED uintptr_t devAddr, void *vAddr, size_t nbytes, UNUSED s32 arg3) {
|
||||
osInvalDCache(vAddr, nbytes);
|
||||
}
|
||||
|
||||
@@ -1359,7 +1355,7 @@ void patch_sound(struct AudioBankSound *sound, struct AudioBank *memBase, struct
|
||||
}
|
||||
|
||||
void func_sh_802f5310(s32 bankId, struct AudioBank *mem, struct PatchStruct *patchInfo, s32 arg3) {
|
||||
u8 *addr;
|
||||
u8 *addr = NULL;
|
||||
s32 sp4C;
|
||||
struct AudioBankSample *temp_s0;
|
||||
s32 i;
|
||||
|
||||
@@ -448,19 +448,16 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
struct Instrument *instrument;
|
||||
struct Drum *drum;
|
||||
s32 temp_a0_5;
|
||||
u16 sp3A = 0;
|
||||
#ifdef VERSION_EU
|
||||
u16 sp3A;
|
||||
s32 sameSound = TRUE;
|
||||
#else
|
||||
u8 sameSound = TRUE;
|
||||
#endif
|
||||
u8 cmd;
|
||||
UNUSED u8 cmdSemitone;
|
||||
#ifndef VERSION_EU
|
||||
u16 sp3A;
|
||||
#endif
|
||||
f32 tuning;
|
||||
s32 vel;
|
||||
s32 vel = 0;
|
||||
UNUSED s32 usedSemitone;
|
||||
f32 freqScale;
|
||||
#ifndef VERSION_EU
|
||||
@@ -1139,6 +1136,7 @@ s32 seq_channel_layer_process_script_part2(struct SequenceChannelLayer *layer) {
|
||||
cmd = m64_read_u8(state) + 0x80;
|
||||
layer->freqScaleMultiplier = unk_sh_data_1[cmd];
|
||||
// missing break :)
|
||||
FALL_THROUGH;
|
||||
|
||||
default:
|
||||
switch (cmd & 0xf0) {
|
||||
@@ -1286,8 +1284,8 @@ s32 seq_channel_layer_process_script_part4(struct SequenceChannelLayer *layer, s
|
||||
|
||||
s32 seq_channel_layer_process_script_part3(struct SequenceChannelLayer *layer, s32 cmd) {
|
||||
struct M64ScriptState *state = &layer->scriptState;
|
||||
u16 sp3A;
|
||||
s32 vel;
|
||||
u16 sp3A = 0;
|
||||
s32 vel = 0;
|
||||
struct SequenceChannel *seqChannel = layer->seqChannel;
|
||||
struct SequencePlayer *seqPlayer = seqChannel->seqPlayer;
|
||||
|
||||
@@ -1653,7 +1651,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
} else {
|
||||
eu_stubbed_printf_1("SUB:ERR:BANK %d NOT CACHED.\n", cmd);
|
||||
}
|
||||
// fallthrough
|
||||
FALL_THROUGH;
|
||||
#endif
|
||||
|
||||
case 0xc1: // chan_setinstr ("set program"?)
|
||||
|
||||
@@ -513,7 +513,7 @@ u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) {
|
||||
u32 *aiBufPtr;
|
||||
u64 *cmd = cmdBuf;
|
||||
s32 chunkLen;
|
||||
s32 nextVolRampTable;
|
||||
s32 nextVolRampTable = 0;
|
||||
|
||||
for (i = gAudioBufferParameters.updatesPerFrame; i > 0; i--) {
|
||||
process_sequences(i - 1);
|
||||
@@ -634,7 +634,7 @@ u64 *synthesis_resample_and_mix_reverb(u64 *cmd, s32 bufLen, s16 reverbIndex, s1
|
||||
aMix(cmd++, 0, 0x7fff, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH);
|
||||
aMix(cmd++, 0, 0x8000 + gSynthesisReverbs[reverbIndex].reverbGain, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_LEFT_CH);
|
||||
} else {
|
||||
startPad = (item->startPos & 0x7) * 2
|
||||
startPad = (item->startPos & 0x7) * 2;
|
||||
paddedLengthA = AUDIO_ALIGN(startPad + item->lengthA, 4);
|
||||
|
||||
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED, (item->startPos - startPad / 2), DEFAULT_LEN_1CH, reverbIndex);
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
aSetBuffer(pkt, 0, 0, c + DMEM_ADDR_WET_RIGHT_CH, d); \
|
||||
aSaveBuffer(pkt, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.ringBuffer.right + (off)));
|
||||
|
||||
#undef ALIGN
|
||||
#define ALIGN(val, amnt) (((val) + (1 << amnt) - 1) & ~((1 << amnt) - 1))
|
||||
|
||||
struct VolumeChange {
|
||||
@@ -62,6 +63,7 @@ struct NoteSubEu *gNoteSubsEu;
|
||||
// just that the reverb structure is chosen from an array with index
|
||||
// Identical in EU.
|
||||
void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex) {
|
||||
struct ReverbRingBufferItem *item;
|
||||
struct SynthesisReverb *reverb = &gSynthesisReverbs[reverbIndex];
|
||||
s32 srcPos, dstPos;
|
||||
if (reverb->downsampleRate != 1) {
|
||||
@@ -85,7 +87,7 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex)
|
||||
}
|
||||
}
|
||||
|
||||
struct ReverbRingBufferItem *item = &reverb->items[reverb->curFrame][updateIndex];
|
||||
item = &reverb->items[reverb->curFrame][updateIndex];
|
||||
s32 nSamples = chunkLen / reverb->downsampleRate;
|
||||
s32 excessiveSamples = (nSamples + reverb->nextRingBufferPos) - reverb->bufSizePerChannel;
|
||||
if (excessiveSamples < 0) {
|
||||
@@ -374,7 +376,7 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
|
||||
s32 flags; // sp148, sp11C, t8
|
||||
u16 resamplingRateFixedPoint; // sp5c, sp11A
|
||||
s32 nSamplesToLoad; //s0, Ec
|
||||
s32 sp130; //sp128, sp104
|
||||
s32 sp130 = 0; //sp128, sp104
|
||||
UNUSED s32 tempBufLen;
|
||||
s32 t0;
|
||||
u8 *sampleAddr; // sp120, spF4
|
||||
@@ -394,7 +396,7 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
|
||||
s32 nSamplesInThisIteration; // v1_2
|
||||
u32 a3;
|
||||
u8 *v0_2;
|
||||
s32 unk_s6; // sp90
|
||||
s32 unk_s6 = 0; // sp90
|
||||
s32 s5Aligned;
|
||||
s32 sp88;
|
||||
s32 sp84;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user