mirror of
https://github.com/N64Recomp/N64ModernRuntime.git
synced 2025-12-25 09:22:37 +00:00
* `RendererContext` abstract class * Delete rt64_layer * Implement renderer creation callback * Make `GraphicsConfig` an abstract class * Remove rt64 * Add renderer callback to `ultramodern::set_callbacks` * Fix rebase * Change setup_result's visibility to protected * Declare abstract `is_equal` method instead of operators * Various fixes * Fix issues * trigger_config_action * Move GraphicsConfig back to ultramodern * Change `update_config` to return if any changes were applied * Rename renderer_wrapper to renderer_context * Remove SDL2 and other libraries * Allow registering get_graphics_api_name * Move WindowHandle to renderer namespace * Comments explaining which callbacks are required * Fix CI * Update readme * `ULTRAMODERN_QUICK_EXIT` macro * Remove --config from readme * Add `add_compile_definitions(NOMINMAX)`
22 lines
663 B
C++
22 lines
663 B
C++
#include "ultramodern/ultra64.h"
|
|
|
|
#define K0BASE 0x80000000
|
|
#define K1BASE 0xA0000000
|
|
#define K2BASE 0xC0000000
|
|
#define IS_KSEG0(x) ((u32)(x) >= K0BASE && (u32)(x) < K1BASE)
|
|
#define IS_KSEG1(x) ((u32)(x) >= K1BASE && (u32)(x) < K2BASE)
|
|
#define K0_TO_PHYS(x) ((u32)(x)&0x1FFFFFFF)
|
|
#define K1_TO_PHYS(x) ((u32)(x)&0x1FFFFFFF)
|
|
|
|
u32 osVirtualToPhysical(PTR(void) addr) {
|
|
uintptr_t addr_val = (uintptr_t)addr;
|
|
if (IS_KSEG0(addr_val)) {
|
|
return K0_TO_PHYS(addr_val);
|
|
} else if (IS_KSEG1(addr_val)) {
|
|
return K1_TO_PHYS(addr_val);
|
|
} else {
|
|
// TODO handle TLB mappings
|
|
return (u32)addr_val;
|
|
}
|
|
}
|
|
|