Skip to content

Commit

Permalink
CGameOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
henriquegemignani committed Sep 8, 2024
1 parent a96b245 commit 289df2c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 13 deletions.
2 changes: 1 addition & 1 deletion config/G2ME01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ fn_80008B60 = .text:0x80008B60; // type:function size:0xC8
fn_80008C28 = .text:0x80008C28; // type:function size:0xB8
fn_80008CE0 = .text:0x80008CE0; // type:function size:0x88
fn_80008D68 = .text:0x80008D68; // type:function size:0x80
fn_80008DE8 = .text:0x80008DE8; // type:function size:0xAC
reserve__Q24rstl47vector<10SObjectTag,Q24rstl17rmemory_allocator>Fi = .text:0x80008DE8; // type:function size:0xAC
fn_80008E94 = .text:0x80008E94; // type:function size:0xAC
ReleaseData__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv = .text:0x80008F40; // type:function size:0x64 scope:global
ReleaseData__Q24rstl15rc_ptr<6CIOWin>Fv = .text:0x80008FA4; // type:function size:0x64 scope:global
Expand Down
42 changes: 30 additions & 12 deletions src/MetroidPrime/Player/CGameOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@
#include "Kyoto/Graphics/CGraphics.hpp"
#include "Kyoto/Graphics/CMoviePlayer.hpp"
#include "Kyoto/Math/CMath.hpp"
#include "Kyoto/Streams/CMemoryStreamOut.hpp"
#include "Kyoto/Streams/CInputStream.hpp"
#include "Kyoto/Streams/CMemoryStreamOut.hpp"


#include "dolphin/os.h"

extern "C" void fn_8029AF00(int, uchar);
extern "C" rstl::pair<bool, bool> fn_80227694();
extern "C" void fn_802275B8(rstl::pair<bool, bool>&, CMemoryStreamOut& out);
extern "C" rstl::pair<bool, bool> fn_80227624(CInputStream& in);
extern "C" rstl::pair< bool, bool > fn_80227694();
extern "C" void fn_802275B8(rstl::pair< bool, bool >&, CMemoryStreamOut& out);
extern "C" rstl::pair< bool, bool > fn_80227624(CInputStream& in);

extern "C" bool lbl_804191E0;

SObjectTag sControllerAssets[] = {
SObjectTag(0x2A13423E, 0xF13452F8),
};

int CGameOptions_CalculateBits(uint v) {
int iVar1;

Expand Down Expand Up @@ -65,7 +70,7 @@ CGameOptions::CGameOptions()
InitSoundMode();
}

CGameOptions::CGameOptions(CInputStream& in)
CGameOptions::CGameOptions(CInputStream& in)

: soundMode(CAudioSys::kSM_Stereo)
, screenBrightness(4)
Expand All @@ -82,10 +87,9 @@ CGameOptions::CGameOptions(CInputStream& in)
, swapBeamsControls(false)
, hintSystem(true)
, unk(false)
, vec()
{
, vec() {
in.ReadBits(32);
soundMode = (CAudioSys::ESurroundModes) in.ReadBits(CGameOptions_CalculateBits(2));
soundMode = (CAudioSys::ESurroundModes)in.ReadBits(CGameOptions_CalculateBits(2));
screenBrightness = in.ReadBits(CGameOptions_CalculateBits(8));
screenXOffset = in.ReadBits(CGameOptions_CalculateBits(60)) - 30;
screenYOffset = in.ReadBits(CGameOptions_CalculateBits(60)) - 30;
Expand All @@ -95,14 +99,14 @@ CGameOptions::CGameOptions(CInputStream& in)
musicVol = in.ReadBits(CGameOptions_CalculateBits(0x69));
hudAlpha = in.ReadBits(CGameOptions_CalculateBits(0xff));
helmetAlpha = in.ReadBits(CGameOptions_CalculateBits(0xff));

hudLag = in.ReadBits(1);
hintSystem = in.ReadBits(1);
invertY = in.ReadBits(1);
rumble = in.ReadBits(1);
swapBeamsControls = in.ReadBits(1);
unk = in.ReadBits(1);

for (int i = 0; i < 4; ++i) {
unk2.push_back(fn_80227624(in));
}
Expand All @@ -129,7 +133,7 @@ void CGameOptions::PutTo(CMemoryStreamOut& out) {
out.WriteBits(unk != 0, 1);

int i = 0;
rstl::pair<bool, bool>* data = unk2.data();
rstl::pair< bool, bool >* data = unk2.data();
for (; i < 4; ++i) {
fn_802275B8(*data, out);
++data;
Expand Down Expand Up @@ -306,6 +310,20 @@ void CGameOptions::ToggleControls(bool flag) {
}
}

void CGameOptions::ResetControllerAssets(int controls) {}
void CGameOptions::ResetControllerAssets(int controls) {
switch (controls) {
case 1:
vec.reserve(15);
for (int i = 0; i < 5; ++i) {
vec.push_back(sControllerAssets[i]);
}
break;
case 0:
vec = rstl::vector<SObjectTag>();
break;
default:
break;
}
}

void CGameOptions::SetControls(int controls) { ResetControllerAssets(controls); }

0 comments on commit 289df2c

Please sign in to comment.