Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config/G2ME01/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ MetroidPrime/ScriptObjects/CScriptAreaProperties.cpp:
MetroidPrime/CHealthInfo.cpp:
.text start:0x8014206C end:0x80142188

MetroidPrime/ScriptObjects/CScriptStreamedMusic.cpp:
.text start:0x8015CD4C end:0x8015DDE8
.rodata start:0x803A95F8 end:0x803A9620
.data start:0x803B5430 end:0x803B5450
.sdata2 start:0x8041C460 end:0x8041C468

MetroidPrime/Player/CGameOptions.cpp:
.text start:0x80160C20 end:0x80161D04

Expand Down
46 changes: 23 additions & 23 deletions config/G2ME01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5798,29 +5798,29 @@ fn_8015C990 = .text:0x8015C990; // type:function size:0x19C align:4
fn_8015CB2C = .text:0x8015CB2C; // type:function size:0x80 align:4
fn_8015CBAC = .text:0x8015CBAC; // type:function size:0xCC align:4
fn_8015CC78 = .text:0x8015CC78; // type:function size:0xD4
fn_8015CD4C = .text:0x8015CD4C; // type:function size:0x94 align:4
fn_8015CDE0 = .text:0x8015CDE0; // type:function size:0x2D8 align:4
fn_8015D0B8 = .text:0x8015D0B8; // type:function size:0x190
fn_8015D248 = .text:0x8015D248; // type:function size:0x60
fn_8015D2A8 = .text:0x8015D2A8; // type:function size:0xD8
fn_8015D380 = .text:0x8015D380; // type:function size:0xAC align:4
fn_8015D42C = .text:0x8015D42C; // type:function size:0x104
fn_8015D530 = .text:0x8015D530; // type:function size:0x150 align:4
fn_8015D680 = .text:0x8015D680; // type:function size:0x120 align:4
fn_8015D7A0 = .text:0x8015D7A0; // type:function size:0x74
fn_8015D814 = .text:0x8015D814; // type:function size:0x84 align:4
fn_8015D898 = .text:0x8015D898; // type:function size:0x3C align:4
fn_8015D8D4 = .text:0x8015D8D4; // type:function size:0x70 align:4
fn_8015D944 = .text:0x8015D944; // type:function size:0x24 align:4
fn_8015D968 = .text:0x8015D968; // type:function size:0x60
fn_8015D9C8 = .text:0x8015D9C8; // type:function size:0x34 align:4
fn_8015D9FC = .text:0x8015D9FC; // type:function size:0x34
fn_8015DA30 = .text:0x8015DA30; // type:function size:0x7C align:4
fn_8015DAAC = .text:0x8015DAAC; // type:function size:0x190 align:4
fn_8015DC3C = .text:0x8015DC3C; // type:function size:0xB4
__dt__20CScriptStreamedMusicFv = .text:0x8015CD4C; // type:function size:0x94 align:4
LoadStreamedAudio__FR13CStateManagerR12CInputStreamRC11CEntityInfo = .text:0x8015CDE0; // type:function size:0x2D8 align:4
SetStereoPair__20CScriptStreamedMusicFv = .text:0x8015D0B8; // type:function size:0x190
__pl__4rstlFRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>c = .text:0x8015D248; // type:function size:0x60
__ct<Q24rstl127const_linear_iterator<c,Q24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>>__Q24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>FQ24rstl127const_linear_iterator<c,Q24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>Q24rstl127const_linear_iterator<c,Q24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>RCQ24rstl17rmemory_allocator = .text:0x8015D2A8; // type:function size:0xD8
find__Q24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>CFci = .text:0x8015D380; // type:function size:0xAC align:4
internal_search<Q24rstl127const_linear_iterator<c,Q24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>,PCc>__Q24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>FQ24rstl127const_linear_iterator<c,Q24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>Q24rstl127const_linear_iterator<c,Q24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>PCcPCc = .text:0x8015D42C; // type:function size:0x104
TweakOverride__20CScriptStreamedMusicFR13CStateManager = .text:0x8015D530; // type:function size:0x150 align:4
PreloadMemoryAudio__20CScriptStreamedMusicFv = .text:0x8015D680; // type:function size:0x120 align:4
substr__Q24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>CFii = .text:0x8015D7A0; // type:function size:0x74
Think__20CScriptStreamedMusicFfR13CStateManager = .text:0x8015D814; // type:function size:0x84 align:4
StopStream__20CScriptStreamedMusicFv = .text:0x8015D898; // type:function size:0x3C align:4
StartStream__20CScriptStreamedMusicFv = .text:0x8015D8D4; // type:function size:0x70 align:4
StopNonDsp__20CScriptStreamedMusicFv = .text:0x8015D944; // type:function size:0x24 align:4
PlayNonDsp__20CScriptStreamedMusicFv = .text:0x8015D968; // type:function size:0x60
Stop__20CScriptStreamedMusicFv = .text:0x8015D9C8; // type:function size:0x34 align:4
PlayAudio__20CScriptStreamedMusicFv = .text:0x8015D9FC; // type:function size:0x34
Play__20CScriptStreamedMusicFR13CStateManager = .text:0x8015DA30; // type:function size:0x7C align:4
AcceptScriptMsg__20CScriptStreamedMusicFR13CStateManagerRC10CScriptMsg = .text:0x8015DAAC; // type:function size:0x190 align:4
IsDSPFile__20CScriptStreamedMusicFRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator> = .text:0x8015DC3C; // type:function size:0xB4
fn_8015DCF0 = .text:0x8015DCF0; // type:function size:0x4
fn_8015DCF4 = .text:0x8015DCF4; // type:function size:0xE4 align:4
fn_8015DDD8 = .text:0x8015DDD8; // type:function size:0x10
__ct__20CScriptStreamedMusicF9TUniqueIdRC11CEntityInfoRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>bffUibb = .text:0x8015DCF4; // type:function size:0xE4 align:4
IsOneShot__20CScriptStreamedMusicFb = .text:0x8015DDD8; // type:function size:0x10
fn_8015DDE8 = .text:0x8015DDE8; // type:function size:0x120 align:4
fn_8015DF08 = .text:0x8015DF08; // type:function size:0x4 align:4
fn_8015DF0C = .text:0x8015DF0C; // type:function size:0x32C
Expand Down Expand Up @@ -18148,7 +18148,7 @@ lbl_803B53A0 = .data:0x803B53A0; // type:object size:0x40
lbl_803B53E0 = .data:0x803B53E0; // type:object size:0x20
lbl_803B5400 = .data:0x803B5400; // type:object size:0x10
lbl_803B5410 = .data:0x803B5410; // type:object size:0x20
lbl_803B5430 = .data:0x803B5430; // type:object size:0x20
__vt__20CScriptStreamedMusic = .data:0x803B5430; // type:object size:0x20
lbl_803B5450 = .data:0x803B5450; // type:object size:0x18
lbl_803B5468 = .data:0x803B5468; // type:object size:0x98
lbl_803B5500 = .data:0x803B5500; // type:object size:0x80
Expand Down
1 change: 1 addition & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ def MatchingFor(*versions):
Object(NonMatching, "MetroidPrime/CHealthInfo.cpp"),
Object(NonMatching, "MetroidPrime/Player/CGameOptions.cpp"),
Object(NonMatching, "MetroidPrime/ScriptObjects/CScriptSequenceTimer.cpp"),
Object(NonMatching, "MetroidPrime/ScriptObjects/CScriptStreamedMusic.cpp"),
Object(NonMatching, "MetroidPrime/ScriptLoaderRel.cpp"),
Object(NonMatching, "MetroidPrime/ScriptLoader.cpp"),
Object(NonMatching, "MetroidPrime/CAxisAngle.cpp"),
Expand Down
11 changes: 11 additions & 0 deletions include/Kyoto/Basics/CCast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ inline uchar ToUint8(register float in) {
return *ptr;
}

inline char ToInt8(register float in) {
char a;
register char* ptr = &a;

asm {
psq_st in, 0(ptr), 1, OS_FASTCAST_S8
}
return *ptr;
}

inline uchar ToUint8(int c) { return static_cast<uchar>(c); }

inline float ToReal32(register const uchar& in) {
Expand Down Expand Up @@ -52,6 +62,7 @@ inline float LtoF(int in) { return static_cast< float >(in); }

#else
inline uchar ToUint8(float in) { return static_cast< uchar >(in); }
inline char ToInt8(float in) { return static_cast< char >(in); }
inline uchar ToUint8(int c) { return static_cast<uchar>(c); }
inline float ToReal32(uchar in) { return static_cast< float >(in); }
inline short FtoS(float in) { return static_cast< short >(in); }
Expand Down
11 changes: 6 additions & 5 deletions include/MetroidPrime/CActor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class CActor : public CEntity {
void AcceptScriptMsg(CStateManager& mgr, const CScriptMsg&) override;
void SetActive(const bool active) override;

virtual void UnkVtable20(); // G2ME01 slot +0x20; original name unknown
virtual void PreRender(CStateManager&, const CFrustumPlanes&);
virtual void AddToRenderer(const CStateManager&) const;
virtual void Render(const CStateManager&) const;
Expand Down Expand Up @@ -88,13 +89,14 @@ class CActor : public CEntity {
virtual CAABox GetSortingBounds(const CStateManager&) const;
virtual void DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type,
float dt);
virtual CScannableObjectInfo* GetScannableObjectInfo() const;
virtual void ProcessSoundEvent(int sfxId, float weight, int flags, float fallOff, float maxDist,
uchar minVol, uchar maxVol, const CVector3f& toListener,
const CVector3f& position, int aid, CStateManager& mgr,
bool translateId);

CAdvancementDeltas UpdateAnimation(float dt, CStateManager& mgr, bool advTree);

void ProcessSoundEvent(int sfxId, float weight, int flags, float fallOff, float maxDist,
uchar minVol, uchar maxVol, const CVector3f& toListener,
const CVector3f& position, int aid, CStateManager& mgr, bool translateId);

void UpdateSfxEmitters();
void RemoveEmitter();
void SetModelData(const CModelData& modelData, CStateManager& mgr);
Expand Down Expand Up @@ -125,7 +127,6 @@ class CActor : public CEntity {
void SetActorLights(rstl::auto_ptr< CActorLights > lights);
void SetInFluid(bool b, TUniqueId uid);

CScannableObjectInfo* GetScannableObjectInfo() const;
void MoveScannableObjectInfoToActor(CActor* actor, CStateManager& mgr);

/// ????
Expand Down
3 changes: 2 additions & 1 deletion include/MetroidPrime/CEntity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CEntity {
virtual void PreThink(float dt, CStateManager& mgr);
virtual void Think(float dt, CStateManager& mgr);
virtual void AcceptScriptMsg(CStateManager& mgr, const CScriptMsg&);
virtual void SendActive(CStateManager& mgr, bool active);
void SendActive(CStateManager& mgr, bool active);
virtual void SetActive(const bool active);

CEntity(TUniqueId id, const CEntityInfo& info, const rstl::string& name, uint inGrave);
Expand All @@ -34,6 +34,7 @@ class CEntity {
TAreaId GetCurrentAreaId() const { return m_areaId; }
const bool GetActive() const { return m_active; }
bool IsScriptingBlocked() const { return m_scriptingBlocked; }
bool GetEditorFlag2() const { return m_entityUnknown; }

// might be fake?
rstl::vector< SConnection >& ConnectionList() { return m_conns; }
Expand Down
1 change: 1 addition & 0 deletions include/MetroidPrime/CEntityInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ enum EScriptObjectMessage {
kSM_Start = 0x53545254,
kSM_Stop = 0x53544f50,
kSM_Play = 0x504c4159,
kSM_Load = 0x4c4f4144,
kSM_Activate = 0x41435456,
kSM_Deactivate = 0x44435456,
kSM_ToggleActive = 0x54435456,
Expand Down
7 changes: 6 additions & 1 deletion include/MetroidPrime/CGameArea.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _CGAMEAREA
#define _CGAMEAREA

#include "Kyoto/SObjectTag.hpp"

class CScriptAreaProperties;
class CGameArea {
public:
Expand All @@ -15,6 +17,7 @@ class CGameArea {
};

int GetPhase() const { return m_phase; }
CAssetId GetAreaAssetId() const { return m_areaAssetId; }

void SetAreaAttributes(CScriptAreaProperties*);
bool IsLoaded() const { return m_phase == 0x10; }
Expand All @@ -23,7 +26,9 @@ class CGameArea {
EOcclusionState GetOcclusionState() const { return m_postConstructed->m_occlusionState; }

private:
char pad1[0xf4];
char pad1[0x54];
CAssetId m_areaAssetId; // 0x54
char pad2[0x9c];
int m_phase; // 0xf4;
CGameArea* m_next; // 0xf8
CGameArea* m_prev; // 0xfc
Expand Down
45 changes: 45 additions & 0 deletions include/MetroidPrime/CInGameTweakManager.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#ifndef _CINGAMETWEAKMANAGER
#define _CINGAMETWEAKMANAGER

#include "Kyoto/SObjectTag.hpp"
#include "rstl/string.hpp"

class CTweakValue {
public:
struct Audio {
float GetFadeIn() const { return x0_fadeIn; }
float GetFadeOut() const { return x4_fadeOut; }
float GetVolume() const { return x8_volume; }
const rstl::string& GetFileName() const { return xc_fileName; }

private:
float x0_fadeIn;
float x4_fadeOut;
float x8_volume;
rstl::string xc_fileName;
CAssetId x1c_resourceId;
};

const Audio& GetAudio() const { return x24_audio; }

private:
uint x0_type;
rstl::string x4_key;
rstl::string x14_text;
Audio x24_audio;
uint x44_value;
};

NESTED_CHECK_SIZEOF(CTweakValue, Audio, 0x20)
CHECK_SIZEOF(CTweakValue, 0x48)

class CInGameTweakManager {
public:
bool HasTweakValue(const rstl::string& key) const;
const CTweakValue* GetTweakValue(const rstl::string& key) const;
static rstl::string GetIdentifierForMusicEvent(CAssetId areaId, const rstl::string& name);
};

extern CInGameTweakManager* gpTweakManager;

#endif // _CINGAMETWEAKMANAGER
47 changes: 47 additions & 0 deletions include/MetroidPrime/ScriptObjects/CScriptStreamedMusic.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#ifndef _CSCRIPTSTREAMEDMUSIC
#define _CSCRIPTSTREAMEDMUSIC

#include "Kyoto/Streams/CFilePreload.hpp"
#include "MetroidPrime/CEntity.hpp"

#include "rstl/optional_object.hpp"

class CScriptStreamedMusic : public CEntity {
public:
CScriptStreamedMusic(TUniqueId id, const CEntityInfo& info, const rstl::string& name,
const rstl::string& fileName, bool noStopOnDeactivate, float fadeIn,
float fadeOut, uint volume, bool loop, bool music);
~CScriptStreamedMusic() override;
CEntity* TypesMatch(int typeId) const override;
void Think(float dt, CStateManager& mgr) override;
void AcceptScriptMsg(CStateManager& mgr, const CScriptMsg& msg) override;
void PlayAudio();

static bool IsDSPFile(const rstl::string& fileName);

private:
static int IsOneShot(bool loop);
void StartStream();
void StopStream();
void StopNonDsp();
void PlayNonDsp();
void Play(CStateManager& mgr);
void Stop();
void TweakOverride(CStateManager& mgr);
void PreloadMemoryAudio();
void SetStereoPair();

rstl::string x24_fileName;
bool x34_noStopOnDeactivate : 1;
bool x34_fileIsDsp : 1;
bool x34_loop : 1;
bool x34_music : 1;
bool x34_preloadPending : 1;
float x38_fadeIn;
float x3c_fadeOut;
uint x40_volume;
rstl::optional_object< CFilePreload > x44_preload;
};
CHECK_SIZEOF(CScriptStreamedMusic, 0x4C)

#endif // _CSCRIPTSTREAMEDMUSIC
1 change: 1 addition & 0 deletions include/dolphin/os/OSFastCast.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ extern "C" {

#define OS_FASTCAST_U8 2
#define OS_FASTCAST_U16 3
#define OS_FASTCAST_S8 4
#define OS_FASTCAST_S16 5
// clang-format off
static inline void OSInitFastCast(void) {
Expand Down
Loading
Loading