Merge pull request #234 from hatal175/dispCtrlSet

Tried to decompile dispCtrlSet
This commit is contained in:
Ibot02 2021-12-31 00:12:15 +01:00 committed by GitHub
commit 8b6601525f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 74 additions and 29 deletions

View File

@ -5,10 +5,10 @@
#include "fade.h" #include "fade.h"
typedef struct { typedef struct {
u16 displayControl; /*0x00*/ u16 displayControl;
u8 filler2[0x2]; /*0x02*/ u8 filler2[0x2];
u16 unk4; /*0x04*/ u16 unk4;
u16 displayControlMask; /*0x06*/ u16 displayControlMask;
} LcdControls; } LcdControls;
typedef struct { typedef struct {
@ -28,22 +28,19 @@ typedef struct {
} BgAffSettings; } BgAffSettings;
typedef struct { typedef struct {
u16 bg2dx; u16 dx;
u16 bg2dmx; u16 dmx;
u16 bg2dy; u16 dy;
u16 bg2dmy; u16 dmy;
u16 bg2xPointLeastSig; u16 xPointLeastSig;
u16 bg2xPointMostSig; u16 xPointMostSig;
u16 bg2yPointLeastSig; u16 yPointLeastSig;
u16 bg2yPointMostSig; u16 yPointMostSig;
u16 bg3dx; } BgTransformationSettings;
u16 bg3dmx;
u16 bg3dy; typedef struct {
u16 bg3dmy; BgTransformationSettings bg2;
u16 bg3xPointLeastSig; BgTransformationSettings bg3;
u16 bg3xPointMostSig;
u16 bg3yPointLeastSig;
u16 bg3yPointMostSig;
u16 window0HorizontalDimensions; u16 window0HorizontalDimensions;
u16 window1HorizontalDimensions; u16 window1HorizontalDimensions;
u16 window0VerticalDimensions; u16 window0VerticalDimensions;

View File

@ -117,7 +117,55 @@ void sub_08016CA8(BgSettings* bg) {
} }
} }
ASM_FUNC("asm/dispCtrlSet.s", void DispCtrlSet(void)); NONMATCH("asm/non_matching/dispCtrlSet.inc", void DispCtrlSet(void)) {
BgControls* controls;
u16 tmp = gScreen.lcd.displayControl & gScreen.lcd.displayControlMask;
REG_DISPCNT = tmp;
REG_BG0CNT = gScreen.bg0.control;
REG_BG1CNT = gScreen.bg1.control;
REG_BG2CNT = gScreen.bg2.control;
REG_BG3CNT = gScreen.bg3.control;
REG_BG0HOFS = gScreen.bg0.xOffset;
REG_BG0VOFS = gScreen.bg0.yOffset;
REG_BG1HOFS = gScreen.bg1.xOffset;
REG_BG1VOFS = gScreen.bg1.yOffset;
REG_BG2HOFS = gScreen.bg2.xOffset;
REG_BG2VOFS = gScreen.bg2.yOffset;
REG_BG3HOFS = gScreen.bg3.xOffset;
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;
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_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;
}
END_NONMATCH
// Load any resources that were requested with LoadResourceAsync // Load any resources that were requested with LoadResourceAsync
void LoadResources(void) { void LoadResources(void) {

View File

@ -237,14 +237,14 @@ void sub_08058BC8(ManagerC* this) {
tmp++; tmp++;
} while (++tmp3 < 0xA0u); } while (++tmp3 < 0xA0u);
tmp = &gUnk_02017BA0[gUnk_03003DE4[0] * 0xA0]; tmp = &gUnk_02017BA0[gUnk_03003DE4[0] * 0xA0];
gScreen.controls.bg2dx = tmp->pa; gScreen.controls.bg2.dx = tmp->pa;
gScreen.controls.bg2dmx = tmp->pb; gScreen.controls.bg2.dmx = tmp->pb;
gScreen.controls.bg2dy = tmp->pc; gScreen.controls.bg2.dy = tmp->pc;
gScreen.controls.bg2dmy = tmp->pd; gScreen.controls.bg2.dmy = tmp->pd;
gScreen.controls.bg2xPointLeastSig = ((union SplitWord*)&tmp->dx)->HALF.LO; gScreen.controls.bg2.xPointLeastSig = ((union SplitWord*)&tmp->dx)->HALF.LO;
gScreen.controls.bg2xPointMostSig = ((union SplitWord*)&tmp->dx)->HALF.HI; gScreen.controls.bg2.xPointMostSig = ((union SplitWord*)&tmp->dx)->HALF.HI;
gScreen.controls.bg2yPointLeastSig = ((union SplitWord*)&tmp->dy)->HALF.LO; gScreen.controls.bg2.yPointLeastSig = ((union SplitWord*)&tmp->dy)->HALF.LO;
gScreen.controls.bg2yPointMostSig = ((union SplitWord*)&tmp->dy)->HALF.HI; gScreen.controls.bg2.yPointMostSig = ((union SplitWord*)&tmp->dy)->HALF.HI;
} }
const u16 gUnk_08108300[4] = { 0xA4, 0x4C, 0xF4, 0x9C }; const u16 gUnk_08108300[4] = { 0xA4, 0x4C, 0xF4, 0x9C };