mirror of
https://github.com/zeldaret/st
synced 2026-05-30 17:05:50 -04:00
69ef244371
* merge headers from nitro decomp * cleanup: use inlines from g2.h and gx.h when changing registers * cleanup: remove externs declarations in source files
65 lines
1.9 KiB
C++
65 lines
1.9 KiB
C++
#ifndef TYPES_H
|
|
#define TYPES_H
|
|
|
|
#include <nitro/types.h>
|
|
|
|
typedef s8 unk8;
|
|
typedef s16 unk16;
|
|
typedef s32 unk32;
|
|
|
|
#define CEIL_DIV(a, b) (((a) + (b) - 1) / (b))
|
|
|
|
#ifdef __cplusplus
|
|
#define DECL_PTMF(name, ...) \
|
|
template <typename T, typename R = void> struct name { \
|
|
typedef R (T::*PTMFCallback)(__VA_ARGS__); \
|
|
\
|
|
PTMFCallback callback; \
|
|
};
|
|
|
|
#define CALL_PTMF(type, data, ...) \
|
|
{ \
|
|
type &ptr = (data); \
|
|
(this->*ptr.callback)(__VA_ARGS__); \
|
|
}
|
|
|
|
#define STATIC_CALL_PTMF(type, data, thisx, ...) \
|
|
{ \
|
|
type &ptr = (data); \
|
|
((thisx)->*ptr.callback)(__VA_ARGS__); \
|
|
}
|
|
|
|
#define STATIC_PTMFCALLBACK(type, data, thisx, ...) \
|
|
{ \
|
|
type::PTMFCallback &ptr = (data); \
|
|
((thisx)->*ptr)(__VA_ARGS__); \
|
|
}
|
|
|
|
DECL_PTMF(PTMF);
|
|
typedef void (*UnkCallback)(u16 param1);
|
|
|
|
template <typename T> class Instance {
|
|
public:
|
|
Instance();
|
|
~Instance();
|
|
};
|
|
|
|
template <typename T> class AutoInstance : public Instance<T> {
|
|
public:
|
|
AutoInstance() {}
|
|
~AutoInstance() {}
|
|
};
|
|
|
|
#define DECL_INSTANCE(T, gpInstance) \
|
|
template <typename T> Instance<T>::Instance() { \
|
|
gpInstance = (T *) this; \
|
|
} \
|
|
template <typename T> Instance<T>::~Instance() { \
|
|
gpInstance = NULL; \
|
|
} \
|
|
template class Instance<T>
|
|
|
|
#endif
|
|
|
|
#endif
|