mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 11:14:15 +01:00
sub_81BF5A4
This commit is contained in:
parent
8604291b0f
commit
c5dddf41f5
@ -5,211 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_81BF5A4
|
||||
sub_81BF5A4: @ 81BF5A4
|
||||
push {r4-r6,lr}
|
||||
mov r6, r8
|
||||
push {r6}
|
||||
sub sp, 0x10
|
||||
movs r0, 0x8
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0xA
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x10
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x12
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x14
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x16
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x50
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r1, 0
|
||||
str r1, [sp, 0xC]
|
||||
ldr r4, =0x040000d4
|
||||
add r0, sp, 0xC
|
||||
str r0, [r4]
|
||||
movs r0, 0xC0
|
||||
lsls r0, 19
|
||||
str r0, [r4, 0x4]
|
||||
ldr r0, =0x85006000
|
||||
str r0, [r4, 0x8]
|
||||
ldr r0, [r4, 0x8]
|
||||
str r1, [sp, 0xC]
|
||||
add r0, sp, 0xC
|
||||
str r0, [r4]
|
||||
movs r0, 0xE0
|
||||
lsls r0, 19
|
||||
str r0, [r4, 0x4]
|
||||
ldr r2, =0x85000100
|
||||
str r2, [r4, 0x8]
|
||||
ldr r0, [r4, 0x8]
|
||||
str r1, [sp, 0xC]
|
||||
add r0, sp, 0xC
|
||||
str r0, [r4]
|
||||
movs r0, 0xA0
|
||||
lsls r0, 19
|
||||
str r0, [r4, 0x4]
|
||||
str r2, [r4, 0x8]
|
||||
ldr r0, [r4, 0x8]
|
||||
movs r0, 0
|
||||
bl ResetBgsAndClearDma3BusyFlags
|
||||
ldr r1, =gUnknown_08618108
|
||||
movs r0, 0
|
||||
movs r2, 0x2
|
||||
bl InitBgsFromTemplates
|
||||
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
|
||||
ldr r0, =gUnknown_08618110
|
||||
bl InitWindows
|
||||
bl DeactivateAllTextPrinters
|
||||
ldr r0, =gUnknown_08618138
|
||||
str r0, [r4]
|
||||
ldr r0, =0x050001e0
|
||||
str r0, [r4, 0x4]
|
||||
ldr r0, =0x84000008
|
||||
str r0, [r4, 0x8]
|
||||
ldr r0, [r4, 0x8]
|
||||
movs r0, 0
|
||||
movs r1, 0x40
|
||||
bl SetGpuReg
|
||||
movs r0, 0x2
|
||||
movs r1, 0
|
||||
bl FillWindowPixelBuffer
|
||||
movs r0, 0x3
|
||||
movs r1, 0
|
||||
bl FillWindowPixelBuffer
|
||||
movs r0, 0
|
||||
movs r1, 0xAA
|
||||
bl FillWindowPixelBuffer
|
||||
ldr r5, =gUnknown_08617E9B
|
||||
movs r0, 0
|
||||
adds r1, r5, 0
|
||||
movs r2, 0
|
||||
bl GetStringWidth
|
||||
adds r1, r0, 0
|
||||
movs r4, 0x78
|
||||
subs r0, r4, r1
|
||||
lsrs r1, r0, 31
|
||||
adds r0, r1
|
||||
asrs r0, 1
|
||||
lsls r2, r0, 24
|
||||
lsrs r2, 24
|
||||
ldr r6, =gUnknown_0861815B
|
||||
str r6, [sp]
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
mov r8, r0
|
||||
str r0, [sp, 0x4]
|
||||
str r5, [sp, 0x8]
|
||||
movs r0, 0x2
|
||||
movs r1, 0
|
||||
movs r3, 0x3
|
||||
bl box_print
|
||||
ldr r5, =gUnknown_08617E8D
|
||||
movs r0, 0
|
||||
adds r1, r5, 0
|
||||
movs r2, 0
|
||||
bl GetStringWidth
|
||||
adds r1, r0, 0
|
||||
subs r4, r1
|
||||
lsrs r0, r4, 31
|
||||
adds r4, r0
|
||||
asrs r4, 1
|
||||
adds r0, r4, 0
|
||||
adds r0, 0x78
|
||||
lsls r2, r0, 24
|
||||
lsrs r2, 24
|
||||
str r6, [sp]
|
||||
mov r0, r8
|
||||
str r0, [sp, 0x4]
|
||||
str r5, [sp, 0x8]
|
||||
movs r0, 0x2
|
||||
movs r1, 0
|
||||
movs r3, 0x3
|
||||
bl box_print
|
||||
movs r0, 0
|
||||
adds r1, r5, 0
|
||||
movs r2, 0
|
||||
bl GetStringWidth
|
||||
adds r1, r0, 0
|
||||
movs r0, 0x70
|
||||
subs r0, r1
|
||||
lsrs r1, r0, 31
|
||||
adds r0, r1
|
||||
asrs r0, 1
|
||||
lsls r2, r0, 24
|
||||
lsrs r2, 24
|
||||
str r6, [sp]
|
||||
mov r0, r8
|
||||
str r0, [sp, 0x4]
|
||||
str r5, [sp, 0x8]
|
||||
movs r0, 0x3
|
||||
movs r1, 0
|
||||
movs r3, 0
|
||||
bl box_print
|
||||
ldr r4, =gUnknown_08617E78
|
||||
movs r0, 0x1
|
||||
adds r1, r4, 0
|
||||
movs r2, 0
|
||||
bl GetStringWidth
|
||||
adds r1, r0, 0
|
||||
movs r0, 0xD0
|
||||
subs r0, r1
|
||||
lsrs r1, r0, 31
|
||||
adds r0, r1
|
||||
asrs r0, 1
|
||||
lsls r2, r0, 24
|
||||
lsrs r2, 24
|
||||
ldr r0, =gUnknown_08618158
|
||||
str r0, [sp]
|
||||
mov r0, r8
|
||||
str r0, [sp, 0x4]
|
||||
str r4, [sp, 0x8]
|
||||
movs r0, 0
|
||||
movs r1, 0x1
|
||||
movs r3, 0x2
|
||||
bl box_print
|
||||
movs r0, 0x2
|
||||
movs r1, 0x2
|
||||
bl CopyWindowToVram
|
||||
movs r0, 0x3
|
||||
movs r1, 0x2
|
||||
bl CopyWindowToVram
|
||||
movs r0, 0
|
||||
movs r1, 0x2
|
||||
bl CopyWindowToVram
|
||||
add sp, 0x10
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81BF5A4
|
||||
|
||||
thumb_func_start sub_81BF7A4
|
||||
sub_81BF7A4: @ 81BF7A4
|
||||
push {r4,r5,lr}
|
||||
|
19
include/bg.h
Normal file
19
include/bg.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef GUARD_bg_H
|
||||
#define GUARD_bg_H
|
||||
|
||||
struct BgTemplate {
|
||||
u32 bg:2;
|
||||
u32 charBaseIndex:2;
|
||||
u32 mapBaseIndex:5;
|
||||
u32 screenSize:2;
|
||||
u32 paletteMode:1;
|
||||
u32 priority:2;
|
||||
u32 baseTile:10;
|
||||
};
|
||||
|
||||
void ResetBgsAndClearDma3BusyFlags(u32);
|
||||
void InitBgsFromTemplates(u8, const struct BgTemplate *, u8);
|
||||
u32 ChangeBgX(u8, u32, u8);
|
||||
u32 ChangeBgY(u8, u32, u8);
|
||||
|
||||
#endif //GUARD_bg_H
|
@ -18,8 +18,8 @@ struct MultiBootParam
|
||||
u8 response_bit; // 1d
|
||||
u8 client_bit; // 1e
|
||||
u8 reserved1; // 1f
|
||||
u8 *boot_srcp; // 20
|
||||
u8 *boot_endp; // 24
|
||||
const u8 *boot_srcp; // 20
|
||||
const u8 *boot_endp; // 24
|
||||
const u8 *masterp;
|
||||
u8 *reserved2[MULTIBOOT_NCHILD];
|
||||
u32 system_work2[4];
|
||||
|
@ -15,4 +15,6 @@ struct MenuAction2
|
||||
void (*func)(u8);
|
||||
};
|
||||
|
||||
void box_print(u8, u8, u8, u8, const void *, s8, const u8 *);
|
||||
|
||||
#endif // GUARD_MENU_H
|
||||
|
@ -186,9 +186,9 @@ bool8 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter);
|
||||
bool8 TextPrinterWait(struct TextPrinter *textPrinter);
|
||||
void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *counter, u8 *yCoordIndex);
|
||||
u16 RenderText(struct TextPrinter *textPrinter);
|
||||
u32 GetStringWidthFixedWidthFont(u8 *str, u8 fontId, u8 letterSpacing);
|
||||
u32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing);
|
||||
u32 (*GetFontWidthFunc(u8 glyphId))(u16, bool32);
|
||||
s32 GetStringWidth(u8 fontId, u8 *str, s16 letterSpacing);
|
||||
u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing);
|
||||
u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str);
|
||||
u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y);
|
||||
u8 GetKeypadIconTileOffset(u8 keypadIconId);
|
||||
|
@ -30,7 +30,7 @@ struct Window
|
||||
u8 *tileData;
|
||||
};
|
||||
|
||||
bool16 InitWindows(struct WindowTemplate *templates);
|
||||
bool16 InitWindows(const struct WindowTemplate *templates);
|
||||
u16 AddWindow(const struct WindowTemplate *template);
|
||||
int AddWindowWithoutTileMap(struct WindowTemplate *template);
|
||||
void RemoveWindow(u8 windowId);
|
||||
|
@ -1,13 +1,16 @@
|
||||
|
||||
// Includes
|
||||
#include "global.h"
|
||||
#include "multiboot.h"
|
||||
#include "gpu_regs.h"
|
||||
#include "multiboot.h"
|
||||
#include "malloc.h"
|
||||
#include "bg.h"
|
||||
#include "main.h"
|
||||
#include "sprite.h"
|
||||
#include "task.h"
|
||||
#include "unknown_task.h"
|
||||
#include "malloc.h"
|
||||
#include "window.h"
|
||||
#include "menu.h"
|
||||
#include "m4a.h"
|
||||
|
||||
// Static type declarations
|
||||
@ -26,7 +29,7 @@ extern berryfix_t *gUnknown_030012B8;
|
||||
// Static ROM declarations
|
||||
|
||||
static void sub_81BF3DC(void);
|
||||
void sub_81BF5A4(void);
|
||||
static void sub_81BF5A4(void);
|
||||
u32 sub_81BF7A4(u8);
|
||||
|
||||
// .rodata
|
||||
@ -35,6 +38,14 @@ extern const u8 gUnknown_089A6550[0xC0];
|
||||
extern const u8 gMultiBootProgram_BerryGlitchFix_Script[0x3b34];
|
||||
extern const u8 gMultiBootProgram_BerryGlitchFix_Start[];
|
||||
extern const u8 gMultiBootProgram_BerryGlitchFix_End[];
|
||||
extern const u8 gUnknown_08617E78[];
|
||||
extern const u8 gUnknown_08617E8D[];
|
||||
extern const u8 gUnknown_08617E9B[];
|
||||
extern const struct BgTemplate gUnknown_08618108[2];
|
||||
extern const struct WindowTemplate gUnknown_08618110[7];
|
||||
extern const u16 gUnknown_08618138[16];
|
||||
extern const u8 gUnknown_08618158[3];
|
||||
extern const u8 gUnknown_0861815B[3];
|
||||
|
||||
// .text
|
||||
|
||||
@ -121,3 +132,258 @@ static void sub_81BF3DC(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
static void sub_81BF5A4(void)
|
||||
{
|
||||
s32 width;
|
||||
|
||||
SetGpuReg(REG_OFFSET_BG0CNT, 0x0000);
|
||||
SetGpuReg(REG_OFFSET_BG1CNT, 0x0000);
|
||||
SetGpuReg(REG_OFFSET_BG0HOFS, 0x0000);
|
||||
SetGpuReg(REG_OFFSET_BG0VOFS, 0x0000);
|
||||
SetGpuReg(REG_OFFSET_BG1HOFS, 0x0000);
|
||||
SetGpuReg(REG_OFFSET_BG1VOFS, 0x0000);
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, 0x0000);
|
||||
|
||||
DmaFill32(3, 0, VRAM, VRAM_SIZE);
|
||||
DmaFill32(3, 0, OAM, OAM_SIZE);
|
||||
DmaFill32(3, 0, PLTT, PLTT_SIZE);
|
||||
ResetBgsAndClearDma3BusyFlags(0);
|
||||
|
||||
InitBgsFromTemplates(0, gUnknown_08618108, ARRAY_COUNT(gUnknown_08618108));
|
||||
ChangeBgX(0, 0, 0);
|
||||
ChangeBgY(0, 0, 0);
|
||||
ChangeBgX(1, 0, 0);
|
||||
ChangeBgY(1, 0, 0);
|
||||
InitWindows(gUnknown_08618110);
|
||||
DeactivateAllTextPrinters();
|
||||
|
||||
DmaCopy32(3, gUnknown_08618138, BG_PLTT + 0x1E0, 0x20);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP);
|
||||
FillWindowPixelBuffer(2, 0);
|
||||
FillWindowPixelBuffer(3, 0);
|
||||
FillWindowPixelBuffer(0, 0xAA);
|
||||
|
||||
// This block is a meme among memes
|
||||
width = (0x78 - GetStringWidth(0, gUnknown_08617E9B, 0)) / 2;
|
||||
box_print(2, 0, width, 3, gUnknown_0861815B, -1, gUnknown_08617E9B);
|
||||
width = (s32)(0x78 - GetStringWidth(0, gUnknown_08617E9B, 0)) / 2 + 0x78;
|
||||
box_print(2, 0, width, 3, gUnknown_0861815B, -1, gUnknown_08617E8D);
|
||||
width = (0x70 - GetStringWidth(0, gUnknown_08617E8D, 0)) / 2;
|
||||
box_print(3, 0, width, 0, gUnknown_0861815B, -1, gUnknown_08617E8D);
|
||||
width = (0xd0 - GetStringWidth(1, gUnknown_08617E78, 0)) / 2;
|
||||
box_print(0, 1, width, 2, gUnknown_08618158, -1, gUnknown_08617E78);
|
||||
|
||||
CopyWindowToVram(2, 2);
|
||||
CopyWindowToVram(3, 2);
|
||||
CopyWindowToVram(0, 2);
|
||||
}
|
||||
#else
|
||||
__attribute__((naked)) static void sub_81BF5A4(void)
|
||||
{
|
||||
asm(".syntax unified\n"
|
||||
"\tpush {r4-r6,lr}\n"
|
||||
"\tmov r6, r8\n"
|
||||
"\tpush {r6}\n"
|
||||
"\tsub sp, 0x10\n"
|
||||
"\tmovs r0, 0x8\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tbl SetGpuReg\n"
|
||||
"\tmovs r0, 0xA\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tbl SetGpuReg\n"
|
||||
"\tmovs r0, 0x10\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tbl SetGpuReg\n"
|
||||
"\tmovs r0, 0x12\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tbl SetGpuReg\n"
|
||||
"\tmovs r0, 0x14\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tbl SetGpuReg\n"
|
||||
"\tmovs r0, 0x16\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tbl SetGpuReg\n"
|
||||
"\tmovs r0, 0x50\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tbl SetGpuReg\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tstr r1, [sp, 0xC]\n"
|
||||
"\tldr r4, =0x040000d4\n"
|
||||
"\tadd r0, sp, 0xC\n"
|
||||
"\tstr r0, [r4]\n"
|
||||
"\tmovs r0, 0xC0\n"
|
||||
"\tlsls r0, 19\n"
|
||||
"\tstr r0, [r4, 0x4]\n"
|
||||
"\tldr r0, =0x85006000\n"
|
||||
"\tstr r0, [r4, 0x8]\n"
|
||||
"\tldr r0, [r4, 0x8]\n"
|
||||
"\tstr r1, [sp, 0xC]\n"
|
||||
"\tadd r0, sp, 0xC\n"
|
||||
"\tstr r0, [r4]\n"
|
||||
"\tmovs r0, 0xE0\n"
|
||||
"\tlsls r0, 19\n"
|
||||
"\tstr r0, [r4, 0x4]\n"
|
||||
"\tldr r2, =0x85000100\n"
|
||||
"\tstr r2, [r4, 0x8]\n"
|
||||
"\tldr r0, [r4, 0x8]\n"
|
||||
"\tstr r1, [sp, 0xC]\n"
|
||||
"\tadd r0, sp, 0xC\n"
|
||||
"\tstr r0, [r4]\n"
|
||||
"\tmovs r0, 0xA0\n"
|
||||
"\tlsls r0, 19\n"
|
||||
"\tstr r0, [r4, 0x4]\n"
|
||||
"\tstr r2, [r4, 0x8]\n"
|
||||
"\tldr r0, [r4, 0x8]\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tbl ResetBgsAndClearDma3BusyFlags\n"
|
||||
"\tldr r1, =gUnknown_08618108\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tmovs r2, 0x2\n"
|
||||
"\tbl InitBgsFromTemplates\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tbl ChangeBgX\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tbl ChangeBgY\n"
|
||||
"\tmovs r0, 0x1\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tbl ChangeBgX\n"
|
||||
"\tmovs r0, 0x1\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tbl ChangeBgY\n"
|
||||
"\tldr r0, =gUnknown_08618110\n"
|
||||
"\tbl InitWindows\n"
|
||||
"\tbl DeactivateAllTextPrinters\n"
|
||||
"\tldr r0, =gUnknown_08618138\n"
|
||||
"\tstr r0, [r4]\n"
|
||||
"\tldr r0, =0x050001e0\n"
|
||||
"\tstr r0, [r4, 0x4]\n"
|
||||
"\tldr r0, =0x84000008\n"
|
||||
"\tstr r0, [r4, 0x8]\n"
|
||||
"\tldr r0, [r4, 0x8]\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tmovs r1, 0x40\n"
|
||||
"\tbl SetGpuReg\n"
|
||||
"\tmovs r0, 0x2\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tbl FillWindowPixelBuffer\n"
|
||||
"\tmovs r0, 0x3\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tbl FillWindowPixelBuffer\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tmovs r1, 0xAA\n"
|
||||
"\tbl FillWindowPixelBuffer\n"
|
||||
"\tldr r5, =gUnknown_08617E9B\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tadds r1, r5, 0\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tbl GetStringWidth\n"
|
||||
"\tadds r1, r0, 0\n"
|
||||
"\tmovs r4, 0x78\n"
|
||||
"\tsubs r0, r4, r1\n"
|
||||
"\tlsrs r1, r0, 31\n"
|
||||
"\tadds r0, r1\n"
|
||||
"\tasrs r0, 1\n"
|
||||
"\tlsls r2, r0, 24\n"
|
||||
"\tlsrs r2, 24\n"
|
||||
"\tldr r6, =gUnknown_0861815B\n"
|
||||
"\tstr r6, [sp]\n"
|
||||
"\tmovs r0, 0x1\n"
|
||||
"\tnegs r0, r0\n"
|
||||
"\tmov r8, r0\n"
|
||||
"\tstr r0, [sp, 0x4]\n"
|
||||
"\tstr r5, [sp, 0x8]\n"
|
||||
"\tmovs r0, 0x2\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tmovs r3, 0x3\n"
|
||||
"\tbl box_print\n"
|
||||
"\tldr r5, =gUnknown_08617E8D\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tadds r1, r5, 0\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tbl GetStringWidth\n"
|
||||
"\tadds r1, r0, 0\n"
|
||||
"\tsubs r4, r1\n"
|
||||
"\tlsrs r0, r4, 31\n"
|
||||
"\tadds r4, r0\n"
|
||||
"\tasrs r4, 1\n"
|
||||
"\tadds r0, r4, 0\n"
|
||||
"\tadds r0, 0x78\n"
|
||||
"\tlsls r2, r0, 24\n"
|
||||
"\tlsrs r2, 24\n"
|
||||
"\tstr r6, [sp]\n"
|
||||
"\tmov r0, r8\n"
|
||||
"\tstr r0, [sp, 0x4]\n"
|
||||
"\tstr r5, [sp, 0x8]\n"
|
||||
"\tmovs r0, 0x2\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tmovs r3, 0x3\n"
|
||||
"\tbl box_print\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tadds r1, r5, 0\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tbl GetStringWidth\n"
|
||||
"\tadds r1, r0, 0\n"
|
||||
"\tmovs r0, 0x70\n"
|
||||
"\tsubs r0, r1\n"
|
||||
"\tlsrs r1, r0, 31\n"
|
||||
"\tadds r0, r1\n"
|
||||
"\tasrs r0, 1\n"
|
||||
"\tlsls r2, r0, 24\n"
|
||||
"\tlsrs r2, 24\n"
|
||||
"\tstr r6, [sp]\n"
|
||||
"\tmov r0, r8\n"
|
||||
"\tstr r0, [sp, 0x4]\n"
|
||||
"\tstr r5, [sp, 0x8]\n"
|
||||
"\tmovs r0, 0x3\n"
|
||||
"\tmovs r1, 0\n"
|
||||
"\tmovs r3, 0\n"
|
||||
"\tbl box_print\n"
|
||||
"\tldr r4, =gUnknown_08617E78\n"
|
||||
"\tmovs r0, 0x1\n"
|
||||
"\tadds r1, r4, 0\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tbl GetStringWidth\n"
|
||||
"\tadds r1, r0, 0\n"
|
||||
"\tmovs r0, 0xD0\n"
|
||||
"\tsubs r0, r1\n"
|
||||
"\tlsrs r1, r0, 31\n"
|
||||
"\tadds r0, r1\n"
|
||||
"\tasrs r0, 1\n"
|
||||
"\tlsls r2, r0, 24\n"
|
||||
"\tlsrs r2, 24\n"
|
||||
"\tldr r0, =gUnknown_08618158\n"
|
||||
"\tstr r0, [sp]\n"
|
||||
"\tmov r0, r8\n"
|
||||
"\tstr r0, [sp, 0x4]\n"
|
||||
"\tstr r4, [sp, 0x8]\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tmovs r1, 0x1\n"
|
||||
"\tmovs r3, 0x2\n"
|
||||
"\tbl box_print\n"
|
||||
"\tmovs r0, 0x2\n"
|
||||
"\tmovs r1, 0x2\n"
|
||||
"\tbl CopyWindowToVram\n"
|
||||
"\tmovs r0, 0x3\n"
|
||||
"\tmovs r1, 0x2\n"
|
||||
"\tbl CopyWindowToVram\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tmovs r1, 0x2\n"
|
||||
"\tbl CopyWindowToVram\n"
|
||||
"\tadd sp, 0x10\n"
|
||||
"\tpop {r3}\n"
|
||||
"\tmov r8, r3\n"
|
||||
"\tpop {r4-r6}\n"
|
||||
"\tpop {r0}\n"
|
||||
"\tbx r0\n"
|
||||
"\t.pool\n"
|
||||
".syntax divided");
|
||||
}
|
||||
#endif
|
||||
|
189
src/bg.c
189
src/bg.c
@ -1,5 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "dma3.h"
|
||||
#include "bg.h"
|
||||
|
||||
#define DISPCNT_ALL_BG_AND_MODE_BITS 0x0F07
|
||||
|
||||
@ -22,33 +23,23 @@ struct BgControl {
|
||||
u16 priority:2;
|
||||
u16 mosaic:1;
|
||||
u16 wraparound:1;
|
||||
|
||||
|
||||
u16 charBaseIndex:2;
|
||||
u16 mapBaseIndex:5;
|
||||
u16 paletteMode:1;
|
||||
|
||||
|
||||
u8 unknown_2;
|
||||
u8 unknown_3;
|
||||
} configs[4];
|
||||
|
||||
u16 bgVisibilityAndMode;
|
||||
};
|
||||
|
||||
struct BgTemplate {
|
||||
u32 bg:2;
|
||||
u32 charBaseIndex:2;
|
||||
u32 mapBaseIndex:5;
|
||||
u32 screenSize:2;
|
||||
u32 paletteMode:1;
|
||||
u32 priority:2;
|
||||
u32 baseTile:10;
|
||||
u16 bgVisibilityAndMode;
|
||||
};
|
||||
|
||||
struct BgConfig2 {
|
||||
u32 baseTile:10;
|
||||
u32 basePalette:4;
|
||||
u32 unk_3:18;
|
||||
|
||||
|
||||
void* tilemap;
|
||||
u32 bg_x;
|
||||
u32 bg_y;
|
||||
@ -103,7 +94,7 @@ void ResetBgControlStructs(void)
|
||||
struct BgConfig* bgConfigs = &gGpuBgConfigs.configs[0];
|
||||
struct BgConfig zeroedConfig = gZeroedBgControlStruct;
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
bgConfigs[i] = zeroedConfig;
|
||||
@ -126,40 +117,40 @@ void SetBgControlAttributes(u8 bg, u8 charBaseIndex, u8 mapBaseIndex, u8 screenS
|
||||
{
|
||||
gGpuBgConfigs.configs[bg].charBaseIndex = charBaseIndex & 0x3;
|
||||
}
|
||||
|
||||
|
||||
if (mapBaseIndex != 0xFF)
|
||||
{
|
||||
gGpuBgConfigs.configs[bg].mapBaseIndex = mapBaseIndex & 0x1F;
|
||||
}
|
||||
|
||||
|
||||
if (screenSize != 0xFF)
|
||||
{
|
||||
gGpuBgConfigs.configs[bg].screenSize = screenSize & 0x3;
|
||||
}
|
||||
|
||||
|
||||
if (paletteMode != 0xFF)
|
||||
{
|
||||
gGpuBgConfigs.configs[bg].paletteMode = paletteMode;
|
||||
}
|
||||
|
||||
|
||||
if (priority != 0xFF)
|
||||
{
|
||||
gGpuBgConfigs.configs[bg].priority = priority & 0x3;
|
||||
}
|
||||
|
||||
|
||||
if (mosaic != 0xFF)
|
||||
{
|
||||
gGpuBgConfigs.configs[bg].mosaic = mosaic & 0x1;
|
||||
}
|
||||
|
||||
|
||||
if (wraparound != 0xFF)
|
||||
{
|
||||
gGpuBgConfigs.configs[bg].wraparound = wraparound;
|
||||
}
|
||||
|
||||
|
||||
gGpuBgConfigs.configs[bg].unknown_2 = 0;
|
||||
gGpuBgConfigs.configs[bg].unknown_3 = 0;
|
||||
|
||||
|
||||
gGpuBgConfigs.configs[bg].visible = 1;
|
||||
}
|
||||
}
|
||||
@ -188,7 +179,7 @@ u16 GetBgControlAttribute(u8 bg, u8 attributeId)
|
||||
return gGpuBgConfigs.configs[bg].wraparound;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
@ -196,7 +187,7 @@ u8 LoadBgVram(u8 bg, void *src, u16 size, u16 destOffset, u8 mode)
|
||||
{
|
||||
u16 offset;
|
||||
s8 cursor;
|
||||
|
||||
|
||||
if (IsInvalidBg(bg) == FALSE && gGpuBgConfigs.configs[bg].visible != FALSE)
|
||||
{
|
||||
switch (mode)
|
||||
@ -211,11 +202,11 @@ u8 LoadBgVram(u8 bg, void *src, u16 size, u16 destOffset, u8 mode)
|
||||
cursor = -1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
offset = destOffset + offset;
|
||||
|
||||
|
||||
cursor = RequestDma3Copy(src, (void*)(offset + BG_VRAM), size, 0);
|
||||
|
||||
|
||||
if (cursor == -1)
|
||||
{
|
||||
return -1;
|
||||
@ -225,7 +216,7 @@ u8 LoadBgVram(u8 bg, void *src, u16 size, u16 destOffset, u8 mode)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
end:
|
||||
return cursor;
|
||||
}
|
||||
@ -242,9 +233,9 @@ void ShowBgInternal(u8 bg)
|
||||
(gGpuBgConfigs.configs[bg].mapBaseIndex << 8) |
|
||||
(gGpuBgConfigs.configs[bg].wraparound << 13) |
|
||||
(gGpuBgConfigs.configs[bg].screenSize << 14);
|
||||
|
||||
|
||||
SetGpuReg((bg << 1) + 0x8, value);
|
||||
|
||||
|
||||
gGpuBgConfigs.bgVisibilityAndMode |= 1 << (bg + 8);
|
||||
gGpuBgConfigs.bgVisibilityAndMode &= DISPCNT_ALL_BG_AND_MODE_BITS;
|
||||
}
|
||||
@ -273,7 +264,7 @@ void SetBgAffineInternal(u8 bg, u32 srcCenterX, u32 srcCenterY, s16 dispCenterX,
|
||||
{
|
||||
struct BgAffineSrcData src;
|
||||
struct BgAffineDstData dest;
|
||||
|
||||
|
||||
switch (gGpuBgConfigs.bgVisibilityAndMode & 0x7)
|
||||
{
|
||||
case 1:
|
||||
@ -288,7 +279,7 @@ void SetBgAffineInternal(u8 bg, u32 srcCenterX, u32 srcCenterY, s16 dispCenterX,
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
src.texX = srcCenterX;
|
||||
src.texY = srcCenterY;
|
||||
src.scrX = dispCenterX;
|
||||
@ -296,7 +287,7 @@ void SetBgAffineInternal(u8 bg, u32 srcCenterX, u32 srcCenterY, s16 dispCenterX,
|
||||
src.sx = scaleX;
|
||||
src.sy = scaleY;
|
||||
src.alpha = rotationAngle;
|
||||
|
||||
|
||||
BgAffineSet(&src, &dest, 1);
|
||||
|
||||
SetGpuReg(REG_OFFSET_BG2PA, dest.pa);
|
||||
@ -326,20 +317,20 @@ void ResetBgsAndClearDma3BusyFlags(u32 leftoverFireRedLeafGreenVariable)
|
||||
{
|
||||
int i;
|
||||
ResetBgs();
|
||||
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
gDmaBusyBitfield[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
gUnneededFireRedVariable = leftoverFireRedLeafGreenVariable;
|
||||
}
|
||||
|
||||
void InitBgsFromTemplates(u8 bgMode, struct BgTemplate *templates, u8 numTemplates)
|
||||
void InitBgsFromTemplates(u8 bgMode, const struct BgTemplate *templates, u8 numTemplates)
|
||||
{
|
||||
int i;
|
||||
u8 bg;
|
||||
|
||||
|
||||
SetBgModeInternal(bgMode);
|
||||
ResetBgControlStructs();
|
||||
|
||||
@ -355,11 +346,11 @@ void InitBgsFromTemplates(u8 bgMode, struct BgTemplate *templates, u8 numTemplat
|
||||
templates[i].priority,
|
||||
0,
|
||||
0);
|
||||
|
||||
|
||||
gGpuBgConfigs2[bg].baseTile = templates[i].baseTile;
|
||||
gGpuBgConfigs2[bg].basePalette = 0;
|
||||
gGpuBgConfigs2[bg].unk_3 = 0;
|
||||
|
||||
|
||||
gGpuBgConfigs2[bg].tilemap = NULL;
|
||||
gGpuBgConfigs2[bg].bg_x = 0;
|
||||
gGpuBgConfigs2[bg].bg_y = 0;
|
||||
@ -367,10 +358,10 @@ void InitBgsFromTemplates(u8 bgMode, struct BgTemplate *templates, u8 numTemplat
|
||||
}
|
||||
}
|
||||
|
||||
void InitBgFromTemplate(struct BgTemplate *template)
|
||||
void InitBgFromTemplate(const struct BgTemplate *template)
|
||||
{
|
||||
u8 bg = template->bg;
|
||||
|
||||
|
||||
if (bg < 4)
|
||||
{
|
||||
SetBgControlAttributes(bg,
|
||||
@ -381,11 +372,11 @@ void InitBgFromTemplate(struct BgTemplate *template)
|
||||
template->priority,
|
||||
0,
|
||||
0);
|
||||
|
||||
|
||||
gGpuBgConfigs2[bg].baseTile = template->baseTile;
|
||||
gGpuBgConfigs2[bg].basePalette = 0;
|
||||
gGpuBgConfigs2[bg].unk_3 = 0;
|
||||
|
||||
|
||||
gGpuBgConfigs2[bg].tilemap = NULL;
|
||||
gGpuBgConfigs2[bg].bg_x = 0;
|
||||
gGpuBgConfigs2[bg].bg_y = 0;
|
||||
@ -401,7 +392,7 @@ u16 LoadBgTiles(u8 bg, void* src, u16 size, u16 destOffset)
|
||||
{
|
||||
u16 tileOffset;
|
||||
u8 cursor;
|
||||
|
||||
|
||||
if (GetBgControlAttribute(bg, BG_CTRL_ATTR_PALETTEMODE) == 0)
|
||||
{
|
||||
tileOffset = (gGpuBgConfigs2[bg].baseTile + destOffset) * 0x20;
|
||||
@ -410,37 +401,37 @@ u16 LoadBgTiles(u8 bg, void* src, u16 size, u16 destOffset)
|
||||
{
|
||||
tileOffset = (gGpuBgConfigs2[bg].baseTile + destOffset) * 0x40;
|
||||
}
|
||||
|
||||
|
||||
cursor = LoadBgVram(bg, src, size, tileOffset, DISPCNT_MODE_1);
|
||||
|
||||
|
||||
if (cursor == 0xFF)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
gDmaBusyBitfield[cursor / 0x20] |= (1 << (cursor % 0x20));
|
||||
|
||||
|
||||
if (gUnneededFireRedVariable == 1)
|
||||
{
|
||||
DummiedOutFireRedLeafGreenTileAllocFunc(bg, tileOffset / 0x20, size / 0x20, 1);
|
||||
}
|
||||
|
||||
|
||||
return cursor;
|
||||
}
|
||||
|
||||
u16 LoadBgTilemap(u8 bg, void *src, u16 size, u16 destOffset)
|
||||
{
|
||||
u8 cursor;
|
||||
|
||||
|
||||
cursor = LoadBgVram(bg, src, size, destOffset * 2, DISPCNT_MODE_2);
|
||||
|
||||
|
||||
if (cursor == 0xFF)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
gDmaBusyBitfield[cursor / 0x20] |= (1 << (cursor % 0x20));
|
||||
|
||||
|
||||
return cursor;
|
||||
}
|
||||
|
||||
@ -448,12 +439,12 @@ u16 Unused_LoadBgPalette(u8 bg, void *src, u16 size, u16 destOffset)
|
||||
{
|
||||
u16 paletteOffset;
|
||||
s8 cursor;
|
||||
|
||||
|
||||
if (IsInvalidBg32(bg) == FALSE)
|
||||
{
|
||||
paletteOffset = (gGpuBgConfigs2[bg].basePalette * 0x20) + (destOffset * 2);
|
||||
cursor = RequestDma3Copy(src, (void*)(paletteOffset + BG_PLTT), size, 0);
|
||||
|
||||
|
||||
if (cursor == -1)
|
||||
{
|
||||
return -1;
|
||||
@ -475,14 +466,14 @@ bool8 IsDma3ManagerBusyWithBgCopy(void)
|
||||
u8 mod;
|
||||
u8 div;
|
||||
s8 reqSpace;
|
||||
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < 0x80; i++)
|
||||
{
|
||||
div = i / 0x20;
|
||||
mod = i % 0x20;
|
||||
|
||||
|
||||
if ((gDmaBusyBitfield[div] & (1 << mod)) != FALSE)
|
||||
{
|
||||
reqSpace = CheckForSpaceForDma3Request(i);
|
||||
@ -490,7 +481,7 @@ bool8 IsDma3ManagerBusyWithBgCopy(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
gDmaBusyBitfield[div] &= ~(1 << mod);
|
||||
}
|
||||
}
|
||||
@ -634,12 +625,12 @@ u32 ChangeBgX(u8 bg, u32 value, u8 op)
|
||||
u8 mode;
|
||||
u16 temp1;
|
||||
u16 temp2;
|
||||
|
||||
|
||||
if (IsInvalidBg32(bg) != FALSE || GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case 0:
|
||||
@ -653,9 +644,9 @@ u32 ChangeBgX(u8 bg, u32 value, u8 op)
|
||||
gGpuBgConfigs2[bg].bg_x -= value;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
mode = GetBgMode();
|
||||
|
||||
|
||||
switch (bg)
|
||||
{
|
||||
case 0:
|
||||
@ -695,7 +686,7 @@ u32 ChangeBgX(u8 bg, u32 value, u8 op)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return gGpuBgConfigs2[bg].bg_x;
|
||||
}
|
||||
|
||||
@ -713,12 +704,12 @@ u32 ChangeBgY(u8 bg, u32 value, u8 op)
|
||||
u8 mode;
|
||||
u16 temp1;
|
||||
u16 temp2;
|
||||
|
||||
|
||||
if (IsInvalidBg32(bg) != FALSE || GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case 0:
|
||||
@ -732,9 +723,9 @@ u32 ChangeBgY(u8 bg, u32 value, u8 op)
|
||||
gGpuBgConfigs2[bg].bg_y -= value;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
mode = GetBgMode();
|
||||
|
||||
|
||||
switch (bg)
|
||||
{
|
||||
case 0:
|
||||
@ -774,7 +765,7 @@ u32 ChangeBgY(u8 bg, u32 value, u8 op)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return gGpuBgConfigs2[bg].bg_y;
|
||||
}
|
||||
|
||||
@ -783,12 +774,12 @@ u32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op)
|
||||
u8 mode;
|
||||
u16 temp1;
|
||||
u16 temp2;
|
||||
|
||||
|
||||
if (IsInvalidBg32(bg) != FALSE || GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case 0:
|
||||
@ -802,9 +793,9 @@ u32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op)
|
||||
gGpuBgConfigs2[bg].bg_y -= value;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
mode = GetBgMode();
|
||||
|
||||
|
||||
switch (bg)
|
||||
{
|
||||
case 0:
|
||||
@ -820,7 +811,7 @@ u32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op)
|
||||
{
|
||||
temp1 = gGpuBgConfigs2[2].bg_y >> 0x8;
|
||||
SetGpuReg_ForcedBlank(REG_OFFSET_BG2VOFS, temp1);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -845,7 +836,7 @@ u32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return gGpuBgConfigs2[bg].bg_y;
|
||||
}
|
||||
|
||||
@ -868,13 +859,13 @@ u8 Unused_AdjustBgMosaic(u8 a1, u8 a2)
|
||||
u16 result;
|
||||
s16 test1;
|
||||
s16 test2;
|
||||
|
||||
|
||||
result = GetGpuReg(REG_OFFSET_MOSAIC);
|
||||
|
||||
|
||||
test1 = result & 0xF;
|
||||
test2 = (result >> 4) & 0xF;
|
||||
result &= 0xFF00;
|
||||
|
||||
|
||||
switch (a2)
|
||||
{
|
||||
case 0:
|
||||
@ -929,12 +920,12 @@ u8 Unused_AdjustBgMosaic(u8 a1, u8 a2)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
result |= ((test2 << 0x4) & 0xF0);
|
||||
result |= (test1 & 0xF);
|
||||
|
||||
|
||||
SetGpuReg(REG_OFFSET_MOSAIC, result);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -981,7 +972,7 @@ void CopyToBgTilemapBuffer(u8 bg, void *src, u16 mode, u16 destOffset)
|
||||
void CopyBgTilemapBufferToVram(u8 bg)
|
||||
{
|
||||
u16 sizeToLoad;
|
||||
|
||||
|
||||
if (IsInvalidBg32(bg) == FALSE && IsTileMapOutsideWram(bg) == FALSE)
|
||||
{
|
||||
switch (GetBgType(bg))
|
||||
@ -1006,7 +997,7 @@ void CopyToBgTilemapBufferRect(u8 bg, void* src, u8 destX, u8 destY, u8 width, u
|
||||
u16 destX16;
|
||||
u16 destY16;
|
||||
u16 mode;
|
||||
|
||||
|
||||
if (IsInvalidBg32(bg) == FALSE && IsTileMapOutsideWram(bg) == FALSE)
|
||||
{
|
||||
switch (GetBgType(bg))
|
||||
@ -1047,11 +1038,11 @@ void CopyRectToBgTilemapBufferRect(u8 bg, void* src, u8 srcX, u8 srcY, u8 srcWid
|
||||
u16 attribute;
|
||||
u16 mode;
|
||||
u16 mode2;
|
||||
|
||||
|
||||
void* srcCopy;
|
||||
u16 destX16;
|
||||
u16 destY16;
|
||||
|
||||
|
||||
if (IsInvalidBg32(bg) == FALSE && IsTileMapOutsideWram(bg) == FALSE)
|
||||
{
|
||||
attribute = GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE);
|
||||
@ -1336,7 +1327,7 @@ void FillBgTilemapBufferRect_Palette0(u8 bg, u16 tileNum, u8 x, u8 y, u8 width,
|
||||
u16 x16;
|
||||
u16 y16;
|
||||
u16 mode;
|
||||
|
||||
|
||||
if (IsInvalidBg32(bg) == FALSE && IsTileMapOutsideWram(bg) == FALSE)
|
||||
{
|
||||
switch (GetBgType(bg))
|
||||
@ -1375,10 +1366,10 @@ void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 widt
|
||||
u16 mode2;
|
||||
u16 attribute;
|
||||
u16 mode3;
|
||||
|
||||
|
||||
u16 x16;
|
||||
u16 y16;
|
||||
|
||||
|
||||
if (IsInvalidBg32(bg) == FALSE && IsTileMapOutsideWram(bg) == FALSE)
|
||||
{
|
||||
attribute = GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE);
|
||||
@ -1414,9 +1405,9 @@ void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 widt
|
||||
u16 GetBgMetricTextMode(u8 bg, u8 whichMetric)
|
||||
{
|
||||
u8 attribute;
|
||||
|
||||
|
||||
attribute = GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE);
|
||||
|
||||
|
||||
switch (whichMetric)
|
||||
{
|
||||
case 0:
|
||||
@ -1462,9 +1453,9 @@ u16 GetBgMetricTextMode(u8 bg, u8 whichMetric)
|
||||
u32 GetBgMetricAffineMode(u8 bg, u8 whichMetric)
|
||||
{
|
||||
u8 attribute;
|
||||
|
||||
|
||||
attribute = GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE);
|
||||
|
||||
|
||||
switch (whichMetric)
|
||||
{
|
||||
case 0:
|
||||
@ -1491,7 +1482,7 @@ u32 GetTileMapIndexFromCoords(s32 x, s32 y, s32 screenSize, u32 screenWidth, u32
|
||||
{
|
||||
x = x & (screenWidth - 1);
|
||||
y = y & (screenHeight - 1);
|
||||
|
||||
|
||||
switch (screenSize)
|
||||
{
|
||||
case 0:
|
||||
@ -1526,7 +1517,7 @@ void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u32 tileOffset, u32 pal
|
||||
test = ((*dest & 0xFC00) + (palette2 << 12)) | ((*src + tileOffset) & 0x3FF);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
*dest = test;
|
||||
}
|
||||
#else
|
||||
@ -1586,10 +1577,10 @@ _08002B3C:\n\
|
||||
u32 GetBgType(u8 bg)
|
||||
{
|
||||
u8 mode;
|
||||
|
||||
|
||||
mode = GetBgMode();
|
||||
|
||||
|
||||
|
||||
|
||||
switch (bg)
|
||||
{
|
||||
case 0:
|
||||
@ -1621,7 +1612,7 @@ u32 GetBgType(u8 bg)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return 0xFFFF;
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ void MultiBootStartProbe(struct MultiBootParam *mp)
|
||||
mp->probe_count = 1;
|
||||
}
|
||||
|
||||
void MultiBootStartMaster(struct MultiBootParam *mp, u8 *srcp, int length, u8 palette_color, s8 palette_speed)
|
||||
void MultiBootStartMaster(struct MultiBootParam *mp, const u8 *srcp, int length, u8 palette_color, s8 palette_speed)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
|
@ -2779,7 +2779,7 @@ _08005D6E:\n\
|
||||
bx r1");
|
||||
}
|
||||
|
||||
u32 GetStringWidthFixedWidthFont(u8 *str, u8 fontId, u8 letterSpacing)
|
||||
u32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing)
|
||||
{
|
||||
int i;
|
||||
u8 width;
|
||||
@ -2788,7 +2788,7 @@ u32 GetStringWidthFixedWidthFont(u8 *str, u8 fontId, u8 letterSpacing)
|
||||
u8 line;
|
||||
int strPos;
|
||||
u8 lineWidths[8];
|
||||
u8 *strLocal;
|
||||
const u8 *strLocal;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
@ -2883,7 +2883,7 @@ u32 (*GetFontWidthFunc(u8 glyphId))(u16, bool32)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 GetStringWidth(u8 fontId, u8 *str, s16 letterSpacing)
|
||||
u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing)
|
||||
{
|
||||
bool8 isJapanese;
|
||||
int minGlyphWidth;
|
||||
|
@ -35,7 +35,7 @@ static void nullsub_8(void)
|
||||
|
||||
}
|
||||
|
||||
bool16 InitWindows(struct WindowTemplate *templates)
|
||||
bool16 InitWindows(const struct WindowTemplate *templates)
|
||||
{
|
||||
int i;
|
||||
void *bgTilemapBuffer;
|
||||
|
Loading…
Reference in New Issue
Block a user