From 6089fa5b64e0c334ac25bbcb84b6298bfaa9d148 Mon Sep 17 00:00:00 2001 From: Dasaav-dsv Date: Sun, 28 Apr 2024 01:08:28 +0200 Subject: [PATCH] Fixes to silence clang errors and warnings --- include/coresystem/file/file.hpp | 2 +- source/coresystem/file.cpp | 21 ++++++++++++--------- source/coresystem/file_wwise.inl | 4 ++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/include/coresystem/file/file.hpp b/include/coresystem/file/file.hpp index c81957ee..b4c0aea3 100644 --- a/include/coresystem/file/file.hpp +++ b/include/coresystem/file/file.hpp @@ -350,9 +350,9 @@ class resource_request { } private: - std::unique_ptr file; CS::CSResourceRepository repository; std::wstring resource; + std::unique_ptr file; FD4::FD4ResCap* res_cap = nullptr; mutable std::atomic_flag is_ready = ATOMIC_FLAG_INIT; struct resource_request_task : public CS::CSEzTask { diff --git a/source/coresystem/file.cpp b/source/coresystem/file.cpp index e63387ec..4ac502aa 100644 --- a/source/coresystem/file.cpp +++ b/source/coresystem/file.cpp @@ -16,9 +16,9 @@ namespace fs = std::filesystem; LIBER_SINGLETON_INSTANCE(CS::CSFileImp); LIBER_SINGLETON_INSTANCE(CS::CSFD4MoWwisebankRepositoryImp); -#define LIBER_RESOURCE_EXTENSION(EXT) \ - { fs::path(LIBER_STRINGIFY(.##EXT)), \ - liber::symbol::get() }, const auto& get_extension_map() { @@ -147,8 +147,8 @@ void file_request::file_request_task::eztask_execute(FD4::FD4TaskData*) { load_file_cap(request.path, request.loader, load_bnk); return; } - if (!load_bnk && !existing->ready() - || load_bnk && !is_bank_ready(existing)) + if ((!load_bnk && !existing->ready()) + || (load_bnk && !is_bank_ready(existing))) return; break; case file_request::UNLOAD: @@ -161,10 +161,11 @@ void file_request::file_request_task::eztask_execute(FD4::FD4TaskData*) { request.task.reset(); }; -#define LIBER_RESOURCE_REPOSITORY(NAME) \ - case CS::CSResourceRepository::NAME: \ - res_repository = *reinterpret_cast( \ - liber::symbol::get()); \ +#define LIBER_RESOURCE_REPOSITORY(NAME) \ + case CS::CSResourceRepository::NAME: \ + res_repository = *reinterpret_cast( \ + liber::symbol<"CS::" LIBER_STRINGIFY( \ + NAME) "Imp::instance">::get()); \ break; void from::resource_request::resource_request_task::eztask_execute( @@ -183,6 +184,8 @@ void from::resource_request::resource_request_task::eztask_execute( case CS::CSResourceRepository::CSGparamRepository: holder_offset += 0x18; break; + default: + break; } FD4::FD4ResCapHolder* res_cap_holder = reinterpret_cast(res_repository + holder_offset); diff --git a/source/coresystem/file_wwise.inl b/source/coresystem/file_wwise.inl index ddfbc932..3a1b9263 100644 --- a/source/coresystem/file_wwise.inl +++ b/source/coresystem/file_wwise.inl @@ -109,8 +109,8 @@ void override_wwise_loader_once() { MemoryBarrier(); void** overwritten_vtable = old_vtable; std::copy_n(old_vtable, 7, new_vtable); - new_vtable[1] = load_wem_override; - new_vtable[2] = load_bnk_override; + new_vtable[1] = (void*)&load_wem_override; + new_vtable[2] = (void*)&load_bnk_override; success = overwritten_vtable == InterlockedCompareExchangePointer( reinterpret_cast(&old_vtable), new_vtable,