From 85a959f321dfa01c9c76f9c74fbbda55614271da Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 28 Feb 2018 13:07:58 +0100 Subject: [PATCH] clean up files --- asm/blit.s | 823 ------------------------------------------------ include/blit.h | 10 + include/clock.h | 2 +- ld_script.txt | 2 +- src/blit.c | 4 +- src/text.c | 12 +- src/window.c | 23 +- 7 files changed, 23 insertions(+), 853 deletions(-) delete mode 100644 asm/blit.s create mode 100644 include/blit.h diff --git a/asm/blit.s b/asm/blit.s deleted file mode 100644 index 5df45e77e..000000000 --- a/asm/blit.s +++ /dev/null @@ -1,823 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start BlitBitmapRect4BitWithoutColorKey -@ void BlitBitmapRect4BitWithoutColorKey(struct Bitmap *src, struct Bitmap *dest, u16 srcX, u16 srcY, u16 destX, u16 destY, u16 width, u16 height) -BlitBitmapRect4BitWithoutColorKey: @ 8002BDC - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x14 - ldr r4, [sp, 0x2C] - ldr r5, [sp, 0x30] - ldr r6, [sp, 0x34] - ldr r7, [sp, 0x38] - lsls r2, 16 - lsrs r2, 16 - lsls r3, 16 - lsrs r3, 16 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r6, 16 - lsrs r6, 16 - lsls r7, 16 - lsrs r7, 16 - str r4, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - str r7, [sp, 0xC] - movs r4, 0xFF - str r4, [sp, 0x10] - bl BlitBitmapRect4Bit - add sp, 0x14 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end BlitBitmapRect4BitWithoutColorKey - - thumb_func_start BlitBitmapRect4Bit -@ void BlitBitmapRect4Bit(struct Bitmap *src, struct Bitmap *dest, u16 srcX, u16 srcY, u16 destX, u16 destY, u16 width, u16 height, u8 colorKey) -BlitBitmapRect4Bit: @ 8002C20 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - str r0, [sp] - str r1, [sp, 0x4] - ldr r0, [sp, 0x4C] - ldr r1, [sp, 0x50] - ldr r4, [sp, 0x54] - ldr r5, [sp, 0x58] - ldr r6, [sp, 0x5C] - lsls r2, 16 - lsrs r2, 16 - str r2, [sp, 0x8] - lsls r3, 16 - lsrs r7, r3, 16 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0xC] - lsls r1, 16 - lsrs r1, 16 - mov r9, r1 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r6, 24 - lsrs r6, 24 - str r6, [sp, 0x10] - ldr r0, [sp, 0x4] - ldrh r3, [r0, 0x4] - ldr r1, [sp, 0xC] - subs r0, r3, r1 - adds r2, r4 - mov r8, r2 - cmp r0, r4 - bge _08002C74 - ldr r2, [sp, 0x8] - adds r0, r2 - mov r8, r0 -_08002C74: - ldr r4, [sp, 0x4] - ldrh r0, [r4, 0x6] - mov r1, r9 - subs r0, r1 - adds r2, r5, r7 - str r2, [sp, 0x14] - cmp r0, r5 - bge _08002C88 - adds r0, r7 - str r0, [sp, 0x14] -_08002C88: - ldr r4, [sp] - ldrh r1, [r4, 0x4] - movs r2, 0x7 - adds r0, r1, 0 - ands r0, r2 - adds r1, r0 - asrs r1, 3 - str r1, [sp, 0x18] - adds r0, r3, 0 - ands r0, r2 - adds r0, r3, r0 - asrs r0, 3 - str r0, [sp, 0x1C] - ldr r0, [sp, 0x10] - cmp r0, 0xFF - bne _08002D46 - adds r3, r7, 0 - mov r1, r9 - ldr r2, [sp, 0x14] - cmp r3, r2 - blt _08002CB4 - b _08002DEE -_08002CB4: - ldr r5, [sp, 0x8] - ldr r6, [sp, 0xC] - adds r4, r3, 0x1 - str r4, [sp, 0x24] - adds r0, r1, 0x1 - str r0, [sp, 0x28] - cmp r5, r8 - bge _08002D3A - movs r7, 0x3 - asrs r0, r3, 3 - ldr r2, [sp, 0x18] - muls r0, r2 - lsls r0, 5 - mov r10, r0 - lsls r0, r3, 29 - lsrs r0, 27 - mov r9, r0 - asrs r0, r1, 3 - ldr r4, [sp, 0x1C] - muls r0, r4 - lsls r0, 5 - mov r12, r0 - lsls r0, r1, 29 - lsrs r3, r0, 27 -_08002CE4: - asrs r0, r5, 1 - ands r0, r7 - ldr r2, [sp] - ldr r1, [r2] - adds r1, r0 - asrs r0, r5, 3 - lsls r0, 5 - adds r1, r0 - add r1, r10 - mov r4, r9 - adds r2, r1, r4 - asrs r0, r6, 1 - ands r0, r7 - ldr r4, [sp, 0x4] - ldr r1, [r4] - adds r1, r0 - asrs r0, r6, 3 - lsls r0, 5 - adds r1, r0 - add r1, r12 - adds r4, r1, r3 - ldrb r2, [r2] - adds r0, r5, 0 - movs r1, 0x1 - ands r0, r1 - lsls r0, 2 - asrs r2, r0 - movs r0, 0xF - ands r2, r0 - adds r0, r6, 0 - ands r0, r1 - lsls r1, r0, 2 - lsls r2, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r4] - ands r0, r1 - orrs r2, r0 - strb r2, [r4] - adds r5, 0x1 - adds r6, 0x1 - cmp r5, r8 - blt _08002CE4 -_08002D3A: - ldr r3, [sp, 0x24] - ldr r1, [sp, 0x28] - ldr r2, [sp, 0x14] - cmp r3, r2 - blt _08002CB4 - b _08002DEE -_08002D46: - adds r3, r7, 0 - mov r1, r9 - ldr r4, [sp, 0x14] - cmp r3, r4 - bge _08002DEE -_08002D50: - ldr r5, [sp, 0x8] - ldr r6, [sp, 0xC] - adds r0, r3, 0x1 - str r0, [sp, 0x24] - adds r2, r1, 0x1 - str r2, [sp, 0x28] - cmp r5, r8 - bge _08002DE4 - movs r4, 0x3 - mov r9, r4 - asrs r0, r3, 3 - ldr r2, [sp, 0x18] - muls r0, r2 - lsls r0, 5 - str r0, [sp, 0x20] - lsls r0, r3, 29 - lsrs r0, 27 - mov r10, r0 - movs r3, 0x1 - asrs r0, r1, 3 - ldr r4, [sp, 0x1C] - muls r0, r4 - lsls r0, 5 - mov r12, r0 - lsls r0, r1, 29 - lsrs r7, r0, 27 -_08002D84: - asrs r0, r5, 1 - mov r1, r9 - ands r0, r1 - ldr r2, [sp] - ldr r1, [r2] - adds r1, r0 - asrs r0, r5, 3 - lsls r0, 5 - adds r1, r0 - ldr r4, [sp, 0x20] - adds r1, r4 - mov r0, r10 - adds r2, r1, r0 - asrs r0, r6, 1 - mov r1, r9 - ands r0, r1 - ldr r4, [sp, 0x4] - ldr r1, [r4] - adds r1, r0 - asrs r0, r6, 3 - lsls r0, 5 - adds r1, r0 - add r1, r12 - adds r4, r1, r7 - ldrb r2, [r2] - adds r0, r5, 0 - ands r0, r3 - lsls r0, 2 - asrs r2, r0 - movs r0, 0xF - ands r2, r0 - ldr r0, [sp, 0x10] - cmp r2, r0 - beq _08002DDC - adds r0, r6, 0 - ands r0, r3 - lsls r1, r0, 2 - lsls r2, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r4] - ands r0, r1 - orrs r2, r0 - strb r2, [r4] -_08002DDC: - adds r5, 0x1 - adds r6, 0x1 - cmp r5, r8 - blt _08002D84 -_08002DE4: - ldr r3, [sp, 0x24] - ldr r1, [sp, 0x28] - ldr r2, [sp, 0x14] - cmp r3, r2 - blt _08002D50 -_08002DEE: - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end BlitBitmapRect4Bit - - thumb_func_start FillBitmapRect4Bit -@ void FillBitmapRect4Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue) -FillBitmapRect4Bit: @ 8002E00 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - mov r9, r0 - ldr r0, [sp, 0x28] - ldr r4, [sp, 0x2C] - lsls r1, 16 - lsrs r1, 16 - str r1, [sp] - lsls r2, 16 - lsrs r2, 16 - adds r6, r2, 0 - lsls r3, 16 - lsrs r3, 16 - lsls r0, 16 - lsrs r0, 16 - lsls r4, 24 - lsrs r5, r4, 24 - adds r4, r1, r3 - mov r3, r9 - ldrh r1, [r3, 0x4] - cmp r4, r1 - ble _08002E36 - adds r4, r1, 0 -_08002E36: - adds r2, r0 - mov r12, r2 - mov r2, r9 - ldrh r0, [r2, 0x6] - cmp r12, r0 - ble _08002E44 - mov r12, r0 -_08002E44: - movs r0, 0x7 - ands r0, r1 - adds r0, r1, r0 - asrs r0, 3 - str r0, [sp, 0x4] - lsls r0, r5, 28 - lsrs r0, 24 - mov r8, r0 - movs r3, 0xF - mov r10, r3 - mov r0, r10 - ands r0, r5 - mov r10, r0 - adds r1, r6, 0 - cmp r1, r12 - bge _08002EB6 -_08002E64: - ldr r3, [sp] - adds r7, r1, 0x1 - cmp r3, r4 - bge _08002EB0 - asrs r0, r1, 3 - ldr r2, [sp, 0x4] - muls r0, r2 - lsls r6, r0, 5 - lsls r0, r1, 29 - lsrs r5, r0, 27 -_08002E78: - asrs r2, r3, 1 - movs r0, 0x3 - ands r2, r0 - mov r0, r9 - ldr r1, [r0] - adds r1, r2 - asrs r0, r3, 3 - lsls r0, 5 - adds r1, r0 - adds r1, r6 - adds r2, r1, r5 - lsls r0, r3, 31 - cmp r0, 0 - beq _08002E9E - ldrb r1, [r2] - movs r0, 0xF - ands r0, r1 - mov r1, r8 - b _08002EA6 -_08002E9E: - ldrb r1, [r2] - movs r0, 0xF0 - ands r0, r1 - mov r1, r10 -_08002EA6: - orrs r0, r1 - strb r0, [r2] - adds r3, 0x1 - cmp r3, r4 - blt _08002E78 -_08002EB0: - adds r1, r7, 0 - cmp r1, r12 - blt _08002E64 -_08002EB6: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end FillBitmapRect4Bit - - thumb_func_start BlitBitmapRect4BitTo8Bit -@ void BlitBitmapRect4BitTo8Bit(struct Bitmap *src, struct Bitmap *dest, u16 srcX, u16 srcY, u16 destX, u16 destY, u16 width, u16 height, u8 colorKey, u8 paletteOffset) -BlitBitmapRect4BitTo8Bit: @ 8002EC8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x3C - str r0, [sp] - str r1, [sp, 0x4] - ldr r0, [sp, 0x5C] - ldr r1, [sp, 0x60] - ldr r5, [sp, 0x64] - ldr r4, [sp, 0x68] - ldr r6, [sp, 0x6C] - ldr r7, [sp, 0x70] - mov r8, r7 - lsls r2, 16 - lsrs r2, 16 - str r2, [sp, 0x8] - lsls r3, 16 - lsrs r3, 16 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0xC] - lsls r1, 16 - lsrs r7, r1, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r4, 16 - lsrs r4, 16 - lsls r6, 24 - lsrs r6, 24 - str r6, [sp, 0x10] - mov r0, r8 - lsls r0, 28 - lsrs r0, 24 - str r0, [sp, 0x14] - lsls r0, r6, 28 - lsrs r0, 24 - str r0, [sp, 0x28] - ldr r1, [sp, 0x4] - ldrh r0, [r1, 0x4] - ldr r2, [sp, 0xC] - subs r0, r2 - ldr r1, [sp, 0x8] - adds r1, r5, r1 - str r1, [sp, 0x18] - cmp r0, r5 - bge _08002F2E - ldr r2, [sp, 0x8] - adds r0, r2 - str r0, [sp, 0x18] -_08002F2E: - ldr r5, [sp, 0x4] - ldrh r1, [r5, 0x6] - subs r0, r1, r7 - cmp r0, r4 - bge _08002F40 - adds r0, r3, r1 - subs r0, r7 - str r0, [sp, 0x1C] - b _08002F44 -_08002F40: - adds r4, r3, r4 - str r4, [sp, 0x1C] -_08002F44: - ldr r0, [sp] - ldrh r1, [r0, 0x4] - movs r2, 0x7 - adds r0, r1, 0 - ands r0, r2 - adds r1, r0 - asrs r1, 3 - str r1, [sp, 0x20] - ldr r5, [sp, 0x4] - ldrh r1, [r5, 0x4] - adds r0, r1, 0 - ands r0, r2 - adds r1, r0 - asrs r1, 3 - str r1, [sp, 0x24] - ldr r0, [sp, 0x10] - cmp r0, 0xFF - bne _08003024 - adds r2, r3, 0 - adds r5, r7, 0 - ldr r1, [sp, 0x1C] - cmp r2, r1 - blt _08002F74 - b _08003106 -_08002F74: - ldr r3, [sp, 0x8] - lsrs r3, 1 - str r3, [sp, 0x2C] - movs r0, 0x3 - ands r3, r0 - str r3, [sp, 0x2C] - ldr r7, [sp, 0x8] - lsrs r0, r7, 3 - lsls r0, 5 - str r0, [sp, 0x30] -_08002F88: - ldr r0, [sp] - ldr r1, [r0] - ldr r3, [sp, 0x2C] - adds r1, r3 - ldr r7, [sp, 0x30] - adds r1, r7 - asrs r0, r2, 3 - ldr r3, [sp, 0x20] - muls r0, r3 - lsls r0, 5 - mov r8, r0 - add r1, r8 - lsls r0, r2, 29 - lsrs r7, r0, 27 - adds r6, r1, r7 - ldr r3, [sp, 0x8] - ldr r4, [sp, 0xC] - adds r2, 0x1 - mov r10, r2 - adds r0, r5, 0x1 - str r0, [sp, 0x38] - ldr r1, [sp, 0x18] - cmp r3, r1 - bge _08003018 - asrs r0, r5, 3 - ldr r2, [sp, 0x24] - muls r0, r2 - lsls r0, 6 - mov r12, r0 - lsls r0, r5, 29 - lsrs r0, 26 - mov r9, r0 -_08002FC8: - movs r0, 0x7 - ands r0, r4 - ldr r5, [sp, 0x4] - ldr r1, [r5] - adds r1, r0 - asrs r0, r4, 3 - lsls r0, 6 - adds r1, r0 - add r1, r12 - mov r0, r9 - adds r5, r1, r0 - movs r0, 0x1 - ands r0, r3 - cmp r0, 0 - beq _08002FEC - ldrb r0, [r6] - lsrs r0, 4 - b _08003008 -_08002FEC: - asrs r2, r3, 1 - movs r0, 0x3 - ands r2, r0 - ldr r0, [sp] - ldr r1, [r0] - adds r1, r2 - asrs r0, r3, 3 - lsls r0, 5 - adds r1, r0 - add r1, r8 - adds r6, r1, r7 - ldrb r1, [r6] - movs r0, 0xF - ands r0, r1 -_08003008: - ldr r1, [sp, 0x14] - adds r0, r1, r0 - strb r0, [r5] - adds r3, 0x1 - adds r4, 0x1 - ldr r2, [sp, 0x18] - cmp r3, r2 - blt _08002FC8 -_08003018: - mov r2, r10 - ldr r5, [sp, 0x38] - ldr r3, [sp, 0x1C] - cmp r2, r3 - blt _08002F88 - b _08003106 -_08003024: - adds r2, r3, 0 - adds r5, r7, 0 - ldr r7, [sp, 0x1C] - cmp r2, r7 - bge _08003106 - ldr r0, [sp, 0x8] - lsrs r0, 1 - str r0, [sp, 0x34] - movs r0, 0x3 - ldr r1, [sp, 0x34] - ands r1, r0 - str r1, [sp, 0x34] -_0800303C: - ldr r3, [sp] - ldr r1, [r3] - ldr r7, [sp, 0x34] - adds r1, r7 - ldr r3, [sp, 0x8] - lsrs r0, r3, 3 - lsls r0, 5 - adds r1, r0 - asrs r0, r2, 3 - ldr r7, [sp, 0x20] - muls r0, r7 - lsls r0, 5 - mov r8, r0 - add r1, r8 - lsls r0, r2, 29 - lsrs r7, r0, 27 - adds r6, r1, r7 - ldr r4, [sp, 0xC] - adds r2, 0x1 - mov r10, r2 - adds r0, r5, 0x1 - str r0, [sp, 0x38] - ldr r1, [sp, 0x18] - cmp r3, r1 - bge _080030FC - asrs r0, r5, 3 - ldr r2, [sp, 0x24] - muls r0, r2 - lsls r0, 6 - mov r9, r0 - lsls r0, r5, 29 - lsrs r0, 26 - mov r12, r0 -_0800307E: - movs r0, 0x1 - ands r0, r3 - cmp r0, 0 - beq _080030B2 - ldrb r2, [r6] - movs r0, 0xF0 - ands r0, r2 - ldr r5, [sp, 0x28] - cmp r0, r5 - beq _080030F2 - adds r0, r4, 0 - movs r1, 0x7 - ands r0, r1 - ldr r5, [sp, 0x4] - ldr r1, [r5] - adds r1, r0 - asrs r0, r4, 3 - lsls r0, 6 - adds r1, r0 - add r1, r9 - mov r0, r12 - adds r5, r1, r0 - lsrs r0, r2, 4 - ldr r1, [sp, 0x14] - adds r0, r1, r0 - b _080030F0 -_080030B2: - asrs r2, r3, 1 - movs r0, 0x3 - ands r2, r0 - ldr r5, [sp] - ldr r1, [r5] - adds r1, r2 - asrs r0, r3, 3 - lsls r0, 5 - adds r1, r0 - add r1, r8 - adds r6, r1, r7 - ldrb r0, [r6] - movs r2, 0xF - ands r2, r0 - ldr r0, [sp, 0x10] - cmp r2, r0 - beq _080030F2 - adds r0, r4, 0 - movs r1, 0x7 - ands r0, r1 - ldr r5, [sp, 0x4] - ldr r1, [r5] - adds r1, r0 - asrs r0, r4, 3 - lsls r0, 6 - adds r1, r0 - add r1, r9 - mov r0, r12 - adds r5, r1, r0 - ldr r1, [sp, 0x14] - adds r0, r1, r2 -_080030F0: - strb r0, [r5] -_080030F2: - adds r3, 0x1 - adds r4, 0x1 - ldr r2, [sp, 0x18] - cmp r3, r2 - blt _0800307E -_080030FC: - mov r2, r10 - ldr r5, [sp, 0x38] - ldr r3, [sp, 0x1C] - cmp r2, r3 - blt _0800303C -_08003106: - add sp, 0x3C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end BlitBitmapRect4BitTo8Bit - - thumb_func_start FillBitmapRect8Bit -@ void FillBitmapRect8Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue) -FillBitmapRect8Bit: @ 8003118 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - mov r8, r0 - ldr r0, [sp, 0x28] - ldr r4, [sp, 0x2C] - lsls r1, 16 - lsrs r1, 16 - mov r10, r1 - lsls r2, 16 - lsrs r2, 16 - adds r6, r2, 0 - lsls r3, 16 - lsrs r3, 16 - lsls r0, 16 - lsrs r0, 16 - lsls r4, 24 - lsrs r4, 24 - mov r9, r4 - adds r5, r1, r3 - mov r3, r8 - ldrh r1, [r3, 0x4] - cmp r5, r1 - ble _08003150 - adds r5, r1, 0 -_08003150: - adds r7, r2, r0 - mov r2, r8 - ldrh r0, [r2, 0x6] - cmp r7, r0 - ble _0800315C - adds r7, r0, 0 -_0800315C: - movs r0, 0x7 - ands r0, r1 - adds r0, r1, r0 - asrs r0, 3 - str r0, [sp] - adds r1, r6, 0 - cmp r1, r7 - bge _080031AC -_0800316C: - mov r3, r10 - adds r6, r1, 0x1 - str r6, [sp, 0x4] - cmp r3, r5 - bge _080031A6 - movs r0, 0x7 - mov r12, r0 - asrs r0, r1, 3 - ldr r2, [sp] - muls r0, r2 - lsls r4, r0, 6 - lsls r0, r1, 29 - lsrs r2, r0, 26 -_08003186: - adds r0, r3, 0 - mov r6, r12 - ands r0, r6 - mov r6, r8 - ldr r1, [r6] - adds r1, r0 - asrs r0, r3, 3 - lsls r0, 6 - adds r1, r0 - adds r1, r4 - adds r1, r2 - mov r0, r9 - strb r0, [r1] - adds r3, 0x1 - cmp r3, r5 - blt _08003186 -_080031A6: - ldr r1, [sp, 0x4] - cmp r1, r7 - blt _0800316C -_080031AC: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end FillBitmapRect8Bit - - .align 2, 0 @ Don't pad with nop. diff --git a/include/blit.h b/include/blit.h new file mode 100644 index 000000000..e7f384cc8 --- /dev/null +++ b/include/blit.h @@ -0,0 +1,10 @@ +#ifndef GUARD_BLIT_H +#define GUARD_BLIT_H + +void BlitBitmapRect4BitWithoutColorKey(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height); +void BlitBitmapRect4Bit(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height, u8 colorKey); +void FillBitmapRect4Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue); +void BlitBitmapRect4BitTo8Bit(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height, u8 colorKey, u8 paletteOffset); +void FillBitmapRect8Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue); + +#endif // GUARD_BLIT_H diff --git a/include/clock.h b/include/clock.h index 4e6560c91..aa179bf6f 100644 --- a/include/clock.h +++ b/include/clock.h @@ -5,4 +5,4 @@ void DoTimeBasedEvents(void); -#endif +#endif // GUARD_CLOCK_H diff --git a/ld_script.txt b/ld_script.txt index 4c7b40dd9..81c4da14b 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -47,7 +47,7 @@ SECTIONS { src/dma3_manager.o(.text); src/gpu_regs.o(.text); src/bg.o(.text); - asm/blit.o(.text); + src/blit.o(.text); src/window.o(.text); src/text.o(.text); src/sprite.o(.text); diff --git a/src/blit.c b/src/blit.c index 16f76918e..b4d5f7de5 100644 --- a/src/blit.c +++ b/src/blit.c @@ -1,7 +1,5 @@ #include "global.h" - -// this file's functions -void BlitBitmapRect4Bit(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height, u8 colorKey); +#include "blit.h" void BlitBitmapRect4BitWithoutColorKey(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height) { diff --git a/src/text.c b/src/text.c index a2495d068..eacfd2a1f 100644 --- a/src/text.c +++ b/src/text.c @@ -4,18 +4,15 @@ #include "m4a.h" #include "palette.h" #include "sound.h" +#include "constants/songs.h" #include "string_util.h" #include "window.h" #include "text.h" +#include "blit.h" -extern void FillBitmapRect4Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue); -extern void FillWindowPixelRect(u8 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 height); -extern void BlitBitmapRectToWindow(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight); extern u8 GetKeypadIconWidth(u8 keypadIconId); -extern void CopyWindowToVram(u8 windowId, u8 mode); extern u16 Font6Func(struct TextPrinter *textPrinter); extern u32 GetGlyphWidthFont6(u16 glyphId, bool32 isJapanese); -extern void PlaySE(u16 songNum); extern u8* UnkTextUtil_GetPtrI(u8 a1); extern int sub_8197964(); @@ -27,7 +24,6 @@ static u16 gLastTextBgColor; static u16 gLastTextFgColor; static u16 gLastTextShadowColor; -extern struct Main gMain; extern struct MusicPlayerInfo gMPlayInfo_BGM; const struct FontInfo *gFonts; @@ -1986,7 +1982,7 @@ bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter) if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { result = TRUE; - PlaySE(5); + PlaySE(SE_SELECT); } } return result; @@ -2004,7 +2000,7 @@ bool16 TextPrinterWait(struct TextPrinter *textPrinter) if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { result = TRUE; - PlaySE(5); + PlaySE(SE_SELECT); } } return result; diff --git a/src/window.c b/src/window.c index 589557d43..9a52a5a20 100644 --- a/src/window.c +++ b/src/window.c @@ -1,6 +1,8 @@ #include "global.h" #include "window.h" #include "malloc.h" +#include "bg.h" +#include "blit.h" u32 filler_03002F58; u32 filler_03002F5C; @@ -15,19 +17,6 @@ EWRAM_DATA struct Window gWindows[WINDOWS_MAX] = {0}; EWRAM_DATA static struct Window* sWindowPtr = NULL; EWRAM_DATA static u16 sWindowSize = 0; -extern void* GetBgTilemapBuffer(u8 bg); -extern int DummiedOutFireRedLeafGreenTileAllocFunc(int, int, int, int); -extern u16 GetBgAttribute(u8 bg, u8 attributeId); -extern void SetBgTilemapBuffer(u8 bg, void *tilemap); -extern void CopyBgTilemapBufferToVram(u8 bg); -extern u8 LoadBgTiles(u8 bg, void *src, u16 size, u16 destOffset); -extern void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 width, u8 height, u8 paletteSlot, u16 tileNumDelta); -extern void FillBgTilemapBufferRect(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height, u8 palette); -extern void BlitBitmapRect4Bit(struct Bitmap *src, struct Bitmap *dest, u16 srcX, u16 srcY, u16 destX, u16 destY, u16 width, u16 height, u8 colorKey); -extern void BlitBitmapRect4BitTo8Bit(struct Bitmap *src, struct Bitmap *dest, u16 srcX, u16 srcY, u16 destX, u16 destY, u16 width, u16 height, u8 colorKey, u8 paletteNum); -extern void FillBitmapRect4Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue); -extern void FillBitmapRect8Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue); - static u8 GetNumActiveWindowsOnBg(u8 bgId); static u8 GetNumActiveWindowsOnBg8Bit(u8 bgId); @@ -130,13 +119,13 @@ u16 AddWindow(const struct WindowTemplate *template) u8 *allocatedTilemapBuffer; int i; - for (win = 0; win < 0x20; ++win) + for (win = 0; win < WINDOWS_MAX; ++win) { if ((bgLayer = gWindows[win].window.priority) == 0xFF) break; } - if (win == 0x20) + if (win == WINDOWS_MAX) return 0xFF; bgLayer = template->priority; @@ -199,13 +188,13 @@ int AddWindowWithoutTileMap(const struct WindowTemplate *template) u8 bgLayer; int allocatedBaseBlock; - for (win = 0; win < 0x20; ++win) + for (win = 0; win < WINDOWS_MAX; ++win) { if (gWindows[win].window.priority == 0xFF) break; } - if (win == 0x20) + if (win == WINDOWS_MAX) return 0xFF; bgLayer = template->priority;