diff --git a/asm/Dolphin/exi/EXIUart.s b/asm/Dolphin/exi/EXIUart.s index df70dd3c..18618fa3 100644 --- a/asm/Dolphin/exi/EXIUart.s +++ b/asm/Dolphin/exi/EXIUart.s @@ -1,5 +1,21 @@ .include "macros.inc" +.section .sbss, "wa" +.balign 8 + +.global lbl_805A9BE8 +lbl_805A9BE8: + .skip 0x4 +.global lbl_805A9BEC +lbl_805A9BEC: + .skip 0x4 +.global lbl_805A9BF0 +lbl_805A9BF0: + .skip 0x4 +.global lbl_805A9BF4 +lbl_805A9BF4: + .skip 0xC + .section .text, "ax" .global InitializeUART @@ -186,4 +202,3 @@ lbl_803C1B4C: /* 803C1B54 003BEAB4 38 21 00 30 */ addi r1, r1, 0x30 /* 803C1B58 003BEAB8 7C 08 03 A6 */ mtlr r0 /* 803C1B5C 003BEABC 4E 80 00 20 */ blr - diff --git a/asm/Dolphin/si/SIBios.s b/asm/Dolphin/si/SIBios.s index 23de9d23..9749f18a 100644 --- a/asm/Dolphin/si/SIBios.s +++ b/asm/Dolphin/si/SIBios.s @@ -87,21 +87,8 @@ lbl_805A9BD4: .global __PADFixBits __PADFixBits: .skip 0x8 -.global lbl_805A9BE0 -lbl_805A9BE0: - .skip 0x8 -.global lbl_805A9BE8 -lbl_805A9BE8: - .skip 0x4 -.global lbl_805A9BEC -lbl_805A9BEC: - .skip 0x4 -.global lbl_805A9BF0 -lbl_805A9BF0: - .skip 0x4 -.global lbl_805A9BF4 -lbl_805A9BF4: - .skip 0xC + + .section .text, "ax" diff --git a/asm/Dolphin/si/SISamplingRate.s b/asm/Dolphin/si/SISamplingRate.s index 3ef7d700..72050ceb 100644 --- a/asm/Dolphin/si/SISamplingRate.s +++ b/asm/Dolphin/si/SISamplingRate.s @@ -34,6 +34,11 @@ lbl_803F6FB8: .balign 4 .4byte 0 +.section .sbss, "wa" +.balign 8 +.global lbl_805A9BE0 +lbl_805A9BE0: + .skip 0x8 .section .text, "ax" diff --git a/configure.py b/configure.py index 4b21e220..ec610e9f 100755 --- a/configure.py +++ b/configure.py @@ -980,11 +980,11 @@ LIBS = [ }, { "lib": "si", - "mwcc_version": "1.2.5", + "mwcc_version": "1.2.5e", "cflags": "$cflags_base", "objects": [ "Dolphin/si/SIBios", - "Dolphin/si/SISamplingRate", + ["Dolphin/si/SISamplingRate", True], ], }, { diff --git a/obj_files.mk b/obj_files.mk index 2c715453..56866900 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -839,7 +839,7 @@ CARD_FILES :=\ SI_FILES :=\ $(BUILD_DIR)/asm/Dolphin/si/SIBios.o\ - $(BUILD_DIR)/asm/Dolphin/si/SISamplingRate.o + $(BUILD_DIR)/src/Dolphin/si/SISamplingRate.ep.o EXI_FILES :=\ $(BUILD_DIR)/asm/Dolphin/exi/EXIBios.o\ diff --git a/src/Dolphin/si/SISamplingRate.c b/src/Dolphin/si/SISamplingRate.c new file mode 100644 index 00000000..c9b96ca6 --- /dev/null +++ b/src/Dolphin/si/SISamplingRate.c @@ -0,0 +1,54 @@ +#include "dolphin/sipriv.h" +#include "dolphin/vi.h" +#pragma dont_inline on +static u32 SamplingRate; + +typedef struct XY { + u16 line; + u8 count; +} XY; + +static XY XYNTSC[12] = { + {263 - 17, 2}, {15, 18}, {30, 9}, {44, 6}, {52, 5}, {65, 4}, + {87, 3}, {87, 3}, {87, 3}, {131, 2}, {131, 2}, {131, 2}, +}; + +static XY XYPAL[12] = { + {313 - 17, 2}, {15, 21}, {29, 11}, {45, 7}, {52, 6}, {63, 5}, + {78, 4}, {104, 3}, {104, 3}, {104, 3}, {104, 3}, {156, 2}, +}; + +void SISetSamplingRate(u32 msec) { + XY* xy; + BOOL enabled; + + if (msec > 11) { + msec = 11; + } + + enabled = OSDisableInterrupts(); + + SamplingRate = msec; + + switch (VIGetTvFormat()) { + case VI_NTSC: + case VI_MPAL: + case VI_EURGB60: + xy = XYNTSC; + break; + case VI_PAL: + xy = XYPAL; + break; + default: + OSReport("SISetSamplingRate: unknown TV format. Use default."); + msec = 0; + xy = XYNTSC; + break; + } + + SISetXY((__VIRegs[54] & 1 ? 2u : 1u) * xy[msec].line, xy[msec].count); + OSRestoreInterrupts(enabled); +} + +void SIRefreshSamplingRate() { SISetSamplingRate(SamplingRate); } +#pragma dont_inline reset