* Update RT64 to correctly report errors for shader model 5.1 GPUs

* Fixed Windows filesystem error crash

* Force audio driver selection to wasapi on Windows to prevent audio issue
This commit is contained in:
Wiseguy 2024-05-26 14:24:13 -04:00 committed by GitHub
parent 4ebe71bfcc
commit 1ea7d4ebe9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 34 additions and 23 deletions

View File

@ -87,16 +87,6 @@ add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/RecompiledPatches/patches_bin.c
DEPENDS ${CMAKE_SOURCE_DIR}/patches/patches.bin DEPENDS ${CMAKE_SOURCE_DIR}/patches/patches.bin
) )
# Generate mm_shader_cache.c from the MM shader cache if it exists
if (EXISTS ${CMAKE_SOURCE_DIR}/shadercache/mm_shader_cache.bin)
set(HAS_MM_SHADER_CACHE TRUE)
add_compile_definitions(HAS_MM_SHADER_CACHE)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mm_shader_cache.c ${CMAKE_CURRENT_BINARY_DIR}/mm_shader_cache.h
COMMAND file_to_c ${CMAKE_SOURCE_DIR}/shadercache/mm_shader_cache.bin mm_shader_cache_bytes ${CMAKE_CURRENT_BINARY_DIR}/mm_shader_cache.c ${CMAKE_CURRENT_BINARY_DIR}/mm_shader_cache.h
DEPENDS ${CMAKE_SOURCE_DIR}/shadercache/mm_shader_cache.bin
)
endif()
# Recompile patches elf into patches.c # Recompile patches elf into patches.c
add_custom_command(OUTPUT add_custom_command(OUTPUT
${CMAKE_SOURCE_DIR}/RecompiledPatches/patches.c ${CMAKE_SOURCE_DIR}/RecompiledPatches/patches.c
@ -111,6 +101,16 @@ add_custom_command(OUTPUT
# Main executable # Main executable
add_executable(Zelda64Recompiled) add_executable(Zelda64Recompiled)
# Generate mm_shader_cache.c from the MM shader cache if it exists
if (EXISTS ${CMAKE_SOURCE_DIR}/shadercache/mm_shader_cache.bin)
set(HAS_MM_SHADER_CACHE TRUE)
target_compile_definitions(Zelda64Recompiled PRIVATE HAS_MM_SHADER_CACHE)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mm_shader_cache.c ${CMAKE_CURRENT_BINARY_DIR}/mm_shader_cache.h
COMMAND file_to_c ${CMAKE_SOURCE_DIR}/shadercache/mm_shader_cache.bin mm_shader_cache_bytes ${CMAKE_CURRENT_BINARY_DIR}/mm_shader_cache.c ${CMAKE_CURRENT_BINARY_DIR}/mm_shader_cache.h
DEPENDS ${CMAKE_SOURCE_DIR}/shadercache/mm_shader_cache.bin
)
endif()
set (SOURCES set (SOURCES
${CMAKE_SOURCE_DIR}/ultramodern/audio.cpp ${CMAKE_SOURCE_DIR}/ultramodern/audio.cpp
${CMAKE_SOURCE_DIR}/ultramodern/events.cpp ${CMAKE_SOURCE_DIR}/ultramodern/events.cpp

@ -1 +1 @@
Subproject commit 64b9e166f75b4dc44a59983b67c3e9ecc1f4cfd7 Subproject commit 1adcbea31a04f2403da729eb5dfed3950dd7ec52

View File

@ -323,6 +323,10 @@ int main(int argc, char** argv) {
SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi); SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
#endif #endif
#ifdef _WIN32
// Force wasapi on Windows, as there seems to be some issue with sample queueing with directsound currently.
SDL_setenv("SDL_AUDIODRIVER", "wasapi", true);
#endif
//printf("Current dir: %ls\n", std::filesystem::current_path().c_str()); //printf("Current dir: %ls\n", std::filesystem::current_path().c_str());
// Initialize SDL audio and set the output frequency. // Initialize SDL audio and set the output frequency.

View File

@ -112,20 +112,27 @@ std::filesystem::path get_save_file_path_backup() {
} }
void update_save_file() { void update_save_file() {
{
std::ofstream save_file{ get_save_file_path_temp(), std::ios_base::binary }; std::ofstream save_file{ get_save_file_path_temp(), std::ios_base::binary };
if (save_file.good()) { if (save_file.good()) {
std::lock_guard lock{ save_context.save_buffer_mutex }; std::lock_guard lock{ save_context.save_buffer_mutex };
save_file.write(save_context.save_buffer.data(), save_context.save_buffer.size()); save_file.write(save_context.save_buffer.data(), save_context.save_buffer.size());
if (std::filesystem::exists(get_save_file_path())) {
std::filesystem::rename(get_save_file_path(),get_save_file_path_backup());
} else {
printf("\nSavefile doesn't exist. Skip renaming.");
} }
std::filesystem::rename(get_save_file_path_temp(),get_save_file_path()); else {
} else { recomp::message_box("Failed to write to the save file. Check your file permissions. If you have moved your appdata folder to Dropbox or similar, this can cause issues.");
}
}
std::error_code ec;
if (std::filesystem::exists(get_save_file_path(), ec)) {
std::filesystem::copy_file(get_save_file_path(), get_save_file_path_backup(), std::filesystem::copy_options::overwrite_existing, ec);
if (ec) {
printf("[ERROR] Failed to copy save file backup\n");
}
}
std::filesystem::copy_file(get_save_file_path_temp(), get_save_file_path(), std::filesystem::copy_options::overwrite_existing, ec);
if (ec) {
recomp::message_box("Failed to write to the save file. Check your file permissions. If you have moved your appdata folder to Dropbox or similar, this can cause issues."); recomp::message_box("Failed to write to the save file. Check your file permissions. If you have moved your appdata folder to Dropbox or similar, this can cause issues.");
//std::exit(EXIT_FAILURE);
} }
} }

View File

@ -6,7 +6,7 @@
#include "nfd.h" #include "nfd.h"
#include <filesystem> #include <filesystem>
std::string version_number = "v1.0.1"; std::string version_number = "v1.1.0";
Rml::DataModelHandle model_handle; Rml::DataModelHandle model_handle;
bool mm_rom_valid = false; bool mm_rom_valid = false;