From c07357747879e9b4af3c73d3b190996b2d2e757b Mon Sep 17 00:00:00 2001 From: anonymous <> Date: Wed, 24 May 2023 00:45:36 +0000 Subject: [PATCH] Match DispCtrlSet --- asm/non_matching/DispCtrlSet.inc | 131 ------------------------------- src/interrupts.c | 63 ++++++++------- 2 files changed, 35 insertions(+), 159 deletions(-) delete mode 100644 asm/non_matching/DispCtrlSet.inc diff --git a/asm/non_matching/DispCtrlSet.inc b/asm/non_matching/DispCtrlSet.inc deleted file mode 100644 index cadf64af..00000000 --- a/asm/non_matching/DispCtrlSet.inc +++ /dev/null @@ -1,131 +0,0 @@ - .syntax unified - ldr r3, _08016DF0 @ =gScreen - ldrh r1, [r3] - ldrh r0, [r3, #6] - ands r0, r1 - movs r1, #0x80 - lsls r1, r1, #0x13 - strh r0, [r1] - adds r1, #8 - ldrh r0, [r3, #8] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0x14] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0x20] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0x2c] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0xa] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0xc] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0x16] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0x18] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0x22] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0x24] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0x2e] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0x30] - strh r0, [r1] - adds r1, r3, #0 - adds r1, #0x38 - ldr r2, _08016DF4 @ =0x04000020 - ldrh r0, [r3, #0x38] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #2] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #4] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #6] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #8] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0xa] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0xc] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0xe] - strh r0, [r2] - adds r1, #0x10 - adds r2, #2 - ldrh r0, [r1] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #2] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #4] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #6] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #8] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0xa] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0xc] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0xe] - strh r0, [r2] - adds r1, #0x10 - adds r2, #2 - ldrh r0, [r1] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #2] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #4] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #6] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #8] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0xa] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0xc] - strh r0, [r2] - adds r2, #4 - ldrh r0, [r1, #0xe] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0x10] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0x12] - strh r0, [r2] - bx lr - .align 2, 0 -_08016DF0: .4byte gScreen -_08016DF4: .4byte 0x04000020 - .syntax divided diff --git a/src/interrupts.c b/src/interrupts.c index 23934487..69a0f137 100644 --- a/src/interrupts.c +++ b/src/interrupts.c @@ -94,8 +94,10 @@ void sub_08016CA8(BgSettings* bg) { } } -NONMATCH("asm/non_matching/DispCtrlSet.inc", void DispCtrlSet(void)) { +void DispCtrlSet(void) { + u16* tmp2; BgControls* controls; + BgTransformationSettings* bgTfSettings; u16 tmp = gScreen.lcd.displayControl & gScreen.lcd.displayControlMask; REG_DISPCNT = tmp; @@ -113,36 +115,41 @@ NONMATCH("asm/non_matching/DispCtrlSet.inc", void DispCtrlSet(void)) { REG_BG3VOFS = gScreen.bg3.yOffset; controls = &(gScreen.controls); - REG_BG2PA = controls->bg2.dx; - REG_BG2PB = controls->bg2.dmx; - REG_BG2PC = controls->bg2.dy; - REG_BG2PD = controls->bg2.dmy; - REG_BG2X_L = controls->bg2.xPointLeastSig; - REG_BG2X_H = controls->bg2.xPointMostSig; - REG_BG2Y_L = controls->bg2.yPointLeastSig; - REG_BG2Y_H = controls->bg2.yPointMostSig; + bgTfSettings = &controls->bg2; - REG_BG3PA = controls->bg3.dx; - REG_BG3PB = controls->bg3.dmx; - REG_BG3PC = controls->bg3.dy; - REG_BG3PD = controls->bg3.dmy; - REG_BG3X_L = controls->bg3.xPointLeastSig; - REG_BG3X_H = controls->bg3.xPointMostSig; - REG_BG3Y_L = controls->bg3.yPointLeastSig; - REG_BG3Y_H = controls->bg3.yPointMostSig; + REG_BG2PA = bgTfSettings->dx; + REG_BG2PB = bgTfSettings->dmx; + REG_BG2PC = bgTfSettings->dy; + REG_BG2PD = bgTfSettings->dmy; + REG_BG2X_L = bgTfSettings->xPointLeastSig; + REG_BG2X_H = bgTfSettings->xPointMostSig; + REG_BG2Y_L = bgTfSettings->yPointLeastSig; + REG_BG2Y_H = bgTfSettings->yPointMostSig; - REG_WIN0H = controls->window0HorizontalDimensions; - REG_WIN1H = controls->window1HorizontalDimensions; - REG_WIN0V = controls->window0VerticalDimensions; - REG_WIN1V = controls->window1VerticalDimensions; - REG_WININ = controls->windowInsideControl; - REG_WINOUT = controls->windowOutsideControl; - REG_MOSAIC = controls->mosaicSize; - REG_BLDCNT = controls->layerFXControl; - REG_BLDALPHA = controls->alphaBlend; - REG_BLDY = controls->layerBrightness; + bgTfSettings = &controls->bg3; + + REG_BG3PA = bgTfSettings->dx; + REG_BG3PB = bgTfSettings->dmx; + REG_BG3PC = bgTfSettings->dy; + REG_BG3PD = bgTfSettings->dmy; + REG_BG3X_L = bgTfSettings->xPointLeastSig; + REG_BG3X_H = bgTfSettings->xPointMostSig; + REG_BG3Y_L = bgTfSettings->yPointLeastSig; + REG_BG3Y_H = bgTfSettings->yPointMostSig; + + tmp2 = &controls->window0HorizontalDimensions; + REG_WIN0H = tmp2[0]; + // REG_WIN0H = *tmp2; + REG_WIN1H = tmp2[1]; + REG_WIN0V = tmp2[2]; + REG_WIN1V = tmp2[3]; + REG_WININ = tmp2[4]; + REG_WINOUT = tmp2[5]; + REG_MOSAIC = tmp2[6]; + REG_BLDCNT = tmp2[7]; + REG_BLDALPHA = tmp2[8]; + REG_BLDY = tmp2[9]; } -END_NONMATCH // Load any resources that were requested with LoadResourceAsync void LoadResources(void) {