From 2ea6a07d8efe38f7eb40d0c2aaed2c8d7cd59d45 Mon Sep 17 00:00:00 2001 From: Death Killer <884052+deathkiller@users.noreply.github.com> Date: Sun, 21 Apr 2024 23:23:23 +0200 Subject: [PATCH] Fixed build --- Sources/Jazz2.vcxproj | 4 ++-- Sources/Jazz2.vcxproj.filters | 4 ++-- Sources/Shared/IO/AndroidAssetStream.cpp | 5 +++++ Sources/Shared/IO/AndroidAssetStream.h | 5 +++++ Sources/Shared/IO/FileStream.h | 2 +- Sources/Shared/IO/FileSystem.cpp | 6 ++++-- Sources/nCine/Input/JoyMapping.cpp | 4 ++-- 7 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Sources/Jazz2.vcxproj b/Sources/Jazz2.vcxproj index 51d9c11e..dcf7027d 100644 --- a/Sources/Jazz2.vcxproj +++ b/Sources/Jazz2.vcxproj @@ -303,7 +303,7 @@ - + @@ -706,7 +706,7 @@ - + diff --git a/Sources/Jazz2.vcxproj.filters b/Sources/Jazz2.vcxproj.filters index 9208d2d8..49c0befe 100644 --- a/Sources/Jazz2.vcxproj.filters +++ b/Sources/Jazz2.vcxproj.filters @@ -1476,7 +1476,7 @@ Header Files\backward - + Header Files\Shared\IO @@ -2444,7 +2444,7 @@ Source Files\Jazz2\UI\Menu - + Source Files\Shared\IO diff --git a/Sources/Shared/IO/AndroidAssetStream.cpp b/Sources/Shared/IO/AndroidAssetStream.cpp index de360e53..9269cee6 100644 --- a/Sources/Shared/IO/AndroidAssetStream.cpp +++ b/Sources/Shared/IO/AndroidAssetStream.cpp @@ -126,6 +126,11 @@ namespace Death { namespace IO { #endif } + Containers::StringView AndroidAssetStream::GetPath() const + { + return _path; + } + void AndroidAssetStream::InitializeAssetManager(struct android_app* state) { _assetManager = state->activity->assetManager; diff --git a/Sources/Shared/IO/AndroidAssetStream.h b/Sources/Shared/IO/AndroidAssetStream.h index 904bbc8e..a04451c9 100644 --- a/Sources/Shared/IO/AndroidAssetStream.h +++ b/Sources/Shared/IO/AndroidAssetStream.h @@ -5,6 +5,7 @@ #if defined(DEATH_TARGET_ANDROID) #include "Stream.h" +#include "../Containers/String.h" #include "../Containers/StringView.h" #include // For android_app @@ -33,6 +34,9 @@ namespace Death { namespace IO { std::int32_t Write(const void* buffer, std::int32_t bytes) override; bool IsValid() const override; + + /** @brief Returns file path */ + Containers::StringView GetPath() const; void SetCloseOnDestruction(bool shouldCloseOnDestruction) override { _shouldCloseOnDestruction = shouldCloseOnDestruction; @@ -74,6 +78,7 @@ namespace Death { namespace IO { static AAssetManager* _assetManager; static const char* _internalDataPath; + Containers::String _path; #if defined(DEATH_USE_FILE_DESCRIPTORS) std::int32_t _fileDescriptor; unsigned long int _startOffset; diff --git a/Sources/Shared/IO/FileStream.h b/Sources/Shared/IO/FileStream.h index c809235d..37094319 100644 --- a/Sources/Shared/IO/FileStream.h +++ b/Sources/Shared/IO/FileStream.h @@ -24,7 +24,7 @@ namespace Death { namespace IO { bool IsValid() const override; - /** @brief Returns file path if any */ + /** @brief Returns file path */ Containers::StringView GetPath() const; void SetCloseOnDestruction(bool shouldCloseOnDestruction) override { diff --git a/Sources/Shared/IO/FileSystem.cpp b/Sources/Shared/IO/FileSystem.cpp index f66dbb60..24b76bd0 100644 --- a/Sources/Shared/IO/FileSystem.cpp +++ b/Sources/Shared/IO/FileSystem.cpp @@ -1844,10 +1844,10 @@ namespace Death { namespace IO { id pathString = ((id(*)(Class, SEL, const char*))objc_msgSend)(nsStringClass, sel_getUid("stringWithUTF8String:"), String::nullTerminatedView(path).data()); id pathUrl = ((id(*)(Class, SEL, id))objc_msgSend)(nsUrlClass, sel_getUid("fileURLWithPath:"), pathString); id fileManagerInstance = ((id(*)(Class, SEL))objc_msgSend)(nsFileManager, sel_getUid("defaultManager")); - return ((bool(*)(id, SEL, id, SEL, id, SEL, id))objc_msgSend)(fileManagerInstance, sel_getUid("trashItemAtURL:"), pathUrl, nullptr, nullptr); + return ((bool(*)(id, SEL, id, SEL, id, SEL, id))objc_msgSend)(fileManagerInstance, sel_getUid("trashItemAtURL:"), pathUrl, sel_getUid("resultingItemURL:"), nullptr, sel_getUid("error:"), nullptr); } return false; -#elif defined(DEATH_TARGET_WINDOWS) +#elif defined(DEATH_TARGET_WINDOWS) && !defined(DEATH_TARGET_WINDOWS_RT) auto pathW = Utf8::ToUtf16(path); SHFILEOPSTRUCTW sf; @@ -1898,6 +1898,7 @@ namespace Death { namespace IO { return false; } +#if !defined(DEATH_TARGET_APPLE) && !defined(DEATH_TARGET_SWITCH) && !defined(__FreeBSD__) while (true) { if (::fallocate(dest, FALLOC_FL_KEEP_SIZE, 0, sb.st_size) == 0) { break; @@ -1910,6 +1911,7 @@ namespace Death { namespace IO { return false; } } +#endif # if defined(DEATH_TARGET_APPLE) // fcopyfile works on FreeBSD and OS X 10.5+ diff --git a/Sources/nCine/Input/JoyMapping.cpp b/Sources/nCine/Input/JoyMapping.cpp index 8ce7b620..9edf0f02 100644 --- a/Sources/nCine/Input/JoyMapping.cpp +++ b/Sources/nCine/Input/JoyMapping.cpp @@ -439,7 +439,7 @@ namespace nCine #if defined(DEATH_TARGET_ANDROID) // Never search by name on Android, it can lead to wrong mapping if (!mapping.isValid) { - auto joyNameLower = StringUtils::lowercase(joyName); + auto joyNameLower = StringUtils::lowercase(StringView(joyName)); // Don't assign Android default mapping to internal NVIDIA Shield devices, WSA devices and mice (detected as gamepads) if (joyNameLower == "virtual-search"_s || joyNameLower == "shield-ask-remote"_s || joyNameLower == "virtual_keyboard"_s || joyNameLower.contains("mouse"_s)) { return false; @@ -488,7 +488,7 @@ namespace nCine # if defined(DEATH_TARGET_UNIX) // Keyboards, mice and touchpads (SynPS/2 Synaptics TouchPad), and also VMware virtual devices on Linux/BSD // are incorrectly recognized as joystick in some cases, don't assign XInput mapping to them - auto joyNameLower = StringUtils::lowercase(joyName); + auto joyNameLower = StringUtils::lowercase(StringView(joyName)); if (joyNameLower.contains("keyboard"_s) || joyNameLower.contains("mouse"_s) || (joyNameLower.contains("razer "_s) && joyNameLower.contains("deathadder"_s)) || (joyNameLower == "synps/2 synaptics touchpad"_s) ||