Match and link SISamplingRate

This commit is contained in:
Phillip Stephens 2022-10-13 11:30:13 -07:00
parent 2806b45058
commit b923d9cb52
6 changed files with 80 additions and 19 deletions

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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],
],
},
{

View File

@ -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\

View File

@ -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