diff options
| author | GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com> | 2022-08-15 04:57:24 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-14 22:57:24 -0400 |
| commit | f7c2b5ef1d39bb39126c28743a63155bf415e9ca (patch) | |
| tree | e94e3bbcca8aa3266a15d28e0507eed3227172e9 | |
| parent | b17ef7f66d5b1feecd02363960077110275058b6 (diff) | |
Wii U support (#1097)
* Wii U support
* [WiiU] Combined Dockerfile
* [WiiU] Combined Dockerfile
* [WiiU] Combined Dockerfile
* Add Jenkins support
* wiiu: fix scissor clamp
* wiiu: improve button remapping
* wiiu: fix scaling issues
* Update Dockerfile after merge
* Pull assets before build
* Only stop container once
* Adjust logging sinks
* wiiu: Change button mapping to match PC version
* wiiu: Implement controller changes
* wiiu: Update BUILDING.md
Co-authored-by: qurious-pixel <62252937+qurious-pixel@users.noreply.github.com>
Co-authored-by: David Chavez <david@dcvz.io>
| -rw-r--r-- | ZAPD/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | ZAPDUtils/Utils/BinaryReader.cpp | 17 | ||||
| -rw-r--r-- | ZAPDUtils/Utils/BinaryWriter.cpp | 17 | ||||
| -rw-r--r-- | ZAPDUtils/Utils/StringHelper.cpp | 4 |
4 files changed, 41 insertions, 5 deletions
diff --git a/ZAPD/CMakeLists.txt b/ZAPD/CMakeLists.txt index 7487938..cf49ef6 100644 --- a/ZAPD/CMakeLists.txt +++ b/ZAPD/CMakeLists.txt @@ -465,6 +465,12 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") PNG::PNG
Threads::Threads
)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "CafeOS")
+ set(ADDITIONAL_LIBRARY_DEPENDENCIES
+ "ZAPDUtils;"
+ "libultraship;"
+ PNG::PNG
+ )
else()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
@@ -478,7 +484,7 @@ else() )
endif()
-if(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch")
+if(CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS")
add_library(pathconf OBJECT pathconf.c)
target_link_libraries(${PROJECT_NAME} PRIVATE "${ADDITIONAL_LIBRARY_DEPENDENCIES}" $<TARGET_OBJECTS:pathconf> )
else()
diff --git a/ZAPDUtils/Utils/BinaryReader.cpp b/ZAPDUtils/Utils/BinaryReader.cpp index 5916ce9..092124a 100644 --- a/ZAPDUtils/Utils/BinaryReader.cpp +++ b/ZAPDUtils/Utils/BinaryReader.cpp @@ -130,7 +130,13 @@ float BinaryReader::ReadSingle() stream->Read((char*)&result, sizeof(float)); if (endianness != Endianness::Native) - result = BitConverter::ToFloatBE((uint8_t*)&result, 0); + { + float tmp; + char* dst = (char*)&tmp; + char* src = (char*)&result; + dst[3] = src[0]; dst[2] = src[1]; dst[1] = src[2]; dst[0] = src[3]; + result = tmp; + } if (std::isnan(result)) throw std::runtime_error("BinaryReader::ReadSingle(): Error reading stream"); @@ -145,7 +151,14 @@ double BinaryReader::ReadDouble() stream->Read((char*)&result, sizeof(double)); if (endianness != Endianness::Native) - result = BitConverter::ToDoubleBE((uint8_t*)&result, 0); + { + double tmp; + char* dst = (char*)&tmp; + char* src = (char*)&result; + dst[7] = src[0]; dst[6] = src[1]; dst[5] = src[2]; dst[4] = src[3]; + dst[3] = src[4]; dst[2] = src[5]; dst[1] = src[6]; dst[0] = src[7]; + result = tmp; + } if (std::isnan(result)) throw std::runtime_error("BinaryReader::ReadDouble(): Error reading stream"); diff --git a/ZAPDUtils/Utils/BinaryWriter.cpp b/ZAPDUtils/Utils/BinaryWriter.cpp index aa7840f..34bcad0 100644 --- a/ZAPDUtils/Utils/BinaryWriter.cpp +++ b/ZAPDUtils/Utils/BinaryWriter.cpp @@ -107,7 +107,13 @@ void BinaryWriter::Write(uint64_t value) void BinaryWriter::Write(float value) { if (endianness != Endianness::Native) - value = BitConverter::ToFloatBE((uint8_t*)&value, 0); + { + float tmp; + char* dst = (char*)&tmp; + char* src = (char*)&value; + dst[3] = src[0]; dst[2] = src[1]; dst[1] = src[2]; dst[0] = src[3]; + value = tmp; + } stream->Write((char*)&value, sizeof(float)); } @@ -115,7 +121,14 @@ void BinaryWriter::Write(float value) void BinaryWriter::Write(double value) { if (endianness != Endianness::Native) - value = BitConverter::ToDoubleBE((uint8_t*)&value, 0); + { + double tmp; + char* dst = (char*)&tmp; + char* src = (char*)&value; + dst[7] = src[0]; dst[6] = src[1]; dst[5] = src[2]; dst[4] = src[3]; + dst[3] = src[4]; dst[2] = src[5]; dst[1] = src[6]; dst[0] = src[7]; + value = tmp; + } stream->Write((char*)&value, sizeof(double)); } diff --git a/ZAPDUtils/Utils/StringHelper.cpp b/ZAPDUtils/Utils/StringHelper.cpp index 051e9a8..26a8af3 100644 --- a/ZAPDUtils/Utils/StringHelper.cpp +++ b/ZAPDUtils/Utils/StringHelper.cpp @@ -64,7 +64,11 @@ void StringHelper::ReplaceOriginal(std::string& str, const std::string& from, co bool StringHelper::StartsWith(const std::string& s, const std::string& input) { +#if __cplusplus >= 202002L + return s.starts_with(input.c_str()); +#else return s.rfind(input, 0) == 0; +#endif } bool StringHelper::Contains(const std::string& s, const std::string& input) |
