From dfb3d74816524cdf52158e6c81d3cc153c7f4cfb Mon Sep 17 00:00:00 2001 From: Avril Date: Mon, 8 Nov 2021 05:00:27 +0000 Subject: [PATCH] Added SM64 engine to C hard-coded new API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fortune for rngxx's current commit: Future small blessing − 末小吉 --- .gitignore | 1 + include/rngxx.h | 1 + include/rngxx.hpp | 2 ++ include/rngxx/internal/init.hpp | 3 +-- src/capi-bridge.cpp | 3 +++ 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 14b9e02..ad27096 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ vgcore.* *-test *.so* *.a +rngrx diff --git a/include/rngxx.h b/include/rngxx.h index 4177723..65e6ce8 100644 --- a/include/rngxx.h +++ b/include/rngxx.h @@ -22,6 +22,7 @@ typedef struct Random rng_t; enum rng_kind { RNG_KIND_CRAND, + RNG_KIND_SM64, }; enum rng_next_flag { diff --git a/include/rngxx.hpp b/include/rngxx.hpp index 65eba66..1223830 100644 --- a/include/rngxx.hpp +++ b/include/rngxx.hpp @@ -14,6 +14,8 @@ #undef _RNGXX_COMMON_MINIMAL #endif +#define RNGXX_DCTOR_NAME(T) _rng__init_for_ ## T + #define CTOR_COPY(name) name(const name& copy) #define CTOR_MOVE(name) name(name&& move) diff --git a/include/rngxx/internal/init.hpp b/include/rngxx/internal/init.hpp index 7f773a2..83cc6d0 100644 --- a/include/rngxx/internal/init.hpp +++ b/include/rngxx/internal/init.hpp @@ -25,8 +25,7 @@ namespace rng::init std::function& get(std::string_view name); } -#define RNGXX_DCTOR_NAME(T) _rng__init_for_ ## T // To add to dynamic CTOR map #define RNGXX_APPLY_CTOR(ns, T, TSeed) \ -const static auto RNGXX_DCTOR_NAME(T) = rng::init::apply(#T, [](const TSeed* ptr) { return new ns::T(*ptr); }) +const auto RNGXX_DCTOR_NAME(T) = rng::init::apply(#T, [](const TSeed* ptr) { return new ns::T(*ptr); }) diff --git a/src/capi-bridge.cpp b/src/capi-bridge.cpp index 428619e..5c46b79 100644 --- a/src/capi-bridge.cpp +++ b/src/capi-bridge.cpp @@ -3,6 +3,7 @@ #include #include +#include #include @@ -134,6 +135,8 @@ extern "C" { { case RNG_KIND_CRAND: return new rng::crand(seed[0]); + case RNG_KIND_SM64: + return new rng::sm64(seed[0]); default: return NULL; } }