mirror of
https://github.com/Zelda64Recomp/Zelda64Recomp
synced 2026-07-07 22:22:24 -04:00
Added heuristics to determine when to skip camera interpolation, added ability to enable developer mode in RT64
This commit is contained in:
+34
-12
@@ -15,6 +15,14 @@
|
||||
constexpr std::u8string_view graphics_filename = u8"graphics.json";
|
||||
constexpr std::u8string_view controls_filename = u8"controls.json";
|
||||
|
||||
constexpr auto res_default = ultramodern::Resolution::Auto;
|
||||
constexpr auto wm_default = ultramodern::WindowMode::Windowed;
|
||||
constexpr auto ar_default = RT64::UserConfiguration::AspectRatio::Expand;
|
||||
constexpr auto msaa_default = RT64::UserConfiguration::Antialiasing::MSAA4X;
|
||||
constexpr auto rr_default = RT64::UserConfiguration::RefreshRate::Display;
|
||||
constexpr int rr_manual_default = 60;
|
||||
constexpr bool developer_mode_default = false;
|
||||
|
||||
namespace ultramodern {
|
||||
void to_json(json& j, const GraphicsConfig& config) {
|
||||
j = json{
|
||||
@@ -24,16 +32,29 @@ namespace ultramodern {
|
||||
{"msaa_option", config.msaa_option},
|
||||
{"rr_option", config.rr_option},
|
||||
{"rr_manual_value", config.rr_manual_value},
|
||||
{"developer_mode", config.developer_mode},
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void from_or_default(const json& j, const std::string& key, T& out, T default_value) {
|
||||
auto find_it = j.find(key);
|
||||
if (find_it != j.end()) {
|
||||
find_it->get_to(out);
|
||||
}
|
||||
else {
|
||||
out = default_value;
|
||||
}
|
||||
}
|
||||
|
||||
void from_json(const json& j, GraphicsConfig& config) {
|
||||
j.at("res_option") .get_to(config.res_option);
|
||||
j.at("wm_option") .get_to(config.wm_option);
|
||||
j.at("ar_option") .get_to(config.ar_option);
|
||||
j.at("msaa_option") .get_to(config.msaa_option);
|
||||
j.at("rr_option") .get_to(config.rr_option);
|
||||
j.at("rr_manual_value").get_to(config.rr_manual_value);
|
||||
from_or_default(j, "res_option", config.res_option, res_default);
|
||||
from_or_default(j, "wm_option", config.wm_option, wm_default);
|
||||
from_or_default(j, "ar_option", config.ar_option, ar_default);
|
||||
from_or_default(j, "msaa_option", config.msaa_option, msaa_default);
|
||||
from_or_default(j, "rr_option", config.rr_option, rr_default);
|
||||
from_or_default(j, "rr_manual_value", config.rr_manual_value, rr_manual_default);
|
||||
from_or_default(j, "developer_mode", config.developer_mode, developer_mode_default);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,12 +131,13 @@ void recomp::reset_input_bindings() {
|
||||
|
||||
void recomp::reset_graphics_options() {
|
||||
ultramodern::GraphicsConfig new_config{};
|
||||
new_config.res_option = ultramodern::Resolution::Auto;
|
||||
new_config.wm_option = ultramodern::WindowMode::Windowed;
|
||||
new_config.ar_option = RT64::UserConfiguration::AspectRatio::Expand;
|
||||
new_config.msaa_option = RT64::UserConfiguration::Antialiasing::MSAA4X;
|
||||
new_config.rr_option = RT64::UserConfiguration::RefreshRate::Display;
|
||||
new_config.rr_manual_value = 60;
|
||||
new_config.res_option = res_default;
|
||||
new_config.wm_option = wm_default;
|
||||
new_config.ar_option = ar_default;
|
||||
new_config.msaa_option = msaa_default;
|
||||
new_config.rr_option = rr_default;
|
||||
new_config.rr_manual_value = rr_manual_default;
|
||||
new_config.developer_mode = developer_mode_default;
|
||||
ultramodern::set_graphics_config(new_config);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,11 +61,11 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
extern "C" RT64::Application* InitiateGFXWindows(GFX_INFO Gfx_Info, HWND hwnd, DWORD threadId);
|
||||
extern "C" RT64::Application* InitiateGFXWindows(GFX_INFO Gfx_Info, HWND hwnd, DWORD threadId, uint8_t debug);
|
||||
#elif defined(__ANDROID__)
|
||||
static_assert(false && "Unimplemented");
|
||||
#elif defined(__linux__)
|
||||
extern "C" RT64::Application* InitiateGFXLinux(GFX_INFO Gfx_Info, Window window, Display *display);
|
||||
extern "C" RT64::Application* InitiateGFXLinux(GFX_INFO Gfx_Info, Window window, Display *display, uint8_t debug);
|
||||
#else
|
||||
static_assert(false && "Unimplemented");
|
||||
#endif
|
||||
@@ -130,22 +130,10 @@ RT64::UserConfiguration::Antialiasing compute_max_supported_aa(RT64::RenderSampl
|
||||
return RT64::UserConfiguration::Antialiasing::None;
|
||||
}
|
||||
|
||||
RT64::Application* RT64Init(uint8_t* rom, uint8_t* rdram, ultramodern::WindowHandle window_handle) {
|
||||
RT64::Application* RT64Init(uint8_t* rom, uint8_t* rdram, ultramodern::WindowHandle window_handle, bool debug) {
|
||||
set_rt64_hooks();
|
||||
// Dynamic loading
|
||||
//auto RT64 = LoadLibrary("RT64.dll");
|
||||
//if (RT64 == 0) {
|
||||
// fprintf(stdout, "Failed to load RT64\n");
|
||||
// std::exit(EXIT_FAILURE);
|
||||
//}
|
||||
//GET_FUNC(RT64, InitiateGFX);
|
||||
//GET_FUNC(RT64, ProcessRDPList);
|
||||
//GET_FUNC(RT64, ProcessDList);
|
||||
//GET_FUNC(RT64, UpdateScreen);
|
||||
|
||||
GFX_INFO gfx_info{};
|
||||
// gfx_info.hWnd = window_handle;
|
||||
// gfx_info.hStatusBar = nullptr;
|
||||
|
||||
gfx_info.HEADER = rom;
|
||||
gfx_info.RDRAM = rdram;
|
||||
@@ -185,11 +173,11 @@ RT64::Application* RT64Init(uint8_t* rom, uint8_t* rdram, ultramodern::WindowHan
|
||||
gfx_info.RDRAM_SIZE = &RDRAM_SIZE;
|
||||
|
||||
#if defined(_WIN32)
|
||||
RT64::Application* ret = InitiateGFXWindows(gfx_info, window_handle.window, window_handle.thread_id);
|
||||
RT64::Application* ret = InitiateGFXWindows(gfx_info, window_handle.window, window_handle.thread_id, debug);
|
||||
#elif defined(__ANDROID__)
|
||||
static_assert(false && "Unimplemented");
|
||||
#elif defined(__linux__)
|
||||
RT64::Application* ret = InitiateGFXLinux(gfx_info, window_handle.window, window_handle.display);
|
||||
RT64::Application* ret = InitiateGFXLinux(gfx_info, window_handle.window, window_handle.display, debug);
|
||||
#else
|
||||
static_assert(false && "Unimplemented");
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user