Files
bigmak94andClaude Opus 5.5 bd9bded792 GalaxyQuest: Super Mario Galaxy in VR on Meta Quest 3
A native port built on the Petari decompilation (previous commit): an
HLE platform layer (OS, DVD, GX, audio, input, NAND) under the game's
own code, an OpenXR presentation (a diorama around the player, a giant
screen, the HUD and settings as compositor layers, SpaceWarp, dynamic
resolution), Touch Plus controls, the tools that convert your own game
files (tools/cook, which also takes the few pieces of data the game's
executable holds from your sys/main.dol), and the port's changes to the
decompilation (`git diff petari-base -- decomp`).  README.md explains
installing and building, docs/TECHNICAL.md how it works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 01:59:38 +02:00

62 lines
4.6 KiB
C++

#pragma once
#include "Game/LiveActor/Spine.hpp"
/// @brief Used for executing states of a LiveActor.
class Nerve {
public:
/// @brief Executes a state based on the host actor.
/// @param pSpine The spine that contains the host LiveActor to execute the state for.
virtual void execute(Spine* pSpine) const = 0;
/// @brief Executes after the last iteration of a state before it executes another state.
/// @param pSpine The spine that contains the host LiveActor to execute the state for.
virtual void executeOnEnd(Spine* pSpine) const;
};
#ifdef __MWERKS__
#define NERVE_WEAK ATTRIBUTE_WEAK
#define NERVE_DEF
#else
/* C++17 inline variables give header-defined nerves one definition across TUs. */
#define NERVE_WEAK
#define NERVE_DEF inline
#endif
#define NEW_NERVE(name, parent_class, executor_name) \
class name : public Nerve { \
public: \
virtual void execute(Spine* pSpine) const { \
parent_class* actor = reinterpret_cast< parent_class* >(pSpine->mExecutor); \
actor->exe##executor_name(); \
}; \
static name sInstance; \
}; \
NERVE_DEF name name::sInstance NERVE_WEAK;
#define NEW_NERVE_ONEND(name, parent_class, executor_name, executorOnEnd_name) \
class name : public Nerve { \
public: \
virtual void execute(Spine* pSpine) const { \
parent_class* actor = reinterpret_cast< parent_class* >(pSpine->mExecutor); \
actor->exe##executor_name(); \
}; \
virtual void executeOnEnd(Spine* pSpine) const { \
parent_class* actor = reinterpret_cast< parent_class* >(pSpine->mExecutor); \
actor->end##executorOnEnd_name(); \
}; \
static name sInstance; \
}; \
NERVE_DEF name name::sInstance NERVE_WEAK;
/* easy alternative to get a nerve instance (in the standard format) */
#define GET_NERVE(cls, nerve) (&Nrv##cls::nerve::sInstance)
/* easy alternative to get a nerve instance (with an anonymous namespace) */
#define GET_NERVE_ANON(nerve) (&::nerve::sInstance)
/* easy alternative to get a nerve instance (with no namespace) */
#define GET_NERVE_GLOBAL(nerve) (&nerve::sInstance)
/* easy alternative to get a nerve instance (where namespace does not follow standard) */
#define GET_NERVE_DIRECT(nmspc, nerve) (&nmspc::nerve::sInstance)