Hooked up graphics option menu to RT64, updated RT64

This commit is contained in:
Mr-Wiseguy
2024-01-01 00:09:14 -05:00
parent ac131c7835
commit 09bacbe82c
12 changed files with 354 additions and 135 deletions
+103 -2
View File
@@ -2,10 +2,80 @@
#include <cstring>
// #include <Windows.h>
#include "../ultramodern/ultramodern.hpp"
#define HLSL_CPU
#include "hle/rt64_application.h"
#include "rt64_layer.h"
#include "rt64_render_hooks.h"
typedef struct {
// void* hWnd;
// void* hStatusBar;
// int Reserved;
unsigned char* HEADER; /* This is the rom header (first 40h bytes of the rom) */
unsigned char* RDRAM;
unsigned char* DMEM;
unsigned char* IMEM;
unsigned int* MI_INTR_REG;
unsigned int* DPC_START_REG;
unsigned int* DPC_END_REG;
unsigned int* DPC_CURRENT_REG;
unsigned int* DPC_STATUS_REG;
unsigned int* DPC_CLOCK_REG;
unsigned int* DPC_BUFBUSY_REG;
unsigned int* DPC_PIPEBUSY_REG;
unsigned int* DPC_TMEM_REG;
unsigned int* VI_STATUS_REG;
unsigned int* VI_ORIGIN_REG;
unsigned int* VI_WIDTH_REG;
unsigned int* VI_INTR_REG;
unsigned int* VI_V_CURRENT_LINE_REG;
unsigned int* VI_TIMING_REG;
unsigned int* VI_V_SYNC_REG;
unsigned int* VI_H_SYNC_REG;
unsigned int* VI_LEAP_REG;
unsigned int* VI_H_START_REG;
unsigned int* VI_V_START_REG;
unsigned int* VI_V_BURST_REG;
unsigned int* VI_X_SCALE_REG;
unsigned int* VI_Y_SCALE_REG;
void (*CheckInterrupts)(void);
unsigned int version;
unsigned int* SP_STATUS_REG;
const unsigned int* RDRAM_SIZE;
} GFX_INFO;
#ifdef _WIN32
#define DLLEXPORT extern "C" __declspec(dllexport)
#define DLLIMPORT extern "C" __declspec(dllimport)
#define CALL __cdecl
#else
#define DLLEXPORT extern "C" __attribute__((visibility("default")))
#define DLLIMPORT extern "C"
#endif
#if defined(_WIN32)
extern "C" RT64::Application* InitiateGFXWindows(GFX_INFO Gfx_Info, HWND hwnd, DWORD threadId);
#elif defined(__ANDROID__)
static_assert(false && "Unimplemented");
#elif defined(__linux__)
extern "C" RT64::Application* InitiateGFXLinux(GFX_INFO Gfx_Info, Window window, Display *display);
#else
static_assert(false && "Unimplemented");
#endif
DLLIMPORT void ProcessRDPList(void);
DLLIMPORT void ProcessDList(void);
DLLIMPORT void UpdateScreen(void);
DLLIMPORT void ChangeWindow(void);
DLLIMPORT void PluginShutdown(void);
static uint8_t DMEM[0x1000];
static uint8_t IMEM[0x1000];
@@ -45,7 +115,7 @@ void dummy_check_interrupts() {
}
bool RT64Init(uint8_t* rom, uint8_t* rdram, ultramodern::WindowHandle window_handle) {
RT64::Application* RT64Init(uint8_t* rom, uint8_t* rdram, ultramodern::WindowHandle window_handle) {
set_rt64_hooks();
// Dynamic loading
//auto RT64 = LoadLibrary("RT64.dll");
@@ -134,3 +204,34 @@ void RT64ChangeWindow() {
void RT64Shutdown() {
PluginShutdown();
}
void RT64UpdateConfig(RT64::Application* application, const ultramodern::GraphicsConfig& old_config, const ultramodern::GraphicsConfig& new_config) {
if (new_config.wm_option != old_config.wm_option) {
application->setFullScreen(new_config.wm_option == ultramodern::WindowMode::Fullscreen);
}
switch (new_config.res_option) {
default:
case ultramodern::Resolution::Auto:
application->userConfig.resolution = RT64::UserConfiguration::Resolution::WindowIntegerScale;
break;
case ultramodern::Resolution::Original:
application->userConfig.resolution = RT64::UserConfiguration::Resolution::Original;
break;
case ultramodern::Resolution::Original2x:
application->userConfig.resolution = RT64::UserConfiguration::Resolution::Manual;
application->userConfig.resolutionMultiplier = 2.0;
break;
}
application->userConfig.aspectRatio = new_config.ar_option;
application->userConfig.antialiasing = new_config.msaa_option;
application->userConfig.refreshRate = new_config.rr_option;
application->userConfig.refreshRateTarget = new_config.rr_manual_value;
application->updateUserConfig(true);
if (new_config.msaa_option != old_config.msaa_option) {
application->updateMultisampling();
}
}