diff --git a/.gitignore b/.gitignore index 2cd9fadcb..e6d9f7f11 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,11 @@ obj-* ./tolua.cpp ./tolua.cpp.rule build -.vscode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/scripts .clangd compile_commands.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 000000000..e69de29bb diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..0e1fe0144 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,28 @@ +{ + "configurations": [ + { + "name": "Stratagus", + "type": "cppvsdbg", + "request": "launch", + "program": "${workspaceFolder}/build/Debug/stratagus.exe", + "args": ["-d", "${env:APPDATA}/Stratagus/data.${input:game}"], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/../${input:game}", + "environment": [{"name": "PATH", "value": "${workspaceFolder}\\..\\dependencies\\bin;${env:PATH}"}], + "externalConsole": true + } + ], + "inputs": [ + { + "type": "pickString", + "id": "game", + "description": "Which game to launch?", + "options": [ + "wargus", + "war1gus", + "stargus", + ], + "default": "wargus" + }, + ] +} diff --git a/.vscode/scripts/download.ps1 b/.vscode/scripts/download.ps1 new file mode 100644 index 000000000..03e29de4e --- /dev/null +++ b/.vscode/scripts/download.ps1 @@ -0,0 +1,16 @@ +if (-not (Test-Path "$args[0]/../dependencies")) { + if (-not (Test-Path "$args[0]/../dependencies.zip")) { + Invoke-WebRequest https://github.com/Wargus/win32-stratagus-dependencies/releases/download/master-builds/dependencies.zip -OutFile "$args[0]/../dependencies.zip" + } + Expand-Archive "$args[0]/../dependencies.zip" + Move-Item "$args[0]/../dependencies/dependencies/"* "$args[0]/../dependencies/" +} +if (-not (Test-Path "$args[0]/../dependencies/bin/ffmpeg.exe")) { + Invoke-WebRequest https://github.com/Wargus/stratagus/releases/download/2015-30-11/ffmpeg.exe -OutFile "$args[0]/../dependencies/bin/ffmpeg.exe" +} +if (-not (Test-Path "$args[0]/../wargus")) { + git clone https://github.com/Wargus/wargus "$args[0]/../wargus" +} +if (-not (Test-Path "$args[0]/../war1gus")) { + git clone https://github.com/Wargus/wargus "$args[0]/../war1gus" +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..268ae4ab9 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,16 @@ +{ + "cmake.configureEnvironment": { + "CMAKE_PREFIX_PATH": "${workspaceFolder}\\..\\dependencies", + }, + "cmake.configureArgs": [ + "-DENABLE_STDIO_REDIRECT=ON", + //"-G", "Visual Studio 16 2019", + //"-T", "v141_xp", + //"-A", "win32", + ], + "cmake.generator": "Visual Studio 16 2019", + "cmake.toolset": "v141_xp", + "cmake.platform": "win32", + "cmake.copyCompileCommands": "${workspaceFolder}", + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000..ffab72cb9 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,16 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Download games and dependencies", + "type": "shell", + "command": "PowerShell.exe -ExecutionPolicy Bypass -File ${workspaceFolder}/.vscode/scripts/download.ps1 '${workspaceFolder}'", + "problemMatcher": [], + "group": "build", + "presentation": { + "reveal": "always", + "panel": "new" + } + } + ] +} diff --git a/src/stratagus/iolib.cpp b/src/stratagus/iolib.cpp index 39f74f67a..7e21b8f99 100644 --- a/src/stratagus/iolib.cpp +++ b/src/stratagus/iolib.cpp @@ -715,8 +715,8 @@ int ReadDataDirectory(const char *dirname, std::vector<FileList> &fl) #else strcat_s(buffer, sizeof(buffer), "*.*"); struct _finddata_t fileinfo; - long hFile = _findfirst(buffer, &fileinfo); - if (hFile != -1L) { + intptr_t hFile = _findfirst(buffer, &fileinfo); + if (hFile != -1) { do { filename = fileinfo.name; #endif