| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,42 @@ | ||
| image: Visual Studio 2015 | ||
|
|
||
| before_build: | ||
| - cmd: | | ||
| git submodule update --init | ||
| md build32 & cd build32 | ||
| cmake -Werror=dev -G "Visual Studio 14 2015" .. | ||
| cd .. | ||
| md build64 & cd build64 | ||
| cmake -Werror=dev -G "Visual Studio 14 2015 Win64" .. | ||
| cd .. | ||
| build_script: | ||
| - cmd: cmake --build build32 --config Release --target everything | ||
| - cmd: cmake --build build64 --config Release --target everything | ||
|
|
||
| test_script: | ||
| - cmd: cmake --build build32 --config Debug --target run_tests | ||
| - cmd: cmake --build build64 --config Debug --target run_tests | ||
| - cmd: cmake --build build32 --config Release --target run_tests | ||
| - cmd: cmake --build build64 --config Release --target run_tests | ||
| - cmd: build32\Release\DDNet-Server shutdown | ||
| - cmd: build64\Release\DDNet-Server shutdown | ||
|
|
||
| after_build: | ||
| - cmd: cmake --build build32 --config Release --target package | ||
| - cmd: cmake --build build64 --config Release --target package | ||
|
|
||
| environment: | ||
| CFLAGS: /WX | ||
| CXXFLAGS: /WX | ||
| LDFLAGS: /WX | ||
|
|
||
| artifacts: | ||
| - path: build*/DDNet-*.zip | ||
| name: DDNet | ||
|
|
||
| branches: | ||
| except: | ||
| - staging.tmp |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| status = [ | ||
| "ci/circleci", | ||
| "continuous-integration/appveyor/branch", | ||
| "continuous-integration/travis-ci/push", | ||
| ] | ||
| timeout_sec = 10800 # macOS on Travis CI has long waiting times |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,58 @@ | ||
| dependencies: | ||
| override: | ||
| - | | ||
| sudo add-apt-repository -y ppa:zoogie/sdl2-snapshots | ||
| sudo apt-get update | ||
| sudo apt-get build-dep teeworlds | ||
| sudo apt-get install cmake libsdl2-dev xz-utils | ||
| - | | ||
| if [ ! -x ~/bam/bam ]; then | ||
| git clone https://github.com/matricks/bam ~/bam/ | ||
| cd ~/bam; ./make_unix.sh | ||
| fi | ||
| cache_directories: | ||
| - "~/bam/" | ||
| - "~/cmake/" | ||
|
|
||
| checkout: | ||
| post: | ||
| - git submodule update --init | ||
|
|
||
| ## Customize test commands | ||
| compile: | ||
| override: | ||
| - ~/bam/bam release | ||
| - | | ||
| mkdir build | ||
| cd build | ||
| env CFLAGS="-Wdeclaration-after-statement -Werror" CXXFLAGS="-Werror" cmake -DDOWNLOAD_GTEST=ON .. | ||
| make everything | ||
| test: | ||
| override: | ||
| - | | ||
| cd build | ||
| make run_tests | ||
| ./DDNet-Server shutdown | ||
| - | | ||
| cd build | ||
| make package | ||
| mv DDNet-*.tar.* ${CIRCLE_ARTIFACTS} | ||
| branches: | ||
| ignore: | ||
| - staging.tmp | ||
|
|
||
| ## | ||
| ##deployment: | ||
| ## master: | ||
| ## branch: master | ||
| ## owner: ddnet | ||
| ## commands: | ||
| ## - | | ||
| ## cd build | ||
| ## make package | ||
| ## mv DDNet-*.tar.* |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| cmake_minimum_required(VERSION 2.8) | ||
|
|
||
| project(googletest-download NONE) | ||
|
|
||
| include(ExternalProject) | ||
| ExternalProject_Add(googletest | ||
| GIT_REPOSITORY https://github.com/google/googletest.git | ||
| GIT_TAG "${DDNET_GTEST_VERSION}" | ||
| SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src" | ||
| BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build" | ||
| CONFIGURE_COMMAND "" | ||
| BUILD_COMMAND "" | ||
| INSTALL_COMMAND "" | ||
| TEST_COMMAND "" | ||
| TLS_VERIFY ON | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| if(NOT CMAKE_CROSSCOMPILING) | ||
| find_package(PkgConfig QUIET) | ||
| pkg_check_modules(PC_GLEW libglew) | ||
| endif() | ||
|
|
||
| set_extra_dirs_lib(GLEW glew) | ||
| find_library(GLEW_LIBRARY | ||
| NAMES GLEW glew32 | ||
| HINTS ${HINTS_GLEW_LIBDIR} ${PC_GLEW_LIBDIR} ${PC_GLEW_LIBRARY_DIRS} | ||
| PATHS ${PATHS_GLEW_LIBDIR} | ||
| ${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH} | ||
| ) | ||
| set_extra_dirs_include(GLEW glew "${GLEW_LIBRARY}") | ||
| find_path(GLEW_INCLUDEDIR GL | ||
| HINTS ${HINTS_GLEW_INCLUDEDIR} ${PC_GLEW_INCLUDEDIR} ${PC_GLEW_INCLUDE_DIRS} | ||
| PATHS ${PATHS_GLEW_INCLUDEDIR} | ||
| ${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH} | ||
| ) | ||
|
|
||
| include(FindPackageHandleStandardArgs) | ||
| find_package_handle_standard_args(GLEW DEFAULT_MSG GLEW_LIBRARY GLEW_INCLUDEDIR) | ||
|
|
||
| mark_as_advanced(GLEW_LIBRARY GLEW_INCLUDEDIR) | ||
|
|
||
| set(GLEW_LIBRARIES ${GLEW_LIBRARY}) | ||
| set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDEDIR}) | ||
|
|
||
| is_bundled(IS_BUNDLED "${GLEW_LIBRARY}") | ||
| if(IS_BUNDLED AND TARGET_OS STREQUAL "windows") | ||
| set(GLEW_COPY_FILES "${EXTRA_GLEW_LIBDIR}/glew32.dll") | ||
| else() | ||
| set(GLEW_COPY_FILES) | ||
| endif() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| set(CMAKE_SYSTEM_NAME Darwin) | ||
|
|
||
| set(CMAKE_C_COMPILER o64-clang) | ||
| set(CMAKE_CXX_COMPILER o64-clang++) | ||
| set(CMAKE_INSTALL_NAME_TOOL x86_64-apple-darwin15-install_name_tool) | ||
|
|
||
| set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| set(CMAKE_SYSTEM_NAME Windows) | ||
|
|
||
| set(CMAKE_C_COMPILER i686-w64-mingw32-gcc) | ||
| set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++) | ||
| set(CMAKE_RC_COMPILER i686-w64-mingw32-windres) | ||
|
|
||
| set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| set(CMAKE_SYSTEM_NAME Windows) | ||
|
|
||
| set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) | ||
| set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) | ||
| set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) | ||
|
|
||
| set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #version 330 | ||
|
|
||
| uniform vec4 vertColor; | ||
|
|
||
| out vec4 FragClr; | ||
|
|
||
| void main() | ||
| { | ||
| FragClr = vertColor; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #version 330 | ||
|
|
||
| layout (location = 0) in vec2 inVertex; | ||
|
|
||
| uniform mat4x2 Pos; | ||
|
|
||
| uniform vec2 Offset; | ||
| uniform vec2 Dir; | ||
| uniform int JumpIndex; | ||
|
|
||
| void main() | ||
| { | ||
| vec4 VertPos = vec4(inVertex, 0.0, 1.0); | ||
| int XCount = gl_InstanceID - (int(gl_InstanceID/JumpIndex) * JumpIndex); | ||
| int YCount = (int(gl_InstanceID/JumpIndex)); | ||
| VertPos.x += Offset.x + Dir.x * XCount; | ||
| VertPos.y += Offset.y + Dir.y * YCount; | ||
|
|
||
| gl_Position = vec4(Pos * VertPos, 0.0, 1.0); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #version 330 | ||
|
|
||
| uniform vec4 vertColor; | ||
|
|
||
| out vec4 FragClr; | ||
| void main() | ||
| { | ||
| FragClr = vertColor; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #version 330 | ||
|
|
||
| layout (location = 0) in vec2 inVertex; | ||
|
|
||
| uniform mat4x2 Pos; | ||
|
|
||
| uniform vec2 Dir; | ||
|
|
||
| void main() | ||
| { | ||
| vec4 VertPos = vec4(inVertex, 0.0, 1.0); | ||
| VertPos.x += Dir.x * (gl_InstanceID+1); | ||
| VertPos.y += Dir.y * (gl_InstanceID+1); | ||
|
|
||
| gl_Position = vec4(Pos * VertPos, 0.0, 1.0); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #version 330 | ||
|
|
||
| uniform sampler2D textureSampler; | ||
|
|
||
| uniform vec4 vertColor; | ||
|
|
||
| noperspective in vec2 texCoord; | ||
| flat in float fragLOD; | ||
|
|
||
| out vec4 FragClr; | ||
| void main() | ||
| { | ||
| vec4 tex = textureLod(textureSampler, texCoord, fragLOD); | ||
| FragClr = tex * vertColor; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #version 330 | ||
|
|
||
| layout (location = 0) in vec2 inVertex; | ||
| layout (location = 1) in vec2 inVertexTexCoord; | ||
| layout (location = 2) in ivec2 inVertexTexRightOrBottom; | ||
|
|
||
| uniform mat4x2 Pos; | ||
| uniform float LOD; | ||
|
|
||
| uniform vec2 Dir; | ||
|
|
||
| noperspective out vec2 texCoord; | ||
| flat out float fragLOD; | ||
|
|
||
| void main() | ||
| { | ||
| vec4 VertPos = vec4(inVertex, 0.0, 1.0); | ||
| VertPos.x += Dir.x * (gl_InstanceID+1); | ||
| VertPos.y += Dir.y * (gl_InstanceID+1); | ||
|
|
||
| gl_Position = vec4(Pos * VertPos, 0.0, 1.0); | ||
| float F1 = -(0.5/(1024.0 * pow(0.5, LOD))); | ||
| float F2 = (0.5/(1024.0 * pow(0.5, LOD))); | ||
| float tx = (inVertexTexCoord.x/(16.0)); | ||
| float ty = (inVertexTexCoord.y/(16.0)); | ||
| texCoord = vec2(tx + (inVertexTexRightOrBottom.x == 0 ? F2 : F1), ty + (inVertexTexRightOrBottom.y == 0 ? F2 : F1)); | ||
| fragLOD = LOD; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #version 330 | ||
|
|
||
| uniform sampler2D textureSampler; | ||
|
|
||
| uniform vec4 vertColor; | ||
|
|
||
| noperspective in vec2 texCoord; | ||
| flat in float fragLOD; | ||
|
|
||
| out vec4 FragClr; | ||
| void main() | ||
| { | ||
| vec4 tex = textureLod(textureSampler, texCoord, fragLOD); | ||
| FragClr = tex * vertColor; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #version 330 | ||
|
|
||
| layout (location = 0) in vec2 inVertex; | ||
| layout (location = 1) in vec2 inVertexTexCoord; | ||
| layout (location = 2) in ivec2 inVertexTexRightOrBottom; | ||
|
|
||
| uniform mat4x2 Pos; | ||
| uniform float LOD; | ||
|
|
||
| uniform vec2 Offset; | ||
| uniform vec2 Dir; | ||
| uniform int JumpIndex; | ||
|
|
||
| noperspective out vec2 texCoord; | ||
| flat out float fragLOD; | ||
|
|
||
| void main() | ||
| { | ||
| vec4 VertPos = vec4(inVertex, 0.0, 1.0); | ||
| int XCount = gl_InstanceID - (int(gl_InstanceID/JumpIndex) * JumpIndex); | ||
| int YCount = (int(gl_InstanceID/JumpIndex)); | ||
| VertPos.x += Offset.x + Dir.x * XCount; | ||
| VertPos.y += Offset.y + Dir.y * YCount; | ||
|
|
||
| gl_Position = vec4(Pos * VertPos, 0.0, 1.0); | ||
| float F1 = -(0.5/(1024.0 * pow(0.5, LOD))); | ||
| float F2 = (0.5/(1024.0 * pow(0.5, LOD))); | ||
| float tx = (inVertexTexCoord.x/(16.0)); | ||
| float ty = (inVertexTexCoord.y/(16.0)); | ||
| texCoord = vec2(tx + (inVertexTexRightOrBottom.x == 0 ? F2 : F1), ty + (inVertexTexRightOrBottom.y == 0 ? F2 : F1)); | ||
| fragLOD = LOD; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #version 330 | ||
|
|
||
| uniform int isTextured; | ||
| uniform sampler2D textureSampler; | ||
|
|
||
| noperspective in vec2 texCoord; | ||
| noperspective in vec4 vertColor; | ||
|
|
||
| out vec4 FragClr; | ||
| void main() | ||
| { | ||
| if(isTextured == 1) { | ||
| vec4 tex = texture(textureSampler, texCoord); | ||
| FragClr = tex * vertColor; | ||
| } | ||
| else FragClr = vertColor; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #version 330 | ||
|
|
||
| layout (location = 0) in vec2 inVertex; | ||
| layout (location = 1) in vec2 inVertexTexCoord; | ||
| layout (location = 2) in vec4 inVertexColor; | ||
|
|
||
| uniform mat4x2 Pos; | ||
|
|
||
| noperspective out vec2 texCoord; | ||
| noperspective out vec4 vertColor; | ||
|
|
||
| void main() | ||
| { | ||
| gl_Position = vec4(Pos * vec4(inVertex, 0.0, 1.0), 0.0, 1.0); | ||
| texCoord = inVertexTexCoord; | ||
| vertColor = inVertexColor; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #version 330 | ||
|
|
||
| uniform vec4 vertColor; | ||
|
|
||
| out vec4 FragClr; | ||
|
|
||
| void main() | ||
| { | ||
| FragClr = vertColor; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #version 330 | ||
|
|
||
| layout (location = 0) in vec2 inVertex; | ||
|
|
||
| uniform mat4x2 Pos; | ||
|
|
||
| void main() | ||
| { | ||
| gl_Position = vec4(Pos * vec4(inVertex, 0.0, 1.0), 0.0, 1.0); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #version 330 | ||
|
|
||
| uniform sampler2D textureSampler; | ||
|
|
||
| uniform vec4 vertColor; | ||
|
|
||
| noperspective in vec2 texCoord; | ||
| flat in float fragLOD; | ||
|
|
||
| out vec4 FragClr; | ||
| void main() | ||
| { | ||
| vec4 tex = textureLod(textureSampler, texCoord, fragLOD); | ||
| FragClr = tex * vertColor; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #version 330 | ||
|
|
||
| layout (location = 0) in vec2 inVertex; | ||
| layout (location = 1) in vec2 inVertexTexCoord; | ||
| layout (location = 2) in ivec2 inVertexTexRightOrBottom; | ||
|
|
||
| uniform mat4x2 Pos; | ||
| uniform float LOD; | ||
|
|
||
| noperspective out vec2 texCoord; | ||
| flat out float fragLOD; | ||
|
|
||
| void main() | ||
| { | ||
| gl_Position = vec4(Pos * vec4(inVertex, 0.0, 1.0), 0.0, 1.0); | ||
| float F1 = -(0.5/(1024.0 * pow(0.5, LOD))); | ||
| float F2 = (0.5/(1024.0 * pow(0.5, LOD))); | ||
| float tx = (inVertexTexCoord.x/(16.0)); | ||
| float ty = (inVertexTexCoord.y/(16.0)); | ||
| texCoord = vec2(tx + (inVertexTexRightOrBottom.x == 0 ? F2 : F1), ty + (inVertexTexRightOrBottom.y == 0 ? F2 : F1)); | ||
| fragLOD = LOD; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| <plist version="1.0"> | ||
| <dict> | ||
| <key>CFBundleDevelopmentRegion</key> | ||
| <string>English</string> | ||
| <key>CFBundleExecutable</key> | ||
| <string>${TARGET_CLIENT}</string> | ||
| <key>CFBundleIconFile</key> | ||
| <string>${TARGET_CLIENT}</string> | ||
| <key>CFBundleInfoDictionaryVersion</key> | ||
| <string>6.0</string> | ||
| <key>CFBundlePackageType</key> | ||
| <string>APPL</string> | ||
| <key>CFBundleSignature</key> | ||
| <string>????</string> | ||
| <key>CFBundleVersion</key> | ||
| <string>${PROJECT_VERSION}</string> | ||
| <key>CFBundleIdentifier</key> | ||
| <string>org.DDNetClient.app</string> | ||
| <key>NSHighResolutionCapable</key> | ||
| <true/> | ||
| </dict> | ||
| </plist> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| APPL???? |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| <plist version="1.0"> | ||
| <dict> | ||
| <key>CFBundleDevelopmentRegion</key> | ||
| <string>English</string> | ||
| <key>CFBundleExecutable</key> | ||
| <string>${TARGET_SERVER_LAUNCHER}</string> | ||
| <key>CFBundleIconFile</key> | ||
| <string>${TARGET_SERVER}</string> | ||
| <key>CFBundleInfoDictionaryVersion</key> | ||
| <string>6.0</string> | ||
| <key>CFBundlePackageType</key> | ||
| <string>APPL</string> | ||
| <key>CFBundleSignature</key> | ||
| <string>????</string> | ||
| <key>CFBundleVersion</key> | ||
| <string>${PROJECT_VERSION}</string> | ||
| </dict> | ||
| </plist> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| APPL???? |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ID ICON "DDNet.ico" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| <assemblyIdentity version="1.0.0.0" name="DDNet.exe"/> | ||
| <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> | ||
| <security> | ||
| <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> | ||
| <requestedExecutionLevel level="asInvoker" uiAccess="false" /> | ||
| </requestedPrivileges> | ||
| </security> | ||
| </trustInfo> | ||
|
|
||
| <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> | ||
| <application> | ||
| <!-- Windows 10 --> | ||
| <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> | ||
| <!-- Windows 8.1 --> | ||
| <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> | ||
| </application> | ||
| </compatibility> | ||
|
|
||
| <asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> | ||
| <asmv3:windowsSettings | ||
| xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> | ||
| <dpiAware>True/PM</dpiAware> | ||
| </asmv3:windowsSettings> | ||
| </asmv3:application> | ||
|
|
||
| </asmv1:assembly> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| #include "winuser.h" | ||
| 1 RT_MANIFEST DDNet.manifest |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| from collections import namedtuple | ||
| import os | ||
| import shlex | ||
| import subprocess | ||
| import tempfile | ||
|
|
||
| ConfigDmgtools = namedtuple('Config', 'dmg hfsplus newfs_hfs verbose') | ||
| ConfigHdiutil = namedtuple('Config', 'hdiutil verbose') | ||
|
|
||
| def chunks(l, n): | ||
| """ | ||
| Yield successive n-sized chunks from l. | ||
| From https://stackoverflow.com/a/312464. | ||
| """ | ||
| for i in range(0, len(l), n): | ||
| yield l[i:i + n] | ||
|
|
||
| class Dmg: | ||
| def __init__(self, config): | ||
| self.config = config | ||
|
|
||
| def _check_call(self, process_args, *args, **kwargs): | ||
| if self.config.verbose >= 1: | ||
| print("EXECUTING {}".format(" ".join(shlex.quote(x) for x in process_args))) | ||
| if not (self.config.verbose >= 2 and "stdout" not in kwargs): | ||
| kwargs["stdout"] = open(os.devnull, 'wb') | ||
| subprocess.check_call(process_args, *args, **kwargs) | ||
|
|
||
| class Dmgtools(Dmg): | ||
| def _mkfs_hfs(self, *args): | ||
| self._check_call((self.config.newfs_hfs,) + args) | ||
| def _hfs(self, *args): | ||
| self._check_call((self.config.hfsplus,) + args) | ||
| def _dmg(self, *args): | ||
| self._check_call((self.config.dmg,) + args) | ||
|
|
||
| def _create_hfs(self, hfs, volume_name, size): | ||
| if self.config.verbose >= 1: | ||
| print("TRUNCATING {} to {} bytes".format(hfs, size)) | ||
| with open(hfs, 'wb') as f: | ||
| f.truncate(size) | ||
| self._mkfs_hfs('-v', volume_name, hfs) | ||
|
|
||
| def _symlink(self, hfs, target, link_name): | ||
| self._hfs(hfs, 'symlink', link_name, target) | ||
|
|
||
| def _add(self, hfs, directory): | ||
| self._hfs(hfs, 'addall', directory) | ||
|
|
||
| def _finish(self, hfs, dmg): | ||
| self._dmg('build', hfs, dmg) | ||
|
|
||
| def create(self, dmg, volume_name, directory, symlinks): | ||
| input_size = sum(os.stat(os.path.join(path, f)).st_size for path, dirs, files in os.walk(directory) for f in files) | ||
| output_size = max(input_size * 2, 1024**2) | ||
| hfs = tempfile.mktemp(prefix=dmg + '.', suffix='.hfs') | ||
| self._create_hfs(hfs, volume_name, output_size) | ||
| self._add(hfs, directory) | ||
| for target, link_name in symlinks: | ||
| self._symlink(hfs, target, link_name) | ||
| self._finish(hfs, dmg) | ||
| if self.config.verbose >= 1: | ||
| print("REMOVING {}".format(hfs)) | ||
| os.remove(hfs) | ||
|
|
||
| class Hdiutil(Dmg): | ||
| def _hdiutil(self, *args): | ||
| self._check_call((self.config.hdiutil,) + args) | ||
|
|
||
| def create(self, dmg, volume_name, directory, symlinks): | ||
| if symlinks: | ||
| raise NotImplementedError("symlinks are not yet implemented") | ||
| self._hdiutil('create', '-volname', volume_name, '-srcdir', directory, dmg) | ||
|
|
||
| def main(): | ||
| import argparse | ||
| p = argparse.ArgumentParser(description="Manipulate dmg archives") | ||
|
|
||
| subcommands = p.add_subparsers(help="Subcommand", dest='command', metavar="COMMAND") | ||
| subcommands.required = True | ||
|
|
||
| create = subcommands.add_parser("create", help="Create a dmg archive from files or directories") | ||
| create.add_argument('-v', '--verbose', action='count', help="Verbose output") | ||
| createx = create.add_mutually_exclusive_group(required=True) | ||
| createx.add_argument('--dmgtools', nargs=3, help="Paths to the dmg and hfsplus executable (https://github.com/mozilla/libdmg-hfsplus) and the newfs_hfs executable (http://pkgs.fedoraproject.org/repo/pkgs/hfsplus-tools/diskdev_cmds-540.1.linux3.tar.gz/0435afc389b919027b69616ad1b05709/diskdev_cmds-540.1.linux3.tar.gz)") | ||
| createx.add_argument('--hdiutil', help="Path to the hdiutil (only exists for macOS at time of writing)") | ||
| create.add_argument('output', metavar="OUTPUT", help="Filename of the output dmg archive") | ||
| create.add_argument('volume_name', metavar="VOLUME_NAME", help="Name of the dmg archive") | ||
| create.add_argument('directory', metavar="DIR", help="Directory to create the archive from") | ||
| create.add_argument('--symlink', metavar="SYMLINK", nargs=2, action="append", help="Symlink the first argument under the second name") | ||
| args = p.parse_args() | ||
|
|
||
| verbose = args.verbose or 0 | ||
| symlinks = args.symlink or [] | ||
| if args.dmgtools: | ||
| dmg, hfsplus, newfs_hfs = args.dmgtools | ||
| dmg = Dmgtools(ConfigDmgtools(dmg=dmg, hfsplus=hfsplus, newfs_hfs=newfs_hfs, verbose=verbose)) | ||
| elif args.hdiutil: | ||
| dmg = Hdiutil(ConfigHdiutil(hdiutil=args.hdiutil, verbose=verbose)) | ||
| else: | ||
| raise RuntimeError("unreachable") | ||
| dmg.create(volume_name=args.volume_name, directory=args.directory, dmg=args.output, symlinks=symlinks) | ||
|
|
||
| if __name__ == '__main__': | ||
| main() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,35 +1,56 @@ | ||
| #ifndef ENGINE_CLIENT_FETCHER_H | ||
| #define ENGINE_CLIENT_FETCHER_H | ||
|
|
||
| #include <engine/shared/jobs.h> | ||
| #include <engine/storage.h> | ||
| #include <engine/kernel.h> | ||
|
|
||
| class CFetchTask : public IJob | ||
| { | ||
| private: | ||
| IStorage *m_pStorage; | ||
|
|
||
| char m_aUrl[256]; | ||
| char m_aDest[128]; | ||
| int m_StorageType; | ||
| bool m_UseDDNetCA; | ||
| bool m_CanTimeout; | ||
|
|
||
| double m_Size; | ||
| double m_Current; | ||
| int m_Progress; | ||
| int m_State; | ||
|
|
||
| std::atomic<bool> m_Abort; | ||
|
|
||
| virtual void OnProgress() { } | ||
| virtual void OnCompletion() { } | ||
|
|
||
| static int ProgressCallback(void *pUser, double DlTotal, double DlCurr, double UlTotal, double UlCurr); | ||
| static size_t WriteCallback(char *pData, size_t Size, size_t Number, void *pFile); | ||
|
|
||
| void Run(); | ||
|
|
||
| public: | ||
| enum | ||
| { | ||
| STATE_ERROR = -1, | ||
| STATE_QUEUED, | ||
| STATE_RUNNING, | ||
| STATE_DONE, | ||
| STATE_ABORTED, | ||
| }; | ||
|
|
||
| CFetchTask(IStorage *pStorage, const char *pUrl, const char *pDest, int StorageType = -2, bool UseDDNetCA = false, bool CanTimeout = true); | ||
|
|
||
| double Current() const; | ||
| double Size() const; | ||
| int Progress() const; | ||
| int State() const; | ||
| const char *Dest() const; | ||
| void Abort(); | ||
| }; | ||
|
|
||
| bool FetcherInit(); | ||
| void EscapeUrl(char *pBud, int Size, const char *pStr); | ||
| #endif |