diff --git a/src/game/fmb.c b/src/game/fmb.c index 18b1f7a69..3c7281cdc 100644 --- a/src/game/fmb.c +++ b/src/game/fmb.c @@ -167,7 +167,7 @@ struct menuitem g_AudioVideo4MbMenuItems[] = { { MENUITEMTYPE_SEPARATOR, 0, 0x00000000, 0x00000000, 0x00000000, NULL }, { MENUITEMTYPE_DROPDOWN, 0, 0x00000000, L_OPTIONS_311, 0x00000000, menuhandlerScreenRatio }, // "Ratio" #if PAL - { MENUITEMTYPE_DROPDOWN, 0, 0x00000000, L_MPWEAPONS_269, 0x00000000, func0f1030e4pf }, // "Language" + { MENUITEMTYPE_DROPDOWN, 0, 0x00000000, L_MPWEAPONS_269, 0x00000000, menuhandlerLanguage }, // "Language" #endif { MENUITEMTYPE_SEPARATOR, 0, 0x00000000, 0x00000000, 0x00000000, NULL }, { MENUITEMTYPE_SELECTABLE, 0, 0x00000008, L_OPTIONS_312, 0x00000000, NULL }, // "Back" diff --git a/src/game/mainmenu.c b/src/game/mainmenu.c index 31b469729..484b9758c 100644 --- a/src/game/mainmenu.c +++ b/src/game/mainmenu.c @@ -264,144 +264,39 @@ s32 menuhandlerScreenRatio(s32 operation, struct menuitem *item, union handlerda return 0; } -#if VERSION == VERSION_PAL_FINAL -u16 var80071ce0pf[] = { 0x5507, 0x5508, 0x5509, 0x550a, 0x550b }; +#if PAL +s32 menuhandlerLanguage(s32 operation, struct menuitem *item, union handlerdata *data) +{ + u16 labels[] = { + L_MPWEAPONS_262, // English + L_MPWEAPONS_263, // French + L_MPWEAPONS_264, // German + L_MPWEAPONS_265, // Italian + L_MPWEAPONS_266, // Spanish + }; -GLOBAL_ASM( -glabel func0f1030e4pf -/* f1030e4: 27bdffd8 */ addiu $sp,$sp,-40 -/* f1030e8: 3c0e8007 */ lui $t6,0x8007 -/* f1030ec: afbf0014 */ sw $ra,0x14($sp) -/* f1030f0: afa5002c */ sw $a1,0x2c($sp) -/* f1030f4: 25ce1ce0 */ addiu $t6,$t6,0x1ce0 -/* f1030f8: 8dc10000 */ lw $at,0x0($t6) -/* f1030fc: 27a2001c */ addiu $v0,$sp,0x1c -/* f103100: 24080005 */ li $t0,0x5 -/* f103104: ac410000 */ sw $at,0x0($v0) -/* f103108: 8dd90004 */ lw $t9,0x4($t6) -/* f10310c: ac590004 */ sw $t9,0x4($v0) -/* f103110: 95c10008 */ lhu $at,0x8($t6) -/* f103114: a4410008 */ sh $at,0x8($v0) -/* f103118: 24010001 */ li $at,0x1 -/* f10311c: 10810009 */ beq $a0,$at,.PF0f103144 -/* f103120: 24010003 */ li $at,0x3 -/* f103124: 10810009 */ beq $a0,$at,.PF0f10314c -/* f103128: 24010006 */ li $at,0x6 -/* f10312c: 1081000e */ beq $a0,$at,.PF0f103168 -/* f103130: 24010007 */ li $at,0x7 -/* f103134: 10810018 */ beq $a0,$at,.PF0f103198 -/* f103138: 3c02800a */ lui $v0,0x800a -/* f10313c: 1000001d */ b .PF0f1031b4 -/* f103140: 00001025 */ move $v0,$zero -.PF0f103144: -/* f103144: 1000001a */ b .PF0f1031b0 -/* f103148: acc80000 */ sw $t0,0x0($a2) -.PF0f10314c: -/* f10314c: 8cc90000 */ lw $t1,0x0($a2) -/* f103150: 00095040 */ sll $t2,$t1,0x1 -/* f103154: 004a5821 */ addu $t3,$v0,$t2 -/* f103158: 0fc5bdaa */ jal langGet -/* f10315c: 95640000 */ lhu $a0,0x0($t3) -/* f103160: 10000015 */ b .PF0f1031b8 -/* f103164: 8fbf0014 */ lw $ra,0x14($sp) -.PF0f103168: -/* f103168: 8ccc0000 */ lw $t4,0x0($a2) -/* f10316c: 3c02800a */ lui $v0,0x800a -/* f103170: 2442a510 */ addiu $v0,$v0,-23280 -/* f103174: a44c0482 */ sh $t4,0x482($v0) -/* f103178: 0fc5bdd7 */ jal langSetEuropean -/* f10317c: 3184ffff */ andi $a0,$t4,0xffff -/* f103180: 3c02800a */ lui $v0,0x800a -/* f103184: 2442a510 */ addiu $v0,$v0,-23280 -/* f103188: 8c4d0458 */ lw $t5,0x458($v0) -/* f10318c: 35b80005 */ ori $t8,$t5,0x5 -/* f103190: 10000007 */ b .PF0f1031b0 -/* f103194: ac580458 */ sw $t8,0x458($v0) -.PF0f103198: -/* f103198: 2442a510 */ addiu $v0,$v0,-23280 -/* f10319c: 944f0482 */ lhu $t7,0x482($v0) -/* f1031a0: 2de10005 */ sltiu $at,$t7,0x5 -/* f1031a4: 14200002 */ bnez $at,.PF0f1031b0 -/* f1031a8: accf0000 */ sw $t7,0x0($a2) -/* f1031ac: acc00000 */ sw $zero,0x0($a2) -.PF0f1031b0: -/* f1031b0: 00001025 */ move $v0,$zero -.PF0f1031b4: -/* f1031b4: 8fbf0014 */ lw $ra,0x14($sp) -.PF0f1031b8: -/* f1031b8: 27bd0028 */ addiu $sp,$sp,0x28 -/* f1031bc: 03e00008 */ jr $ra -/* f1031c0: 00000000 */ nop -); -#elif VERSION == VERSION_PAL_BETA -u16 var80071ce0pf[] = { 0x5507, 0x5508, 0x5509, 0x550a, 0x550b }; + switch (operation) { + case MENUOP_GETOPTIONCOUNT: + data->dropdown.value = 5; + break; + case MENUOP_GETOPTIONTEXT: + return (s32)langGet(labels[data->dropdown.value]); + case MENUOP_SET: + g_Vars.language = data->dropdown.value; + langSetEuropean(g_Vars.language); + g_Vars.modifiedfiles |= MODFILE_GAME | MODFILE_BOSS; + break; + case MENUOP_GETOPTIONVALUE: + data->dropdown.value = g_Vars.language; -GLOBAL_ASM( -glabel func0f1030e4pf -/* f102e4c: 27bdffd8 */ addiu $sp,$sp,-40 -/* f102e50: 3c0e8007 */ lui $t6,0x8007 -/* f102e54: afbf0014 */ sw $ra,0x14($sp) -/* f102e58: afa5002c */ sw $a1,0x2c($sp) -/* f102e5c: 25ce36cc */ addiu $t6,$t6,0x36cc -/* f102e60: 8dc10000 */ lw $at,0x0($t6) -/* f102e64: 27a2001c */ addiu $v0,$sp,0x1c -/* f102e68: 24080005 */ li $t0,0x5 -/* f102e6c: ac410000 */ sw $at,0x0($v0) -/* f102e70: 8dd90004 */ lw $t9,0x4($t6) -/* f102e74: ac590004 */ sw $t9,0x4($v0) -/* f102e78: 95c10008 */ lhu $at,0x8($t6) -/* f102e7c: a4410008 */ sh $at,0x8($v0) -/* f102e80: 24010001 */ li $at,0x1 -/* f102e84: 10810009 */ beq $a0,$at,.PB0f102eac -/* f102e88: 24010003 */ li $at,0x3 -/* f102e8c: 10810009 */ beq $a0,$at,.PB0f102eb4 -/* f102e90: 24010006 */ li $at,0x6 -/* f102e94: 1081000e */ beq $a0,$at,.PB0f102ed0 -/* f102e98: 24010007 */ li $at,0x7 -/* f102e9c: 10810018 */ beq $a0,$at,.PB0f102f00 -/* f102ea0: 3c02800a */ lui $v0,0x800a -/* f102ea4: 1000001d */ b .PB0f102f1c -/* f102ea8: 00001025 */ move $v0,$zero -.PB0f102eac: -/* f102eac: 1000001a */ b .PB0f102f18 -/* f102eb0: acc80000 */ sw $t0,0x0($a2) -.PB0f102eb4: -/* f102eb4: 8cc90000 */ lw $t1,0x0($a2) -/* f102eb8: 00095040 */ sll $t2,$t1,0x1 -/* f102ebc: 004a5821 */ addu $t3,$v0,$t2 -/* f102ec0: 0fc5c06a */ jal langGet -/* f102ec4: 95640000 */ lhu $a0,0x0($t3) -/* f102ec8: 10000015 */ b .PB0f102f20 -/* f102ecc: 8fbf0014 */ lw $ra,0x14($sp) -.PB0f102ed0: -/* f102ed0: 8ccc0000 */ lw $t4,0x0($a2) -/* f102ed4: 3c02800a */ lui $v0,0x800a -/* f102ed8: 2442e4d0 */ addiu $v0,$v0,-6960 -/* f102edc: a44c0482 */ sh $t4,0x482($v0) -/* f102ee0: 0fc5c097 */ jal langSetEuropean -/* f102ee4: 3184ffff */ andi $a0,$t4,0xffff -/* f102ee8: 3c02800a */ lui $v0,0x800a -/* f102eec: 2442e4d0 */ addiu $v0,$v0,-6960 -/* f102ef0: 8c4d0458 */ lw $t5,0x458($v0) -/* f102ef4: 35b80005 */ ori $t8,$t5,0x5 -/* f102ef8: 10000007 */ b .PB0f102f18 -/* f102efc: ac580458 */ sw $t8,0x458($v0) -.PB0f102f00: -/* f102f00: 2442e4d0 */ addiu $v0,$v0,-6960 -/* f102f04: 944f0482 */ lhu $t7,0x482($v0) -/* f102f08: 2de10005 */ sltiu $at,$t7,0x5 -/* f102f0c: 14200002 */ bnez $at,.PB0f102f18 -/* f102f10: accf0000 */ sw $t7,0x0($a2) -/* f102f14: acc00000 */ sw $zero,0x0($a2) -.PB0f102f18: -/* f102f18: 00001025 */ move $v0,$zero -.PB0f102f1c: -/* f102f1c: 8fbf0014 */ lw $ra,0x14($sp) -.PB0f102f20: -/* f102f20: 27bd0028 */ addiu $sp,$sp,0x28 -/* f102f24: 03e00008 */ jr $ra -/* f102f28: 00000000 */ nop -); + if (data->dropdown.value > LANGUAGE_PAL_ES) { + data->dropdown.value = LANGUAGE_PAL_EN; + } + break; + } + + return 0; +} #endif s32 menuhandlerScreenSplit(s32 operation, struct menuitem *item, union handlerdata *data) @@ -4475,7 +4370,7 @@ struct menuitem g_VideoOptionsMenuItems[] = { { MENUITEMTYPE_DROPDOWN, 0, 0x00000000, L_OPTIONS_216, 0x00000000, menuhandlerScreenRatio }, // "Ratio" { MENUITEMTYPE_CHECKBOX, 0, 0x00000000, L_OPTIONS_217, 0x00000000, menuhandlerHiRes }, // "Hi-Res" #if PAL - { MENUITEMTYPE_DROPDOWN, 0, 0x00000000, L_MPWEAPONS_269, 0x00000000, func0f1030e4pf }, // "Language" + { MENUITEMTYPE_DROPDOWN, 0, 0x00000000, L_MPWEAPONS_269, 0x00000000, menuhandlerLanguage }, // "Language" #endif { MENUITEMTYPE_DROPDOWN, 0, 0x00000000, L_OPTIONS_218, 0x00000000, menuhandlerScreenSplit }, // "2-Player Screen Split" { MENUITEMTYPE_CHECKBOX, 0, 0x00000000, L_MPWEAPONS_170, 0x00000000, menuhandlerAlternativeTitle }, // "Alternative Title Screen" @@ -4488,7 +4383,7 @@ struct menuitem g_2PMissionVideoOptionsMenuItems[] = { { MENUITEMTYPE_DROPDOWN, 0, 0x00000000, L_OPTIONS_216, 0x00000000, menuhandlerScreenRatio }, // "Ratio" { MENUITEMTYPE_CHECKBOX, 0, 0x00000000, L_OPTIONS_217, 0x00000000, menuhandlerHiRes }, // "Hi-Res" #if PAL - { MENUITEMTYPE_DROPDOWN, 0, 0x00000000, L_MPWEAPONS_269, 0x00000000, func0f1030e4pf }, // "Language" + { MENUITEMTYPE_DROPDOWN, 0, 0x00000000, L_MPWEAPONS_269, 0x00000000, menuhandlerLanguage }, // "Language" #endif { MENUITEMTYPE_DROPDOWN, 0, 0x00000000, L_MPWEAPONS_154, 0x00000000, menuhandlerScreenSplit }, // "Split" { MENUITEMTYPE_SEPARATOR, 0, 0x00000000, 0x00000000, 0x00000000, NULL }, diff --git a/src/include/game/mainmenu.h b/src/include/game/mainmenu.h index 64824a779..736241b9a 100644 --- a/src/include/game/mainmenu.h +++ b/src/include/game/mainmenu.h @@ -74,7 +74,7 @@ s32 menuhandlerPdModeSetting(s32 operation, struct menuitem *item, union handler s32 menuhandlerReversePitch(s32 operation, struct menuitem *item, union handlerdata *data); s32 menuhandlerScreenRatio(s32 operation, struct menuitem *item, union handlerdata *data); #if PAL -s32 func0f1030e4pf(s32 operation, struct menuitem *item, union handlerdata *data); +s32 menuhandlerLanguage(s32 operation, struct menuitem *item, union handlerdata *data); #endif s32 menuhandlerScreenSize(s32 operation, struct menuitem *item, union handlerdata *data); s32 menuhandlerScreenSplit(s32 operation, struct menuitem *item, union handlerdata *data);