From 99a4e2ccfb63e29610999fe19c4f12978c4442db Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Sat, 17 May 2025 18:26:43 -0400 Subject: [PATCH] fix link voice missing when hanging off ledges --- soh/soh/stubs.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/soh/soh/stubs.c b/soh/soh/stubs.c index 56013e56f..fec147625 100644 --- a/soh/soh/stubs.c +++ b/soh/soh/stubs.c @@ -145,7 +145,23 @@ void Audio_osWritebackDCache(void* mem, s32 size) { } s32 osAiSetFrequency(u32 freq) { - return 1; + // from libultra + // #define VI_NTSC_CLOCK 48681812 /* Hz = 48.681812 MHz */ + // s32 osViClock = VI_NTSC_CLOCK; + u8 bitrate; + f32 dacRateF = ((f32)48681812 / freq) + 0.5f; + u32 dacRate = dacRateF; + + if (dacRate < 132) { + return -1; + } + + bitrate = (dacRate / 66); + if (bitrate > 16) { + bitrate = 16; + } + + return 48681812 / (s32)dacRate; } void osInvalDCache(void* vaddr, s32 nbytes) {