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
3 changes: 3 additions & 0 deletions MarathonRecomp/api/Marathon.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#include "CSD/Manager/csdmSceneObserver.h"
#include "CSD/Manager/csdmSubjectBase.h"
#include "CSD/Platform/csdTexList.h"
#include "Sonicteam/AppMarathon.h"
#include "Sonicteam/DocMarathonImp.h"
#include "Sonicteam/DocMarathonState.h"
#include "Sonicteam/SoX/Component.h"
#include "Sonicteam/SoX/Engine/Doc.h"
#include "Sonicteam/SoX/Engine/Task.h"
Expand Down
11 changes: 1 addition & 10 deletions MarathonRecomp/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,15 @@
### Naming Conventions

- Use `camelCase` for local variables, `SNAKE_CASE` for preprocessor macros, and `PascalCase` for everything else. Marathon-specific types that don't exist in the game should use `snake_case` for better differentiation.
- Class names should be prefixed with `C`, e.g., `CSonicContext`.
- Struct names should be prefixed with `S`, e.g., `SUpdateInfo`.
- Class members should be prefixed with `m_`, e.g., `m_Time`. Do not use this prefix for struct members.
- Enum names should be prefixed with `E`, e.g., `ELightType`.
- Enum members should start with `e`, followed by the enum name and an underscore, e.g., `eLightType_Point`.
- For enum members indicating the count of elements, prefix with `n`, followed by the name, e.g., `nLightType`.
- Pointers should be prefixed with `p`, e.g., `pSonicContext`.
- Shared pointers should be prefixed with `sp`, e.g., `spDatabase`.
- References should be prefixed with `r`, e.g., `rMessage`.
- Input function arguments should be prefixed with `in_`, e.g., `in_Name`.
- Output function arguments should be prefixed with `out_`, e.g., `out_Value`.
- Static class members should be prefixed with `ms_`, e.g., `ms_Instance`.
- Static members outside a class should be prefixed with `g_`, e.g., `g_AllocationTracker`.
- Marathon-specific preprocessor macros should start with `MARATHON_`, e.g., `MARATHON_INSERT_PADDING`.
- Hedgehog namespace-specific preprocessor macros should start with `HH_` along with the library's shorthand, e.g., `HH_FND_MSG_MAKE_TYPE`.
- Function pointers should be prefixed with `fp`, e.g., `fpCGameObjectConstructor`.

Combine prefixes as necessary, e.g., `m_sp` for a shared pointer as a class member or `in_r` for a const reference as a function argument.
Combine prefixes as necessary, e.g., `m_sp` for a shared pointer as a class member.

### Coding Style

Expand Down
14 changes: 14 additions & 0 deletions MarathonRecomp/api/Sonicteam/AppMarathon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include <Marathon.inl>
#include <Sonicteam/DocMarathonState.h>

namespace Sonicteam
{
class AppMarathon
{
public:
MARATHON_INSERT_PADDING(0x180);
xpointer<DocMarathonState> m_pDoc;
};
}
14 changes: 14 additions & 0 deletions MarathonRecomp/api/Sonicteam/DocMarathonImp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include <Marathon.inl>
#include <Sonicteam/SoX/Engine/Doc.h>

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

#include <Marathon.inl>
#include <Sonicteam/DocMarathonImp.h>

namespace Sonicteam
{
class DocMarathonState : public DocMarathonImp {};
}
5 changes: 5 additions & 0 deletions MarathonRecomp/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ PPC_FUNC(sub_8262A568)
LOGFN_UTILITY("Changed resolution: {}x{}", cfg->Width.get(), cfg->Height.get());

__imp__sub_8262A568(ctx, base);

App::s_pApp = (Sonicteam::AppMarathon*)g_memory.Translate(ctx.r3.u32);
}

// Sonicteam::DocMarathonState::Update
Expand Down Expand Up @@ -83,6 +85,9 @@ PPC_FUNC(sub_825EA610)
SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
GameWindow::Update();
}

// Allow variable FPS when config is not 60 FPS.
App::s_pApp->m_pDoc->m_VFrame = Config::FPS != 60;
}

PPC_FUNC_IMPL(__imp__sub_82582648);
Expand Down
2 changes: 2 additions & 0 deletions MarathonRecomp/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class App
static inline bool s_isSaving;
static inline bool s_isSaveDataCorrupt;

static inline Sonicteam::AppMarathon* s_pApp;

static inline EPlayerCharacter s_playerCharacter;
static inline ELanguage s_language;

Expand Down
Loading