Skip to content

Commit

Permalink
Fixed build
Browse files Browse the repository at this point in the history
  • Loading branch information
deathkiller committed Apr 21, 2024
1 parent 2085973 commit 2ea6a07
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Sources/Jazz2.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
<ClInclude Include="$(ExtensionLibraryPath)\IO\Stream.h" />
<ClInclude Include="$(ExtensionLibraryPath)\Base\Unaligned.h" />
<ClInclude Include="$(ExtensionLibraryPath)\Base\TypeInfo.h" />
<ClInclude Include="..\..\Sdílené soubory Death™ Common\Native\IO\PakFile.h" />
<ClInclude Include="$(ExtensionLibraryPath)\IO\PakFile.h" />
<ClInclude Include="backward\backward.h" />
<ClInclude Include="Common.h" />
<ClInclude Include="Jazz2\Actors\ActorBase.h" />
Expand Down Expand Up @@ -706,7 +706,7 @@
<ClCompile Include="$(ExtensionLibraryPath)\IO\FileSystem.cpp" />
<ClCompile Include="$(ExtensionLibraryPath)\IO\MemoryStream.cpp" />
<ClCompile Include="$(ExtensionLibraryPath)\IO\Stream.cpp" />
<ClCompile Include="..\..\Sdílené soubory Death™ Common\Native\IO\PakFile.cpp" />
<ClCompile Include="$(ExtensionLibraryPath)\IO\PakFile.cpp" />
<ClCompile Include="Jazz2\Actors\ActorBase.cpp" />
<ClCompile Include="Jazz2\Actors\Collectibles\CarrotCollectible.cpp" />
<ClCompile Include="Jazz2\Actors\Collectibles\CarrotFlyCollectible.cpp" />
Expand Down
4 changes: 2 additions & 2 deletions Sources/Jazz2.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@
<ClInclude Include="backward\backward.h">
<Filter>Header Files\backward</Filter>
</ClInclude>
<ClInclude Include="..\..\Sdílené soubory Death™ Common\Native\IO\PakFile.h">
<ClInclude Include="$(ExtensionLibraryPath)\IO\PakFile.h">
<Filter>Header Files\Shared\IO</Filter>
</ClInclude>
</ItemGroup>
Expand Down Expand Up @@ -2444,7 +2444,7 @@
<ClCompile Include="Jazz2\UI\Menu\FirstRunSection.cpp">
<Filter>Source Files\Jazz2\UI\Menu</Filter>
</ClCompile>
<ClCompile Include="..\..\Sdílené soubory Death™ Common\Native\IO\PakFile.cpp">
<ClCompile Include="$(ExtensionLibraryPath)\IO\PakFile.cpp">
<Filter>Source Files\Shared\IO</Filter>
</ClCompile>
</ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions Sources/Shared/IO/AndroidAssetStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions Sources/Shared/IO/AndroidAssetStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#if defined(DEATH_TARGET_ANDROID)

#include "Stream.h"
#include "../Containers/String.h"
#include "../Containers/StringView.h"

#include <android_native_app_glue.h> // For android_app
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Sources/Shared/IO/FileStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions Sources/Shared/IO/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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+
Expand Down
4 changes: 2 additions & 2 deletions Sources/nCine/Input/JoyMapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) ||
Expand Down

0 comments on commit 2ea6a07

Please sign in to comment.