Complete out of battle PSI menu and improve in-batttle PSI menu

This commit is contained in:
Lorenzooone 2019-09-06 21:24:22 +02:00
parent 0f7438300f
commit 80d1d654cf
11 changed files with 164 additions and 51 deletions

View File

@ -17,6 +17,7 @@ $input_c_files =
"src/c/goods.c", "src/c/goods.c",
"src/c/fileselect.c", "src/c/fileselect.c",
"src/c/status.c", "src/c/status.c",
"src/c/battle.c",
"src/c/psi.c" "src/c/psi.c"
$base_c_address = 0x83755B8; $base_c_address = 0x83755B8;

37
src/c/battle.c Normal file
View File

@ -0,0 +1,37 @@
#include "window.h"
#include "battle.h"
#include "number-selector.h"
#include "locs.h"
void printTargetOfAttack(short a, short target)
{
WINDOW *window = getWindow(3);
m2_setupwindow(window, 0x9, 0x3, 0x14, 0x2);
initWindow_buffer(window, NULL, 0);
printstr_buffer(window, &m12_battle_commands_str11, 0, 0, false);
if(target != -1)
{
printstr_hlight_buffer(window, &m12_battle_commands_str14, 8, 0, 0);
short *pointer = (short*)(0x20248E0 + 0x83E);
byte *pointer2 = (byte*)(0x20248E0);
short value = *pointer;
m2_setupBattleName((a * value) + target + 1);
byte* str = ((*((byte**)0x3005220)) + 0x4C0);
printstr_buffer(window, str, 2, 0, false);
if(a != 0)
pointer2 += 0x2E;
else
pointer2 += 0x26;
byte val = *(pointer2 + target);
unsigned short ailmentTile = ailmentTileSetup((byte*)(0x2020CCF + (val * 0x94)), 0);
if(ailmentTile >= 1)
map_tile(ailmentTile, window->window_x + 0x26, window->window_y);
}
else
{
if(a == 0) //a is the row here
printstr_buffer(window, &m12_battle_commands_str12, 2, 0, false);
else
printstr_buffer(window, &m12_battle_commands_str13, 2, 0, false);
}
}

13
src/c/battle.h Normal file
View File

@ -0,0 +1,13 @@
#ifndef HEADER_BATTLE_INCLUDED
#define HEADER_BATTLE_INCLUDED
#include "vwf.h"
void printTargetOfAttack(short a, short target);
extern byte m12_battle_commands_str11;
extern byte m12_battle_commands_str12;
extern byte m12_battle_commands_str13;
extern byte m12_battle_commands_str14;
#endif

View File

@ -15,6 +15,8 @@ int __attribute__((naked)) m2_sub_a334c(int value) {}
int __attribute__((naked)) m2_sub_a3384(int value) {} int __attribute__((naked)) m2_sub_a3384(int value) {}
void __attribute__((naked)) m2_sub_d3c50() {} void __attribute__((naked)) m2_sub_d3c50() {}
void __attribute__((naked)) m2_sub_d6844() {} void __attribute__((naked)) m2_sub_d6844() {}
int __attribute__((naked)) m2_setupwindow(WINDOW* window, short window_x, short window_y, short window_width, short window_height) {}
int __attribute__((naked)) m2_clearwindowtiles(WINDOW* window) {} int __attribute__((naked)) m2_clearwindowtiles(WINDOW* window) {}
int __attribute__((naked)) customcodes_parse_generic(int code, char* parserAddress, WINDOW* window, int* dest) {} int __attribute__((naked)) customcodes_parse_generic(int code, char* parserAddress, WINDOW* window, int* dest) {}
void __attribute__((naked)) m2_printstr(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight) {} void __attribute__((naked)) m2_printstr(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight) {}
void __attribute__((naked)) m2_setupBattleName(short value) {}

View File

@ -94,7 +94,7 @@ void psiTargetWindow_buffer(byte target)
PSIPrintInfo *printInfo = &(psi_print_info[target - 1]); PSIPrintInfo *printInfo = &(psi_print_info[target - 1]);
byte *string_group1 = (byte*)(0x8B204E4); byte *string_group1 = (byte*)(0x8B204E4);
byte extract = (printInfo->PSIID); byte extract = (printInfo->PSIID);
byte *baseStrPointer = (byte*)(&psitext); byte *baseStrPointer = (byte*)(&psitext);
byte value = 0; byte value = 0;
byte value2 = 0; byte value2 = 0;
byte *str = 0; byte *str = 0;
@ -124,7 +124,7 @@ void psiTargetWindow_buffer(byte target)
void psiPrint_buffer(byte value, WINDOW* window, bool printPSILine, PSIPrintInfo *printInfo) void psiPrint_buffer(byte value, WINDOW* window, bool printPSILine, PSIPrintInfo *printInfo)
{ {
byte *str = 0; byte *str = 0;
byte *baseStrPointer = (byte*)(&psitext); byte *baseStrPointer = (byte*)(&psitext);
byte (*possibleTargets)[3][4] = (byte(*)[3][4])cursorValues; byte (*possibleTargets)[3][4] = (byte(*)[3][4])cursorValues;
if(printPSILine) if(printPSILine)
@ -479,7 +479,7 @@ int PSITargetInput(WINDOW* window)
else else
window->hold = false; window->hold = false;
if(state.b || state.select) if((state.b || state.select) && (beforeVWF))
{ {
m2_soundeffect(0x12E); m2_soundeffect(0x12E);
window->counter = 0; window->counter = 0;
@ -488,10 +488,9 @@ int PSITargetInput(WINDOW* window)
window->cursor_x_delta = target; window->cursor_x_delta = target;
if(state.a || state.l) if((state.a || state.l) && (beforeVWF))
{ {
if(beforeVWF) m2_soundeffect(0x12D);
m2_soundeffect(0x12D);
window->counter = 0xFFFF; window->counter = 0xFFFF;
return target; return target;
} }

View File

@ -74,7 +74,7 @@ int statusNumbersPrint(WINDOW* window, bool doNotPrint)
print_string_in_buffer(str, 0x2C, (0xF) << 3, (int*)(OVERWORLD_BUFFER - 0x2000)); print_string_in_buffer(str, 0x2C, (0xF) << 3, (int*)(OVERWORLD_BUFFER - 0x2000));
} }
print_blankstr_buffer(1, 0x3, 0xA, (int*)(OVERWORLD_BUFFER - 0x2000)); print_blankstr_buffer(1, 0x3, 0xA, (int*)(OVERWORLD_BUFFER - 0x2000));
unsigned short symbolTile = ailmentTileSetup(character_data, 0); unsigned short symbolTile = ailmentTileSetup(&(character_data->ailment), 0);
if(symbolTile == 0) if(symbolTile == 0)
{ {
printStatusSymbolArrangement(0x1FF, window); printStatusSymbolArrangement(0x1FF, window);

View File

@ -1278,8 +1278,13 @@ void printstr_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short
unsigned short printstr_hlight_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight) unsigned short printstr_hlight_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight)
{ {
unsigned short printX = (x + window->window_x) << 3; return printstr_hlight_pixels_buffer(window, str, x << 3, y << 3, highlight);
unsigned short printY = (y + window->window_y) << 3; }
unsigned short printstr_hlight_pixels_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight)
{
unsigned short printX = x + ((window->window_x) << 3);
unsigned short printY = y + ((window->window_y) << 3);
unsigned short tmpPaletteMsk = (*palette_mask); unsigned short tmpPaletteMsk = (*palette_mask);
unsigned short palette_mask_highlight = tmpPaletteMsk; unsigned short palette_mask_highlight = tmpPaletteMsk;
if(highlight) if(highlight)
@ -1462,40 +1467,40 @@ int setNumber_getLength(int value, byte *str, int maxLength)
return pos; return pos;
} }
unsigned short ailmentTileSetup(PC *character, unsigned short defaultVal) unsigned short ailmentTileSetup(byte *ailmentBase, unsigned short defaultVal)
{ {
int value = defaultVal; int value = defaultVal;
byte flagValue = 0; byte flagValue = 0;
if(character->ailment == CONSCIOUS) if((*ailmentBase) == CONSCIOUS)
{ {
if(character->ailment2 != CONSCIOUS) if((*(ailmentBase + 1)) != CONSCIOUS)
{ {
flagValue = character->ailment2; flagValue = (*(ailmentBase + 1));
value = 1; value = 1;
} }
else if(character->ailment3 != CONSCIOUS) else if((*(ailmentBase + 2)) != CONSCIOUS)
{ {
flagValue = character->ailment3; flagValue = (*(ailmentBase + 2));
value = 2; value = 2;
} }
else if(character->strange) else if((*(ailmentBase + 3)))
{ {
flagValue = character->strange; flagValue = (*(ailmentBase + 3));
value = 3; value = 3;
} }
else if(character->cant_concentrate) else if((*(ailmentBase + 4)))
{ {
flagValue = character->cant_concentrate; flagValue = (*(ailmentBase + 4));
value = 4; value = 4;
} }
else if(character->homesick) else if((*(ailmentBase + 5)))
{ {
flagValue = character->homesick; flagValue = (*(ailmentBase + 5));
value = 5; value = 5;
} }
else if(character->unknown2[0]) else if((*(ailmentBase + 6)))
{ {
flagValue = character->unknown2[0]; flagValue = (*(ailmentBase + 6));
value = 6; value = 6;
} }
else else
@ -1504,7 +1509,7 @@ unsigned short ailmentTileSetup(PC *character, unsigned short defaultVal)
else else
{ {
value = 0; value = 0;
flagValue = character->ailment; flagValue = (*(ailmentBase));
} }
unsigned short *returnValues = (unsigned short*)0x8B1F2E4; unsigned short *returnValues = (unsigned short*)0x8B1F2E4;
return (*(returnValues + (value * 7) + flagValue - 1)); return (*(returnValues + (value * 7) + flagValue - 1));

View File

@ -97,13 +97,14 @@ void setStuffWindow_Graphics();
void clearWindowTiles_buffer(WINDOW* window); void clearWindowTiles_buffer(WINDOW* window);
int initWindow_buffer(WINDOW* window, byte* text_start, unsigned short delay_between_prints); int initWindow_buffer(WINDOW* window, byte* text_start, unsigned short delay_between_prints);
void print_blankstr_buffer(int x, int y, int width, int *dest); void print_blankstr_buffer(int x, int y, int width, int *dest);
unsigned short ailmentTileSetup(PC *character, unsigned short defaultVal); unsigned short ailmentTileSetup(byte *ailmentBase, unsigned short defaultVal);
int setNumber_getLength(int value, byte *str, int maxLength); int setNumber_getLength(int value, byte *str, int maxLength);
int print_string_in_buffer(byte *str, int x, int y, int *dest); int print_string_in_buffer(byte *str, int x, int y, int *dest);
void printCashWindow(); void printCashWindow();
WINDOW* getWindow(int index); WINDOW* getWindow(int index);
void printstr_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight); void printstr_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight);
unsigned short printstr_hlight_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight); unsigned short printstr_hlight_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight);
unsigned short printstr_hlight_pixels_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight);
extern unsigned short m2_coord_table[]; extern unsigned short m2_coord_table[];
extern byte m2_ness_name[]; extern byte m2_ness_name[];
@ -135,4 +136,6 @@ extern void m2_soundeffect(int index);
extern void m2_printstr(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight); extern void m2_printstr(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight);
extern int customcodes_parse_generic(int code, char* parserAddress, WINDOW* window, int* dest); extern int customcodes_parse_generic(int code, char* parserAddress, WINDOW* window, int* dest);
extern void m2_sub_d3c50(); extern void m2_sub_d3c50();
extern void m2_sub_d6844(); extern void m2_sub_d6844();
extern int m2_setupwindow(WINDOW* window, short window_x, short window_y, short window_width, short window_height);
extern void m2_setupBattleName(short value);

View File

@ -55,9 +55,11 @@ mov r3,6
//--------------------------------------------------------- //---------------------------------------------------------
.org 0x80B7D9A :: bl b7d9a_main_window_manage_input .org 0x80B7D9A :: bl b7d9a_main_window_manage_input
.org 0x80B7DD2 :: bl printCashWindow
//.org 0x80B8A36 :: bl initWindow_buffer //Money window //.org 0x80B8A36 :: bl initWindow_buffer //Money window
//.org 0x80B8A3C :: bl print_window_with_buffer //.org 0x80B8A3C :: bl print_window_with_buffer
.org 0x80B8890 :: bl print_window_with_buffer :: bl b8894_printCashWindowAndStore //Main window + Cash Window out of Status menu .org 0x80B8890 :: bl print_window_with_buffer :: bl b8894_printCashWindowAndStore //Main window + Cash Window out of Status menu
.org 0x80B8664 :: bl print_window_with_buffer :: bl b8894_printCashWindowAndStore //Main window + Cash Window out of PSI menu
.org 0x80B831A :: bl initWindow_buffer .org 0x80B831A :: bl initWindow_buffer
.org 0x80B8320 :: bl b8320_statusWindowTextStore .org 0x80B8320 :: bl b8320_statusWindowTextStore
@ -78,13 +80,21 @@ mov r3,6
// PSI battle window hacks // PSI battle window hacks
//--------------------------------------------------------- //---------------------------------------------------------
.org 0x80E00C8 :: bl e02c6_print_target_store
.org 0x80E02C6 :: bl e02c6_print_target_store
.org 0x80E0762 :: bl initWindow_buffer .org 0x80E0762 :: bl initWindow_buffer
.org 0x80E0776 :: bl print_window_with_buffer .org 0x80E0776 :: bl print_window_with_buffer
.org 0x80E07C2 :: bl clearWindowTiles_buffer .org 0x80E07C2 :: bl clearWindowTiles_buffer
.org 0x80E0892 :: bl initWindow_buffer .org 0x80E0892 :: bl initWindow_buffer
.org 0x80E08A6 :: bl print_window_with_buffer .org 0x80E08A6 :: bl print_window_with_buffer
.org 0x80E0990 :: bl initWindow_buffer
.org 0x80E0A30 :: bl initWindow_buffer .org 0x80E0A30 :: bl initWindow_buffer
.org 0x80E0A54 :: bl print_window_with_buffer .org 0x80E0A54 :: bl print_window_with_buffer
.org 0x80C24A2 :: bl printstr_hlight_buffer
.org 0x80C24B4 :: bl printstr_hlight_buffer
.org 0x80C24CC :: bl printstr_hlight_buffer
.org 0x80C2500 :: bl printstr_hlight_buffer
.org 0x80C2518 :: bl printstr_hlight_buffer
//--------------------------------------------------------- //---------------------------------------------------------
// BAC18 hacks (status window) // BAC18 hacks (status window)
@ -113,7 +123,26 @@ mov r3,6
.org 0x80B8C34 :: bl initWindow_buffer .org 0x80B8C34 :: bl initWindow_buffer
.org 0x80B8C42 :: bl baec6_psi_window_print_buffer .org 0x80B8C42 :: bl baec6_psi_window_print_buffer
.org 0x80B8C7E :: bl initWindow_buffer .org 0x80B8C7E :: bl initWindow_buffer
.org 0x80B8C8C :: bl baec6_psi_window_print_buffer .org 0x80B8C8C :: nop :: nop
.org 0x80B8CA8 :: bl initWindow_buffer
.org 0x80B8CAE :: bl print_window_with_buffer
.org 0x80B8CEA :: bl baec6_psi_window_print_buffer
.org 0x80B8D0C :: bl initWindow_buffer
.org 0x80B8D16 :: bl initWindow_buffer
.org 0x80B8D22 :: bl psiWindow_buffer
.org 0x80B8E44 :: bl initWindow_buffer
.org 0x80B8E62 :: bl baec6_psi_window_print_buffer
.org 0x80B9222 :: bl initWindow_buffer
.org 0x80B922E :: bl psiTargetWindow_buffer
.org 0x80B916E :: bl initWindow_buffer
.org 0x80B9174 :: bl print_window_with_buffer
.org 0x80B9238 :: bl initWindow_buffer
.org 0x80B9256 :: bl baec6_psi_window_print_buffer
.org 0x80BA9FA :: bl initWindow_buffer
.org 0x80BAA00 :: bl print_window_with_buffer
.org 0x80BAB64 :: bl initWindow_buffer
.org 0x80BABA6 :: bl printstr_hlight_buffer
.org 0x80BA8AC :: bl ba8ac_load_targets_print
//--------------------------------------------------------- //---------------------------------------------------------
// Class PSI window hacks // Class PSI window hacks
@ -218,14 +247,14 @@ bl print_string
.org 0x80C23AE :: lsr r6,r3,0xD // tiles-to-pixels .org 0x80C23AE :: lsr r6,r3,0xD // tiles-to-pixels
.org 0x80C23CE :: bl c239c_print_psi :: nop :: nop :: nop .org 0x80C23CE :: bl c239c_print_psi :: nop :: nop :: nop
.org 0x80C23DA :: add r4,17 // pixel width of "PSI " .org 0x80C23DA :: add r4,17 // pixel width of "PSI "
.org 0x80C23F0 :: bl print_string_hlight_pixels // print rockin' .org 0x80C23F0 :: bl printstr_hlight_pixels_buffer // print rockin'
.org 0x80C2402 :: mov r0,3 :: lsl r0,r0,0x10 // pixel width of space .org 0x80C2402 :: mov r0,3 :: lsl r0,r0,0x10 // pixel width of space
.org 0x80C242E :: mov r0,0x14 // new PSI name entry length .org 0x80C242E :: mov r0,0x14 // new PSI name entry length
.org 0x80C2448 .org 0x80C2448
bl print_string_hlight_pixels // print PSI name bl printstr_hlight_pixels_buffer // print PSI name
mov r2,r1 // record X width mov r2,r1 // record X width
add r2,3 // add a space add r2,3 // add a space
.org 0x80C2468 :: bl print_string_hlight_pixels .org 0x80C2468 :: bl printstr_hlight_pixels_buffer
//--------------------------------------------------------- //---------------------------------------------------------
// PSI target window hacks // PSI target window hacks
@ -274,7 +303,7 @@ mov r0,0x50
// Redraw main menu when entering PSI target window // Redraw main menu when entering PSI target window
.org 0x80B8CF8 :: bl b8bbc_redraw_menu_13to2 // 1 to 2 .org 0x80B8CF8 :: bl b8bbc_redraw_menu_13to2 // 1 to 2
.org 0x80B920C :: bl b8bbc_redraw_menu_13to2 // 3 to 2 .org 0x80B920C :: bl b8bbc_redraw_menu_13to2_store // 3 to 2
//--------------------------------------------------------- //---------------------------------------------------------
// E06EC hacks (PSI window in battle) // E06EC hacks (PSI window in battle)
@ -1588,11 +1617,13 @@ moved_graphics_table:
.definelabel m2_formatnumber ,0x80CA65C .definelabel m2_formatnumber ,0x80CA65C
.definelabel m2_clearwindowtiles ,0x80CA834 .definelabel m2_clearwindowtiles ,0x80CA834
.definelabel m2_menuwindow ,0x80C1C98 .definelabel m2_menuwindow ,0x80C1C98
.definelabel m2_setupwindow ,0x80BE188
.definelabel m2_resetwindow ,0x80BE490 .definelabel m2_resetwindow ,0x80BE490
.definelabel m2_sub_d3c50 ,0x80D3C50 .definelabel m2_sub_d3c50 ,0x80D3C50
.definelabel m2_hpwindow_up ,0x80D3F0C .definelabel m2_hpwindow_up ,0x80D3F0C
.definelabel m2_curhpwindow_down ,0x80D41D8 .definelabel m2_curhpwindow_down ,0x80D41D8
.definelabel m2_sub_d6844 ,0x80D6844 .definelabel m2_sub_d6844 ,0x80D6844
.definelabel m2_setupBattleName ,0x80DCD00
.definelabel m2_div ,0x80F49D8 .definelabel m2_div ,0x80F49D8
.definelabel m2_remainder ,0x80F4A70 .definelabel m2_remainder ,0x80F4A70
.definelabel m2_items ,0x8B1D62C .definelabel m2_items ,0x8B1D62C

View File

@ -384,6 +384,9 @@ push {lr}
mov r9,r0 mov r9,r0
ldr r3,[r5,#0] ldr r3,[r5,#0]
bl load_pixels_overworld bl load_pixels_overworld
push {r0-r3}
swi #5
pop {r0-r3}
pop {pc} pop {pc}
//============================================================================== //==============================================================================
@ -423,6 +426,14 @@ bl store_pixels_overworld
@@end: @@end:
pop {pc} pop {pc}
//==============================================================================
//Prints the attack target choice menu and stores the buffer
e02c6_print_target_store:
push {lr}
bl printTargetOfAttack
bl store_pixels_overworld
pop {pc}
//============================================================================== //==============================================================================
// Clears the PSI window when switching classes // Clears the PSI window when switching classes
// r5 = 0x3005230 // r5 = 0x3005230
@ -485,18 +496,30 @@ mov r3,2
mov r4,r0 mov r4,r0
bl 0x80BE4C8 bl 0x80BE4C8
mov r0,r4 mov r0,r4
bl 0x80C8BE4 bl print_window_with_buffer
swi #5 swi #5
// Clobbered code (restore the window borders, etc.) // Clobbered code (restore the window borders, etc.)
mov r0,1 mov r0,1
bl 0x80BD7AC bl m2_swapwindowbuf
add sp,4 add sp,4
pop {r1-r4,pc} pop {r1-r4,pc}
.pool .pool
//==============================================================================
// Redraw main menu when exiting PSI window from using a PSI and stores the buffer
b8bbc_redraw_menu_13to2_store:
push {lr}
bl b8bbc_redraw_menu_13to2
mov r3,r9
cmp r3,#0
beq @@end //store only if we're exiting the menu
bl store_pixels_overworld
@@end:
pop {pc}
//============================================================================== //==============================================================================
// Redraw main menu when entering PSI target window // Redraw main menu when entering PSI target window
b8bbc_redraw_menu_13to2: b8bbc_redraw_menu_13to2:
@ -784,6 +807,15 @@ bl 0x80BD7F8 // restore tilemaps
pop {pc} pop {pc}
.pool .pool
//==============================================================================
//Calls the funcion which loads the targets in and then stores the buffer
ba8ac_load_targets_print:
push {lr}
bl 0x80BAA80
bl store_pixels_overworld
pop {pc}
//============================================================================== //==============================================================================
// Print "PSI " // Print "PSI "
c239c_print_psi: c239c_print_psi:
@ -793,7 +825,7 @@ mov r2,0
str r2,[sp] str r2,[sp]
mov r2,r4 mov r2,r4
lsl r3,r3,3 // tiles-to-pixels lsl r3,r3,3 // tiles-to-pixels
bl print_string_hlight_pixels bl printstr_hlight_pixels_buffer
add sp,4 add sp,4
pop {pc} pop {pc}
@ -1749,7 +1781,7 @@ beq @@do_not_print
mov r2,#1 //Goes on as usual and sets vwf_skip to true mov r2,#1 //Goes on as usual and sets vwf_skip to true
orr r2,r1 orr r2,r1
strb r2,[r0,#3] strb r2,[r0,#3]
bl m2_clearwindowtiles bl clearWindowTiles_buffer
pop {pc} pop {pc}
@@do_not_print: //Doesn't print in the PSI window @@do_not_print: //Doesn't print in the PSI window
@ -1999,7 +2031,7 @@ bx r0 //Jump to the next useful piece of code
b8d40_psi_going_inner_window: b8d40_psi_going_inner_window:
push {lr} push {lr}
bl PSITargetWindowInput bl PSITargetWindowInput
bl store_pixels_overworld_psi_window bl store_pixels_overworld
pop {pc} pop {pc}
//============================================================================== //==============================================================================
@ -2036,7 +2068,7 @@ pop {r2}
@@store_buffer: @@store_buffer:
cmp r0,#0 cmp r0,#0
bne @@continue bne @@continue
bl store_pixels_overworld_psi_window bl store_pixels_overworld
@@continue: @@continue:
cmp r0,#0 cmp r0,#0
@ -2193,6 +2225,9 @@ beq @@end
cmp r0,#0 cmp r0,#0
blt @@end blt @@end
bl load_pixels_overworld bl load_pixels_overworld
push {r0-r2}
swi #5
pop {r0-r2}
@@end: @@end:
pop {pc} pop {pc}
@ -2889,20 +2924,6 @@ str r0,[r1,#8]
ldr r0,[r1,#8] ldr r0,[r1,#8]
pop {r0-r1,pc} pop {r0-r1,pc}
//==============================================================================
//Loads the vram into the buffer, it's called each time there is only the main file_select window active (a good way to set the whole thing up)
load_pixels_overworld_psi_window:
push {r0-r1,lr}
ldr r1,=#0x40000C8 //DMA transfer 2
ldr r0,=#0x6002000 //Source
str r0,[r1]
ldr r0,=#overworld_buffer //Target
str r0,[r1,#4]
ldr r0,=#0x94000800 //Store 0x1800 bytes - When VBlank and in words of 32 bits
str r0,[r1,#8]
ldr r0,[r1,#8]
pop {r0-r1,pc}
//============================================================================== //==============================================================================
//Stores the buffer into the vram. This avoids screen tearing. //Stores the buffer into the vram. This avoids screen tearing.
store_pixels_overworld_psi_window: store_pixels_overworld_psi_window:

View File

@ -694,6 +694,7 @@ namespace ScriptTool
{ {
var str = hardcodedStrings[i]; var str = hardcodedStrings[i];
offsetFile.WriteLine($".definelabel {name.Replace('-', '_')}_str{i},0x{referenceAddress | 0x8000000:X}");
foreach (int ptr in str.PointerLocations) foreach (int ptr in str.PointerLocations)
{ {
offsetFile.WriteLine(String.Format(".org 0x{0:X} :: dw 0x{1:X8}", offsetFile.WriteLine(String.Format(".org 0x{0:X} :: dw 0x{1:X8}",