From 9b48f1dc87cc8448cfb808cc9759c2008e94c605 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 31 Dec 2019 09:40:03 +1000 Subject: [PATCH] Decompile optionsGetScreenSize, optionsSetScreenSize, optionsGetScreenRatio, optionsSetScreenRatio, optionsGetScreenSplit and optionsSetScreenSplit --- src/game/game_102240.c | 14 ++++---- src/game/game_10ccd0.c | 12 +++---- src/game/game_152710.c | 61 +++++++++++++------------------- src/include/constants.h | 10 ++++++ src/include/game/game_152710.h | 12 +++---- src/include/setup/setup_0160b0.h | 6 ++-- src/include/setup/setup_020df0.h | 3 ++ src/setup/setup_0160b0.c | 6 ++-- src/setup/setup_020df0.c | 6 ++-- 9 files changed, 65 insertions(+), 65 deletions(-) diff --git a/src/game/game_102240.c b/src/game/game_102240.c index e213efb4d..35fa24316 100644 --- a/src/game/game_102240.c +++ b/src/game/game_102240.c @@ -494,10 +494,10 @@ glabel menuhandlerSoundMode GLOBAL_ASM( glabel menuhandlerScreenSize /* f102754: 27bdffd8 */ addiu $sp,$sp,-40 -/* f102758: 3c0e8007 */ lui $t6,%hi(options_screenmode) +/* f102758: 3c0e8007 */ lui $t6,%hi(g_ScreenSizeOptions) /* f10275c: afbf0014 */ sw $ra,0x14($sp) /* f102760: afa5002c */ sw $a1,0x2c($sp) -/* f102764: 25ce19f0 */ addiu $t6,$t6,%lo(options_screenmode) +/* f102764: 25ce19f0 */ addiu $t6,$t6,%lo(g_ScreenSizeOptions) /* f102768: 8dc10000 */ lw $at,0x0($t6) /* f10276c: 27a20020 */ addiu $v0,$sp,0x20 /* f102770: 24080003 */ addiu $t0,$zero,0x3 @@ -527,7 +527,7 @@ glabel menuhandlerScreenSize /* f1027c8: 1000000f */ beqz $zero,.L0f102808 /* f1027cc: 8fbf0014 */ lw $ra,0x14($sp) .L0f1027d0: -/* f1027d0: 0fc54bc4 */ jal optionsSetScreenMode +/* f1027d0: 0fc54bc4 */ jal optionsSetScreenSize /* f1027d4: 8cc40000 */ lw $a0,0x0($a2) /* f1027d8: 3c02800a */ lui $v0,%hi(g_Vars) /* f1027dc: 24429fc0 */ addiu $v0,$v0,%lo(g_Vars) @@ -553,10 +553,10 @@ glabel menuhandlerScreenSize GLOBAL_ASM( glabel menuhandlerScreenRatio /* f102814: 27bdffe0 */ addiu $sp,$sp,-32 -/* f102818: 3c0e8007 */ lui $t6,%hi(options_screenratio) +/* f102818: 3c0e8007 */ lui $t6,%hi(g_ScreenRatioOptions) /* f10281c: afbf0014 */ sw $ra,0x14($sp) /* f102820: afa50024 */ sw $a1,0x24($sp) -/* f102824: 25ce19f8 */ addiu $t6,$t6,%lo(options_screenratio) +/* f102824: 25ce19f8 */ addiu $t6,$t6,%lo(g_ScreenRatioOptions) /* f102828: 8dc10000 */ lw $at,0x0($t6) /* f10282c: 27a2001c */ addiu $v0,$sp,0x1c /* f102830: 24080002 */ addiu $t0,$zero,0x2 @@ -610,10 +610,10 @@ glabel menuhandlerScreenRatio GLOBAL_ASM( glabel menuhandlerScreenSplit /* f1028cc: 27bdffc8 */ addiu $sp,$sp,-56 -/* f1028d0: 3c0e8007 */ lui $t6,%hi(options_screensplit) +/* f1028d0: 3c0e8007 */ lui $t6,%hi(g_ScreenSplitOptions) /* f1028d4: afbf0014 */ sw $ra,0x14($sp) /* f1028d8: afa5003c */ sw $a1,0x3c($sp) -/* f1028dc: 25ce19fc */ addiu $t6,$t6,%lo(options_screensplit) +/* f1028dc: 25ce19fc */ addiu $t6,$t6,%lo(g_ScreenSplitOptions) /* f1028e0: 8dc10000 */ lw $at,0x0($t6) /* f1028e4: 27a20034 */ addiu $v0,$sp,0x34 /* f1028e8: 24080002 */ addiu $t0,$zero,0x2 diff --git a/src/game/game_10ccd0.c b/src/game/game_10ccd0.c index b489a3cbf..6dc167500 100644 --- a/src/game/game_10ccd0.c +++ b/src/game/game_10ccd0.c @@ -2994,7 +2994,7 @@ glabel func0f10f204 /* f10f5a0: 02002825 */ or $a1,$s0,$zero /* f10f5a4: 10400005 */ beqz $v0,.L0f10f5bc /* f10f5a8: 24040006 */ addiu $a0,$zero,0x6 -/* f10f5ac: 0fc54bc4 */ jal optionsSetScreenMode +/* f10f5ac: 0fc54bc4 */ jal optionsSetScreenSize /* f10f5b0: 24040002 */ addiu $a0,$zero,0x2 /* f10f5b4: 1000000c */ beqz $zero,.L0f10f5e8 /* f10f5b8: 2404001f */ addiu $a0,$zero,0x1f @@ -3003,12 +3003,12 @@ glabel func0f10f204 /* f10f5c0: 02002825 */ or $a1,$s0,$zero /* f10f5c4: 10400005 */ beqz $v0,.L0f10f5dc /* f10f5c8: 00000000 */ sll $zero,$zero,0x0 -/* f10f5cc: 0fc54bc4 */ jal optionsSetScreenMode +/* f10f5cc: 0fc54bc4 */ jal optionsSetScreenSize /* f10f5d0: 24040001 */ addiu $a0,$zero,0x1 /* f10f5d4: 10000004 */ beqz $zero,.L0f10f5e8 /* f10f5d8: 2404001f */ addiu $a0,$zero,0x1f .L0f10f5dc: -/* f10f5dc: 0fc54bc4 */ jal optionsSetScreenMode +/* f10f5dc: 0fc54bc4 */ jal optionsSetScreenSize /* f10f5e0: 00002025 */ or $a0,$zero,$zero /* f10f5e4: 2404001f */ addiu $a0,$zero,0x1f .L0f10f5e8: @@ -3817,14 +3817,14 @@ glabel func0f10feac /* f110194: 02002825 */ or $a1,$s0,$zero /* f110198: 0fc4794c */ jal func0f11e530 /* f11019c: 00403025 */ or $a2,$v0,$zero -/* f1101a0: 0fc54bc1 */ jal optionsGetScreenMode +/* f1101a0: 0fc54bc1 */ jal optionsGetScreenSize /* f1101a4: 00000000 */ sll $zero,$zero,0x0 /* f1101a8: 00523026 */ xor $a2,$v0,$s2 /* f1101ac: 2cc60001 */ sltiu $a2,$a2,0x1 /* f1101b0: 24040006 */ addiu $a0,$zero,0x6 /* f1101b4: 0fc4794c */ jal func0f11e530 /* f1101b8: 02002825 */ or $a1,$s0,$zero -/* f1101bc: 0fc54bc1 */ jal optionsGetScreenMode +/* f1101bc: 0fc54bc1 */ jal optionsGetScreenSize /* f1101c0: 00000000 */ sll $zero,$zero,0x0 /* f1101c4: 24150002 */ addiu $s5,$zero,0x2 /* f1101c8: 00553026 */ xor $a2,$v0,$s5 @@ -3873,7 +3873,7 @@ glabel func0f10feac /* f110274: 02002825 */ or $a1,$s0,$zero /* f110278: 0fc4794c */ jal func0f11e530 /* f11027c: 00403025 */ or $a2,$v0,$zero -/* f110280: 0fc54bc1 */ jal optionsGetScreenMode +/* f110280: 0fc54bc1 */ jal optionsGetScreenSize /* f110284: 00000000 */ sll $zero,$zero,0x0 /* f110288: 50400002 */ beqzl $v0,.L0f110294 /* f11028c: 8e990450 */ lw $t9,0x450($s4) diff --git a/src/game/game_152710.c b/src/game/game_152710.c index 9130d1814..061f596b7 100644 --- a/src/game/game_152710.c +++ b/src/game/game_152710.c @@ -358,48 +358,35 @@ glabel func0f152d80 /* f152f00: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel optionsGetScreenMode -/* f152f04: 3c028008 */ lui $v0,0x8008 -/* f152f08: 03e00008 */ jr $ra -/* f152f0c: 8c42fab0 */ lw $v0,-0x550($v0) -); +s32 optionsGetScreenSize(void) +{ + return g_ScreenSize; +} -GLOBAL_ASM( -glabel optionsSetScreenMode -/* f152f10: 3c018008 */ lui $at,0x8008 -/* f152f14: 03e00008 */ jr $ra -/* f152f18: ac24fab0 */ sw $a0,-0x550($at) -); +void optionsSetScreenSize(s32 size) +{ + g_ScreenSize = size; +} -GLOBAL_ASM( -glabel optionsGetScreenRatio -/* f152f1c: 3c028008 */ lui $v0,0x8008 -/* f152f20: 03e00008 */ jr $ra -/* f152f24: 8c42fab4 */ lw $v0,-0x54c($v0) -); +s32 optionsGetScreenRatio(void) +{ + return g_ScreenRatio; +} -GLOBAL_ASM( -glabel optionsSetScreenRatio -/* f152f28: 3c018008 */ lui $at,0x8008 -/* f152f2c: 03e00008 */ jr $ra -/* f152f30: ac24fab4 */ sw $a0,-0x54c($at) -); +void optionsSetScreenRatio(s32 ratio) +{ + g_ScreenRatio = ratio; +} -GLOBAL_ASM( -glabel optionsGetScreenSplit -/* f152f34: 3c028008 */ lui $v0,0x8008 -/* f152f38: 03e00008 */ jr $ra -/* f152f3c: 9042fab8 */ lbu $v0,-0x548($v0) -); +u8 optionsGetScreenSplit(void) +{ + return g_ScreenSplit; +} -GLOBAL_ASM( -glabel optionsSetScreenSplit -/* f152f40: 3c018008 */ lui $at,0x8008 -/* f152f44: afa40000 */ sw $a0,0x0($sp) -/* f152f48: 03e00008 */ jr $ra -/* f152f4c: a024fab8 */ sb $a0,-0x548($at) -); +void optionsSetScreenSplit(u8 split) +{ + g_ScreenSplit = split; +} GLOBAL_ASM( glabel func0f152f50 diff --git a/src/include/constants.h b/src/include/constants.h index 01859f413..3bcbe24ad 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -720,6 +720,16 @@ #define SAVEFILEFLAG_RESCUE_MECHANIC_DEAD 0x3e #define SAVEFILEFLAG_G5_MINE 0x3f // true if thrown on top door +#define SCREENRATIO_NORMAL 0 +#define SCREENRATIO_16_9 1 + +#define SCREENSIZE_FULL 0 +#define SCREENSIZE_WIDE 1 +#define SCREENSIZE_CINEMA 2 + +#define SCREENSPLIT_HORIZONTAL 0 +#define SCREENSPLIT_VERTICAL 1 + #define SPEED_WALK 0 #define SPEED_JOG 1 #define SPEED_RUN 2 diff --git a/src/include/game/game_152710.h b/src/include/game/game_152710.h index 510f53ef3..be348aa9e 100644 --- a/src/include/game/game_152710.h +++ b/src/include/game/game_152710.h @@ -37,12 +37,12 @@ u32 optionsSetInGameSubtitles(void); u32 optionsSetCutsceneSubtitles(void); void optionsSetHeadRoll(s32 optionsindex, bool enable); u32 func0f152d80(void); -u32 optionsGetScreenMode(void); -u32 optionsSetScreenMode(void); -u32 optionsGetScreenRatio(void); -u32 optionsSetScreenRatio(void); -u32 optionsGetScreenSplit(void); -u32 optionsSetScreenSplit(void); +s32 optionsGetScreenSize(void); +void optionsSetScreenSize(s32 size); +s32 optionsGetScreenRatio(void); +void optionsSetScreenRatio(s32 ratio); +u8 optionsGetScreenSplit(void); +void optionsSetScreenSplit(u8 split); u32 func0f152f50(void); void func0f152f70(u32 arg0); diff --git a/src/include/setup/setup_0160b0.h b/src/include/setup/setup_0160b0.h index d8ab977d2..622399931 100644 --- a/src/include/setup/setup_0160b0.h +++ b/src/include/setup/setup_0160b0.h @@ -176,9 +176,9 @@ extern u32 var800719c0; extern u16 options_controlmode[]; extern u16 g_AimControlOptions[]; extern u16 options_soundmode[]; -extern u16 options_screenmode[]; -extern u16 options_screenratio[]; -extern u16 options_screensplit[]; +extern u16 g_ScreenSizeOptions[]; +extern u16 g_ScreenRatioOptions[]; +extern u16 g_ScreenSplitOptions[]; extern struct menu_dialog menudialog_objectives; extern struct menu_dialog menudialog_perfectdarkmodesettings; extern struct menu_dialog menudialog_selectdifficulty; diff --git a/src/include/setup/setup_020df0.h b/src/include/setup/setup_020df0.h index fa3b2e52d..4218a984c 100644 --- a/src/include/setup/setup_020df0.h +++ b/src/include/setup/setup_020df0.h @@ -147,6 +147,9 @@ extern u32 var8007f9fc; extern u32 var8007fa60; extern u32 var8007fa80; extern u32 var8007fa84; +extern s32 g_ScreenSize; +extern s32 g_ScreenRatio; +extern u8 g_ScreenSplit; extern u32 var8007fac0; extern u32 var8007fac4; extern u32 var8007facc; diff --git a/src/setup/setup_0160b0.c b/src/setup/setup_0160b0.c index 4a38e8baf..271c15932 100644 --- a/src/setup/setup_0160b0.c +++ b/src/setup/setup_0160b0.c @@ -1563,7 +1563,7 @@ u16 options_soundmode[] = { }; // 17a10 -u16 options_screenmode[] = { +u16 g_ScreenSizeOptions[] = { 0x56dc, // "Full" 0x56dd, // "Wide" 0x56de, // "Cinema" @@ -1571,13 +1571,13 @@ u16 options_screenmode[] = { }; // 17a18 -u16 options_screenratio[] = { +u16 g_ScreenRatioOptions[] = { 0x56df, // "Normal" 0x56e0, // "16:9" }; // 17a1c -u16 options_screensplit[] = { +u16 g_ScreenSplitOptions[] = { 0x56e1, // "Horizontal" 0x56e2, // "Vertical" }; diff --git a/src/setup/setup_020df0.c b/src/setup/setup_020df0.c index 2d99771a4..007e77990 100644 --- a/src/setup/setup_020df0.c +++ b/src/setup/setup_020df0.c @@ -6948,9 +6948,9 @@ u32 var8007faa0 = 0x00000000; u32 var8007faa4 = 0x00000001; u32 var8007faa8 = 0x00000001; u32 var8007faac = 0x00000001; -u32 var8007fab0 = 0x00000000; -u32 var8007fab4 = 0x00000000; -u32 var8007fab8 = 0x00000000; +s32 g_ScreenSize = SCREENSIZE_FULL; +s32 g_ScreenRatio = SCREENRATIO_NORMAL; +u8 g_ScreenSplit = SCREENSPLIT_HORIZONTAL; u32 var8007fabc = 0x00000000; u32 var8007fac0 = 0x00000001; u32 var8007fac4 = 0x00000000;