From 5aa650bffa061b118426b70e68d6000fbd8a926d Mon Sep 17 00:00:00 2001 From: Reonu Date: Fri, 26 Jul 2024 04:08:23 +0100 Subject: [PATCH] Update RT64 for HD texture framework and DXIL linker (#262) * WIP HD texture support * Remove STB implementation as it's already defined in RT64 * Fix texcoords for seamless pause background patch * Fix RT64 compilation error and temporarily disable shader cache * Fix vertices for bottom strip in seamless pause background patch * Update RT64 for mip preloading and alignment fixes * Update RT64 for zipped texture pack support and fix CMake warning flags for clang-cl * Update RT64 to have multiple pack loading and texture memory stats in the debugger * Update RT64 to fix replace button crash * Update to RT64 main as HD textures were merged and completely removed shader cache as it's not needed --------- Co-authored-by: Wiseguy <68165316+Mr-Wiseguy@users.noreply.github.com> --- CMakeLists.txt | 5 ++++- lib/rt64 | 2 +- patches/fixes.c | 6 +++--- src/main/main.cpp | 8 -------- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7acd983..b1b6e79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) # set(CMAKE_CXX_VISIBILITY_PRESET hidden) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-everything -Wall -Wextra") +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-everything /W4") +endif() # Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24: if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") @@ -29,6 +31,7 @@ SET(LUNASVG_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) add_subdirectory(${CMAKE_SOURCE_DIR}/lib/lunasvg) # set(BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS_SAVED}") SET(ENABLE_SVG_PLUGIN ON CACHE BOOL "" FORCE) +SET(RMLUI_TESTS_ENABLED OFF CACHE BOOL "" FORCE) add_subdirectory(${CMAKE_SOURCE_DIR}/lib/RmlUi) add_subdirectory(${CMAKE_SOURCE_DIR}/lib/N64ModernRuntime) diff --git a/lib/rt64 b/lib/rt64 index 36e3114..0fd6d05 160000 --- a/lib/rt64 +++ b/lib/rt64 @@ -1 +1 @@ -Subproject commit 36e3114cd23a80683504c257729ff7a419735f50 +Subproject commit 0fd6d05b8a0ec5daae313ad9e8504812ec31775d diff --git a/patches/fixes.c b/patches/fixes.c index 7d159c1..2f3f8b2 100644 --- a/patches/fixes.c +++ b/patches/fixes.c @@ -35,11 +35,11 @@ RECOMP_PATCH s16 KaleidoScope_SetPageVertices(PlayState* play, Vtx* vtx, s16 vtx s32 cur_y; u32 row; - cur_y = PAGE_BG_HEIGHT / 2; + cur_y = (PAGE_BG_HEIGHT + 2) / 2; // 2 verts per row plus 2 extra verts at the start and the end. for (row = 0; row < RECOMP_PAGE_ROW_COUNT + 2; row++) { - s32 next_y = MAX(cur_y - RECOMP_PAGE_ROW_HEIGHT, -PAGE_BG_HEIGHT / 2); + s32 next_y = MAX(cur_y - RECOMP_PAGE_ROW_HEIGHT, -(PAGE_BG_HEIGHT + 2) / 2); vtx[4 * row + 0].v.ob[0] = -PAGE_BG_WIDTH / 2; vtx[4 * row + 1].v.ob[0] = PAGE_BG_WIDTH / 2; @@ -234,7 +234,7 @@ RECOMP_PATCH Gfx* KaleidoScope_DrawPageSections(Gfx* gfx, Vtx* vertices, Texture // Draw the rows. for (u32 bg_row = 0; bg_row < RECOMP_PAGE_ROW_COUNT; bg_row++) { - u32 cur_row_height = MIN(RECOMP_PAGE_ROW_HEIGHT, PAGE_BG_HEIGHT - bg_row * RECOMP_PAGE_ROW_HEIGHT); + u32 cur_row_height = MIN(RECOMP_PAGE_ROW_HEIGHT, PAGE_BG_HEIGHT + 1 - bg_row * RECOMP_PAGE_ROW_HEIGHT); gDPLoadTextureTile(gfx++, *cur_image, G_IM_FMT_IA, G_IM_SIZ_8b, // fmt, siz PAGE_BG_WIDTH + 2, PAGE_BG_HEIGHT + 2, // width, height diff --git a/src/main/main.cpp b/src/main/main.cpp index 50edd04..99d940b 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -28,17 +28,12 @@ #include "ovl_patches.hpp" #include "librecomp/game.hpp" -#ifdef HAS_MM_SHADER_CACHE -#include "mm_shader_cache.h" -#endif - #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include #include "SDL_syswm.h" #endif -#define STB_IMAGE_IMPLEMENTATION #include "../../lib/rt64/src/contrib/stb/stb_image.h" template @@ -332,9 +327,6 @@ std::vector supported_games = { .rom_hash = 0xEF18B4A9E2386169ULL, .internal_name = "ZELDA MAJORA'S MASK", .game_id = u8"mm.n64.us.1.0", -#ifdef HAS_MM_SHADER_CACHE - .cache_data = {mm_shader_cache_bytes, sizeof(mm_shader_cache_bytes)}, -#endif .is_enabled = true, .entrypoint_address = get_entrypoint_address(), .entrypoint = recomp_entrypoint,