Add SET_ECHO level script command + minor BETTER_REVERB refactoring (#591)
* Add SET_ECHO level script command + minor BETTER_REVERB refactoring * Add Puppyprint debug page for trying out different BETTER_REVERB presets and configurations Also fix a missing Puppyprint enum that was causing issues * Modify Puppyprint BETTER_REVERB page + other minor improvements * Swap order of RSP commands to allow reverb downsampling to sound more similar to that of without downsampling
This commit is contained in:
1 parent
e2cf2d5119
commit
37787dffc9
16 files changed
+688
-70
No files matched your search
@@ -208,6 +208,8 @@ void clear_areas(void) {
|
||||
gAreaData[i].dialog[1] = DIALOG_NONE;
|
||||
gAreaData[i].musicParam = 0;
|
||||
gAreaData[i].musicParam2 = 0;
|
||||
gAreaData[i].useEchoOverride = FALSE;
|
||||
gAreaData[i].echoOverride = 0;
|
||||
#ifdef BETTER_REVERB
|
||||
gAreaData[i].betterReverbPreset = 0;
|
||||
#endif
|
||||
|
||||
+3
-1
@@ -73,8 +73,10 @@ struct Area {
|
||||
/*0x34*/ u8 dialog[2]; // Level start dialog number (set by level script cmd 0x30)
|
||||
/*0x36*/ u16 musicParam;
|
||||
/*0x38*/ u16 musicParam2;
|
||||
/*0x3A*/ u8 useEchoOverride; // Should area echo be overridden using echoOverride?
|
||||
/*0x3B*/ s8 echoOverride; // Value used to override the area echo values defined in level_defines.h
|
||||
#ifdef BETTER_REVERB
|
||||
/*0x3A*/ u8 betterReverbPreset;
|
||||
/*0x3C*/ u8 betterReverbPreset;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
+22
-4
@@ -178,6 +178,16 @@ u32 pressed_pause(void) {
|
||||
u32 dialogActive = get_dialog_id() >= 0;
|
||||
u32 intangible = (gMarioState->action & ACT_FLAG_INTANGIBLE) != 0;
|
||||
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
#ifdef BETTER_REVERB
|
||||
if (sPPDebugPage == PUPPYPRINT_PAGE_RAM || sPPDebugPage == PUPPYPRINT_PAGE_LEVEL_SELECT || sPPDebugPage == PUPPYPRINT_PAGE_BETTER_REVERB) {
|
||||
#else
|
||||
if (sPPDebugPage == PUPPYPRINT_PAGE_RAM || sPPDebugPage == PUPPYPRINT_PAGE_LEVEL_SELECT) {
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!intangible && !dialogActive && !gWarpTransition.isActive && sDelayedWarpOp == WARP_OP_NONE
|
||||
&& (gPlayer1Controller->buttonPressed & START_BUTTON)) {
|
||||
return TRUE;
|
||||
@@ -397,7 +407,7 @@ void init_mario_after_warp(void) {
|
||||
|
||||
if (gCurrDemoInput == NULL) {
|
||||
#ifdef BETTER_REVERB
|
||||
gBetterReverbPreset = gCurrentArea->betterReverbPreset;
|
||||
gBetterReverbPresetValue = gCurrentArea->betterReverbPreset;
|
||||
#endif
|
||||
set_background_music(gCurrentArea->musicParam, gCurrentArea->musicParam2, 0);
|
||||
|
||||
@@ -509,7 +519,7 @@ void warp_credits(void) {
|
||||
|
||||
if (gCurrCreditsEntry == NULL || gCurrCreditsEntry == sCreditsSequence) {
|
||||
#ifdef BETTER_REVERB
|
||||
gBetterReverbPreset = gCurrentArea->betterReverbPreset;
|
||||
gBetterReverbPresetValue = gCurrentArea->betterReverbPreset;
|
||||
#endif
|
||||
set_background_music(gCurrentArea->musicParam, gCurrentArea->musicParam2, 0);
|
||||
}
|
||||
@@ -1008,7 +1018,11 @@ s32 play_mode_normal(void) {
|
||||
check_instant_warp();
|
||||
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
#ifdef BETTER_REVERB
|
||||
if (sPPDebugPage != PUPPYPRINT_PAGE_RAM && sPPDebugPage != PUPPYPRINT_PAGE_LEVEL_SELECT && sPPDebugPage != PUPPYPRINT_PAGE_BETTER_REVERB) {
|
||||
#else
|
||||
if (sPPDebugPage != PUPPYPRINT_PAGE_RAM && sPPDebugPage != PUPPYPRINT_PAGE_LEVEL_SELECT) {
|
||||
#endif
|
||||
if (sTimerRunning && gHudDisplay.timer < 17999) {
|
||||
gHudDisplay.timer++;
|
||||
}
|
||||
@@ -1026,7 +1040,11 @@ s32 play_mode_normal(void) {
|
||||
#endif
|
||||
if (gCurrentArea != NULL) {
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
if (sPPDebugPage != PUPPYPRINT_PAGE_RAM && sPPDebugPage != PUPPYPRINT_PAGE_LEVEL_SELECT) {
|
||||
#ifdef BETTER_REVERB
|
||||
if (sPPDebugPage != PUPPYPRINT_PAGE_RAM && sPPDebugPage != PUPPYPRINT_PAGE_LEVEL_SELECT && sPPDebugPage != PUPPYPRINT_PAGE_BETTER_REVERB) {
|
||||
#else
|
||||
if (sPPDebugPage != PUPPYPRINT_PAGE_RAM && sPPDebugPage != PUPPYPRINT_PAGE_LEVEL_SELECT) {
|
||||
#endif
|
||||
update_camera(gCurrentArea->camera);
|
||||
}
|
||||
#else
|
||||
@@ -1275,7 +1293,7 @@ s32 init_level(void) {
|
||||
|
||||
if (gCurrDemoInput == NULL) {
|
||||
#ifdef BETTER_REVERB
|
||||
gBetterReverbPreset = gCurrentArea->betterReverbPreset;
|
||||
gBetterReverbPresetValue = gCurrentArea->betterReverbPreset;
|
||||
#endif
|
||||
set_background_music(gCurrentArea->musicParam, gCurrentArea->musicParam2, 0);
|
||||
}
|
||||
|
||||
+498
-10
@@ -26,7 +26,9 @@ a modern game engine's developer's console.
|
||||
#include <ultra64.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "seq_ids.h"
|
||||
#include "game_init.h"
|
||||
#include "sound_init.h"
|
||||
#include "memory.h"
|
||||
#include "print.h"
|
||||
#include "string.h"
|
||||
@@ -40,7 +42,9 @@ a modern game engine's developer's console.
|
||||
#include "object_list_processor.h"
|
||||
#include "engine/surface_load.h"
|
||||
#include "audio/data.h"
|
||||
#include "audio/external.h"
|
||||
#include "audio/heap.h"
|
||||
#include "audio/load.h"
|
||||
#include "hud.h"
|
||||
#include "debug_box.h"
|
||||
#include "color_presets.h"
|
||||
@@ -599,6 +603,378 @@ void puppyprint_level_select_menu(void) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BETTER_REVERB
|
||||
|
||||
#define DEBUG_REVERB_PRESET_COUNT ARRAY_COUNT(gDebugBetterReverbSettings)
|
||||
|
||||
enum BetterReverbDebugFields {
|
||||
PPREVERB_USE_LIGHTWEIGHT,
|
||||
PPREVERB_DOWNSAMPLE_RATE,
|
||||
PPREVERB_IS_MONO,
|
||||
PPREVERB_FILTER_COUNT,
|
||||
PPREVERB_WINDOW_SIZE,
|
||||
PPREVERB_GAIN,
|
||||
PPREVERB_GAIN_INDEX,
|
||||
PPREVERB_REVERB_INDEX,
|
||||
PPREVERB_DELAYS_L,
|
||||
PPREVERB_DELAYS_R,
|
||||
PPREVERB_REVERB_MULTS_L,
|
||||
PPREVERB_REVERB_MULTS_R,
|
||||
PPREVERB_AREA_ECHO,
|
||||
PPREVERB_TOTAL,
|
||||
};
|
||||
|
||||
struct BetterReverbDebugSizes {
|
||||
u8 treatAsEntryCount;
|
||||
u8 bytes;
|
||||
s32 entryMinimum;
|
||||
s32 entryMaximum;
|
||||
};
|
||||
|
||||
static struct BetterReverbDebugSizes maxReverbEntrySizes[PPREVERB_TOTAL] = {
|
||||
{.treatAsEntryCount = TRUE, .bytes = 1, .entryMinimum = 0, .entryMaximum = 1}, // useLightweightSettings
|
||||
{.treatAsEntryCount = TRUE, .bytes = 1, .entryMinimum = -1, .entryMaximum = 5}, // downsampleRate (seems to work up to 7 before things are audibly dangerous, but I suspect it's still unsafe)
|
||||
{.treatAsEntryCount = TRUE, .bytes = 1, .entryMinimum = 0, .entryMaximum = 1}, // isMono
|
||||
{.treatAsEntryCount = TRUE, .bytes = 1, .entryMinimum = 3, .entryMaximum = NUM_ALLPASS}, // filterCount
|
||||
{.treatAsEntryCount = FALSE, .bytes = 2, .entryMinimum = -1, .entryMaximum = 0x7FFF}, // windowSize
|
||||
{.treatAsEntryCount = FALSE, .bytes = 2, .entryMinimum = -1, .entryMaximum = 0x7FFF}, // gain
|
||||
{.treatAsEntryCount = FALSE, .bytes = 1, .entryMinimum = 0, .entryMaximum = 0xFF}, // gainIndex
|
||||
{.treatAsEntryCount = FALSE, .bytes = 1, .entryMinimum = 0, .entryMaximum = 0xFF}, // reverbIndex
|
||||
{.treatAsEntryCount = TRUE, .bytes = 1, .entryMinimum = 0, .entryMaximum = 1}, // delaysL
|
||||
{.treatAsEntryCount = TRUE, .bytes = 1, .entryMinimum = 0, .entryMaximum = 1}, // delaysR
|
||||
{.treatAsEntryCount = TRUE, .bytes = 1, .entryMinimum = 0, .entryMaximum = 1}, // reverbMultsL
|
||||
{.treatAsEntryCount = TRUE, .bytes = 1, .entryMinimum = 0, .entryMaximum = 1}, // reverbMultsR
|
||||
{.treatAsEntryCount = FALSE, .bytes = 1, .entryMinimum = -0x80, .entryMaximum = 0x7F}, // area echo (not part of struct)
|
||||
};
|
||||
|
||||
#define REVERB_TOP_PRIO(x) (((x) | (0xFF << SOUNDARGS_SHIFT_PRIORITY)) & ~SOUND_NO_ECHO)
|
||||
static u32 betterReverbSfx[] = {
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_YAH_WAH_HOO),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_YAH_WAH_HOO + (1 << 16)),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_YAH_WAH_HOO + (2 << 16)),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_HOOHOO),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_YAHOO),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_UH),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_HRMM),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_WAH2),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_WHOA),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_EEUH),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_ATTACKED),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_OOOF),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_HERE_WE_GO),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_YAWNING),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_WAAAOOOW),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_HAHA),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_UH_LEDGE_CLIMB_FAST),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_ON_FIRE),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_DYING),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_PANTING_COLD),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_PANTING),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_MAMA_MIA),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_DROWNING),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_YAHOO_WAHA_YIPPEE),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_YAHOO_WAHA_YIPPEE + (3 << 16)),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_YAHOO_WAHA_YIPPEE + (4 << 16)),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_DOH),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_GAME_OVER),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_HELLO),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_PRESS_START_TO_PLAY),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_TWIRL_BOUNCE),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_SO_LONGA_BOWSER),
|
||||
REVERB_TOP_PRIO(SOUND_MARIO_IMA_TIRED),
|
||||
};
|
||||
#undef REVERB_TOP_PRIO
|
||||
|
||||
static s8 ppAreaEchos[DEBUG_REVERB_PRESET_COUNT] = {0};
|
||||
|
||||
static s32 ppReverbSide = 0;
|
||||
static s32 ppReverbSelectY = 0;
|
||||
|
||||
s32 better_reverb_get_or_set_field(u8 shouldSet, s32 xIndex, s32 yIndex, s32 valueToSet) {
|
||||
s32 ret = 0;
|
||||
|
||||
if (shouldSet) {
|
||||
if (valueToSet < maxReverbEntrySizes[yIndex].entryMinimum) {
|
||||
valueToSet = maxReverbEntrySizes[yIndex].entryMinimum;
|
||||
} else if (valueToSet > maxReverbEntrySizes[yIndex].entryMaximum) {
|
||||
valueToSet = maxReverbEntrySizes[yIndex].entryMaximum;
|
||||
}
|
||||
|
||||
switch(yIndex) {
|
||||
case PPREVERB_USE_LIGHTWEIGHT:
|
||||
gDebugBetterReverbSettings[xIndex].useLightweightSettings = valueToSet;
|
||||
break;
|
||||
case PPREVERB_DOWNSAMPLE_RATE:
|
||||
gDebugBetterReverbSettings[xIndex].downsampleRate = valueToSet;
|
||||
break;
|
||||
case PPREVERB_IS_MONO:
|
||||
gDebugBetterReverbSettings[xIndex].isMono = valueToSet;
|
||||
break;
|
||||
case PPREVERB_FILTER_COUNT:
|
||||
gDebugBetterReverbSettings[xIndex].filterCount = valueToSet;
|
||||
break;
|
||||
case PPREVERB_WINDOW_SIZE:
|
||||
gDebugBetterReverbSettings[xIndex].windowSize = valueToSet;
|
||||
break;
|
||||
case PPREVERB_GAIN:
|
||||
gDebugBetterReverbSettings[xIndex].gain = valueToSet;
|
||||
break;
|
||||
case PPREVERB_GAIN_INDEX:
|
||||
gDebugBetterReverbSettings[xIndex].gainIndex = valueToSet;
|
||||
break;
|
||||
case PPREVERB_REVERB_INDEX:
|
||||
gDebugBetterReverbSettings[xIndex].reverbIndex = valueToSet;
|
||||
break;
|
||||
case PPREVERB_DELAYS_L:
|
||||
gDebugBetterReverbSettings[xIndex].delaysL = sReverbDelaysArr[valueToSet];
|
||||
break;
|
||||
case PPREVERB_DELAYS_R:
|
||||
gDebugBetterReverbSettings[xIndex].delaysR = sReverbDelaysArr[valueToSet];
|
||||
break;
|
||||
case PPREVERB_REVERB_MULTS_L:
|
||||
gDebugBetterReverbSettings[xIndex].reverbMultsL = sReverbMultsArr[valueToSet];
|
||||
break;
|
||||
case PPREVERB_REVERB_MULTS_R:
|
||||
gDebugBetterReverbSettings[xIndex].reverbMultsR = sReverbMultsArr[valueToSet];
|
||||
break;
|
||||
case PPREVERB_AREA_ECHO:
|
||||
if (gCurrentArea != NULL && !gCurrentArea->useEchoOverride) {
|
||||
u8 level = gCurrLevelNum;
|
||||
u8 area = gCurrAreaIndex - 1;
|
||||
if (level > LEVEL_MAX) {
|
||||
level = LEVEL_MAX;
|
||||
}
|
||||
if (area > 2) {
|
||||
area = 2;
|
||||
}
|
||||
|
||||
gCurrentArea->echoOverride = sLevelAreaReverbs[level][area];
|
||||
gCurrentArea->useEchoOverride = TRUE;
|
||||
|
||||
for (u32 i = 0; i < DEBUG_REVERB_PRESET_COUNT; i++) {
|
||||
ppAreaEchos[i] = gCurrentArea->echoOverride;
|
||||
}
|
||||
}
|
||||
ppAreaEchos[xIndex] = valueToSet;
|
||||
break;
|
||||
|
||||
ret = valueToSet;
|
||||
}
|
||||
} else {
|
||||
switch(yIndex) {
|
||||
case PPREVERB_USE_LIGHTWEIGHT:
|
||||
ret = gDebugBetterReverbSettings[xIndex].useLightweightSettings;
|
||||
break;
|
||||
case PPREVERB_DOWNSAMPLE_RATE:
|
||||
ret = gDebugBetterReverbSettings[xIndex].downsampleRate;
|
||||
break;
|
||||
case PPREVERB_IS_MONO:
|
||||
ret = gDebugBetterReverbSettings[xIndex].isMono;
|
||||
break;
|
||||
case PPREVERB_FILTER_COUNT:
|
||||
ret = gDebugBetterReverbSettings[xIndex].filterCount;
|
||||
break;
|
||||
case PPREVERB_WINDOW_SIZE:
|
||||
ret = gDebugBetterReverbSettings[xIndex].windowSize;
|
||||
break;
|
||||
case PPREVERB_GAIN:
|
||||
ret = gDebugBetterReverbSettings[xIndex].gain;
|
||||
break;
|
||||
case PPREVERB_GAIN_INDEX:
|
||||
ret = gDebugBetterReverbSettings[xIndex].gainIndex;
|
||||
break;
|
||||
case PPREVERB_REVERB_INDEX:
|
||||
ret = gDebugBetterReverbSettings[xIndex].reverbIndex;
|
||||
break;
|
||||
case PPREVERB_DELAYS_L:
|
||||
ret = (u32) ((u8*) gDebugBetterReverbSettings[xIndex].delaysL - (u8*) &sReverbDelaysArr[0][0]) / sizeof(sReverbDelaysArr[0]);
|
||||
break;
|
||||
case PPREVERB_DELAYS_R:
|
||||
ret = (u32) ((u8*) gDebugBetterReverbSettings[xIndex].delaysR - (u8*) &sReverbDelaysArr[0][0]) / sizeof(sReverbDelaysArr[0]);
|
||||
break;
|
||||
case PPREVERB_REVERB_MULTS_L:
|
||||
ret = (u32) ((u8*) gDebugBetterReverbSettings[xIndex].reverbMultsL - (u8*) &sReverbMultsArr[0][0]) / sizeof(sReverbMultsArr[0]);
|
||||
break;
|
||||
case PPREVERB_REVERB_MULTS_R:
|
||||
ret = (u32) ((u8*) gDebugBetterReverbSettings[xIndex].reverbMultsR - (u8*) &sReverbMultsArr[0][0]) / sizeof(sReverbMultsArr[0]);
|
||||
break;
|
||||
case PPREVERB_AREA_ECHO:
|
||||
if (gCurrentArea != NULL && !gCurrentArea->useEchoOverride) {
|
||||
u8 level = gCurrLevelNum;
|
||||
u8 area = gCurrAreaIndex - 1;
|
||||
if (level > LEVEL_MAX) {
|
||||
level = LEVEL_MAX;
|
||||
}
|
||||
if (area > 2) {
|
||||
area = 2;
|
||||
}
|
||||
|
||||
gCurrentArea->echoOverride = sLevelAreaReverbs[level][area];
|
||||
gCurrentArea->useEchoOverride = TRUE;
|
||||
|
||||
for (u32 i = 0; i < DEBUG_REVERB_PRESET_COUNT; i++) {
|
||||
ppAreaEchos[i] = gCurrentArea->echoOverride;
|
||||
}
|
||||
}
|
||||
ret = ppAreaEchos[xIndex];
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret < maxReverbEntrySizes[yIndex].entryMinimum) {
|
||||
ret = maxReverbEntrySizes[yIndex].entryMinimum;
|
||||
} else if (ret > maxReverbEntrySizes[yIndex].entryMaximum) {
|
||||
ret = maxReverbEntrySizes[yIndex].entryMaximum;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void better_reverb_preset_menu(void) {
|
||||
char textBytes[16];
|
||||
s32 printValue;
|
||||
s32 x;
|
||||
s32 y;
|
||||
|
||||
prepare_blank_box();
|
||||
render_blank_box_rounded(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0, 127);
|
||||
finish_blank_box();
|
||||
|
||||
print_set_envcolour(63, 159, 127, 255),
|
||||
print_small_text(SCREEN_WIDTH/2, SCREEN_HEIGHT - 48, "<COL_3FFF9FFF>D-Pad Up/Down:<COL_--------> Scroll, <COL_3FFF9FFF>Start:<COL_--------> Switch Preset A/B", PRINT_TEXT_ALIGN_CENTRE, PRINT_ALL, FONT_OUTLINE);
|
||||
print_set_envcolour(63, 159, 127, 255),
|
||||
print_small_text(SCREEN_WIDTH/2, SCREEN_HEIGHT - 36, "<COL_3FFF9FFF>D-Pad L/R:<COL_--------> Fine Adjustment, <COL_3FFF9FFF>Z/R:<COL_--------> Coarse Adjustment", PRINT_TEXT_ALIGN_CENTRE, PRINT_ALL, FONT_OUTLINE);
|
||||
print_set_envcolour(63, 159, 127, 255),
|
||||
print_small_text(SCREEN_WIDTH/2, SCREEN_HEIGHT - 24, "<COL_3FFF9FFF>A:<COL_--------> Apply Selected Preset, <COL_3FFF9FFF>B:<COL_--------> Preview SFX", PRINT_TEXT_ALIGN_CENTRE, PRINT_ALL, FONT_OUTLINE);
|
||||
|
||||
x = 32;
|
||||
y = 16;
|
||||
for (s32 j = 0; j < PPREVERB_TOTAL; j++) {
|
||||
y += 12;
|
||||
if (j == ppReverbSelectY) {
|
||||
print_set_envcolour(255, 255, 159, 255);
|
||||
} else {
|
||||
print_set_envcolour(191, 159, 191, 255);
|
||||
}
|
||||
switch(j) {
|
||||
case PPREVERB_USE_LIGHTWEIGHT:
|
||||
print_small_text_light(x, y, "Lightweight:", PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
|
||||
break;
|
||||
case PPREVERB_DOWNSAMPLE_RATE:
|
||||
print_small_text_light(x, y, "Downsample Rate:", PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
|
||||
break;
|
||||
case PPREVERB_IS_MONO:
|
||||
print_small_text_light(x, y, "Mono:", PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
|
||||
break;
|
||||
case PPREVERB_FILTER_COUNT:
|
||||
print_small_text_light(x, y, "Filter Count:", PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
|
||||
break;
|
||||
case PPREVERB_WINDOW_SIZE:
|
||||
print_small_text_light(x, y, "Window Size:", PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
|
||||
break;
|
||||
case PPREVERB_GAIN:
|
||||
print_small_text_light(x, y, "Gain:", PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
|
||||
break;
|
||||
case PPREVERB_GAIN_INDEX:
|
||||
print_small_text_light(x, y, "Gain Index:", PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
|
||||
break;
|
||||
case PPREVERB_REVERB_INDEX:
|
||||
print_small_text_light(x, y, "Reverb Index:", PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
|
||||
break;
|
||||
case PPREVERB_DELAYS_L:
|
||||
print_small_text_light(x, y, "Delays L:", PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
|
||||
break;
|
||||
case PPREVERB_DELAYS_R:
|
||||
print_small_text_light(x, y, "Delays R:", PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
|
||||
break;
|
||||
case PPREVERB_REVERB_MULTS_L:
|
||||
print_small_text_light(x, y, "Reverb Mults L:", PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
|
||||
break;
|
||||
case PPREVERB_REVERB_MULTS_R:
|
||||
print_small_text_light(x, y, "Reverb Mults R:", PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
|
||||
break;
|
||||
case PPREVERB_AREA_ECHO:
|
||||
print_small_text_light(x, y, "Area Echo:", PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (s32 i = 0; i < DEBUG_REVERB_PRESET_COUNT; i++) {
|
||||
s32 windowSize = better_reverb_get_or_set_field(FALSE, i, PPREVERB_WINDOW_SIZE, 0);
|
||||
s32 downsampleRate = better_reverb_get_or_set_field(FALSE, i, PPREVERB_DOWNSAMPLE_RATE, 0);
|
||||
s32 isLightweight = better_reverb_get_or_set_field(FALSE, i, PPREVERB_USE_LIGHTWEIGHT, 0);
|
||||
x = (SCREEN_WIDTH/2) + (i * 84);
|
||||
y = 12;
|
||||
if (i == ppReverbSide) {
|
||||
print_set_envcolour(255, 255, 159, 255);
|
||||
} else {
|
||||
print_set_envcolour(191, 159, 191, 255);
|
||||
}
|
||||
sprintf(textBytes, "PRESET %c", 'A' + i);
|
||||
print_small_text_light(x, y, textBytes, PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
|
||||
y += 4;
|
||||
for (s32 j = 0; j < PPREVERB_TOTAL; j++) {
|
||||
y += 12;
|
||||
printValue = better_reverb_get_or_set_field(FALSE, i, j, 0);
|
||||
if (i == ppReverbSide && j == ppReverbSelectY) {
|
||||
print_set_envcolour(255, 159, 0, 255);
|
||||
} else if (windowSize == 0) { // All reverb disabled
|
||||
if (j == PPREVERB_WINDOW_SIZE) {
|
||||
print_set_envcolour(255, 255, 255, 255);
|
||||
} else {
|
||||
print_set_envcolour(95, 95, 95, 255);
|
||||
}
|
||||
} else if (downsampleRate <= 0) { // Vanilla reverb
|
||||
switch(j) {
|
||||
case PPREVERB_DOWNSAMPLE_RATE:
|
||||
case PPREVERB_WINDOW_SIZE:
|
||||
case PPREVERB_GAIN:
|
||||
case PPREVERB_AREA_ECHO:
|
||||
print_set_envcolour(255, 255, 255, 255);
|
||||
break;
|
||||
default:
|
||||
print_set_envcolour(95, 95, 95, 255);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (isLightweight) { // Lightweight reverb
|
||||
switch(j) {
|
||||
case PPREVERB_FILTER_COUNT:
|
||||
case PPREVERB_GAIN_INDEX:
|
||||
case PPREVERB_REVERB_INDEX:
|
||||
case PPREVERB_REVERB_MULTS_L:
|
||||
case PPREVERB_REVERB_MULTS_R:
|
||||
print_set_envcolour(95, 95, 95, 255);
|
||||
break;
|
||||
default:
|
||||
print_set_envcolour(255, 255, 255, 255);
|
||||
break;
|
||||
|
||||
}
|
||||
} else { // Standard reverb
|
||||
print_set_envcolour(255, 255, 255, 255);
|
||||
}
|
||||
|
||||
if (maxReverbEntrySizes[j].bytes == 2) {
|
||||
sprintf(textBytes, "0x%04X", (u16) printValue);
|
||||
} else if (!maxReverbEntrySizes[j].treatAsEntryCount) {
|
||||
sprintf(textBytes, "0x%02X", (u8) printValue);
|
||||
} else if (j == PPREVERB_USE_LIGHTWEIGHT || j == PPREVERB_IS_MONO) {
|
||||
if (printValue == 0) {
|
||||
sprintf(textBytes, "FALSE");
|
||||
} else {
|
||||
sprintf(textBytes, "TRUE");
|
||||
}
|
||||
} else {
|
||||
sprintf(textBytes, "%d", printValue);
|
||||
}
|
||||
|
||||
print_small_text_light(x, y, textBytes, PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
u8 gLastWarpID = 0;
|
||||
|
||||
void puppyprint_render_general_vars(void) {
|
||||
@@ -650,18 +1026,21 @@ void puppyprint_render_general_vars(void) {
|
||||
|
||||
struct PuppyPrintPage ppPages[] = {
|
||||
#ifdef USE_PROFILER
|
||||
{&puppyprint_render_standard, "Profiler"},
|
||||
{&puppyprint_render_minimal, "Minimal"},
|
||||
[PUPPYPRINT_PAGE_PROFILER] = {&puppyprint_render_standard, "Profiler"},
|
||||
[PUPPYPRINT_PAGE_MINIMAL] = {&puppyprint_render_minimal, "Minimal"},
|
||||
#endif
|
||||
{&puppyprint_render_general_vars, "General"},
|
||||
{&print_audio_overview, "Audio"},
|
||||
{&print_ram_overview, "Segments"},
|
||||
{&puppyprint_render_collision, "Collision"},
|
||||
{&print_console_log, "Log"},
|
||||
{&puppyprint_level_select_menu, "Level Select"},
|
||||
{&render_coverage_map, "Coverage"},
|
||||
[PUPPYPRINT_PAGE_GENERAL] = {&puppyprint_render_general_vars, "General"},
|
||||
[PUPPYPRINT_PAGE_AUDIO] = {&print_audio_overview, "Audio"},
|
||||
[PUPPYPRINT_PAGE_RAM] = {&print_ram_overview, "Segments"},
|
||||
[PUPPYPRINT_PAGE_COLLISION] = {&puppyprint_render_collision, "Collision"},
|
||||
[PUPPYPRINT_PAGE_LOG] = {&print_console_log, "Log"},
|
||||
[PUPPYPRINT_PAGE_LEVEL_SELECT] = {&puppyprint_level_select_menu, "Level Select"},
|
||||
[PUPPYPRINT_PAGE_COVERAGE] = {&render_coverage_map, "Coverage"},
|
||||
#ifdef PUPPYCAM
|
||||
{&puppycamera_debug_view, "Unlock Camera"},
|
||||
[PUPPYPRINT_PAGE_CAMERA] = {&puppycamera_debug_view, "Unlock Camera"},
|
||||
#endif
|
||||
#ifdef BETTER_REVERB
|
||||
[PUPPYPRINT_PAGE_BETTER_REVERB] = {&better_reverb_preset_menu, "Reverb Config"},
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -810,6 +1189,115 @@ void puppyprint_profiler_process(void) {
|
||||
gPPSegScroll += 4;
|
||||
}
|
||||
}
|
||||
#ifdef BETTER_REVERB
|
||||
if (sPPDebugPage == PUPPYPRINT_PAGE_BETTER_REVERB)
|
||||
{
|
||||
s32 grabbedValue = better_reverb_get_or_set_field(FALSE, ppReverbSide, ppReverbSelectY, 0);
|
||||
|
||||
// These only need to be done once, but not really worth optimizing tbh
|
||||
maxReverbEntrySizes[PPREVERB_DELAYS_L].entryMaximum = gReverbDelaysArrCount - 1;
|
||||
maxReverbEntrySizes[PPREVERB_DELAYS_R].entryMaximum = gReverbDelaysArrCount - 1;
|
||||
maxReverbEntrySizes[PPREVERB_REVERB_MULTS_L].entryMaximum = gReverbMultsArrCount - 1;
|
||||
maxReverbEntrySizes[PPREVERB_REVERB_MULTS_R].entryMaximum = gReverbMultsArrCount - 1;
|
||||
|
||||
if (gPlayer1Controller->buttonPressed & (A_BUTTON | B_BUTTON)) {
|
||||
u8 betterReverbLastPreset = gBetterReverbPresetValue;
|
||||
|
||||
if (gCurrentArea != NULL) {
|
||||
gCurrentArea->useEchoOverride = TRUE;
|
||||
gBetterReverbPresetValue = (u8)(s8) (ppReverbSide - DEBUG_REVERB_PRESET_COUNT);
|
||||
gCurrentArea->echoOverride = ppAreaEchos[ppReverbSide];
|
||||
}
|
||||
|
||||
if (sAudioIsInitialized) {
|
||||
if (gAudioLoadLock != AUDIO_LOCK_UNINITIALIZED) {
|
||||
gAudioLoadLock = AUDIO_LOCK_LOADING;
|
||||
|
||||
init_reverb_us(0);
|
||||
|
||||
if (gAudioLoadLock != AUDIO_LOCK_UNINITIALIZED) {
|
||||
gAudioLoadLock = AUDIO_LOCK_NOT_LOADING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gBetterReverbPresetValue = betterReverbLastPreset;
|
||||
|
||||
if (gPlayer1Controller->buttonPressed & B_BUTTON) {
|
||||
u32 sound = random_u16() % ARRAY_COUNT(betterReverbSfx);
|
||||
play_sound(betterReverbSfx[sound], gGlobalSoundSource);
|
||||
} else { // A_BUTTON
|
||||
sPPDebugPage = 0;
|
||||
}
|
||||
} else if (gPlayer1Controller->buttonPressed & L_JPAD) {
|
||||
if (ppReverbSelectY == PPREVERB_FILTER_COUNT) {
|
||||
grabbedValue -= 3;
|
||||
} else if ((ppReverbSelectY == PPREVERB_WINDOW_SIZE || ppReverbSelectY == PPREVERB_GAIN) && grabbedValue > 0 && grabbedValue <= 0x80) {
|
||||
grabbedValue = 0;
|
||||
} else {
|
||||
if (maxReverbEntrySizes[ppReverbSelectY].bytes == 2) {
|
||||
grabbedValue -= 0x80;
|
||||
} else {
|
||||
grabbedValue -= 0x1;
|
||||
}
|
||||
}
|
||||
|
||||
better_reverb_get_or_set_field(TRUE, ppReverbSide, ppReverbSelectY, grabbedValue);
|
||||
} else if (gPlayer1Controller->buttonPressed & R_JPAD) {
|
||||
if (ppReverbSelectY == PPREVERB_FILTER_COUNT) {
|
||||
grabbedValue += 3;
|
||||
} else if ((ppReverbSelectY == PPREVERB_WINDOW_SIZE || ppReverbSelectY == PPREVERB_GAIN) && grabbedValue < 0) {
|
||||
grabbedValue = 0;
|
||||
} else {
|
||||
if (maxReverbEntrySizes[ppReverbSelectY].bytes == 2) {
|
||||
grabbedValue += 0x80;
|
||||
} else {
|
||||
grabbedValue += 0x1;
|
||||
}
|
||||
}
|
||||
|
||||
better_reverb_get_or_set_field(TRUE, ppReverbSide, ppReverbSelectY, grabbedValue);
|
||||
} else if (gPlayer1Controller->buttonPressed & Z_TRIG) {
|
||||
if (ppReverbSelectY == PPREVERB_FILTER_COUNT) {
|
||||
grabbedValue -= 3;
|
||||
} else if ((ppReverbSelectY == PPREVERB_WINDOW_SIZE || ppReverbSelectY == PPREVERB_GAIN) && grabbedValue > 0 && grabbedValue <= 0x800) {
|
||||
grabbedValue = 0;
|
||||
} else {
|
||||
if (maxReverbEntrySizes[ppReverbSelectY].bytes == 2) {
|
||||
grabbedValue -= 0x800;
|
||||
} else if (!maxReverbEntrySizes[ppReverbSelectY].treatAsEntryCount) {
|
||||
grabbedValue -= 0x10;
|
||||
} else {
|
||||
grabbedValue -= 0x1;
|
||||
}
|
||||
}
|
||||
|
||||
better_reverb_get_or_set_field(TRUE, ppReverbSide, ppReverbSelectY, grabbedValue);
|
||||
} else if (gPlayer1Controller->buttonPressed & R_TRIG) {
|
||||
if (ppReverbSelectY == PPREVERB_FILTER_COUNT) {
|
||||
grabbedValue += 3;
|
||||
} else if ((ppReverbSelectY == PPREVERB_WINDOW_SIZE || ppReverbSelectY == PPREVERB_GAIN) && grabbedValue < 0) {
|
||||
grabbedValue = 0;
|
||||
} else {
|
||||
if (maxReverbEntrySizes[ppReverbSelectY].bytes == 2) {
|
||||
grabbedValue += 0x800;
|
||||
} else if (!maxReverbEntrySizes[ppReverbSelectY].treatAsEntryCount) {
|
||||
grabbedValue += 0x10;
|
||||
} else {
|
||||
grabbedValue += 0x1;
|
||||
}
|
||||
}
|
||||
|
||||
better_reverb_get_or_set_field(TRUE, ppReverbSide, ppReverbSelectY, grabbedValue);
|
||||
} else if (gPlayer1Controller->buttonPressed & D_JPAD) {
|
||||
ppReverbSelectY = (ppReverbSelectY + 1) % PPREVERB_TOTAL;
|
||||
} else if (gPlayer1Controller->buttonPressed & U_JPAD) {
|
||||
ppReverbSelectY = (ppReverbSelectY + PPREVERB_TOTAL - 1) % PPREVERB_TOTAL;
|
||||
} else if (gPlayer1Controller->buttonPressed & START_BUTTON) {
|
||||
ppReverbSide = (ppReverbSide + 1) % DEBUG_REVERB_PRESET_COUNT;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
profiler_update(PROFILER_TIME_PUPPYPRINT2, osGetCount() - first);
|
||||
}
|
||||
|
||||
@@ -94,8 +94,12 @@ enum PPPages {
|
||||
PUPPYPRINT_PAGE_COLLISION,
|
||||
PUPPYPRINT_PAGE_LOG,
|
||||
PUPPYPRINT_PAGE_LEVEL_SELECT,
|
||||
PUPPYPRINT_PAGE_COVERAGE,
|
||||
#ifdef PUPPYCAM
|
||||
PUPPYPRINT_PAGE_CAMERA
|
||||
PUPPYPRINT_PAGE_CAMERA,
|
||||
#endif
|
||||
#ifdef BETTER_REVERB
|
||||
PUPPYPRINT_PAGE_BETTER_REVERB,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user