summaryrefslogtreecommitdiff
path: root/soh/src
diff options
context:
space:
mode:
Diffstat (limited to 'soh/src')
-rw-r--r--soh/src/boot/assert.c2
-rw-r--r--soh/src/code/fault_drawer.c5
-rw-r--r--soh/src/code/graph.c16
-rw-r--r--soh/src/code/main.c2
-rw-r--r--soh/src/code/z_message_PAL.c17
5 files changed, 28 insertions, 14 deletions
diff --git a/soh/src/boot/assert.c b/soh/src/boot/assert.c
index b7895dddd..5a44a9308 100644
--- a/soh/src/boot/assert.c
+++ b/soh/src/boot/assert.c
@@ -1,5 +1,6 @@
#include "global.h"
+#ifndef __SWITCH__
void __assert(const char* exp, const char* file, s32 line) {
char msg[256];
@@ -7,3 +8,4 @@ void __assert(const char* exp, const char* file, s32 line) {
sprintf(msg, "ASSERT: %s:%d(%d)", file, line, osGetThreadId(NULL));
Fault_AddHungupAndCrashImpl(msg, exp);
}
+#endif \ No newline at end of file
diff --git a/soh/src/code/fault_drawer.c b/soh/src/code/fault_drawer.c
index 9759bfe72..8cd08248f 100644
--- a/soh/src/code/fault_drawer.c
+++ b/soh/src/code/fault_drawer.c
@@ -265,16 +265,14 @@ void* FaultDrawer_FormatStringFunc(void* arg, const char* str, u32 count) {
return arg;
}
-void FaultDrawer_VPrintf(const char* str, char* args) { // va_list
+void FaultDrawer_VPrintf(const char* str, va_list args) { // va_list
_Printf(FaultDrawer_FormatStringFunc, (char*)&sFaultDrawerStruct, str, args);
}
void FaultDrawer_Printf(const char* fmt, ...) {
va_list args;
va_start(args, fmt);
-
FaultDrawer_VPrintf(fmt, args);
-
va_end(args);
}
@@ -284,7 +282,6 @@ void FaultDrawer_DrawText(s32 x, s32 y, const char* fmt, ...) {
FaultDrawer_SetCursor(x, y);
FaultDrawer_VPrintf(fmt, args);
-
va_end(args);
}
diff --git a/soh/src/code/graph.c b/soh/src/code/graph.c
index f4dcf56e8..cf0a53c76 100644
--- a/soh/src/code/graph.c
+++ b/soh/src/code/graph.c
@@ -481,6 +481,22 @@ static void RunFrame()
uint64_t ticksA, ticksB;
ticksA = GetPerfCounter();
+#ifdef __SWITCH__
+ #define SAMPLES_HIGH 752
+ #define SAMPLES_LOW 720
+
+ #define AUDIO_FRAMES_PER_UPDATE (R_UPDATE_RATE > 0 ? R_UPDATE_RATE : 1 )
+ #define NUM_AUDIO_CHANNELS 2
+ int samples_left = AudioPlayer_Buffered();
+ u32 num_audio_samples = samples_left < AudioPlayer_GetDesiredBuffered() ? SAMPLES_HIGH : SAMPLES_LOW;
+
+ s16 audio_buffer[SAMPLES_HIGH * NUM_AUDIO_CHANNELS * 3];
+ for (int i = 0; i < AUDIO_FRAMES_PER_UPDATE; i++) {
+ AudioMgr_CreateNextAudioBuffer(audio_buffer + i * (num_audio_samples * NUM_AUDIO_CHANNELS), num_audio_samples);
+ }
+
+ AudioPlayer_Play((u8*)audio_buffer, num_audio_samples * (sizeof(int16_t) * NUM_AUDIO_CHANNELS * AUDIO_FRAMES_PER_UPDATE));
+#endif
Graph_StartFrame();
// TODO: Workaround for rumble being too long. Implement os thread functions.
diff --git a/soh/src/code/main.c b/soh/src/code/main.c
index 372e3947c..fd02b016a 100644
--- a/soh/src/code/main.c
+++ b/soh/src/code/main.c
@@ -41,8 +41,6 @@ void main(int argc, char** argv)
GameConsole_Init();
InitOTR();
BootCommands_Init();
-
- BootCommands_ParseBootArgs(argc - 1, (char**)&argv[1]);
Main(0);
}
diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c
index e711e8abe..a91dd5e41 100644
--- a/soh/src/code/z_message_PAL.c
+++ b/soh/src/code/z_message_PAL.c
@@ -111,7 +111,7 @@ void Message_ResetOcarinaNoteState(void) {
sOcarinaNoteCEnvR = 10;
sOcarinaNoteCEnvG = 10;
sOcarinaNoteCEnvB = 10;
- if (CVar_GetS32("gHudColors", 1) == 0) {
+ if (CVar_GetS32("gHudColors", 1) == 0) {
sOcarinaNoteAPrimR = 80;
sOcarinaNoteAPrimG = 150;
sOcarinaNoteAPrimB = 255;
@@ -240,8 +240,6 @@ void Message_DrawTextChar(GlobalContext* globalCtx, void* textureImage, Gfx** p)
s16 x = msgCtx->textPosX;
s16 y = msgCtx->textPosY;
- gSPInvalidateTexCache(gfx++, textureImage);
-
gDPPipeSync(gfx++);
sCharTexSize = (R_TEXT_CHAR_SCALE / 100.0f) * 16.0f;
@@ -1229,6 +1227,8 @@ void Message_Decode(GlobalContext* globalCtx) {
MessageContext* msgCtx = &globalCtx->msgCtx;
Font* font = &globalCtx->msgCtx.font;
+ gSPInvalidateTexCache(globalCtx->state.gfxCtx->polyOpa.p++, NULL);
+
globalCtx->msgCtx.textDelayTimer = 0;
globalCtx->msgCtx.textUnskippable = globalCtx->msgCtx.textDelay = globalCtx->msgCtx.textDelayTimer = 0;
sTextFade = false;
@@ -1624,6 +1624,7 @@ void Message_OpenText(GlobalContext* globalCtx, u16 textId) {
}
sMessageHasSetSfx = D_8014B2F4 = sTextboxSkipped = sTextIsCredits = 0;
+ gSPInvalidateTexCache(globalCtx->state.gfxCtx->polyOpa.p++, NULL);
if (textId >= 0x0500 && textId < 0x0600) { // text ids 0500 to 0600 are reserved for credits
sTextIsCredits = true;
@@ -1793,7 +1794,7 @@ void Message_StartTextbox(GlobalContext* globalCtx, u16 textId, Actor* actor) {
// so we need to switch the order of these lines
if (gSaveContext.n64ddFlag && textId == 0x2053) {
msgCtx->talkActor = actor;
- Message_OpenText(globalCtx, textId);
+ Message_OpenText(globalCtx, textId);
} else {
Message_OpenText(globalCtx, textId);
msgCtx->talkActor = actor;
@@ -2114,7 +2115,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) {
if(CBtnB_2 > 255){CBtnB_2=255;};
s16 sOcarinaNoteCPrimColors_CUSTOM[][3] = {
{ CBtnR, CBtnG, CBtnB }, //Unified
- { CBtnR_2, CBtnG_2, CBtnB_2 },
+ { CBtnR_2, CBtnG_2, CBtnB_2 },
{ CBtnRL, CBtnGL, CBtnBL }, //Left
{ CBtnRD, CBtnGD, CBtnBD }, //Down
{ CBtnRR, CBtnGR, CBtnBR }, //Right
@@ -2704,15 +2705,15 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) {
Message_ContinueTextbox(globalCtx, msgCtx->lastPlayedSong + 0x893); // You played [song name]
Message_Decode(globalCtx);
msgCtx->msgMode = MSGMODE_DISPLAY_SONG_PLAYED_TEXT;
-
- if (CVar_GetS32("gFastOcarinaPlayback", 0) == 0 || globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_TIME
+
+ if (CVar_GetS32("gFastOcarinaPlayback", 0) == 0 || globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_TIME
|| globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_STORMS ||
globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS) {
msgCtx->stateTimer = 20;
} else {
msgCtx->stateTimer = 1;
}
-
+
Message_DrawText(globalCtx, &gfx);
break;
case MSGMODE_DISPLAY_SONG_PLAYED_TEXT: