mirror of
https://github.com/Mr-Wiseguy/Zelda64Recomp.git
synced 2024-11-22 12:59:14 +01:00
Changes to fix compilation on linux
This commit is contained in:
parent
68ee43f5ac
commit
a6e34bb49b
@ -20,7 +20,9 @@ endif()
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/lib/")
|
||||
if (WIN32)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/lib/")
|
||||
endif()
|
||||
|
||||
set(RT64_STATIC TRUE)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/lib/rt64 ${CMAKE_BINARY_DIR}/rt64)
|
||||
@ -90,7 +92,7 @@ add_custom_command(OUTPUT
|
||||
${CMAKE_SOURCE_DIR}/RecompiledPatches/recomp_overlays.inl
|
||||
${CMAKE_SOURCE_DIR}/RecompiledPatches/funcs.h
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/patch_loading.cpp
|
||||
COMMAND RecompPort patches.toml && ${CMAKE_COMMAND} -E touch ${CMAKE_SOURCE_DIR}/src/recomp/patch_loading.cpp
|
||||
COMMAND ./N64Recomp patches.toml && ${CMAKE_COMMAND} -E touch ${CMAKE_SOURCE_DIR}/src/recomp/patch_loading.cpp
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/patches/patches.bin
|
||||
)
|
||||
@ -211,6 +213,29 @@ if (WIN32)
|
||||
target_sources(Zelda64Recompiled PRIVATE ${CMAKE_SOURCE_DIR}/icons/app.rc)
|
||||
endif()
|
||||
|
||||
if (LINUX)
|
||||
find_package(X11 REQUIRED)
|
||||
|
||||
message(STATUS "X11_FOUND = ${X11_FOUND}")
|
||||
message(STATUS "X11_Xrandr_FOUND = ${X11_Xrandr_FOUND}")
|
||||
message(STATUS "X11_INCLUDE_DIR = ${X11_INCLUDE_DIR}")
|
||||
message(STATUS "X11_LIBRARIES = ${X11_LIBRARIES}")
|
||||
|
||||
include_directories(${X11_INCLUDE_DIR} ${X11_Xrandr_INCLUDE_PATH})
|
||||
target_link_libraries(Zelda64Recompiled PRIVATE ${X11_LIBRARIES} ${X11_Xrandr_LIB})
|
||||
|
||||
find_package(Freetype REQUIRED)
|
||||
|
||||
message(STATUS "FREETYPE_FOUND = ${FREETYPE_FOUND}")
|
||||
message(STATUS "FREETYPE_INCLUDE_DIRS = ${FREETYPE_INCLUDE_DIRS}")
|
||||
message(STATUS "FREETYPE_LIBRARIES = ${FREETYPE_LIBRARIES}")
|
||||
|
||||
include_directories(${FREETYPE_LIBRARIES})
|
||||
target_link_libraries(Zelda64Recompiled PRIVATE ${FREETYPE_LIBRARIES})
|
||||
|
||||
target_link_libraries(Zelda64Recompiled PRIVATE "-latomic")
|
||||
endif()
|
||||
|
||||
target_link_libraries(Zelda64Recompiled PRIVATE
|
||||
PatchesLib
|
||||
RecompiledFuncs
|
||||
@ -237,7 +262,7 @@ if (${WIN32})
|
||||
set (DXC "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/x64/dxc.exe")
|
||||
add_compile_definitions(NOMINMAX)
|
||||
else()
|
||||
set (DXC "LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/src/contrib/dxc/lib/x64" "${PROJECT_SOURCE_DIR}/src/contrib/dxc/bin/x64/dxc")
|
||||
set (DXC "LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/src/contrib/dxc/lib/x64" "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/x64/dxc")
|
||||
endif()
|
||||
|
||||
build_vertex_shader(Zelda64Recompiled "shaders/InterfaceVS.hlsl" "shaders/InterfaceVS.hlsl")
|
||||
|
@ -114,7 +114,7 @@ std::filesystem::path recomp::get_app_folder_path() {
|
||||
}
|
||||
|
||||
if (homedir != nullptr) {
|
||||
recomp_dir = std::filesystem::path{homedir} / (std::string{"."} + recomp::program_id);
|
||||
recomp_dir = std::filesystem::path{homedir} / (std::u8string{u8"."} + std::u8string{recomp::program_id});
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -380,12 +380,9 @@ void recomp::set_rumble(bool on) {
|
||||
InputState.rumble_active = on;
|
||||
}
|
||||
|
||||
static float lerp(float from, float to, float amount) {
|
||||
return (from + (to - from) * amount);
|
||||
}
|
||||
static float smoothstep(float from, float to, float amount) {
|
||||
amount = (amount * amount) * (3.0f - 2.0f * amount);
|
||||
return lerp(from, to, amount);
|
||||
return std::lerp(from, to, amount);
|
||||
}
|
||||
|
||||
// Update rumble to attempt to mimic the way n64 rumble ramps up and falls off
|
||||
|
@ -39,7 +39,7 @@ extern "C" void recomp_powf(uint8_t* rdram, recomp_context* ctx) {
|
||||
float a = _arg<0, float>(rdram, ctx);
|
||||
float b = ctx->f14.fl; //_arg<1, float>(rdram, ctx);
|
||||
|
||||
_return(ctx, std::powf(a, b));
|
||||
_return(ctx, std::pow(a, b));
|
||||
}
|
||||
|
||||
extern "C" void recomp_get_target_framerate(uint8_t* rdram, recomp_context* ctx) {
|
||||
|
@ -17,12 +17,6 @@
|
||||
#include "../ultramodern/ultramodern.hpp"
|
||||
#include "../../RecompiledPatches/patches_bin.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
inline uint32_t byteswap(uint32_t val) {
|
||||
return _byteswap_ulong(val);
|
||||
@ -49,7 +43,7 @@ bool check_hash(const std::vector<uint8_t>& rom_data, uint64_t expected_hash) {
|
||||
return calculated_hash == expected_hash;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> read_file(const std::filesystem::path& path) {
|
||||
static std::vector<uint8_t> read_file(const std::filesystem::path& path) {
|
||||
std::vector<uint8_t> ret;
|
||||
|
||||
std::ifstream file{ path, std::ios::binary};
|
||||
|
@ -68,7 +68,7 @@ struct TextureHandle {
|
||||
std::unique_ptr<RT64::RenderDescriptorSet> set;
|
||||
};
|
||||
|
||||
std::vector<char> read_file(const std::filesystem::path& filepath) {
|
||||
static std::vector<char> read_file(const std::filesystem::path& filepath) {
|
||||
std::vector<char> ret{};
|
||||
std::ifstream input_file{ filepath, std::ios::binary };
|
||||
|
||||
|
@ -175,7 +175,11 @@ ultramodern::RT64Context::RT64Context(uint8_t* rdram, ultramodern::WindowHandle
|
||||
}
|
||||
|
||||
// Set up the RT64 application.
|
||||
if (!app->setup(window_handle.thread_id)) {
|
||||
uint32_t thread_id = 0;
|
||||
#ifdef _WIN32
|
||||
thread_id = window_handle.thread_id;
|
||||
#endif
|
||||
if (!app->setup(thread_id)) {
|
||||
app = nullptr;
|
||||
return;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
# undef None
|
||||
# undef Status
|
||||
# undef LockMask
|
||||
# undef Always
|
||||
#endif
|
||||
|
||||
struct UltraThreadContext {
|
||||
|
Loading…
Reference in New Issue
Block a user