mirror of
https://github.com/N64Recomp/N64ModernRuntime.git
synced 2026-06-25 17:33:10 +00:00
Merge branch 'N64Recomp:main' into main
This commit is contained in:
commit
664915284e
5 changed files with 35 additions and 14 deletions
|
|
@ -7,8 +7,7 @@
|
|||
#include <ultramodern/ultra64.h>
|
||||
|
||||
template<int index, typename T>
|
||||
T _arg(uint8_t* rdram, recomp_context* ctx) {
|
||||
static_assert(index < 4, "Only args 0 through 3 supported");
|
||||
T _arg(uint8_t* rdram, recomp_context* ctx) requires(index < 4) {
|
||||
gpr raw_arg = (&ctx->r4)[index];
|
||||
if constexpr (std::is_same_v<T, float>) {
|
||||
if constexpr (index < 2) {
|
||||
|
|
@ -38,6 +37,25 @@ T _arg(uint8_t* rdram, recomp_context* ctx) {
|
|||
}
|
||||
}
|
||||
|
||||
template<int index, typename T>
|
||||
T _arg(uint8_t* rdram, recomp_context* ctx) requires(index >= 4) {
|
||||
const auto raw_arg = MEM_W(index * 4, ctx->r29);
|
||||
if constexpr (std::is_pointer_v<T>) {
|
||||
static_assert (!std::is_pointer_v<std::remove_pointer_t<T>>, "Double pointers not supported");
|
||||
return TO_PTR(std::remove_pointer_t<T>, raw_arg);
|
||||
}
|
||||
else if constexpr (std::is_integral_v<T>) {
|
||||
static_assert(sizeof(T) <= 4, "64-bit args not supported");
|
||||
return static_cast<T>(raw_arg);
|
||||
}
|
||||
else {
|
||||
// static_assert in else workaround
|
||||
[] <bool flag = false>() {
|
||||
static_assert(flag, "Unsupported type");
|
||||
}();
|
||||
}
|
||||
}
|
||||
|
||||
inline float _arg_float_a1(uint8_t* rdram, recomp_context* ctx) {
|
||||
(void)rdram;
|
||||
union {
|
||||
|
|
|
|||
|
|
@ -466,22 +466,20 @@ recomp::mods::ModOpenError parse_manifest_config_schema_option(const nlohmann::j
|
|||
|
||||
auto precision = config_schema_json.find(config_schema_precision_key);
|
||||
if (precision != config_schema_json.end()) {
|
||||
int64_t precision_int64;
|
||||
if (get_to<int64_t>(*precision, precision_int64)) {
|
||||
option_number.precision = precision_int64;
|
||||
}
|
||||
else {
|
||||
if (!precision->is_number()) {
|
||||
error_param = config_schema_precision_key;
|
||||
return recomp::mods::ModOpenError::IncorrectConfigSchemaType;
|
||||
}
|
||||
option_number.precision = precision->template get<int64_t>();
|
||||
}
|
||||
|
||||
auto percent = config_schema_json.find(config_schema_percent_key);
|
||||
if (percent != config_schema_json.end()) {
|
||||
if (!get_to<bool>(*percent, option_number.percent)) {
|
||||
if (!percent->is_boolean()) {
|
||||
error_param = config_schema_percent_key;
|
||||
return recomp::mods::ModOpenError::IncorrectConfigSchemaType;
|
||||
}
|
||||
option_number.percent = percent->template get<bool>();
|
||||
}
|
||||
|
||||
auto default_value = config_schema_json.find(config_schema_default_key);
|
||||
|
|
|
|||
|
|
@ -96,7 +96,8 @@ enum class ThreadPriority {
|
|||
void set_native_thread_name(const std::string& name);
|
||||
void set_native_thread_priority(ThreadPriority pri);
|
||||
PTR(OSThread) this_thread();
|
||||
void set_main_thread();
|
||||
void set_entrypoint_thread();
|
||||
bool is_entrypoint_thread();
|
||||
bool is_game_thread();
|
||||
void submit_rsp_task(RDRAM_ARG PTR(OSTask) task);
|
||||
void send_si_message();
|
||||
|
|
|
|||
|
|
@ -29,14 +29,18 @@ std::string ultramodern::threads::get_game_thread_name(const OSThread* t) {
|
|||
|
||||
extern "C" void bootproc();
|
||||
|
||||
thread_local bool is_main_thread = false;
|
||||
thread_local bool is_entrypoint_thread = false;
|
||||
// Whether this thread is part of the game (i.e. the start thread or one spawned by osCreateThread)
|
||||
thread_local bool is_game_thread = false;
|
||||
thread_local PTR(OSThread) thread_self = NULLPTR;
|
||||
|
||||
void ultramodern::set_main_thread() {
|
||||
void ultramodern::set_entrypoint_thread() {
|
||||
::is_game_thread = true;
|
||||
is_main_thread = true;
|
||||
::is_entrypoint_thread = true;
|
||||
}
|
||||
|
||||
bool ultramodern::is_entrypoint_thread() {
|
||||
return ::is_entrypoint_thread;
|
||||
}
|
||||
|
||||
bool ultramodern::is_game_thread() {
|
||||
|
|
@ -45,7 +49,7 @@ bool ultramodern::is_game_thread() {
|
|||
|
||||
#if 0
|
||||
int main(int argc, char** argv) {
|
||||
ultramodern::set_main_thread();
|
||||
ultramodern::set_entrypoint_thread();
|
||||
|
||||
bootproc();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ void ultramodern::set_callbacks(
|
|||
}
|
||||
|
||||
void ultramodern::preinit(RDRAM_ARG ultramodern::renderer::WindowHandle window_handle) {
|
||||
ultramodern::set_main_thread();
|
||||
ultramodern::set_entrypoint_thread();
|
||||
ultramodern::init_events(PASS_RDRAM window_handle);
|
||||
ultramodern::init_timers(PASS_RDRAM1);
|
||||
ultramodern::init_audio();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue