Added SM64 engine to C hard-coded new API

Fortune for rngxx's current commit: Future small blessing − 末小吉
master
Avril 2 years ago
parent 8a0ecc0e32
commit dfb3d74816
Signed by: flanchan
GPG Key ID: 284488987C31F630

1
.gitignore vendored

@ -5,3 +5,4 @@ vgcore.*
*-test *-test
*.so* *.so*
*.a *.a
rngrx

@ -22,6 +22,7 @@ typedef struct Random rng_t;
enum rng_kind { enum rng_kind {
RNG_KIND_CRAND, RNG_KIND_CRAND,
RNG_KIND_SM64,
}; };
enum rng_next_flag { enum rng_next_flag {

@ -14,6 +14,8 @@
#undef _RNGXX_COMMON_MINIMAL #undef _RNGXX_COMMON_MINIMAL
#endif #endif
#define RNGXX_DCTOR_NAME(T) _rng__init_for_ ## T
#define CTOR_COPY(name) name(const name& copy) #define CTOR_COPY(name) name(const name& copy)
#define CTOR_MOVE(name) name(name&& move) #define CTOR_MOVE(name) name(name&& move)

@ -25,8 +25,7 @@ namespace rng::init
std::function<Random* (const void*)>& get(std::string_view name); std::function<Random* (const void*)>& get(std::string_view name);
} }
#define RNGXX_DCTOR_NAME(T) _rng__init_for_ ## T
// To add to dynamic CTOR map // To add to dynamic CTOR map
#define RNGXX_APPLY_CTOR(ns, T, TSeed) \ #define RNGXX_APPLY_CTOR(ns, T, TSeed) \
const static auto RNGXX_DCTOR_NAME(T) = rng::init::apply<ns::T, TSeed>(#T, [](const TSeed* ptr) { return new ns::T(*ptr); }) const auto RNGXX_DCTOR_NAME(T) = rng::init::apply<ns::T, TSeed>(#T, [](const TSeed* ptr) { return new ns::T(*ptr); })

@ -3,6 +3,7 @@
#include <rngxx.hpp> #include <rngxx.hpp>
#include <rngxx/crand.h> #include <rngxx/crand.h>
#include <rngxx/sm64.h>
#include <init.hpp> #include <init.hpp>
@ -134,6 +135,8 @@ extern "C" {
{ {
case RNG_KIND_CRAND: case RNG_KIND_CRAND:
return new rng::crand(seed[0]); return new rng::crand(seed[0]);
case RNG_KIND_SM64:
return new rng::sm64(seed[0]);
default: return NULL; default: return NULL;
} }
} }

Loading…
Cancel
Save