Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove assignment and bitfield alignment #560

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ LineEnding: LF
ColumnLimit: 0

AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments:
Enabled: true
AlignConsecutiveBitFields:
Enabled: true
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignConsecutiveMacros: Consecutive
AlignEscapedNewlines: LeftWithLastLine
AlignTrailingComments: true
AlignArrayOfStructures: Left

Expand Down
10 changes: 5 additions & 5 deletions arm9/overlays/05/src/ov05_021E72FC.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ BOOL ov05_021E72FC(FieldSystem *fieldSystem, u32 param1) {

void ov05_021E7358(FieldSystem *fieldSystem, u32 param1, u32 param2) {
UnkStruct021E7358 *res = ov05_021E74D4(24);
res->fieldSystem = fieldSystem;
res->Unk10 = param1;
res->Unk00 = param2;
res->fieldSystem = fieldSystem;
res->Unk10 = param1;
res->Unk00 = param2;
PlaySE(SEQ_SE_DP_F209);
FieldSystem_CreateTask(fieldSystem, ov05_021E73B4, res);
}
Expand All @@ -65,9 +65,9 @@ u32 ov05_021E7388(u32 param0) {
}

BOOL ov05_021E73B4(TaskManager *taskManager) {
UnkStruct021E7358 *strct = TaskManager_GetEnvironment(taskManager);
UnkStruct021E7358 *strct = TaskManager_GetEnvironment(taskManager);
LocalMapObject *playerObject = PlayerAvatar_GetMapObject(strct->Unk10);
u8 res2 = (u8)sub_02058720(playerObject);
u8 res2 = (u8)sub_02058720(playerObject);
switch (strct->Unk08) {
case 0:
MapObject_SetFlagsBits(playerObject, MAPOBJECTFLAG_UNK8);
Expand Down
18 changes: 9 additions & 9 deletions arm9/overlays/19/src/overlay_19.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
#include "heap.h"

const struct BgTemplate ov19_02252508 = {
.x = 0,
.y = 0,
.x = 0,
.y = 0,
.bufferSize = 0x800,
.baseTile = 0x000,
.size = GF_BG_SCR_SIZE_256x256,
.colorMode = GF_BG_CLR_4BPP,
.baseTile = 0x000,
.size = GF_BG_SCR_SIZE_256x256,
.colorMode = GF_BG_CLR_4BPP,
.screenBase = 12,
.charBase = 0,
.priority = 0,
.areaOver = 0,
.mosaic = 0
.charBase = 0,
.priority = 0,
.areaOver = 0,
.mosaic = 0
};

void ov19_02252440(struct BgConfig *bgConfig) {
Expand Down
8 changes: 4 additions & 4 deletions arm9/overlays/21/src/ov21_02254854.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ BOOL ov21_0225489C(UnkStruct02254854 *param0, u32 param1, u32 param2, u32 param3
param0->bytearray[2] = 0;
param0->bytearray[3] = 1;
param0->bytearray[6] = 0;
param0->Unk20 = 0;
param0->Unk20 = 0;
GF_RTC_CopyTime(&param0->time);
if (param0->time.hour >= 0x18) {
param0->time.hour = param0->time.hour % 0x18;
Expand All @@ -55,7 +55,7 @@ BOOL ov21_0225489C(UnkStruct02254854 *param0, u32 param1, u32 param2, u32 param3
param0->time.hour = param0->time.hour % 0x3c;
}
param0->bytearray[5] = (u8)param0->time.minute;
param0->Unk10 = ov20_02254130((void *)ov21_02254D80, TRUE, ov21_02254974, param0, 8);
param0->Unk10 = ov20_02254130((void *)ov21_02254D80, TRUE, ov21_02254974, param0, 8);
if (param0->Unk10 == FALSE) {
return FALSE;
}
Expand Down Expand Up @@ -94,11 +94,11 @@ void ov21_02254974(u32 param0, u32 param1, u32 param2, UnkStruct02254854 *param3
#pragma unused(param0, param1)
switch (param2) {
case 1:
param3->Unk20 = 1;
param3->Unk20 = 1;
param3->bytearray[6] = 1;
return;
case 0:
param3->Unk20 = 0;
param3->Unk20 = 0;
param3->bytearray[6] = 1;
return;
default:
Expand Down
28 changes: 14 additions & 14 deletions arm9/overlays/21/src/ov21_02254A6C.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ BOOL ov21_02254A6C(UnkStruct02254A6C *param0, void *param1) {
ov20_022536F4(strct->Unk08, 8);
strct->Unk00 = param1;
strct->Unk04 = ov20_02252D34();
void *res = GfGfxLoader_GetScrnData(12, 0x19, 1, &sp4, 8);
void *res = GfGfxLoader_GetScrnData(12, 0x19, 1, &sp4, 8);
if (res == 0) {
FreeToHeap(strct);
return FALSE;
Expand Down Expand Up @@ -100,13 +100,13 @@ BOOL ov21_02254B60(u32 param0, void *param1) {
ov20_02252D7C(0, 0);
ov21_02254C5C(strct);
BgCommitTilemapBufferToVram(strct->Unk04, 6);
u32 r3 = reg_GXS_DB_DISPCNT;
u32 r2 = reg_GXS_DB_DISPCNT;
u32 r3 = reg_GXS_DB_DISPCNT;
u32 r2 = reg_GXS_DB_DISPCNT;
vu32 tmp = r3; // unused? wtf
u32 r0 = ~0x1F00 & r2;
r2 = r3 << 19; // cast with shift? can't replicate both though
r3 = r2 >> 27;
r2 = 4 | r3;
u32 r0 = ~0x1F00 & r2;
r2 = r3 << 19; // cast with shift? can't replicate both though
r3 = r2 >> 27;
r2 = 4 | r3;
r2 <<= 8;
r0 |= r2;
reg_GXS_DB_DISPCNT = r0;
Expand Down Expand Up @@ -140,24 +140,24 @@ BOOL ov21_02254C40(u32 param0, void *param1) {
}

void ov21_02254C5C(UnkStruct02254A6C *param0) {
u32 tmp = (u32)param0->Unk00->Unk00;
reg_CP_DIVCNT = 0;
u32 tmp = (u32)param0->Unk00->Unk00;
reg_CP_DIVCNT = 0;
(*(vu32 *)REG_DIV_NUMER_ADDR) = tmp;
reg_CP_DIV_DENOM = 10;
reg_CP_DIV_DENOM = 10;
while (reg_CP_DIVCNT & ((u32)&reg_CP_DIVCNT >> 0xb)) {}

u32 regaddr = (u32)&reg_CP_DIV_RESULT_L;
u32 regaddr = (u32)&reg_CP_DIV_RESULT_L;
u32 divResult = *(u32 *)regaddr;
while (reg_CP_DIVCNT & (regaddr >> 0xb)) {}

u32 divRemRes = reg_CP_DIVREM_RESULT_L;
CopyToBgTilemapRect(param0->Unk04, 6, 3, 7, 4, 9, param0->Unk30, (u8)(divResult << 2), 0, 40, 9);
CopyToBgTilemapRect(param0->Unk04, 6, 8, 7, 4, 9, param0->Unk30, (u8)(divRemRes << 2), 0, 40, 9);

tmp = param0->Unk00->Unk04;
reg_CP_DIVCNT = 0;
tmp = param0->Unk00->Unk04;
reg_CP_DIVCNT = 0;
(*(vu32 *)REG_DIV_NUMER_ADDR) = tmp;
reg_CP_DIV_DENOM = 10;
reg_CP_DIV_DENOM = 10;

while (reg_CP_DIVCNT & ((u32)&reg_CP_DIVCNT >> 0xb)) {}

Expand Down
4 changes: 2 additions & 2 deletions arm9/overlays/24/include/overlay_24.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

typedef enum {
TOUCH_TYPE_ERASE = 0,
TOUCH_TYPE_DRAW = 1,
TOUCH_TYPE_DRAW = 1,
} TouchType;

typedef enum {
MEMO_PAD_PIXEL_TYPE_FILLED = 1,
MEMO_PAD_PIXEL_TYPE_EMPTY = 4,
MEMO_PAD_PIXEL_TYPE_EMPTY = 4,
} MemoPadPixelType;

typedef struct MemoPadDrawState {
Expand Down
28 changes: 14 additions & 14 deletions arm9/overlays/24/src/ov24_02254840.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ BOOL ov24_0225489C(MemoPadAppHandler *appHandler, u32 arg1, u32 arg2, u32 arg3)
static const u8 ov24_022550F8[] = {
0x18, 0x58, 0xB4, 0xCC, 0x68, 0xA8, 0xB4, 0xCC
};
appHandler->drawState.unk16E8 = arg3;
appHandler->drawState.unk16E8 = arg3;
appHandler->drawState.touchType = TOUCH_TYPE_DRAW;
if (ov24_02254CA0(&(appHandler->displayHandler), &(appHandler->drawState))) {
appHandler->unk0 = 0;
appHandler->unk1 = 0;
appHandler->unk2 = 0;
appHandler->unk0 = 0;
appHandler->unk1 = 0;
appHandler->unk2 = 0;
appHandler->touchHeld = FALSE;
appHandler->unk16FC = ov20_02254130(ov24_022550F8, 2, ov24_02254960, appHandler, 8);
appHandler->unk16F8 = arg1;
appHandler->unk16FC = ov20_02254130(ov24_022550F8, 2, ov24_02254960, appHandler, 8);
appHandler->unk16F8 = arg1;
return TRUE;
}
return FALSE;
Expand Down Expand Up @@ -151,8 +151,8 @@ BOOL ov24_02254A70(MemoPadAppHandler *appHandler) {
y = (y - 16) >> 1;
if (appHandler->drawState.pixelData[x][y] != appHandler->drawState.touchType) {
appHandler->drawState.pixelData[x][y] = appHandler->drawState.touchType;
appHandler->drawState.lastModifiedX = x;
appHandler->drawState.lastModifiedY = y;
appHandler->drawState.lastModifiedX = x;
appHandler->drawState.lastModifiedY = y;
return TRUE;
}
}
Expand All @@ -164,8 +164,8 @@ BOOL ov24_02254AD4(MemoPadAppHandler *appHandler) {
u32 x, y;
if (TouchScreen_GetTapState(&x, &y)) {
if (((x - 16) < 156) & ((y - 16) < 150)) {
x = (x - 16) >> 1;
y = (y - 16) >> 1;
x = (x - 16) >> 1;
y = (y - 16) >> 1;
appHandler->drawState.lastModifiedX = x;
appHandler->drawState.lastModifiedY = y;
return TRUE;
Expand Down Expand Up @@ -197,8 +197,8 @@ void ov24_02254B20(MemoPadAppHandler *appHandler, u32 x0, u32 y0, u32 x1, u32 y1
if ((x0 < 0x4e) && ((u32)offset < 0x4b)) {
if (appHandler->drawState.touchType != appHandler->drawState.pixelData[x0][offset]) {
appHandler->drawState.pixelData[x0][offset] = appHandler->drawState.touchType;
appHandler->drawState.lastModifiedX = x0;
appHandler->drawState.lastModifiedY = offset;
appHandler->drawState.lastModifiedX = x0;
appHandler->drawState.lastModifiedY = offset;
ov24_02254D8C(appHandler->displayHandler, 3);
}
}
Expand All @@ -220,8 +220,8 @@ void ov24_02254B20(MemoPadAppHandler *appHandler, u32 x0, u32 y0, u32 x1, u32 y1
if ((y0 < 0x4b) && ((u32)offset < 0x4e)) {
if (appHandler->drawState.touchType != appHandler->drawState.pixelData[offset][y0]) {
appHandler->drawState.pixelData[offset][y0] = appHandler->drawState.touchType;
appHandler->drawState.lastModifiedX = offset;
appHandler->drawState.lastModifiedY = y0;
appHandler->drawState.lastModifiedX = offset;
appHandler->drawState.lastModifiedY = y0;
ov24_02254D8C(appHandler->displayHandler, 3);
}
}
Expand Down
74 changes: 37 additions & 37 deletions arm9/overlays/24/src/ov24_02254CA0.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ BOOL ov24_02254CA0(MemoPadDisplayHandler **displayHandlerOut, MemoPadDrawState *
ov20_022536F4(&(displayHandler->unk8), 0x10);
GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_MAIN));
displayHandler->drawState = drawState;
displayHandler->config = ov20_02252D34();
displayHandler->unk50 = ov20_02252D24();
displayHandler->config = ov20_02252D34();
displayHandler->unk50 = ov20_02252D24();
GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_MAIN));
*displayHandlerOut = displayHandler;
return TRUE;
Expand All @@ -46,12 +46,12 @@ BOOL ov24_02254CA0(MemoPadDisplayHandler **displayHandlerOut, MemoPadDrawState *

BOOL ov24_02254D00(MemoPadDisplayHandler *displayHandler) {
static const WindowTemplate template = {
.bgId = GF_BG_LYR_SUB_3,
.left = 2,
.top = 2,
.width = 20,
.height = 19,
.palette = 0,
.bgId = GF_BG_LYR_SUB_3,
.left = 2,
.top = 2,
.width = 20,
.height = 19,
.palette = 0,
.baseTile = 12,
};
displayHandler->window = AllocWindows(HEAP_ID_POKETCH_APP, 1);
Expand Down Expand Up @@ -119,34 +119,34 @@ void ov24_02254DC8(void *arg0) {

void ov24_02254DDC(void *arg0, void *arg1) {
static const BgTemplate template_7000 = {
.x = 0,
.y = 0,
.x = 0,
.y = 0,
.bufferSize = 0,
.baseTile = 0,
.size = 1,
.colorMode = 0,
.baseTile = 0,
.size = 1,
.colorMode = 0,
.screenBase = GX_BG_SCRBASE_0x7000,
.charBase = GX_BG_CHARBASE_0x00000,
.bgExtPltt = 0,
.priority = 2,
.areaOver = 0,
.dummy = 0,
.mosaic = 0,
.charBase = GX_BG_CHARBASE_0x00000,
.bgExtPltt = 0,
.priority = 2,
.areaOver = 0,
.dummy = 0,
.mosaic = 0,
};
static const BgTemplate template_7800 = {
.x = 0,
.y = 0,
.x = 0,
.y = 0,
.bufferSize = 0x800,
.baseTile = 0,
.size = 1,
.colorMode = 0,
.baseTile = 0,
.size = 1,
.colorMode = 0,
.screenBase = GX_BG_SCRBASE_0x7800,
.charBase = GX_BG_CHARBASE_0x00000,
.bgExtPltt = 0,
.priority = 3,
.areaOver = 0,
.dummy = 0,
.mosaic = 0,
.charBase = GX_BG_CHARBASE_0x00000,
.bgExtPltt = 0,
.priority = 3,
.areaOver = 0,
.dummy = 0,
.mosaic = 0,
};
GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_APP));
GXSDispCnt dispcnt;
Expand Down Expand Up @@ -191,12 +191,12 @@ void ov24_02254F28(s32 arg0, void *arg1) {

void ov24_02254F40(u32 arg0, void *arg1) {
MemoPadDisplayHandler *displayHandler = ov20_022538A0(arg1);
MemoPadDrawState *drawState = displayHandler->drawState;
MemoPadDrawState *drawState = displayHandler->drawState;
if (drawState->touchType == TOUCH_TYPE_ERASE) {
s32 width, height;
width = height = 8;
s32 x = drawState->lastModifiedX * 2 - 4;
s32 y = drawState->lastModifiedY * 2 - 4;
s32 x = drawState->lastModifiedX * 2 - 4;
s32 y = drawState->lastModifiedY * 2 - 4;
if (x < 0) {
width += x;
x = 0;
Expand All @@ -215,10 +215,10 @@ void ov24_02254F40(u32 arg0, void *arg1) {
}
} else {
s32 height = 2;
s32 width = 2;
s32 x = drawState->lastModifiedX * 2;
s32 y = drawState->lastModifiedY * 2;
s32 a = (x >> 3) + ((y >> 3) * 0x14);
s32 width = 2;
s32 x = drawState->lastModifiedX * 2;
s32 y = drawState->lastModifiedY * 2;
s32 a = (x >> 3) + ((y >> 3) * 0x14);
FillWindowPixelRect(displayHandler->window, MEMO_PAD_PIXEL_TYPE_FILLED, x, y, width, height);
GXS_LoadBG3Char((u8 *)(displayHandler->window->pixelBuffer) + a * 0x20, (a + 0xc) * 0x20, 0x20);
}
Expand Down
2 changes: 1 addition & 1 deletion arm9/overlays/52/src/overlay_52.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ void ov52_021D7604(HeapID heapId, struct SaveData *save, BOOL set_trainerid) {
sub_0206007C(save);

PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(save);
u32 trainerid = MTRandom();
u32 trainerid = MTRandom();

if (set_trainerid) {
PlayerProfile_SetTrainerID(playerProfile, trainerid);
Expand Down
Loading
Loading