summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjiangzhengwenjz <jiangzhengwenjzw@qq.com>2019-11-11 13:10:36 +0800
committerjiangzhengwenjz <jiangzhengwenjzw@qq.com>2019-11-11 13:10:36 +0800
commitea779d8f359feb860a958e9d83c06a6c99cc90f1 (patch)
tree8f725666bdea9f4b38c5a58548e01ca25dc52ecf
parent5acaa57a2afb3c53cde22b8d2e3bc35f37e72b16 (diff)
sub_8141198
-rw-r--r--src/slot_machine.c305
1 files changed, 8 insertions, 297 deletions
diff --git a/src/slot_machine.c b/src/slot_machine.c
index 3bfbbb08b..866da9eb1 100644
--- a/src/slot_machine.c
+++ b/src/slot_machine.c
@@ -2070,10 +2070,15 @@ static bool32 sub_8141180(u8 a0)
return sub_814112C()->field_0000[a0].unk3;
}
-#ifdef NONMATCHING
+static inline void LoadColor(u16 color, u16 *pal)
+{
+ *pal = color;
+ LoadPalette(pal, 0x00, 0x02);
+}
+
static bool8 sub_8141198(u8 * state, struct SlotMachineSetupTaskData * ptr)
{
- u16 pal;
+ u16 pal[2];
u8 textColor[3];
u32 x;
@@ -2109,8 +2114,7 @@ static bool8 sub_8141198(u8 * state, struct SlotMachineSetupTaskData * ptr)
LoadPalette(gUnknown_8465930, 0x00, 0xA0);
LoadPalette(gUnknown_84664BC, 0x50, 0x20);
LoadPalette(gUnknown_84665C0, 0x70, 0x60);
- pal = RGB(30, 30, 31);
- LoadPalette(&pal, 0x00, 0x02);
+ LoadColor(RGB(30, 30, 31), pal);
LoadUserWindowBorderGfx(0, 0x00A, 0xD0);
sub_814FDA0(0, 0x001, 0xF0);
@@ -2165,299 +2169,6 @@ static bool8 sub_8141198(u8 * state, struct SlotMachineSetupTaskData * ptr)
}
return TRUE;
}
-#else
-NAKED
-static bool8 sub_8141198(u8 * state, struct SlotMachineSetupTaskData * ptr)
-{
- asm_unified("\tpush {r4-r7,lr}\n"
- "\tmov r7, r8\n"
- "\tpush {r7}\n"
- "\tsub sp, 0x14\n"
- "\tadds r7, r0, 0\n"
- "\tmov r8, r1\n"
- "\tldrb r6, [r7]\n"
- "\tcmp r6, 0x1\n"
- "\tbeq _081411D0\n"
- "\tcmp r6, 0x1\n"
- "\tbgt _081411B4\n"
- "\tcmp r6, 0\n"
- "\tbeq _081411C2\n"
- "\tb _08141450\n"
- "_081411B4:\n"
- "\tcmp r6, 0x2\n"
- "\tbne _081411BA\n"
- "\tb _081413E4\n"
- "_081411BA:\n"
- "\tcmp r6, 0x3\n"
- "\tbne _081411C0\n"
- "\tb _08141436\n"
- "_081411C0:\n"
- "\tb _08141450\n"
- "_081411C2:\n"
- "\tmovs r0, 0x1\n"
- "\tnegs r0, r0\n"
- "\tmovs r1, 0x10\n"
- "\tmovs r2, 0\n"
- "\tbl BlendPalettes\n"
- "\tb _0814142E\n"
- "_081411D0:\n"
- "\tmovs r0, 0\n"
- "\tbl SetVBlankCallback\n"
- "\tbl ResetSpriteData\n"
- "\tbl FreeAllSpritePalettes\n"
- "\tmovs r1, 0xE0\n"
- "\tlsls r1, 19\n"
- "\tmovs r2, 0x80\n"
- "\tlsls r2, 3\n"
- "\tmovs r0, 0\n"
- "\tmovs r3, 0x1\n"
- "\tbl RequestDma3Fill\n"
- "\tmovs r1, 0xC0\n"
- "\tlsls r1, 19\n"
- "\tmovs r0, 0\n"
- "\tmovs r2, 0x20\n"
- "\tmovs r3, 0x1\n"
- "\tbl RequestDma3Fill\n"
- "\tldr r1, _0814139C @ =0x0600c000\n"
- "\tmovs r0, 0\n"
- "\tmovs r2, 0x20\n"
- "\tmovs r3, 0x1\n"
- "\tbl RequestDma3Fill\n"
- "\tmovs r0, 0\n"
- "\tmovs r1, 0\n"
- "\tbl SetGpuReg\n"
- "\tbl ResetBgPositions\n"
- "\tmovs r0, 0\n"
- "\tbl ResetBgsAndClearDma3BusyFlags\n"
- "\tldr r1, _081413A0 @ =gUnknown_8466B10\n"
- "\tmovs r0, 0\n"
- "\tmovs r2, 0x4\n"
- "\tbl InitBgsFromTemplates\n"
- "\tldr r0, _081413A4 @ =gUnknown_8466B20\n"
- "\tbl InitWindows\n"
- "\tldr r1, _081413A8 @ =0x0000205c\n"
- "\tadd r1, r8\n"
- "\tmovs r0, 0x3\n"
- "\tbl SetBgTilemapBuffer\n"
- "\tmovs r4, 0x20\n"
- "\tstr r4, [sp]\n"
- "\tstr r4, [sp, 0x4]\n"
- "\tmovs r0, 0x3\n"
- "\tmovs r1, 0\n"
- "\tmovs r2, 0\n"
- "\tmovs r3, 0\n"
- "\tbl FillBgTilemapBufferRect_Palette0\n"
- "\tmovs r0, 0x3\n"
- "\tbl CopyBgTilemapBufferToVram\n"
- "\tbl ResetTempTileDataBuffers\n"
- "\tldr r1, _081413AC @ =gUnknown_84659D0\n"
- "\tmovs r5, 0\n"
- "\tstr r5, [sp]\n"
- "\tmovs r0, 0x2\n"
- "\tmovs r2, 0\n"
- "\tmovs r3, 0\n"
- "\tbl DecompressAndCopyTileDataToVram\n"
- "\tldr r1, _081413B0 @ =gUnknown_846653C\n"
- "\tstr r5, [sp]\n"
- "\tmovs r0, 0x2\n"
- "\tmovs r2, 0\n"
- "\tmovs r3, 0xC0\n"
- "\tbl DecompressAndCopyTileDataToVram\n"
- "\tldr r1, _081413B4 @ =0x0000185c\n"
- "\tadd r1, r8\n"
- "\tmovs r0, 0x2\n"
- "\tbl SetBgTilemapBuffer\n"
- "\tldr r1, _081413B8 @ =gUnknown_84661D4\n"
- "\tmovs r0, 0x2\n"
- "\tmovs r2, 0\n"
- "\tmovs r3, 0\n"
- "\tbl CopyToBgTilemapBuffer\n"
- "\tmovs r0, 0x2\n"
- "\tbl CopyBgTilemapBufferToVram\n"
- "\tldr r0, _081413BC @ =gUnknown_8465930\n"
- "\tmovs r1, 0\n"
- "\tmovs r2, 0xA0\n"
- "\tbl LoadPalette\n"
- "\tldr r0, _081413C0 @ =gUnknown_84664BC\n"
- "\tmovs r1, 0x50\n"
- "\tmovs r2, 0x20\n"
- "\tbl LoadPalette\n"
- "\tldr r0, _081413C4 @ =gUnknown_84665C0\n"
- "\tmovs r1, 0x70\n"
- "\tmovs r2, 0x60\n"
- "\tbl LoadPalette\n"
- "\tldr r1, _081413C8 @ =0x00007fde\n"
- "\tadd r0, sp, 0xC\n"
- "\tstrh r1, [r0]\n"
- "\tmovs r1, 0\n"
- "\tmovs r2, 0x2\n"
- "\tbl LoadPalette\n"
- "\tmovs r0, 0\n"
- "\tmovs r1, 0xA\n"
- "\tmovs r2, 0xD0\n"
- "\tbl LoadUserWindowBorderGfx\n"
- "\tmovs r0, 0\n"
- "\tmovs r1, 0x1\n"
- "\tmovs r2, 0xF0\n"
- "\tbl sub_814FDA0\n"
- "\tldr r1, _081413CC @ =0x0000085c\n"
- "\tadd r1, r8\n"
- "\tmovs r0, 0\n"
- "\tbl SetBgTilemapBuffer\n"
- "\tstr r4, [sp]\n"
- "\tmovs r0, 0x1E\n"
- "\tstr r0, [sp, 0x4]\n"
- "\tmovs r0, 0\n"
- "\tmovs r1, 0\n"
- "\tmovs r2, 0\n"
- "\tmovs r3, 0x2\n"
- "\tbl FillBgTilemapBufferRect_Palette0\n"
- "\tldr r1, _081413D0 @ =gUnknown_8466620\n"
- "\tstr r5, [sp]\n"
- "\tmovs r0, 0x1\n"
- "\tmovs r2, 0\n"
- "\tmovs r3, 0\n"
- "\tbl DecompressAndCopyTileDataToVram\n"
- "\tldr r1, _081413D4 @ =gUnknown_8466998\n"
- "\tstr r6, [sp]\n"
- "\tmovs r0, 0x1\n"
- "\tmovs r2, 0\n"
- "\tmovs r3, 0\n"
- "\tbl DecompressAndCopyTileDataToVram\n"
- "\tmovs r0, 0x1\n"
- "\tbl CopyBgTilemapBufferToVram\n"
- "\tmovs r0, 0x2\n"
- "\tbl stdpal_get\n"
- "\tmovs r1, 0xE0\n"
- "\tmovs r2, 0x20\n"
- "\tbl LoadPalette\n"
- "\tmovs r0, 0x1\n"
- "\tmovs r1, 0xFF\n"
- "\tbl FillWindowPixelBuffer\n"
- "\tmovs r0, 0x1\n"
- "\tbl PutWindowTilemap\n"
- "\tldr r4, _081413D8 @ =gString_SlotMachineControls\n"
- "\tmovs r0, 0\n"
- "\tadds r1, r4, 0\n"
- "\tmovs r2, 0\n"
- "\tbl GetStringWidth\n"
- "\tmovs r2, 0xEC\n"
- "\tsubs r2, r0\n"
- "\tadd r1, sp, 0x10\n"
- "\tmovs r0, 0xF\n"
- "\tstrb r0, [r1]\n"
- "\tstrb r6, [r1, 0x1]\n"
- "\tmovs r0, 0x2\n"
- "\tstrb r0, [r1, 0x2]\n"
- "\tlsls r2, 24\n"
- "\tlsrs r2, 24\n"
- "\tstr r1, [sp]\n"
- "\tstr r5, [sp, 0x4]\n"
- "\tstr r4, [sp, 0x8]\n"
- "\tmovs r0, 0x1\n"
- "\tmovs r1, 0\n"
- "\tmovs r3, 0\n"
- "\tbl AddTextPrinterParameterized3\n"
- "\tmovs r0, 0\n"
- "\tbl CopyBgTilemapBufferToVram\n"
- "\tmovs r1, 0x83\n"
- "\tlsls r1, 5\n"
- "\tmovs r0, 0\n"
- "\tbl SetGpuRegBits\n"
- "\tmovs r0, 0x50\n"
- "\tmovs r1, 0xF8\n"
- "\tbl SetGpuReg\n"
- "\tbl sub_8140C0C\n"
- "\tbl sub_8140CA0\n"
- "\tbl sub_8140E9C\n"
- "\tbl sub_8140FC4\n"
- "\tbl sub_8140F2C\n"
- "\tmovs r0, 0x1\n"
- "\tnegs r0, r0\n"
- "\tmovs r1, 0x10\n"
- "\tmovs r2, 0\n"
- "\tbl BlendPalettes\n"
- "\tldr r0, _081413DC @ =sub_8141118\n"
- "\tbl SetVBlankCallback\n"
- "\tldr r0, _081413E0 @ =sub_8140E40\n"
- "\tbl SetHBlankCallback\n"
- "\tb _0814142E\n"
- "\t.align 2, 0\n"
- "_0814139C: .4byte 0x0600c000\n"
- "_081413A0: .4byte gUnknown_8466B10\n"
- "_081413A4: .4byte gUnknown_8466B20\n"
- "_081413A8: .4byte 0x0000205c\n"
- "_081413AC: .4byte gUnknown_84659D0\n"
- "_081413B0: .4byte gUnknown_846653C\n"
- "_081413B4: .4byte 0x0000185c\n"
- "_081413B8: .4byte gUnknown_84661D4\n"
- "_081413BC: .4byte gUnknown_8465930\n"
- "_081413C0: .4byte gUnknown_84664BC\n"
- "_081413C4: .4byte gUnknown_84665C0\n"
- "_081413C8: .4byte 0x00007fde\n"
- "_081413CC: .4byte 0x0000085c\n"
- "_081413D0: .4byte gUnknown_8466620\n"
- "_081413D4: .4byte gUnknown_8466998\n"
- "_081413D8: .4byte gString_SlotMachineControls\n"
- "_081413DC: .4byte sub_8141118\n"
- "_081413E0: .4byte sub_8140E40\n"
- "_081413E4:\n"
- "\tbl FreeTempTileDataBuffersIfPossible\n"
- "\tlsls r0, 24\n"
- "\tlsrs r5, r0, 24\n"
- "\tcmp r5, 0\n"
- "\tbne _08141450\n"
- "\tmovs r0, 0\n"
- "\tbl ShowBg\n"
- "\tmovs r0, 0x3\n"
- "\tbl ShowBg\n"
- "\tmovs r0, 0x2\n"
- "\tbl ShowBg\n"
- "\tmovs r0, 0x1\n"
- "\tbl HideBg\n"
- "\tbl sub_8141B34\n"
- "\tmovs r4, 0x1\n"
- "\tnegs r4, r4\n"
- "\tadds r0, r4, 0\n"
- "\tmovs r1, 0x10\n"
- "\tmovs r2, 0\n"
- "\tbl BlendPalettes\n"
- "\tstr r5, [sp]\n"
- "\tadds r0, r4, 0\n"
- "\tadds r1, r4, 0\n"
- "\tmovs r2, 0x10\n"
- "\tmovs r3, 0\n"
- "\tbl BeginNormalPaletteFade\n"
- "\tmovs r0, 0x3\n"
- "\tbl EnableInterrupts\n"
- "_0814142E:\n"
- "\tldrb r0, [r7]\n"
- "\tadds r0, 0x1\n"
- "\tstrb r0, [r7]\n"
- "\tb _08141450\n"
- "_08141436:\n"
- "\tbl UpdatePaletteFade\n"
- "\tldr r0, _0814144C @ =gPaletteFade\n"
- "\tldrb r1, [r0, 0x7]\n"
- "\tmovs r0, 0x80\n"
- "\tands r0, r1\n"
- "\tcmp r0, 0\n"
- "\tbne _08141450\n"
- "\tmovs r0, 0\n"
- "\tb _08141452\n"
- "\t.align 2, 0\n"
- "_0814144C: .4byte gPaletteFade\n"
- "_08141450:\n"
- "\tmovs r0, 0x1\n"
- "_08141452:\n"
- "\tadd sp, 0x14\n"
- "\tpop {r3}\n"
- "\tmov r8, r3\n"
- "\tpop {r4-r7}\n"
- "\tpop {r1}\n"
- "\tbx r1");
-}
-#endif //NONMATCHING
static bool8 sub_8141460(u8 * state, struct SlotMachineSetupTaskData * ptr)
{