Skip to content
Closed
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
2 changes: 2 additions & 0 deletions MarathonRecomp/api/Marathon.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "CSD/Platform/csdTexList.h"
#include "Sonicteam/Actor.h"
#include "Sonicteam/AppMarathon.h"
#include "Sonicteam/AudioEngineXenon.h"
#include "Sonicteam/Camera/CameraMode.h"
#include "Sonicteam/Camera/Cameraman.h"
#include "Sonicteam/Camera/SonicCamera.h"
Expand Down Expand Up @@ -48,6 +49,7 @@
#include "Sonicteam/Player/State/Object2.h"
#include "Sonicteam/Player/State/TailsContext.h"
#include "Sonicteam/SoX/AI/StateMachine.h"
#include "Sonicteam/SoX/Audio/IAudioEngine.h"
#include "Sonicteam/SoX/Component.h"
#include "Sonicteam/SoX/Engine/Doc.h"
#include "Sonicteam/SoX/Engine/DocMode.h"
Expand Down
31 changes: 31 additions & 0 deletions MarathonRecomp/api/Sonicteam/AudioEngineXenon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#pragma once

#include <Marathon.inl>
#include <Sonicteam/SoX/Engine/Doc.h>
#include <Sonicteam/SoX/Audio/IAudioEngine.h>
#include <kernel/memory.h>

namespace Sonicteam
{

class AudioEngineXenon : public SoX::Audio::IAudioEngine
{
public:
MARATHON_INSERT_PADDING(8);
be<float> m_Audio;
be<float> m_SoundEffects;
MARATHON_INSERT_PADDING(0x14);

//Singleton<T,C<T>>
static AudioEngineXenon* GetAudioEngine()
{
auto ppAudio = (xpointer<AudioEngineXenon>*)g_memory.Translate(0x82D37AC8);
if (!ppAudio->ptr.get())
{
auto pAudio = GuestToHostFunction<AudioEngineXenon*>(sub_824A5C78);
*ppAudio = pAudio;
}
return *ppAudio;
};
};
}
53 changes: 52 additions & 1 deletion MarathonRecomp/api/Sonicteam/DocMarathonImp.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,61 @@

namespace Sonicteam
{

struct DocSaveFile
{
public:
enum EPISODE
{
EPISODE_SONIC,
EPISODE_SHADOW,
EPISODE_SILVER
//...
};
static const uint32_t EPISODE_COUNT = 32;
static const uint32_t TRIAL_COUNT = 512;
static const uint32_t GLOBALFLAG_COUNT = 0x2800;
static const uint32_t STRING_SIZE = 0x100;
static const uint32_t STRING_SIZE_SHORT = 0x42;

MARATHON_INSERT_PADDING(4);
be<uint32_t> m_Episode_Lives[EPISODE_COUNT];
be<uint32_t> m_Episode_Rings[EPISODE_COUNT];
be<uint32_t> m_GlobalFlags[GLOBALFLAG_COUNT];
char m_Episode_Lua[EPISODE_COUNT * STRING_SIZE];
MARATHON_INSERT_PADDING(EPISODE_COUNT * 0x80);
char m_Episode_Objective[EPISODE_COUNT * STRING_SIZE];
char m_Episode_Area[EPISODE_COUNT * STRING_SIZE];
char m_Episode_Terrain[EPISODE_COUNT * STRING_SIZE];
char m_Episode_SET[EPISODE_COUNT * STRING_SIZE];
char m_Episode_PATH[EPISODE_COUNT * STRING_SIZE];
MARATHON_INSERT_PADDING(EPISODE_COUNT * 0x500);
char m_Episode_MST[EPISODE_COUNT * STRING_SIZE];
MARATHON_INSERT_PADDING(EPISODE_COUNT * 0x24C);
be<uint32_t> m_Episode_Progress[EPISODE_COUNT];
be<uint16_t> m_Episode_Year[EPISODE_COUNT];
uint8_t m_Episode_Month[EPISODE_COUNT];
uint8_t m_Episode_Day[EPISODE_COUNT];
uint8_t m_Episode_Hour[EPISODE_COUNT];
uint8_t m_Episode_Minute[EPISODE_COUNT];
char m_Episode_Location[EPISODE_COUNT * STRING_SIZE_SHORT];
be<uint32_t> m_Trial_ID[TRIAL_COUNT];
be<uint32_t> m_Trial_Rank[TRIAL_COUNT];
be<uint32_t> m_Trial_Time[TRIAL_COUNT];
be<uint32_t> m_Trial_Score[TRIAL_COUNT];
be<uint32_t> m_Trial_Rings[TRIAL_COUNT];
bool m_Option_Subtitles;
be<float> m_Option_Music;
be<float> m_Option_Effects;
};

class DocMarathonImp : public SoX::Engine::Doc
{
public:
MARATHON_INSERT_PADDING(0x74);
bool m_VFrame;
MARATHON_INSERT_PADDING(0X2E8);
DocSaveFile m_SaveIn;
DocSaveFile m_SaveOut;
};
}
}
13 changes: 13 additions & 0 deletions MarathonRecomp/api/Sonicteam/SoX/Audio/IAudioEngine.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#include <Marathon.inl>

namespace Sonicteam::SoX::Audio
{

class IAudioEngine
{
public:
xpointer<void> m_pVftable;
};
}
4 changes: 4 additions & 0 deletions MarathonRecomp/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ PPC_FUNC(sub_8262A568)
cfg->Width = Video::s_viewportWidth;
cfg->Height = Video::s_viewportHeight;

auto pAudio = Sonicteam::AudioEngineXenon::GetAudioEngine();
pAudio->m_Audio = Config::MasterVolume * Config::MusicVolume;
pAudio->m_SoundEffects = Config::MasterVolume * Config::EffectsVolume;

LOGFN_UTILITY("Changed resolution: {}x{}", cfg->Width.get(), cfg->Height.get());

__imp__sub_8262A568(ctx, base);
Expand Down
2 changes: 1 addition & 1 deletion tools/XenosRecomp
Loading