Dataset Viewer
Auto-converted to Parquet Duplicate
repo
string
pull_number
string
instance_id
string
issue_numbers
list
base_commit
string
patch
string
test_patch
string
problem_statement
string
hints_text
string
all_hints_text
string
commit_urls
list
created_at
string
commit_url
string
rebuild_cmds
list
test_cmds
list
print_cmds
list
log_parser
string
FAIL_TO_PASS
list
PASS_TO_PASS
list
docker_image
string
libsdl-org/SDL
11761
libsdl-org__SDL-11761
[ "8963" ]
028107124358a3d256c8c3acf4e4db6f20e4c348
diff --git a/.github/workflows/generic.yml b/.github/workflows/generic.yml index 1398bca8381d5..84e1d97fe7a2f 100644 --- a/.github/workflows/generic.yml +++ b/.github/workflows/generic.yml @@ -207,7 +207,7 @@ jobs: ctest -VV --test-dir build/ -j2 - name: "Build test apk's (CMake)" id: apks - if: ${{ steps.build.outcome == 'success' && matrix.platform.android-apks != '' }} + if: ${{ always() && steps.build.outcome == 'success' && matrix.platform.android-apks != '' }} # shell: ${{ matrix.platform.shell }} run: | ${{ matrix.platform.source-cmd }} @@ -218,7 +218,7 @@ jobs: -- ${{ matrix.platform.cmake-build-arguments }} - name: 'Install (CMake)' id: install - if: ${{ steps.build.outcome == 'success' }} + if: ${{ always() && steps.build.outcome == 'success' }} # shell: ${{ matrix.platform.shell }} run: | ${{ matrix.platform.source-cmd }} @@ -227,7 +227,7 @@ jobs: ( cd prefix; find . ) | LC_ALL=C sort -u - name: 'Package (CPack)' id: package - if: ${{ steps.build.outcome == 'success' }} + if: ${{ always() && steps.build.outcome == 'success' }} # shell: ${{ matrix.platform.shell }} run: | # DMG creation on macOS occasionally fails, so try multiple times diff --git a/CMakeLists.txt b/CMakeLists.txt index 94b1c9bfe0531..5c4f9cbd412f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -498,16 +498,21 @@ else() sdl_include_directories(NO_EXPORT SYSTEM PRIVATE "$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/src/video/khronos>") endif() -if(MSVC AND TARGET SDL3-shared) +if(MSVC AND TARGET SDL3-shared AND NOT SDL_LIBC) if(SDL_CPU_X64) enable_language(ASM_MASM) set(asm_src "${SDL3_SOURCE_DIR}/src/stdlib/SDL_mslibc_x64.masm") target_compile_options(SDL3-shared PRIVATE "$<$<COMPILE_LANGUAGE:ASM_MASM>:/nologo>") set_property(SOURCE "${asm_src}" PROPERTY LANGUAGE "ASM_MASM") target_sources(SDL3-shared PRIVATE "${asm_src}") - elseif(SDL_CPU_ARM32 OR SDL_CPU_ARM64) - # FIXME: ARM assembler (armasm.exe/armasm64.exe) is NOT ASM_MASM, and does currently not work with CMake - # (https://gitlab.kitware.com/cmake/cmake/-/issues/18912) + elseif(SDL_CPU_ARM64) + enable_language(ASM_MARMASM) + set(asm_src "${SDL3_SOURCE_DIR}/src/stdlib/SDL_mslibc_arm64.masm") + target_compile_options(SDL3-shared PRIVATE "$<$<COMPILE_LANGUAGE:ASM_MARMASM>:/nologo>") + set_property(SOURCE "${asm_src}" PROPERTY LANGUAGE "ASM_MARMASM") + target_sources(SDL3-shared PRIVATE "${asm_src}") + elseif(SDL_CPU_ARM32) + # FIXME endif() endif() @@ -1889,8 +1894,10 @@ elseif(WINDOWS) if(TARGET SDL3-shared AND MSVC AND NOT SDL_LIBC) # Prevent codegen that would use the VC runtime libraries. target_compile_options(SDL3-shared PRIVATE $<$<COMPILE_LANGUAGE:C,CXX>:/GS-> $<$<COMPILE_LANGUAGE:C,CXX>:/Gs1048576>) + target_compile_options(SDL_uclibc PRIVATE $<$<COMPILE_LANGUAGE:C,CXX>:/GS-> $<$<COMPILE_LANGUAGE:C,CXX>:/Gs1048576>) if(SDL_CPU_X86) target_compile_options(SDL3-shared PRIVATE "/arch:SSE") + target_compile_options(SDL3-SDL_uclibc PRIVATE "/arch:SSE") endif() endif() @@ -3388,6 +3395,17 @@ if(SDL_SHARED) # (__rt_sdiv, __rt_udiv, __rt_sdiv64, _rt_udiv64, __dtou64, __u64tod, __i64tos) target_link_libraries(SDL3-shared PRIVATE msvcrt.lib) endif() + find_library(HAVE_ONECORE_LIB NAMES "onecore.lib") + if(HAVE_ONECORE_LIB) + # SDL_malloc.c: __imp_MapViewOfFileNuma2 referenced in function MapViewOfFile2 + target_link_libraries(SDL3-shared PRIVATE onecore.lib) + endif() + find_library(HAVE_VOLATILEACCESSU_LIB NAMES "volatileaccessu.lib") + if(HAVE_VOLATILEACCESSU_LIB) + # SDL_malloc.c : RtlSetVolatileMemory referenced in function RtlFillVolatileMemory + # SDL_malloc.c : RtlFillDeviceMemory referenced in function RtlZeroDeviceMemory + target_link_libraries(SDL3-shared PRIVATE volatileaccessu.lib) + endif() endif() if(HAS_Q_NO_USE_LIBIRC) target_compile_options(SDL3-shared PRIVATE /Q_no-use-libirc) diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj index e860035ae625a..ada62e856d8c7 100644 --- a/VisualC/SDL/SDL.vcxproj +++ b/VisualC/SDL/SDL.vcxproj @@ -43,7 +43,6 @@ </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> - <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" /> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> @@ -647,9 +646,6 @@ <ClCompile Include="..\..\src\stdlib\SDL_memmove.c" /> <ClCompile Include="..\..\src\stdlib\SDL_memset.c" /> <ClCompile Include="..\..\src\stdlib\SDL_mslibc.c" /> - <MASM Condition="'$(Platform)'=='x64'" Include="..\..\src\stdlib\SDL_mslibc_x64.masm"> - <PrecompiledHeader>NotUsing</PrecompiledHeader> - </MASM> <ClCompile Include="..\..\src\stdlib\SDL_murmur3.c" /> <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" /> <ClCompile Include="..\..\src\stdlib\SDL_random.c" /> @@ -729,6 +725,5 @@ </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> - <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" /> </ImportGroup> </Project> diff --git a/cmake/sdlcompilers.cmake b/cmake/sdlcompilers.cmake index ec3b6124cade0..c3d8c4702e6ad 100644 --- a/cmake/sdlcompilers.cmake +++ b/cmake/sdlcompilers.cmake @@ -34,7 +34,7 @@ function(SDL_AddCommonCompilerFlags TARGET) cmake_push_check_state() check_c_compiler_flag("/W3" COMPILER_SUPPORTS_W3) if(COMPILER_SUPPORTS_W3) - target_compile_options(${TARGET} PRIVATE "/W3") + target_compile_options(${TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:/W3>") endif() cmake_pop_check_state() endif() @@ -131,7 +131,7 @@ function(SDL_AddCommonCompilerFlags TARGET) if(MSVC) check_c_compiler_flag(/WX HAVE_WX) if(HAVE_WX) - target_compile_options(${TARGET} PRIVATE "/WX") + target_compile_options(${TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:/WX>") endif() elseif(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QNX) check_c_compiler_flag(-Werror HAVE_WERROR) diff --git a/src/SDL_hashtable.c b/src/SDL_hashtable.c index a3f6613cd0096..571e376974177 100644 --- a/src/SDL_hashtable.c +++ b/src/SDL_hashtable.c @@ -22,8 +22,31 @@ #include "SDL_hashtable.h" // XXX: We can't use SDL_assert here because it's going to call into hashtable code -#include <assert.h> -#define HT_ASSERT(x) assert(x) +#ifdef NDEBUG +#define HT_ASSERT(x) (void)(0) +#else +#if (defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN)) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) +#include <windows.h> +#endif +/* This is not declared in any header, although it is shared between some + parts of SDL, because we don't want anything calling it without an + extremely good reason. */ +extern SDL_NORETURN void SDL_ExitProcess(int exitcode); +static void HT_ASSERT_FAIL(const char *msg) +{ + const char *caption = "SDL_HashTable Assertion Failure!"; + (void)caption; +#if (defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN)) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) + MessageBoxA(NULL, msg, caption, MB_OK | MB_ICONERROR); +#elif defined(HAVE_STDIO_H) + fprintf(stderr, "\n\n%s\n%s\n\n", caption, msg); + fflush(stderr); +#endif + SDL_TriggerBreakpoint(); + SDL_ExitProcess(-1); +} +#define HT_ASSERT(x) if (!(x)) HT_ASSERT_FAIL("SDL_HashTable Assertion Failure: " #x) +#endif typedef struct SDL_HashItem { diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c index 2fa85ec5f9920..f35f3e8bcb564 100644 --- a/src/dynapi/SDL_dynapi.c +++ b/src/dynapi/SDL_dynapi.c @@ -520,6 +520,9 @@ static void SDL_InitDynamicAPILocked(void) if (initialize_jumptable(SDL_DYNAPI_VERSION, &jump_table, sizeof(jump_table)) < 0) { // Now we're screwed. Should definitely abort now. dynapi_warn("Failed to initialize internal SDL dynapi. As this would otherwise crash, we have to abort now."); +#ifndef NDEBUG + SDL_TriggerBreakpoint(); +#endif SDL_ExitProcess(86); } } diff --git a/src/stdlib/SDL_malloc.c b/src/stdlib/SDL_malloc.c index a4de7d24ac545..ea09d1e5cbf77 100644 --- a/src/stdlib/SDL_malloc.c +++ b/src/stdlib/SDL_malloc.c @@ -28,8 +28,8 @@ #define LACKS_STRINGS_H #define LACKS_STRING_H #define LACKS_STDLIB_H -#define FORCEINLINE #define ABORT +#define NO_MALLOC_STATS 1 #define USE_LOCKS 1 #define USE_DL_PREFIX @@ -816,6 +816,7 @@ struct mallinfo { inlining are defined as macros, so these aren't used for them. */ +#if 0 /* SDL */ #ifndef FORCEINLINE #if defined(__GNUC__) #define FORCEINLINE __inline __attribute__ ((always_inline)) @@ -823,6 +824,7 @@ struct mallinfo { #define FORCEINLINE __forceinline #endif #endif +#endif /* SDL */ #ifndef NOINLINE #if defined(__GNUC__) #define NOINLINE __attribute__ ((noinline)) @@ -835,13 +837,17 @@ struct mallinfo { #ifdef __cplusplus extern "C" { +#if 0 /* SDL */ #ifndef FORCEINLINE #define FORCEINLINE inline #endif +#endif /* SDL */ #endif /* __cplusplus */ +#if 0 /* SDL */ #ifndef FORCEINLINE #define FORCEINLINE #endif +#endif /* SDL_FORCE_INLINE */ #if !ONLY_MSPACES @@ -1697,20 +1703,20 @@ static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */ #else /* WIN32 */ /* Win32 MMAP via VirtualAlloc */ -static FORCEINLINE void* win32mmap(size_t size) { +SDL_FORCE_INLINE void* win32mmap(size_t size) { void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); return (ptr != 0)? ptr: MFAIL; } /* For direct MMAP, use MEM_TOP_DOWN to minimize interference */ -static FORCEINLINE void* win32direct_mmap(size_t size) { +SDL_FORCE_INLINE void* win32direct_mmap(size_t size) { void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN, PAGE_READWRITE); return (ptr != 0)? ptr: MFAIL; } /* This function supports releasing coalesed segments */ -static FORCEINLINE int win32munmap(void* ptr, size_t size) { +SDL_FORCE_INLINE int win32munmap(void* ptr, size_t size) { MEMORY_BASIC_INFORMATION minfo; char* cptr = (char*)ptr; while (size) { @@ -1863,7 +1869,7 @@ static FORCEINLINE int win32munmap(void* ptr, size_t size) { #elif (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) /* Custom spin locks for older gcc on x86 */ -static FORCEINLINE int x86_cas_lock(int *sl) { +SDL_FORCE_INLINE int x86_cas_lock(int *sl) { int ret; int val = 1; int cmp = 0; @@ -1874,7 +1880,7 @@ static FORCEINLINE int x86_cas_lock(int *sl) { return ret; } -static FORCEINLINE void x86_clear_lock(int* sl) { +SDL_FORCE_INLINE void x86_clear_lock(int* sl) { assert(*sl != 0); int prev = 0; int ret; @@ -1952,14 +1958,14 @@ struct malloc_recursive_lock { #define MLOCK_T struct malloc_recursive_lock static MLOCK_T malloc_global_mutex = { 0, 0, (THREAD_ID_T)0}; -static FORCEINLINE void recursive_release_lock(MLOCK_T *lk) { +SDL_FORCE_INLINE void recursive_release_lock(MLOCK_T *lk) { assert(lk->sl != 0); if (--lk->c == 0) { CLEAR_LOCK(&lk->sl); } } -static FORCEINLINE int recursive_acquire_lock(MLOCK_T *lk) { +SDL_FORCE_INLINE int recursive_acquire_lock(MLOCK_T *lk) { THREAD_ID_T mythreadid = CURRENT_THREAD; int spins = 0; for (;;) { @@ -1980,7 +1986,7 @@ static FORCEINLINE int recursive_acquire_lock(MLOCK_T *lk) { } } -static FORCEINLINE int recursive_try_lock(MLOCK_T *lk) { +SDL_FORCE_INLINE int recursive_try_lock(MLOCK_T *lk) { THREAD_ID_T mythreadid = CURRENT_THREAD; if (*((volatile int *)(&lk->sl)) == 0) { if (!CAS_LOCK(&lk->sl)) { diff --git a/src/stdlib/SDL_mslibc.c b/src/stdlib/SDL_mslibc.c index a527bf75d6bdf..6698403fe8904 100644 --- a/src/stdlib/SDL_mslibc.c +++ b/src/stdlib/SDL_mslibc.c @@ -728,14 +728,6 @@ void __declspec(naked) _alloca_probe_16(void) #endif // _M_IX86 -#ifdef _M_ARM64 - -void __chkstk(void); -void __chkstk() { -} - -#endif - #endif // MSC_VER #ifdef __ICL diff --git a/src/stdlib/SDL_mslibc_arm64.masm b/src/stdlib/SDL_mslibc_arm64.masm new file mode 100644 index 0000000000000..a769cc106f5ff --- /dev/null +++ b/src/stdlib/SDL_mslibc_arm64.masm @@ -0,0 +1,26 @@ +TeStackLimit EQU 0x00010 +PAGE_SIZE equ 0x1000 + + AREA CODE, READONLY + + EXPORT __chkstk + +__chkstk PROC + ldr x17,[x18, #TeStackLimit] + subs x16,sp,x15, LSL #0x4 + csel x16,xzr,x16,cc + cmp x16,x17 + b.cc chkstk_start_loop + ret +chkstk_start_loop + and x16,x16,#-PAGE_SIZE +chkstk_loop + sub x17,x17,#0x1, LSL #12 + ldr xzr,[x17] + cmp x17,x16 + b.ne chkstk_loop + ret + + ENDP + + END diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c index ab43c13d3a850..50da685f7eb57 100644 --- a/src/stdlib/SDL_string.c +++ b/src/stdlib/SDL_string.c @@ -368,7 +368,7 @@ static size_t SDL_ScanUnsignedLongLongInternal(const char *text, int count, int negative = *text == '-'; ++text; } - if ((radix == 0 || radix == 16) && *text == '0') { + if ((radix == 0 || radix == 16) && *text == '0' && text[1] != '\0') { ++text; if (*text == 'x' || *text == 'X') { radix = 16;
diff --git a/test/testautomation_stdlib.c b/test/testautomation_stdlib.c index a2ac6719884b7..26317584f19bc 100644 --- a/test/testautomation_stdlib.c +++ b/test/testautomation_stdlib.c @@ -1324,6 +1324,9 @@ static int SDLCALL stdlib_strtox(void *arg) STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "-uvwxyz", 32, -991, 3); STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "ZzZzZzZzZzZzZzZzZzZzZzZzZ", 36, ullong_max, 25); + STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "0", 0, 0, 1); + STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "0", 10, 0, 1); + STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "-0", 0, 0, 2); STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "-0", 10, 0, 2); STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, " - 1", 0, 0, 0); // invalid input @@ -1335,6 +1338,10 @@ static int SDLCALL stdlib_strtox(void *arg) // Since the CI runs the tests against a variety of targets, this should be fine in practice. if (sizeof(long) == 4) { + STRTOX_TEST_CASE(SDL_strtol, long, "%ld", "0", 0, 0, 1); + STRTOX_TEST_CASE(SDL_strtol, long, "%ld", "0", 10, 0, 1); + STRTOX_TEST_CASE(SDL_strtol, long, "%ld", "-0", 0, 0, 2); + STRTOX_TEST_CASE(SDL_strtol, long, "%ld", "-0", 10, 0, 2); STRTOX_TEST_CASE(SDL_strtol, long, "%ld", "2147483647", 10, 2147483647, 10); STRTOX_TEST_CASE(SDL_strtol, long, "%ld", "2147483648", 10, 2147483647, 10); STRTOX_TEST_CASE(SDL_strtol, long, "%ld", "-2147483648", 10, -2147483647L - 1, 11); @@ -1347,6 +1354,10 @@ static int SDLCALL stdlib_strtox(void *arg) } if (sizeof(long long) == 8) { + STRTOX_TEST_CASE(SDL_strtoll, long long, FMT_PRILLd, "0", 0, 0LL, 1); + STRTOX_TEST_CASE(SDL_strtoll, long long, FMT_PRILLd, "0", 10, 0LL, 1); + STRTOX_TEST_CASE(SDL_strtoll, long long, FMT_PRILLd, "-0", 0, 0LL, 2); + STRTOX_TEST_CASE(SDL_strtoll, long long, FMT_PRILLd, "-0", 10, 0LL, 2); STRTOX_TEST_CASE(SDL_strtoll, long long, FMT_PRILLd, "9223372036854775807", 10, 9223372036854775807LL, 19); STRTOX_TEST_CASE(SDL_strtoll, long long, FMT_PRILLd, "9223372036854775808", 10, 9223372036854775807LL, 19); STRTOX_TEST_CASE(SDL_strtoll, long long, FMT_PRILLd, "-9223372036854775808", 10, -9223372036854775807LL - 1, 20);
arm64 asm, __chkstk, and cmake Our current MSVC code is missing `__chkstk` for arm64 and we are blaming cmake for it referencing cmake issue reported at https://gitlab.kitware.com/cmake/cmake/-/issues/18912 Any progress on this? I found armasm support merges among cmake gitlab PRs. along with some open issues - other and newer than the one above: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7793 https://gitlab.kitware.com/cmake/cmake/-/issues/24317 @madebr ?
Any progress on this? We are scoping work for the SDL 3.2.0 release, so please let us know if this is a showstopper for you. Well, it _can_ be a showstopper. I don't have anything to test with, though. Me either... let's leave this open until someone has a repro environment. #11761 addresses this. I copied `__chkstk` from a arm64 SDL3.dll. But it's 100% not tested.
Any progress on this? We are scoping work for the SDL 3.2.0 release, so please let us know if this is a showstopper for you. Well, it _can_ be a showstopper. I don't have anything to test with, though. Me either... let's leave this open until someone has a repro environment. #11761 addresses this. I copied `__chkstk` from a arm64 SDL3.dll. But it's 100% not tested.
[ "https://github.com/libsdl-org/SDL/commit/ae6c9370c1fca3db47ed089049c84e9c0c0c7133", "https://github.com/libsdl-org/SDL/commit/4d8946171bf7189afa3317ffdc59a956bdcf1d29", "https://github.com/libsdl-org/SDL/commit/4613773fc1ab19cdf2c8ecfcba6c1557be53e328", "https://github.com/libsdl-org/SDL/commit/ad5b75f503f6bf8740c1321f78f276f21901e1d6", "https://github.com/libsdl-org/SDL/commit/c501023cb08c8262e0a070ce760858c4e68fb29c", "https://github.com/libsdl-org/SDL/commit/91d50dc0824c43c9dc9b0b2170b200791766cdb7", "https://github.com/libsdl-org/SDL/commit/77b9d3bf62e825229bf971bd8aaad75302b51f5b", "https://github.com/libsdl-org/SDL/commit/2d4a4becd0edd10e82ddedad7659615f69d89ac1", "https://github.com/libsdl-org/SDL/commit/182057b34e259872c7b9f5cc0946d8c1c49f9d1a", "https://github.com/libsdl-org/SDL/commit/8d6459a2ed6b7398068fc7f3bbe3a4bc4898fc7b" ]
2024-12-28T14:28:37Z
https://github.com/libsdl-org/SDL/tree/028107124358a3d256c8c3acf4e4db6f20e4c348
[ "$vs=\"${env:ProgramFiles(x86)}\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat\"; cmd.exe /c \"call `\"$vs`\" -arch=x64 && cmake --build build --parallel && cmake --install build\"" ]
[ "$env:SDL_AUDIODRIVER=\"\"dummy\"\"; $env:SDL_VIDEODRIVER=\"\"offscreen\"\"; ctest --test-dir build --no-tests=error --output-on-failure -VV -C Release 2>&1 | Tee-Object -FilePath test-output.log" ]
[ "cat test-output.log" ]
def parser(log: str) -> dict[str, str]: # Improved parser for CTest and internal testautomation output with wrapped lines import re results: dict[str, str] = {} def set_status(name: str, status: str): status = (status or "").strip().lower() if status in ("passed", "pass", "success", "ok"): new = "pass" elif status in ("skipped", "skip", "not run", "notrun", "disabled", "ignored"): new = "skip" else: # Treat anything else, including 'failed', 'error', 'timeout', etc., as fail new = "fail" prev = results.get(name) if prev == "fail": return if (prev is None) or (new == "fail") or (prev == "skip" and new == "pass"): results[name] = new # Regex to capture CTest per-test summary lines # Example: " 1/23 Test #1: testaudioinfo .................... Passed 0.02 sec" ctest_line_re = re.compile( r"\bTest\s+#\s*\d+:\s+(\S+).*?\b(Passed|Failed|Skipped|Not Run|Disabled|Timeout)\b", re.IGNORECASE, ) # "The following tests FAILED:" block entries: # e.g. " 2 - testautomation (Failed)" or "(Timeout)" failed_entry_re = re.compile( r"^\s*\d+\s*-\s*([^\s]+)\s+\(([^)]+)\)", re.IGNORECASE, ) # Internal testautomation granular results can be wrapped across lines. # We'll parse from a normalized buffer without CTest/timestamp prefixes. internal_test_re = re.compile( r">>>\s*Test\s*'([^']+)'\s*:\s*(Passed|Failed|Skipped|Not Run|Disabled|Timeout)\b", re.IGNORECASE, ) # Helper to strip CTest channel prefix and optional timestamp prefix chan_prefix_re = re.compile(r"^\s*\d+:\s+") ts_prefix_re = re.compile(r"^\d{2}/\d{2}/\d{2}\s+\d{2}:\d{2}:\d{2}:\s+") def strip_prefixes(s: str) -> str: s2 = chan_prefix_re.sub("", s, count=1) s2 = ts_prefix_re.sub("", s2, count=1) return s2 # Buffer to accumulate possibly wrapped internal test lines buf = "" buf_lines = 0 max_buf_lines = 4 # safety cap # Process the log line-by-line for raw_line in log.splitlines(): line = raw_line.rstrip("\r\n") # 1) CTest per-test summary lines on raw content m = ctest_line_re.search(line) if m: name, status = m.groups() set_status(name, status) # don't "continue" because same line might also contain something else (unlikely). # 2) Failed block entries on raw content f = failed_entry_re.search(line) if f: name = f.group(1) # Treat anything in parentheses here as failure (Failed, Timeout, etc.) set_status(name, "fail") # 3) Internal ">>> Test '...': Status" parsing with wrapping norm = strip_prefixes(line) # If a new internal test marker appears, (re)start the buffer from that marker idx = norm.find(">>> Test") if idx >= 0: buf = norm[idx:].strip() buf_lines = 1 elif buf: # Continue accumulating if buffer is active # Append stripped current line content (without prefixes) seg = norm.strip() if seg: # Deduplicate a single overlapping character at the boundary when the next # segment begins with the same char followed by a closing quote (e.g., "s':") if buf and len(seg) >= 2 and seg[0] == buf[-1] and seg[1] == "'": seg = seg[1:] # Concatenate directly to avoid inserting spaces inside quoted names buf += seg buf_lines += 1 # Try to match the internal test result in the buffer (if any) if buf: it = internal_test_re.search(buf) if it: name, status = it.groups() set_status(name, status) buf = "" buf_lines = 0 elif buf_lines >= max_buf_lines: # Give up on this buffer if it doesn't resolve in N lines buf = "" buf_lines = 0 return results
[ "video_getClosestDisplayModeRandomResolution" ]
[ "video_getFullscreenDisplayModes", "round_roundNumberCases", "stdlib_strnlen", "testqsort", "hints_getHint", "pixels_saveLoadBMP", "log10_baseCases", "exp_infCases", "pow_baseNZeroExpOddCases", "asin_outOfDomainCases", "audio_buildAudioStream", "pixels_getPixelFormatDetails", "rect_testEnclosePointsRepeatedInput", "time_dateTimeConversion", "platform_testEndianessAndSwap", "cos_nanCase", "mouse_getMouseState", "process_testInheritedEnv", "iostrm_testMem", "rect_testIntersectRectParam", "audio_buildAudioStreamNegative", "surface_testBlitZeroSource", "stdlib_sscanf", "TestVirtualJoystick", "sdltest_randomIntegerInRange", "stdlib_strtod", "intrinsics_testSSE4.1", "atan2_nanCases", "testprocess", "floor_roundNumberCases", "video_getWindowDisplayModeNegative", "scalbn_regularCases", "keyboard_getScancodeFromName", "surface_testBlit9Grid", "audio_enumerateAndNameAudioDevicesNegativeTestts", "cos_precisionTest", "rect_testEnclosePointsWithClipping", "audio_lockUnlockOpenAudioDevice", "subsystems_dependRefCountWithExtraInit", "testbounds", "rect_testFRectEquals", "process_testNewEnv", "atan2_xInfCases", "copysign_rangeTest", "mouse_getGlobalMouseState", "rect_testEnclosePoints", "keyboard_getKeyNameNegative", "mouse_createFreeCursor", "rect_testHasIntersectionEmpty", "video_getSetWindowData", "keyboard_getKeyboardState", "sdltest_getFuzzerInvocationCount", "keyboard_getScancodeFromNameNegative", "events_addDelEventWatchWithUserdata", "rect_testUnionRectInside", "fmod_regularCases", "rect_testIntersectRectAndLineOutside", "surface_testLoadFailure", "testpower", "timer_addRemoveTimer", "render_testUVWrapping", "process_testArguments", "surface_testPalette", "testplatform", "surface_testCompleteSurfaceConversion", "copysign_infCases", "trunc_nanCase", "fmod_divByZeroCases", "render_testBlitTiled", "ceil_rangeTest", "rect_testHasIntersectionInside", "audio_printAudioDrivers", "exp_baseCase", "sin_nanCase", "sdltest_randomBoundaryNumberSint8", "pow_regularCases", "surface_testFlip", "process_testWriteToFinishedProcess", "intrinsics_testSSE4.2", "sqrt_regularCases", "fabs_infCases", "iostrm_testAllocFree", "video_getSetWindowMinimumSize", "log_testHint", "sqrt_baseCases", "pow_basePInfCases", "scalbn_nanCase", "testsem", "properties_testBasic", "mouse_setCursor", "scalbn_infCases", "video_getWindowDisplayMode", "exp_zeroCases", "fmod_divByInfCases", "trunc_roundNumberCases", "sin_precisionTest", "subsystems_dependRefCountInitByOneQuitAll", "video_createWindowVariousFlags", "render_testPrimitivesWithViewport", "time_dateTimeUtilities", "log_baseCases", "pow_rangeTest", "render_testPrimitives", "audio_openCloseAndGetAudioStatus", "sdltest_randomBoundaryNumberSint32", "rect_testFRectEqualsParam", "process_testSimpleStdinToStdout", "atan_zeroCases", "copysign_zeroCases", "sdltest_randomBoundaryNumberUint8", "process_testKill", "rect_testIntersectRectAndLine", "fabs_zeroCases", "rect_testHasIntersectionOutside", "keyboard_getKeyName", "audio_enumerateAndNameAudioDevices", "stdlib_snprintf", "floor_nanCase", "testtimer", "surface_testBlitTiled", "tan_nanCase", "log10_regularCases", "floor_fractionCases", "audio_resampleLoss", "sdltest_randomNumber", "round_fractionCases", "intrinsics_testAVX2", "fmod_nanCases", "platform_testGetVersion", "sdltest_randomAsciiString", "testatomic", "tan_zeroCases", "rect_testHasIntersectionParam", "cos_infCases", "timer_getPerformanceCounter", "keyboard_setTextInputArea", "pow_basePZeroCases", "pow_baseZeroExpNInfCases", "audio_getAudioStatus", "tan_precisionTest", "video_createWindowVariousSizes", "rect_testRectEmptyParam", "blit_testExampleApplicationRender", "scalbn_baseZeroCases", "platform_testSetErrorEmptyInput", "rect_testHasIntersectionPoint", "acos_nanCase", "process_testFileRedirection", "iostrm_testParamNegative", "cos_regularCases", "stdlib_strlcpy", "modf_baseCases", "surface_testClearSurface", "timer_getPerformanceFrequency", "exp_overflowCase", "intrinsics_testSSE2", "surface_testSurfaceConversion", "rect_testHasIntersectionPartial", "TestGUIDToString", "scalbn_expZeroCase", "pow_baseNanExp0Cases", "atan2_topLeftQuadrantTest", "torturethread", "events_addDelEventWatch", "render_testClipRect", "fabs_nanCase", "pixels_allocFreePalette", "rect_testIntersectRectOutside", "mouse_getMouseFocus", "iostrm_testFileWrite", "time_getRealtimeClock", "stdlib_swprintf", "rect_testIntersectRectPartial", "clipboard_testPrimarySelectionTextFunctions", "hints_setHint", "ceil_roundNumberCases", "sqrt_nanCase", "rect_testEnclosePointsParam", "atan2_bothInfCases", "stdlib_strtox", "iostrm_testDynamicMem", "round_zeroCases", "audio_initQuitAudio", "rect_testIntersectRectAndLineParam", "intrinsics_testSSE3", "asin_nanCase", "process_testMultiprocessStdinToStdout", "surface_testBlitBlendMod", "sqrt_infCase", "clipboard_testClipboardTextFunctions", "pow_nanArgsCases", "atan2_xZeroCases", "process_testStdinToStdout", "iostrm_testConstMem", "fmod_divOfZeroCases", "pow_base1ExpNanCase", "iostrm_testFileRead", "platform_testSetErrorInvalidInput", "video_createMaximized", "audio_getAudioFormatName", "main_testImpliedJoystickInit", "cos_rangeTest", "platform_testTypes", "keyboard_getKeyFromScancode", "pow_baseNInfCases", "render_testBlit", "testfile", "surface_testBlitMultiple", "keyboard_startStopTextInput", "clipboard_testClipboardDataFunctions", "pow_basePZeroExpOddCases", "surface_testBlit", "rect_testIntersectRectAndLineEmpty", "properties_testCopy", "asin_limitCases", "fmod_divOfInfCases", "sdltest_generateRunSeed", "sqrt_outOfDomainCases", "blit_testRandomToRandomSVGA", "trunc_fractionCases", "surface_testBlitBlendAddPremultiplied", "stdlib_aligned_alloc", "sdltest_randomBoundaryNumberUint16", "audio_printCurrentAudioDriver", "ceil_infCases", "surface_testBlitBlendAdd", "audio_enumerateAndNameAudioDevicesNegativeTests", "atan2_bottomRightQuadrantTest", "process_testNonExistingExecutable", "mouse_warpMouseInWindow", "tan_infCases", "rect_testIntersectRectInside", "render_testGetNumRenderDrivers", "platform_testGetFunctions", "ceil_zeroCases", "testver", "testthread", "platform_testHasFunctions", "acos_precisionTest", "video_getClosestDisplayModeCurrentResolution", "render_testLogicalSize", "video_createMinimized", "mouse_getCursor", "render_testBlit9Grid", "atan2_yZeroCases", "round_nanCase", "atan_limitCases", "testkeys", "audio_quitInitAudioSubSystem", "fmod_rangeTest", "platform_testDefaultInit", "video_getWindowFlags", "testerror", "stdlib_strpbrk", "mouse_getSetRelativeMouseMode", "audio_pauseUnpauseAudio", "render_testViewport", "atan_precisionTest", "main_testImpliedJoystickQuit", "video_getWindowPixelFormat", "timer_delayAndGetTicks", "events_mainThreadCallbacks", "surface_testOverflow", "atan_nanCase", "stdlib_iconv", "floor_infCases", "pow_powerOfTwo", "testdisplayinfo", "subsystems_dependRefCountInitAllQuitByOne", "subsystems_referenceCount", "surface_testBlitBlendMul", "rect_testIntersectRectFloat", "pow_baseNOneExpInfCases", "keyboard_setTextInputAreaNegative", "testlocale", "surface_testBlitAlphaMod", "keyboard_getScancodeNameNegative", "stdlib_overflow", "video_getWindowSurface", "keyboard_getSetModState", "properties_testLocking", "audio_convertAccuracy", "sdltest_randomBoundaryNumberSint64", "render_testBlitColor", "rect_testRectEmptyFloat", "sin_infCases", "mouse_getRelativeMouseState", "video_getSetWindowGrab", "video_getSetWindowSize", "pow_expInfCases", "surface_testBlitBlendPremultiplied", "atan2_bothZeroCases", "keyboard_getKeyboardFocus", "pixels_getPixelFormatName", "rect_testIntersectRectAndLineInside", "acos_limitCases", "rect_testRectEqualsParam", "intrinsics_testSSE", "sdltest_randomBoundaryNumberSint16", "video_enableDisableScreensaver", "video_getSetWindowPosition", "rect_testIntersectRectAndLineFloat", "rect_testIntersectRectPoint", "rect_testRectEmpty", "sin_rangeTest", "testyuv", "process_testStdinToStderr", "mouse_getDefaultCursor", "process_testExitCode", "log_regularCases", "rect_testEnclosePointsFloat", "testevdev", "surface_testScale", "mouse_createFreeColorCursor", "log_limitCases", "platform_testGetPowerInfo", "audio_convertAudio", "surface_testPalettization", "acos_outOfDomainCases", "surface_testPremultiplyAlpha", "audio_initOpenCloseQuitAudio", "asin_precisionTest", "render_testBlendModes", "intrinsics_selftest", "rect_testUnionRectParam", "rect_testUnionRectOutside", "video_getWindowId", "platform_testGetSetClearError", "sin_regularCases", "atan2_topRightQuadrantTest", "atan2_yInfCases", "trunc_zeroCases", "trunc_rangeTest", "process_testBatBadButVulnerability", "video_getSetWindowMaximumSize", "copysign_nanCases", "log10_nanCases", "log10_limitCases", "ceil_fractionCases", "properties_testCleanup", "testaudioinfo", "atan2_bottomLeftQuadrantTest", "stdlib_getsetenv", "sdltest_randomBoundaryNumberUint32", "surface_testBlitColorMod", "floor_zeroCases", "surface_testBlitBlendBlend", "round_rangeTest", "log_nanCases", "intrinsics_testAVX", "pow_badOperationCase", "rect_testUnionRectEmpty", "events_pushPumpAndPollUserevent", "pow_baseNZeroCases", "rect_testRectEquals", "audio_formatChange", "video_setWindowCenteredOnDisplay", "trunc_infCases", "round_infCases", "ceil_nanCase", "surface_testSaveLoadBitmap", "TestStringToGUID", "iostrm_testCompareRWFromMemWithRWFromFile", "keyboard_getKeyFromName", "main_testSetError", "stdlib_strstr", "rect_testIntersectRectEmpty", "sdltest_randomAsciiStringOfSize", "testfilesystem", "floor_rangeTest", "stdlib_wcstol", "exp_regularCases", "iostrm_testFileWriteReadEndian", "mouse_showCursor", "sdltest_randomBoundaryNumberUint64", "fabs_rangeTest" ]
starryzhang/sweb.eval.win.libsdl-org_1776_sdl-11761
libsdl-org/SDL
12806
libsdl-org__SDL-12806
[ "12802" ]
f35a2736b708408bd5e6273255c03513cf60605a
diff --git a/CMakeLists.txt b/CMakeLists.txt index 364cb5c0fd359..0db59b3eec21c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1893,11 +1893,13 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) set (USE_POSIX_SPAWN 1) endif() elseif(WINDOWS) + enable_language(CXX) check_c_source_compiles(" #include <windows.h> int main(int argc, char **argv) { return 0; }" HAVE_WIN32_CC) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/core/windows/*.c") + sdl_glob_sources("${SDL3_SOURCE_DIR}/src/core/windows/*.cpp") sdl_glob_sources("${SDL3_SOURCE_DIR}/src/main/windows/*.c") sdl_glob_sources("${SDL3_SOURCE_DIR}/src/io/windows/*.c") @@ -2008,6 +2010,7 @@ elseif(WINDOWS) if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_WINDOWS 1) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/video/windows/*.c") + sdl_glob_sources("${SDL3_SOURCE_DIR}/src/video/windows/*.cpp") CheckOpenVR() @@ -2135,7 +2138,7 @@ elseif(WINDOWS) set(SDL_JOYSTICK_WGI 1) endif() if(HAVE_GAMEINPUT_H) - sdl_glob_sources("${SDL3_SOURCE_DIR}/src/joystick/gdk/*.c") + sdl_glob_sources("${SDL3_SOURCE_DIR}/src/joystick/gdk/*.cpp") set(SDL_JOYSTICK_GAMEINPUT 1) endif() set(HAVE_SDL_JOYSTICK TRUE) diff --git a/VisualC-GDK/SDL/SDL.vcxproj b/VisualC-GDK/SDL/SDL.vcxproj index d15619c802ee2..baa2fffe2c2af 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj +++ b/VisualC-GDK/SDL/SDL.vcxproj @@ -645,7 +645,7 @@ <ClCompile Include="..\..\src\audio\SDL_wave.c" /> <ClCompile Include="..\..\src\audio\wasapi\SDL_wasapi.c" /> <ClCompile Include="..\..\src\core\SDL_core_unsupported.c" /> - <ClCompile Include="..\..\src\core\windows\SDL_gameinput.c"/> + <ClCompile Include="..\..\src\core\windows\SDL_gameinput.cpp"/> <ClCompile Include="..\..\src\core\windows\SDL_hid.c" /> <ClCompile Include="..\..\src\core\windows\SDL_immdevice.c" /> <ClCompile Include="..\..\src\core\windows\SDL_windows.c" /> @@ -710,7 +710,7 @@ <ClCompile Include="..\..\src\hidapi\SDL_hidapi.c" /> <ClCompile Include="..\..\src\joystick\controller_type.c" /> <ClCompile Include="..\..\src\joystick\dummy\SDL_sysjoystick.c" /> - <ClCompile Include="..\..\src\joystick\gdk\SDL_gameinputjoystick.c" /> + <ClCompile Include="..\..\src\joystick\gdk\SDL_gameinputjoystick.cpp" /> <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapijoystick.c" /> <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_8bitdo.c" /> <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_combined.c" /> @@ -891,7 +891,7 @@ <ClCompile Include="..\..\src\video\windows\SDL_windowsevents.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowsframebuffer.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowskeyboard.c" /> - <ClCompile Include="..\..\src\video\windows\SDL_windowsgameinput.c" /> + <ClCompile Include="..\..\src\video\windows\SDL_windowsgameinput.cpp" /> <ClCompile Include="..\..\src\video\windows\SDL_windowsmessagebox.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowsmodes.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowsmouse.c" /> diff --git a/VisualC-GDK/SDL/SDL.vcxproj.filters b/VisualC-GDK/SDL/SDL.vcxproj.filters index 03b5a6a8f817d..26f228826c966 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj.filters +++ b/VisualC-GDK/SDL/SDL.vcxproj.filters @@ -27,7 +27,7 @@ <ClCompile Include="..\..\src\audio\SDL_wave.c" /> <ClCompile Include="..\..\src\audio\wasapi\SDL_wasapi.c" /> <ClCompile Include="..\..\src\core\SDL_core_unsupported.c" /> - <ClCompile Include="..\..\src\core\windows\SDL_gameinput.c" /> + <ClCompile Include="..\..\src\core\windows\SDL_gameinput.cpp" /> <ClCompile Include="..\..\src\core\windows\SDL_hid.c" /> <ClCompile Include="..\..\src\core\windows\SDL_immdevice.c" /> <ClCompile Include="..\..\src\core\windows\SDL_windows.c" /> @@ -61,7 +61,7 @@ <ClCompile Include="..\..\src\hidapi\SDL_hidapi.c" /> <ClCompile Include="..\..\src\joystick\controller_type.c" /> <ClCompile Include="..\..\src\joystick\dummy\SDL_sysjoystick.c" /> - <ClCompile Include="..\..\src\joystick\gdk\SDL_gameinputjoystick.c" /> + <ClCompile Include="..\..\src\joystick\gdk\SDL_gameinputjoystick.cpp" /> <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapijoystick.c" /> <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_8bitdo.c" /> <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_combined.c" /> @@ -193,7 +193,7 @@ <ClCompile Include="..\..\src\video\windows\SDL_windowsevents.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowsframebuffer.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowskeyboard.c" /> - <ClCompile Include="..\..\src\video\windows\SDL_windowsgameinput.c" /> + <ClCompile Include="..\..\src\video\windows\SDL_windowsgameinput.cpp" /> <ClCompile Include="..\..\src\video\windows\SDL_windowsmessagebox.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowsmodes.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowsmouse.c" /> diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj index 738a4110fbc8f..c0a4d8643665d 100644 --- a/VisualC/SDL/SDL.vcxproj +++ b/VisualC/SDL/SDL.vcxproj @@ -424,6 +424,16 @@ <ClCompile Include="..\..\src\camera\dummy\SDL_camera_dummy.c" /> <ClCompile Include="..\..\src\camera\mediafoundation\SDL_camera_mediafoundation.c" /> <ClCompile Include="..\..\src\camera\SDL_camera.c" /> + <ClCompile Include="..\..\src\core\windows\pch_cpp.cpp"> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> + <PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile> + <PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile> + <PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile> + <PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile> + </ClCompile> <ClCompile Include="..\..\src\dialog\SDL_dialog.c" /> <ClCompile Include="..\..\src\dialog\SDL_dialog_utils.c" /> <ClCompile Include="..\..\src\filesystem\SDL_filesystem.c" /> @@ -543,7 +553,12 @@ <ClCompile Include="..\..\src\audio\SDL_wave.c" /> <ClCompile Include="..\..\src\audio\wasapi\SDL_wasapi.c" /> <ClCompile Include="..\..\src\core\SDL_core_unsupported.c" /> - <ClCompile Include="..\..\src\core\windows\SDL_gameinput.c" /> + <ClCompile Include="..\..\src\core\windows\SDL_gameinput.cpp"> + <PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile> + <PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile> + <PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile> + <PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile> + </ClCompile> <ClCompile Include="..\..\src\core\windows\SDL_hid.c" /> <ClCompile Include="..\..\src\core\windows\SDL_immdevice.c" /> <ClCompile Include="..\..\src\core\windows\SDL_windows.c" /> @@ -580,7 +595,12 @@ <ClCompile Include="..\..\src\hidapi\SDL_hidapi.c" /> <ClCompile Include="..\..\src\joystick\controller_type.c" /> <ClCompile Include="..\..\src\joystick\dummy\SDL_sysjoystick.c" /> - <ClCompile Include="..\..\src\joystick\gdk\SDL_gameinputjoystick.c" /> + <ClCompile Include="..\..\src\joystick\gdk\SDL_gameinputjoystick.cpp"> + <PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile> + <PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile> + <PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile> + <PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile> + </ClCompile> <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapijoystick.c" /> <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_8bitdo.c" /> <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_combined.c" /> @@ -726,7 +746,12 @@ <ClCompile Include="..\..\src\video\windows\SDL_windowsevents.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowsframebuffer.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowskeyboard.c" /> - <ClCompile Include="..\..\src\video\windows\SDL_windowsgameinput.c" /> + <ClCompile Include="..\..\src\video\windows\SDL_windowsgameinput.cpp"> + <PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile> + <PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile> + <PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile> + <PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile> + </ClCompile> <ClCompile Include="..\..\src\video\windows\SDL_windowsmessagebox.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowsmodes.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowsmouse.c" /> diff --git a/VisualC/SDL/SDL.vcxproj.filters b/VisualC/SDL/SDL.vcxproj.filters index a5b201ed6d5e2..2583c9f3791ea 100644 --- a/VisualC/SDL/SDL.vcxproj.filters +++ b/VisualC/SDL/SDL.vcxproj.filters @@ -537,9 +537,6 @@ <ClInclude Include="..\..\src\events\SDL_events_c.h"> <Filter>events</Filter> </ClInclude> - <ClInclude Include="..\..\src\events\SDL_eventfilter_c.h"> - <Filter>events</Filter> - </ClInclude> <ClInclude Include="..\..\src\events\SDL_keyboard_c.h"> <Filter>events</Filter> </ClInclude> @@ -962,6 +959,7 @@ <ClInclude Include="..\..\include\SDL3\SDL_storage.h" /> <ClInclude Include="..\..\include\SDL3\SDL_time.h" /> <ClInclude Include="..\..\src\events\SDL_categories_c.h" /> + <ClInclude Include="..\..\src\events\SDL_eventwatch_c.h" /> </ItemGroup> <ItemGroup> <ClCompile Include="..\..\src\audio\wasapi\SDL_wasapi.c" /> @@ -1049,7 +1047,7 @@ <ClCompile Include="..\..\src\core\SDL_core_unsupported.c"> <Filter>core</Filter> </ClCompile> - <ClCompile Include="..\..\src\core\windows\SDL_gameinput.c"> + <ClCompile Include="..\..\src\core\windows\SDL_gameinput.cpp"> <Filter>core\windows</Filter> </ClCompile> <ClCompile Include="..\..\src\core\windows\SDL_hid.c"> @@ -1088,9 +1086,6 @@ <ClCompile Include="..\..\src\events\SDL_events.c"> <Filter>events</Filter> </ClCompile> - <ClCompile Include="..\..\src\events\SDL_eventfilter.c"> - <Filter>events</Filter> - </ClCompile> <ClCompile Include="..\..\src\events\SDL_keyboard.c"> <Filter>events</Filter> </ClCompile> @@ -1184,7 +1179,7 @@ <ClCompile Include="..\..\src\joystick\dummy\SDL_sysjoystick.c"> <Filter>joystick\dummy</Filter> </ClCompile> - <ClCompile Include="..\..\src\joystick\gdk\SDL_gameinputjoystick.c"> + <ClCompile Include="..\..\src\joystick\gdk\SDL_gameinputjoystick.cpp"> <Filter>joystick\gdk</Filter> </ClCompile> <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_8bitdo.c"> @@ -1367,7 +1362,7 @@ <ClCompile Include="..\..\src\video\windows\SDL_windowskeyboard.c"> <Filter>video\windows</Filter> </ClCompile> - <ClCompile Include="..\..\src\video\windows\SDL_windowsgameinput.c"> + <ClCompile Include="..\..\src\video\windows\SDL_windowsgameinput.cpp"> <Filter>video\windows</Filter> </ClCompile> <ClCompile Include="..\..\src\video\windows\SDL_windowsmessagebox.c"> @@ -1606,11 +1601,12 @@ <ClCompile Include="..\..\src\storage\generic\SDL_genericstorage.c" /> <ClCompile Include="..\..\src\storage\steam\SDL_steamstorage.c" /> <ClCompile Include="..\..\src\storage\SDL_storage.c" /> + <ClCompile Include="..\..\src\events\SDL_eventwatch.c" /> + <ClCompile Include="..\..\src\core\windows\pch_cpp.cpp"> + <Filter>core\windows</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ResourceCompile Include="..\..\src\core\windows\version.rc" /> </ItemGroup> - <ItemGroup> - <MASM Include="..\..\src\stdlib\SDL_mslibc_x64.masm" /> - </ItemGroup> </Project> diff --git a/src/core/windows/SDL_gameinput.c b/src/core/windows/SDL_gameinput.cpp similarity index 85% rename from src/core/windows/SDL_gameinput.c rename to src/core/windows/SDL_gameinput.cpp index 9ac5912db9d06..e2ea3fb4ab285 100644 --- a/src/core/windows/SDL_gameinput.c +++ b/src/core/windows/SDL_gameinput.cpp @@ -25,16 +25,11 @@ #include "SDL_windows.h" #include "SDL_gameinput.h" -#ifdef SDL_PLATFORM_WIN32 -#include <initguid.h> -// {11BE2A7E-4254-445A-9C09-FFC40F006918} -DEFINE_GUID(SDL_IID_GameInput, 0x11BE2A7E, 0x4254, 0x445A, 0x9C, 0x09, 0xFF, 0xC4, 0x0F, 0x00, 0x69, 0x18); -#endif - static SDL_SharedObject *g_hGameInputDLL; static IGameInput *g_pGameInput; static int g_nGameInputRefCount; + bool SDL_InitGameInput(IGameInput **ppGameInput) { if (g_nGameInputRefCount == 0) { @@ -43,7 +38,7 @@ bool SDL_InitGameInput(IGameInput **ppGameInput) return false; } - typedef HRESULT (WINAPI *GameInputCreate_t)(IGameInput * *gameInput); + typedef HRESULT (WINAPI *GameInputCreate_t)(IGameInput **gameInput); GameInputCreate_t GameInputCreateFunc = (GameInputCreate_t)SDL_LoadFunction(g_hGameInputDLL, "GameInputCreate"); if (!GameInputCreateFunc) { SDL_UnloadObject(g_hGameInputDLL); @@ -58,15 +53,19 @@ bool SDL_InitGameInput(IGameInput **ppGameInput) } #ifdef SDL_PLATFORM_WIN32 - hr = IGameInput_QueryInterface(pGameInput, &SDL_IID_GameInput, (void **)&g_pGameInput); - IGameInput_Release(pGameInput); +#if GAMEINPUT_API_VERSION >= 1 + hr = pGameInput->QueryInterface(IID_IGameInput, (void **)&g_pGameInput); +#else + // We require GameInput v1.1 or newer + hr = E_NOINTERFACE; +#endif + pGameInput->Release(); if (FAILED(hr)) { SDL_UnloadObject(g_hGameInputDLL); return WIN_SetErrorFromHRESULT("GameInput QueryInterface failed", hr); } #else // Assume that the version we get is compatible with the current SDK - // If that isn't the case, define the correct GUID for SDL_IID_GameInput above g_pGameInput = pGameInput; #endif } @@ -85,7 +84,7 @@ void SDL_QuitGameInput(void) --g_nGameInputRefCount; if (g_nGameInputRefCount == 0) { if (g_pGameInput) { - IGameInput_Release(g_pGameInput); + g_pGameInput->Release(); g_pGameInput = NULL; } if (g_hGameInputDLL) { diff --git a/src/core/windows/SDL_gameinput.h b/src/core/windows/SDL_gameinput.h index 0022c0bdde163..4d2beb5647005 100644 --- a/src/core/windows/SDL_gameinput.h +++ b/src/core/windows/SDL_gameinput.h @@ -25,9 +25,16 @@ #ifdef HAVE_GAMEINPUT_H -#define COBJMACROS #include <gameinput.h> +#ifndef GAMEINPUT_API_VERSION +#define GAMEINPUT_API_VERSION 0 +#endif + +#if GAMEINPUT_API_VERSION == 1 +using namespace GameInput::v1; +#endif + extern bool SDL_InitGameInput(IGameInput **ppGameInput); extern void SDL_QuitGameInput(void); diff --git a/src/joystick/gdk/SDL_gameinputjoystick.c b/src/joystick/gdk/SDL_gameinputjoystick.cpp similarity index 89% rename from src/joystick/gdk/SDL_gameinputjoystick.c rename to src/joystick/gdk/SDL_gameinputjoystick.cpp index 6cf0a902b7f17..46d4ecc5f117a 100644 --- a/src/joystick/gdk/SDL_gameinputjoystick.c +++ b/src/joystick/gdk/SDL_gameinputjoystick.cpp @@ -24,6 +24,7 @@ #include "../SDL_sysjoystick.h" #include "../usb_ids.h" +#include "../../core/windows/SDL_windows.h" #include "../../core/windows/SDL_gameinput.h" // Default value for SDL_HINT_JOYSTICK_GAMEINPUT @@ -66,7 +67,7 @@ typedef struct joystick_hwdata static GAMEINPUT_InternalList g_GameInputList = { NULL }; static IGameInput *g_pGameInput = NULL; -static GameInputCallbackToken g_GameInputCallbackToken = GAMEINPUT_INVALID_CALLBACK_TOKEN_VALUE; +static GameInputCallbackToken g_GameInputCallbackToken = 0; static Uint64 g_GameInputTimestampOffset; static bool GAMEINPUT_InternalIsGamepad(const GameInputDeviceInfo *info) @@ -93,15 +94,22 @@ static bool GAMEINPUT_InternalAddOrFind(IGameInputDevice *pDevice) SDL_AssertJoysticksLocked(); - info = IGameInputDevice_GetDeviceInfo(pDevice); - if (info->capabilities & GameInputDeviceCapabilityWireless) { +#if GAMEINPUT_API_VERSION >= 1 + HRESULT hr = pDevice->GetDeviceInfo(&info); + if (FAILED(hr)) { + return WIN_SetErrorFromHRESULT("IGameInputDevice::GetDeviceInfo", hr); + } +#else + info = pDevice->GetDeviceInfo(); +#endif + if (false /*info->capabilities & GameInputDeviceCapabilityWireless*/) { bus = SDL_HARDWARE_BUS_BLUETOOTH; } else { bus = SDL_HARDWARE_BUS_USB; } vendor = info->vendorId; product = info->productId; - version = (info->firmwareVersion.major << 8) | info->firmwareVersion.minor; + //version = (info->firmwareVersion.major << 8) | info->firmwareVersion.minor; if (SDL_JoystickHandledByAnotherDriver(&SDL_GAMEINPUT_JoystickDriver, vendor, product, version, "")) { return true; @@ -130,18 +138,20 @@ static bool GAMEINPUT_InternalAddOrFind(IGameInputDevice *pDevice) // Generate a device path for (idx = 0; idx < APP_LOCAL_DEVICE_ID_SIZE; ++idx) { SDL_snprintf(tmp, SDL_arraysize(tmp), "%02hhX", info->deviceId.value[idx]); - SDL_strlcat(elem->path, tmp, SDL_arraysize(tmp)); + SDL_strlcat(elem->path, tmp, SDL_arraysize(elem->path)); } - if (info->deviceStrings) { - // In theory we could get the manufacturer and product strings here, but they're NULL for all the controllers I've tested +#if GAMEINPUT_API_VERSION >= 1 + if (info->displayName) { + product_string = info->displayName; } - +#else if (info->displayName) { - // This could give us a product string, but it's NULL for all the controllers I've tested + product_string = info->displayName->data; } +#endif - IGameInputDevice_AddRef(pDevice); + pDevice->AddRef(); elem->device = pDevice; elem->name = SDL_CreateJoystickName(vendor, product, manufacturer_string, product_string); elem->guid = SDL_CreateJoystickGUID(bus, vendor, product, version, manufacturer_string, product_string, 'g', 0); @@ -168,7 +178,7 @@ static bool GAMEINPUT_InternalRemoveByIndex(int idx) elem = g_GameInputList.devices[idx]; if (elem) { - IGameInputDevice_Release(elem->device); + elem->device->Release(); SDL_free(elem->name); SDL_free(elem); } @@ -232,10 +242,11 @@ static void CALLBACK GAMEINPUT_InternalJoystickDeviceCallback( } static void GAMEINPUT_JoystickDetect(void); +static void GAMEINPUT_JoystickQuit(void); static bool GAMEINPUT_JoystickInit(void) { - HRESULT hR; + HRESULT hr; if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_GAMEINPUT, SDL_GAMEINPUT_DEFAULT)) { return true; @@ -245,21 +256,21 @@ static bool GAMEINPUT_JoystickInit(void) return false; } - hR = IGameInput_RegisterDeviceCallback(g_pGameInput, - NULL, + hr = g_pGameInput->RegisterDeviceCallback(NULL, GameInputKindController, GameInputDeviceConnected, GameInputBlockingEnumeration, NULL, GAMEINPUT_InternalJoystickDeviceCallback, &g_GameInputCallbackToken); - if (FAILED(hR)) { - return SDL_SetError("IGameInput::RegisterDeviceCallback failure with HRESULT of %08lX", hR); + if (FAILED(hr)) { + GAMEINPUT_JoystickQuit(); + return WIN_SetErrorFromHRESULT("IGameInput::RegisterDeviceCallback", hr); } // Calculate the relative offset between SDL timestamps and GameInput timestamps Uint64 now = SDL_GetTicksNS(); - uint64_t timestampUS = IGameInput_GetCurrentTimestamp(g_pGameInput); + uint64_t timestampUS = g_pGameInput->GetCurrentTimestamp(); g_GameInputTimestampOffset = (SDL_NS_TO_US(now) - timestampUS); GAMEINPUT_JoystickDetect(); @@ -292,7 +303,7 @@ static void GAMEINPUT_JoystickDetect(void) elem->isAdded = true; } - if (elem->isDeleteRequested || !(IGameInputDevice_GetDeviceStatus(elem->device) & GameInputDeviceConnected)) { + if (elem->isDeleteRequested || !(elem->device->GetDeviceStatus() & GameInputDeviceConnected)) { SDL_PrivateJoystickRemoved(elem->device_instance); GAMEINPUT_InternalRemoveByIndex(idx--); } @@ -357,6 +368,7 @@ static SDL_JoystickID GAMEINPUT_JoystickGetDeviceInstanceID(int device_index) static void GAMEINPUT_UpdatePowerInfo(SDL_Joystick *joystick, IGameInputDevice *device) { +#if 0 GameInputBatteryState battery_state; SDL_PowerState state; int percent = 0; @@ -385,10 +397,10 @@ static void GAMEINPUT_UpdatePowerInfo(SDL_Joystick *joystick, IGameInputDevice * percent = (int)SDL_roundf((battery_state.remainingCapacity / battery_state.fullChargeCapacity) * 100.0f); } SDL_SendJoystickPowerInfo(joystick, state, percent); +#endif } -#ifdef IGameInput_RegisterSystemButtonCallback - +#if GAMEINPUT_API_VERSION >= 1 static void CALLBACK GAMEINPUT_InternalSystemButtonCallback( _In_ GameInputCallbackToken callbackToken, _In_ void * context, @@ -415,8 +427,7 @@ static void CALLBACK GAMEINPUT_InternalSystemButtonCallback( SDL_UnlockJoysticks(); } } - -#endif // IGameInput_RegisterSystemButtonCallback +#endif // GAMEINPUT_API_VERSION >= 1 static bool GAMEINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) { @@ -441,19 +452,15 @@ static bool GAMEINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) joystick->nbuttons = 11; joystick->nhats = 1; -#ifdef IGameInput_RegisterSystemButtonCallback +#if GAMEINPUT_API_VERSION >= 1 if (info->supportedSystemButtons != GameInputSystemButtonNone) { if (info->supportedSystemButtons & GameInputSystemButtonShare) { ++joystick->nbuttons; } -#if 1 // The C macro in GameInput.h version 10.0.26100 refers to a focus policy which I guess has been removed from the final API? -#undef IGameInput_RegisterSystemButtonCallback -#define IGameInput_RegisterSystemButtonCallback(This, device, buttonFilter, context, callbackFunc, callbackToken) ((This)->lpVtbl->RegisterSystemButtonCallback(This, device, buttonFilter, context, callbackFunc, callbackToken)) -#endif - IGameInput_RegisterSystemButtonCallback(g_pGameInput, elem->device, (GameInputSystemButtonGuide | GameInputSystemButtonShare), joystick, GAMEINPUT_InternalSystemButtonCallback, &hwdata->system_button_callback_token); + g_pGameInput->RegisterSystemButtonCallback(elem->device, (GameInputSystemButtonGuide | GameInputSystemButtonShare), joystick, GAMEINPUT_InternalSystemButtonCallback, &hwdata->system_button_callback_token); } -#endif // IGameInput_RegisterSystemButtonCallback +#endif // GAMEINPUT_API_VERSION >= 1 } else { joystick->naxes = info->controllerAxisCount; joystick->nbuttons = info->controllerButtonCount; @@ -467,6 +474,7 @@ static bool GAMEINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) SDL_SetBooleanProperty(SDL_GetJoystickProperties(joystick), SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN, true); } +#if 0 if (info->supportedInput & GameInputKindTouch) { SDL_PrivateJoystickAddTouchpad(joystick, info->touchPointCount); } @@ -482,6 +490,7 @@ static bool GAMEINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) } else { joystick->connection_state = SDL_JOYSTICK_CONNECTION_WIRED; } +#endif return true; } @@ -492,7 +501,7 @@ static bool GAMEINPUT_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequenc GameInputRumbleParams *params = &hwdata->rumbleParams; params->lowFrequency = (float)low_frequency_rumble / (float)SDL_MAX_UINT16; params->highFrequency = (float)high_frequency_rumble / (float)SDL_MAX_UINT16; - IGameInputDevice_SetRumbleState(hwdata->devref->device, params); + hwdata->devref->device->SetRumbleState(params); return true; } @@ -503,7 +512,7 @@ static bool GAMEINPUT_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left GameInputRumbleParams *params = &hwdata->rumbleParams; params->leftTrigger = (float)left_rumble / (float)SDL_MAX_UINT16; params->rightTrigger = (float)right_rumble / (float)SDL_MAX_UINT16; - IGameInputDevice_SetRumbleState(hwdata->devref->device, params); + hwdata->devref->device->SetRumbleState(params); return true; } @@ -531,15 +540,15 @@ static void GAMEINPUT_JoystickUpdate(SDL_Joystick *joystick) IGameInputReading *reading = NULL; Uint64 timestamp; GameInputGamepadState state; - HRESULT hR; + HRESULT hr; - hR = IGameInput_GetCurrentReading(g_pGameInput, info->supportedInput, device, &reading); - if (FAILED(hR)) { + hr = g_pGameInput->GetCurrentReading(info->supportedInput, device, &reading); + if (FAILED(hr)) { // don't SetError here since there can be a legitimate case when there's no reading avail return; } - timestamp = SDL_US_TO_NS(IGameInputReading_GetTimestamp(reading) + g_GameInputTimestampOffset); + timestamp = SDL_US_TO_NS(reading->GetTimestamp() + g_GameInputTimestampOffset); if (GAMEINPUT_InternalIsGamepad(info)) { static WORD s_XInputButtons[] = { @@ -557,7 +566,7 @@ static void GAMEINPUT_JoystickUpdate(SDL_Joystick *joystick) }; Uint8 btnidx = 0, hat = 0; - if (IGameInputReading_GetGamepadState(reading, &state)) { + if (reading->GetGamepadState(&state)) { for (btnidx = 0; btnidx < SDL_arraysize(s_XInputButtons); ++btnidx) { WORD button_mask = s_XInputButtons[btnidx]; if (!button_mask) { @@ -599,7 +608,7 @@ static void GAMEINPUT_JoystickUpdate(SDL_Joystick *joystick) if (button_state) { uint32_t i; - uint32_t button_count = IGameInputReading_GetControllerButtonState(reading, info->controllerButtonCount, button_state); + uint32_t button_count = reading->GetControllerButtonState(info->controllerButtonCount, button_state); for (i = 0; i < button_count; ++i) { SDL_SendJoystickButton(timestamp, joystick, (Uint8)i, button_state[i]); } @@ -609,7 +618,7 @@ static void GAMEINPUT_JoystickUpdate(SDL_Joystick *joystick) #define CONVERT_AXIS(v) (Sint16)((v)*65535.0f - 32768.0f) if (axis_state) { uint32_t i; - uint32_t axis_count = IGameInputReading_GetControllerAxisState(reading, info->controllerAxisCount, axis_state); + uint32_t axis_count = reading->GetControllerAxisState(info->controllerAxisCount, axis_state); for (i = 0; i < axis_count; ++i) { SDL_SendJoystickAxis(timestamp, joystick, (Uint8)i, CONVERT_AXIS(axis_state[i])); } @@ -619,7 +628,7 @@ static void GAMEINPUT_JoystickUpdate(SDL_Joystick *joystick) if (switch_state) { uint32_t i; - uint32_t switch_count = IGameInputReading_GetControllerSwitchState(reading, info->controllerSwitchCount, switch_state); + uint32_t switch_count = reading->GetControllerSwitchState(info->controllerSwitchCount, switch_state); for (i = 0; i < switch_count; ++i) { Uint8 hat; switch (switch_state[i]) { @@ -658,6 +667,7 @@ static void GAMEINPUT_JoystickUpdate(SDL_Joystick *joystick) } } +#if 0 if (info->supportedInput & GameInputKindTouch) { GameInputTouchState *touch_state = SDL_stack_alloc(GameInputTouchState, info->touchPointCount); if (touch_state) { @@ -679,8 +689,9 @@ static void GAMEINPUT_JoystickUpdate(SDL_Joystick *joystick) // FIXME: How do we interpret the motion data? } } +#endif - IGameInputReading_Release(reading); + reading->Release(); // FIXME: We can poll this at a much lower rate GAMEINPUT_UpdatePowerInfo(joystick, device); @@ -691,7 +702,11 @@ static void GAMEINPUT_JoystickClose(SDL_Joystick* joystick) GAMEINPUT_InternalJoystickHwdata *hwdata = joystick->hwdata; if (hwdata->system_button_callback_token) { - IGameInput_UnregisterCallback(g_pGameInput, hwdata->system_button_callback_token, 5000); +#if GAMEINPUT_API_VERSION >= 1 + g_pGameInput->UnregisterCallback(hwdata->system_button_callback_token); +#else + g_pGameInput->UnregisterCallback(hwdata->system_button_callback_token, 10000); +#endif } SDL_free(hwdata); @@ -702,8 +717,14 @@ static void GAMEINPUT_JoystickQuit(void) { if (g_pGameInput) { // free the callback - IGameInput_UnregisterCallback(g_pGameInput, g_GameInputCallbackToken, /*timeoutInUs:*/ 10000); - g_GameInputCallbackToken = GAMEINPUT_INVALID_CALLBACK_TOKEN_VALUE; + if (g_GameInputCallbackToken) { +#if GAMEINPUT_API_VERSION >= 1 + g_pGameInput->UnregisterCallback(g_GameInputCallbackToken); +#else + g_pGameInput->UnregisterCallback(g_GameInputCallbackToken, 10000); +#endif + g_GameInputCallbackToken = 0; + } // free the list while (g_GameInputList.count > 0) { @@ -738,7 +759,7 @@ static bool GAMEINPUT_JoystickGetGamepadMapping(int device_index, SDL_GamepadMap out->back.kind = EMappingKind_Button; out->back.target = SDL_GAMEPAD_BUTTON_BACK; -#ifdef IGameInput_RegisterSystemButtonCallback +#if GAMEINPUT_API_VERSION >= 1 if (elem->info->supportedSystemButtons & GameInputSystemButtonGuide) { out->guide.kind = EMappingKind_Button; out->guide.target = SDL_GAMEPAD_BUTTON_GUIDE; @@ -748,7 +769,7 @@ static bool GAMEINPUT_JoystickGetGamepadMapping(int device_index, SDL_GamepadMap out->misc1.kind = EMappingKind_Button; out->misc1.target = SDL_GAMEPAD_BUTTON_GAMEINPUT_SHARE; } -#endif +#endif // GAMEINPUT_API_VERSION >= 1 out->start.kind = EMappingKind_Button; out->start.target = SDL_GAMEPAD_BUTTON_START; diff --git a/src/video/windows/SDL_windowsgameinput.c b/src/video/windows/SDL_windowsgameinput.cpp similarity index 81% rename from src/video/windows/SDL_windowsgameinput.c rename to src/video/windows/SDL_windowsgameinput.cpp index 183733a380470..7ea77ecc558b4 100644 --- a/src/video/windows/SDL_windowsgameinput.c +++ b/src/video/windows/SDL_windowsgameinput.cpp @@ -22,16 +22,14 @@ #include "SDL_windowsvideo.h" -// GameInput currently has a bug with keys stuck on focus change, and crashes on initialization on some systems, so we'll disable it until these issues are fixed. -#undef HAVE_GAMEINPUT_H - #ifdef HAVE_GAMEINPUT_H #include "../../core/windows/SDL_gameinput.h" +extern "C" { #include "../../events/SDL_mouse_c.h" #include "../../events/SDL_keyboard_c.h" #include "../../events/scancodes_windows.h" - +} #define MAX_GAMEINPUT_BUTTONS 7 // GameInputMouseWheelTiltRight is the highest button @@ -75,7 +73,14 @@ static bool GAMEINPUT_InternalAddOrFind(WIN_GameInputData *data, IGameInputDevic const GameInputDeviceInfo *info; bool result = false; - info = IGameInputDevice_GetDeviceInfo(pDevice); +#if GAMEINPUT_API_VERSION >= 1 + HRESULT hr = pDevice->GetDeviceInfo(&info); + if (FAILED(hr)) { + return WIN_SetErrorFromHRESULT("IGameInputDevice_GetDeviceInfo", hr); + } +#else + info = pDevice->GetDeviceInfo(); +#endif SDL_LockMutex(data->lock); { @@ -100,15 +105,11 @@ static bool GAMEINPUT_InternalAddOrFind(WIN_GameInputData *data, IGameInputDevic goto done; } - if (info->deviceStrings) { - // In theory we could get the manufacturer and product strings here, but they're NULL for all the devices I've tested - } - if (info->displayName) { // This could give us a product string, but it's NULL for all the devices I've tested } - IGameInputDevice_AddRef(pDevice); + pDevice->AddRef(); device->pDevice = pDevice; device->instance_id = SDL_GetNextObjectID(); device->info = info; @@ -147,15 +148,15 @@ static bool GAMEINPUT_InternalRemoveByIndex(WIN_GameInputData *data, int idx) SDL_RemoveKeyboard(device->instance_id, true); } if (device->last_mouse_reading) { - IGameInputReading_Release(device->last_mouse_reading); + device->last_mouse_reading->Release(); device->last_mouse_reading = NULL; } if (device->last_keyboard_reading) { - IGameInputReading_Release(device->last_keyboard_reading); + device->last_keyboard_reading->Release(); device->last_keyboard_reading = NULL; } } - IGameInputDevice_Release(device->pDevice); + device->pDevice->Release(); SDL_free(device->name); SDL_free(device); } @@ -217,6 +218,8 @@ bool WIN_InitGameInput(SDL_VideoDevice *_this) { WIN_GameInputData *data; HRESULT hr; + Uint64 now; + uint64_t timestampUS; bool result = false; if (_this->internal->gameinput_context) { @@ -238,22 +241,21 @@ bool WIN_InitGameInput(SDL_VideoDevice *_this) goto done; } - hr = IGameInput_RegisterDeviceCallback(data->pGameInput, - NULL, - (GameInputKindMouse | GameInputKindKeyboard), - GameInputDeviceConnected, - GameInputBlockingEnumeration, - data, - GAMEINPUT_InternalDeviceCallback, - &data->gameinput_callback_token); + hr = data->pGameInput->RegisterDeviceCallback(NULL, + (GameInputKindMouse | GameInputKindKeyboard), + GameInputDeviceConnected, + GameInputBlockingEnumeration, + data, + GAMEINPUT_InternalDeviceCallback, + &data->gameinput_callback_token); if (FAILED(hr)) { - SDL_SetError("IGameInput::RegisterDeviceCallback failure with HRESULT of %08X", hr); + WIN_SetErrorFromHRESULT("IGameInput::RegisterDeviceCallback", hr); goto done; } // Calculate the relative offset between SDL timestamps and GameInput timestamps - Uint64 now = SDL_GetTicksNS(); - uint64_t timestampUS = IGameInput_GetCurrentTimestamp(data->pGameInput); + now = SDL_GetTicksNS(); + timestampUS = data->pGameInput->GetCurrentTimestamp(); data->timestamp_offset = (SDL_NS_TO_US(now) - timestampUS); result = true; @@ -268,12 +270,12 @@ bool WIN_InitGameInput(SDL_VideoDevice *_this) static void GAMEINPUT_InitialMouseReading(WIN_GameInputData *data, SDL_Window *window, GAMEINPUT_Device *device, IGameInputReading *reading) { GameInputMouseState state; - if (SUCCEEDED(IGameInputReading_GetMouseState(reading, &state))) { - Uint64 timestamp = SDL_US_TO_NS(IGameInputReading_GetTimestamp(reading) + data->timestamp_offset); + if (reading->GetMouseState(&state)) { + Uint64 timestamp = SDL_US_TO_NS(reading->GetTimestamp() + data->timestamp_offset); SDL_MouseID mouseID = device->instance_id; for (int i = 0; i < MAX_GAMEINPUT_BUTTONS; ++i) { - const GameInputMouseButtons mask = (1 << i); + const GameInputMouseButtons mask = GameInputMouseButtons(1 << i); bool down = ((state.buttons & mask) != 0); SDL_SendMouseButton(timestamp, window, mouseID, GAMEINPUT_button_map[i], down); } @@ -284,9 +286,8 @@ static void GAMEINPUT_HandleMouseDelta(WIN_GameInputData *data, SDL_Window *wind { GameInputMouseState last; GameInputMouseState state; - if (SUCCEEDED(IGameInputReading_GetMouseState(last_reading, &last)) && - SUCCEEDED(IGameInputReading_GetMouseState(reading, &state))) { - Uint64 timestamp = SDL_US_TO_NS(IGameInputReading_GetTimestamp(reading) + data->timestamp_offset); + if (last_reading->GetMouseState(&last) && reading->GetMouseState(&state)) { + Uint64 timestamp = SDL_US_TO_NS(reading->GetTimestamp() + data->timestamp_offset); SDL_MouseID mouseID = device->instance_id; GameInputMouseState delta; @@ -301,7 +302,7 @@ static void GAMEINPUT_HandleMouseDelta(WIN_GameInputData *data, SDL_Window *wind } if (delta.buttons) { for (int i = 0; i < MAX_GAMEINPUT_BUTTONS; ++i) { - const GameInputMouseButtons mask = (1 << i); + const GameInputMouseButtons mask = GameInputMouseButtons(1 << i); if (delta.buttons & mask) { bool down = ((state.buttons & mask) != 0); SDL_SendMouseButton(timestamp, window, mouseID, GAMEINPUT_button_map[i], down); @@ -337,7 +338,7 @@ static bool KeysHaveScancode(const GameInputKeyState *keys, uint32_t count, SDL_ static void GAMEINPUT_InitialKeyboardReading(WIN_GameInputData *data, SDL_Window *window, GAMEINPUT_Device *device, IGameInputReading *reading) { - Uint64 timestamp = SDL_US_TO_NS(IGameInputReading_GetTimestamp(reading) + data->timestamp_offset); + Uint64 timestamp = SDL_US_TO_NS(reading->GetTimestamp() + data->timestamp_offset); SDL_KeyboardID keyboardID = device->instance_id; uint32_t max_keys = device->info->keyboardInfo->maxSimultaneousKeys; @@ -346,7 +347,7 @@ static void GAMEINPUT_InitialKeyboardReading(WIN_GameInputData *data, SDL_Window return; } - uint32_t num_keys = IGameInputReading_GetKeyState(reading, max_keys, keys); + uint32_t num_keys = reading->GetKeyState(max_keys, keys); if (!num_keys) { // FIXME: We probably need to track key state by keyboardID SDL_ResetKeyboard(); @@ -382,7 +383,7 @@ static void DumpKeys(const char *prefix, GameInputKeyState *keys, uint32_t count static void GAMEINPUT_HandleKeyboardDelta(WIN_GameInputData *data, SDL_Window *window, GAMEINPUT_Device *device, IGameInputReading *last_reading, IGameInputReading *reading) { - Uint64 timestamp = SDL_US_TO_NS(IGameInputReading_GetTimestamp(reading) + data->timestamp_offset); + Uint64 timestamp = SDL_US_TO_NS(reading->GetTimestamp() + data->timestamp_offset); SDL_KeyboardID keyboardID = device->instance_id; uint32_t max_keys = device->info->keyboardInfo->maxSimultaneousKeys; @@ -394,8 +395,8 @@ static void GAMEINPUT_HandleKeyboardDelta(WIN_GameInputData *data, SDL_Window *w uint32_t index_last = 0; uint32_t index_keys = 0; - uint32_t num_last = IGameInputReading_GetKeyState(last_reading, max_keys, last); - uint32_t num_keys = IGameInputReading_GetKeyState(reading, max_keys, keys); + uint32_t num_last = last_reading->GetKeyState(max_keys, last); + uint32_t num_keys = reading->GetKeyState(max_keys, keys); #ifdef DEBUG_KEYS SDL_Log("Timestamp: %llu", timestamp); DumpKeys("Last keys:", last, num_last); @@ -463,20 +464,20 @@ void WIN_UpdateGameInput(SDL_VideoDevice *_this) if (data->enabled_input & GameInputKindMouse) { if (device->last_mouse_reading) { HRESULT hr; - while (SUCCEEDED(hr = IGameInput_GetNextReading(data->pGameInput, device->last_mouse_reading, GameInputKindMouse, device->pDevice, &reading))) { + while (SUCCEEDED(hr = data->pGameInput->GetNextReading(device->last_mouse_reading, GameInputKindMouse, device->pDevice, &reading))) { GAMEINPUT_HandleMouseDelta(data, window, device, device->last_mouse_reading, reading); - IGameInputReading_Release(device->last_mouse_reading); + device->last_mouse_reading->Release(); device->last_mouse_reading = reading; } if (hr != GAMEINPUT_E_READING_NOT_FOUND) { - if (SUCCEEDED(IGameInput_GetCurrentReading(data->pGameInput, GameInputKindMouse, device->pDevice, &reading))) { + if (SUCCEEDED(data->pGameInput->GetCurrentReading(GameInputKindMouse, device->pDevice, &reading))) { GAMEINPUT_HandleMouseDelta(data, window, device, device->last_mouse_reading, reading); - IGameInputReading_Release(device->last_mouse_reading); + device->last_mouse_reading->Release(); device->last_mouse_reading = reading; } } } else { - if (SUCCEEDED(IGameInput_GetCurrentReading(data->pGameInput, GameInputKindMouse, device->pDevice, &reading))) { + if (SUCCEEDED(data->pGameInput->GetCurrentReading(GameInputKindMouse, device->pDevice, &reading))) { GAMEINPUT_InitialMouseReading(data, window, device, reading); device->last_mouse_reading = reading; } @@ -487,26 +488,26 @@ void WIN_UpdateGameInput(SDL_VideoDevice *_this) if (window->text_input_active) { // Reset raw input while text input is active if (device->last_keyboard_reading) { - IGameInputReading_Release(device->last_keyboard_reading); + device->last_keyboard_reading->Release(); device->last_keyboard_reading = NULL; } } else { if (device->last_keyboard_reading) { HRESULT hr; - while (SUCCEEDED(hr = IGameInput_GetNextReading(data->pGameInput, device->last_keyboard_reading, GameInputKindKeyboard, device->pDevice, &reading))) { + while (SUCCEEDED(hr = data->pGameInput->GetNextReading(device->last_keyboard_reading, GameInputKindKeyboard, device->pDevice, &reading))) { GAMEINPUT_HandleKeyboardDelta(data, window, device, device->last_keyboard_reading, reading); - IGameInputReading_Release(device->last_keyboard_reading); + device->last_keyboard_reading->Release(); device->last_keyboard_reading = reading; } if (hr != GAMEINPUT_E_READING_NOT_FOUND) { - if (SUCCEEDED(IGameInput_GetCurrentReading(data->pGameInput, GameInputKindKeyboard, device->pDevice, &reading))) { + if (SUCCEEDED(data->pGameInput->GetCurrentReading(GameInputKindKeyboard, device->pDevice, &reading))) { GAMEINPUT_HandleKeyboardDelta(data, window, device, device->last_keyboard_reading, reading); - IGameInputReading_Release(device->last_keyboard_reading); + device->last_keyboard_reading->Release(); device->last_keyboard_reading = reading; } } } else { - if (SUCCEEDED(IGameInput_GetCurrentReading(data->pGameInput, GameInputKindKeyboard, device->pDevice, &reading))) { + if (SUCCEEDED(data->pGameInput->GetCurrentReading(GameInputKindKeyboard, device->pDevice, &reading))) { GAMEINPUT_InitialKeyboardReading(data, window, device, reading); device->last_keyboard_reading = reading; } @@ -534,12 +535,12 @@ bool WIN_UpdateGameInputEnabled(SDL_VideoDevice *_this) GAMEINPUT_Device *device = data->devices[i]; if (device->last_mouse_reading && !raw_mouse_enabled) { - IGameInputReading_Release(device->last_mouse_reading); + device->last_mouse_reading->Release(); device->last_mouse_reading = NULL; } if (device->last_keyboard_reading && !raw_keyboard_enabled) { - IGameInputReading_Release(device->last_keyboard_reading); + device->last_keyboard_reading->Release(); device->last_keyboard_reading = NULL; } } @@ -559,9 +560,13 @@ void WIN_QuitGameInput(SDL_VideoDevice *_this) if (data->pGameInput) { // free the callback - if (data->gameinput_callback_token != GAMEINPUT_INVALID_CALLBACK_TOKEN_VALUE) { - IGameInput_UnregisterCallback(data->pGameInput, data->gameinput_callback_token, /*timeoutInUs:*/ 10000); - data->gameinput_callback_token = GAMEINPUT_INVALID_CALLBACK_TOKEN_VALUE; + if (data->gameinput_callback_token) { +#if GAMEINPUT_API_VERSION >= 1 + data->pGameInput->UnregisterCallback(data->gameinput_callback_token); +#else + data->pGameInput->UnregisterCallback(data->gameinput_callback_token, 10000); +#endif + data->gameinput_callback_token = 0; } // free the list @@ -569,7 +574,7 @@ void WIN_QuitGameInput(SDL_VideoDevice *_this) GAMEINPUT_InternalRemoveByIndex(data, 0); } - IGameInput_Release(data->pGameInput); + data->pGameInput->Release(); data->pGameInput = NULL; } diff --git a/src/video/windows/SDL_windowsgameinput.h b/src/video/windows/SDL_windowsgameinput.h index 561de9c4e0c89..e6f1afa2d62ff 100644 --- a/src/video/windows/SDL_windowsgameinput.h +++ b/src/video/windows/SDL_windowsgameinput.h @@ -22,8 +22,17 @@ typedef struct WIN_GameInputData WIN_GameInputData; +// Set up for C function definitions, even when using C++ +#ifdef __cplusplus +extern "C" { +#endif + extern bool WIN_InitGameInput(SDL_VideoDevice *_this); extern bool WIN_UpdateGameInputEnabled(SDL_VideoDevice *_this); extern void WIN_UpdateGameInput(SDL_VideoDevice *_this); extern void WIN_QuitGameInput(SDL_VideoDevice *_this); +// Ends C function definitions when using C++ +#ifdef __cplusplus +} +#endif diff --git a/src/video/windows/SDL_windowsvideo.h b/src/video/windows/SDL_windowsvideo.h index 8a0edf5ae0243..0e9c50eb86932 100644 --- a/src/video/windows/SDL_windowsvideo.h +++ b/src/video/windows/SDL_windowsvideo.h @@ -28,8 +28,10 @@ #include "../SDL_sysvideo.h" #ifdef HAVE_DXGI_H +#ifndef __cplusplus #define CINTERFACE #define COBJMACROS +#endif #include <dxgi.h> #endif
diff --git a/.github/workflows/create-test-plan.py b/.github/workflows/create-test-plan.py index a137889c81a7d..8048e2bc3229f 100755 --- a/.github/workflows/create-test-plan.py +++ b/.github/workflows/create-test-plan.py @@ -381,9 +381,11 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta match spec.msvc_arch: case MsvcArch.X86: job.cflags.append("/clang:-m32") + job.cxxflags.append("/clang:-m32") job.ldflags.append("/MACHINE:X86") case MsvcArch.X64: job.cflags.append("/clang:-m64") + job.cxxflags.append("/clang:-m64") job.ldflags.append("/MACHINE:X64") case _: raise ValueError(f"Unsupported clang-cl architecture (arch={spec.msvc_arch})")
GameInput v1 header changes On Windows, the `gameinput.h` file (taken from [NuGet](https://www.nuget.org/packages/Microsoft.GameInput)) is C++ instead of C. Since the source files that include it are C, the compiler tries to interpret the header file as C and errors. Also, there are other differences that make it incompatible with the v0 API on console
[ "https://github.com/libsdl-org/SDL/commit/53a4365c12dfbc6189e0e684d17f726300ae2621" ]
2025-04-11T19:03:32Z
https://github.com/libsdl-org/SDL/tree/f35a2736b708408bd5e6273255c03513cf60605a
[ "cmd /c '\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat\" -arch=x64 && cmake --build build --parallel && cmake --install build --prefix prefix'" ]
[ "$env:SDL_TESTS_QUICK=\"1\"; ctest --test-dir build --output-on-failure -VV 2>&1 | Tee-Object -FilePath build\\test-output.log" ]
[ "type build\\test-output.log" ]
def parser(log: str) -> dict[str, str]: import re # Strip common ANSI escape sequences to avoid breaking regexes def strip_ansi(s: str) -> str: # CSI sequences, OSC sequences, simple ESC codes s = re.sub(r"\x1B\[[0-9;?]*[ -/]*[@-~]", "", s) s = re.sub(r"\x1B\][^\x07]*(\x07|\x1B\\)", "", s) # OSC ... BEL or ST s = re.sub(r"\x1B[@-Z\\-_]", "", s) # 2-char sequences return s log = strip_ansi(log).replace("\r", "") # precedence for merging statuses rank = {"pass": 1, "skip": 2, "fail": 3} def set_status(d: dict, name: str, status: str): if not name: return status = status.lower() if status not in rank: return prev = d.get(name) if prev is None or rank[status] > rank[prev]: d[name] = status def norm_status(s: str) -> str: s = s.strip().lower() # Normalize a variety of framework outputs if s in ("passed", "ok", "success", "succeeded", "pass"): return "pass" if s in ("skipped", "skip", "ignored", "xfail", "not run", "not-run"): return "skip" # Everything else counts as fail: failed, error, timeout, xpass (unexpected pass), etc. return "fail" results: dict[str, str] = {} # ------------------------- # 1) CTest per-test result lines (with fraction prefix) # Examples: # 1/10 Test #1: testname .................... Passed 0.01 sec # 2/10 Test #2: long name ................... ***Failed 0.02 sec # ... Timeout ctest_frac_re = re.compile( r"^\s*\d+/\d+\s+Test\s+#\d+:\s+([^\n]+?)\s+(?:\.*\s*)?(?:\*{0,3}\s*)?\b(Passed|Failed|Not Run|Skipped|Timeout)\b", re.IGNORECASE | re.MULTILINE, ) for m in ctest_frac_re.finditer(log): name = m.group(1).strip() status = norm_status(m.group(2)) set_status(results, name, status) # 2) CTest per-test result lines (without fraction prefix) ctest_simple_re = re.compile( r"^\s*Test\s+#\d+:\s+([^\n]+?)\s+(?:\.*\s*)?(?:\*{0,3}\s*)?\b(Passed|Failed|Not Run|Skipped|Timeout)\b", re.IGNORECASE | re.MULTILINE, ) for m in ctest_simple_re.finditer(log): name = m.group(1).strip() status = norm_status(m.group(2)) set_status(results, name, status) # 3) CTest: "The following tests FAILED:" block # Accept various failure reasons in parentheses. # N - name (Failed|Timeout|SEGFAULT|ChildKilled|OTHER_FAULT|Not Run|...) failed_block_re = re.compile( r"^\s*\d+\s*-\s*(.+?)\s*\(([^)]+)\)", re.IGNORECASE | re.MULTILINE, ) if re.search(r"The following tests\s+FAILED", log, re.IGNORECASE): for m in failed_block_re.finditer(log): name = m.group(1).strip() reason = m.group(2).strip().lower() status = "skip" if "not run" in reason else "fail" set_status(results, name, status) # 4) CTest: "The following tests did not run:" block (skips) did_not_run_header = re.search(r"The following tests\s+did\s+not\s+run\s*:", log, re.IGNORECASE) if did_not_run_header: # Collect subsequent lines of form " N - name" start = did_not_run_header.end() tail = log[start:].splitlines() for line in tail: if not line.strip(): break m = re.match(r"^\s*\d+\s*-\s*(.+?)\s*$", line) if m: name = m.group(1).strip() set_status(results, name, "skip") else: # Stop if pattern breaks (end of block) if re.match(r"^\S", line): break # 5) Inner unit tests from an automation harness inner_test_re = re.compile( r">>>\s*Test\s+'((?:[^']|\n)+?)'\s*:\s*(Passed|Failed|Skipped|Timeout|Error)", re.IGNORECASE, ) for m in inner_test_re.finditer(log): name = re.sub(r"\s+", " ", m.group(1)).strip() status = norm_status(m.group(2)) set_status(results, name, status) # 6) Pytest item lines: "file.py::test_name STATUS" pytest_item_re = re.compile( r"^\s*([^\s][^\n]*?::[^\s]+)\s+(PASSED|FAILED|ERROR|SKIPPED|XFAIL|XPASS)", re.IGNORECASE | re.MULTILINE, ) for m in pytest_item_re.finditer(log): name = m.group(1).strip() status_word = m.group(2).upper() if status_word == "XPASS": status = "fail" else: status = norm_status(status_word) set_status(results, name, status) # Pytest summary-style failures: "FAILED file::test - ..." or "ERROR file::test - ..." pytest_sum_fail_re = re.compile(r"^\s*(FAILED|ERROR)\s+([^\s].*?::[^\s]+)\b", re.MULTILINE) for m in pytest_sum_fail_re.finditer(log): name = m.group(2).strip() set_status(results, name, "fail") # 7) unittest patterns: # a) "test_method (package.ClassName) ... ok/FAIL/ERROR/skipped" unittest_paren_re = re.compile( r"^\s*(\S+)\s*\(([^)]+)\)\s+\.\.\.\s+(ok|FAIL|ERROR|skipped|SKIPPED)", re.IGNORECASE | re.MULTILINE, ) for m in unittest_paren_re.finditer(log): method = m.group(1).strip() cls = m.group(2).strip() name = f"{cls}.{method}" status = norm_status(m.group(3)) set_status(results, name, status) # b) "ClassName.test_method ... ok/FAIL/ERROR/skipped" unittest_dots_re = re.compile( r"^\s*([A-Za-z_]\w+(?:\.[A-Za-z_]\w+)+)\s+\.\.\.\s+(ok|FAIL|ERROR|skipped|SKIPPED)", re.IGNORECASE | re.MULTILINE, ) for m in unittest_dots_re.finditer(log): name = m.group(1).strip() status = norm_status(m.group(2)) set_status(results, name, status) # 8) Go test: "--- PASS: TestName", etc. go_test_re = re.compile(r"^\s*---\s+(PASS|FAIL|SKIP):\s+([^\s(]+)", re.MULTILINE) for m in go_test_re.finditer(log): status = norm_status(m.group(1)) name = m.group(2).strip() set_status(results, name, status) # 9) GoogleTest: "[ OK ] Suite.Test" / "[ FAILED ] Suite.Test" / "[ SKIPPED ] Suite.Test" gtest_re = re.compile( r"^\s*\[\s*(OK|PASSED|FAILED|SKIPPED)\s*\]\s+([^\n]+)", re.IGNORECASE | re.MULTILINE, ) for m in gtest_re.finditer(log): status = norm_status(m.group(1)) # strip trailing time "(xx ms)" if present name = re.sub(r"\s+\([^)]*\)\s*$", "", m.group(2)).strip() set_status(results, name, status) # 10) TAP: "ok 1 - name", "not ok 2 - name", with optional "# SKIP" tap_re = re.compile( r"^\s*(ok|not ok)\s+\d+\s*(?:-\s*)?(.+?)(?:\s+#\s*(SKIP|TODO).*)?$", re.IGNORECASE | re.MULTILINE, ) for m in tap_re.finditer(log): oknot = m.group(1).lower() name = m.group(2).strip() directive = (m.group(3) or "").lower() if oknot == "ok": status = "skip" if directive in ("skip", "todo") else "pass" else: status = "fail" set_status(results, name, status) # 11) Jest symbol-style per-test assertions: "✓ name", "✕ name", "○ name" # Avoid matching file-level "PASS path/file" lines. jest_sym_re = re.compile(r"^\s*([✓✔✕×○])\s+(.+)$", re.MULTILINE) for m in jest_sym_re.finditer(log): sym = m.group(1) name = m.group(2).strip() if sym in ("✓", "✔"): status = "pass" elif sym in ("✕", "×"): status = "fail" else: status = "skip" set_status(results, name, status) # 12) Rust cargo test: "test path::name ... ok/FAILED/ignored" rust_re = re.compile(r"^\s*test\s+([^\s]+)\s+\.\.\.\s+(ok|FAILED|ignored)", re.IGNORECASE | re.MULTILINE) for m in rust_re.finditer(log): name = m.group(1).strip() status = norm_status(m.group(2)) set_status(results, name, status) # 13) Repro filter hints; treat as failed tests if shown # Broaden to allow dots, dashes, colons, and underscores. repro_filter_re = re.compile(r"--filter\s+([^\s]+)") for m in repro_filter_re.finditer(log): name = m.group(1).strip() set_status(results, name, "fail") return results
[ "testplatform-no-simd" ]
[ "video_getFullscreenDisplayModes", "round_roundNumberCases", "audio_enumerateAndNameAudioDevicesNegativeTest ts", "stdlib_strnlen", "testqsort", "hints_getHint", "pixels_saveLoadBMP", "log10_baseCases", "exp_infCases", "pow_baseNZeroExpOddCases", "asin_outOfDomainCases", "audio_buildAudioStream", "pixels_getPixelFormatDetails", "rect_testEnclosePointsRepeatedInput", "time_dateTimeConversion", "platform_testEndianessAndSwap", "cos_nanCase", "mouse_getMouseState", "process_testInheritedEnv", "iostrm_testMem", "rect_testIntersectRectParam", "audio_buildAudioStreamNegative", "surface_testBlitZeroSource", "stdlib_sscanf", "TestVirtualJoystick", "sdltest_randomIntegerInRange", "stdlib_strtod", "atan2_nanCases", "testprocess", "floor_roundNumberCases", "video_getWindowDisplayModeNegative", "scalbn_regularCases", "keyboard_getScancodeFromName", "surface_testBlit9Grid", "cos_precisionTest", "rect_testEnclosePointsWithClipping", "audio_lockUnlockOpenAudioDevice", "subsystems_dependRefCountWithExtraInit", "testbounds", "rect_testFRectEquals", "process_testNewEnv", "atan2_xInfCases", "copysign_rangeTest", "mouse_getGlobalMouseState", "rect_testEnclosePoints", "keyboard_getKeyNameNegative", "mouse_createFreeCursor", "rect_testHasIntersectionEmpty", "video_getSetWindowData", "sdltest_getFuzzerInvocationCount", "keyboard_getKeyboardState", "keyboard_getScancodeFromNameNegative", "events_addDelEventWatchWithUserdata", "rect_testUnionRectInside", "surface_testInvalidFormat", "fmod_regularCases", "rect_testIntersectRectAndLineOutside", "surface_testLoadFailure", "testpower", "timer_addRemoveTimer", "render_testUVWrapping", "process_testArguments", "surface_testPalette", "render_testTextureState", "testplatform", "surface_testCompleteSurfaceConversion", "copysign_infCases", "trunc_nanCase", "fmod_divByZeroCases", "render_testBlitTiled", "ceil_rangeTest", "rect_testHasIntersectionInside", "audio_printAudioDrivers", "exp_baseCase", "sin_nanCase", "sdltest_randomBoundaryNumberSint8", "pow_regularCases", "surface_testFlip", "process_testWriteToFinishedProcess", "sqrt_regularCases", "fabs_infCases", "iostrm_testAllocFree", "video_getSetWindowMinimumSize", "log_testHint", "sqrt_baseCases", "pow_basePInfCases", "testsem", "scalbn_nanCase", "properties_testBasic", "mouse_setCursor", "scalbn_infCases", "video_getWindowDisplayMode", "exp_zeroCases", "fmod_divByInfCases", "trunc_roundNumberCases", "sin_precisionTest", "subsystems_dependRefCountInitByOneQuitAll", "video_createWindowVariousFlags", "render_testPrimitivesWithViewport", "time_dateTimeUtilities", "log_baseCases", "pow_rangeTest", "render_testPrimitives", "audio_openCloseAndGetAudioStatus", "sdltest_randomBoundaryNumberSint32", "rect_testFRectEqualsParam", "process_testSimpleStdinToStdout", "atan_zeroCases", "copysign_zeroCases", "sdltest_randomBoundaryNumberUint8", "render_testRGBSurfaceNoAlpha", "process_testKill", "rect_testIntersectRectAndLine", "fabs_zeroCases", "rect_testHasIntersectionOutside", "keyboard_getKeyName", "audio_enumerateAndNameAudioDevices", "stdlib_snprintf", "testtimer", "floor_nanCase", "surface_testBlitTiled", "tan_nanCase", "log10_regularCases", "floor_fractionCases", "audio_resampleLoss", "sdltest_randomNumber", "round_fractionCases", "fmod_nanCases", "platform_testGetVersion", "sdltest_randomAsciiString", "testatomic", "tan_zeroCases", "rect_testHasIntersectionParam", "cos_infCases", "timer_getPerformanceCounter", "keyboard_setTextInputArea", "pow_basePZeroCases", "pow_baseZeroExpNInfCases", "audio_getAudioStatus", "tan_precisionTest", "video_createWindowVariousSizes", "rect_testRectEmptyParam", "blit_testExampleApplicationRender", "scalbn_baseZeroCases", "platform_testSetErrorEmptyInput", "rect_testHasIntersectionPoint", "acos_nanCase", "process_testFileRedirection", "iostrm_testParamNegative", "cos_regularCases", "stdlib_strlcpy", "modf_baseCases", "surface_testClearSurface", "timer_getPerformanceFrequency", "exp_overflowCase", "surface_testSurfaceConversion", "rect_testHasIntersectionPartial", "TestGUIDToString", "scalbn_expZeroCase", "pow_baseNanExp0Cases", "atan2_topLeftQuadrantTest", "torturethread", "events_addDelEventWatch", "render_testClipRect", "fabs_nanCase", "pixels_allocFreePalette", "rect_testIntersectRectOutside", "mouse_getMouseFocus", "iostrm_testFileWrite", "time_getRealtimeClock", "stdlib_swprintf", "rect_testIntersectRectPartial", "clipboard_testPrimarySelectionTextFunctions", "hints_setHint", "ceil_roundNumberCases", "sqrt_nanCase", "rect_testEnclosePointsParam", "atan2_bothInfCases", "stdlib_strtox", "iostrm_testDynamicMem", "round_zeroCases", "audio_initQuitAudio", "rect_testIntersectRectAndLineParam", "asin_nanCase", "process_testMultiprocessStdinToStdout", "surface_testBlitBlendMod", "sqrt_infCase", "clipboard_testClipboardTextFunctions", "rect_testGetRectIntersectionFloat", "pow_nanArgsCases", "atan2_xZeroCases", "process_testStdinToStdout", "iostrm_testConstMem", "fmod_divOfZeroCases", "pow_base1ExpNanCase", "iostrm_testFileRead", "render_testGetSetTextureScaleMode", "platform_testSetErrorInvalidInput", "video_createMaximized", "audio_getAudioFormatName", "main_testImpliedJoystickInit", "cos_rangeTest", "platform_testTypes", "keyboard_getKeyFromScancode", "pow_baseNInfCases", "testfile", "render_testBlit", "surface_testBlitMultiple", "keyboard_startStopTextInput", "clipboard_testClipboardDataFunctions", "pow_basePZeroExpOddCases", "surface_testBlit", "rect_testIntersectRectAndLineEmpty", "properties_testCopy", "asin_limitCases", "fmod_divOfInfCases", "sdltest_generateRunSeed", "sqrt_outOfDomainCases", "blit_testRandomToRandomSVGA", "trunc_fractionCases", "surface_testBlitBlendAddPremultiplied", "stdlib_aligned_alloc", "sdltest_randomBoundaryNumberUint16", "audio_printCurrentAudioDriver", "ceil_infCases", "surface_testBlitBlendAdd", "audio_enumerateAndNameAudioDevicesNegativeTests", "atan2_bottomRightQuadrantTest", "process_testNonExistingExecutable", "mouse_warpMouseInWindow", "tan_infCases", "rect_testIntersectRectInside", "render_testGetNumRenderDrivers", "platform_testGetFunctions", "ceil_zeroCases", "testver", "testthread", "platform_testHasFunctions", "acos_precisionTest", "video_getClosestDisplayModeCurrentResolution", "render_testLogicalSize", "video_createMinimized", "mouse_getCursor", "render_testBlit9Grid", "atan2_yZeroCases", "round_nanCase", "atan_limitCases", "testkeys", "audio_quitInitAudioSubSystem", "fmod_rangeTest", "platform_testDefaultInit", "video_getWindowFlags", "testerror", "stdlib_strpbrk", "mouse_getSetRelativeMouseMode", "audio_pauseUnpauseAudio", "render_testViewport", "atan_precisionTest", "main_testImpliedJoystickQuit", "video_getWindowPixelFormat", "timer_delayAndGetTicks", "events_mainThreadCallbacks", "audio_enumerateAndNameAudioDevicesNegativeTests s", "surface_testOverflow", "atan_nanCase", "stdlib_iconv", "floor_infCases", "testdisplayinfo", "pow_powerOfTwo", "subsystems_dependRefCountInitAllQuitByOne", "subsystems_referenceCount", "surface_testBlitBlendMul", "rect_testIntersectRectFloat", "pow_baseNOneExpInfCases", "keyboard_setTextInputAreaNegative", "testlocale", "surface_testBlitAlphaMod", "rect_testHasIntersectionFloat", "keyboard_getScancodeNameNegative", "stdlib_overflow", "video_getWindowSurface", "keyboard_getSetModState", "properties_testLocking", "audio_convertAccuracy", "sdltest_randomBoundaryNumberSint64", "render_testBlitColor", "rect_testRectEmptyFloat", "sin_infCases", "rect_testGetRectUntionFloat", "mouse_getRelativeMouseState", "video_getSetWindowGrab", "video_getSetWindowSize", "pow_expInfCases", "surface_testBlitBlendPremultiplied", "atan2_bothZeroCases", "video_getClosestDisplayModeRandomResolution", "keyboard_getKeyboardFocus", "pixels_getPixelFormatName", "rect_testIntersectRectAndLineInside", "acos_limitCases", "rect_testRectEqualsParam", "video_enableDisableScreensaver", "sdltest_randomBoundaryNumberSint16", "video_getSetWindowPosition", "rect_testIntersectRectAndLineFloat", "rect_testIntersectRectPoint", "rect_testRectEmpty", "sin_rangeTest", "testyuv", "process_testStdinToStderr", "mouse_getDefaultCursor", "process_testExitCode", "log_regularCases", "rect_testEnclosePointsFloat", "testevdev", "surface_testScale", "mouse_createFreeColorCursor", "log_limitCases", "platform_testGetPowerInfo", "audio_convertAudio", "surface_testPalettization", "acos_outOfDomainCases", "surface_testPremultiplyAlpha", "audio_initOpenCloseQuitAudio", "asin_precisionTest", "render_testBlendModes", "intrinsics_selftest", "rect_testUnionRectParam", "rect_testUnionRectOutside", "video_getWindowId", "platform_testGetSetClearError", "sin_regularCases", "atan2_topRightQuadrantTest", "rect_testGetRectEnclosingPointsFloat", "atan2_yInfCases", "trunc_zeroCases", "trunc_rangeTest", "process_testBatBadButVulnerability", "video_getSetWindowMaximumSize", "copysign_nanCases", "log10_nanCases", "log10_limitCases", "ceil_fractionCases", "properties_testCleanup", "testaudioinfo", "atan2_bottomLeftQuadrantTest", "stdlib_getsetenv", "render_testBlit9GridTiled", "sdltest_randomBoundaryNumberUint32", "surface_testBlitColorMod", "floor_zeroCases", "surface_testBlitBlendBlend", "round_rangeTest", "log_nanCases", "pow_badOperationCase", "rect_testUnionRectEmpty", "events_pushPumpAndPollUserevent", "pow_baseNZeroCases", "rect_testRectEquals", "audio_formatChange", "video_setWindowCenteredOnDisplay", "trunc_infCases", "round_infCases", "ceil_nanCase", "surface_testSaveLoadBitmap", "TestStringToGUID", "iostrm_testCompareRWFromMemWithRWFromFile", "keyboard_getKeyFromName", "main_testSetError", "stdlib_strstr", "rect_testIntersectRectEmpty", "sdltest_randomAsciiStringOfSize", "testfilesystem", "floor_rangeTest", "stdlib_wcstol", "exp_regularCases", "iostrm_testFileWriteReadEndian", "mouse_showCursor", "rect_testGetRectAndLineIntersectionFloat", "sdltest_randomBoundaryNumberUint64", "fabs_rangeTest" ]
starryzhang/sweb.eval.win.libsdl-org_1776_sdl-12806
microsoft/ebpf-for-windows
4117
microsoft__ebpf-for-windows-4117
[ "3602", "4129" ]
30fdb1f81aa7d4eaceb26a72d72920aeac79bebb
"diff --git a/netebpfext/net_ebpf_ext.c b/netebpfext/net_ebpf_ext.c\nindex 451fb361b4..05e70e467e 10(...TRUNCATED)
"diff --git a/scripts/execute_ebpf_cicd_tests.ps1 b/scripts/execute_ebpf_cicd_tests.ps1\nindex 39607(...TRUNCATED)
"Workflow failed - km_mt_stress_tests_restart_extension\n[Failed Run](https://github.com/microsoft/e(...TRUNCATED)
"[Failed Run](https://github.com/microsoft/ebpf-for-windows/actions/runs/9234035167)\n[Codebase](htt(...TRUNCATED)
"[Failed Run](https://github.com/microsoft/ebpf-for-windows/actions/runs/9234035167)\n[Codebase](htt(...TRUNCATED)
["https://github.com/microsoft/ebpf-for-windows/commit/af0d832e4c1f4f98bcd9da90990bfa6dc31a83ae","ht(...TRUNCATED)
2025-01-06T19:12:32Z
https://github.com/microsoft/ebpf-for-windows/tree/30fdb1f81aa7d4eaceb26a72d72920aeac79bebb
["nuget restore ebpf-for-windows.sln ; msbuild /m /p:Configuration=Debug /p:Platform=x64 /p:Solution(...TRUNCATED)
["Set-Location C:\\testbed\\x64\\Debug; .\\unit_tests.exe --reporter tap --durations yes *> C:\\test(...TRUNCATED)
[ "Get-Content C:\\testbed\\test-results\\catch2-tap.log -Raw" ]
"def parser(log: str) -> dict[str, str]:\n import re\n\n results: dict[str, str] = {}\n\n #(...TRUNCATED)
["map_crud_operations:BPF_MAP_TYPE_LRU_HASH :: ebpf_map_next_key( map.get(), sizeof(key), key == 0 ?(...TRUNCATED)
["map_crud_operations:BPF_MAP_TYPE_PERCPU_HASH :: *reinterpret_cast<uint64_t*>(value.data()) == key (...TRUNCATED)
starryzhang/sweb.eval.win.microsoft_1776_ebpf-for-windows-4117
microsoft/STL
5444
microsoft__STL-5444
[ "5291", "5435" ]
1e0317478eddc973e801bdacc10cee2df9943b82
"diff --git a/stl/CMakeLists.txt b/stl/CMakeLists.txt\nindex ac17fb0a55f..10d21b3173c 100644\n--- a/(...TRUNCATED)
"diff --git a/tests/libcxx/expected_results.txt b/tests/libcxx/expected_results.txt\nindex 64b389eaf(...TRUNCATED)
"LWG-4186 `regex_traits::transform_primary` mistakenly detects `typeid` of a function\nLWG-4186 `reg(...TRUNCATED)
"More generally, `regex_traits::transform_primary()` currently implements the general traits require(...TRUNCATED)
"More generally, `regex_traits::transform_primary()` currently implements the general traits require(...TRUNCATED)
["https://github.com/microsoft/STL/commit/898777a69c30cbc8d564b92262db306f51c2dd8f","https://github.(...TRUNCATED)
2025-04-26T18:40:04Z
https://github.com/microsoft/STL/tree/1e0317478eddc973e801bdacc10cee2df9943b82
["git config --global --add safe.directory C:/testbed ; git submodule update --init --progress ; cmd(...TRUNCATED)
["cmd /c '\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDe(...TRUNCATED)
["cmd /c '\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDe(...TRUNCATED)
"def parser(log: str) -> dict[str, str]:\n import re\n\n results: dict[str, str] = {}\n\n d(...TRUNCATED)
["libc++::std/containers/associative/map/map.ops/find.pass.cpp:2","libc++::std/containers/associativ(...TRUNCATED)
["libc++::std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_notify_all.pass.(...TRUNCATED)
starryzhang/sweb.eval.win.microsoft_1776_stl-5444

Developing projects compatible on Windows platform is important to expand the user market.

There are some bugs that would only occur on Windows. To migrate projects to Windows some codes need to be rewritten to have branching points across different os or use cross-platform compatible libraries...

To test LLM's knowledge of both SWE and Windows-specific knowledge, we propose SWE-bench-Live-Windows, a dataset of Windows specific SWE tasks.

The instances are also set up to docker images using our RepoLaunch agent...

Downloads last month
23