sm64.hpp¶
The core libsm64 interface.
-
class
sm64
¶ Interface class to libsm64. It’s quite primitive at the moment.
Constructors
Note
Safety cannot be guaranteed with this class, this is simply due to how low-level it is.
-
sm64
(const char *path)¶ Loads libsm64 from the DLL at the specified path.
- Parameters
path – C string with the path to the DLL
-
sm64
(std::string path)¶ Loads libsm64 from the DLL at the specified path.
- Parameters
path – String with the path to the DLL
-
sm64
(std::filesystem::path path)¶ Loads libsm64 from the DLL at the specified path.
- Parameters
path – Path to the DLL.
Access functions
-
template<typename
T
>
T &get
(std::string expr)¶ Gets a reference to a variable from libsm64.
Note
This method performs type checking. If you don’t like that, use
get_unsafe()
instead.- Template Parameters
T – The type of the returned reference
- Parameters
expr – A valid accessor expression
- Throws
std::domain_error – if the accessor expression does not refer to a base type
pancake::type_error – if the accessor expression’s type doesn’t match
T
std::invalid_argument – if the accessor expression is somehow invalid
-
void *
get_unsafe
(std::string expr)¶ Gets a void pointer to a variable from libsm64.
Warning
This method doesn’t perform type checking. If you care about type safety, use
get()
instead.- Template Parameters
T – The type of the returned reference
- Parameters
expr – A valid accessor expression
- Throws
std::domain_error – if the accessor expression does not refer to a base type
std::invalid_argument – if the accessor expression is somehow invalid
-
const std::variant<double, int64_t, nullptr_t>
constant
(std::string name) const¶ Gets a constant, returning the specified type in a variant.
- Parameters
name – the name of the constant
- Returns
the requested constant, wrapped in a variant. If the constant is defined with no value,returns
nullptr
.
-
void
advance
()¶ Advances the game by 1 frame.
Savestate functions
-
class
savestate
final¶ Opaque class containing savestate buffers. The implementation is platform-specific and non-extensible.
-
savestate
alloc_svst
() const¶ Allocates a savestate buffer bound to this
sm64
.- Returns
An empty savestate buffer
-