diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json deleted file mode 100644 index b68a4af620..0000000000 --- a/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,191 +0,0 @@ -{ - "configurations": [ - { - "name": "Mac", - "includePath": [ - "/usr/include", - "/usr/local/include", - "${workspaceRoot}", - "${workspaceRoot}/libretro-common/include" - ], - "defines": [], - "intelliSenseMode": "clang-x64", - "browse": { - "path": [ - "/usr/include", - "/usr/local/include", - "${workspaceRoot}" - ], - "limitSymbolsToIncludedHeaders": true, - "databaseFilename": "" - }, - "macFrameworkPath": [ - "/System/Library/Frameworks", - "/Library/Frameworks" - ] - }, - { - "name": "Linux", - "includePath": [ - "/usr/include", - "/usr/local/include", - "${workspaceRoot}", - "${workspaceFolder}/libretro-common/include", - "${workspaceRoot}/libretro-common/include" - ], - "defines": [], - "intelliSenseMode": "clang-x64", - "browse": { - "path": [ - "/usr/include", - "/usr/local/include", - "${workspaceRoot}" - ], - "limitSymbolsToIncludedHeaders": true, - "databaseFilename": "" - } - }, - { - "name": "Win32", - "includePath": [ - "C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/um", - "C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/ucrt", - "C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/shared", - "C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/winrt", - "${workspaceRoot}", - "${workspaceFolder}/libretro-common/include" - ], - "defines": [ - "_DEBUG", - "UNICODE" - ], - "intelliSenseMode": "msvc-x64", - "browse": { - "path": [ - "C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/um", - "C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/ucrt", - "C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/shared", - "C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/winrt", - "${workspaceRoot}" - ], - "limitSymbolsToIncludedHeaders": true, - "databaseFilename": "" - }, - "cStandard": "c11", - "cppStandard": "c++17", - "configurationProvider": "ms-vscode.makefile-tools" - }, - { - "name": "msys2-mingw32", - "includePath": [ - "C:/msys64/mingw32/include", - "C:/msys64/mingw32/i686-w64-mingw32/include", - "${workspaceRoot}/libretro-common/include", - "${workspaceRoot}/include", - "${workspaceRoot}" - ], - "defines": [ - "_DEBUG", - "UNICODE" - ], - "intelliSenseMode": "msvc-x64", - "browse": { - "path": [ - "C:/msys64/mingw32/include", - "C:/msys64/mingw32/i686-w64-mingw32/include", - "${workspaceRoot}/libretro-common/include", - "${workspaceRoot}/include", - "${workspaceRoot}" - ], - "limitSymbolsToIncludedHeaders": true, - "databaseFilename": "" - } - }, - { - "name": "msys2-mingw64", - "includePath": [ - "C:/msys64/mingw64/include", - "C:/msys64/mingw64/x86_64-w64-mingw32/include", - "${workspaceRoot}/libretro-common/include", - "${workspaceRoot}/include", - "${workspaceRoot}" - ], - "defines": [ - "_DEBUG", - "UNICODE" - ], - "intelliSenseMode": "msvc-x64", - "browse": { - "path": [ - "C:/msys64/mingw64/include", - "C:/msys64/mingw64/x86_64-w64-mingw32/include", - "${workspaceRoot}/libretro-common/include", - "${workspaceRoot}/include", - "${workspaceRoot}" - ], - "limitSymbolsToIncludedHeaders": true, - "databaseFilename": "" - } - }, - { - "name": "Switch", - "includePath": [ - "/opt/devkitpro/devkitA64/aarch64-none-elf/include", - "/opt/devkitpro/devkitA64/lib/gcc/aarch64-none-elf/8.3.0/include", - "/opt/devkitpro/libnx/include", - "/opt/devkitpro/portlibs/switch/include", - "/opt/devkitpro/portlibs/switch/include/freetype2", - "${workspaceFolder}/**" - ], - "defines": [ - "_DEBUG", - "UNICODE", - "_UNICODE", - "__aarch64__", - "__SWITCH__", - "HAVE_LIBNX" - ], - "windowsSdkVersion": "10.0.17763.0", - "compilerPath": "/opt/devkitpro/devkitA64/bin/aarch64-none-elf-gcc", - "cStandard": "c11", - "cppStandard": "c++11", - "intelliSenseMode": "gcc-x64" - }, - { - "name": "WiiU", - "includePath": [ - "/opt/devkitpro/devkitPPC/powerpc-eabi/include", - "/opt/devkitpro/devkitPPC/lib/gcc/powerpc-eabi/6.3.0/include", - "/opt/devkitpro/portlibs/ppc/include", - "${workspaceFolder}/**" - ], - "defines": [ - "WIIU", - "WIIU_HID" - ], - "windowsSdkVersion": "10.0.17763.0", - "compilerPath": "/opt/devkitpro/devkitPPC/bin/powerpc-eabi-gcc", - "cStandard": "c11", - "cppStandard": "c++11", - "intelliSenseMode": "gcc-x64" - }, - { - "name": "ps2sdk-ee", - "includePath": [ - "${env:PS2DEV}/ps2sdk/common/include", - "${env:PS2DEV}/ps2sdk/ee/include", - "${env:PS2DEV}/gsKit/include", - "${workspaceFolder}/**" - ], - "defines": [ - "PS2", - "_EE" - ], - "compilerPath": "${env:PS2DEV}/ee/bin/mips64r5900el-ps2-elf-gcc", - "cStandard": "c11", - "cppStandard": "c++11", - "intelliSenseMode": "gcc-x64" - } - ], - "version": 4 -} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 28f4114a39..0000000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "(gdb) Launch", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceFolder}/retroarch.exe", - "args": ["-v"], - "stopAtEntry": false, - "cwd": "${workspaceFolder}", - "environment": [], - "externalConsole": true, - "MIMode": "gdb", - "miDebuggerPath": "c:\\msys64\\mingw64\\bin\\gdb.exe", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ] - }, - { - "name": "(gdb) Attach", - "type": "cppdbg", - "request": "attach", - "program": "${workspaceFolder}/retroarch.exe", - "processId": "${command:pickProcess}", - "MIMode": "gdb", - "miDebuggerPath": "c:\\msys64\\mingw64\\bin\\gdb.exe", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ] - }, - { - "name": "PSP-GDB Debugger", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceFolder}/retroarchpsp.elf", - "stopAtEntry": false, - "cwd": "${workspaceFolder}", - "environment": [], - "setupCommands": [ - { - "text": "symbol-file ${workspaceFolder}/retroarchpsp.elf", - "description": "read symbols for elf file", - "ignoreFailures": true - }, - { - "description": "Enable all-exceptions", - "text": "-exec \"catch throw\"", - "ignoreFailures": true - } - ], - "showDisplayString": true, - "targetArchitecture": "mips", - "MIMode": "gdb", - "miDebuggerPath": "/usr/local/pspdev/bin/psp-gdb", - "miDebuggerServerAddress": "127.0.0.1:10001", - } - ] -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 4a0e9d8e42..0000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - /*"terminal.integrated.shell.windows": "C:\\msys64\\usr\\bin\\bash.exe", - "terminal.integrated.env.windows": { - "PATH": "/mingw64/lib/ccache/bin:/mingw64/lib/ccache/bin:/mingw64/lib/ccache/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:$PATH", - "MSYSTEM": "MINGW64", - },*/ - "terminal.integrated.cursorBlinking": true, - "editor.tabSize": 3, - "editor.detectIndentation": false, - "editor.renderWhitespace": "all", - "editor.insertSpaces": true, - "editor.formatOnSave": false, - "editor.ruler": [80], - "files.associations": { - "*.h": "c", - "*.in": "c", - "*.rh": "c", - "array": "c", - "iosfwd": "c", - "xlocbuf": "c", - "xmemory0": "c", - "ios": "c", - "list": "c", - "unordered_map": "c", - "unordered_set": "c", - "sstream": "cpp", - "hash_map": "c", - "hash_set": "c", - "initializer_list": "c", - "string_view": "c", - "utility": "c", - "thread": "c", - "xlocale": "c", - "deque": "c", - "vector": "c", - "xhash": "c", - "xiosbase": "c", - "xstring": "c", - "xtree": "c", - "xutility": "c" - }, - "C_Cpp.dimInactiveRegions": false, -} diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index e34d4bc668..0000000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "2.0.0", - "tasks": [ - { - "label": "linux clean build", - "type": "shell", - "group": "build", - "command": "make clean && ./configure && make -j12" - }, - { - "label": "linux clean", - "type": "shell", - "group": "build", - "command": "make clean" - }, - { - "label": "linux build with debug symbols", - "type": "shell", - "group": "build", - "command": "DEBUG=1 make -j12" - }, - { - "label": "linux build", - "type": "shell", - "group": "build", - "command": "make -j12" - }, - { - "label": "linux build and run", - "type": "shell", - "group": "build", - "command": "make -j12 && ./retroarch -v" - }, - { - "label": "linux build and run with debug symbols", - "type": "shell", - "group": "build", - "command": "DEBUG=1 make -j12 && ./retroarch -v" - }, - { - "label": "msys2-mingw64 build", - "type": "shell", - - "group": { - "kind": "build", - "isDefault": true - }, - - "command": "./configure; make -j2", - "options": { - "shell": { - "executable": "C:\\msys64\\usr\\bin\\bash.exe", - "args": [ - "-c" - ] - } - } - }, - { - "label": "msys2-mingw64 build with debug symbols", - "type": "shell", - - "group": "build", - - "command": "./configure; DEBUG=1 make -j2", - "options": { - "shell": { - "executable": "C:\\msys64\\usr\\bin\\bash.exe", - "args": [ - "-c" - ] - } - } - }, - { - "label": "msys2-mingw64 rebuild", - "type": "shell", - - "group": "build", - - "command": "make -j2", - "options": { - "shell": { - "executable": "C:\\msys64\\usr\\bin\\bash.exe", - "args": [ - "-c" - ] - } - } - }, - { - "label": "msys2-mingw64 clean", - "type": "shell", - - "group": "build", - - "command": "make clean", - "options": { - "shell": { - "executable": "C:\\msys64\\usr\\bin\\bash.exe", - "args": [ - "-c" - ] - } - } - }, - { - "label": "msys2-mingw64 run", - "type": "shell", - - "group": { - "kind": "test", - "isDefault": true }, - - "command": "./retroarch -v", - "options": { - "shell": { - "executable": "C:\\msys64\\usr\\bin\\bash.exe", - "args": [ - "-c" - ] - } - } - } - ] -} \ No newline at end of file diff --git a/frontend/drivers/platform_win32.c b/frontend/drivers/platform_win32.c index 1c6ad2969e..108f1af586 100644 --- a/frontend/drivers/platform_win32.c +++ b/frontend/drivers/platform_win32.c @@ -25,6 +25,11 @@ #include #endif +#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600 +#include +#include +#endif + #include #include #include @@ -279,14 +284,23 @@ static size_t frontend_win32_get_os(char *s, size_t len, int *major, int *minor) SYSTEM_INFO si = {{0}}; OSVERSIONINFOEX vi = {0}; vi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); +#if _WIN32_WINNT >= 0x0600 + /* Vista and later*/ + const char win_ver_reg_key[] = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"; + const DWORD reg_read_flags = RRF_RT_REG_SZ; /* Only read strings (REG_SZ) */ + const int ProductName_2nd_digit = 9; /* second digit in the string 'Windows 10' */ + char str_ProductName[64] = {0}; + char str_DisplayVersion[64] = {0}; + char str_LCUVer[64] = {0}; + char str_CurrentBuild[64] = {0}; + DWORD key_type = 0; /* null pointer */ + DWORD data_size = 0; + long reg_read_result; + bool read_success = TRUE; + /* end Vista and later; still within Windows 2000 and later block */ +#endif - GetSystemInfo(&si); - - /* Available from NT 3.5 and Win95 */ - GetVersionEx((OSVERSIONINFO*)&vi); - - server = vi.wProductType != VER_NT_WORKSTATION; - +GetSystemInfo(&si); switch (si.wProcessorArchitecture) { case PROCESSOR_ARCHITECTURE_AMD64: @@ -301,6 +315,72 @@ static size_t frontend_win32_get_os(char *s, size_t len, int *major, int *minor) default: break; } + +#if _WIN32_WINNT >= 0x0600 + /* Vista and later: check for Win11 by looking for a specific Registry value. + * The behavior of GetVersionEx is changed under Win11 and no longer provides + * relevant data. If the specific Registry value is present, read version data + * directly from registry and skip remainder of function. + * Each read is paired for string values; the first gets the size of the + * string (read into data_size); the second passes data_size back as an + * argument and reads the actual string. */ + reg_read_result = RegGetValue(HKEY_LOCAL_MACHINE, win_ver_reg_key, "LCUVer", + reg_read_flags, &key_type, 0, &data_size); + + if (reg_read_result == ERROR_SUCCESS) + { + if (RegGetValue(HKEY_LOCAL_MACHINE, win_ver_reg_key, "LCUVer", + reg_read_flags, &key_type, str_LCUVer, &data_size) != ERROR_SUCCESS) + read_success = FALSE; + + if (RegGetValue(HKEY_LOCAL_MACHINE, win_ver_reg_key, "ProductName", + reg_read_flags, &key_type, 0, &data_size) != ERROR_SUCCESS) + read_success = FALSE; + + if (RegGetValue(HKEY_LOCAL_MACHINE, win_ver_reg_key, "ProductName", + reg_read_flags, &key_type, str_ProductName, &data_size) != ERROR_SUCCESS) + read_success = FALSE; + + if (RegGetValue(HKEY_LOCAL_MACHINE, win_ver_reg_key, "DisplayVersion", + reg_read_flags, &key_type, 0, &data_size) != ERROR_SUCCESS) + read_success = FALSE; + + if (RegGetValue(HKEY_LOCAL_MACHINE, win_ver_reg_key, "DisplayVersion", + reg_read_flags, &key_type, str_DisplayVersion, &data_size) != ERROR_SUCCESS) + read_success = FALSE; + + if (read_success) + { + str_ProductName[ProductName_2nd_digit] = '1'; + /* Even the version in the Registry still says Windows 10 and requires + * string manipulation. */ + + _len = strlcpy(s, str_ProductName, len); + if (!string_is_empty(arch)) + { + _len += strlcat(s, " ", len); + _len += strlcat(s, arch, len); + } + _len = strlcat(s, " ", len); + _len = strlcat(s, str_DisplayVersion, len); + _len = strlcat(s, " (", len); + _len = strlcat(s, str_LCUVer, len); + _len = strlcat(s, ")", len); + + *major = 10; + *minor = 0; + + return _len; + } + } + /* End registry-check-and-read code; still within 2000-and-later block */ +#endif + + /* GetVersionEx call changed in Win2K and later */ + GetVersionEx((OSVERSIONINFO*)&vi); + + server = vi.wProductType != VER_NT_WORKSTATION; + #else OSVERSIONINFO vi = {0}; vi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);