Add CGameOptions

This commit is contained in:
Henrique Gemignani Passos Lima 2022-10-31 18:19:28 +02:00
parent bc0a05a424
commit fb422bead3
No known key found for this signature in database
GPG Key ID: E224F951761145F8
16 changed files with 417 additions and 57 deletions

View File

@ -517,8 +517,8 @@ AreStringsNotEqual__21CStreamedAudioManagerFPCcPCc:
/* 80365A14 00362974 38 21 00 10 */ addi r1, r1, 0x10 /* 80365A14 00362974 38 21 00 10 */ addi r1, r1, 0x10
/* 80365A18 00362978 4E 80 00 20 */ blr /* 80365A18 00362978 4E 80 00 20 */ blr
.global SetSfxVolume__21CStreamedAudioManagerFUc .global SetSfxVolume__19CStreamAudioManagerFUi
SetSfxVolume__21CStreamedAudioManagerFUc: SetSfxVolume__19CStreamAudioManagerFUi:
/* 80365A1C 0036297C 2C 03 00 7F */ cmpwi r3, 0x7f /* 80365A1C 0036297C 2C 03 00 7F */ cmpwi r3, 0x7f
/* 80365A20 00362980 90 6D 9E 7C */ stw r3, lbl_805A8A3C@sda21(r13) /* 80365A20 00362980 90 6D 9E 7C */ stw r3, lbl_805A8A3C@sda21(r13)
/* 80365A24 00362984 4C 81 00 20 */ blelr /* 80365A24 00362984 4C 81 00 20 */ blelr
@ -526,8 +526,8 @@ SetSfxVolume__21CStreamedAudioManagerFUc:
/* 80365A2C 0036298C 90 0D 9E 7C */ stw r0, lbl_805A8A3C@sda21(r13) /* 80365A2C 0036298C 90 0D 9E 7C */ stw r0, lbl_805A8A3C@sda21(r13)
/* 80365A30 00362990 4E 80 00 20 */ blr /* 80365A30 00362990 4E 80 00 20 */ blr
.global SetMusicVolume__19CStreamAudioManagerFi .global SetMusicVolume__19CStreamAudioManagerFUi
SetMusicVolume__19CStreamAudioManagerFi: SetMusicVolume__19CStreamAudioManagerFUi:
/* 80365A34 00362994 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80365A34 00362994 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 80365A38 00362998 7C 08 02 A6 */ mflr r0 /* 80365A38 00362998 7C 08 02 A6 */ mflr r0
/* 80365A3C 0036299C 2C 03 00 7F */ cmpwi r3, 0x7f /* 80365A3C 0036299C 2C 03 00 7F */ cmpwi r3, 0x7f

View File

@ -453,8 +453,8 @@ SetIsBeginSceneClearFb__9CGraphicsFb:
/* 803094A8 00306408 98 6D 9C 6C */ stb r3, mIsBeginSceneClearFb__9CGraphics@sda21(r13) /* 803094A8 00306408 98 6D 9C 6C */ stb r3, mIsBeginSceneClearFb__9CGraphics@sda21(r13)
/* 803094AC 0030640C 4E 80 00 20 */ blr /* 803094AC 0030640C 4E 80 00 20 */ blr
.global sub_803094b0 .global sub_803094b0__9CGraphicsFUiUiUi
sub_803094b0: sub_803094b0__9CGraphicsFUiUiUi:
/* 803094B0 00306410 94 21 FF E0 */ stwu r1, -0x20(r1) /* 803094B0 00306410 94 21 FF E0 */ stwu r1, -0x20(r1)
/* 803094B4 00306414 7C 08 02 A6 */ mflr r0 /* 803094B4 00306414 7C 08 02 A6 */ mflr r0
/* 803094B8 00306418 90 01 00 24 */ stw r0, 0x24(r1) /* 803094B8 00306418 90 01 00 24 */ stw r0, 0x24(r1)
@ -503,8 +503,8 @@ lbl_80309548:
/* 8030955C 003064BC 38 21 00 20 */ addi r1, r1, 0x20 /* 8030955C 003064BC 38 21 00 20 */ addi r1, r1, 0x20
/* 80309560 003064C0 4E 80 00 20 */ blr /* 80309560 003064C0 4E 80 00 20 */ blr
.global sub_80309564 .global sub_80309564__9CGraphicsFPUiPUiPUi
sub_80309564: sub_80309564__9CGraphicsFPUiPUiPUi:
/* 80309564 003064C4 28 03 00 00 */ cmplwi r3, 0 /* 80309564 003064C4 28 03 00 00 */ cmplwi r3, 0
/* 80309568 003064C8 41 82 00 0C */ beq lbl_80309574 /* 80309568 003064C8 41 82 00 0C */ beq lbl_80309574
/* 8030956C 003064CC 80 0D A8 48 */ lwz r0, lbl_805A9408@sda21(r13) /* 8030956C 003064CC 80 0D A8 48 */ lwz r0, lbl_805A9408@sda21(r13)

View File

@ -2820,7 +2820,7 @@ lbl_80244138:
/* 80244158 002410B8 7F E3 FB 78 */ mr r3, r31 /* 80244158 002410B8 7F E3 FB 78 */ mr r3, r31
/* 8024415C 002410BC 38 80 00 01 */ li r4, 1 /* 8024415C 002410BC 38 80 00 01 */ li r4, 1
/* 80244160 002410C0 38 A0 00 01 */ li r5, 1 /* 80244160 002410C0 38 A0 00 01 */ li r5, 1
/* 80244164 002410C4 4B FC AC 45 */ bl SetSurroundMode__12CGameOptionsFQ29CAudioSys14ESurroundModesi /* 80244164 002410C4 4B FC AC 45 */ bl SetSurroundMode__12CGameOptionsFQ29CAudioSys14ESurroundModesb
/* 80244168 002410C8 48 00 00 28 */ b lbl_80244190 /* 80244168 002410C8 48 00 00 28 */ b lbl_80244190
lbl_8024416C: lbl_8024416C:
/* 8024416C 002410CC 88 82 B2 21 */ lbz r4, lbl_805ACF41@sda21(r2) /* 8024416C 002410CC 88 82 B2 21 */ lbz r4, lbl_805ACF41@sda21(r2)
@ -2920,7 +2920,7 @@ lbl_80244270:
lbl_80244280: lbl_80244280:
/* 80244280 002411E0 7C C3 33 78 */ mr r3, r6 /* 80244280 002411E0 7C C3 33 78 */ mr r3, r6
/* 80244284 002411E4 38 A0 00 01 */ li r5, 1 /* 80244284 002411E4 38 A0 00 01 */ li r5, 1
/* 80244288 002411E8 4B FC AB 21 */ bl SetSurroundMode__12CGameOptionsFQ29CAudioSys14ESurroundModesi /* 80244288 002411E8 4B FC AB 21 */ bl SetSurroundMode__12CGameOptionsFQ29CAudioSys14ESurroundModesb
/* 8024428C 002411EC 48 00 00 48 */ b lbl_802442D4 /* 8024428C 002411EC 48 00 00 48 */ b lbl_802442D4
.global lbl_80244290 .global lbl_80244290
lbl_80244290: lbl_80244290:

View File

@ -205,14 +205,14 @@ lbl_8020E9C8:
/* 8020E9C8 0020B928 80 0D A1 30 */ lwz r0, gpTweakPlayerControl2@sda21(r13) /* 8020E9C8 0020B928 80 0D A1 30 */ lwz r0, gpTweakPlayerControl2@sda21(r13)
/* 8020E9CC 0020B92C 90 0D A1 28 */ stw r0, gpTweakPlayerControlCurrent@sda21(r13) /* 8020E9CC 0020B92C 90 0D A1 28 */ stw r0, gpTweakPlayerControlCurrent@sda21(r13)
lbl_8020E9D0: lbl_8020E9D0:
/* 8020E9D0 0020B930 48 00 00 15 */ bl ResetControllerAssets__12CGameOptionsFv /* 8020E9D0 0020B930 48 00 00 15 */ bl ResetControllerAssets__12CGameOptionsFi
/* 8020E9D4 0020B934 80 01 00 14 */ lwz r0, 0x14(r1) /* 8020E9D4 0020B934 80 01 00 14 */ lwz r0, 0x14(r1)
/* 8020E9D8 0020B938 7C 08 03 A6 */ mtlr r0 /* 8020E9D8 0020B938 7C 08 03 A6 */ mtlr r0
/* 8020E9DC 0020B93C 38 21 00 10 */ addi r1, r1, 0x10 /* 8020E9DC 0020B93C 38 21 00 10 */ addi r1, r1, 0x10
/* 8020E9E0 0020B940 4E 80 00 20 */ blr /* 8020E9E0 0020B940 4E 80 00 20 */ blr
.global ResetControllerAssets__12CGameOptionsFv .global ResetControllerAssets__12CGameOptionsFi
ResetControllerAssets__12CGameOptionsFv: ResetControllerAssets__12CGameOptionsFi:
/* 8020E9E4 0020B944 94 21 FF 30 */ stwu r1, -0xd0(r1) /* 8020E9E4 0020B944 94 21 FF 30 */ stwu r1, -0xd0(r1)
/* 8020E9E8 0020B948 7C 08 02 A6 */ mflr r0 /* 8020E9E8 0020B948 7C 08 02 A6 */ mflr r0
/* 8020E9EC 0020B94C 2C 04 00 01 */ cmpwi r4, 1 /* 8020E9EC 0020B94C 2C 04 00 01 */ cmpwi r4, 1
@ -402,7 +402,7 @@ lbl_8020EC44:
/* 8020EC90 0020BBF0 90 C1 00 20 */ stw r6, 0x20(r1) /* 8020EC90 0020BBF0 90 C1 00 20 */ stw r6, 0x20(r1)
/* 8020EC94 0020BBF4 90 01 00 18 */ stw r0, 0x18(r1) /* 8020EC94 0020BBF4 90 01 00 18 */ stw r0, 0x18(r1)
/* 8020EC98 0020BBF8 90 01 00 14 */ stw r0, 0x14(r1) /* 8020EC98 0020BBF8 90 01 00 14 */ stw r0, 0x14(r1)
/* 8020EC9C 0020BBFC 48 00 0D 05 */ bl sub_8020f9a0 /* 8020EC9C 0020BBFC 48 00 0D 05 */ bl "sort<Q24rstl130pointer_iterator<Q24rstl11pair<Ui,Ui>,Q24rstl55vector<Q24rstl11pair<Ui,Ui>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>,Q226@unnamed@CGameOptions_cpp@13AssetIdSorter>__4rstlFQ24rstl130pointer_iterator<Q24rstl11pair<Ui,Ui>,Q24rstl55vector<Q24rstl11pair<Ui,Ui>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>Q24rstl130pointer_iterator<Q24rstl11pair<Ui,Ui>,Q24rstl55vector<Q24rstl11pair<Ui,Ui>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>Q226@unnamed@CGameOptions_cpp@13AssetIdSorter"
lbl_8020ECA0: lbl_8020ECA0:
/* 8020ECA0 0020BC00 BA 81 00 A0 */ lmw r20, 0xa0(r1) /* 8020ECA0 0020BC00 BA 81 00 A0 */ lmw r20, 0xa0(r1)
/* 8020ECA4 0020BC04 80 01 00 D4 */ lwz r0, 0xd4(r1) /* 8020ECA4 0020BC04 80 01 00 D4 */ lwz r0, 0xd4(r1)
@ -497,8 +497,8 @@ GetHudAlpha__12CGameOptionsCFv:
/* 8020EDA0 0020BD00 38 21 00 10 */ addi r1, r1, 0x10 /* 8020EDA0 0020BD00 38 21 00 10 */ addi r1, r1, 0x10
/* 8020EDA4 0020BD04 4E 80 00 20 */ blr /* 8020EDA4 0020BD04 4E 80 00 20 */ blr
.global SetSurroundMode__12CGameOptionsFQ29CAudioSys14ESurroundModesi .global SetSurroundMode__12CGameOptionsFQ29CAudioSys14ESurroundModesb
SetSurroundMode__12CGameOptionsFQ29CAudioSys14ESurroundModesi: SetSurroundMode__12CGameOptionsFQ29CAudioSys14ESurroundModesb:
/* 8020EDA8 0020BD08 94 21 FF E0 */ stwu r1, -0x20(r1) /* 8020EDA8 0020BD08 94 21 FF E0 */ stwu r1, -0x20(r1)
/* 8020EDAC 0020BD0C 7C 08 02 A6 */ mflr r0 /* 8020EDAC 0020BD0C 7C 08 02 A6 */ mflr r0
/* 8020EDB0 0020BD10 90 01 00 24 */ stw r0, 0x24(r1) /* 8020EDB0 0020BD10 90 01 00 24 */ stw r0, 0x24(r1)
@ -544,7 +544,7 @@ SetMusicVolume__12CGameOptionsFib:
/* 8020EE40 0020BDA0 90 7E 00 5C */ stw r3, 0x5c(r30) /* 8020EE40 0020BDA0 90 7E 00 5C */ stw r3, 0x5c(r30)
/* 8020EE44 0020BDA4 41 82 00 0C */ beq lbl_8020EE50 /* 8020EE44 0020BDA4 41 82 00 0C */ beq lbl_8020EE50
/* 8020EE48 0020BDA8 80 7E 00 5C */ lwz r3, 0x5c(r30) /* 8020EE48 0020BDA8 80 7E 00 5C */ lwz r3, 0x5c(r30)
/* 8020EE4C 0020BDAC 48 15 6B E9 */ bl SetMusicVolume__19CStreamAudioManagerFi /* 8020EE4C 0020BDAC 48 15 6B E9 */ bl SetMusicVolume__19CStreamAudioManagerFUi
lbl_8020EE50: lbl_8020EE50:
/* 8020EE50 0020BDB0 80 01 00 24 */ lwz r0, 0x24(r1) /* 8020EE50 0020BDB0 80 01 00 24 */ lwz r0, 0x24(r1)
/* 8020EE54 0020BDB4 83 E1 00 1C */ lwz r31, 0x1c(r1) /* 8020EE54 0020BDB4 83 E1 00 1C */ lwz r31, 0x1c(r1)
@ -578,7 +578,7 @@ SetSfxVolume__12CGameOptionsFib:
/* 8020EEB8 0020BE18 54 03 06 3E */ clrlwi r3, r0, 0x18 /* 8020EEB8 0020BE18 54 03 06 3E */ clrlwi r3, r0, 0x18
/* 8020EEBC 0020BE1C 48 13 D6 31 */ bl SysSetSfxVolume__9CAudioSysFUcUsUcUc /* 8020EEBC 0020BE1C 48 13 D6 31 */ bl SysSetSfxVolume__9CAudioSysFUcUsUcUc
/* 8020EEC0 0020BE20 80 7E 00 58 */ lwz r3, 0x58(r30) /* 8020EEC0 0020BE20 80 7E 00 58 */ lwz r3, 0x58(r30)
/* 8020EEC4 0020BE24 48 15 6B 59 */ bl SetSfxVolume__21CStreamedAudioManagerFUc /* 8020EEC4 0020BE24 48 15 6B 59 */ bl SetSfxVolume__19CStreamAudioManagerFUi
/* 8020EEC8 0020BE28 80 1E 00 58 */ lwz r0, 0x58(r30) /* 8020EEC8 0020BE28 80 1E 00 58 */ lwz r0, 0x58(r30)
/* 8020EECC 0020BE2C 54 03 06 3E */ clrlwi r3, r0, 0x18 /* 8020EECC 0020BE2C 54 03 06 3E */ clrlwi r3, r0, 0x18
/* 8020EED0 0020BE30 48 14 C7 0D */ bl SetSfxVolume__12CMoviePlayerFUc /* 8020EED0 0020BE30 48 14 C7 0D */ bl SetSfxVolume__12CMoviePlayerFUc
@ -611,11 +611,11 @@ SetScreenStretch__12CGameOptionsFib:
/* 8020EF2C 0020BE8C 38 61 00 14 */ addi r3, r1, 0x14 /* 8020EF2C 0020BE8C 38 61 00 14 */ addi r3, r1, 0x14
/* 8020EF30 0020BE90 38 81 00 10 */ addi r4, r1, 0x10 /* 8020EF30 0020BE90 38 81 00 10 */ addi r4, r1, 0x10
/* 8020EF34 0020BE94 38 A1 00 0C */ addi r5, r1, 0xc /* 8020EF34 0020BE94 38 A1 00 0C */ addi r5, r1, 0xc
/* 8020EF38 0020BE98 48 0F A6 2D */ bl sub_80309564 /* 8020EF38 0020BE98 48 0F A6 2D */ bl sub_80309564__9CGraphicsFPUiPUiPUi
/* 8020EF3C 0020BE9C 80 7E 00 54 */ lwz r3, 0x54(r30) /* 8020EF3C 0020BE9C 80 7E 00 54 */ lwz r3, 0x54(r30)
/* 8020EF40 0020BEA0 80 81 00 10 */ lwz r4, 0x10(r1) /* 8020EF40 0020BEA0 80 81 00 10 */ lwz r4, 0x10(r1)
/* 8020EF44 0020BEA4 80 A1 00 0C */ lwz r5, 0xc(r1) /* 8020EF44 0020BEA4 80 A1 00 0C */ lwz r5, 0xc(r1)
/* 8020EF48 0020BEA8 48 0F A5 69 */ bl sub_803094b0 /* 8020EF48 0020BEA8 48 0F A5 69 */ bl sub_803094b0__9CGraphicsFUiUiUi
lbl_8020EF4C: lbl_8020EF4C:
/* 8020EF4C 0020BEAC 80 01 00 24 */ lwz r0, 0x24(r1) /* 8020EF4C 0020BEAC 80 01 00 24 */ lwz r0, 0x24(r1)
/* 8020EF50 0020BEB0 83 E1 00 1C */ lwz r31, 0x1c(r1) /* 8020EF50 0020BEB0 83 E1 00 1C */ lwz r31, 0x1c(r1)
@ -645,11 +645,11 @@ SetScreenPositionY__12CGameOptionsFib:
/* 8020EFA4 0020BF04 38 61 00 14 */ addi r3, r1, 0x14 /* 8020EFA4 0020BF04 38 61 00 14 */ addi r3, r1, 0x14
/* 8020EFA8 0020BF08 38 81 00 10 */ addi r4, r1, 0x10 /* 8020EFA8 0020BF08 38 81 00 10 */ addi r4, r1, 0x10
/* 8020EFAC 0020BF0C 38 A1 00 0C */ addi r5, r1, 0xc /* 8020EFAC 0020BF0C 38 A1 00 0C */ addi r5, r1, 0xc
/* 8020EFB0 0020BF10 48 0F A5 B5 */ bl sub_80309564 /* 8020EFB0 0020BF10 48 0F A5 B5 */ bl sub_80309564__9CGraphicsFPUiPUiPUi
/* 8020EFB4 0020BF14 80 61 00 14 */ lwz r3, 0x14(r1) /* 8020EFB4 0020BF14 80 61 00 14 */ lwz r3, 0x14(r1)
/* 8020EFB8 0020BF18 80 81 00 10 */ lwz r4, 0x10(r1) /* 8020EFB8 0020BF18 80 81 00 10 */ lwz r4, 0x10(r1)
/* 8020EFBC 0020BF1C 80 BE 00 50 */ lwz r5, 0x50(r30) /* 8020EFBC 0020BF1C 80 BE 00 50 */ lwz r5, 0x50(r30)
/* 8020EFC0 0020BF20 48 0F A4 F1 */ bl sub_803094b0 /* 8020EFC0 0020BF20 48 0F A4 F1 */ bl sub_803094b0__9CGraphicsFUiUiUi
lbl_8020EFC4: lbl_8020EFC4:
/* 8020EFC4 0020BF24 80 01 00 24 */ lwz r0, 0x24(r1) /* 8020EFC4 0020BF24 80 01 00 24 */ lwz r0, 0x24(r1)
/* 8020EFC8 0020BF28 83 E1 00 1C */ lwz r31, 0x1c(r1) /* 8020EFC8 0020BF28 83 E1 00 1C */ lwz r31, 0x1c(r1)
@ -679,11 +679,11 @@ SetScreenPositionX__12CGameOptionsFib:
/* 8020F01C 0020BF7C 38 61 00 14 */ addi r3, r1, 0x14 /* 8020F01C 0020BF7C 38 61 00 14 */ addi r3, r1, 0x14
/* 8020F020 0020BF80 38 81 00 10 */ addi r4, r1, 0x10 /* 8020F020 0020BF80 38 81 00 10 */ addi r4, r1, 0x10
/* 8020F024 0020BF84 38 A1 00 0C */ addi r5, r1, 0xc /* 8020F024 0020BF84 38 A1 00 0C */ addi r5, r1, 0xc
/* 8020F028 0020BF88 48 0F A5 3D */ bl sub_80309564 /* 8020F028 0020BF88 48 0F A5 3D */ bl sub_80309564__9CGraphicsFPUiPUiPUi
/* 8020F02C 0020BF8C 80 61 00 14 */ lwz r3, 0x14(r1) /* 8020F02C 0020BF8C 80 61 00 14 */ lwz r3, 0x14(r1)
/* 8020F030 0020BF90 80 9E 00 4C */ lwz r4, 0x4c(r30) /* 8020F030 0020BF90 80 9E 00 4C */ lwz r4, 0x4c(r30)
/* 8020F034 0020BF94 80 A1 00 0C */ lwz r5, 0xc(r1) /* 8020F034 0020BF94 80 A1 00 0C */ lwz r5, 0xc(r1)
/* 8020F038 0020BF98 48 0F A4 79 */ bl sub_803094b0 /* 8020F038 0020BF98 48 0F A4 79 */ bl sub_803094b0__9CGraphicsFUiUiUi
lbl_8020F03C: lbl_8020F03C:
/* 8020F03C 0020BF9C 80 01 00 24 */ lwz r0, 0x24(r1) /* 8020F03C 0020BF9C 80 01 00 24 */ lwz r0, 0x24(r1)
/* 8020F040 0020BFA0 83 E1 00 1C */ lwz r31, 0x1c(r1) /* 8020F040 0020BFA0 83 E1 00 1C */ lwz r31, 0x1c(r1)
@ -774,7 +774,7 @@ EnsureOptions__12CGameOptionsFv:
/* 8020F16C 0020C0CC 80 9F 00 44 */ lwz r4, 0x44(r31) /* 8020F16C 0020C0CC 80 9F 00 44 */ lwz r4, 0x44(r31)
/* 8020F170 0020C0D0 7F E3 FB 78 */ mr r3, r31 /* 8020F170 0020C0D0 7F E3 FB 78 */ mr r3, r31
/* 8020F174 0020C0D4 38 A0 00 01 */ li r5, 1 /* 8020F174 0020C0D4 38 A0 00 01 */ li r5, 1
/* 8020F178 0020C0D8 4B FF FC 31 */ bl SetSurroundMode__12CGameOptionsFQ29CAudioSys14ESurroundModesi /* 8020F178 0020C0D8 4B FF FC 31 */ bl SetSurroundMode__12CGameOptionsFQ29CAudioSys14ESurroundModesb
/* 8020F17C 0020C0DC 80 9F 00 64 */ lwz r4, 0x64(r31) /* 8020F17C 0020C0DC 80 9F 00 64 */ lwz r4, 0x64(r31)
/* 8020F180 0020C0E0 7F E3 FB 78 */ mr r3, r31 /* 8020F180 0020C0E0 7F E3 FB 78 */ mr r3, r31
/* 8020F184 0020C0E4 4B FF FB B5 */ bl SetHelmetAlpha__12CGameOptionsFi /* 8020F184 0020C0E4 4B FF FB B5 */ bl SetHelmetAlpha__12CGameOptionsFi
@ -840,7 +840,7 @@ ResetToDefaults__12CGameOptionsFv:
/* 8020F268 0020C1C8 88 03 00 68 */ lbz r0, 0x68(r3) /* 8020F268 0020C1C8 88 03 00 68 */ lbz r0, 0x68(r3)
/* 8020F26C 0020C1CC 50 80 1F 38 */ rlwimi r0, r4, 3, 0x1c, 0x1c /* 8020F26C 0020C1CC 50 80 1F 38 */ rlwimi r0, r4, 3, 0x1c, 0x1c
/* 8020F270 0020C1D0 98 03 00 68 */ stb r0, 0x68(r3) /* 8020F270 0020C1D0 98 03 00 68 */ stb r0, 0x68(r3)
/* 8020F274 0020C1D4 48 00 06 B5 */ bl InitSoundMode__12CGameOptionsFi /* 8020F274 0020C1D4 48 00 06 B5 */ bl InitSoundMode__12CGameOptionsFv
/* 8020F278 0020C1D8 7F E3 FB 78 */ mr r3, r31 /* 8020F278 0020C1D8 7F E3 FB 78 */ mr r3, r31
/* 8020F27C 0020C1DC 4B FF FE 81 */ bl EnsureOptions__12CGameOptionsFv /* 8020F27C 0020C1DC 4B FF FE 81 */ bl EnsureOptions__12CGameOptionsFv
/* 8020F280 0020C1E0 80 01 00 14 */ lwz r0, 0x14(r1) /* 8020F280 0020C1E0 80 01 00 14 */ lwz r0, 0x14(r1)
@ -1193,7 +1193,7 @@ lbl_8020F608:
/* 8020F7A0 0020C700 7F C3 F3 78 */ mr r3, r30 /* 8020F7A0 0020C700 7F C3 F3 78 */ mr r3, r30
/* 8020F7A4 0020C704 50 80 2E F6 */ rlwimi r0, r4, 5, 0x1b, 0x1b /* 8020F7A4 0020C704 50 80 2E F6 */ rlwimi r0, r4, 5, 0x1b, 0x1b
/* 8020F7A8 0020C708 98 1E 00 68 */ stb r0, 0x68(r30) /* 8020F7A8 0020C708 98 1E 00 68 */ stb r0, 0x68(r30)
/* 8020F7AC 0020C70C 48 00 01 7D */ bl InitSoundMode__12CGameOptionsFi /* 8020F7AC 0020C70C 48 00 01 7D */ bl InitSoundMode__12CGameOptionsFv
/* 8020F7B0 0020C710 80 01 00 24 */ lwz r0, 0x24(r1) /* 8020F7B0 0020C710 80 01 00 24 */ lwz r0, 0x24(r1)
/* 8020F7B4 0020C714 7F C3 F3 78 */ mr r3, r30 /* 8020F7B4 0020C714 7F C3 F3 78 */ mr r3, r30
/* 8020F7B8 0020C718 83 E1 00 1C */ lwz r31, 0x1c(r1) /* 8020F7B8 0020C718 83 E1 00 1C */ lwz r31, 0x1c(r1)
@ -1293,7 +1293,7 @@ lbl_8020F87C:
/* 8020F900 0020C860 90 BF 00 70 */ stw r5, 0x70(r31) /* 8020F900 0020C860 90 BF 00 70 */ stw r5, 0x70(r31)
/* 8020F904 0020C864 90 BF 00 74 */ stw r5, 0x74(r31) /* 8020F904 0020C864 90 BF 00 74 */ stw r5, 0x74(r31)
/* 8020F908 0020C868 90 BF 00 78 */ stw r5, 0x78(r31) /* 8020F908 0020C868 90 BF 00 78 */ stw r5, 0x78(r31)
/* 8020F90C 0020C86C 48 00 00 1D */ bl InitSoundMode__12CGameOptionsFi /* 8020F90C 0020C86C 48 00 00 1D */ bl InitSoundMode__12CGameOptionsFv
/* 8020F910 0020C870 80 01 00 14 */ lwz r0, 0x14(r1) /* 8020F910 0020C870 80 01 00 14 */ lwz r0, 0x14(r1)
/* 8020F914 0020C874 7F E3 FB 78 */ mr r3, r31 /* 8020F914 0020C874 7F E3 FB 78 */ mr r3, r31
/* 8020F918 0020C878 83 E1 00 0C */ lwz r31, 0xc(r1) /* 8020F918 0020C878 83 E1 00 0C */ lwz r31, 0xc(r1)
@ -1301,8 +1301,8 @@ lbl_8020F87C:
/* 8020F920 0020C880 38 21 00 10 */ addi r1, r1, 0x10 /* 8020F920 0020C880 38 21 00 10 */ addi r1, r1, 0x10
/* 8020F924 0020C884 4E 80 00 20 */ blr /* 8020F924 0020C884 4E 80 00 20 */ blr
.global InitSoundMode__12CGameOptionsFi .global InitSoundMode__12CGameOptionsFv
InitSoundMode__12CGameOptionsFi: InitSoundMode__12CGameOptionsFv:
/* 8020F928 0020C888 94 21 FF F0 */ stwu r1, -0x10(r1) /* 8020F928 0020C888 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 8020F92C 0020C88C 7C 08 02 A6 */ mflr r0 /* 8020F92C 0020C88C 7C 08 02 A6 */ mflr r0
/* 8020F930 0020C890 90 01 00 14 */ stw r0, 0x14(r1) /* 8020F930 0020C890 90 01 00 14 */ stw r0, 0x14(r1)
@ -1343,8 +1343,8 @@ lbl_8020F990:
/* 8020F99C 0020C8FC 4E 80 00 20 */ blr /* 8020F99C 0020C8FC 4E 80 00 20 */ blr
.global sub_8020f9a0 .global "sort<Q24rstl130pointer_iterator<Q24rstl11pair<Ui,Ui>,Q24rstl55vector<Q24rstl11pair<Ui,Ui>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>,Q226@unnamed@CGameOptions_cpp@13AssetIdSorter>__4rstlFQ24rstl130pointer_iterator<Q24rstl11pair<Ui,Ui>,Q24rstl55vector<Q24rstl11pair<Ui,Ui>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>Q24rstl130pointer_iterator<Q24rstl11pair<Ui,Ui>,Q24rstl55vector<Q24rstl11pair<Ui,Ui>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>Q226@unnamed@CGameOptions_cpp@13AssetIdSorter"
sub_8020f9a0: "sort<Q24rstl130pointer_iterator<Q24rstl11pair<Ui,Ui>,Q24rstl55vector<Q24rstl11pair<Ui,Ui>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>,Q226@unnamed@CGameOptions_cpp@13AssetIdSorter>__4rstlFQ24rstl130pointer_iterator<Q24rstl11pair<Ui,Ui>,Q24rstl55vector<Q24rstl11pair<Ui,Ui>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>Q24rstl130pointer_iterator<Q24rstl11pair<Ui,Ui>,Q24rstl55vector<Q24rstl11pair<Ui,Ui>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>Q226@unnamed@CGameOptions_cpp@13AssetIdSorter":
/* 8020F9A0 0020C900 94 21 FF B0 */ stwu r1, -0x50(r1) /* 8020F9A0 0020C900 94 21 FF B0 */ stwu r1, -0x50(r1)
/* 8020F9A4 0020C904 7C 08 02 A6 */ mflr r0 /* 8020F9A4 0020C904 7C 08 02 A6 */ mflr r0
/* 8020F9A8 0020C908 90 01 00 54 */ stw r0, 0x54(r1) /* 8020F9A8 0020C908 90 01 00 54 */ stw r0, 0x54(r1)
@ -1445,7 +1445,7 @@ lbl_8020FAF4:
/* 8020FB0C 0020CA6C 98 E1 00 0C */ stb r7, 0xc(r1) /* 8020FB0C 0020CA6C 98 E1 00 0C */ stb r7, 0xc(r1)
/* 8020FB10 0020CA70 90 C1 00 20 */ stw r6, 0x20(r1) /* 8020FB10 0020CA70 90 C1 00 20 */ stw r6, 0x20(r1)
/* 8020FB14 0020CA74 90 01 00 24 */ stw r0, 0x24(r1) /* 8020FB14 0020CA74 90 01 00 24 */ stw r0, 0x24(r1)
/* 8020FB18 0020CA78 4B FF FE 89 */ bl sub_8020f9a0 /* 8020FB18 0020CA78 4B FF FE 89 */ bl "sort<Q24rstl130pointer_iterator<Q24rstl11pair<Ui,Ui>,Q24rstl55vector<Q24rstl11pair<Ui,Ui>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>,Q226@unnamed@CGameOptions_cpp@13AssetIdSorter>__4rstlFQ24rstl130pointer_iterator<Q24rstl11pair<Ui,Ui>,Q24rstl55vector<Q24rstl11pair<Ui,Ui>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>Q24rstl130pointer_iterator<Q24rstl11pair<Ui,Ui>,Q24rstl55vector<Q24rstl11pair<Ui,Ui>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>Q226@unnamed@CGameOptions_cpp@13AssetIdSorter"
/* 8020FB1C 0020CA7C 88 FF 00 00 */ lbz r7, 0(r31) /* 8020FB1C 0020CA7C 88 FF 00 00 */ lbz r7, 0(r31)
/* 8020FB20 0020CA80 38 61 00 1C */ addi r3, r1, 0x1c /* 8020FB20 0020CA80 38 61 00 1C */ addi r3, r1, 0x1c
/* 8020FB24 0020CA84 80 DE 00 00 */ lwz r6, 0(r30) /* 8020FB24 0020CA84 80 DE 00 00 */ lwz r6, 0(r30)
@ -1455,7 +1455,7 @@ lbl_8020FAF4:
/* 8020FB34 0020CA94 98 E1 00 08 */ stb r7, 8(r1) /* 8020FB34 0020CA94 98 E1 00 08 */ stb r7, 8(r1)
/* 8020FB38 0020CA98 90 C1 00 18 */ stw r6, 0x18(r1) /* 8020FB38 0020CA98 90 C1 00 18 */ stw r6, 0x18(r1)
/* 8020FB3C 0020CA9C 90 01 00 1C */ stw r0, 0x1c(r1) /* 8020FB3C 0020CA9C 90 01 00 1C */ stw r0, 0x1c(r1)
/* 8020FB40 0020CAA0 4B FF FE 61 */ bl sub_8020f9a0 /* 8020FB40 0020CAA0 4B FF FE 61 */ bl "sort<Q24rstl130pointer_iterator<Q24rstl11pair<Ui,Ui>,Q24rstl55vector<Q24rstl11pair<Ui,Ui>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>,Q226@unnamed@CGameOptions_cpp@13AssetIdSorter>__4rstlFQ24rstl130pointer_iterator<Q24rstl11pair<Ui,Ui>,Q24rstl55vector<Q24rstl11pair<Ui,Ui>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>Q24rstl130pointer_iterator<Q24rstl11pair<Ui,Ui>,Q24rstl55vector<Q24rstl11pair<Ui,Ui>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>Q226@unnamed@CGameOptions_cpp@13AssetIdSorter"
lbl_8020FB44: lbl_8020FB44:
/* 8020FB44 0020CAA4 80 01 00 54 */ lwz r0, 0x54(r1) /* 8020FB44 0020CAA4 80 01 00 54 */ lwz r0, 0x54(r1)
/* 8020FB48 0020CAA8 83 E1 00 4C */ lwz r31, 0x4c(r1) /* 8020FB48 0020CAA8 83 E1 00 4C */ lwz r31, 0x4c(r1)

View File

@ -553,7 +553,7 @@ lbl_802494E0:
/* 8024953C 0024649C 90 C1 00 20 */ stw r6, 0x20(r1) /* 8024953C 0024649C 90 C1 00 20 */ stw r6, 0x20(r1)
/* 80249540 002464A0 90 01 00 18 */ stw r0, 0x18(r1) /* 80249540 002464A0 90 01 00 18 */ stw r0, 0x18(r1)
/* 80249544 002464A4 90 01 00 14 */ stw r0, 0x14(r1) /* 80249544 002464A4 90 01 00 14 */ stw r0, 0x14(r1)
/* 80249548 002464A8 4B FC 64 59 */ bl sub_8020f9a0 /* 80249548 002464A8 4B FC 64 59 */ bl "sort<Q24rstl130pointer_iterator<Q24rstl11pair<Ui,Ui>,Q24rstl55vector<Q24rstl11pair<Ui,Ui>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>,Q226@unnamed@CGameOptions_cpp@13AssetIdSorter>__4rstlFQ24rstl130pointer_iterator<Q24rstl11pair<Ui,Ui>,Q24rstl55vector<Q24rstl11pair<Ui,Ui>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>Q24rstl130pointer_iterator<Q24rstl11pair<Ui,Ui>,Q24rstl55vector<Q24rstl11pair<Ui,Ui>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>Q226@unnamed@CGameOptions_cpp@13AssetIdSorter"
lbl_8024954C: lbl_8024954C:
/* 8024954C 002464AC 38 60 00 00 */ li r3, 0 /* 8024954C 002464AC 38 60 00 00 */ li r3, 0
lbl_80249550: lbl_80249550:
@ -2805,4 +2805,3 @@ lbl_803D4780:
.asciz "INT_Hints" .asciz "INT_Hints"
.balign 4 .balign 4
.4byte 0 .4byte 0

View File

@ -5901,7 +5901,7 @@ __ct__24CGameArchitectureSupportFR10COsContext:
/* 80007228 00004188 48 34 35 E5 */ bl SetVolumeScale__9CAudioSysFs /* 80007228 00004188 48 34 35 E5 */ bl SetVolumeScale__9CAudioSysFs
/* 8000722C 0000418C 48 35 D4 29 */ bl Initialize__17CDSPStreamManagerFv /* 8000722C 0000418C 48 35 D4 29 */ bl Initialize__17CDSPStreamManagerFv
/* 80007230 00004190 38 60 00 7F */ li r3, 0x7f /* 80007230 00004190 38 60 00 7F */ li r3, 0x7f
/* 80007234 00004194 48 35 E8 01 */ bl SetMusicVolume__19CStreamAudioManagerFi /* 80007234 00004194 48 35 E8 01 */ bl SetMusicVolume__19CStreamAudioManagerFUi
/* 80007238 00004198 38 60 00 01 */ li r3, 1 /* 80007238 00004198 38 60 00 01 */ li r3, 1
/* 8000723C 0000419C 48 34 40 A1 */ bl TrkSetSampleRate__9CAudioSysF14ETRKSampleRate /* 8000723C 0000419C 48 34 40 A1 */ bl TrkSetSampleRate__9CAudioSysF14ETRKSampleRate
/* 80007240 000041A0 80 6D A0 78 */ lwz r3, gpMain@sda21(r13) /* 80007240 000041A0 80 6D A0 78 */ lwz r3, gpMain@sda21(r13)

View File

@ -315,7 +315,7 @@ LIBS = [
["MetroidPrime/ScriptObjects/CScriptMidi", False], ["MetroidPrime/ScriptObjects/CScriptMidi", False],
"MetroidPrime/ScriptObjects/CScriptStreamedAudio", "MetroidPrime/ScriptObjects/CScriptStreamedAudio",
"MetroidPrime/CRagDoll", "MetroidPrime/CRagDoll",
"MetroidPrime/Player/CGameOptions", ["MetroidPrime/Player/CGameOptions", False],
["MetroidPrime/ScriptObjects/CRepulsor", True], ["MetroidPrime/ScriptObjects/CRepulsor", True],
"MetroidPrime/CEnvFxManager", "MetroidPrime/CEnvFxManager",
"MetroidPrime/Weapons/CEnergyProjectile", "MetroidPrime/Weapons/CEnergyProjectile",

View File

@ -15,12 +15,17 @@ enum ETRKRepeatMode {
class CAudioSys { class CAudioSys {
public: public:
enum ESurroundModes { kSM_Mono, kSM_Stereo, kSM_Surround };
CAudioSys(uchar, uchar, uchar, uchar, uint); CAudioSys(uchar, uchar, uchar, uchar, uint);
~CAudioSys(); ~CAudioSys();
static void SysSetVolume(uchar, uint, uchar); static void SysSetVolume(uchar, uint, uchar);
static void SysSetSfxVolume(uchar, ushort, uchar, uchar);
static void SetDefaultVolumeScale(short); static void SetDefaultVolumeScale(short);
static void SetVolumeScale(short); static void SetVolumeScale(short);
static void SetSurroundMode(ESurroundModes);
static void TrkSetSampleRate(ETRKSampleRate); static void TrkSetSampleRate(ETRKSampleRate);
static short GetDefaultVolumeScale(); static short GetDefaultVolumeScale();

View File

@ -7,7 +7,8 @@ class CStreamAudioManager {
public: public:
static void Update(float dt); static void Update(float dt);
static void StopAll(); static void StopAll();
static void SetMusicVolume(uchar); static void SetMusicVolume(uint);
static void SetSfxVolume(uint);
private: private:
}; };

View File

@ -126,6 +126,7 @@ public:
static const CTransform4f& GetViewMatrix() { return mViewMatrix; } static const CTransform4f& GetViewMatrix() { return mViewMatrix; }
static const CTransform4f& GetModelMatrix() { return mModelMatrix; } static const CTransform4f& GetModelMatrix() { return mModelMatrix; }
static void SetBrightness(float b) { mBrightness = b; }
static float GetSecondsMod900(); static float GetSecondsMod900();
static void SetExternalTimeProvider(CTimeProvider* provider); static void SetExternalTimeProvider(CTimeProvider* provider);
@ -137,6 +138,10 @@ public:
static void SetDepthWriteMode(bool test, ERglEnum comp, bool write); static void SetDepthWriteMode(bool test, ERglEnum comp, bool write);
static void SetBlendMode(ERglBlendMode, ERglBlendFactor, ERglBlendFactor, ERglLogicOp); static void SetBlendMode(ERglBlendMode, ERglBlendFactor, ERglBlendFactor, ERglLogicOp);
// Screen Position
static void sub_80309564(uint* stretch, uint* xOffset, uint* yOffset);
static void sub_803094b0(uint stretch, uint xOffset, uint yOffset);
static CTevCombiners::CTevPass& kEnvPassthru; static CTevCombiners::CTevPass& kEnvPassthru;
static CTevCombiners::CTevPass kEnvModulateConstColor; static CTevCombiners::CTevPass kEnvModulateConstColor;
static CTevCombiners::CTevPass kEnvConstColor; static CTevCombiners::CTevPass kEnvConstColor;
@ -151,6 +156,7 @@ public:
private: private:
static CTransform4f mViewMatrix; static CTransform4f mViewMatrix;
static CTransform4f mModelMatrix; static CTransform4f mModelMatrix;
static float mBrightness;
}; };
#endif // _CGRAPHICS #endif // _CGRAPHICS

View File

@ -0,0 +1,11 @@
#ifndef _CMOVIEPLAYER
#define _CMOVIEPLAYER
#include "types.h"
class CMoviePlayer {
public:
static void SetSfxVolume(uchar);
};
#endif // _CMOVIEPLAYER

View File

@ -8,34 +8,61 @@
#include "rstl/vector.hpp" #include "rstl/vector.hpp"
#include "Kyoto/SObjectTag.hpp" #include "Kyoto/SObjectTag.hpp"
#include "Kyoto/Streams/CInputStream.hpp" #include "Kyoto/Audio/CAudioSys.hpp"
#include "MetroidPrime/TGameTypes.hpp" #include "MetroidPrime/TGameTypes.hpp"
class CInputStream;
class CMemoryStreamOut;
class CGameOptions { class CGameOptions {
public: public:
CGameOptions(); CGameOptions();
CGameOptions(CInputStream& in); CGameOptions(CInputStream& in);
void PutTo(CMemoryStreamOut&);
void InitSoundMode();
void ResetToDefaults();
void EnsureOptions(); void EnsureOptions();
void SetScreenBrightness(int, bool);
float TuneScreenBrightness();
void SetScreenPositionX(int, bool);
void SetScreenPositionY(int, bool);
void SetScreenStretch(int, bool);
void SetSfxVolume(int, bool);
void SetMusicVolume(int, bool);
void SetSurroundMode(CAudioSys::ESurroundModes, bool);
float GetHudAlpha() const;
float GetHelmetAlpha() const;
void SetHelmetAlpha(int);
void SetHUDLag(bool);
void SetIsHintSystemEnabled(bool);
void SetInvertYAxis(bool);
void ToggleControls(bool);
void ResetControllerAssets(int);
void SetControls(int);
void SetIsRumbleEnabled(bool rumble); void SetIsRumbleEnabled(bool rumble);
bool GetIsRumbleEnabled() const { return x68_26_rumble; } bool GetIsRumbleEnabled() const { return x68_26_rumble; }
private: private:
rstl::reserved_vector< bool, 64 > x0_; rstl::reserved_vector< uchar, 64 > x0_;
int x44_soundMode; // CAudioSys::ESurroundModes int x44_soundMode;
uint x48_screenBrightness; int x48_screenBrightness;
int x4c_screenXOffset; int x4c_screenXOffset;
int x50_screenYOffset; int x50_screenYOffset;
int x54_screenStretch; int x54_screenStretch;
uint x58_sfxVol; uint x58_sfxVol;
uint x5c_musicVol; uint x5c_musicVol;
uint x60_hudAlpha; int x60_hudAlpha;
uint x64_helmetAlpha; int x64_helmetAlpha;
bool x68_24_hudLag : 1; bool x68_24_hudLag : 1;
bool x68_25_invertY : 1; bool x68_25_invertY : 1;
bool x68_26_rumble : 1; bool x68_26_rumble : 1;
bool x68_27_swapBeamsControls : 1; uchar x68_27_swapBeamsControls : 1;
bool x68_28_hintSystem : 1; bool x68_28_hintSystem : 1;
rstl::vector< rstl::pair< CAssetId, CAssetId > > x6c_controlTxtrMap; rstl::vector< rstl::pair< CAssetId, CAssetId > > x6c_controlTxtrMap;
}; };

View File

@ -23,5 +23,7 @@ private:
CHECK_SIZEOF(CTweaks, 0x64) CHECK_SIZEOF(CTweaks, 0x64)
extern CTweakPlayerControl* gpTweakPlayerControlCurrent; extern CTweakPlayerControl* gpTweakPlayerControlCurrent;
extern CTweakPlayerControl* gpTweakPlayerControl1;
extern CTweakPlayerControl* gpTweakPlayerControl2;
#endif // _CTWEAKS #endif // _CTWEAKS

View File

@ -77,7 +77,7 @@ public:
++x4_count; ++x4_count;
} }
vector& operator=(const vector& other) { vector& operator=(const vector& other); /* {
if (this == &other) if (this == &other)
return *this; return *this;
clear(); clear();
@ -92,7 +92,7 @@ public:
x4_count = other.x4_count; x4_count = other.x4_count;
} }
return *this; return *this;
} }*/
void clear() { void clear() {
destroy(begin(), end()); destroy(begin(), end());
@ -115,7 +115,7 @@ public:
protected: protected:
template < typename In > template < typename In >
void insert_into(iterator at, int n, In in); /* { void insert_into(iterator at, int n, In in) {
int insertAt = xc_items + n; int insertAt = xc_items + n;
if (x8_capacity < insertAt) { if (x8_capacity < insertAt) {
int newCapacity = x8_capacity != 0 ? x8_capacity * 2 : 4; int newCapacity = x8_capacity != 0 ? x8_capacity * 2 : 4;
@ -123,7 +123,7 @@ protected:
x0_allocator.allocate(newData, newCapacity); x0_allocator.allocate(newData, newCapacity);
} }
}*/ }
}; };
template < typename T, typename Alloc > template < typename T, typename Alloc >

View File

@ -35,12 +35,8 @@ void CBSKnockBack::Start(CBodyController& bc, CStateManager& mgr) {
if (!parm2.GetBoolValue()) { if (!parm2.GetBoolValue()) {
CPASAnimParm parm0(animState->GetAnimParmData(best.second, 0)); CPASAnimParm parm0(animState->GetAnimParmData(best.second, 0));
float knockdownAngle = parm0.GetReal32Value(); float knockdownAngle = parm0.GetReal32Value();
float delta1 = CAbsAngle::FromRadians(angle.AsRadians() - float delta1 = CAbsAngle::FromRadians(angle.AsRadians() - CRelAngle::FromDegrees(knockdownAngle).AsRadians()).AsRadians();
CRelAngle::FromDegrees(knockdownAngle).AsRadians()) float delta2 = CAbsAngle::FromRadians(CRelAngle::FromDegrees(knockdownAngle).AsRadians() - angle.AsRadians()).AsRadians();
.AsRadians();
float delta2 = CAbsAngle::FromRadians(CRelAngle::FromDegrees(knockdownAngle).AsRadians() -
angle.AsRadians())
.AsRadians();
float minAngle = rstl::min_val(delta1, delta2); float minAngle = rstl::min_val(delta1, delta2);
// There's missing code here. Same problem in CBSFall, see there for details // There's missing code here. Same problem in CBSFall, see there for details
const float flippedAngle = (delta1 > M_PIF) ? -minAngle : minAngle; const float flippedAngle = (delta1 > M_PIF) ? -minAngle : minAngle;

View File

@ -0,0 +1,313 @@
#include "MetroidPrime/Player/CGameOptions.hpp"
#include "MetroidPrime/Tweaks/CTweaks.hpp"
#include "Kyoto/Audio/CStreamAudioManager.hpp"
#include "Kyoto/Graphics/CGraphics.hpp"
#include "Kyoto/Graphics/CMoviePlayer.hpp"
#include "Kyoto/Math/CMath.hpp"
#include "Kyoto/Streams/CInputStream.hpp"
#include "Kyoto/Streams/CMemoryStreamOut.hpp"
#include "rstl/algorithm.hpp"
#include "dolphin/os.h"
namespace rstl {
// template < class It, class Cmp >
// void sort(It first, It last, Cmp cmp) {
// // TODO: proper implementation
// cmp(*first, *last);
// }
} // namespace rstl
namespace {
class AssetIdSorter {
public:
AssetIdSorter() {}
bool operator()(const rstl::pair< CAssetId, CAssetId >& a,
const rstl::pair< CAssetId, CAssetId >& b) {
return a.first < b.first;
}
};
} // namespace
int CalculateBits(int i) {
int result = 0;
for (uint j = i; j != 0; j = j >> 1) {
result += 1;
}
return result;
}
inline void WriteValue(CMemoryStreamOut& out, uint value, int maxSize) {
out.WriteBits(value, CalculateBits(maxSize));
}
void CGameOptions::InitSoundMode() {
if (OSGetSoundMode() == 0) {
x44_soundMode = 0;
} else {
x44_soundMode = (x44_soundMode != 0) ? x44_soundMode : 1;
}
}
CGameOptions::CGameOptions()
: x0_(0)
, x44_soundMode(1)
, x48_screenBrightness(4)
, x4c_screenXOffset(0)
, x50_screenYOffset(0)
, x54_screenStretch(0)
, x58_sfxVol(0x7f)
, x5c_musicVol(0x7f)
, x60_hudAlpha(0xff)
, x64_helmetAlpha(0xff)
, x68_24_hudLag(true)
, x68_25_invertY(false)
, x68_26_rumble(true)
, x68_27_swapBeamsControls(false)
, x68_28_hintSystem(true) {
InitSoundMode();
}
CGameOptions::CGameOptions(CInputStream& in)
: x0_(0)
, x44_soundMode(1)
, x48_screenBrightness(4)
, x4c_screenXOffset(0)
, x50_screenYOffset(0)
, x54_screenStretch(0)
, x58_sfxVol(0x7f)
, x5c_musicVol(0x7f)
, x60_hudAlpha(0xff)
, x64_helmetAlpha(0xff)
, x68_24_hudLag(true)
, x68_25_invertY(false)
, x68_26_rumble(true)
, x68_27_swapBeamsControls(false)
, x68_28_hintSystem(true) {
for (int i = 0; i < x0_.size(); ++i) {
x0_[i] = in.ReadBits(8);
}
x44_soundMode = in.ReadBits(CalculateBits(2));
x48_screenBrightness = in.ReadBits(CalculateBits(8));
x4c_screenXOffset = in.ReadBits(CalculateBits(0x3c)) - 0x1e;
x50_screenYOffset = in.ReadBits(CalculateBits(0x3c)) - 0x1e;
x54_screenStretch = in.ReadBits(CalculateBits(0x14)) - 10;
x58_sfxVol = in.ReadBits(CalculateBits(0x7f));
x5c_musicVol = in.ReadBits(CalculateBits(0x7f));
x60_hudAlpha = in.ReadBits(CalculateBits(0xff));
x64_helmetAlpha = in.ReadBits(CalculateBits(0xff));
x68_24_hudLag = in.ReadPackedBool();
x68_28_hintSystem = in.ReadPackedBool();
x68_25_invertY = in.ReadPackedBool();
x68_26_rumble = in.ReadPackedBool();
x68_27_swapBeamsControls = in.ReadPackedBool();
InitSoundMode();
}
void CGameOptions::PutTo(CMemoryStreamOut& out) {
for (int i = 0; i < x0_.size(); ++i) {
out.WriteBits(x0_[i], 8);
}
WriteValue(out, x44_soundMode, 2);
WriteValue(out, x48_screenBrightness, 8);
WriteValue(out, x4c_screenXOffset + 0x1e, 0x3c);
WriteValue(out, x50_screenYOffset + 0x1e, 0x3c);
WriteValue(out, x54_screenStretch + 10, 0x14);
WriteValue(out, x58_sfxVol, 0x7f);
WriteValue(out, x5c_musicVol, 0x7f);
WriteValue(out, x60_hudAlpha, 0xff);
WriteValue(out, x64_helmetAlpha, 0xff);
out.WriteBits(x68_24_hudLag != false, 1);
out.WriteBits(x68_28_hintSystem != false, 1);
out.WriteBits(x68_25_invertY != false, 1);
out.WriteBits(x68_26_rumble != false, 1);
out.WriteBits(x68_27_swapBeamsControls != false, 1);
}
void CGameOptions::ResetToDefaults() {
x48_screenBrightness = 4;
x4c_screenXOffset = 0;
x50_screenYOffset = 0;
x54_screenStretch = 0;
x58_sfxVol = 0x7f;
x5c_musicVol = 0x7f;
x44_soundMode = CAudioSys::kSM_Stereo;
x60_hudAlpha = 0xff;
x64_helmetAlpha = 0xff;
x68_24_hudLag = true;
x68_25_invertY = false;
x68_26_rumble = true;
x68_27_swapBeamsControls = false;
x68_28_hintSystem = true;
InitSoundMode();
EnsureOptions();
}
void CGameOptions::EnsureOptions() {
SetScreenBrightness(x48_screenBrightness, true);
SetScreenPositionX(x4c_screenXOffset, true);
SetScreenPositionY(x50_screenYOffset, true);
SetScreenStretch(x54_screenStretch, true);
SetSfxVolume(x58_sfxVol, true);
SetMusicVolume(x5c_musicVol, true);
SetSurroundMode(CAudioSys::ESurroundModes(x44_soundMode), true);
SetHelmetAlpha(x64_helmetAlpha);
SetHUDLag(x68_24_hudLag);
SetInvertYAxis(x68_25_invertY);
SetIsRumbleEnabled(x68_26_rumble);
SetIsHintSystemEnabled(x68_28_hintSystem);
ToggleControls(x68_27_swapBeamsControls);
}
void CGameOptions::SetScreenBrightness(int value, bool apply) {
x48_screenBrightness = CMath::Clamp(0, value, 8);
if (apply) {
CGraphics::SetBrightness(TuneScreenBrightness());
}
}
float CGameOptions::TuneScreenBrightness() {
float f = x48_screenBrightness - 4;
return f * 0.25f * 0.375f + 1.f;
}
void CGameOptions::SetScreenPositionX(int position, bool apply) {
x4c_screenXOffset = CMath::Clamp(-30, position, 30);
if (apply) {
uint a, b, c;
CGraphics::sub_80309564(&a, &b, &c);
CGraphics::sub_803094b0(a, x4c_screenXOffset, c);
}
}
void CGameOptions::SetScreenPositionY(int position, bool apply) {
x50_screenYOffset = CMath::Clamp(-30, position, 30);
if (apply) {
uint a, b, c;
CGraphics::sub_80309564(&a, &b, &c);
CGraphics::sub_803094b0(a, b, x50_screenYOffset);
}
}
void CGameOptions::SetScreenStretch(int value, bool apply) {
x54_screenStretch = CMath::Clamp(-10, value, 10);
if (apply) {
uint a, b, c;
CGraphics::sub_80309564(&a, &b, &c);
CGraphics::sub_803094b0(x54_screenStretch, b, c);
}
}
void CGameOptions::SetSfxVolume(int value, bool apply) {
x58_sfxVol = CMath::Clamp(0, value, 0x7f);
if (apply) {
CAudioSys::SysSetSfxVolume(x58_sfxVol, 1, true, true);
CStreamAudioManager::SetSfxVolume(x58_sfxVol);
CMoviePlayer::SetSfxVolume(x58_sfxVol);
}
}
void CGameOptions::SetMusicVolume(int value, bool apply) {
x5c_musicVol = CMath::Clamp(0, value, 0x7f);
if (apply) {
CStreamAudioManager::SetMusicVolume(x5c_musicVol);
}
}
void CGameOptions::SetSurroundMode(CAudioSys::ESurroundModes mode, bool apply) {
x44_soundMode = CMath::Clamp< int >(0, mode, 2);
if (apply) {
CAudioSys::SetSurroundMode(CAudioSys::ESurroundModes(x44_soundMode));
}
}
float CGameOptions::GetHudAlpha() const { return x60_hudAlpha * 0.003921569f; }
float CGameOptions::GetHelmetAlpha() const { return x64_helmetAlpha * 0.003921569f; }
void CGameOptions::SetHelmetAlpha(int alpha) { x64_helmetAlpha = alpha; }
void CGameOptions::SetHUDLag(bool flag) { x68_24_hudLag = flag; }
void CGameOptions::SetIsHintSystemEnabled(bool flag) { x68_28_hintSystem = flag; }
void CGameOptions::SetInvertYAxis(bool flag) { x68_25_invertY = flag; }
void CGameOptions::SetIsRumbleEnabled(bool flag) { x68_26_rumble = flag; }
void CGameOptions::ToggleControls(bool flag) {
x68_27_swapBeamsControls = flag;
if (flag) {
SetControls(1);
} else {
SetControls(0);
}
}
void CGameOptions::ResetControllerAssets(int controls) {
switch (controls) {
case 0: {
x6c_controlTxtrMap = rstl::vector< rstl::pair< CAssetId, CAssetId > >();
break;
}
case 1: {
if (x6c_controlTxtrMap.empty()) {
const rstl::pair< CAssetId, CAssetId > CStickToDPadRemap[] = {
rstl::pair< CAssetId, CAssetId >(0x2A13C23Eu, 0xF13452F8u),
rstl::pair< CAssetId, CAssetId >(0xA91A7703u, 0xC042EC91u),
rstl::pair< CAssetId, CAssetId >(0x12A12131u, 0x5F556002u),
rstl::pair< CAssetId, CAssetId >(0xA9798329u, 0xB306E26Fu),
rstl::pair< CAssetId, CAssetId >(0xCD7B1ACAu, 0x8ADA8184u),
};
const rstl::pair< CAssetId, CAssetId > CStickOutlineToDPadRemap[] = {
rstl::pair< CAssetId, CAssetId >(0x1A29C0E6u, 0xF13452F8u),
rstl::pair< CAssetId, CAssetId >(0x5D9F9796u, 0xC042EC91u),
rstl::pair< CAssetId, CAssetId >(0x951546A8u, 0x5F556002u),
rstl::pair< CAssetId, CAssetId >(0x7946C4C5u, 0xB306E26Fu),
rstl::pair< CAssetId, CAssetId >(0x409AA72Eu, 0x8ADA8184u),
};
x6c_controlTxtrMap.reserve(15);
for (int i = 0; i < 5; ++i) {
x6c_controlTxtrMap.push_back(rstl::pair< CAssetId, CAssetId >(CStickToDPadRemap[i].first,
CStickToDPadRemap[i].second));
x6c_controlTxtrMap.push_back(rstl::pair< CAssetId, CAssetId >(CStickToDPadRemap[i].second,
CStickToDPadRemap[i].first));
}
for (int i = 0; i < 5; ++i) {
rstl::pair< CAssetId, CAssetId > value(CStickOutlineToDPadRemap[i]);
x6c_controlTxtrMap.push_back(value);
}
rstl::sort(x6c_controlTxtrMap.begin(), x6c_controlTxtrMap.end(), AssetIdSorter());
}
break;
}
}
}
void CGameOptions::SetControls(int controls) {
switch (controls) {
case 0:
gpTweakPlayerControlCurrent = gpTweakPlayerControl1;
break;
case 1:
gpTweakPlayerControlCurrent = gpTweakPlayerControl2;
break;
}
ResetControllerAssets(controls);
}