From 643e8b15a1d22b5cf387192ddeb9bca416779ec6 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Fri, 21 Jul 2023 12:22:26 +1000 Subject: [PATCH] Fixes for other compilers --- source/application/StarApplicationController.hpp | 2 +- source/extern/CMakeLists.txt | 2 +- source/game/StarWorldClient.cpp | 12 +++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/source/application/StarApplicationController.hpp b/source/application/StarApplicationController.hpp index 922ccd5..69e9d00 100644 --- a/source/application/StarApplicationController.hpp +++ b/source/application/StarApplicationController.hpp @@ -49,7 +49,7 @@ public: virtual AudioFormat enableAudio() = 0; virtual void disableAudio() = 0; - typedef void (__cdecl* AudioCallback)(void* userdata, uint8_t* stream, int len); + typedef void (*AudioCallback)(void* userdata, uint8_t* stream, int len); virtual bool openAudioInputDevice(const char* name, int freq, int channels, void* userdata, AudioCallback callback) = 0; virtual bool closeAudioInputDevice() = 0; diff --git a/source/extern/CMakeLists.txt b/source/extern/CMakeLists.txt index 2e4ea24..41cb9b5 100644 --- a/source/extern/CMakeLists.txt +++ b/source/extern/CMakeLists.txt @@ -3,10 +3,10 @@ SET (OPUS_INSTALL_CMAKE_CONFIG_MODULE OFF) SET (OPUS_X86_MAY_HAVE_AVX OFF) SET (OPUS_X86_MAY_HAVE_SSE4_1 OFF) SET (OPUS_ENABLE_FLOAT_API ON) +SET (OPUS_FLOAT_APPROX ON) SET (OPUS_STACK_PROTECTOR OFF) SET (OPUS_NONTHREADSAFE_PSEUDOSTACK OFF) SET (OPUS_USE_ALLOCA ON) - ADD_SUBDIRECTORY (opus) IF (OPUS_NONTHREADSAFE_PSEUDOSTACK) diff --git a/source/game/StarWorldClient.cpp b/source/game/StarWorldClient.cpp index d6e6020..56f28a2 100644 --- a/source/game/StarWorldClient.cpp +++ b/source/game/StarWorldClient.cpp @@ -795,7 +795,7 @@ void WorldClient::handleIncomingPackets(List const& packets) { m_damageManager->pushRemoteDamageRequest(damage->remoteDamageRequest); } else if (auto damage = as(packet)) { - std::string_view view(damage->remoteDamageNotification.damageNotification.targetMaterialKind.utf8()); + std::string_view view = damage->remoteDamageNotification.damageNotification.targetMaterialKind.utf8(); static const size_t FULL_SIZE = SECRET_BROADCAST_PREFIX.size() + Curve25519::SignatureSize; static const std::string LEGACY_VOICE_PREFIX = "data\0voice\0"s; @@ -824,14 +824,16 @@ void WorldClient::handleIncomingPackets(List const& packets) { // (remove this and stop transmitting like this once most SE features are ported over) if (auto player = m_entityMap->get(damage->remoteDamageNotification.sourceEntityId)) { if (auto publicKey = player->effectsAnimator()->globalTagPtr("\0SE_VOICE_SIGNING_KEY"s)) { - auto rawData = view.substr(75); + auto raw = view.substr(75); if (m_broadcastCallback && Curve25519::verify( (uint8_t const*)view.data() + LEGACY_VOICE_PREFIX.size(), (uint8_t const*)publicKey->utf8Ptr(), - (void*)rawData.data(), - rawData.size() + (void*)raw.data(), + raw.size() )) { - m_broadcastCallback(player, "Voice\0"s + rawData); + auto broadcastData = "Voice\0"s; + broadcastData.append(raw.data(), raw.size()); + m_broadcastCallback(player, broadcastData); } } }