Compare commits

..

3 Commits

Author SHA1 Message Date
WarmUpTill
c8f4e524ba Make deps/exprtk dependency optional 2026-09-28 21:10:59 +02:00
WarmUpTill
b104f98d02 Fix Twitch token status not reflecting reality when cached user ID empty 2026-09-25 19:43:24 +02:00
WarmUpTill
abc8c3708f Fix Twitch token being treated as invalid after load with broken config
Some checks failed
debian-build / build (push) Has been cancelled
Push to master / Check Formatting 🔍 (push) Has been cancelled
Push to master / Build Project 🧱 (push) Has been cancelled
Push to master / Create Release 🛫 (push) Has been cancelled
2026-09-23 09:32:30 +02:00
23 changed files with 74 additions and 295 deletions

View File

@@ -38,4 +38,4 @@ runs:
if: ${{ runner.os == 'Windows' }} if: ${{ runner.os == 'Windows' }}
shell: pwsh shell: pwsh
run: | run: |
${{ inputs.workingDirectory }}/build_${{ inputs.target }}/tests/${{ inputs.config }}/advanced-scene-switcher-tests.exe ${{ inputs.workingDirectory }}/build_x64/tests/${{ inputs.config }}/advanced-scene-switcher-tests.exe

View File

@@ -2,7 +2,7 @@
param( param(
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')] [ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
[string] $Configuration = 'RelWithDebInfo', [string] $Configuration = 'RelWithDebInfo',
[ValidateSet('x86', 'x64', 'arm64')] [ValidateSet('x86', 'x64')]
[string] $Target, [string] $Target,
[ValidateSet('Visual Studio 17 2022', 'Visual Studio 16 2019')] [ValidateSet('Visual Studio 17 2022', 'Visual Studio 16 2019')]
[string] $CMakeGenerator, [string] $CMakeGenerator,
@@ -211,17 +211,13 @@ function Build {
$msbuildExe = vswhere -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe | select-object -first 1 $msbuildExe = vswhere -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe | select-object -first 1
if ($msbuildExe) { if ($msbuildExe) {
$LibusbPlatform = if ($Target -eq 'arm64') { 'arm64' } else { 'x64' }
$env:CL="/wd5287" $env:CL="/wd5287"
Invoke-External $msbuildExe "${LibusbPath}/msvc/libusb.sln" /property:Configuration=Release /property:Platform=$LibusbPlatform Invoke-External $msbuildExe "${LibusbPath}/msvc/libusb.sln" /property:Configuration=Release /property:Platform=x64
Remove-Item Env:CL Remove-Item Env:CL
$libusbBuildResultDirectory = Get-ChildItem -Path "${LibusbPath}/build" -Directory -Filter "v*" -ErrorAction SilentlyContinue | $libusbBuildResultDirectory = "${LibusbPath}/build/v143/x64/Release"
ForEach-Object { Join-Path $_.FullName "${LibusbPlatform}/Release" } | if (-not (Test-Path -Path $libusbBuildResultDirectory)) {
Where-Object { Test-Path -Path $_ } | $libusbBuildResultDirectory = "${LibusbPath}/x64/Release/dll"
Select-Object -First 1
if (-not $libusbBuildResultDirectory) {
$libusbBuildResultDirectory = "${LibusbPath}/${LibusbPlatform}/Release/dll"
} }
Copy-Item -Path "${libusbBuildResultDirectory}/*" -Destination ${ADVSSDepPath} -Recurse -Force Copy-Item -Path "${libusbBuildResultDirectory}/*" -Destination ${ADVSSDepPath} -Recurse -Force
} else { } else {
@@ -251,10 +247,9 @@ function Build {
if ($opensslDir) { if ($opensslDir) {
Write-Host "Detected OpenSSL at: $opensslDir" Write-Host "Detected OpenSSL at: $opensslDir"
$OpenSSLArch = if ($Target -eq 'arm64') { 'arm64' } else { 'x64' }
$MqttCmakeArgs += "-DOPENSSL_ROOT_DIR=$opensslDir" $MqttCmakeArgs += "-DOPENSSL_ROOT_DIR=$opensslDir"
$MqttCmakeArgs += "-DOPENSSL_CRYPTO_LIBRARY=$opensslDir\lib\VC\$OpenSSLArch\MD\libcrypto.lib" $MqttCmakeArgs += "-DOPENSSL_CRYPTO_LIBRARY=$opensslDir\lib\VC\x64\MD\libcrypto.lib"
$MqttCmakeArgs += "-DOPENSSL_SSL_LIBRARY=$opensslDir\lib\VC\$OpenSSLArch\MD\libssl.lib" $MqttCmakeArgs += "-DOPENSSL_SSL_LIBRARY=$opensslDir\lib\VC\x64\MD\libssl.lib"
} else { } else {
Write-Warning "OpenSSL not found - maybe cmake will find it ..." Write-Warning "OpenSSL not found - maybe cmake will find it ..."
} }

View File

@@ -1,6 +1,6 @@
[CmdletBinding()] [CmdletBinding()]
param( param(
[ValidateSet('x64', 'arm64')] [ValidateSet('x64')]
[string] $Target = 'x64', [string] $Target = 'x64',
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')] [ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
[string] $Configuration = 'RelWithDebInfo', [string] $Configuration = 'RelWithDebInfo',

View File

@@ -1,6 +1,6 @@
[CmdletBinding()] [CmdletBinding()]
param( param(
[ValidateSet('x64', 'arm64')] [ValidateSet('x64')]
[string] $Target = 'x64', [string] $Target = 'x64',
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')] [ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
[string] $Configuration = 'RelWithDebInfo', [string] $Configuration = 'RelWithDebInfo',
@@ -69,8 +69,7 @@ function Package {
Remove-Item @RemoveArgs Remove-Item @RemoveArgs
$ReleasePath = "${ProjectRoot}/release/${Configuration}" $ReleasePath = "${ProjectRoot}/release/${Configuration}"
$BinDirName = if ($Target -eq 'arm64') { 'arm64' } else { '64bit' } $NewBinPath = "${ReleasePath}/${ProductName}/bin/64bit"
$NewBinPath = "${ReleasePath}/${ProductName}/bin/${BinDirName}"
$NewDataPath = "${ReleasePath}/${ProductName}/data" $NewDataPath = "${ReleasePath}/${ProductName}/data"
$CIWindowsDir = "${ProjectRoot}/build-aux/CI/windows" $CIWindowsDir = "${ProjectRoot}/build-aux/CI/windows"
@@ -81,7 +80,7 @@ function Package {
New-Item -ItemType Directory -Force -Path $RecStaging | Out-Null New-Item -ItemType Directory -Force -Path $RecStaging | Out-Null
Copy-Item -Path "${CIWindowsDir}/README.txt" -Destination "${RecStaging}/README.txt" Copy-Item -Path "${CIWindowsDir}/README.txt" -Destination "${RecStaging}/README.txt"
if ( Test-Path -Path $NewBinPath ) { if ( Test-Path -Path $NewBinPath ) {
$RecBinPath = "${RecStaging}/${ProductName}/bin/${BinDirName}" $RecBinPath = "${RecStaging}/${ProductName}/bin/64bit"
New-Item -ItemType Directory -Force -Path $RecBinPath | Out-Null New-Item -ItemType Directory -Force -Path $RecBinPath | Out-Null
Copy-Item -Path "${NewBinPath}/*" -Destination $RecBinPath -Recurse -Force Copy-Item -Path "${NewBinPath}/*" -Destination $RecBinPath -Recurse -Force
} }
@@ -103,7 +102,7 @@ function Package {
New-Item -ItemType Directory -Force -Path $PortableStaging | Out-Null New-Item -ItemType Directory -Force -Path $PortableStaging | Out-Null
Copy-Item -Path "${CIWindowsDir}/README-portable.txt" -Destination "${PortableStaging}/README.txt" Copy-Item -Path "${CIWindowsDir}/README-portable.txt" -Destination "${PortableStaging}/README.txt"
if ( Test-Path -Path $NewBinPath ) { if ( Test-Path -Path $NewBinPath ) {
$PortableBinPath = "${PortableStaging}/obs-plugins/${BinDirName}" $PortableBinPath = "${PortableStaging}/obs-plugins/64bit"
New-Item -ItemType Directory -Force -Path $PortableBinPath | Out-Null New-Item -ItemType Directory -Force -Path $PortableBinPath | Out-Null
Copy-Item -Path "${NewBinPath}/*" -Destination $PortableBinPath -Recurse -Force Copy-Item -Path "${NewBinPath}/*" -Destination $PortableBinPath -Recurse -Force
} }
@@ -137,10 +136,10 @@ function Package {
Copy-Item -Path "${Configuration}/*" -Destination $PkgRec -Recurse -Force Copy-Item -Path "${Configuration}/*" -Destination $PkgRec -Recurse -Force
# Legacy layout (for OBS installation directory) # Legacy layout (for OBS installation directory)
if ( Test-Path "${Configuration}/${ProductName}/bin/${BinDirName}" ) { if ( Test-Path "${Configuration}/${ProductName}/bin/64bit" ) {
$PkgLegBin = "Package/portable/obs-plugins/${BinDirName}" $PkgLegBin = "Package/portable/obs-plugins/64bit"
New-Item -ItemType Directory -Force -Path $PkgLegBin | Out-Null New-Item -ItemType Directory -Force -Path $PkgLegBin | Out-Null
Copy-Item -Path "${Configuration}/${ProductName}/bin/${BinDirName}/*" -Destination $PkgLegBin -Recurse -Force Copy-Item -Path "${Configuration}/${ProductName}/bin/64bit/*" -Destination $PkgLegBin -Recurse -Force
} }
if ( Test-Path "${Configuration}/${ProductName}/data" ) { if ( Test-Path "${Configuration}/${ProductName}/data" ) {
$PkgLegData = "Package/portable/data/obs-plugins/${ProductName}" $PkgLegData = "Package/portable/data/obs-plugins/${ProductName}"

View File

@@ -415,63 +415,3 @@ jobs:
with: with:
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-windows-x64-${{ needs.check-event.outputs.commitHash }} name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-windows-x64-${{ needs.check-event.outputs.commitHash }}
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-windows-x64*.* path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-windows-x64*.*
windows-arm64-build:
name: Build for Windows ARM64 🪟
runs-on: windows-11-arm
needs: check-event
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0
- name: Set Up Environment 🔧
id: setup
run: |
# Set Up Environment 🔧
if ( $Env:RUNNER_DEBUG -ne $null ) {
Set-PSDebug -Trace 1
}
$BuildSpec = Get-Content -Path buildspec.json -Raw | ConvertFrom-Json
$ProductName = $BuildSpec.name
$GitOutput = git describe --tags
"pluginName=${ProductName}" >> $env:GITHUB_OUTPUT
"pluginVersion=${GitOutput}" >> $env:GITHUB_OUTPUT
- name: Build Dependencies 🏗️
uses: ./.github/actions/build-dependencies
with:
workingDirectory: ${{ github.workspace }}/plugin
target: arm64
config: ${{ needs.check-event.outputs.config }}
- name: Build Plugin 🧱
uses: ./.github/actions/build-plugin
with:
target: arm64
config: ${{ needs.check-event.outputs.config }}
- name: Run tests
uses: ./.github/actions/run-tests
with:
target: arm64
config: ${{ needs.check-event.outputs.config }}
- name: Package Plugin 📀
uses: ./.github/actions/package-plugin
with:
target: arm64
config: ${{ needs.check-event.outputs.config }}
package: ${{ fromJSON(needs.check-event.outputs.package) }}
- name: Upload Artifacts 📡
uses: actions/upload-artifact@v7
with:
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-windows-arm64-${{ needs.check-event.outputs.commitHash }}
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-windows-arm64*.*

View File

@@ -383,8 +383,18 @@ target_precompile_headers(${LIB_NAME} PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/lib/pch.hpp") "${CMAKE_CURRENT_SOURCE_DIR}/lib/pch.hpp")
target_include_directories( target_include_directories(
${LIB_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/deps/obs-websocket/lib" ${LIB_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/deps/obs-websocket/lib")
"${CMAKE_CURRENT_SOURCE_DIR}/deps/exprtk")
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deps/exprtk/exprtk.hpp")
target_include_directories(${LIB_NAME}
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/deps/exprtk")
target_compile_definitions(${LIB_NAME} PRIVATE EXPRTK_SUPPORT=1)
else()
message(
STATUS
"${PROJECT_NAME}: deps/exprtk not found - math expression support disabled"
)
endif()
if(NOT nlohmann_json_DIR if(NOT nlohmann_json_DIR
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deps/json/CMakeLists.txt") AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deps/json/CMakeLists.txt")

View File

@@ -74,35 +74,6 @@
"ADVSS_ENABLE_TESTS": true "ADVSS_ENABLE_TESTS": true
} }
}, },
{
"name": "windows-arm64",
"displayName": "Windows ARM64",
"description": "Build for Windows ARM64",
"inherits": ["template"],
"binaryDir": "${sourceDir}/build_arm64",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"generator": "Visual Studio 18 2026",
"architecture": "ARM64",
"warnings": {"dev": true, "deprecated": true},
"cacheVariables": {
"QT_VERSION": "6",
"CMAKE_SYSTEM_VERSION": "10.0.18363.657"
}
},
{
"name": "windows-ci-arm64",
"inherits": ["windows-arm64"],
"displayName": "Windows ARM64 CI build",
"description": "Build for Windows ARM64 on CI",
"cacheVariables": {
"CMAKE_COMPILE_WARNING_AS_ERROR": true,
"ADVSS_ENABLE_TESTS": true
}
},
{ {
"name": "linux-x86_64", "name": "linux-x86_64",
"displayName": "Linux x86_64", "displayName": "Linux x86_64",
@@ -191,20 +162,6 @@
"description": "Windows CI build for x64 (RelWithDebInfo configuration)", "description": "Windows CI build for x64 (RelWithDebInfo configuration)",
"configuration": "RelWithDebInfo" "configuration": "RelWithDebInfo"
}, },
{
"name": "windows-arm64",
"configurePreset": "windows-arm64",
"displayName": "Windows ARM64",
"description": "Windows build for ARM64",
"configuration": "RelWithDebInfo"
},
{
"name": "windows-ci-arm64",
"configurePreset": "windows-ci-arm64",
"displayName": "Windows ARM64 CI",
"description": "Windows CI build for ARM64 (RelWithDebInfo configuration)",
"configuration": "RelWithDebInfo"
},
{ {
"name": "linux-x86_64", "name": "linux-x86_64",
"configurePreset": "linux-x86_64", "configurePreset": "linux-x86_64",

View File

@@ -6,8 +6,7 @@
"label": "OBS sources", "label": "OBS sources",
"hashes": { "hashes": {
"macos": "39751f067bacc13d44b116c5138491b5f1391f91516d3d590d874edd21292291", "macos": "39751f067bacc13d44b116c5138491b5f1391f91516d3d590d874edd21292291",
"windows-x64": "2c8427c10b55ac6d68008df2e9a3e82f4647aaad18f105e30d4713c2de678ccf", "windows-x64": "2c8427c10b55ac6d68008df2e9a3e82f4647aaad18f105e30d4713c2de678ccf"
"windows-ARM64": "2c8427c10b55ac6d68008df2e9a3e82f4647aaad18f105e30d4713c2de678ccf"
} }
}, },
"prebuilt": { "prebuilt": {
@@ -16,8 +15,7 @@
"label": "Pre-Built obs-deps", "label": "Pre-Built obs-deps",
"hashes": { "hashes": {
"macos": "495687e63383d1a287684b6e2e9bfe246bb8f156fe265926afb1a325af1edd2a", "macos": "495687e63383d1a287684b6e2e9bfe246bb8f156fe265926afb1a325af1edd2a",
"windows-x64": "c8c642c1070dc31ce9a0f1e4cef5bb992f4bff4882255788b5da12129e85caa7", "windows-x64": "c8c642c1070dc31ce9a0f1e4cef5bb992f4bff4882255788b5da12129e85caa7"
"windows-ARM64": "f581cc61e8f734a8b12d485fc8662a408ca59d222814e4b37bce115bd442fb04"
} }
}, },
"qt6": { "qt6": {
@@ -26,12 +24,10 @@
"label": "Pre-Built Qt6", "label": "Pre-Built Qt6",
"hashes": { "hashes": {
"macos": "d3f5f04b6ea486e032530bdf0187cbda9a54e0a49621a4c8ba984c5023998867", "macos": "d3f5f04b6ea486e032530bdf0187cbda9a54e0a49621a4c8ba984c5023998867",
"windows-x64": "0e76bf0555dd5382838850b748d3dcfab44a1e1058441309ab54e1a65b156d0a", "windows-x64": "0e76bf0555dd5382838850b748d3dcfab44a1e1058441309ab54e1a65b156d0a"
"windows-ARM64": "7aab240504931f32ea8e8d208a912a0d6ddbd78c16858f2e559c7c9b29ab9326"
}, },
"debugSymbols": { "debugSymbols": {
"windows-x64": "11b7be92cf66a273299b8f3515c07a5cfb61614b59a4e67f7fc5ecba5e2bdf21", "windows-x64": "11b7be92cf66a273299b8f3515c07a5cfb61614b59a4e67f7fc5ecba5e2bdf21"
"windows-ARM64": "884ae08291b5c87d83a7b0004ea8db356530c1f4ff9bdc814b5d599a8d28a152"
} }
} }
}, },

View File

@@ -23,108 +23,6 @@ function(_check_dependencies_windows)
set(dependencies_list prebuilt qt6 obs-studio) set(dependencies_list prebuilt qt6 obs-studio)
_check_dependencies() _check_dependencies()
if(arch STREQUAL "ARM64")
_setup_qt6_host_windows()
endif()
endfunction()
# _setup_qt6_host_windows: Fetch native x64 Qt6 as QT_HOST_PATH for ARM64 build
# tools
function(_setup_qt6_host_windows)
set(dependencies_dir "${CMAKE_CURRENT_SOURCE_DIR}/.deps")
if(NOT buildspec)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/buildspec.json" buildspec)
endif()
string(JSON data GET ${buildspec} dependencies qt6)
string(JSON version GET ${data} version)
string(JSON hash GET ${data} hashes windows-x64)
string(JSON base_url GET ${data} baseUrl)
string(JSON label GET ${data} label)
string(
JSON
revision
ERROR_VARIABLE
error
GET
${data}
revision
windows-x64)
set(file "windows-deps-qt6-VERSION-x64-REVISION.zip")
set(destination "obs-deps-qt6-VERSION-x64")
string(REPLACE "VERSION" "${version}" file "${file}")
string(REPLACE "VERSION" "${version}" destination "${destination}")
if(revision)
string(REPLACE "_REVISION" "_v${revision}" file "${file}")
string(REPLACE "-REVISION" "-v${revision}" file "${file}")
else()
string(REPLACE "_REVISION" "" file "${file}")
string(REPLACE "-REVISION" "" file "${file}")
endif()
set(url "${base_url}/${version}/${file}")
message(STATUS "Setting up ${label} host (x64) for ARM64 cross-compilation")
if(NOT EXISTS
"${dependencies_dir}/${destination}/lib/cmake/Qt6/Qt6Config.cmake")
if(NOT EXISTS "${dependencies_dir}/${file}")
message(STATUS "Downloading ${url}")
set(MAX_DOWNLOAD_RETRIES 3)
set(RETRY_DELAY 60) # seconds
set(download_success FALSE)
foreach(i RANGE 1 ${MAX_DOWNLOAD_RETRIES})
message(STATUS "Attempt ${i}/${MAX_DOWNLOAD_RETRIES} for ${url}")
file(
DOWNLOAD "${url}" "${dependencies_dir}/${file}"
STATUS download_status
EXPECTED_HASH SHA256=${hash})
list(GET download_status 0 error_code)
list(GET download_status 1 error_message)
if(error_code EQUAL 0)
message(STATUS "Downloading ${url} - success on attempt ${i}")
set(download_success TRUE)
break()
else()
message(WARNING "Download failed (attempt ${i}): ${error_message}")
file(REMOVE "${dependencies_dir}/${file}")
if(NOT i EQUAL MAX_DOWNLOAD_RETRIES)
message(STATUS "Retrying in ${RETRY_DELAY} seconds...")
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep ${RETRY_DELAY})
endif()
endif()
endforeach()
if(NOT download_success)
message(
FATAL_ERROR
"Unable to download ${url} after ${MAX_DOWNLOAD_RETRIES} attempts")
endif()
message(STATUS "Downloading ${url} - done")
endif()
file(MAKE_DIRECTORY "${dependencies_dir}/${destination}")
file(ARCHIVE_EXTRACT INPUT "${dependencies_dir}/${file}" DESTINATION
"${dependencies_dir}/${destination}")
endif()
message(STATUS "Using ${dependencies_dir}/${destination} as QT_HOST_PATH")
set(QT_HOST_PATH
"${dependencies_dir}/${destination}"
CACHE PATH "Path to a native Qt6 installation used to supply host tools"
FORCE)
message(
STATUS "Setting up ${label} host (x64) for ARM64 cross-compilation - done")
endfunction() endfunction()
_check_dependencies_windows() _check_dependencies_windows()

View File

@@ -2,13 +2,16 @@
#include "obs-module-helper.hpp" #include "obs-module-helper.hpp"
#include <climits> #include <climits>
#ifdef EXPRTK_SUPPORT
#include <exprtk.hpp> #include <exprtk.hpp>
#include <random> #include <random>
#endif
namespace advss { namespace advss {
std::variant<double, std::string> EvalMathExpression(const std::string &expr) std::variant<double, std::string> EvalMathExpression(const std::string &expr)
{ {
#ifdef EXPRTK_SUPPORT
static auto randomFunc = []() { static auto randomFunc = []() {
thread_local std::mt19937 gen(std::random_device{}()); thread_local std::mt19937 gen(std::random_device{}());
thread_local std::uniform_real_distribution<double> dis(0.0, thread_local std::uniform_real_distribution<double> dis(0.0,
@@ -26,6 +29,7 @@ std::variant<double, std::string> EvalMathExpression(const std::string &expr)
if (parser.compile(expr, expression)) { if (parser.compile(expr, expression)) {
return expression.value(); return expression.value();
} }
#endif
return std::string(obs_module_text( return std::string(obs_module_text(
"AdvSceneSwitcher.math.expressionFail")) + "AdvSceneSwitcher.math.expressionFail")) +
" \"" + expr + "\""; " \"" + expr + "\"";

View File

@@ -5,10 +5,6 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#ifdef DispatchMessage
#undef DispatchMessage
#endif
namespace advss { namespace advss {
template<class T> class MessageDispatcher { template<class T> class MessageDispatcher {

View File

@@ -2,7 +2,6 @@
#include "plugin-state-helpers.hpp" #include "plugin-state-helpers.hpp"
#include <windows.h> #include <windows.h>
#include <objbase.h>
#include <UIAutomation.h> #include <UIAutomation.h>
#include <util/platform.h> #include <util/platform.h>
#include <TlHelp32.h> #include <TlHelp32.h>

View File

@@ -9,10 +9,6 @@
#include <QComboBox> #include <QComboBox>
#include <QCheckBox> #include <QCheckBox>
#ifdef DELETE
#undef DELETE
#endif
namespace advss { namespace advss {
class MacroActionHttp final : public MacroAction { class MacroActionHttp final : public MacroAction {

View File

@@ -8,10 +8,6 @@
#include <QCheckBox> #include <QCheckBox>
#include <QComboBox> #include <QComboBox>
#ifdef DELETE
#undef DELETE
#endif
namespace advss { namespace advss {
class MacroConditionHttp : public MacroCondition { class MacroConditionHttp : public MacroCondition {

View File

@@ -6,10 +6,6 @@
#include <variable-spinbox.hpp> #include <variable-spinbox.hpp>
#include <variable-string.hpp> #include <variable-string.hpp>
#ifdef WIN32_LEAN_AND_MEAN
#undef WIN32_LEAN_AND_MEAN
#endif
#define LIBREMIDI_HEADER_ONLY 1 #define LIBREMIDI_HEADER_ONLY 1
#include <libremidi/libremidi.hpp> #include <libremidi/libremidi.hpp>

View File

@@ -16,10 +16,6 @@
#include <mqtt/async_client.h> #include <mqtt/async_client.h>
#ifdef SendMessage
#undef SendMessage
#endif
namespace advss { namespace advss {
using MqttMessageBuffer = std::shared_ptr<MessageBuffer<std::string>>; using MqttMessageBuffer = std::shared_ptr<MessageBuffer<std::string>>;

View File

@@ -11,8 +11,6 @@ target_sources(${PROJECT_NAME} PRIVATE macro-condition-now-playing.cpp
macro-condition-now-playing.hpp) macro-condition-now-playing.hpp)
target_link_libraries(${PROJECT_NAME} PRIVATE windowsapp) target_link_libraries(${PROJECT_NAME} PRIVATE windowsapp)
target_compile_definitions(
${PROJECT_NAME} PRIVATE _SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS)
setup_advss_plugin(${PROJECT_NAME}) setup_advss_plugin(${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")

View File

@@ -9,12 +9,6 @@ if(NOT WIN32)
return() return()
endif(NOT WIN32) endif(NOT WIN32)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64|arm64|aarch64")
message(WARNING "OpenVR does not provide Windows ARM64 binaries!\n"
"OpenVR condition will be disabled!")
return()
endif()
# --- End of section --- # --- End of section ---
add_library(${PROJECT_NAME} MODULE) add_library(${PROJECT_NAME} MODULE)
@@ -34,9 +28,7 @@ endif()
if(EXISTS "${OpenVR_DIR}/CMakeLists.txt") if(EXISTS "${OpenVR_DIR}/CMakeLists.txt")
set(SIZEOF_VOIDP ${CMAKE_SIZEOF_VOID_P}) set(SIZEOF_VOIDP ${CMAKE_SIZEOF_VOID_P})
if(WIN32 AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64|arm64|aarch64") if((NOT APPLE) AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
set(PROCESSOR_ARCH "arm64")
elseif((NOT APPLE) AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
set(PROCESSOR_ARCH "64") set(PROCESSOR_ARCH "64")
else() else()
set(PROCESSOR_ARCH "32") set(PROCESSOR_ARCH "32")

View File

@@ -9,10 +9,6 @@
#include <QScrollArea> #include <QScrollArea>
#include <QPlainTextEdit> #include <QPlainTextEdit>
#ifdef GetObject
#undef GetObject
#endif
#if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(30, 0, 0) #if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(30, 0, 0)
class QFormLayout; class QFormLayout;

View File

@@ -12,16 +12,6 @@ if(NOT EXISTS "${WHISPER_DIR}/CMakeLists.txt")
return() return()
endif() endif()
# whisper.cpp's ggml CPU backend requires clang on Windows ARM64 and fails with
# MSVC
if(OS_WINDOWS AND CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
message(
WARNING
"Speech plugin is not supported on Windows ARM64 (requires clang)!\n"
"Speech condition will be disabled!")
return()
endif()
set(WHISPER_BUILD_TESTS set(WHISPER_BUILD_TESTS
OFF OFF
CACHE BOOL "" FORCE) CACHE BOOL "" FORCE)

View File

@@ -233,7 +233,12 @@ void TwitchToken::Load(obs_data_t *obj)
{ {
Item::Load(obj); Item::Load(obj);
_token = obs_data_get_string(obj, "token"); _token = obs_data_get_string(obj, "token");
_userID = obs_data_get_string(obj, "userID"); if (obs_data_has_user_value(obj, "userID") &&
*obs_data_get_string(obj, "userID") != '\0') {
_userID = obs_data_get_string(obj, "userID");
} else {
_userID = {};
}
obs_data_set_default_bool(obj, "validateEventSubTimestamps", true); obs_data_set_default_bool(obj, "validateEventSubTimestamps", true);
_validateEventSubTimestamps = _validateEventSubTimestamps =
obs_data_get_bool(obj, "validateEventSubTimestamps"); obs_data_get_bool(obj, "validateEventSubTimestamps");
@@ -255,7 +260,7 @@ void TwitchToken::Save(obs_data_t *obj) const
{ {
Item::Save(obj); Item::Save(obj);
obs_data_set_string(obj, "token", _token.c_str()); obs_data_set_string(obj, "token", _token.c_str());
if (_userID) { if (_userID && !_userID->empty()) {
obs_data_set_string(obj, "userID", _userID->c_str()); obs_data_set_string(obj, "userID", _userID->c_str());
} }
obs_data_set_bool(obj, "validateEventSubTimestamps", obs_data_set_bool(obj, "validateEventSubTimestamps",
@@ -310,7 +315,7 @@ bool TwitchToken::AnyOptionIsEnabled(
return false; return false;
} }
void TwitchToken::SetToken(const std::string &value) bool TwitchToken::SetToken(const std::string &value)
{ {
_token = value; _token = value;
auto res = auto res =
@@ -318,21 +323,34 @@ void TwitchToken::SetToken(const std::string &value)
if (res.status != 200) { if (res.status != 200) {
blog(LOG_WARNING, "failed to get Twitch user id from token!"); blog(LOG_WARNING, "failed to get Twitch user id from token!");
_userID = {}; _userID = {};
return; return false;
} }
bool gotUserID = false;
OBSDataArrayAutoRelease array = obs_data_get_array(res.data, "data"); OBSDataArrayAutoRelease array = obs_data_get_array(res.data, "data");
size_t count = obs_data_array_count(array); size_t count = obs_data_array_count(array);
for (size_t i = 0; i < count; i++) { for (size_t i = 0; i < count; i++) {
OBSDataAutoRelease arrayObj = obs_data_array_item(array, i); OBSDataAutoRelease arrayObj = obs_data_array_item(array, i);
_userID = obs_data_get_string(arrayObj, "id"); std::string id = obs_data_get_string(arrayObj, "id");
if (id.empty()) {
blog(LOG_WARNING,
"Twitch /helix/users response did not contain a user id!");
continue;
}
_userID = id;
_name = obs_data_get_string(arrayObj, "display_name"); _name = obs_data_get_string(arrayObj, "display_name");
gotUserID = true;
}
if (!gotUserID) {
return false;
} }
// Trigger resubscribes with new token // Trigger resubscribes with new token
if (_eventSub) { if (_eventSub) {
_eventSub->ClearActiveSubscriptions(); _eventSub->ClearActiveSubscriptions();
} }
return true;
} }
std::optional<std::string> TwitchToken::GetToken() const std::optional<std::string> TwitchToken::GetToken() const
@@ -388,7 +406,7 @@ bool TwitchToken::IsValid(bool forceUpdate) const
return false; return false;
} }
if (_userID && _userID != id) { if (_userID && !_userID->empty() && _userID != id) {
blog(LOG_INFO, blog(LOG_INFO,
"Twitch token %s does not match expected user (got %s, expected %s)!", "Twitch token %s does not match expected user (got %s, expected %s)!",
_name.c_str(), id, _userID->c_str()); _name.c_str(), id, _userID->c_str());
@@ -396,6 +414,10 @@ bool TwitchToken::IsValid(bool forceUpdate) const
return false; return false;
} }
if (!_userID || _userID->empty()) {
_userID = id;
}
_lastValidityCheckResult = true; _lastValidityCheckResult = true;
return true; return true;
}; };
@@ -819,9 +841,9 @@ void TwitchTokenSettingsDialog::GotToken(const std::optional<QString> &value)
return; return;
} }
_currentToken.SetToken(value.value().toStdString()); bool success = _currentToken.SetToken(value.value().toStdString());
auto name = QString::fromStdString(_currentToken._name); auto name = QString::fromStdString(_currentToken._name);
if (name.isEmpty()) { if (!success || name.isEmpty()) {
_tokenStatus->setText(obs_module_text( _tokenStatus->setText(obs_module_text(
"AdvSceneSwitcher.twitchToken.request.fail")); "AdvSceneSwitcher.twitchToken.request.fail"));
_name->setText(""); _name->setText("");

View File

@@ -48,7 +48,7 @@ public:
bool OptionIsActive(const TokenOption &option) const; bool OptionIsActive(const TokenOption &option) const;
bool OptionIsEnabled(const TokenOption &option) const; bool OptionIsEnabled(const TokenOption &option) const;
bool AnyOptionIsEnabled(const std::vector<TokenOption> &options) const; bool AnyOptionIsEnabled(const std::vector<TokenOption> &options) const;
void SetToken(const std::string &); bool SetToken(const std::string &);
bool IsEmpty() const { return _token.empty(); } bool IsEmpty() const { return _token.empty(); }
std::optional<std::string> GetToken() const; std::optional<std::string> GetToken() const;
std::optional<std::string> GetUserID() const { return _userID; } std::optional<std::string> GetUserID() const { return _userID; }
@@ -65,7 +65,7 @@ private:
mutable std::string _lastValidityCheckValue; mutable std::string _lastValidityCheckValue;
mutable bool _lastValidityCheckResult = false; mutable bool _lastValidityCheckResult = false;
mutable std::chrono::system_clock::time_point _lastValidityCheckTime; mutable std::chrono::system_clock::time_point _lastValidityCheckTime;
std::optional<std::string> _userID; mutable std::optional<std::string> _userID;
std::set<TokenOption> _tokenOptions = TokenOption::GetAllTokenOptions(); std::set<TokenOption> _tokenOptions = TokenOption::GetAllTokenOptions();
std::shared_ptr<EventSub> _eventSub; std::shared_ptr<EventSub> _eventSub;
bool _validateEventSubTimestamps = false; bool _validateEventSubTimestamps = false;

View File

@@ -85,8 +85,11 @@ target_sources(
${PROJECT_NAME} ${PROJECT_NAME}
PRIVATE test-math.cpp ${ADVSS_SOURCE_DIR}/lib/utils/math-helpers.cpp PRIVATE test-math.cpp ${ADVSS_SOURCE_DIR}/lib/utils/math-helpers.cpp
${ADVSS_SOURCE_DIR}/lib/utils/obs-module-helper.cpp) ${ADVSS_SOURCE_DIR}/lib/utils/obs-module-helper.cpp)
target_include_directories(${PROJECT_NAME} if(EXISTS "${ADVSS_SOURCE_DIR}/deps/exprtk/exprtk.hpp")
PRIVATE ${ADVSS_SOURCE_DIR}/deps/exprtk) target_include_directories(${PROJECT_NAME}
PRIVATE ${ADVSS_SOURCE_DIR}/deps/exprtk)
target_compile_definitions(${PROJECT_NAME} PRIVATE EXPRTK_SUPPORT=1)
endif()
if(MSVC) if(MSVC)
target_compile_options(${PROJECT_NAME} PUBLIC /MP /d2FH4- /wd4267 /bigobj) target_compile_options(${PROJECT_NAME} PUBLIC /MP /d2FH4- /wd4267 /bigobj)