LoadWallClockGraphics

This commit is contained in:
PikalaxALT 2017-11-24 18:00:26 -05:00
parent ab569cc466
commit f54f2c424f
7 changed files with 202 additions and 222 deletions

View File

@ -5,195 +5,6 @@
.text .text
thumb_func_start sub_81347B4
sub_81347B4: @ 81347B4
push {lr}
bl LoadOam
bl ProcessSpriteCopyRequests
bl TransferPlttBuffer
pop {r0}
bx r0
thumb_func_end sub_81347B4
thumb_func_start LoadWallClockGraphics
LoadWallClockGraphics: @ 81347C8
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x8
movs r0, 0
bl SetVBlankCallback
movs r0, 0
movs r1, 0
bl SetGpuReg
movs r0, 0xE
movs r1, 0
bl SetGpuReg
movs r0, 0xC
movs r1, 0
bl SetGpuReg
movs r0, 0xA
movs r1, 0
bl SetGpuReg
movs r0, 0x8
movs r1, 0
bl SetGpuReg
movs r0, 0
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0
movs r1, 0
movs r2, 0
bl ChangeBgY
movs r0, 0x1
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0x1
movs r1, 0
movs r2, 0
bl ChangeBgY
movs r0, 0x2
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0x2
movs r1, 0
movs r2, 0
bl ChangeBgY
movs r0, 0x3
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0x3
movs r1, 0
movs r2, 0
bl ChangeBgY
movs r3, 0xC0
lsls r3, 19
movs r4, 0xC0
lsls r4, 9
add r0, sp, 0x4
mov r8, r0
mov r2, sp
movs r6, 0
ldr r1, =0x040000d4
movs r5, 0x80
lsls r5, 5
ldr r7, =0x81000800
movs r0, 0x81
lsls r0, 24
mov r12, r0
_0813486C:
strh r6, [r2]
mov r0, sp
str r0, [r1]
str r3, [r1, 0x4]
str r7, [r1, 0x8]
ldr r0, [r1, 0x8]
adds r3, r5
subs r4, r5
cmp r4, r5
bhi _0813486C
strh r6, [r2]
mov r2, sp
str r2, [r1]
str r3, [r1, 0x4]
lsrs r0, r4, 1
mov r2, r12
orrs r0, r2
str r0, [r1, 0x8]
ldr r0, [r1, 0x8]
movs r0, 0xE0
lsls r0, 19
movs r3, 0x80
lsls r3, 3
movs r4, 0
str r4, [sp, 0x4]
ldr r2, =0x040000d4
mov r1, r8
str r1, [r2]
str r0, [r2, 0x4]
lsrs r0, r3, 2
movs r1, 0x85
lsls r1, 24
orrs r0, r1
str r0, [r2, 0x8]
ldr r0, [r2, 0x8]
movs r1, 0xA0
lsls r1, 19
mov r0, sp
strh r4, [r0]
str r0, [r2]
str r1, [r2, 0x4]
lsrs r3, 1
movs r0, 0x81
lsls r0, 24
orrs r3, r0
str r3, [r2, 0x8]
ldr r0, [r2, 0x8]
ldr r0, =gUnknown_08DCC05C
movs r1, 0xC0
lsls r1, 19
bl LZ77UnCompVram
ldr r0, =gSpecialVar_0x8004
ldrh r0, [r0]
cmp r0, 0
bne _081348FC
ldr r0, =gUnknown_08DCC01C
movs r1, 0
movs r2, 0x20
bl LoadPalette
b _08134906
.pool
_081348FC:
ldr r0, =gUnknown_08DCC03C
movs r1, 0
movs r2, 0x20
bl LoadPalette
_08134906:
bl GetOverworldTextboxPalettePtr
movs r1, 0xE0
movs r2, 0x20
bl LoadPalette
ldr r0, =gUnknown_085B21D4
movs r1, 0xC0
movs r2, 0x8
bl LoadPalette
movs r0, 0
bl ResetBgsAndClearDma3BusyFlags
ldr r1, =gUnknown_085B21FC
movs r0, 0
movs r2, 0x3
bl InitBgsFromTemplates
ldr r0, =gUnknown_085B21DC
bl InitWindows
bl DeactivateAllTextPrinters
movs r1, 0x94
lsls r1, 2
movs r0, 0
movs r2, 0xD0
bl sub_809882C
bl clear_scheduled_bg_copies_to_vram
bl remove_some_task
bl ResetTasks
bl ResetSpriteData
bl ResetPaletteFade
bl FreeAllSpritePalettes
ldr r0, =gUnknown_085B2208
bl LoadCompressedObjectPic
ldr r0, =gUnknown_085B2218
bl LoadSpritePalettes
add sp, 0x8
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end LoadWallClockGraphics
thumb_func_start sub_813498C thumb_func_start sub_813498C
sub_813498C: @ 813498C sub_813498C: @ 813498C
push {lr} push {lr}

View File

@ -5,39 +5,6 @@
.section .rodata .section .rodata
gUnknown_085B21D4:: @ 85B21D4
.incbin "baserom.gba", 0x5b21d4, 0x8
gUnknown_085B21DC:: @ 85B21DC
.incbin "baserom.gba", 0x5b21dc, 0x18
gUnknown_085B21F4:: @ 85B21F4
.incbin "baserom.gba", 0x5b21f4, 0x8
gUnknown_085B21FC:: @ 85B21FC
.incbin "baserom.gba", 0x5b21fc, 0xc
gUnknown_085B2208:: @ 85B2208
.incbin "baserom.gba", 0x5b2208, 0x10
gUnknown_085B2218:: @ 85B2218
.incbin "baserom.gba", 0x5b2218, 0x38
gUnknown_085B2250:: @ 85B2250
.incbin "baserom.gba", 0x5b2250, 0x18
gUnknown_085B2268:: @ 85B2268
.incbin "baserom.gba", 0x5b2268, 0x38
gUnknown_085B22A0:: @ 85B22A0
.incbin "baserom.gba", 0x5b22a0, 0x18
gUnknown_085B22B8:: @ 85B22B8
.incbin "baserom.gba", 0x5b22b8, 0x18
gUnknown_085B22D0:: @ 85B22D0
.incbin "baserom.gba", 0x5b22d0, 0x2d0
gPokeblockFlavorCompatibilityTable:: @ 85B25A0 gPokeblockFlavorCompatibilityTable:: @ 85B25A0
.incbin "baserom.gba", 0x5b25a0, 0x80 .incbin "baserom.gba", 0x5b25a0, 0x80

39
data/wallclock.s Normal file
View File

@ -0,0 +1,39 @@
@ the fourth big chunk of data
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
gUnknown_085B21D4:: @ 85B21D4
.incbin "baserom.gba", 0x5b21d4, 0x8
gUnknown_085B21DC:: @ 85B21DC
.incbin "baserom.gba", 0x5b21dc, 0x18
gUnknown_085B21F4:: @ 85B21F4
.incbin "baserom.gba", 0x5b21f4, 0x8
gUnknown_085B21FC:: @ 85B21FC
.incbin "baserom.gba", 0x5b21fc, 0xc
gUnknown_085B2208:: @ 85B2208
.incbin "baserom.gba", 0x5b2208, 0x10
gUnknown_085B2218:: @ 85B2218
.incbin "baserom.gba", 0x5b2218, 0x38
gUnknown_085B2250:: @ 85B2250
.incbin "baserom.gba", 0x5b2250, 0x18
gUnknown_085B2268:: @ 85B2268
.incbin "baserom.gba", 0x5b2268, 0x38
gUnknown_085B22A0:: @ 85B22A0
.incbin "baserom.gba", 0x5b22a0, 0x18
gUnknown_085B22B8:: @ 85B22B8
.incbin "baserom.gba", 0x5b22b8, 0x18
gUnknown_085B22D0:: @ 85B22D0
.incbin "baserom.gba", 0x5b22d0, 0x2d0

View File

@ -78,6 +78,81 @@
#define DmaCopy16(dmaNum, src, dest, size) DMA_COPY(dmaNum, src, dest, size, 16) #define DmaCopy16(dmaNum, src, dest, size) DMA_COPY(dmaNum, src, dest, size, 16)
#define DmaCopy32(dmaNum, src, dest, size) DMA_COPY(dmaNum, src, dest, size, 32) #define DmaCopy32(dmaNum, src, dest, size) DMA_COPY(dmaNum, src, dest, size, 32)
#define DmaCopyLarge(dmaNum, src, dest, size, block, bit) \
{ \
const void *_src = src; \
void *_dest = dest; \
u32 _size = size; \
while (1) \
{ \
DmaCopy##bit(dmaNum, _src, _dest, (block)); \
_src += (block); \
_dest += (block); \
_size -= (block); \
if (_size <= (block)) \
{ \
DmaCopy##bit(dmaNum, _src, _dest, _size); \
break; \
} \
} \
}
#define DmaCopyLarge16(dmaNum, src, dest, size, block) DmaCopyLarge(dmaNum, src, dest, size, block, 16)
#define DmaCopyLarge32(dmaNum, src, dest, size, block) DmaCopyLarge(dmaNum, src, dest, size, block, 32)
#define DmaFillLarge(dmaNum, value, dest, size, block, bit) \
{ \
void *_dest = dest; \
u32 _size = size; \
while (1) \
{ \
DmaFill##bit(dmaNum, value, _dest, (block)); \
_dest += (block); \
_size -= (block); \
if (_size <= (block)) \
{ \
DmaFill##bit(dmaNum, value, _dest, _size); \
break; \
} \
} \
}
#define DmaFillLarge16(dmaNum, value, dest, size, block) DmaFillLarge(dmaNum, value, dest, size, block, 16)
#define DmaFillLarge32(dmaNum, value, dest, size, block) DmaFillLarge(dmaNum, value, dest, size, block, 32)
#define DmaCopyDefvars(dmaNum, src, dest, size, bit) \
{ \
const void *_src = src; \
void *_dest = dest; \
u32 _size = size; \
DmaCopy##bit(dmaNum, _src, _dest, _size); \
}
#define DmaCopy16Defvars(dmaNum, src, dest, size) DmaCopyDefvars(dmaNum, src, dest, size, 16)
#define DmaCopy32Defvars(dmaNum, src, dest, size) DmaCopyDefvars(dmaNum, src, dest, size, 32)
#define DmaFillDefvars(dmaNum, value, dest, size, bit) \
{ \
void *_dest = dest; \
u32 _size = size; \
DmaFill##bit(dmaNum, value, _dest, _size); \
}
#define DmaFill16Defvars(dmaNum, value, dest, size) DmaFillDefvars(dmaNum, value, dest, size, 16)
#define DmaFill32Defvars(dmaNum, value, dest, size) DmaFillDefvars(dmaNum, value, dest, size, 32)
#define DmaClearDefvars(dmaNum, dest, size, bit) \
{ \
void *_dest = dest; \
u32 _size = size; \
DmaClear##bit(dmaNum, _dest, _size); \
}
#define DmaClear16Defvars(dmaNum, dest, size) DmaClearDefvars(dmaNum, dest, size, 16)
#define DmaClear32Defvars(dmaNum, dest, size) DmaClearDefvars(dmaNum, dest, size, 32)
#define DmaStop(dmaNum) \ #define DmaStop(dmaNum) \
{ \ { \
vu16 *dmaRegs = (vu16 *)REG_ADDR_DMA##dmaNum; \ vu16 *dmaRegs = (vu16 *)REG_ADDR_DMA##dmaNum; \

View File

@ -91,5 +91,8 @@ extern const u8 gUnknown_08DB9F08[];
extern const u8 gUnknown_08DB9FFC[]; extern const u8 gUnknown_08DB9FFC[];
extern const u8 gUnknown_08DBA020[]; extern const u8 gUnknown_08DBA020[];
extern const u8 gUnknown_08DBA12C[]; extern const u8 gUnknown_08DBA12C[];
extern const u8 gUnknown_08DCC05C[];
extern const u16 gUnknown_08DCC01C[];
extern const u16 gUnknown_08DCC03C[];
#endif //GUARD_GRAPHICS_H #endif //GUARD_GRAPHICS_H

View File

@ -178,6 +178,7 @@ SECTIONS {
src/battle_ai_script_commands.o(.text); src/battle_ai_script_commands.o(.text);
asm/trader.o(.text); asm/trader.o(.text);
src/starter_choose.o(.text); src/starter_choose.o(.text);
src/wallclock.o(.text);
asm/wallclock.o(.text); asm/wallclock.o(.text);
asm/rom6.o(.text); asm/rom6.o(.text);
asm/battle_records.o(.text); asm/battle_records.o(.text);
@ -425,6 +426,7 @@ SECTIONS {
src/battle_ai_script_commands.o(.rodata); src/battle_ai_script_commands.o(.rodata);
data/data4.o(.rodata); data/data4.o(.rodata);
data/starter_choose.o(.rodata); data/starter_choose.o(.rodata);
data/wallclock.o(.rodata);
data/data4c.o(.rodata); data/data4c.o(.rodata);
src/battle_controller_link_partner.o(.rodata); src/battle_controller_link_partner.o(.rodata);
src/battle_message.o(.rodata); src/battle_message.o(.rodata);

83
src/wallclock.c Normal file
View File

@ -0,0 +1,83 @@
#include "global.h"
#include "main.h"
#include "palette.h"
#include "gpu_regs.h"
#include "bg.h"
#include "rtc.h"
#include "clock.h"
#include "wallclock.h"
#include "event_data.h"
#include "graphics.h"
#include "text.h"
#include "window.h"
#include "text_window.h"
#include "menu.h"
#include "unknown_task.h"
#include "task.h"
#include "decompress.h"
// static types
// static declarations
// rodata
extern const u16 gUnknown_085B21D4[];
extern const struct BgTemplate gUnknown_085B21FC[];
extern const struct WindowTemplate gUnknown_085B21DC[];
extern const struct CompressedSpriteSheet gUnknown_085B2208;
extern const struct SpritePalette gUnknown_085B2218;
// text
void sub_81347B4(void)
{
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
void LoadWallClockGraphics(void)
{
SetVBlankCallback(NULL);
SetGpuReg(REG_OFFSET_DISPCNT, 0x0000);
SetGpuReg(REG_OFFSET_BG3CNT, 0x0000);
SetGpuReg(REG_OFFSET_BG2CNT, 0x0000);
SetGpuReg(REG_OFFSET_BG1CNT, 0x0000);
SetGpuReg(REG_OFFSET_BG0CNT, 0x0000);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
DmaFillLarge16(3, 0, (void *)VRAM, VRAM_SIZE, 0x1000);
DmaClear32(3, (void *)OAM, OAM_SIZE);
DmaClear16(3, (void *)PLTT, PLTT_SIZE);
LZ77UnCompVram(gUnknown_08DCC05C, (void *)VRAM);
if (gSpecialVar_0x8004 == 0)
{
LoadPalette(gUnknown_08DCC01C, 0x00, 0x20);
}
else
{
LoadPalette(gUnknown_08DCC03C, 0x00, 0x20);
}
LoadPalette(GetOverworldTextboxPalettePtr(), 0xe0, 0x20);
LoadPalette(gUnknown_085B21D4, 0xc0, 0x08);
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, gUnknown_085B21FC, 3);
InitWindows(gUnknown_085B21DC);
DeactivateAllTextPrinters();
sub_809882C(0, 0x250, 0xd0);
clear_scheduled_bg_copies_to_vram();
remove_some_task();
ResetTasks();
ResetSpriteData();
ResetPaletteFade();
FreeAllSpritePalettes();
LoadCompressedObjectPic(&gUnknown_085B2208);
LoadSpritePalettes(&gUnknown_085B2218);
}