├── .github ├── CI │ ├── android_licenses_fix.sh │ ├── create_conf.py │ ├── deploy_rsa_android.enc │ ├── signing.properties │ ├── upload_package.sh │ ├── vcmi-travis.jks │ └── vcmiconf.json.in └── workflows │ ├── build-optional.yml │ └── github.yml ├── .gitignore ├── .gitmodules ├── build.py ├── building.txt ├── ext ├── SDL2 │ ├── SDL2-image │ │ ├── Application.mk │ │ ├── build.mk │ │ └── include │ │ │ ├── SDL_image.h │ │ │ └── miniz.h │ ├── SDL2-mixer │ │ ├── Application.mk │ │ ├── build.mk │ │ └── include │ │ │ └── SDL_mixer.h │ ├── SDL2-prebuilt-include.mk │ ├── SDL2-ttf │ │ ├── Application.mk │ │ ├── build.mk │ │ └── include │ │ │ └── SDL_ttf.h │ └── core │ │ ├── Application.mk │ │ ├── build.mk │ │ └── include │ │ ├── SDL.h │ │ ├── SDL_assert.h │ │ ├── SDL_atomic.h │ │ ├── SDL_audio.h │ │ ├── SDL_bits.h │ │ ├── SDL_blendmode.h │ │ ├── SDL_clipboard.h │ │ ├── SDL_config.h │ │ ├── SDL_config.h.cmake │ │ ├── SDL_config.h.in │ │ ├── SDL_config_android.h │ │ ├── SDL_config_emscripten.h │ │ ├── SDL_config_iphoneos.h │ │ ├── SDL_config_macosx.h │ │ ├── SDL_config_minimal.h │ │ ├── SDL_config_ngage.h │ │ ├── SDL_config_os2.h │ │ ├── SDL_config_pandora.h │ │ ├── SDL_config_windows.h │ │ ├── SDL_config_wingdk.h │ │ ├── SDL_config_winrt.h │ │ ├── SDL_config_xbox.h │ │ ├── SDL_copying.h │ │ ├── SDL_cpuinfo.h │ │ ├── SDL_egl.h │ │ ├── SDL_endian.h │ │ ├── SDL_error.h │ │ ├── SDL_events.h │ │ ├── SDL_filesystem.h │ │ ├── SDL_gamecontroller.h │ │ ├── SDL_gesture.h │ │ ├── SDL_guid.h │ │ ├── SDL_haptic.h │ │ ├── SDL_hidapi.h │ │ ├── SDL_hints.h │ │ ├── SDL_joystick.h │ │ ├── SDL_keyboard.h │ │ ├── SDL_keycode.h │ │ ├── SDL_loadso.h │ │ ├── SDL_locale.h │ │ ├── SDL_log.h │ │ ├── SDL_main.h │ │ ├── SDL_messagebox.h │ │ ├── SDL_metal.h │ │ ├── SDL_misc.h │ │ ├── SDL_mouse.h │ │ ├── SDL_mutex.h │ │ ├── SDL_name.h │ │ ├── SDL_opengl.h │ │ ├── SDL_opengl_glext.h │ │ ├── SDL_opengles.h │ │ ├── SDL_opengles2.h │ │ ├── SDL_opengles2_gl2.h │ │ ├── SDL_opengles2_gl2ext.h │ │ ├── SDL_opengles2_gl2platform.h │ │ ├── SDL_opengles2_khrplatform.h │ │ ├── SDL_pixels.h │ │ ├── SDL_platform.h │ │ ├── SDL_power.h │ │ ├── SDL_quit.h │ │ ├── SDL_rect.h │ │ ├── SDL_render.h │ │ ├── SDL_revision.h │ │ ├── SDL_revision.h.cmake │ │ ├── SDL_rwops.h │ │ ├── SDL_scancode.h │ │ ├── SDL_sensor.h │ │ ├── SDL_shape.h │ │ ├── SDL_stdinc.h │ │ ├── SDL_surface.h │ │ ├── SDL_system.h │ │ ├── SDL_syswm.h │ │ ├── SDL_test.h │ │ ├── SDL_test_assert.h │ │ ├── SDL_test_common.h │ │ ├── SDL_test_compare.h │ │ ├── SDL_test_crc32.h │ │ ├── SDL_test_font.h │ │ ├── SDL_test_fuzzer.h │ │ ├── SDL_test_harness.h │ │ ├── SDL_test_images.h │ │ ├── SDL_test_log.h │ │ ├── SDL_test_md5.h │ │ ├── SDL_test_memory.h │ │ ├── SDL_test_random.h │ │ ├── SDL_thread.h │ │ ├── SDL_timer.h │ │ ├── SDL_touch.h │ │ ├── SDL_types.h │ │ ├── SDL_version.h │ │ ├── SDL_video.h │ │ ├── SDL_vulkan.h │ │ ├── begin_code.h │ │ └── close_code.h ├── ff │ └── include │ │ ├── libavcodec │ │ ├── ac3_parser.h │ │ ├── adts_parser.h │ │ ├── avcodec.h │ │ ├── avdct.h │ │ ├── avfft.h │ │ ├── bsf.h │ │ ├── codec.h │ │ ├── codec_desc.h │ │ ├── codec_id.h │ │ ├── codec_par.h │ │ ├── d3d11va.h │ │ ├── defs.h │ │ ├── dirac.h │ │ ├── dv_profile.h │ │ ├── dxva2.h │ │ ├── jni.h │ │ ├── mediacodec.h │ │ ├── packet.h │ │ ├── qsv.h │ │ ├── vaapi.h │ │ ├── vda.h │ │ ├── vdpau.h │ │ ├── version.h │ │ ├── version_major.h │ │ ├── videotoolbox.h │ │ ├── vorbis_parser.h │ │ └── xvmc.h │ │ ├── libavdevice │ │ ├── avdevice.h │ │ ├── version.h │ │ └── version_major.h │ │ ├── libavfilter │ │ ├── avfilter.h │ │ ├── avfiltergraph.h │ │ ├── buffersink.h │ │ ├── buffersrc.h │ │ ├── version.h │ │ └── version_major.h │ │ ├── libavformat │ │ ├── avformat.h │ │ ├── avio.h │ │ ├── version.h │ │ └── version_major.h │ │ ├── libavutil │ │ ├── adler32.h │ │ ├── aes.h │ │ ├── aes_ctr.h │ │ ├── attributes.h │ │ ├── audio_fifo.h │ │ ├── avassert.h │ │ ├── avconfig.h │ │ ├── avstring.h │ │ ├── avutil.h │ │ ├── base64.h │ │ ├── blowfish.h │ │ ├── bprint.h │ │ ├── bswap.h │ │ ├── buffer.h │ │ ├── camellia.h │ │ ├── cast5.h │ │ ├── channel_layout.h │ │ ├── common.h │ │ ├── cpu.h │ │ ├── crc.h │ │ ├── csp.h │ │ ├── des.h │ │ ├── detection_bbox.h │ │ ├── dict.h │ │ ├── display.h │ │ ├── dovi_meta.h │ │ ├── downmix_info.h │ │ ├── encryption_info.h │ │ ├── error.h │ │ ├── eval.h │ │ ├── ffversion.h │ │ ├── fifo.h │ │ ├── file.h │ │ ├── film_grain_params.h │ │ ├── frame.h │ │ ├── hash.h │ │ ├── hdr_dynamic_metadata.h │ │ ├── hdr_dynamic_vivid_metadata.h │ │ ├── hmac.h │ │ ├── hwcontext.h │ │ ├── hwcontext_cuda.h │ │ ├── hwcontext_d3d11va.h │ │ ├── hwcontext_drm.h │ │ ├── hwcontext_dxva2.h │ │ ├── hwcontext_mediacodec.h │ │ ├── hwcontext_opencl.h │ │ ├── hwcontext_qsv.h │ │ ├── hwcontext_vaapi.h │ │ ├── hwcontext_vdpau.h │ │ ├── hwcontext_videotoolbox.h │ │ ├── hwcontext_vulkan.h │ │ ├── imgutils.h │ │ ├── intfloat.h │ │ ├── intreadwrite.h │ │ ├── lfg.h │ │ ├── log.h │ │ ├── lzo.h │ │ ├── macros.h │ │ ├── mastering_display_metadata.h │ │ ├── mathematics.h │ │ ├── md5.h │ │ ├── mem.h │ │ ├── motion_vector.h │ │ ├── murmur3.h │ │ ├── opt.h │ │ ├── parseutils.h │ │ ├── pixdesc.h │ │ ├── pixelutils.h │ │ ├── pixfmt.h │ │ ├── random_seed.h │ │ ├── rational.h │ │ ├── rc4.h │ │ ├── replaygain.h │ │ ├── ripemd.h │ │ ├── samplefmt.h │ │ ├── sha.h │ │ ├── sha512.h │ │ ├── spherical.h │ │ ├── stereo3d.h │ │ ├── tea.h │ │ ├── threadmessage.h │ │ ├── time.h │ │ ├── timecode.h │ │ ├── timestamp.h │ │ ├── tree.h │ │ ├── twofish.h │ │ ├── tx.h │ │ ├── uuid.h │ │ ├── version.h │ │ ├── video_enc_params.h │ │ └── xtea.h │ │ ├── libpostproc │ │ ├── postprocess.h │ │ ├── version.h │ │ └── version_major.h │ │ ├── libswresample │ │ ├── swresample.h │ │ ├── version.h │ │ └── version_major.h │ │ ├── libswscale │ │ ├── swscale.h │ │ ├── version.h │ │ └── version_major.h │ │ ├── x264.h │ │ └── x264_config.h └── iconv │ ├── Application.mk │ └── build.mk ├── fix_boost_files.py ├── fix_ffmpeg_confs.py ├── fix_fuzzylite_dirs.py ├── fix_sdl_makefiles.py ├── move_sdl_includes.py ├── project ├── .gitignore ├── .idea │ ├── .gitignore │ ├── .name │ ├── codeStyles │ │ ├── Project.xml │ │ └── codeStyleConfig.xml │ ├── compiler.xml │ ├── gradle.xml │ ├── misc.xml │ └── vcs.xml ├── GeneratedVersion.java.in ├── build.gradle ├── defs.gradle ├── defs.gradle.properties ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── vcmi-app │ ├── .gitignore │ ├── build.gradle │ ├── cmake-scripts │ ├── CMakeLists.txt │ ├── client.cmake │ ├── ext-libs.cmake │ ├── fuzzylite.pc.in │ ├── integration │ │ ├── cmake │ │ │ └── generate_vars.cmake │ │ ├── linux │ │ │ └── env │ │ │ │ ├── vars.sh │ │ │ │ └── vars.sh.in │ │ ├── mac │ │ │ └── env │ │ │ │ ├── vars.sh │ │ │ │ └── vars.sh.in │ │ ├── pkg-config │ │ │ └── tbb.pc.in │ │ └── windows │ │ │ └── env │ │ │ ├── vars.bat │ │ │ └── vars.bat.in │ ├── lib.cmake │ ├── main-app.cmake │ ├── server.cmake │ └── versions.cmake │ ├── proguard-rules.pro │ └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ ├── internalData.zip │ └── internalDataHash.txt │ ├── java │ ├── eu │ │ └── vcmi │ │ │ └── vcmi │ │ │ ├── ActivityAbout.java │ │ │ ├── ActivityBase.java │ │ │ ├── ActivityError.java │ │ │ ├── ActivityLauncher.java │ │ │ ├── ActivityMods.java │ │ │ ├── ActivityWithToolbar.java │ │ │ ├── Config.java │ │ │ ├── Const.java │ │ │ ├── NativeMethods.java │ │ │ ├── ServerService.java │ │ │ ├── Storage.java │ │ │ ├── VcmiSDLActivity.java │ │ │ ├── content │ │ │ ├── AsyncLauncherInitialization.java │ │ │ ├── DialogAuthors.java │ │ │ ├── ModBaseViewHolder.java │ │ │ ├── ModsAdapter.java │ │ │ └── ModsViewHolder.java │ │ │ ├── mods │ │ │ ├── VCMIMod.java │ │ │ ├── VCMIModContainer.java │ │ │ └── VCMIModsRepo.java │ │ │ ├── settings │ │ │ ├── AdventureAiController.java │ │ │ ├── AdventureAiSelectionDialog.java │ │ │ ├── CodepageSettingController.java │ │ │ ├── CodepageSettingDialog.java │ │ │ ├── CopyDataController.java │ │ │ ├── DoubleConfig.java │ │ │ ├── ExportDataController.java │ │ │ ├── LauncherSettingController.java │ │ │ ├── LauncherSettingDialog.java │ │ │ ├── LauncherSettingWithDialogController.java │ │ │ ├── LauncherSettingWithSliderController.java │ │ │ ├── ModsBtnController.java │ │ │ ├── MusicSettingController.java │ │ │ ├── PointerModeSettingController.java │ │ │ ├── PointerModeSettingDialog.java │ │ │ ├── PointerMultiplierSettingController.java │ │ │ ├── PointerMultiplierSettingDialog.java │ │ │ ├── ScreenResSettingController.java │ │ │ ├── ScreenResSettingDialog.java │ │ │ ├── SoundSettingController.java │ │ │ └── StartGameController.java │ │ │ ├── util │ │ │ ├── AsyncRequest.java │ │ │ ├── FileUtil.java │ │ │ ├── GeneratedVersion.java │ │ │ ├── IZipProgressReporter.java │ │ │ ├── InstallModAsync.java │ │ │ ├── LegacyConfigReader.java │ │ │ ├── LibsLoader.java │ │ │ ├── Log.java │ │ │ ├── ServerResponse.java │ │ │ ├── SharedPrefs.java │ │ │ └── Utils.java │ │ │ └── viewmodels │ │ │ └── ObservableViewModel.java │ └── org │ │ └── libsdl │ │ └── app │ │ ├── DummyEdit.java │ │ ├── HIDDevice.java │ │ ├── HIDDeviceBLESteamController.java │ │ ├── HIDDeviceManager.java │ │ ├── HIDDeviceUSB.java │ │ ├── SDL.java │ │ ├── SDLActivity.java │ │ ├── SDLAudioManager.java │ │ ├── SDLControllerManager.java │ │ ├── SDLInputConnection.java │ │ └── SDLSurface.java │ └── res │ ├── drawable-nodpi │ └── divider_compat.png │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ ├── compat_toolbar_shadow.xml │ ├── ic_error.xml │ ├── ic_info.xml │ ├── ic_launcher_background.xml │ ├── ic_star_empty.xml │ ├── ic_star_full.xml │ ├── ic_star_half.xml │ ├── overlay_edittext_background.xml │ └── recycler_divider_drawable.xml │ ├── layout-v21 │ └── inc_toolbar.xml │ ├── layout │ ├── activity_about.xml │ ├── activity_error.xml │ ├── activity_game.xml │ ├── activity_launcher.xml │ ├── activity_mods.xml │ ├── activity_toolbar_wrapper.xml │ ├── dialog_authors.xml │ ├── inc_launcher_btn.xml │ ├── inc_launcher_slider.xml │ ├── inc_separator.xml │ ├── inc_toolbar.xml │ ├── mod_base_adapter_item.xml │ └── mods_adapter_item.xml │ ├── menu │ ├── menu_launcher.xml │ └── menu_mods.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ └── ic_launcher.png │ ├── raw │ └── authors.txt │ ├── values-de │ └── strings.xml │ ├── values-pl │ └── strings.xml │ ├── values-ru │ └── strings.xml │ ├── values-uk │ └── strings.xml │ ├── values-v21 │ └── themes.xml │ └── values │ ├── colors.xml │ ├── dimen.xml │ ├── strings.xml │ └── themes.xml ├── update_internal_assets.py ├── vcmiconf.json ├── vcmiconf.py └── vcmiutil.py /.github/CI/android_licenses_fix.sh: -------------------------------------------------------------------------------- 1 | echo "$ANDROID_HOME" 2 | mkdir "$ANDROID_HOME/licenses" || true 3 | echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license" 4 | echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license" 5 | # https://github.com/travis-ci/travis-ci/issues/6555 -------------------------------------------------------------------------------- /.github/CI/create_conf.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | def rewriteFile(path, content): 4 | replacementFile = open(path + "__tmp", "w") 5 | replacementFile.write(content) 6 | replacementFile.close() 7 | os.replace(path + "__tmp", path) 8 | 9 | dir = os.path.dirname(os.path.realpath(__file__)) 10 | with open(dir + "/vcmiconf.json.in", "r") as templateFile: 11 | rootDir = os.path.abspath(dir + "/../..") 12 | config = templateFile.read() 13 | config = config.replace("$PROJECT_ROOT", rootDir) 14 | config = config.replace("$NDK_ROOT", os.getenv("ANDROID_NDK_HOME", "")) 15 | config = config.replace("$SDK_ROOT", os.getenv("ANDROID_SDK_ROOT", "")) 16 | config = config.replace("$JAVA_HOME", os.getenv("JAVA_HOME", "")) 17 | rewriteFile(rootDir + "/vcmiconf.json", config) -------------------------------------------------------------------------------- /.github/CI/deploy_rsa_android.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vcmi/vcmi-android/e63c25adcc56d27d18601fa700a41cdabb4a852a/.github/CI/deploy_rsa_android.enc -------------------------------------------------------------------------------- /.github/CI/signing.properties: -------------------------------------------------------------------------------- 1 | STORE_FILE=vcmi-travis.jks 2 | STORE_PASSWORD=traviskey 3 | KEY_ALIAS=vcmitraviskey 4 | KEY_PASSWORD=traviskey -------------------------------------------------------------------------------- /.github/CI/upload_package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ -z "$DEPLOY_RSA" ]; 3 | then 4 | # Due to security measures travis not expose encryption keys for PR from forks 5 | echo "Build generation is skipped for forks" 6 | exit 0 7 | fi 8 | 9 | echo "$DEPLOY_RSA" > /tmp/deploy_rsa 10 | chmod 600 /tmp/deploy_rsa 11 | 12 | eval "$(ssh-agent -s)" 13 | ssh-add /tmp/deploy_rsa 14 | 15 | PACKAGE_FULL_PATH=$(find $GITHUB_WORKSPACE/project/vcmi-app/build/outputs -type f -name "*-vcmi-*.apk") 16 | echo "PACKAGE_FULL_PATH = $PACKAGE_FULL_PATH" 17 | VCMI_PACKAGE_FILE_NAME=${PACKAGE_FULL_PATH##*/} 18 | echo "VCMI_PACKAGE_FILE_NAME = $VCMI_PACKAGE_FILE_NAME" 19 | 20 | sftp -r -o StrictHostKeyChecking=no travis-android@beholder.vcmi.eu <<< "put $PACKAGE_FULL_PATH /incoming/$VCMI_PACKAGE_FILE_NAME" 21 | 22 | -------------------------------------------------------------------------------- /.github/CI/vcmi-travis.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vcmi/vcmi-android/e63c25adcc56d27d18601fa700a41cdabb4a852a/.github/CI/vcmi-travis.jks -------------------------------------------------------------------------------- /.github/CI/vcmiconf.json.in: -------------------------------------------------------------------------------- 1 | { 2 | "bash" : 3 | { 4 | "projectRoot" : "$PROJECT_ROOT", 5 | "ndkRoot" : "$NDK_ROOT", 6 | "sdkRoot" : "$SDK_ROOT", 7 | "extOutput" : "$PROJECT_ROOT/ext-output" 8 | }, 9 | "projectRoot" : "$PROJECT_ROOT", 10 | "ndkRoot" : "$NDK_ROOT", 11 | "sdkRoot" : "$SDK_ROOT", 12 | "javaRoot": "$JAVA_HOME", 13 | "abis" : "arm64-v8a armeabi-v7a x86_64 x86", 14 | "boostFolderName" : "boost_1_68_0", 15 | "androidApi" : 19, 16 | "cmakeBuildMode" : "Release" 17 | } -------------------------------------------------------------------------------- /.github/workflows/github.yml: -------------------------------------------------------------------------------- 1 | name: VCMI 2 | 3 | on: 4 | push: 5 | branches: 6 | - features/* 7 | - develop 8 | - master 9 | pull_request: 10 | repository_dispatch: 11 | workflow_dispatch: 12 | 13 | env: 14 | # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) 15 | BUILD_TYPE: Release 16 | 17 | jobs: 18 | build: 19 | runs-on: ubuntu-latest 20 | defaults: 21 | run: 22 | shell: bash 23 | 24 | steps: 25 | - uses: actions/checkout@v2 26 | with: 27 | submodules: recursive 28 | fetch-depth: 0 29 | 30 | - name: Update VCMI Sources 31 | run: | 32 | git submodule update --init --remote --recursive ${{github.workspace}}/ext/vcmi 33 | 34 | - name: Dependencies 35 | run: | 36 | wget https://github.com/vcmi/vcmi-android/releases/download/v.1.1/ext-output.zip 37 | unzip ext-output.zip 38 | wget -O ./boost.tar.gz https://boostorg.jfrog.io/artifactory/main/release/1.68.0/source/boost_1_68_0.tar.gz 39 | mkdir -p ext/boost/ 40 | tar xzvf boost.tar.gz -C ./ext/boost/ >/dev/null 41 | 42 | # - name: Build Number 43 | # run: | 44 | # source '${{github.workspace}}/CI/get_package_name.sh' 45 | # echo VCMI_PACKAGE_FILE_NAME="$VCMI_PACKAGE_FILE_NAME" >> $GITHUB_ENV 46 | # echo VCMI_PACKAGE_NAME_SUFFIX="$VCMI_PACKAGE_NAME_SUFFIX" >> $GITHUB_ENV 47 | # env: 48 | # PULL_REQUEST: ${{ github.event.pull_request.number }} 49 | 50 | - name: Build 51 | run: | 52 | chmod +x ./project/gradlew 53 | python ./.github/CI/create_conf.py 54 | python ./update_internal_assets.py 55 | python ./build.py fixpaths 56 | cd ./project 57 | ./gradlew vcmi-app:assembleAllTargetsRelease --info 58 | 59 | - name: Artifacts 60 | uses: actions/upload-artifact@v2 61 | with: 62 | name: vcmi.apk 63 | path: ${{github.workspace}}/project/vcmi-app/build/outputs/apk/AllTargets/release/*.apk 64 | 65 | - name: Upload build 66 | run: | 67 | source '${{github.workspace}}/.github/CI/upload_package.sh' 68 | env: 69 | DEPLOY_RSA: ${{ secrets.DEPLOY_RSA }} 70 | PACKAGE_EXTENSION: apk 71 | 72 | - uses: act10ns/slack@v1 73 | with: 74 | status: ${{ job.status }} 75 | channel: '#notifications' 76 | env: 77 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} 78 | if: always() 79 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /ext/boost/boost*/* 2 | /ext/ff/ffmpeg/ 3 | /ext/ff/x264/ 4 | /ext/SDL2/SDL2-image/code/ 5 | /ext/SDL2/SDL2-mixer/code/ 6 | /ext/SDL2/SDL2-ttf/code/ 7 | /ext-output/ 8 | /obj 9 | /libs 10 | /project/jni/vcmi-app/ 11 | /**/jniLibs/ 12 | /project/build 13 | /project/**/.externalNativeBuild 14 | /project/**/build 15 | /**/.gradle 16 | /project/.idea/workspace.xml 17 | /project/jni/**/*.suo 18 | /__pycache__ 19 | /project/local.properties -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "ext/vcmi"] 2 | path = ext/vcmi 3 | url = https://github.com/vcmi/vcmi.git 4 | branch = develop 5 | [submodule "ext/iconv/code"] 6 | path = ext/iconv/code 7 | url = https://github.com/ironsteel/iconv-android.git 8 | [submodule "ext/oneTBB"] 9 | path = ext/oneTBB 10 | url = https://github.com/oneapi-src/oneTBB.git 11 | [submodule "ext/ff/builder"] 12 | path = ext/ff/builder 13 | url = https://github.com/Javernaut/ffmpeg-android-maker.git 14 | -------------------------------------------------------------------------------- /ext/SDL2/SDL2-image/Application.mk: -------------------------------------------------------------------------------- 1 | APP_MODULES := SDL2_image 2 | APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 3 | APP_PLATFORM := android-21 4 | PROJECT_PATH_BASE := q:/Dev/VCMI/vcmi-android 5 | APP_OPTIM := release 6 | -------------------------------------------------------------------------------- /ext/SDL2/SDL2-image/build.mk: -------------------------------------------------------------------------------- 1 | TMP_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | include $(TMP_PATH)/../SDL2-prebuilt-include.mk 4 | 5 | include $(TMP_PATH)/code/Android.mk -------------------------------------------------------------------------------- /ext/SDL2/SDL2-mixer/Application.mk: -------------------------------------------------------------------------------- 1 | APP_MODULES := SDL2_mixer 2 | APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 3 | APP_PLATFORM := android-21 4 | PROJECT_PATH_BASE := q:/Dev/VCMI/vcmi-android 5 | APP_OPTIM := release 6 | -------------------------------------------------------------------------------- /ext/SDL2/SDL2-mixer/build.mk: -------------------------------------------------------------------------------- 1 | TMP_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | include $(TMP_PATH)/../SDL2-prebuilt-include.mk 5 | include $(TMP_PATH)/code/Android.mk -------------------------------------------------------------------------------- /ext/SDL2/SDL2-prebuilt-include.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := SDL2 5 | LOCAL_SRC_FILES := $(PROJECT_PATH_BASE)/obj/local/$(TARGET_ARCH_ABI)/libSDL2.so 6 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/core/include 7 | include $(PREBUILT_SHARED_LIBRARY) -------------------------------------------------------------------------------- /ext/SDL2/SDL2-ttf/Application.mk: -------------------------------------------------------------------------------- 1 | APP_MODULES := SDL2_ttf 2 | APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 3 | APP_PLATFORM := android-21 4 | PROJECT_PATH_BASE := q:/Dev/VCMI/vcmi-android 5 | APP_OPTIM := release 6 | -------------------------------------------------------------------------------- /ext/SDL2/SDL2-ttf/build.mk: -------------------------------------------------------------------------------- 1 | TMP_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | include $(TMP_PATH)/../SDL2-prebuilt-include.mk 4 | 5 | include $(TMP_PATH)/code/Android.mk -------------------------------------------------------------------------------- /ext/SDL2/core/Application.mk: -------------------------------------------------------------------------------- 1 | APP_MODULES := SDL2 2 | APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 3 | APP_PLATFORM := android-21 4 | PROJECT_PATH_BASE := q:/Dev/VCMI/vcmi-android 5 | APP_OPTIM := release 6 | -------------------------------------------------------------------------------- /ext/SDL2/core/build.mk: -------------------------------------------------------------------------------- 1 | include $(call all-subdir-makefiles) -------------------------------------------------------------------------------- /ext/SDL2/core/include/SDL_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDL_config_h_ 23 | #define SDL_config_h_ 24 | 25 | #include "SDL_platform.h" 26 | 27 | /** 28 | * \file SDL_config.h 29 | */ 30 | 31 | /* Add any platform that doesn't build using the configure system. */ 32 | #if defined(__WIN32__) 33 | #include "SDL_config_windows.h" 34 | #elif defined(__WINRT__) 35 | #include "SDL_config_winrt.h" 36 | #elif defined(__WINGDK__) 37 | #include "SDL_config_wingdk.h" 38 | #elif defined(__XBOXONE__) || defined(__XBOXSERIES__) 39 | #include "SDL_config_xbox.h" 40 | #elif defined(__MACOSX__) 41 | #include "SDL_config_macosx.h" 42 | #elif defined(__IPHONEOS__) 43 | #include "SDL_config_iphoneos.h" 44 | #elif defined(__ANDROID__) 45 | #include "SDL_config_android.h" 46 | #elif defined(__OS2__) 47 | #include "SDL_config_os2.h" 48 | #elif defined(__EMSCRIPTEN__) 49 | #include "SDL_config_emscripten.h" 50 | #elif defined(__NGAGE__) 51 | #include "SDL_config_ngage.h" 52 | #else 53 | /* This is a minimal configuration just to get SDL running on new platforms. */ 54 | #include "SDL_config_minimal.h" 55 | #endif /* platform config */ 56 | 57 | #ifdef USING_GENERATED_CONFIG_H 58 | #error Wrong SDL_config.h, check your include path? 59 | #endif 60 | 61 | #endif /* SDL_config_h_ */ 62 | -------------------------------------------------------------------------------- /ext/SDL2/core/include/SDL_copying.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | -------------------------------------------------------------------------------- /ext/SDL2/core/include/SDL_name.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDLname_h_ 23 | #define SDLname_h_ 24 | 25 | #if defined(__STDC__) || defined(__cplusplus) 26 | #define NeedFunctionPrototypes 1 27 | #endif 28 | 29 | #define SDL_NAME(X) SDL_##X 30 | 31 | #endif /* SDLname_h_ */ 32 | 33 | /* vi: set ts=4 sw=4 expandtab: */ 34 | -------------------------------------------------------------------------------- /ext/SDL2/core/include/SDL_opengles.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 1.X API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #ifdef __IPHONEOS__ 30 | #include 31 | #include 32 | #else 33 | #include 34 | #include 35 | #endif 36 | 37 | #ifndef APIENTRY 38 | #define APIENTRY 39 | #endif 40 | -------------------------------------------------------------------------------- /ext/SDL2/core/include/SDL_opengles2.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles2.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #if !defined(_MSC_VER) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS) 30 | 31 | #ifdef __IPHONEOS__ 32 | #include 33 | #include 34 | #else 35 | #include 36 | #include 37 | #include 38 | #endif 39 | 40 | #else /* _MSC_VER */ 41 | 42 | /* OpenGL ES2 headers for Visual Studio */ 43 | #include "SDL_opengles2_khrplatform.h" 44 | #include "SDL_opengles2_gl2platform.h" 45 | #include "SDL_opengles2_gl2.h" 46 | #include "SDL_opengles2_gl2ext.h" 47 | 48 | #endif /* _MSC_VER */ 49 | 50 | #ifndef APIENTRY 51 | #define APIENTRY GL_APIENTRY 52 | #endif 53 | -------------------------------------------------------------------------------- /ext/SDL2/core/include/SDL_opengles2_gl2platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __gl2platform_h_ 2 | #define __gl2platform_h_ 3 | 4 | /* 5 | ** Copyright 2017-2020 The Khronos Group Inc. 6 | ** SPDX-License-Identifier: Apache-2.0 7 | */ 8 | 9 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h 10 | * 11 | * Adopters may modify khrplatform.h and this file to suit their platform. 12 | * Please contribute modifications back to Khronos as pull requests on the 13 | * public github repository: 14 | * https://github.com/KhronosGroup/OpenGL-Registry 15 | */ 16 | 17 | /*#include */ 18 | 19 | #ifndef GL_APICALL 20 | #define GL_APICALL KHRONOS_APICALL 21 | #endif 22 | 23 | #ifndef GL_APIENTRY 24 | #define GL_APIENTRY KHRONOS_APIENTRY 25 | #endif 26 | 27 | #endif /* __gl2platform_h_ */ 28 | -------------------------------------------------------------------------------- /ext/SDL2/core/include/SDL_quit.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_quit.h 24 | * 25 | * Include file for SDL quit event handling. 26 | */ 27 | 28 | #ifndef SDL_quit_h_ 29 | #define SDL_quit_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | /** 35 | * \file SDL_quit.h 36 | * 37 | * An ::SDL_QUIT event is generated when the user tries to close the application 38 | * window. If it is ignored or filtered out, the window will remain open. 39 | * If it is not ignored or filtered, it is queued normally and the window 40 | * is allowed to close. When the window is closed, screen updates will 41 | * complete, but have no effect. 42 | * 43 | * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) 44 | * and SIGTERM (system termination request), if handlers do not already 45 | * exist, that generate ::SDL_QUIT events as well. There is no way 46 | * to determine the cause of an ::SDL_QUIT event, but setting a signal 47 | * handler in your application will override the default generation of 48 | * quit events for that signal. 49 | * 50 | * \sa SDL_Quit() 51 | */ 52 | 53 | /* There are no functions directly affecting the quit event */ 54 | 55 | #define SDL_QuitRequested() \ 56 | (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) 57 | 58 | #endif /* SDL_quit_h_ */ 59 | -------------------------------------------------------------------------------- /ext/SDL2/core/include/SDL_revision.h: -------------------------------------------------------------------------------- 1 | /* Generated by updaterev.sh, do not edit */ 2 | #ifdef SDL_VENDOR_INFO 3 | #define SDL_REVISION "SDL-release-2.26.1-0-gf17058b56 (" SDL_VENDOR_INFO ")" 4 | #else 5 | #define SDL_REVISION "SDL-release-2.26.1-0-gf17058b56" 6 | #endif 7 | #define SDL_REVISION_NUMBER 0 8 | -------------------------------------------------------------------------------- /ext/SDL2/core/include/SDL_revision.h.cmake: -------------------------------------------------------------------------------- 1 | #cmakedefine SDL_VENDOR_INFO "@SDL_VENDOR_INFO@" 2 | #define SDL_REVISION_NUMBER 0 3 | 4 | #ifdef SDL_VENDOR_INFO 5 | #define SDL_REVISION "@SDL_REVISION@ (" SDL_VENDOR_INFO ")" 6 | #else 7 | #define SDL_REVISION "@SDL_REVISION@" 8 | #endif 9 | -------------------------------------------------------------------------------- /ext/SDL2/core/include/SDL_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_h_ 31 | #define SDL_test_h_ 32 | 33 | #include "SDL.h" 34 | #include "SDL_test_assert.h" 35 | #include "SDL_test_common.h" 36 | #include "SDL_test_compare.h" 37 | #include "SDL_test_crc32.h" 38 | #include "SDL_test_font.h" 39 | #include "SDL_test_fuzzer.h" 40 | #include "SDL_test_harness.h" 41 | #include "SDL_test_images.h" 42 | #include "SDL_test_log.h" 43 | #include "SDL_test_md5.h" 44 | #include "SDL_test_memory.h" 45 | #include "SDL_test_random.h" 46 | 47 | #include "begin_code.h" 48 | /* Set up for C function definitions, even when using C++ */ 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /* Global definitions */ 54 | 55 | /* 56 | * Note: Maximum size of SDLTest log message is less than SDL's limit 57 | * to ensure we can fit additional information such as the timestamp. 58 | */ 59 | #define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584 60 | 61 | /* Ends C function definitions when using C++ */ 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #include "close_code.h" 66 | 67 | #endif /* SDL_test_h_ */ 68 | 69 | /* vi: set ts=4 sw=4 expandtab: */ 70 | -------------------------------------------------------------------------------- /ext/SDL2/core/include/SDL_test_compare.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_compare.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines comparison functions (i.e. for surfaces). 33 | 34 | */ 35 | 36 | #ifndef SDL_test_compare_h_ 37 | #define SDL_test_compare_h_ 38 | 39 | #include "SDL.h" 40 | 41 | #include "SDL_test_images.h" 42 | 43 | #include "begin_code.h" 44 | /* Set up for C function definitions, even when using C++ */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /** 50 | * \brief Compares a surface and with reference image data for equality 51 | * 52 | * \param surface Surface used in comparison 53 | * \param referenceSurface Test Surface used in comparison 54 | * \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy. 55 | * 56 | * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ. 57 | */ 58 | int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error); 59 | 60 | 61 | /* Ends C function definitions when using C++ */ 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #include "close_code.h" 66 | 67 | #endif /* SDL_test_compare_h_ */ 68 | 69 | /* vi: set ts=4 sw=4 expandtab: */ 70 | -------------------------------------------------------------------------------- /ext/SDL2/core/include/SDL_test_images.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_images.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines some images for tests. 33 | 34 | */ 35 | 36 | #ifndef SDL_test_images_h_ 37 | #define SDL_test_images_h_ 38 | 39 | #include "SDL.h" 40 | 41 | #include "begin_code.h" 42 | /* Set up for C function definitions, even when using C++ */ 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /** 48 | *Type for test images. 49 | */ 50 | typedef struct SDLTest_SurfaceImage_s { 51 | int width; 52 | int height; 53 | unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ 54 | const char *pixel_data; 55 | } SDLTest_SurfaceImage_t; 56 | 57 | /* Test images */ 58 | SDL_Surface *SDLTest_ImageBlit(void); 59 | SDL_Surface *SDLTest_ImageBlitColor(void); 60 | SDL_Surface *SDLTest_ImageBlitAlpha(void); 61 | SDL_Surface *SDLTest_ImageBlitBlendAdd(void); 62 | SDL_Surface *SDLTest_ImageBlitBlend(void); 63 | SDL_Surface *SDLTest_ImageBlitBlendMod(void); 64 | SDL_Surface *SDLTest_ImageBlitBlendNone(void); 65 | SDL_Surface *SDLTest_ImageBlitBlendAll(void); 66 | SDL_Surface *SDLTest_ImageFace(void); 67 | SDL_Surface *SDLTest_ImagePrimitives(void); 68 | SDL_Surface *SDLTest_ImagePrimitivesBlend(void); 69 | 70 | /* Ends C function definitions when using C++ */ 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | #include "close_code.h" 75 | 76 | #endif /* SDL_test_images_h_ */ 77 | 78 | /* vi: set ts=4 sw=4 expandtab: */ 79 | -------------------------------------------------------------------------------- /ext/SDL2/core/include/SDL_test_log.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_log.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | * 32 | * Wrapper to log in the TEST category 33 | * 34 | */ 35 | 36 | #ifndef SDL_test_log_h_ 37 | #define SDL_test_log_h_ 38 | 39 | #include "begin_code.h" 40 | /* Set up for C function definitions, even when using C++ */ 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | /** 46 | * \brief Prints given message with a timestamp in the TEST category and INFO priority. 47 | * 48 | * \param fmt Message to be logged 49 | */ 50 | void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 51 | 52 | /** 53 | * \brief Prints given message with a timestamp in the TEST category and the ERROR priority. 54 | * 55 | * \param fmt Message to be logged 56 | */ 57 | void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 58 | 59 | /* Ends C function definitions when using C++ */ 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | #include "close_code.h" 64 | 65 | #endif /* SDL_test_log_h_ */ 66 | 67 | /* vi: set ts=4 sw=4 expandtab: */ 68 | -------------------------------------------------------------------------------- /ext/SDL2/core/include/SDL_test_memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_memory.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_memory_h_ 31 | #define SDL_test_memory_h_ 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | 40 | /** 41 | * \brief Start tracking SDL memory allocations 42 | * 43 | * \note This should be called before any other SDL functions for complete tracking coverage 44 | */ 45 | int SDLTest_TrackAllocations(void); 46 | 47 | /** 48 | * \brief Print a log of any outstanding allocations 49 | * 50 | * \note This can be called after SDL_Quit() 51 | */ 52 | void SDLTest_LogAllocations(void); 53 | 54 | 55 | /* Ends C function definitions when using C++ */ 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #include "close_code.h" 60 | 61 | #endif /* SDL_test_memory_h_ */ 62 | 63 | /* vi: set ts=4 sw=4 expandtab: */ 64 | -------------------------------------------------------------------------------- /ext/SDL2/core/include/SDL_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_types.h 24 | * 25 | * \deprecated 26 | */ 27 | 28 | /* DEPRECATED */ 29 | #include "SDL_stdinc.h" 30 | -------------------------------------------------------------------------------- /ext/SDL2/core/include/close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file close_code.h 24 | * 25 | * This file reverses the effects of begin_code.h and should be included 26 | * after you finish any function and structure declarations in your headers 27 | */ 28 | 29 | #ifndef _begin_code_h 30 | #error close_code.h included without matching begin_code.h 31 | #endif 32 | #undef _begin_code_h 33 | 34 | /* Reset structure packing at previous byte alignment */ 35 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) 36 | #ifdef __BORLANDC__ 37 | #pragma nopackwarning 38 | #endif 39 | #pragma pack(pop) 40 | #endif /* Compiler needs structure packing set */ 41 | -------------------------------------------------------------------------------- /ext/ff/include/libavcodec/ac3_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AC-3 parser prototypes 3 | * Copyright (c) 2003 Fabrice Bellard 4 | * Copyright (c) 2003 Michael Niedermayer 5 | * 6 | * This file is part of FFmpeg. 7 | * 8 | * FFmpeg is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * FFmpeg is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with FFmpeg; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef AVCODEC_AC3_PARSER_H 24 | #define AVCODEC_AC3_PARSER_H 25 | 26 | #include 27 | #include 28 | 29 | /** 30 | * Extract the bitstream ID and the frame size from AC-3 data. 31 | */ 32 | int av_ac3_parse_header(const uint8_t *buf, size_t size, 33 | uint8_t *bitstream_id, uint16_t *frame_size); 34 | 35 | 36 | #endif /* AVCODEC_AC3_PARSER_H */ 37 | -------------------------------------------------------------------------------- /ext/ff/include/libavcodec/adts_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVCODEC_ADTS_PARSER_H 20 | #define AVCODEC_ADTS_PARSER_H 21 | 22 | #include 23 | #include 24 | 25 | #define AV_AAC_ADTS_HEADER_SIZE 7 26 | 27 | /** 28 | * Extract the number of samples and frames from AAC data. 29 | * @param[in] buf pointer to AAC data buffer 30 | * @param[out] samples Pointer to where number of samples is written 31 | * @param[out] frames Pointer to where number of frames is written 32 | * @return Returns 0 on success, error code on failure. 33 | */ 34 | int av_adts_header_parse(const uint8_t *buf, uint32_t *samples, 35 | uint8_t *frames); 36 | 37 | #endif /* AVCODEC_ADTS_PARSER_H */ 38 | -------------------------------------------------------------------------------- /ext/ff/include/libavcodec/jni.h: -------------------------------------------------------------------------------- 1 | /* 2 | * JNI public API functions 3 | * 4 | * Copyright (c) 2015-2016 Matthieu Bouron 5 | * 6 | * This file is part of FFmpeg. 7 | * 8 | * FFmpeg is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * FFmpeg is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with FFmpeg; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef AVCODEC_JNI_H 24 | #define AVCODEC_JNI_H 25 | 26 | /* 27 | * Manually set a Java virtual machine which will be used to retrieve the JNI 28 | * environment. Once a Java VM is set it cannot be changed afterwards, meaning 29 | * you can call multiple times av_jni_set_java_vm with the same Java VM pointer 30 | * however it will error out if you try to set a different Java VM. 31 | * 32 | * @param vm Java virtual machine 33 | * @param log_ctx context used for logging, can be NULL 34 | * @return 0 on success, < 0 otherwise 35 | */ 36 | int av_jni_set_java_vm(void *vm, void *log_ctx); 37 | 38 | /* 39 | * Get the Java virtual machine which has been set with av_jni_set_java_vm. 40 | * 41 | * @param vm Java virtual machine 42 | * @return a pointer to the Java virtual machine 43 | */ 44 | void *av_jni_get_java_vm(void *log_ctx); 45 | 46 | #endif /* AVCODEC_JNI_H */ 47 | -------------------------------------------------------------------------------- /ext/ff/include/libavcodec/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVCODEC_VERSION_H 20 | #define AVCODEC_VERSION_H 21 | 22 | /** 23 | * @file 24 | * @ingroup libavc 25 | * Libavcodec version macros. 26 | */ 27 | 28 | #include "libavutil/version.h" 29 | 30 | #include "version_major.h" 31 | 32 | #define LIBAVCODEC_VERSION_MINOR 37 33 | #define LIBAVCODEC_VERSION_MICRO 100 34 | 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ 36 | LIBAVCODEC_VERSION_MINOR, \ 37 | LIBAVCODEC_VERSION_MICRO) 38 | #define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ 39 | LIBAVCODEC_VERSION_MINOR, \ 40 | LIBAVCODEC_VERSION_MICRO) 41 | #define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT 42 | 43 | #define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) 44 | 45 | #endif /* AVCODEC_VERSION_H */ 46 | -------------------------------------------------------------------------------- /ext/ff/include/libavcodec/version_major.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVCODEC_VERSION_MAJOR_H 20 | #define AVCODEC_VERSION_MAJOR_H 21 | 22 | /** 23 | * @file 24 | * @ingroup libavc 25 | * Libavcodec version macros. 26 | */ 27 | 28 | #define LIBAVCODEC_VERSION_MAJOR 59 29 | 30 | /** 31 | * FF_API_* defines may be placed below to indicate public API that will be 32 | * dropped at a future version bump. The defines themselves are not part of 33 | * the public API and may change, break or disappear at any time. 34 | * 35 | * @note, when bumping the major version it is recommended to manually 36 | * disable each FF_API_* in its own commit instead of disabling them all 37 | * at once through the bump. This improves the git bisect-ability of the change. 38 | */ 39 | 40 | #define FF_API_OPENH264_SLICE_MODE (LIBAVCODEC_VERSION_MAJOR < 60) 41 | #define FF_API_OPENH264_CABAC (LIBAVCODEC_VERSION_MAJOR < 60) 42 | #define FF_API_UNUSED_CODEC_CAPS (LIBAVCODEC_VERSION_MAJOR < 60) 43 | #define FF_API_THREAD_SAFE_CALLBACKS (LIBAVCODEC_VERSION_MAJOR < 60) 44 | #define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 60) 45 | #define FF_API_GET_FRAME_CLASS (LIBAVCODEC_VERSION_MAJOR < 60) 46 | #define FF_API_AUTO_THREADS (LIBAVCODEC_VERSION_MAJOR < 60) 47 | #define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 60) 48 | #define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 60) 49 | #define FF_API_FLAG_TRUNCATED (LIBAVCODEC_VERSION_MAJOR < 60) 50 | #define FF_API_SUB_TEXT_FORMAT (LIBAVCODEC_VERSION_MAJOR < 60) 51 | #define FF_API_IDCT_NONE (LIBAVCODEC_VERSION_MAJOR < 60) 52 | #define FF_API_SVTAV1_OPTS (LIBAVCODEC_VERSION_MAJOR < 60) 53 | 54 | #endif /* AVCODEC_VERSION_MAJOR_H */ 55 | -------------------------------------------------------------------------------- /ext/ff/include/libavdevice/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVDEVICE_VERSION_H 20 | #define AVDEVICE_VERSION_H 21 | 22 | /** 23 | * @file 24 | * @ingroup lavd 25 | * Libavdevice version macros 26 | */ 27 | 28 | #include "libavutil/version.h" 29 | 30 | #include "version_major.h" 31 | 32 | #define LIBAVDEVICE_VERSION_MINOR 7 33 | #define LIBAVDEVICE_VERSION_MICRO 100 34 | 35 | #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \ 36 | LIBAVDEVICE_VERSION_MINOR, \ 37 | LIBAVDEVICE_VERSION_MICRO) 38 | #define LIBAVDEVICE_VERSION AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, \ 39 | LIBAVDEVICE_VERSION_MINOR, \ 40 | LIBAVDEVICE_VERSION_MICRO) 41 | #define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT 42 | 43 | #define LIBAVDEVICE_IDENT "Lavd" AV_STRINGIFY(LIBAVDEVICE_VERSION) 44 | 45 | #endif /* AVDEVICE_VERSION_H */ 46 | -------------------------------------------------------------------------------- /ext/ff/include/libavdevice/version_major.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVDEVICE_VERSION_MAJOR_H 20 | #define AVDEVICE_VERSION_MAJOR_H 21 | 22 | /** 23 | * @file 24 | * @ingroup lavd 25 | * Libavdevice version macros 26 | */ 27 | 28 | #define LIBAVDEVICE_VERSION_MAJOR 59 29 | 30 | /** 31 | * FF_API_* defines may be placed below to indicate public API that will be 32 | * dropped at a future version bump. The defines themselves are not part of 33 | * the public API and may change, break or disappear at any time. 34 | */ 35 | #define FF_API_DEVICE_CAPABILITIES (LIBAVDEVICE_VERSION_MAJOR < 60) 36 | 37 | #endif /* AVDEVICE_VERSION_MAJOR_H */ 38 | -------------------------------------------------------------------------------- /ext/ff/include/libavfilter/avfiltergraph.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Filter graphs 3 | * copyright (c) 2007 Bobby Bingham 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVFILTER_AVFILTERGRAPH_H 23 | #define AVFILTER_AVFILTERGRAPH_H 24 | 25 | #include "avfilter.h" 26 | #include "libavutil/log.h" 27 | 28 | #endif /* AVFILTER_AVFILTERGRAPH_H */ 29 | -------------------------------------------------------------------------------- /ext/ff/include/libavfilter/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version macros. 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVFILTER_VERSION_H 22 | #define AVFILTER_VERSION_H 23 | 24 | /** 25 | * @file 26 | * @ingroup lavfi 27 | * Libavfilter version macros 28 | */ 29 | 30 | #include "libavutil/version.h" 31 | 32 | #include "version_major.h" 33 | 34 | #define LIBAVFILTER_VERSION_MINOR 44 35 | #define LIBAVFILTER_VERSION_MICRO 100 36 | 37 | 38 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ 39 | LIBAVFILTER_VERSION_MINOR, \ 40 | LIBAVFILTER_VERSION_MICRO) 41 | #define LIBAVFILTER_VERSION AV_VERSION(LIBAVFILTER_VERSION_MAJOR, \ 42 | LIBAVFILTER_VERSION_MINOR, \ 43 | LIBAVFILTER_VERSION_MICRO) 44 | #define LIBAVFILTER_BUILD LIBAVFILTER_VERSION_INT 45 | 46 | #define LIBAVFILTER_IDENT "Lavfi" AV_STRINGIFY(LIBAVFILTER_VERSION) 47 | 48 | #endif /* AVFILTER_VERSION_H */ 49 | -------------------------------------------------------------------------------- /ext/ff/include/libavfilter/version_major.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version macros. 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVFILTER_VERSION_MAJOR_H 22 | #define AVFILTER_VERSION_MAJOR_H 23 | 24 | /** 25 | * @file 26 | * @ingroup lavfi 27 | * Libavfilter version macros 28 | */ 29 | 30 | #define LIBAVFILTER_VERSION_MAJOR 8 31 | 32 | /** 33 | * FF_API_* defines may be placed below to indicate public API that will be 34 | * dropped at a future version bump. The defines themselves are not part of 35 | * the public API and may change, break or disappear at any time. 36 | */ 37 | 38 | #define FF_API_SWS_PARAM_OPTION (LIBAVFILTER_VERSION_MAJOR < 9) 39 | #define FF_API_BUFFERSINK_ALLOC (LIBAVFILTER_VERSION_MAJOR < 9) 40 | #define FF_API_PAD_COUNT (LIBAVFILTER_VERSION_MAJOR < 9) 41 | 42 | #endif /* AVFILTER_VERSION_MAJOR_H */ 43 | -------------------------------------------------------------------------------- /ext/ff/include/libavformat/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version macros. 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVFORMAT_VERSION_H 22 | #define AVFORMAT_VERSION_H 23 | 24 | /** 25 | * @file 26 | * @ingroup libavf 27 | * Libavformat version macros 28 | */ 29 | 30 | #include "libavutil/version.h" 31 | 32 | #include "version_major.h" 33 | 34 | #define LIBAVFORMAT_VERSION_MINOR 27 35 | #define LIBAVFORMAT_VERSION_MICRO 100 36 | 37 | #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ 38 | LIBAVFORMAT_VERSION_MINOR, \ 39 | LIBAVFORMAT_VERSION_MICRO) 40 | #define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ 41 | LIBAVFORMAT_VERSION_MINOR, \ 42 | LIBAVFORMAT_VERSION_MICRO) 43 | #define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT 44 | 45 | #define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) 46 | 47 | #endif /* AVFORMAT_VERSION_H */ 48 | -------------------------------------------------------------------------------- /ext/ff/include/libavformat/version_major.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version macros. 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVFORMAT_VERSION_MAJOR_H 22 | #define AVFORMAT_VERSION_MAJOR_H 23 | 24 | /** 25 | * @file 26 | * @ingroup libavf 27 | * Libavformat version macros 28 | */ 29 | 30 | // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) 31 | // Also please add any ticket numbers that you believe might be affected here 32 | #define LIBAVFORMAT_VERSION_MAJOR 59 33 | 34 | /** 35 | * FF_API_* defines may be placed below to indicate public API that will be 36 | * dropped at a future version bump. The defines themselves are not part of 37 | * the public API and may change, break or disappear at any time. 38 | * 39 | * @note, when bumping the major version it is recommended to manually 40 | * disable each FF_API_* in its own commit instead of disabling them all 41 | * at once through the bump. This improves the git bisect-ability of the change. 42 | * 43 | */ 44 | #define FF_API_LAVF_PRIV_OPT (LIBAVFORMAT_VERSION_MAJOR < 60) 45 | #define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 60) 46 | #define FF_API_AVIOCONTEXT_WRITTEN (LIBAVFORMAT_VERSION_MAJOR < 60) 47 | #define FF_HLS_TS_OPTIONS (LIBAVFORMAT_VERSION_MAJOR < 60) 48 | #define FF_API_AVSTREAM_CLASS (LIBAVFORMAT_VERSION_MAJOR > 59) 49 | 50 | 51 | #define FF_API_R_FRAME_RATE 1 52 | 53 | #endif /* AVFORMAT_VERSION_MAJOR_H */ 54 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/adler32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Mans Rullgard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * @ingroup lavu_adler32 24 | * Public header for Adler-32 hash function implementation. 25 | */ 26 | 27 | #ifndef AVUTIL_ADLER32_H 28 | #define AVUTIL_ADLER32_H 29 | 30 | #include 31 | #include 32 | #include "attributes.h" 33 | 34 | /** 35 | * @defgroup lavu_adler32 Adler-32 36 | * @ingroup lavu_hash 37 | * Adler-32 hash function implementation. 38 | * 39 | * @{ 40 | */ 41 | 42 | typedef uint32_t AVAdler; 43 | 44 | /** 45 | * Calculate the Adler32 checksum of a buffer. 46 | * 47 | * Passing the return value to a subsequent av_adler32_update() call 48 | * allows the checksum of multiple buffers to be calculated as though 49 | * they were concatenated. 50 | * 51 | * @param adler initial checksum value 52 | * @param buf pointer to input buffer 53 | * @param len size of input buffer 54 | * @return updated checksum 55 | */ 56 | AVAdler av_adler32_update(AVAdler adler, const uint8_t *buf, 57 | size_t len) av_pure; 58 | 59 | /** 60 | * @} 61 | */ 62 | 63 | #endif /* AVUTIL_ADLER32_H */ 64 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/aes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2007 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_AES_H 22 | #define AVUTIL_AES_H 23 | 24 | #include 25 | 26 | #include "attributes.h" 27 | 28 | /** 29 | * @defgroup lavu_aes AES 30 | * @ingroup lavu_crypto 31 | * @{ 32 | */ 33 | 34 | extern const int av_aes_size; 35 | 36 | struct AVAES; 37 | 38 | /** 39 | * Allocate an AVAES context. 40 | */ 41 | struct AVAES *av_aes_alloc(void); 42 | 43 | /** 44 | * Initialize an AVAES context. 45 | * @param key_bits 128, 192 or 256 46 | * @param decrypt 0 for encryption, 1 for decryption 47 | */ 48 | int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); 49 | 50 | /** 51 | * Encrypt or decrypt a buffer using a previously initialized context. 52 | * @param count number of 16 byte blocks 53 | * @param dst destination array, can be equal to src 54 | * @param src source array, can be equal to dst 55 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 56 | * @param decrypt 0 for encryption, 1 for decryption 57 | */ 58 | void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | #endif /* AVUTIL_AES_H */ 65 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/avconfig.h: -------------------------------------------------------------------------------- 1 | /* Generated by ffmpeg configure */ 2 | #ifndef AVUTIL_AVCONFIG_H 3 | #define AVUTIL_AVCONFIG_H 4 | #define AV_HAVE_BIGENDIAN 0 5 | #define AV_HAVE_FAST_UNALIGNED 1 6 | #endif /* AVUTIL_AVCONFIG_H */ 7 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com) 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_BASE64_H 22 | #define AVUTIL_BASE64_H 23 | 24 | #include 25 | 26 | /** 27 | * @defgroup lavu_base64 Base64 28 | * @ingroup lavu_crypto 29 | * @{ 30 | */ 31 | 32 | /** 33 | * Decode a base64-encoded string. 34 | * 35 | * @param out buffer for decoded data 36 | * @param in null-terminated input string 37 | * @param out_size size in bytes of the out buffer, must be at 38 | * least 3/4 of the length of in, that is AV_BASE64_DECODE_SIZE(strlen(in)) 39 | * @return number of bytes written, or a negative value in case of 40 | * invalid input 41 | */ 42 | int av_base64_decode(uint8_t *out, const char *in, int out_size); 43 | 44 | /** 45 | * Calculate the output size in bytes needed to decode a base64 string 46 | * with length x to a data buffer. 47 | */ 48 | #define AV_BASE64_DECODE_SIZE(x) ((x) * 3LL / 4) 49 | 50 | /** 51 | * Encode data to base64 and null-terminate. 52 | * 53 | * @param out buffer for encoded data 54 | * @param out_size size in bytes of the out buffer (including the 55 | * null terminator), must be at least AV_BASE64_SIZE(in_size) 56 | * @param in input buffer containing the data to encode 57 | * @param in_size size in bytes of the in buffer 58 | * @return out or NULL in case of error 59 | */ 60 | char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); 61 | 62 | /** 63 | * Calculate the output size needed to base64-encode x bytes to a 64 | * null-terminated string. 65 | */ 66 | #define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | #endif /* AVUTIL_BASE64_H */ 73 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/camellia.h: -------------------------------------------------------------------------------- 1 | /* 2 | * An implementation of the CAMELLIA algorithm as mentioned in RFC3713 3 | * Copyright (c) 2014 Supraja Meedinti 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_CAMELLIA_H 23 | #define AVUTIL_CAMELLIA_H 24 | 25 | #include 26 | 27 | 28 | /** 29 | * @file 30 | * @brief Public header for libavutil CAMELLIA algorithm 31 | * @defgroup lavu_camellia CAMELLIA 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_camellia_size; 37 | 38 | struct AVCAMELLIA; 39 | 40 | /** 41 | * Allocate an AVCAMELLIA context 42 | * To free the struct: av_free(ptr) 43 | */ 44 | struct AVCAMELLIA *av_camellia_alloc(void); 45 | 46 | /** 47 | * Initialize an AVCAMELLIA context. 48 | * 49 | * @param ctx an AVCAMELLIA context 50 | * @param key a key of 16, 24, 32 bytes used for encryption/decryption 51 | * @param key_bits number of keybits: possible are 128, 192, 256 52 | */ 53 | int av_camellia_init(struct AVCAMELLIA *ctx, const uint8_t *key, int key_bits); 54 | 55 | /** 56 | * Encrypt or decrypt a buffer using a previously initialized context 57 | * 58 | * @param ctx an AVCAMELLIA context 59 | * @param dst destination array, can be equal to src 60 | * @param src source array, can be equal to dst 61 | * @param count number of 16 byte blocks 62 | * @paran iv initialization vector for CBC mode, NULL for ECB mode 63 | * @param decrypt 0 for encryption, 1 for decryption 64 | */ 65 | void av_camellia_crypt(struct AVCAMELLIA *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt); 66 | 67 | /** 68 | * @} 69 | */ 70 | #endif /* AVUTIL_CAMELLIA_H */ 71 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/ffversion.h: -------------------------------------------------------------------------------- 1 | /* Automatically generated by version.sh, do not manually edit! */ 2 | #ifndef AVUTIL_FFVERSION_H 3 | #define AVUTIL_FFVERSION_H 4 | #define FFMPEG_VERSION "n5.1.2-10-g070b38167c" 5 | #endif /* AVUTIL_FFVERSION_H */ 6 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/hwcontext_cuda.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | 20 | #ifndef AVUTIL_HWCONTEXT_CUDA_H 21 | #define AVUTIL_HWCONTEXT_CUDA_H 22 | 23 | #ifndef CUDA_VERSION 24 | #include 25 | #endif 26 | 27 | #include "pixfmt.h" 28 | 29 | /** 30 | * @file 31 | * An API-specific header for AV_HWDEVICE_TYPE_CUDA. 32 | * 33 | * This API supports dynamic frame pools. AVHWFramesContext.pool must return 34 | * AVBufferRefs whose data pointer is a CUdeviceptr. 35 | */ 36 | 37 | typedef struct AVCUDADeviceContextInternal AVCUDADeviceContextInternal; 38 | 39 | /** 40 | * This struct is allocated as AVHWDeviceContext.hwctx 41 | */ 42 | typedef struct AVCUDADeviceContext { 43 | CUcontext cuda_ctx; 44 | CUstream stream; 45 | AVCUDADeviceContextInternal *internal; 46 | } AVCUDADeviceContext; 47 | 48 | /** 49 | * AVHWFramesContext.hwctx is currently not used 50 | */ 51 | 52 | /** 53 | * @defgroup hwcontext_cuda Device context creation flags 54 | * 55 | * Flags for av_hwdevice_ctx_create. 56 | * 57 | * @{ 58 | */ 59 | 60 | /** 61 | * Use primary device context instead of creating a new one. 62 | */ 63 | #define AV_CUDA_USE_PRIMARY_CONTEXT (1 << 0) 64 | 65 | /** 66 | * @} 67 | */ 68 | 69 | #endif /* AVUTIL_HWCONTEXT_CUDA_H */ 70 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/hwcontext_mediacodec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_HWCONTEXT_MEDIACODEC_H 20 | #define AVUTIL_HWCONTEXT_MEDIACODEC_H 21 | 22 | /** 23 | * MediaCodec details. 24 | * 25 | * Allocated as AVHWDeviceContext.hwctx 26 | */ 27 | typedef struct AVMediaCodecDeviceContext { 28 | /** 29 | * android/view/Surface handle, to be filled by the user. 30 | * 31 | * This is the default surface used by decoders on this device. 32 | */ 33 | void *surface; 34 | } AVMediaCodecDeviceContext; 35 | 36 | #endif /* AVUTIL_HWCONTEXT_MEDIACODEC_H */ 37 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/hwcontext_qsv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_HWCONTEXT_QSV_H 20 | #define AVUTIL_HWCONTEXT_QSV_H 21 | 22 | #include 23 | 24 | /** 25 | * @file 26 | * An API-specific header for AV_HWDEVICE_TYPE_QSV. 27 | * 28 | * This API does not support dynamic frame pools. AVHWFramesContext.pool must 29 | * contain AVBufferRefs whose data pointer points to an mfxFrameSurface1 struct. 30 | */ 31 | 32 | /** 33 | * This struct is allocated as AVHWDeviceContext.hwctx 34 | */ 35 | typedef struct AVQSVDeviceContext { 36 | mfxSession session; 37 | } AVQSVDeviceContext; 38 | 39 | /** 40 | * This struct is allocated as AVHWFramesContext.hwctx 41 | */ 42 | typedef struct AVQSVFramesContext { 43 | mfxFrameSurface1 *surfaces; 44 | int nb_surfaces; 45 | 46 | /** 47 | * A combination of MFX_MEMTYPE_* describing the frame pool. 48 | */ 49 | int frame_type; 50 | } AVQSVFramesContext; 51 | 52 | #endif /* AVUTIL_HWCONTEXT_QSV_H */ 53 | 54 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/hwcontext_vdpau.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_HWCONTEXT_VDPAU_H 20 | #define AVUTIL_HWCONTEXT_VDPAU_H 21 | 22 | #include 23 | 24 | /** 25 | * @file 26 | * An API-specific header for AV_HWDEVICE_TYPE_VDPAU. 27 | * 28 | * This API supports dynamic frame pools. AVHWFramesContext.pool must return 29 | * AVBufferRefs whose data pointer is a VdpVideoSurface. 30 | */ 31 | 32 | /** 33 | * This struct is allocated as AVHWDeviceContext.hwctx 34 | */ 35 | typedef struct AVVDPAUDeviceContext { 36 | VdpDevice device; 37 | VdpGetProcAddress *get_proc_address; 38 | } AVVDPAUDeviceContext; 39 | 40 | /** 41 | * AVHWFramesContext.hwctx is currently not used 42 | */ 43 | 44 | #endif /* AVUTIL_HWCONTEXT_VDPAU_H */ 45 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/intfloat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Mans Rullgard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_INTFLOAT_H 22 | #define AVUTIL_INTFLOAT_H 23 | 24 | #include 25 | #include "attributes.h" 26 | 27 | union av_intfloat32 { 28 | uint32_t i; 29 | float f; 30 | }; 31 | 32 | union av_intfloat64 { 33 | uint64_t i; 34 | double f; 35 | }; 36 | 37 | /** 38 | * Reinterpret a 32-bit integer as a float. 39 | */ 40 | static av_always_inline float av_int2float(uint32_t i) 41 | { 42 | union av_intfloat32 v; 43 | v.i = i; 44 | return v.f; 45 | } 46 | 47 | /** 48 | * Reinterpret a float as a 32-bit integer. 49 | */ 50 | static av_always_inline uint32_t av_float2int(float f) 51 | { 52 | union av_intfloat32 v; 53 | v.f = f; 54 | return v.i; 55 | } 56 | 57 | /** 58 | * Reinterpret a 64-bit integer as a double. 59 | */ 60 | static av_always_inline double av_int2double(uint64_t i) 61 | { 62 | union av_intfloat64 v; 63 | v.i = i; 64 | return v.f; 65 | } 66 | 67 | /** 68 | * Reinterpret a double as a 64-bit integer. 69 | */ 70 | static av_always_inline uint64_t av_double2int(double f) 71 | { 72 | union av_intfloat64 v; 73 | v.f = f; 74 | return v.i; 75 | } 76 | 77 | #endif /* AVUTIL_INTFLOAT_H */ 78 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/lzo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LZO 1x decompression 3 | * copyright (c) 2006 Reimar Doeffinger 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_LZO_H 23 | #define AVUTIL_LZO_H 24 | 25 | /** 26 | * @defgroup lavu_lzo LZO 27 | * @ingroup lavu_crypto 28 | * 29 | * @{ 30 | */ 31 | 32 | #include 33 | 34 | /** @name Error flags returned by av_lzo1x_decode 35 | * @{ */ 36 | /// end of the input buffer reached before decoding finished 37 | #define AV_LZO_INPUT_DEPLETED 1 38 | /// decoded data did not fit into output buffer 39 | #define AV_LZO_OUTPUT_FULL 2 40 | /// a reference to previously decoded data was wrong 41 | #define AV_LZO_INVALID_BACKPTR 4 42 | /// a non-specific error in the compressed bitstream 43 | #define AV_LZO_ERROR 8 44 | /** @} */ 45 | 46 | #define AV_LZO_INPUT_PADDING 8 47 | #define AV_LZO_OUTPUT_PADDING 12 48 | 49 | /** 50 | * @brief Decodes LZO 1x compressed data. 51 | * @param out output buffer 52 | * @param outlen size of output buffer, number of bytes left are returned here 53 | * @param in input buffer 54 | * @param inlen size of input buffer, number of bytes left are returned here 55 | * @return 0 on success, otherwise a combination of the error flags above 56 | * 57 | * Make sure all buffers are appropriately padded, in must provide 58 | * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes. 59 | */ 60 | int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | #endif /* AVUTIL_LZO_H */ 67 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * @ingroup lavu_md5 24 | * Public header for MD5 hash function implementation. 25 | */ 26 | 27 | #ifndef AVUTIL_MD5_H 28 | #define AVUTIL_MD5_H 29 | 30 | #include 31 | #include 32 | 33 | #include "attributes.h" 34 | 35 | /** 36 | * @defgroup lavu_md5 MD5 37 | * @ingroup lavu_hash 38 | * MD5 hash function implementation. 39 | * 40 | * @{ 41 | */ 42 | 43 | extern const int av_md5_size; 44 | 45 | struct AVMD5; 46 | 47 | /** 48 | * Allocate an AVMD5 context. 49 | */ 50 | struct AVMD5 *av_md5_alloc(void); 51 | 52 | /** 53 | * Initialize MD5 hashing. 54 | * 55 | * @param ctx pointer to the function context (of size av_md5_size) 56 | */ 57 | void av_md5_init(struct AVMD5 *ctx); 58 | 59 | /** 60 | * Update hash value. 61 | * 62 | * @param ctx hash function context 63 | * @param src input data to update hash with 64 | * @param len input data length 65 | */ 66 | void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, size_t len); 67 | 68 | /** 69 | * Finish hashing and output digest value. 70 | * 71 | * @param ctx hash function context 72 | * @param dst buffer where output digest value is stored 73 | */ 74 | void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); 75 | 76 | /** 77 | * Hash an array of data. 78 | * 79 | * @param dst The output buffer to write the digest into 80 | * @param src The data to hash 81 | * @param len The length of the data, in bytes 82 | */ 83 | void av_md5_sum(uint8_t *dst, const uint8_t *src, size_t len); 84 | 85 | /** 86 | * @} 87 | */ 88 | 89 | #endif /* AVUTIL_MD5_H */ 90 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/motion_vector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_MOTION_VECTOR_H 20 | #define AVUTIL_MOTION_VECTOR_H 21 | 22 | #include 23 | 24 | typedef struct AVMotionVector { 25 | /** 26 | * Where the current macroblock comes from; negative value when it comes 27 | * from the past, positive value when it comes from the future. 28 | * XXX: set exact relative ref frame reference instead of a +/- 1 "direction". 29 | */ 30 | int32_t source; 31 | /** 32 | * Width and height of the block. 33 | */ 34 | uint8_t w, h; 35 | /** 36 | * Absolute source position. Can be outside the frame area. 37 | */ 38 | int16_t src_x, src_y; 39 | /** 40 | * Absolute destination position. Can be outside the frame area. 41 | */ 42 | int16_t dst_x, dst_y; 43 | /** 44 | * Extra flag information. 45 | * Currently unused. 46 | */ 47 | uint64_t flags; 48 | /** 49 | * Motion vector 50 | * src_x = dst_x + motion_x / motion_scale 51 | * src_y = dst_y + motion_y / motion_scale 52 | */ 53 | int32_t motion_x, motion_y; 54 | uint16_t motion_scale; 55 | } AVMotionVector; 56 | 57 | #endif /* AVUTIL_MOTION_VECTOR_H */ 58 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/pixelutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_PIXELUTILS_H 20 | #define AVUTIL_PIXELUTILS_H 21 | 22 | #include 23 | #include 24 | 25 | /** 26 | * Sum of abs(src1[x] - src2[x]) 27 | */ 28 | typedef int (*av_pixelutils_sad_fn)(const uint8_t *src1, ptrdiff_t stride1, 29 | const uint8_t *src2, ptrdiff_t stride2); 30 | 31 | /** 32 | * Get a potentially optimized pointer to a Sum-of-absolute-differences 33 | * function (see the av_pixelutils_sad_fn prototype). 34 | * 35 | * @param w_bits 1< 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_RANDOM_SEED_H 22 | #define AVUTIL_RANDOM_SEED_H 23 | 24 | #include 25 | /** 26 | * @addtogroup lavu_crypto 27 | * @{ 28 | */ 29 | 30 | /** 31 | * Get a seed to use in conjunction with random functions. 32 | * This function tries to provide a good seed at a best effort bases. 33 | * Its possible to call this function multiple times if more bits are needed. 34 | * It can be quite slow, which is why it should only be used as seed for a faster 35 | * PRNG. The quality of the seed depends on the platform. 36 | */ 37 | uint32_t av_get_random_seed(void); 38 | 39 | /** 40 | * @} 41 | */ 42 | 43 | #endif /* AVUTIL_RANDOM_SEED_H */ 44 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/rc4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RC4 encryption/decryption/pseudo-random number generator 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_RC4_H 22 | #define AVUTIL_RC4_H 23 | 24 | #include 25 | 26 | /** 27 | * @defgroup lavu_rc4 RC4 28 | * @ingroup lavu_crypto 29 | * @{ 30 | */ 31 | 32 | typedef struct AVRC4 { 33 | uint8_t state[256]; 34 | int x, y; 35 | } AVRC4; 36 | 37 | /** 38 | * Allocate an AVRC4 context. 39 | */ 40 | AVRC4 *av_rc4_alloc(void); 41 | 42 | /** 43 | * @brief Initializes an AVRC4 context. 44 | * 45 | * @param key_bits must be a multiple of 8 46 | * @param decrypt 0 for encryption, 1 for decryption, currently has no effect 47 | * @return zero on success, negative value otherwise 48 | */ 49 | int av_rc4_init(struct AVRC4 *d, const uint8_t *key, int key_bits, int decrypt); 50 | 51 | /** 52 | * @brief Encrypts / decrypts using the RC4 algorithm. 53 | * 54 | * @param count number of bytes 55 | * @param dst destination array, can be equal to src 56 | * @param src source array, can be equal to dst, may be NULL 57 | * @param iv not (yet) used for RC4, should be NULL 58 | * @param decrypt 0 for encryption, 1 for decryption, not (yet) used 59 | */ 60 | void av_rc4_crypt(struct AVRC4 *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | #endif /* AVUTIL_RC4_H */ 67 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/replaygain.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_REPLAYGAIN_H 20 | #define AVUTIL_REPLAYGAIN_H 21 | 22 | #include 23 | 24 | /** 25 | * ReplayGain information (see 26 | * http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification). 27 | * The size of this struct is a part of the public ABI. 28 | */ 29 | typedef struct AVReplayGain { 30 | /** 31 | * Track replay gain in microbels (divide by 100000 to get the value in dB). 32 | * Should be set to INT32_MIN when unknown. 33 | */ 34 | int32_t track_gain; 35 | /** 36 | * Peak track amplitude, with 100000 representing full scale (but values 37 | * may overflow). 0 when unknown. 38 | */ 39 | uint32_t track_peak; 40 | /** 41 | * Same as track_gain, but for the whole album. 42 | */ 43 | int32_t album_gain; 44 | /** 45 | * Same as track_peak, but for the whole album, 46 | */ 47 | uint32_t album_peak; 48 | } AVReplayGain; 49 | 50 | #endif /* AVUTIL_REPLAYGAIN_H */ 51 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/ripemd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * Copyright (C) 2013 James Almer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | /** 23 | * @file 24 | * @ingroup lavu_ripemd 25 | * Public header for RIPEMD hash function implementation. 26 | */ 27 | 28 | #ifndef AVUTIL_RIPEMD_H 29 | #define AVUTIL_RIPEMD_H 30 | 31 | #include 32 | #include 33 | 34 | #include "attributes.h" 35 | 36 | /** 37 | * @defgroup lavu_ripemd RIPEMD 38 | * @ingroup lavu_hash 39 | * RIPEMD hash function implementation. 40 | * 41 | * @{ 42 | */ 43 | 44 | extern const int av_ripemd_size; 45 | 46 | struct AVRIPEMD; 47 | 48 | /** 49 | * Allocate an AVRIPEMD context. 50 | */ 51 | struct AVRIPEMD *av_ripemd_alloc(void); 52 | 53 | /** 54 | * Initialize RIPEMD hashing. 55 | * 56 | * @param context pointer to the function context (of size av_ripemd_size) 57 | * @param bits number of bits in digest (128, 160, 256 or 320 bits) 58 | * @return zero if initialization succeeded, -1 otherwise 59 | */ 60 | int av_ripemd_init(struct AVRIPEMD* context, int bits); 61 | 62 | /** 63 | * Update hash value. 64 | * 65 | * @param context hash function context 66 | * @param data input data to update hash with 67 | * @param len input data length 68 | */ 69 | void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, size_t len); 70 | 71 | /** 72 | * Finish hashing and output digest value. 73 | * 74 | * @param context hash function context 75 | * @param digest buffer where output digest value is stored 76 | */ 77 | void av_ripemd_final(struct AVRIPEMD* context, uint8_t *digest); 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | #endif /* AVUTIL_RIPEMD_H */ 84 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/tea.h: -------------------------------------------------------------------------------- 1 | /* 2 | * A 32-bit implementation of the TEA algorithm 3 | * Copyright (c) 2015 Vesselin Bontchev 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_TEA_H 23 | #define AVUTIL_TEA_H 24 | 25 | #include 26 | 27 | /** 28 | * @file 29 | * @brief Public header for libavutil TEA algorithm 30 | * @defgroup lavu_tea TEA 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | extern const int av_tea_size; 36 | 37 | struct AVTEA; 38 | 39 | /** 40 | * Allocate an AVTEA context 41 | * To free the struct: av_free(ptr) 42 | */ 43 | struct AVTEA *av_tea_alloc(void); 44 | 45 | /** 46 | * Initialize an AVTEA context. 47 | * 48 | * @param ctx an AVTEA context 49 | * @param key a key of 16 bytes used for encryption/decryption 50 | * @param rounds the number of rounds in TEA (64 is the "standard") 51 | */ 52 | void av_tea_init(struct AVTEA *ctx, const uint8_t key[16], int rounds); 53 | 54 | /** 55 | * Encrypt or decrypt a buffer using a previously initialized context. 56 | * 57 | * @param ctx an AVTEA context 58 | * @param dst destination array, can be equal to src 59 | * @param src source array, can be equal to dst 60 | * @param count number of 8 byte blocks 61 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 62 | * @param decrypt 0 for encryption, 1 for decryption 63 | */ 64 | void av_tea_crypt(struct AVTEA *ctx, uint8_t *dst, const uint8_t *src, 65 | int count, uint8_t *iv, int decrypt); 66 | 67 | /** 68 | * @} 69 | */ 70 | 71 | #endif /* AVUTIL_TEA_H */ 72 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2003 Fabrice Bellard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_TIME_H 22 | #define AVUTIL_TIME_H 23 | 24 | #include 25 | 26 | /** 27 | * Get the current time in microseconds. 28 | */ 29 | int64_t av_gettime(void); 30 | 31 | /** 32 | * Get the current time in microseconds since some unspecified starting point. 33 | * On platforms that support it, the time comes from a monotonic clock 34 | * This property makes this time source ideal for measuring relative time. 35 | * The returned values may not be monotonic on platforms where a monotonic 36 | * clock is not available. 37 | */ 38 | int64_t av_gettime_relative(void); 39 | 40 | /** 41 | * Indicates with a boolean result if the av_gettime_relative() time source 42 | * is monotonic. 43 | */ 44 | int av_gettime_relative_is_monotonic(void); 45 | 46 | /** 47 | * Sleep for a period of time. Although the duration is expressed in 48 | * microseconds, the actual delay may be rounded to the precision of the 49 | * system timer. 50 | * 51 | * @param usec Number of microseconds to sleep. 52 | * @return zero on success or (negative) error code. 53 | */ 54 | int av_usleep(unsigned usec); 55 | 56 | #endif /* AVUTIL_TIME_H */ 57 | -------------------------------------------------------------------------------- /ext/ff/include/libavutil/twofish.h: -------------------------------------------------------------------------------- 1 | /* 2 | * An implementation of the TwoFish algorithm 3 | * Copyright (c) 2015 Supraja Meedinti 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_TWOFISH_H 23 | #define AVUTIL_TWOFISH_H 24 | 25 | #include 26 | 27 | 28 | /** 29 | * @file 30 | * @brief Public header for libavutil TWOFISH algorithm 31 | * @defgroup lavu_twofish TWOFISH 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_twofish_size; 37 | 38 | struct AVTWOFISH; 39 | 40 | /** 41 | * Allocate an AVTWOFISH context 42 | * To free the struct: av_free(ptr) 43 | */ 44 | struct AVTWOFISH *av_twofish_alloc(void); 45 | 46 | /** 47 | * Initialize an AVTWOFISH context. 48 | * 49 | * @param ctx an AVTWOFISH context 50 | * @param key a key of size ranging from 1 to 32 bytes used for encryption/decryption 51 | * @param key_bits number of keybits: 128, 192, 256 If less than the required, padded with zeroes to nearest valid value; return value is 0 if key_bits is 128/192/256, -1 if less than 0, 1 otherwise 52 | */ 53 | int av_twofish_init(struct AVTWOFISH *ctx, const uint8_t *key, int key_bits); 54 | 55 | /** 56 | * Encrypt or decrypt a buffer using a previously initialized context 57 | * 58 | * @param ctx an AVTWOFISH context 59 | * @param dst destination array, can be equal to src 60 | * @param src source array, can be equal to dst 61 | * @param count number of 16 byte blocks 62 | * @paran iv initialization vector for CBC mode, NULL for ECB mode 63 | * @param decrypt 0 for encryption, 1 for decryption 64 | */ 65 | void av_twofish_crypt(struct AVTWOFISH *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt); 66 | 67 | /** 68 | * @} 69 | */ 70 | #endif /* AVUTIL_TWOFISH_H */ 71 | -------------------------------------------------------------------------------- /ext/ff/include/libpostproc/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version macros. 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef POSTPROC_VERSION_H 22 | #define POSTPROC_VERSION_H 23 | 24 | /** 25 | * @file 26 | * Libpostproc version macros 27 | */ 28 | 29 | #include "libavutil/version.h" 30 | 31 | #include "version_major.h" 32 | 33 | #define LIBPOSTPROC_VERSION_MINOR 6 34 | #define LIBPOSTPROC_VERSION_MICRO 100 35 | 36 | #define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \ 37 | LIBPOSTPROC_VERSION_MINOR, \ 38 | LIBPOSTPROC_VERSION_MICRO) 39 | #define LIBPOSTPROC_VERSION AV_VERSION(LIBPOSTPROC_VERSION_MAJOR, \ 40 | LIBPOSTPROC_VERSION_MINOR, \ 41 | LIBPOSTPROC_VERSION_MICRO) 42 | #define LIBPOSTPROC_BUILD LIBPOSTPROC_VERSION_INT 43 | 44 | #define LIBPOSTPROC_IDENT "postproc" AV_STRINGIFY(LIBPOSTPROC_VERSION) 45 | 46 | #endif /* POSTPROC_VERSION_H */ 47 | -------------------------------------------------------------------------------- /ext/ff/include/libpostproc/version_major.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version macros. 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef POSTPROC_VERSION_MAJOR_H 22 | #define POSTPROC_VERSION_MAJOR_H 23 | 24 | /** 25 | * @file 26 | * Libpostproc version macros 27 | */ 28 | 29 | #define LIBPOSTPROC_VERSION_MAJOR 56 30 | 31 | #endif /* POSTPROC_VERSION_MAJOR_H */ 32 | -------------------------------------------------------------------------------- /ext/ff/include/libswresample/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version macros. 3 | * 4 | * This file is part of libswresample 5 | * 6 | * libswresample is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * libswresample is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with libswresample; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef SWRESAMPLE_VERSION_H 22 | #define SWRESAMPLE_VERSION_H 23 | 24 | /** 25 | * @file 26 | * Libswresample version macros 27 | */ 28 | 29 | #include "libavutil/version.h" 30 | 31 | #include "version_major.h" 32 | 33 | #define LIBSWRESAMPLE_VERSION_MINOR 7 34 | #define LIBSWRESAMPLE_VERSION_MICRO 100 35 | 36 | #define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \ 37 | LIBSWRESAMPLE_VERSION_MINOR, \ 38 | LIBSWRESAMPLE_VERSION_MICRO) 39 | #define LIBSWRESAMPLE_VERSION AV_VERSION(LIBSWRESAMPLE_VERSION_MAJOR, \ 40 | LIBSWRESAMPLE_VERSION_MINOR, \ 41 | LIBSWRESAMPLE_VERSION_MICRO) 42 | #define LIBSWRESAMPLE_BUILD LIBSWRESAMPLE_VERSION_INT 43 | 44 | #define LIBSWRESAMPLE_IDENT "SwR" AV_STRINGIFY(LIBSWRESAMPLE_VERSION) 45 | 46 | #endif /* SWRESAMPLE_VERSION_H */ 47 | -------------------------------------------------------------------------------- /ext/ff/include/libswresample/version_major.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version macros. 3 | * 4 | * This file is part of libswresample 5 | * 6 | * libswresample is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * libswresample is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with libswresample; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef SWRESAMPLE_VERSION_MAJOR_H 22 | #define SWRESAMPLE_VERSION_MAJOR_H 23 | 24 | /** 25 | * @file 26 | * Libswresample version macros 27 | */ 28 | 29 | #define LIBSWRESAMPLE_VERSION_MAJOR 4 30 | 31 | #endif /* SWRESAMPLE_VERSION_MAJOR_H */ 32 | -------------------------------------------------------------------------------- /ext/ff/include/libswscale/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef SWSCALE_VERSION_H 20 | #define SWSCALE_VERSION_H 21 | 22 | /** 23 | * @file 24 | * swscale version macros 25 | */ 26 | 27 | #include "libavutil/version.h" 28 | 29 | #include "version_major.h" 30 | 31 | #define LIBSWSCALE_VERSION_MINOR 7 32 | #define LIBSWSCALE_VERSION_MICRO 100 33 | 34 | #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ 35 | LIBSWSCALE_VERSION_MINOR, \ 36 | LIBSWSCALE_VERSION_MICRO) 37 | #define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \ 38 | LIBSWSCALE_VERSION_MINOR, \ 39 | LIBSWSCALE_VERSION_MICRO) 40 | #define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT 41 | 42 | #define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION) 43 | 44 | #endif /* SWSCALE_VERSION_H */ 45 | -------------------------------------------------------------------------------- /ext/ff/include/libswscale/version_major.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef SWSCALE_VERSION_MAJOR_H 20 | #define SWSCALE_VERSION_MAJOR_H 21 | 22 | /** 23 | * @file 24 | * swscale version macros 25 | */ 26 | 27 | #define LIBSWSCALE_VERSION_MAJOR 6 28 | 29 | /** 30 | * FF_API_* defines may be placed below to indicate public API that will be 31 | * dropped at a future version bump. The defines themselves are not part of 32 | * the public API and may change, break or disappear at any time. 33 | */ 34 | 35 | #endif /* SWSCALE_VERSION_MAJOR_H */ 36 | -------------------------------------------------------------------------------- /ext/ff/include/x264_config.h: -------------------------------------------------------------------------------- 1 | #define X264_BIT_DEPTH 8 2 | #define X264_GPL 1 3 | #define X264_INTERLACED 1 4 | #define X264_CHROMA_FORMAT 0 5 | #define X264_VERSION "" 6 | #define X264_POINTVER "0.148.x" 7 | -------------------------------------------------------------------------------- /ext/iconv/Application.mk: -------------------------------------------------------------------------------- 1 | APP_MODULES := iconv 2 | APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 3 | APP_PLATFORM := android-21 4 | PROJECT_PATH_BASE := q:/Dev/VCMI/vcmi-android 5 | APP_OPTIM := release 6 | -------------------------------------------------------------------------------- /ext/iconv/build.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := iconv 6 | 7 | LOCAL_CFLAGS := \ 8 | -Wno-multichar \ 9 | -D_ANDROID \ 10 | -DBUILDING_LIBICONV \ 11 | -DIN_LIBRARY \ 12 | -DLIBDIR="\"c\"" \ 13 | -I$(LOCAL_PATH)/code/ \ 14 | -I$(LOCAL_PATH)/code/include/ \ 15 | -I$(LOCAL_PATH)/code/lib/ \ 16 | -I$(LOCAL_PATH)/code/libcharset/include \ 17 | 18 | LOCAL_SRC_FILES := \ 19 | ./code/lib/iconv.c \ 20 | ./code/lib/relocatable.c \ 21 | ./code/libcharset/lib/localcharset.c \ 22 | 23 | include $(BUILD_SHARED_LIBRARY) 24 | 25 | LOCAL_LDLIBS := -llog -lcharset 26 | -------------------------------------------------------------------------------- /fix_boost_files.py: -------------------------------------------------------------------------------- 1 | import os 2 | import vcmiutil 3 | import vcmiconf 4 | 5 | def fixReaddirRUsage(): 6 | replacements = [ vcmiutil.ReplacementEntry("# if !defined(__CYGWIN__)\\", "#if 0\\") ] 7 | 8 | vcmiutil.fixFile("./ext/boost/" + vcmiconf.config["boostFolderName"] + "/libs/filesystem/src/operations.cpp", replacements) 9 | 10 | def fixBrokenFeatureDetectionInPthreadMutex(): 11 | replacements = [ vcmiutil.ReplacementEntry("#if (defined(_POSIX_TIMEOUTS) && (_POSIX_TIMEOUTS-0)>=200112L) \\", "#if 0 \\") ] 12 | replacements2 = [ vcmiutil.ReplacementEntry("#if (defined _POSIX_TIMEOUTS && (_POSIX_TIMEOUTS-0)>=200112L) \\", "#if 0 \\") ] 13 | 14 | vcmiutil.fixFile("./ext/boost/" + vcmiconf.config["boostFolderName"] + "/boost/thread/pthread/mutex.hpp", replacements) 15 | vcmiutil.fixFile("./ext/boost/" + vcmiconf.config["boostFolderName"] + "/boost/thread/pthread/recursive_mutex.hpp", replacements2) 16 | 17 | def fixBrokenEpollDetectionOnOldApi(): 18 | replacements = [ vcmiutil.ReplacementEntry("#if defined(EPOLL_CLOEXEC)", "#if defined(EPOLL_CLOEXEC) && __ANDROID_API__ >= 21") ] 19 | 20 | vcmiutil.fixFile("./ext/boost/" + vcmiconf.config["boostFolderName"] + "/boost/asio/detail/impl/epoll_reactor.ipp", replacements) 21 | 22 | fixBrokenFeatureDetectionInPthreadMutex() 23 | fixReaddirRUsage() 24 | fixBrokenEpollDetectionOnOldApi() -------------------------------------------------------------------------------- /fix_ffmpeg_confs.py: -------------------------------------------------------------------------------- 1 | import os 2 | import vcmiutil 3 | 4 | # fixes ffmpeg library naming, so that they're built as libXXX.so, instead of libXXX.so.version (android cannot load libraries like that) 5 | 6 | def fixFFConf(): 7 | replacements = [ 8 | vcmiutil.ReplacementEntry("SLIBNAME_WITH_VERSION=$(SLIBNAME).$(LIBVERSION)", "SLIBNAME_WITH_VERSION=$(SLIBNAME)"), 9 | vcmiutil.ReplacementEntry("SLIBNAME_WITH_MAJOR=$(SLIBNAME).$(LIBMAJOR)", "SLIBNAME_WITH_MAJOR=$(SLIBNAME)"), 10 | vcmiutil.ReplacementEntry("SLIB_INSTALL_NAME=$(SLIBNAME_WITH_VERSION) ", "SLIB_INSTALL_NAME=$(SLIBNAME)"), 11 | vcmiutil.ReplacementEntry("SLIB_INSTALL_LINKS=$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)", "SLIB_INSTALL_LINKS=") 12 | ] 13 | 14 | vcmiutil.fixFile("./ext/ff/ffmpeg/configure", replacements) 15 | 16 | def fixX264Conf(): 17 | replacements = [ vcmiutil.ReplacementEntry("echo \"SONAME=libx264.so.$API\" >> config.mak", "echo \"SONAME=libx264.so\" >> config.mak") ] 18 | 19 | vcmiutil.fixFile("./ext/ff/x264/configure", replacements) 20 | 21 | fixFFConf() 22 | fixX264Conf() -------------------------------------------------------------------------------- /fix_fuzzylite_dirs.py: -------------------------------------------------------------------------------- 1 | import os 2 | import vcmiutil 3 | 4 | # changes fuzzylite hardcoded output dirs (FL/out/bin) to conditional set, so it doesn't override our arch-based output folder 5 | 6 | def fixFuzzyliteHardcodedOutputDirs(): 7 | replacements = [ 8 | vcmiutil.ReplacementEntry("set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY bin)", "if (NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)\n\tset(CMAKE_ARCHIVE_OUTPUT_DIRECTORY bin) #fixed via vcmi python\nendif()"), 9 | vcmiutil.ReplacementEntry("set(CMAKE_LIBRARY_OUTPUT_DIRECTORY bin)", "if (NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)\n\tset(CMAKE_LIBRARY_OUTPUT_DIRECTORY bin) #fixed via vcmi python\nendif()"), 10 | vcmiutil.ReplacementEntry("set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin)", "if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)\n\tset(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin) #fixed via vcmi python\nendif()") 11 | ] 12 | 13 | vcmiutil.fixFile("./ext/vcmi/AI/FuzzyLite/fuzzylite/CMakeLists.txt", replacements) 14 | 15 | fixFuzzyliteHardcodedOutputDirs() -------------------------------------------------------------------------------- /fix_sdl_makefiles.py: -------------------------------------------------------------------------------- 1 | import vcmiutil 2 | 3 | def fixSDLImage(): 4 | replacements = [ 5 | vcmiutil.ReplacementEntry("LOCAL_C_INCLUDES := $(LOCAL_PATH)", "LOCAL_C_INCLUDES := $(LOCAL_PATH) $(PROJECT_PATH_BASE)/ext/SDL2/core/code/include") ] 6 | 7 | vcmiutil.fixFile("./ext/SDL2/SDL2-image/code/Android.mk", replacements) 8 | 9 | def fixSDLTTF(): 10 | replacements = [ 11 | vcmiutil.ReplacementEntry("LOCAL_C_INCLUDES := $(LOCAL_PATH)", "LOCAL_C_INCLUDES := $(LOCAL_PATH) $(PROJECT_PATH_BASE)/ext/SDL2/core/code/include") ] 12 | 13 | vcmiutil.fixFile("./ext/SDL2/SDL2-ttf/code/Android.mk", replacements) 14 | 15 | def fixSDLMixer(): 16 | replacements = [ 17 | vcmiutil.ReplacementEntry("LOCAL_C_INCLUDES := $(LOCAL_PATH)", "LOCAL_C_INCLUDES := $(LOCAL_PATH) $(PROJECT_PATH_BASE)/ext/SDL2/core/code/include"), 18 | vcmiutil.ReplacementEntry("SUPPORT_MOD_MODPLUG ?= true", "SUPPORT_MOD_MODPLUG ?= false"), 19 | vcmiutil.ReplacementEntry("SUPPORT_MOD_MIKMOD ?= true", "SUPPORT_MOD_MIKMOD ?= false") ] 20 | 21 | vcmiutil.fixFile("./ext/SDL2/SDL2-mixer/code/Android.mk", replacements) 22 | 23 | def fixSDLMixerExtSMPEG(): 24 | replacements = [ 25 | vcmiutil.ReplacementEntry("LOCAL_C_INCLUDES := $(LOCAL_PATH)", "LOCAL_C_INCLUDES := $(LOCAL_PATH) $(PROJECT_PATH_BASE)/ext/SDL2/core/code/include") ] 26 | 27 | vcmiutil.fixFile("./ext/SDL2/SDL2-mixer/code/external/smpeg2-2.0.0/Android.mk", replacements) 28 | 29 | fixSDLImage() 30 | fixSDLTTF() 31 | fixSDLMixer() 32 | fixSDLMixerExtSMPEG() 33 | -------------------------------------------------------------------------------- /move_sdl_includes.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | 4 | def flatCopyWithExt(srcDir, dstDir, ext): 5 | if not os.path.exists(dstDir): 6 | os.makedirs(dstDir) 7 | for basename in os.listdir(srcDir): 8 | if basename.endswith(ext): 9 | pathname = os.path.join(srcDir, basename) 10 | if os.path.isfile(pathname): 11 | shutil.copy2(pathname, dstDir) 12 | 13 | def moveSDLIncludes(): 14 | flatCopyWithExt("./ext/SDL2/core/code/include/", "./ext/SDL2/core/include/", ".h") 15 | flatCopyWithExt("./ext/SDL2/SDL2-image/code/", "./ext/SDL2/SDL2-image/include/", ".h") 16 | flatCopyWithExt("./ext/SDL2/SDL2-mixer/code/", "./ext/SDL2/SDL2-mixer/include/", ".h") 17 | flatCopyWithExt("./ext/SDL2/SDL2-ttf/code/", "./ext/SDL2/SDL2-ttf/include/", ".h") 18 | -------------------------------------------------------------------------------- /project/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /project/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /project/.idea/.name: -------------------------------------------------------------------------------- 1 | VCMI -------------------------------------------------------------------------------- /project/.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /project/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /project/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 20 | 21 | -------------------------------------------------------------------------------- /project/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /project/GeneratedVersion.java.in: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.util; 2 | 3 | /** 4 | * Generated via cmake (./project/vcmi-app/cmake-scripts/versions.cmake) 5 | */ 6 | public class GeneratedVersion 7 | { 8 | public static final String VCMI_VERSION = "@VCMI_VERSION@"; 9 | } -------------------------------------------------------------------------------- /project/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:7.3.0' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | apply from: rootProject.file("defs.gradle") 17 | } 18 | 19 | task clean(type: Delete) { 20 | delete rootProject.buildDir 21 | } -------------------------------------------------------------------------------- /project/defs.gradle: -------------------------------------------------------------------------------- 1 | import groovy.json.JsonSlurper 2 | 3 | ext { 4 | final def jsonFile = rootProject.file("../vcmiconf.json") 5 | final def rawConf = new JsonSlurper().parseText(jsonFile.text) 6 | 7 | PROJECT_PATH_BASE = jsonFile.getParentFile().getAbsolutePath().replace('\\', '/') 8 | VCMI_PATH_EXT = "${PROJECT_PATH_BASE}/ext" 9 | VCMI_PATH_MAIN = "${PROJECT_PATH_BASE}/project" 10 | 11 | VCMI_PATH_VCMI = "${VCMI_PATH_EXT}/vcmi" 12 | 13 | // can be 16 if building only for armeabi-v7a, definitely needs to be 21+ to build arm64 and x86_64 14 | VCMI_PLATFORM = rawConf.androidApi 15 | // we should be able to use the newest version to compile, but it seems that gradle-experimental is somehow broken and doesn't compile native libs correctly for apis older than this setting... 16 | VCMI_COMPILE_SDK = 26 17 | VCMI_ABIS = rawConf.abis.split(" ") 18 | 19 | VCMI_STL_VERSION = "c++_shared" 20 | VCMI_BUILD_TOOLS = "25.0.2" 21 | 22 | // these values will be retrieved during gradle build 23 | gitInfoLauncher = "none" 24 | gitInfoVcmi = "none" 25 | 26 | logger.info("Base path = ${PROJECT_PATH_BASE}") 27 | } -------------------------------------------------------------------------------- /project/defs.gradle.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vcmi/vcmi-android/e63c25adcc56d27d18601fa700a41cdabb4a852a/project/defs.gradle.properties -------------------------------------------------------------------------------- /project/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | -------------------------------------------------------------------------------- /project/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vcmi/vcmi-android/e63c25adcc56d27d18601fa700a41cdabb4a852a/project/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /project/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 27 21:00:27 EEST 2022 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /project/settings.gradle: -------------------------------------------------------------------------------- 1 | dependencyResolutionManagement { 2 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | } 8 | rootProject.name = "VCMI" 9 | include ':vcmi-app' 10 | -------------------------------------------------------------------------------- /project/vcmi-app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /project/vcmi-app/cmake-scripts/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.17) 2 | 3 | set(CMAKE_MODULE_PATH "${VCMI_ROOT}/project/vcmi-app/cmake-scripts;${VCMI_ROOT}/ext/vcmi/cmake_modules") 4 | include(VCMIUtils) 5 | include(VersionDefinition) 6 | 7 | set(ANDROID ON) 8 | 9 | set(BOOST_ROOT ${VCMI_ROOT}/ext/boost/boost_1_68_0) 10 | set(VCMI_PATH_VCMI ${VCMI_ROOT}/ext/vcmi) 11 | set(VCMI_PATH_EXT_LIBS ${VCMI_ROOT}/ext-output/${ANDROID_ABI}) 12 | 13 | find_library(syslib_z z) 14 | add_library(ZLIB::ZLIB UNKNOWN IMPORTED) 15 | set_target_properties(ZLIB::ZLIB PROPERTIES IMPORTED_LOCATION ${syslib_z}) 16 | 17 | include_directories(${BOOST_ROOT}) 18 | 19 | include(ext-libs) 20 | include(main-app) -------------------------------------------------------------------------------- /project/vcmi-app/cmake-scripts/client.cmake: -------------------------------------------------------------------------------- 1 | project(vcmiclient) 2 | 3 | add_subdirectory(${VCMI_PATH_VCMI}/client ${VCMI_PATH_VCMI}/out/client) 4 | get_directory_property(LOCAL_CLIENT_SRCS DIRECTORY ${VCMI_PATH_VCMI}/client DEFINITION client_SRCS) 5 | prepend(VCMICLIENT_SRCS ${VCMI_PATH_VCMI}/client ${LOCAL_CLIENT_SRCS}) 6 | 7 | add_library(vcmiclient SHARED ${VCMICLIENT_SRCS} ${CLIENT_ADDITIONAL_SRCS}) 8 | 9 | target_include_directories(vcmiclient PRIVATE ${VCMI_PATH_VCMI}/client) 10 | target_include_directories(vcmiclient PRIVATE ${VCMI_PATH_VCMI}/include) 11 | target_include_directories(vcmiclient PRIVATE ${VCMI_PATH_VCMI}) 12 | target_include_directories(vcmiclient PRIVATE ${VCMI_ROOT}/ext/SDL2/core/include) 13 | target_include_directories(vcmiclient PRIVATE ${VCMI_ROOT}/ext/SDL2/SDL2-image/include) 14 | target_include_directories(vcmiclient PRIVATE ${VCMI_ROOT}/ext/SDL2/SDL2-mixer/include) 15 | target_include_directories(vcmiclient PRIVATE ${VCMI_ROOT}/ext/SDL2/SDL2-ttf/include) 16 | target_include_directories(vcmiclient PRIVATE ${VCMI_ROOT}/ext/ff/include) 17 | 18 | target_link_libraries(vcmiclient vcmi ${Boost_LIBRARIES} ${SDL_CLIENT_LIBRARIES} ${FFMPEG_LIBRARIES} ${SYSTEM_LIBS}) 19 | 20 | set_target_properties(vcmiclient PROPERTIES OUTPUT_NAME vcmi-client) -------------------------------------------------------------------------------- /project/vcmi-app/cmake-scripts/fuzzylite.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=${prefix}blah 3 | includedir=${exec_prefix}/include 4 | libdir=${exec_prefix}/lib 5 | 6 | Name: fuzzylite 7 | Description: A fuzzy logic control library in C++ 8 | Version: @FL_VERSION@ 9 | Libs: -L${libdir} -lfuzzylite 10 | Cflags: -I${includedir} 11 | -------------------------------------------------------------------------------- /project/vcmi-app/cmake-scripts/integration/cmake/generate_vars.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-2021 Intel Corporation 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Reuired parameters: 16 | # SOURCE_DIR - incoming path to oneTBB source directory. 17 | # BINARY_DIR - incoming path to oneTBB build directory. 18 | # BIN_PATH - incoming path to oneTBB binaries directory. 19 | # TBB_INSTALL_VARS - install vars generation trigger 20 | # TBB_CMAKE_INSTALL_LIBDIR - subdir for shared object files installation path (used only in TBB_INSTALL_VARS mode) 21 | # VARS_TEMPLATE - path to the vars template file 22 | # VARS_NAME - name of the output vars script 23 | 24 | set(INPUT_FILE "${SOURCE_DIR}/integration/${VARS_TEMPLATE}") 25 | set(OUTPUT_FILE "${BIN_PATH}/${VARS_NAME}") 26 | 27 | file(TO_NATIVE_PATH "${SOURCE_DIR}" TBBROOT_REPLACEMENT) 28 | file(TO_NATIVE_PATH "${BIN_PATH}" LIBRARY_PATH_REPLACEMENT) 29 | if (WIN32) 30 | file(TO_NATIVE_PATH "${BIN_PATH}" BINARY_PATH_REPLACEMENT) 31 | endif() 32 | 33 | configure_file( ${INPUT_FILE} ${OUTPUT_FILE} @ONLY ) 34 | 35 | if (TBB_INSTALL_VARS) 36 | set(OUTPUT_FILE "${BINARY_DIR}/internal_install_vars") 37 | if (UNIX) 38 | set(TBBROOT_REPLACEMENT "$(cd $(dirname \${BASH_SOURCE}) && pwd -P)/..") 39 | set(LIBRARY_PATH_REPLACEMENT "$TBBROOT/${TBB_CMAKE_INSTALL_LIBDIR}/") 40 | set(CMAKE_ENVIRONMENT_SOURCING_STRING "CMAKE_PREFIX_PATH=\"\${TBBROOT}/${TBB_CMAKE_INSTALL_LIBDIR}/cmake/TBB:${CMAKE_PREFIX_PATH}\"; export CMAKE_PREFIX_PATH") 41 | else() 42 | set(TBBROOT_REPLACEMENT "%~d0%~p0..") 43 | set(LIBRARY_PATH_REPLACEMENT "%TBBROOT%\\${TBB_CMAKE_INSTALL_LIBDIR}") 44 | set(BINARY_PATH_REPLACEMENT "%TBBROOT%\\bin") 45 | set(CMAKE_ENVIRONMENT_SOURCING_STRING "set \"CMAKE_PREFIX_PATH=%TBBROOT%\\${TBB_CMAKE_INSTALL_LIBDIR}\\cmake\\TBB;%CMAKE_PREFIX_PATH%\"") 46 | endif() 47 | 48 | configure_file( ${INPUT_FILE} ${OUTPUT_FILE} @ONLY ) 49 | endif() 50 | -------------------------------------------------------------------------------- /project/vcmi-app/cmake-scripts/integration/linux/env/vars.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (c) 2005-2021 Intel Corporation 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | export TBBROOT=@TBBROOT_REPLACEMENT@ 18 | 19 | LD_LIBRARY_PATH="@LIBRARY_PATH_REPLACEMENT@:${LD_LIBRARY_PATH}"; export LD_LIBRARY_PATH 20 | LIBRARY_PATH="@LIBRARY_PATH_REPLACEMENT@:${LIBRARY_PATH}"; export LIBRARY_PATH 21 | CPATH="${TBBROOT}/include:${CPATH}"; export CPATH 22 | 23 | @CMAKE_ENVIRONMENT_SOURCING_STRING@ 24 | -------------------------------------------------------------------------------- /project/vcmi-app/cmake-scripts/integration/mac/env/vars.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (c) 2005-2021 Intel Corporation 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | export TBBROOT=@TBBROOT_REPLACEMENT@ 18 | 19 | DYLD_LIBRARY_PATH="@LIBRARY_PATH_REPLACEMENT@:${DYLD_LIBRARY_PATH}"; export DYLD_LIBRARY_PATH 20 | LIBRARY_PATH="@LIBRARY_PATH_REPLACEMENT@:${LIBRARY_PATH}"; export LIBRARY_PATH 21 | CPATH="${TBBROOT}/include:${CPATH}"; export CPATH 22 | 23 | @CMAKE_ENVIRONMENT_SOURCING_STRING@ 24 | -------------------------------------------------------------------------------- /project/vcmi-app/cmake-scripts/integration/pkg-config/tbb.pc.in: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 Intel Corporation 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | prefix=@CMAKE_INSTALL_PREFIX@ 16 | exec_prefix=${prefix} 17 | libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ 18 | includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ 19 | 20 | Name: oneAPI Threading Building Blocks (oneTBB) 21 | Description: C++ library for parallel programming on multi-core processors. 22 | URL: https://github.com/oneapi-src/oneTBB 23 | Version: @TBB_VERSION@ 24 | Libs: -L${libdir} -l@TBB_LIB_NAME@ 25 | Cflags: -I${includedir} 26 | -------------------------------------------------------------------------------- /project/vcmi-app/cmake-scripts/integration/windows/env/vars.bat.in: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM 3 | REM Copyright (c) 2005-2021 Intel Corporation 4 | REM 5 | REM Licensed under the Apache License, Version 2.0 (the "License"); 6 | REM you may not use this file except in compliance with the License. 7 | REM You may obtain a copy of the License at 8 | REM 9 | REM http://www.apache.org/licenses/LICENSE-2.0 10 | REM 11 | REM Unless required by applicable law or agreed to in writing, software 12 | REM distributed under the License is distributed on an "AS IS" BASIS, 13 | REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | REM See the License for the specific language governing permissions and 15 | REM limitations under the License. 16 | REM 17 | 18 | @echo off 19 | 20 | set "TBBROOT=@TBBROOT_REPLACEMENT@" 21 | 22 | set "INCLUDE=%TBBROOT%\include;%INCLUDE%" 23 | set "CPATH=%TBBROOT%\include;%CPATH%" 24 | set "LIB=@LIBRARY_PATH_REPLACEMENT@;%LIB%" 25 | set "PATH=@BINARY_PATH_REPLACEMENT@;%PATH%" 26 | 27 | @CMAKE_ENVIRONMENT_SOURCING_STRING@ 28 | -------------------------------------------------------------------------------- /project/vcmi-app/cmake-scripts/lib.cmake: -------------------------------------------------------------------------------- 1 | project(vcmi) 2 | 3 | add_subdirectory(${VCMI_PATH_VCMI}/AI/BattleAI ${VCMI_PATH_VCMI}/out/battleai) 4 | add_subdirectory(${VCMI_PATH_VCMI}/AI/VCAI ${VCMI_PATH_VCMI}/out/vcai) 5 | add_subdirectory(${VCMI_PATH_VCMI}/AI/Nullkiller ${VCMI_PATH_VCMI}/out/nullkiller) 6 | get_directory_property(LOCAL_BATTLEAI_SRCS DIRECTORY ${VCMI_PATH_VCMI}/AI/BattleAI DEFINITION battleAI_SRCS) 7 | get_directory_property(LOCAL_VCAI_SRCS DIRECTORY ${VCMI_PATH_VCMI}/AI/VCAI DEFINITION VCAI_SRCS) 8 | get_directory_property(LOCAL_NULLKILLER_SRCS DIRECTORY ${VCMI_PATH_VCMI}/AI/Nullkiller DEFINITION Nullkiller_SRCS) 9 | list(REMOVE_ITEM LOCAL_BATTLEAI_SRCS main.cpp) 10 | list(REMOVE_ITEM LOCAL_VCAI_SRCS main.cpp) 11 | list(REMOVE_ITEM LOCAL_NULLKILLER_SRCS main.cpp) 12 | prepend(VCMILIB_ADDITIONAL_SRC_BATTLEAI ${VCMI_PATH_VCMI}/AI/BattleAI ${LOCAL_BATTLEAI_SRCS}) 13 | prepend(VCMILIB_ADDITIONAL_SRC_VCAI ${VCMI_PATH_VCMI}/AI/VCAI ${LOCAL_VCAI_SRCS}) 14 | prepend(VCMILIB_ADDITIONAL_SRC_NULLKILLER ${VCMI_PATH_VCMI}/AI/Nullkiller ${LOCAL_NULLKILLER_SRCS}) 15 | 16 | set(VCMILIB_ADDITIONAL_SOURCES ${VCMILIB_ADDITIONAL_SRC_BATTLEAI} ${VCMILIB_ADDITIONAL_SRC_VCAI} ${VCMILIB_ADDITIONAL_SRC_NULLKILLER}) 17 | 18 | set(MAIN_LIB_DIR "${VCMI_PATH_VCMI}/lib") 19 | SET(ENABLE_GITVERSION ON) 20 | include(VCMI_lib) 21 | 22 | add_subdirectory(${VCMI_PATH_VCMI}/lib ${VCMI_PATH_VCMI}/out/lib) 23 | 24 | target_compile_definitions(vcmi PRIVATE -DM_DATA_DIR="none" -DM_BIN_DIR="none" -DM_LIB_DIR="none") # these aren't used by android code, but need to be defined to compile correctly 25 | 26 | target_include_directories(vcmi PRIVATE ${VCMI_PATH_VCMI}/lib) 27 | target_include_directories(vcmi PRIVATE ${VCMI_PATH_VCMI}/include) 28 | target_include_directories(vcmi PRIVATE ${VCMI_PATH_VCMI}) 29 | target_include_directories(vcmi PRIVATE ${VCMI_PATH_VCMI}/AI/FuzzyLite/fuzzylite) 30 | target_include_directories(vcmi PRIVATE ${VCMI_ROOT}/ext/SDL2/core/include) 31 | target_include_directories(vcmi PRIVATE ${VCMI_ROOT}/ext/oneTBB/include) 32 | 33 | set_target_properties(vcmi PROPERTIES OUTPUT_NAME vcmi-lib) -------------------------------------------------------------------------------- /project/vcmi-app/cmake-scripts/server.cmake: -------------------------------------------------------------------------------- 1 | project(vcmiserver) 2 | 3 | add_subdirectory(${VCMI_PATH_VCMI}/server ${VCMI_PATH_VCMI}/out/server) 4 | get_directory_property(LOCAL_SERVER_SRCS DIRECTORY ${VCMI_PATH_VCMI}/server DEFINITION server_SRCS) 5 | prepend(VCMISERVER_SRCS ${VCMI_PATH_VCMI}/server ${LOCAL_SERVER_SRCS}) 6 | 7 | add_library(vcmiserver SHARED ${VCMISERVER_SRCS} ${SERVER_ADDITIONAL_SRCS}) 8 | 9 | target_include_directories(vcmiserver PRIVATE ${VCMI_PATH_VCMI}/server) 10 | target_include_directories(vcmiserver PRIVATE ${VCMI_PATH_VCMI}/include) 11 | target_include_directories(vcmiserver PRIVATE ${VCMI_PATH_VCMI}) 12 | 13 | target_link_libraries(vcmiserver vcmi) 14 | 15 | set_target_properties(vcmiserver PROPERTIES OUTPUT_NAME vcmi-server) -------------------------------------------------------------------------------- /project/vcmi-app/cmake-scripts/versions.cmake: -------------------------------------------------------------------------------- 1 | execute_process(COMMAND git describe origin --match= --always --abbrev=40 2 | WORKING_DIRECTORY "${VCMI_PATH_VCMI}" 3 | OUTPUT_VARIABLE GIT_SHA1_RAW 4 | ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) 5 | set(GIT_SHA1 ${GIT_SHA1_RAW}-android) 6 | 7 | configure_file("${VCMI_PATH_VCMI}/Version.cpp.in" "${CMAKE_BINARY_DIR}/Version.cpp" @ONLY) 8 | 9 | string(LENGTH ${VCMI_VERSION_MAJOR} VERSION_HAS_MAJOR) 10 | string(LENGTH ${VCMI_VERSION_MINOR} VERSION_HAS_MINOR) 11 | 12 | if (${VERSION_HAS_MAJOR} AND ${VERSION_HAS_MINOR}) 13 | set(VCMI_VERSION "${VCMI_VERSION_MAJOR}.${VCMI_VERSION_MINOR}.${VCMI_VERSION_PATCH} (${GIT_SHA1_RAW})") 14 | else() 15 | set(VCMI_VERSION "unknown (${GIT_SHA1_RAW})") 16 | endif() 17 | 18 | message(STATUS "Detected vcmi version: ${VCMI_VERSION}") 19 | configure_file( 20 | "${VCMI_ROOT}/project/GeneratedVersion.java.in" 21 | "${VCMI_ROOT}/project/vcmi-app/src/main/java/eu/vcmi/vcmi/util/GeneratedVersion.java" 22 | @ONLY) -------------------------------------------------------------------------------- /project/vcmi-app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /project/vcmi-app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 34 | 37 | 38 | 45 | 46 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/assets/internalData.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vcmi/vcmi-android/e63c25adcc56d27d18601fa700a41cdabb4a852a/project/vcmi-app/src/main/assets/internalData.zip -------------------------------------------------------------------------------- /project/vcmi-app/src/main/assets/internalDataHash.txt: -------------------------------------------------------------------------------- 1 | 32131767860216ea0bc999fad864a1e9 -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/ActivityBase.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi; 2 | 3 | import android.os.Bundle; 4 | import androidx.annotation.Nullable; 5 | import androidx.appcompat.app.AppCompatActivity; 6 | 7 | import eu.vcmi.vcmi.util.Log; 8 | import eu.vcmi.vcmi.util.SharedPrefs; 9 | 10 | /** 11 | * @author F 12 | */ 13 | public abstract class ActivityBase extends AppCompatActivity 14 | { 15 | protected SharedPrefs mPrefs; 16 | 17 | @Override 18 | protected void onCreate(@Nullable final Bundle savedInstanceState) 19 | { 20 | super.onCreate(savedInstanceState); 21 | setupExceptionHandler(); 22 | mPrefs = new SharedPrefs(this); 23 | } 24 | 25 | private void setupExceptionHandler() 26 | { 27 | final Thread.UncaughtExceptionHandler prevHandler = Thread.getDefaultUncaughtExceptionHandler(); 28 | if (prevHandler != null && !(prevHandler instanceof VCMIExceptionHandler)) // no need to recreate it if it's already setup 29 | { 30 | Thread.setDefaultUncaughtExceptionHandler(new VCMIExceptionHandler(prevHandler)); 31 | } 32 | } 33 | 34 | private static class VCMIExceptionHandler implements Thread.UncaughtExceptionHandler 35 | { 36 | private Thread.UncaughtExceptionHandler mPrevHandler; 37 | 38 | private VCMIExceptionHandler(final Thread.UncaughtExceptionHandler prevHandler) 39 | { 40 | mPrevHandler = prevHandler; 41 | } 42 | 43 | @Override 44 | public void uncaughtException(final Thread thread, final Throwable throwable) 45 | { 46 | Log.e(this, "Unhandled exception", throwable); // to save the exception to file before crashing 47 | 48 | if (mPrevHandler != null && !(mPrevHandler instanceof VCMIExceptionHandler)) 49 | { 50 | mPrevHandler.uncaughtException(thread, throwable); 51 | } 52 | else 53 | { 54 | System.exit(1); 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/ActivityError.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import androidx.annotation.Nullable; 6 | import android.view.View; 7 | import android.widget.TextView; 8 | 9 | /** 10 | * @author F 11 | */ 12 | public class ActivityError extends ActivityWithToolbar 13 | { 14 | public static final String ARG_ERROR_MSG = "ActivityError.msg"; 15 | 16 | @Override 17 | protected void onCreate(@Nullable final Bundle savedInstanceState) 18 | { 19 | super.onCreate(savedInstanceState); 20 | setContentView(R.layout.activity_error); 21 | initToolbar(R.string.launcher_title); 22 | 23 | final View btnTryAgain = findViewById(R.id.error_btn_try_again); 24 | btnTryAgain.setOnClickListener(new OnErrorRetryPressed()); 25 | 26 | final Bundle extras = getIntent().getExtras(); 27 | if (extras != null) 28 | { 29 | final String errorMessage = extras.getString(ARG_ERROR_MSG); 30 | final TextView errorMessageView = (TextView) findViewById(R.id.error_message); 31 | if (errorMessage != null) 32 | { 33 | errorMessageView.setText(errorMessage); 34 | } 35 | } 36 | } 37 | 38 | private class OnErrorRetryPressed implements View.OnClickListener 39 | { 40 | @Override 41 | public void onClick(final View v) 42 | { 43 | // basically restarts main activity 44 | startActivity(new Intent(ActivityError.this, ActivityLauncher.class)); 45 | finish(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/ActivityWithToolbar.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi; 2 | 3 | import androidx.appcompat.app.ActionBar; 4 | import androidx.appcompat.widget.Toolbar; 5 | import android.view.MenuItem; 6 | import android.view.ViewStub; 7 | 8 | /** 9 | * @author F 10 | */ 11 | public abstract class ActivityWithToolbar extends ActivityBase 12 | { 13 | @Override 14 | public void setContentView(final int layoutResId) 15 | { 16 | super.setContentView(R.layout.activity_toolbar_wrapper); 17 | final ViewStub contentStub = (ViewStub) findViewById(R.id.toolbar_wrapper_content_stub); 18 | contentStub.setLayoutResource(layoutResId); 19 | contentStub.inflate(); 20 | } 21 | 22 | @Override 23 | public boolean onOptionsItemSelected(final MenuItem item) 24 | { 25 | if (item.getItemId() == android.R.id.home) 26 | { 27 | finish(); 28 | return true; 29 | } 30 | return super.onOptionsItemSelected(item); 31 | } 32 | 33 | protected void initToolbar(final int textResId) 34 | { 35 | initToolbar(textResId, false); 36 | } 37 | 38 | protected void initToolbar(final int textResId, final boolean isTopLevelActivity) 39 | { 40 | final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 41 | setSupportActionBar(toolbar); 42 | toolbar.setTitle(textResId); 43 | 44 | if (!isTopLevelActivity) 45 | { 46 | final ActionBar bar = getSupportActionBar(); 47 | if (bar != null) 48 | { 49 | bar.setDisplayHomeAsUpEnabled(true); 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/Const.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi; 2 | 3 | import android.content.Context; 4 | import android.os.Build; 5 | import android.os.Environment; 6 | 7 | import java.io.BufferedWriter; 8 | import java.io.File; 9 | import java.io.FileOutputStream; 10 | import java.io.IOException; 11 | import java.io.InputStream; 12 | import java.io.OutputStreamWriter; 13 | 14 | /** 15 | * @author F 16 | */ 17 | public class Const 18 | { 19 | public static final String JNI_METHOD_SUPPRESS = "unused"; // jni methods are marked as unused, because IDE doesn't understand jni calls 20 | // used to disable lint errors about try-with-resources being unsupported on api <19 (it is supported, because retrolambda backports it) 21 | public static final int SUPPRESS_TRY_WITH_RESOURCES_WARNING = Build.VERSION_CODES.KITKAT; 22 | 23 | public static final String VCMI_DATA_ROOT_FOLDER_NAME = "vcmi-data"; 24 | } 25 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/Storage.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi; 2 | 3 | import android.content.Context; 4 | import java.io.File; 5 | import java.io.IOException; 6 | import eu.vcmi.vcmi.util.FileUtil; 7 | 8 | public class Storage 9 | { 10 | public static File getVcmiDataDir(Context context) 11 | { 12 | File root = context.getExternalFilesDir(null); 13 | 14 | return new File(root, Const.VCMI_DATA_ROOT_FOLDER_NAME); 15 | } 16 | 17 | public static boolean testH3DataFolder(Context context) 18 | { 19 | return testH3DataFolder(getVcmiDataDir(context)); 20 | } 21 | 22 | public static boolean testH3DataFolder(final File baseDir) 23 | { 24 | final File testH3Data = new File(baseDir, "Data"); 25 | return testH3Data.exists(); 26 | } 27 | 28 | public static String getH3DataFolder(Context context){ 29 | return getVcmiDataDir(context).getAbsolutePath(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/content/DialogAuthors.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.content; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.app.Dialog; 5 | import android.os.Bundle; 6 | import androidx.annotation.NonNull; 7 | import androidx.fragment.app.DialogFragment; 8 | import androidx.appcompat.app.AlertDialog; 9 | import android.view.LayoutInflater; 10 | import android.view.View; 11 | import android.widget.TextView; 12 | 13 | import java.io.IOException; 14 | 15 | import eu.vcmi.vcmi.R; 16 | import eu.vcmi.vcmi.util.FileUtil; 17 | import eu.vcmi.vcmi.util.Log; 18 | 19 | /** 20 | * @author F 21 | */ 22 | public class DialogAuthors extends DialogFragment 23 | { 24 | @NonNull 25 | @Override 26 | public Dialog onCreateDialog(final Bundle savedInstanceState) 27 | { 28 | final LayoutInflater inflater = LayoutInflater.from(getActivity()); 29 | @SuppressLint("InflateParams") final View inflated = inflater.inflate(R.layout.dialog_authors, null, false); 30 | final TextView vcmiAuthorsView = (TextView) inflated.findViewById(R.id.dialog_authors_vcmi); 31 | final TextView launcherAuthorsView = (TextView) inflated.findViewById(R.id.dialog_authors_launcher); 32 | loadAuthorsContent(vcmiAuthorsView, launcherAuthorsView); 33 | return new AlertDialog.Builder(getActivity()) 34 | .setView(inflated) 35 | .create(); 36 | } 37 | 38 | private void loadAuthorsContent(final TextView vcmiAuthorsView, final TextView launcherAuthorsView) 39 | { 40 | try 41 | { 42 | // to be checked if this should be converted to async load (not really a file operation so it should be okay) 43 | final String authorsContent = FileUtil.read(getResources().openRawResource(R.raw.authors)); 44 | vcmiAuthorsView.setText(authorsContent); 45 | launcherAuthorsView.setText("Fay"); // TODO hardcoded for now 46 | } 47 | catch (final IOException e) 48 | { 49 | Log.e(this, "Could not load authors content", e); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/content/ModBaseViewHolder.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.content; 2 | 3 | import androidx.recyclerview.widget.RecyclerView; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.ImageView; 8 | import android.widget.TextView; 9 | 10 | import eu.vcmi.vcmi.R; 11 | 12 | /** 13 | * @author F 14 | */ 15 | public class ModBaseViewHolder extends RecyclerView.ViewHolder 16 | { 17 | final View mModNesting; 18 | final TextView mModName; 19 | 20 | ModBaseViewHolder(final View parentView) 21 | { 22 | this( 23 | LayoutInflater.from(parentView.getContext()).inflate( 24 | R.layout.mod_base_adapter_item, 25 | (ViewGroup) parentView, 26 | false), 27 | true); 28 | } 29 | 30 | protected ModBaseViewHolder(final View v, final boolean internal) 31 | { 32 | super(v); 33 | mModNesting = itemView.findViewById(R.id.mods_adapter_item_nesting); 34 | mModName = (TextView) itemView.findViewById(R.id.mods_adapter_item_name); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/content/ModsViewHolder.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.content; 2 | 3 | import android.view.LayoutInflater; 4 | import android.view.View; 5 | import android.view.ViewGroup; 6 | import android.widget.ImageView; 7 | import android.widget.TextView; 8 | 9 | import eu.vcmi.vcmi.R; 10 | 11 | /** 12 | * @author F 13 | */ 14 | public class ModsViewHolder extends ModBaseViewHolder 15 | { 16 | final TextView mModAuthor; 17 | final TextView mModType; 18 | final TextView mModSize; 19 | final ImageView mStatusIcon; 20 | final View mDownloadBtn; 21 | final TextView mDownloadProgress; 22 | final View mUninstall; 23 | 24 | ModsViewHolder(final View parentView) 25 | { 26 | super(LayoutInflater.from(parentView.getContext()).inflate(R.layout.mods_adapter_item, (ViewGroup) parentView, false), true); 27 | mModAuthor = (TextView) itemView.findViewById(R.id.mods_adapter_item_author); 28 | mModType = (TextView) itemView.findViewById(R.id.mods_adapter_item_modtype); 29 | mModSize = (TextView) itemView.findViewById(R.id.mods_adapter_item_size); 30 | mDownloadBtn = itemView.findViewById(R.id.mods_adapter_item_btn_download); 31 | mStatusIcon = (ImageView) itemView.findViewById(R.id.mods_adapter_item_status); 32 | mDownloadProgress = (TextView) itemView.findViewById(R.id.mods_adapter_item_install_progress); 33 | mUninstall = itemView.findViewById(R.id.mods_adapter_item_btn_uninstall); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/AdventureAiController.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.settings; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | import eu.vcmi.vcmi.Config; 5 | import eu.vcmi.vcmi.R; 6 | 7 | /** 8 | * @author F 9 | */ 10 | public class AdventureAiController extends LauncherSettingWithDialogController 11 | { 12 | public AdventureAiController(final AppCompatActivity activity) 13 | { 14 | super(activity); 15 | } 16 | 17 | @Override 18 | protected LauncherSettingDialog dialog() 19 | { 20 | return new AdventureAiSelectionDialog(); 21 | } 22 | 23 | @Override 24 | public void onItemChosen(final String item) 25 | { 26 | mConfig.setAdventureAi(item); 27 | updateContent(); 28 | } 29 | 30 | @Override 31 | protected String mainText() 32 | { 33 | return mActivity.getString(R.string.launcher_btn_adventure_ai_title); 34 | } 35 | 36 | @Override 37 | protected String subText() 38 | { 39 | if (mConfig == null) 40 | { 41 | return ""; 42 | } 43 | 44 | return mConfig.getAdventureAi(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/AdventureAiSelectionDialog.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.settings; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import eu.vcmi.vcmi.R; 7 | 8 | /** 9 | * @author F 10 | */ 11 | public class AdventureAiSelectionDialog extends LauncherSettingDialog 12 | { 13 | private static final List AVAILABLE_AI = new ArrayList<>(); 14 | 15 | static 16 | { 17 | AVAILABLE_AI.add("VCAI"); 18 | AVAILABLE_AI.add("Nullkiller"); 19 | } 20 | 21 | public AdventureAiSelectionDialog() 22 | { 23 | super(AVAILABLE_AI); 24 | } 25 | 26 | @Override 27 | protected int dialogTitleResId() 28 | { 29 | return R.string.launcher_btn_adventure_ai_title; 30 | } 31 | 32 | @Override 33 | protected CharSequence itemName(final String item) 34 | { 35 | return item; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/CodepageSettingController.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.settings; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import eu.vcmi.vcmi.Config; 6 | import eu.vcmi.vcmi.R; 7 | 8 | /** 9 | * @author F 10 | */ 11 | public class CodepageSettingController extends LauncherSettingWithDialogController 12 | { 13 | public CodepageSettingController(final AppCompatActivity activity) 14 | { 15 | super(activity); 16 | } 17 | 18 | @Override 19 | protected LauncherSettingDialog dialog() 20 | { 21 | return new CodepageSettingDialog(); 22 | } 23 | 24 | @Override 25 | public void onItemChosen(final String item) 26 | { 27 | mConfig.updateCodepage(item); 28 | updateContent(); 29 | } 30 | 31 | @Override 32 | protected String mainText() 33 | { 34 | return mActivity.getString(R.string.launcher_btn_cp_title); 35 | } 36 | 37 | @Override 38 | protected String subText() 39 | { 40 | if (mConfig == null) 41 | { 42 | return ""; 43 | } 44 | return mConfig.mCodepage == null || mConfig.mCodepage.isEmpty() 45 | ? mActivity.getString(R.string.launcher_btn_cp_subtitle_unknown) 46 | : mActivity.getString(R.string.launcher_btn_cp_subtitle, mConfig.mCodepage); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/CodepageSettingDialog.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.settings; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import eu.vcmi.vcmi.R; 7 | 8 | /** 9 | * @author F 10 | */ 11 | public class CodepageSettingDialog extends LauncherSettingDialog 12 | { 13 | private static final List AVAILABLE_CODEPAGES = new ArrayList<>(); 14 | 15 | static 16 | { 17 | AVAILABLE_CODEPAGES.add("CP1250"); 18 | AVAILABLE_CODEPAGES.add("CP1251"); 19 | AVAILABLE_CODEPAGES.add("CP1252"); 20 | AVAILABLE_CODEPAGES.add("GBK"); 21 | AVAILABLE_CODEPAGES.add("GB2312"); 22 | } 23 | 24 | public CodepageSettingDialog() 25 | { 26 | super(AVAILABLE_CODEPAGES); 27 | } 28 | 29 | @Override 30 | protected int dialogTitleResId() 31 | { 32 | return R.string.launcher_btn_cp_title; 33 | } 34 | 35 | @Override 36 | protected CharSequence itemName(final String item) 37 | { 38 | return item; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/DoubleConfig.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.settings; 2 | 3 | import eu.vcmi.vcmi.Config; 4 | import eu.vcmi.vcmi.util.SharedPrefs; 5 | 6 | /** 7 | * @author F 8 | */ 9 | public class DoubleConfig 10 | { 11 | public final Config mConfig; 12 | public final SharedPrefs mPrefs; 13 | 14 | public DoubleConfig(final Config config, final SharedPrefs prefs) 15 | { 16 | mConfig = config; 17 | mPrefs = prefs; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/LauncherSettingController.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.settings; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | import android.view.View; 5 | import android.widget.TextView; 6 | 7 | import eu.vcmi.vcmi.R; 8 | 9 | /** 10 | * @author F 11 | */ 12 | public abstract class LauncherSettingController implements View.OnClickListener 13 | { 14 | protected AppCompatActivity mActivity; 15 | protected TConf mConfig; 16 | private View mSettingViewRoot; 17 | private TextView mSettingsTextMain; 18 | private TextView mSettingsTextSub; 19 | 20 | LauncherSettingController(final AppCompatActivity act) 21 | { 22 | mActivity = act; 23 | } 24 | 25 | public final LauncherSettingController init(final int rootViewResId) 26 | { 27 | return init(rootViewResId, null); 28 | } 29 | 30 | public final LauncherSettingController init(final int rootViewResId, final TConf config) 31 | { 32 | mSettingViewRoot = mActivity.findViewById(rootViewResId); 33 | mSettingViewRoot.setOnClickListener(this); 34 | mSettingsTextMain = (TextView) mSettingViewRoot.findViewById(R.id.inc_launcher_btn_main); 35 | mSettingsTextSub = (TextView) mSettingViewRoot.findViewById(R.id.inc_launcher_btn_sub); 36 | childrenInit(mSettingViewRoot); 37 | updateConfig(config); 38 | updateContent(); 39 | return this; 40 | } 41 | 42 | protected void childrenInit(final View root) 43 | { 44 | 45 | } 46 | 47 | public void updateConfig(final TConf conf) 48 | { 49 | mConfig = conf; 50 | updateContent(); 51 | } 52 | 53 | public void updateContent() 54 | { 55 | mSettingsTextMain.setText(mainText()); 56 | if (mSettingsTextSub != null) 57 | { 58 | mSettingsTextSub.setText(subText()); 59 | } 60 | } 61 | 62 | protected abstract String mainText(); 63 | 64 | protected abstract String subText(); 65 | 66 | public void show() 67 | { 68 | mSettingViewRoot.setVisibility(View.VISIBLE); 69 | } 70 | 71 | public void hide() 72 | { 73 | mSettingViewRoot.setVisibility(View.GONE); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/LauncherSettingDialog.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.settings; 2 | 3 | import android.app.Dialog; 4 | import android.content.DialogInterface; 5 | import android.os.Bundle; 6 | import androidx.annotation.NonNull; 7 | import androidx.fragment.app.DialogFragment; 8 | import androidx.appcompat.app.AlertDialog; 9 | 10 | import java.util.ArrayList; 11 | 12 | import java.util.List; 13 | 14 | import eu.vcmi.vcmi.util.Log; 15 | 16 | /** 17 | * @author F 18 | */ 19 | public abstract class LauncherSettingDialog extends DialogFragment 20 | { 21 | protected final List mDataset; 22 | private IOnItemChosen mObserver; 23 | 24 | protected LauncherSettingDialog(final List dataset) 25 | { 26 | mDataset = dataset; 27 | } 28 | 29 | public void observe(final IOnItemChosen observer) 30 | { 31 | mObserver = observer; 32 | } 33 | 34 | protected abstract CharSequence itemName(T item); 35 | 36 | protected abstract int dialogTitleResId(); 37 | 38 | @NonNull 39 | @Override 40 | public Dialog onCreateDialog(final Bundle savedInstanceState) 41 | { 42 | List list = new ArrayList<>(); 43 | 44 | for (T t : mDataset) 45 | { 46 | CharSequence charSequence = itemName(t); 47 | list.add(charSequence); 48 | } 49 | 50 | return new AlertDialog.Builder(getActivity()) 51 | .setTitle(dialogTitleResId()) 52 | .setItems( 53 | list.toArray(new CharSequence[0]), 54 | this::onItemChosenInternal) 55 | .create(); 56 | } 57 | 58 | private void onItemChosenInternal(final DialogInterface dialog, final int index) 59 | { 60 | final T chosenItem = mDataset.get(index); 61 | Log.d(this, "Chosen item: " + chosenItem); 62 | dialog.dismiss(); 63 | if (mObserver != null) 64 | { 65 | mObserver.onItemChosen(chosenItem); 66 | } 67 | } 68 | 69 | public interface IOnItemChosen 70 | { 71 | void onItemChosen(V item); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/LauncherSettingWithDialogController.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.settings; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | import android.view.View; 5 | 6 | import eu.vcmi.vcmi.util.Log; 7 | 8 | /** 9 | * @author F 10 | */ 11 | public abstract class LauncherSettingWithDialogController extends LauncherSettingController 12 | implements LauncherSettingDialog.IOnItemChosen 13 | { 14 | public static final String SETTING_DIALOG_ID = "settings.dialog"; 15 | 16 | protected LauncherSettingWithDialogController(final AppCompatActivity act) 17 | { 18 | super(act); 19 | } 20 | 21 | @Override 22 | public void onClick(final View v) 23 | { 24 | Log.i(this, "Showing dialog"); 25 | final LauncherSettingDialog dialog = dialog(); 26 | dialog.observe(this); // TODO rebinding dialogs on activity config changes 27 | dialog.show(mActivity.getSupportFragmentManager(), SETTING_DIALOG_ID); 28 | } 29 | 30 | protected abstract LauncherSettingDialog dialog(); 31 | } 32 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/LauncherSettingWithSliderController.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.settings; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | import androidx.appcompat.widget.AppCompatSeekBar; 5 | import android.view.View; 6 | import android.widget.SeekBar; 7 | 8 | import eu.vcmi.vcmi.R; 9 | 10 | /** 11 | * @author F 12 | */ 13 | public abstract class LauncherSettingWithSliderController extends LauncherSettingController 14 | { 15 | private AppCompatSeekBar mSlider; 16 | private final int mSliderMin; 17 | private final int mSliderMax; 18 | 19 | protected LauncherSettingWithSliderController(final AppCompatActivity act, final int min, final int max) 20 | { 21 | super(act); 22 | mSliderMin = min; 23 | mSliderMax = max; 24 | } 25 | 26 | @Override 27 | protected void childrenInit(final View root) 28 | { 29 | mSlider = (AppCompatSeekBar) root.findViewById(R.id.inc_launcher_btn_slider); 30 | if (mSliderMax <= mSliderMin) 31 | { 32 | throw new IllegalArgumentException("slider min>=max"); 33 | } 34 | mSlider.setMax(mSliderMax - mSliderMin); 35 | mSlider.setOnSeekBarChangeListener(new OnValueChangedListener()); 36 | } 37 | 38 | protected abstract void onValueChanged(final int v); 39 | protected abstract int currentValue(); 40 | 41 | @Override 42 | public void updateContent() 43 | { 44 | super.updateContent(); 45 | mSlider.setProgress(currentValue() + mSliderMin); 46 | } 47 | 48 | @Override 49 | protected String subText() 50 | { 51 | return null; // not used with slider settings 52 | } 53 | 54 | @Override 55 | public void onClick(final View v) 56 | { 57 | // not used with slider settings 58 | } 59 | 60 | private class OnValueChangedListener implements SeekBar.OnSeekBarChangeListener 61 | { 62 | @Override 63 | public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) 64 | { 65 | if (fromUser) 66 | { 67 | onValueChanged(progress); 68 | } 69 | } 70 | 71 | @Override 72 | public void onStartTrackingTouch(final SeekBar seekBar) 73 | { 74 | 75 | } 76 | 77 | @Override 78 | public void onStopTrackingTouch(final SeekBar seekBar) 79 | { 80 | 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/ModsBtnController.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.settings; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | import android.view.View; 5 | 6 | import eu.vcmi.vcmi.R; 7 | 8 | /** 9 | * @author F 10 | */ 11 | public class ModsBtnController extends LauncherSettingController 12 | { 13 | private View.OnClickListener mOnSelectedAction; 14 | 15 | public ModsBtnController(final AppCompatActivity act, final View.OnClickListener onSelectedAction) 16 | { 17 | super(act); 18 | mOnSelectedAction = onSelectedAction; 19 | } 20 | 21 | @Override 22 | protected String mainText() 23 | { 24 | return mActivity.getString(R.string.launcher_btn_mods_title); 25 | } 26 | 27 | @Override 28 | protected String subText() 29 | { 30 | return mActivity.getString(R.string.launcher_btn_mods_subtitle); 31 | } 32 | 33 | @Override 34 | public void onClick(final View v) 35 | { 36 | mOnSelectedAction.onClick(v); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/MusicSettingController.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.settings; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import eu.vcmi.vcmi.Config; 6 | import eu.vcmi.vcmi.R; 7 | 8 | /** 9 | * @author F 10 | */ 11 | public class MusicSettingController extends LauncherSettingWithSliderController 12 | { 13 | public MusicSettingController(final AppCompatActivity act) 14 | { 15 | super(act, 0, 100); 16 | } 17 | 18 | @Override 19 | protected void onValueChanged(final int v) 20 | { 21 | mConfig.updateMusic(v); 22 | updateContent(); 23 | } 24 | 25 | @Override 26 | protected int currentValue() 27 | { 28 | if (mConfig == null) 29 | { 30 | return Config.DEFAULT_MUSIC_VALUE; 31 | } 32 | return mConfig.mVolumeMusic; 33 | } 34 | 35 | @Override 36 | protected String mainText() 37 | { 38 | return mActivity.getString(R.string.launcher_btn_music_title); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/PointerModeSettingController.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.settings; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | import eu.vcmi.vcmi.Config; 5 | import eu.vcmi.vcmi.R; 6 | 7 | /** 8 | * @author F 9 | */ 10 | public class PointerModeSettingController 11 | extends LauncherSettingWithDialogController 12 | { 13 | public PointerModeSettingController(final AppCompatActivity activity) 14 | { 15 | super(activity); 16 | } 17 | 18 | @Override 19 | protected LauncherSettingDialog dialog() 20 | { 21 | return new PointerModeSettingDialog(); 22 | } 23 | 24 | @Override 25 | public void onItemChosen(final PointerMode item) 26 | { 27 | mConfig.setPointerMode(item == PointerMode.RELATIVE); 28 | mConfig.updateSwipe(item.supportsSwipe()); 29 | updateContent(); 30 | } 31 | 32 | @Override 33 | protected String mainText() 34 | { 35 | return mActivity.getString(R.string.launcher_btn_pointermode_title); 36 | } 37 | 38 | @Override 39 | protected String subText() 40 | { 41 | if (mConfig == null) 42 | { 43 | return ""; 44 | } 45 | return mActivity.getString(R.string.launcher_btn_pointermode_subtitle, 46 | PointerModeSettingDialog.pointerModeToUserString(mActivity, getPointerMode())); 47 | } 48 | 49 | private PointerMode getPointerMode() 50 | { 51 | if(mConfig.getPointerModeIsRelative()) 52 | { 53 | return PointerMode.RELATIVE; 54 | } 55 | 56 | if(mConfig.mSwipeEnabled) 57 | { 58 | return PointerMode.NORMAL_WITH_SWIPE; 59 | } 60 | 61 | return PointerMode.NORMAL; 62 | } 63 | 64 | public enum PointerMode 65 | { 66 | NORMAL, 67 | NORMAL_WITH_SWIPE, 68 | RELATIVE; 69 | 70 | public boolean supportsSwipe() 71 | { 72 | return this == NORMAL_WITH_SWIPE; 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/PointerModeSettingDialog.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.settings; 2 | 3 | import android.content.Context; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | import eu.vcmi.vcmi.R; 9 | 10 | /** 11 | * @author F 12 | */ 13 | public class PointerModeSettingDialog extends LauncherSettingDialog 14 | { 15 | private static final List POINTER_MODES = new ArrayList<>(); 16 | 17 | static 18 | { 19 | POINTER_MODES.add(PointerModeSettingController.PointerMode.NORMAL); 20 | POINTER_MODES.add(PointerModeSettingController.PointerMode.NORMAL_WITH_SWIPE); 21 | POINTER_MODES.add(PointerModeSettingController.PointerMode.RELATIVE); 22 | } 23 | 24 | public PointerModeSettingDialog() 25 | { 26 | super(POINTER_MODES); 27 | } 28 | 29 | public static String pointerModeToUserString( 30 | final Context ctx, 31 | final PointerModeSettingController.PointerMode pointerMode) 32 | { 33 | switch (pointerMode) 34 | { 35 | default: 36 | return ""; 37 | case NORMAL: 38 | return ctx.getString(R.string.misc_pointermode_normal); 39 | case NORMAL_WITH_SWIPE: 40 | return ctx.getString(R.string.misc_pointermode_swipe); 41 | case RELATIVE: 42 | return ctx.getString(R.string.misc_pointermode_relative); 43 | } 44 | } 45 | 46 | @Override 47 | protected int dialogTitleResId() 48 | { 49 | return R.string.launcher_btn_pointermode_title; 50 | } 51 | 52 | @Override 53 | protected CharSequence itemName(final PointerModeSettingController.PointerMode item) 54 | { 55 | return pointerModeToUserString(getContext(), item); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/PointerMultiplierSettingController.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.settings; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import eu.vcmi.vcmi.Config; 6 | import eu.vcmi.vcmi.R; 7 | 8 | /** 9 | * @author F 10 | */ 11 | public class PointerMultiplierSettingController 12 | extends LauncherSettingWithDialogController 13 | { 14 | public PointerMultiplierSettingController(final AppCompatActivity activity) 15 | { 16 | super(activity); 17 | } 18 | 19 | @Override 20 | protected LauncherSettingDialog dialog() 21 | { 22 | return new PointerMultiplierSettingDialog(); 23 | } 24 | 25 | @Override 26 | public void onItemChosen(final Float item) 27 | { 28 | mConfig.setPointerSpeedMultiplier(item); 29 | updateContent(); 30 | } 31 | 32 | @Override 33 | protected String mainText() 34 | { 35 | return mActivity.getString(R.string.launcher_btn_pointermulti_title); 36 | } 37 | 38 | @Override 39 | protected String subText() 40 | { 41 | if (mConfig == null) 42 | { 43 | return ""; 44 | } 45 | 46 | String pointerModeString = PointerMultiplierSettingDialog.pointerMultiplierToUserString( 47 | mConfig.getPointerSpeedMultiplier()); 48 | 49 | return mActivity.getString(R.string.launcher_btn_pointermulti_subtitle, pointerModeString); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/PointerMultiplierSettingDialog.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.settings; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Locale; 6 | 7 | import eu.vcmi.vcmi.R; 8 | 9 | /** 10 | * @author F 11 | */ 12 | public class PointerMultiplierSettingDialog extends LauncherSettingDialog 13 | { 14 | private static final List AVAILABLE_MULTIPLIERS = new ArrayList<>(); 15 | 16 | static 17 | { 18 | AVAILABLE_MULTIPLIERS.add(1.0f); 19 | AVAILABLE_MULTIPLIERS.add(1.25f); 20 | AVAILABLE_MULTIPLIERS.add(1.5f); 21 | AVAILABLE_MULTIPLIERS.add(1.75f); 22 | AVAILABLE_MULTIPLIERS.add(2.0f); 23 | AVAILABLE_MULTIPLIERS.add(2.5f); 24 | AVAILABLE_MULTIPLIERS.add(3.0f); 25 | } 26 | 27 | public PointerMultiplierSettingDialog() 28 | { 29 | super(AVAILABLE_MULTIPLIERS); 30 | } 31 | 32 | @Override 33 | protected int dialogTitleResId() 34 | { 35 | return R.string.launcher_btn_pointermode_title; 36 | } 37 | 38 | @Override 39 | protected CharSequence itemName(final Float item) 40 | { 41 | return pointerMultiplierToUserString(item); 42 | } 43 | 44 | public static String pointerMultiplierToUserString(final float multiplier) 45 | { 46 | return String.format(Locale.US, "%.2fx", multiplier); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/ScreenResSettingController.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.settings; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import eu.vcmi.vcmi.Config; 6 | import eu.vcmi.vcmi.R; 7 | 8 | /** 9 | * @author F 10 | */ 11 | public class ScreenResSettingController extends LauncherSettingWithDialogController 12 | { 13 | public ScreenResSettingController(final AppCompatActivity activity) 14 | { 15 | super(activity); 16 | } 17 | 18 | @Override 19 | protected LauncherSettingDialog dialog() 20 | { 21 | return new ScreenResSettingDialog(mActivity); 22 | } 23 | 24 | @Override 25 | public void onItemChosen(final ScreenRes item) 26 | { 27 | mConfig.updateResolution(item.mWidth, item.mHeight); 28 | updateContent(); 29 | } 30 | 31 | @Override 32 | protected String mainText() 33 | { 34 | return mActivity.getString(R.string.launcher_btn_res_title); 35 | } 36 | 37 | @Override 38 | protected String subText() 39 | { 40 | if (mConfig == null) 41 | { 42 | return ""; 43 | } 44 | return mConfig.mResolutionWidth <= 0 || mConfig.mResolutionHeight <= 0 45 | ? mActivity.getString(R.string.launcher_btn_res_subtitle_unknown) 46 | : mActivity.getString(R.string.launcher_btn_res_subtitle, mConfig.mResolutionWidth, mConfig.mResolutionHeight); 47 | } 48 | 49 | public static class ScreenRes 50 | { 51 | public int mWidth; 52 | public int mHeight; 53 | 54 | public ScreenRes(final int width, final int height) 55 | { 56 | mWidth = width; 57 | mHeight = height; 58 | } 59 | 60 | @Override 61 | public String toString() 62 | { 63 | return mWidth + "x" + mHeight; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/SoundSettingController.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.settings; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import eu.vcmi.vcmi.Config; 6 | import eu.vcmi.vcmi.R; 7 | 8 | /** 9 | * @author F 10 | */ 11 | public class SoundSettingController extends LauncherSettingWithSliderController 12 | { 13 | public SoundSettingController(final AppCompatActivity act) 14 | { 15 | super(act, 0, 100); 16 | } 17 | 18 | @Override 19 | protected void onValueChanged(final int v) 20 | { 21 | mConfig.updateSound(v); 22 | updateContent(); 23 | } 24 | 25 | @Override 26 | protected int currentValue() 27 | { 28 | if (mConfig == null) 29 | { 30 | return Config.DEFAULT_SOUND_VALUE; 31 | } 32 | return mConfig.mVolumeSound; 33 | } 34 | 35 | @Override 36 | protected String mainText() 37 | { 38 | return mActivity.getString(R.string.launcher_btn_sound_title); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/StartGameController.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.settings; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | import android.view.View; 5 | 6 | import eu.vcmi.vcmi.R; 7 | import eu.vcmi.vcmi.util.GeneratedVersion; 8 | 9 | /** 10 | * @author F 11 | */ 12 | public class StartGameController extends LauncherSettingController 13 | { 14 | private View.OnClickListener mOnSelectedAction; 15 | 16 | public StartGameController(final AppCompatActivity act, final View.OnClickListener onSelectedAction) 17 | { 18 | super(act); 19 | mOnSelectedAction = onSelectedAction; 20 | } 21 | 22 | @Override 23 | protected String mainText() 24 | { 25 | return mActivity.getString(R.string.launcher_btn_start_title); 26 | } 27 | 28 | @Override 29 | protected String subText() 30 | { 31 | return mActivity.getString(R.string.launcher_btn_start_subtitle, GeneratedVersion.VCMI_VERSION); 32 | } 33 | 34 | @Override 35 | public void onClick(final View v) 36 | { 37 | mOnSelectedAction.onClick(v); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/util/AsyncRequest.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.util; 2 | 3 | import android.annotation.TargetApi; 4 | import android.os.AsyncTask; 5 | import android.os.Build; 6 | import androidx.annotation.RequiresApi; 7 | 8 | import java.net.HttpURLConnection; 9 | import java.net.URL; 10 | import java.util.Scanner; 11 | 12 | import eu.vcmi.vcmi.Const; 13 | 14 | /** 15 | * @author F 16 | */ 17 | public abstract class AsyncRequest extends AsyncTask> 18 | { 19 | @TargetApi(Const.SUPPRESS_TRY_WITH_RESOURCES_WARNING) 20 | protected ServerResponse sendRequest(final String url) 21 | { 22 | 23 | try 24 | { 25 | final HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(); 26 | final int responseCode = conn.getResponseCode(); 27 | if (!ServerResponse.isResponseCodeValid(responseCode)) 28 | { 29 | return new ServerResponse<>(responseCode, null); 30 | } 31 | 32 | try (Scanner s = new java.util.Scanner(conn.getInputStream()).useDelimiter("\\A")) 33 | { 34 | final String response = s.hasNext() ? s.next() : ""; 35 | return new ServerResponse<>(responseCode, response); 36 | } 37 | catch (final Exception e) 38 | { 39 | Log.e(this, "Request failed: ", e); 40 | } 41 | } 42 | catch (final Exception e) 43 | { 44 | Log.e(this, "Request failed: ", e); 45 | } 46 | return new ServerResponse<>(ServerResponse.LOCAL_ERROR_IO, null); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/util/GeneratedVersion.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.util; 2 | 3 | /** 4 | * Generated via cmake (./project/vcmi-app/cmake-scripts/versions.cmake) 5 | */ 6 | public class GeneratedVersion 7 | { 8 | public static final String VCMI_VERSION = "1.1.0 ()"; 9 | } 10 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/util/IZipProgressReporter.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.util; 2 | 3 | import java.io.File; 4 | 5 | public interface IZipProgressReporter 6 | { 7 | void onUnpacked(File newFile); 8 | } 9 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/util/LibsLoader.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.util; 2 | 3 | import android.content.Context; 4 | import android.os.Build; 5 | 6 | import org.libsdl.app.SDL; 7 | 8 | import eu.vcmi.vcmi.NativeMethods; 9 | 10 | /** 11 | * @author F 12 | */ 13 | public final class LibsLoader 14 | { 15 | private static void loadLib(final String libName, final boolean onlyForOldApis) 16 | { 17 | if (!onlyForOldApis || Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) 18 | { 19 | Log.v("Loading native lib: " + libName); 20 | SDL.loadLibrary(libName); 21 | } 22 | } 23 | 24 | private static void loadCommon() 25 | { 26 | loadLib("c++_shared", true); 27 | loadLib("iconv", true); 28 | loadLib("boost-system", true); 29 | loadLib("boost-datetime", true); 30 | loadLib("boost-locale", true); 31 | loadLib("boost-filesystem", true); 32 | loadLib("boost-program-options", true); 33 | loadLib("boost-thread", true); 34 | loadLib("SDL2", false); 35 | loadLib("x264", true); 36 | loadLib("avutil", true); 37 | loadLib("swscale", true); 38 | loadLib("swresample", true); 39 | loadLib("postproc", true); 40 | loadLib("avcodec", true); 41 | loadLib("avformat", true); 42 | loadLib("avfilter", true); 43 | loadLib("avdevice", true); 44 | loadLib("minizip", true); 45 | loadLib("vcmi-fuzzylite", true); 46 | loadLib("vcmi-lib", true); 47 | loadLib("SDL2_image", false); 48 | loadLib("SDL2_mixer", false); 49 | loadLib("SDL2_ttf", false); 50 | } 51 | 52 | public static void loadClientLibs(Context ctx) 53 | { 54 | loadCommon(); 55 | loadLib("vcmi-client", false); 56 | SDL.setContext(ctx); 57 | NativeMethods.clientSetupJNI(); 58 | NativeMethods.initClassloader(); 59 | } 60 | 61 | public static void loadServerLibs() 62 | { 63 | loadCommon(); 64 | loadLib("vcmi-server", false); 65 | NativeMethods.initClassloader(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/util/ServerResponse.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.util; 2 | 3 | /** 4 | * @author F 5 | */ 6 | public class ServerResponse 7 | { 8 | public static final int LOCAL_ERROR_IO = -1; 9 | public static final int LOCAL_ERROR_PARSING = -2; 10 | 11 | public int mCode; 12 | public String mRawContent; 13 | public T mContent; 14 | 15 | public ServerResponse(final int code, final String content) 16 | { 17 | mCode = code; 18 | mRawContent = content; 19 | } 20 | 21 | public static boolean isResponseCodeValid(final int responseCode) 22 | { 23 | return responseCode >= 200 && responseCode < 300; 24 | } 25 | 26 | public boolean isValid() 27 | { 28 | return isResponseCodeValid(mCode); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/util/Utils.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.util; 2 | 3 | import android.content.Context; 4 | import android.content.pm.PackageInfo; 5 | import android.content.pm.PackageManager; 6 | import android.content.res.Resources; 7 | import android.util.DisplayMetrics; 8 | 9 | /** 10 | * @author F 11 | */ 12 | 13 | public final class Utils 14 | { 15 | private static String sAppVersionCache; 16 | 17 | private Utils() 18 | { 19 | } 20 | 21 | public static String appVersionName(final Context ctx) 22 | { 23 | if (sAppVersionCache == null) 24 | { 25 | final PackageManager pm = ctx.getPackageManager(); 26 | try 27 | { 28 | final PackageInfo info = pm.getPackageInfo(ctx.getPackageName(), PackageManager.GET_META_DATA); 29 | return sAppVersionCache = info.versionName; 30 | } 31 | catch (final PackageManager.NameNotFoundException e) 32 | { 33 | Log.e(ctx, "Couldn't resolve app version", e); 34 | } 35 | } 36 | return sAppVersionCache; 37 | } 38 | 39 | public static float convertDpToPx(final Context ctx, final float dp) 40 | { 41 | return convertDpToPx(ctx.getResources(), dp); 42 | } 43 | 44 | public static float convertDpToPx(final Resources res, final float dp) 45 | { 46 | return dp * res.getDisplayMetrics().density; 47 | } 48 | 49 | public static float convertPxToDp(final Context ctx, final float px) 50 | { 51 | return convertPxToDp(ctx.getResources(), px); 52 | } 53 | 54 | public static float convertPxToDp(final Resources res, final float px) 55 | { 56 | return px / res.getDisplayMetrics().density; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/eu/vcmi/vcmi/viewmodels/ObservableViewModel.java: -------------------------------------------------------------------------------- 1 | package eu.vcmi.vcmi.viewmodels; 2 | 3 | import android.view.View; 4 | 5 | import androidx.lifecycle.ViewModel; 6 | import androidx.databinding.PropertyChangeRegistry; 7 | import androidx.databinding.Observable; 8 | 9 | /** 10 | * @author F 11 | */ 12 | public class ObservableViewModel extends ViewModel implements Observable 13 | { 14 | private PropertyChangeRegistry callbacks = new PropertyChangeRegistry(); 15 | 16 | @Override 17 | public void addOnPropertyChangedCallback( 18 | Observable.OnPropertyChangedCallback callback) 19 | { 20 | callbacks.add(callback); 21 | } 22 | 23 | @Override 24 | public void removeOnPropertyChangedCallback( 25 | Observable.OnPropertyChangedCallback callback) 26 | { 27 | callbacks.remove(callback); 28 | } 29 | 30 | public int visible(boolean isVisible) 31 | { 32 | return isVisible ? View.VISIBLE : View.GONE; 33 | } 34 | 35 | /** 36 | * Notifies observers that all properties of this instance have changed. 37 | */ 38 | void notifyChange() { 39 | callbacks.notifyCallbacks(this, 0, null); 40 | } 41 | 42 | /** 43 | * Notifies observers that a specific property has changed. The getter for the 44 | * property that changes should be marked with the @Bindable annotation to 45 | * generate a field in the BR class to be used as the fieldId parameter. 46 | * 47 | * @param fieldId The generated BR id for the Bindable field. 48 | */ 49 | void notifyPropertyChanged(int fieldId) { 50 | callbacks.notifyCallbacks(this, fieldId, null); 51 | } 52 | } -------------------------------------------------------------------------------- /project/vcmi-app/src/main/java/org/libsdl/app/HIDDevice.java: -------------------------------------------------------------------------------- 1 | package org.libsdl.app; 2 | 3 | import android.hardware.usb.UsbDevice; 4 | 5 | interface HIDDevice 6 | { 7 | public int getId(); 8 | public int getVendorId(); 9 | public int getProductId(); 10 | public String getSerialNumber(); 11 | public int getVersion(); 12 | public String getManufacturerName(); 13 | public String getProductName(); 14 | public UsbDevice getDevice(); 15 | public boolean open(); 16 | public int sendFeatureReport(byte[] report); 17 | public int sendOutputReport(byte[] report); 18 | public boolean getFeatureReport(byte[] report); 19 | public void setFrozen(boolean frozen); 20 | public void close(); 21 | public void shutdown(); 22 | } 23 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/drawable-nodpi/divider_compat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vcmi/vcmi-android/e63c25adcc56d27d18601fa700a41cdabb4a852a/project/vcmi-app/src/main/res/drawable-nodpi/divider_compat.png -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/drawable/compat_toolbar_shadow.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/drawable/ic_error.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/drawable/ic_info.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/drawable/ic_star_empty.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/drawable/ic_star_full.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/drawable/ic_star_half.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/drawable/overlay_edittext_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/drawable/recycler_divider_drawable.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/layout-v21/inc_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 18 | 19 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/layout/activity_error.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 22 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/layout/activity_game.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 19 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/layout/activity_mods.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 17 | 18 | 23 | 24 | 29 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/layout/activity_toolbar_wrapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 10 | 11 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/layout/dialog_authors.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 15 | 16 | 17 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 33 | 34 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/layout/inc_launcher_btn.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 10 | 11 | 15 | 16 | 21 | 22 | 26 | 27 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/layout/inc_launcher_slider.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 13 | 14 | 18 | 19 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/layout/inc_separator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/layout/inc_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 12 | 20 | 21 | 27 | 28 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/layout/mod_base_adapter_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 25 | 26 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/menu/menu_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/menu/menu_mods.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vcmi/vcmi-android/e63c25adcc56d27d18601fa700a41cdabb4a852a/project/vcmi-app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vcmi/vcmi-android/e63c25adcc56d27d18601fa700a41cdabb4a852a/project/vcmi-app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vcmi/vcmi-android/e63c25adcc56d27d18601fa700a41cdabb4a852a/project/vcmi-app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vcmi/vcmi-android/e63c25adcc56d27d18601fa700a41cdabb4a852a/project/vcmi-app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vcmi/vcmi-android/e63c25adcc56d27d18601fa700a41cdabb4a852a/project/vcmi-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/values-v21/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | #AAAAAA 5 | #2C332C 6 | #1F221F 7 | #BBBB55 8 | @color/accent 9 | #00000000 10 | -------------------------------------------------------------------------------- /project/vcmi-app/src/main/res/values/dimen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 5 | 80dp 6 | 48dp 7 | 8 | 14sp 9 | 18sp 10 | 22sp 11 | -------------------------------------------------------------------------------- /update_internal_assets.py: -------------------------------------------------------------------------------- 1 | import zipfile 2 | import os 3 | import sys 4 | import hashlib 5 | import shutil 6 | 7 | p = os.path 8 | 9 | def writeFolder(archive, folderPath, rootPath): 10 | for root, dirs, filenames in os.walk(folderPath): 11 | for name in filenames: 12 | archive.write(p.normpath(p.join(root, name)), root[len(rootPath):] + "/" + name) 13 | 14 | def createHash(path, outPath): 15 | blocksize = 65536 16 | hasher = hashlib.md5() 17 | with open(path, "rb") as file: 18 | buf = file.read(blocksize) 19 | while len(buf) > 0: 20 | hasher.update(buf) 21 | buf = file.read(blocksize) 22 | with open(outPath, "w") as file: 23 | file.write(hasher.hexdigest()) 24 | 25 | dir = p.dirname(p.realpath(sys.argv[0])) 26 | pathAssets = dir + "/project/vcmi-app/src/main/assets" 27 | pathOutInternalData = pathAssets + "/internalData.zip" 28 | pathOutHash = pathAssets + "/internalDataHash.txt" 29 | pathBase = dir + "/ext/vcmi" 30 | pathConfig = pathBase + "/config" 31 | pathMods = pathBase + "/Mods" 32 | 33 | assetsPaths = [ 34 | [pathConfig, pathBase], 35 | [pathMods, pathBase], 36 | [p.abspath(dir + "/../data/vcmi_submods/Mods"), p.abspath(dir + "/../data/vcmi_submods")] # templates + extra res 37 | ] 38 | 39 | with zipfile.ZipFile(pathOutInternalData, "w", zipfile.ZIP_DEFLATED) as zf: 40 | for path in assetsPaths: 41 | if not p.exists(path[0]): 42 | print("Skipping path " + path[0] + " (not found)") 43 | continue 44 | writeFolder(zf, path[0], path[1]) 45 | 46 | createHash(pathOutInternalData, pathOutHash) 47 | 48 | #copy authors file into app resources so that we can display it in about view 49 | try: 50 | shutil.copy2(dir + "/ext/vcmi/AUTHORS", dir + "/project/vcmi-app/src/main/res/raw/authors.txt") 51 | except IOError as e: 52 | print("Could not update authors file: " + e.strerror) -------------------------------------------------------------------------------- /vcmiconf.json: -------------------------------------------------------------------------------- 1 | { 2 | "bash" : 3 | { 4 | "projectRoot" : "/mnt/q/Dev/VCMI/vcmi-android", 5 | "ndkRoot" : "/mnt/q/P/Android/android-ndk-r15-linux" 6 | }, 7 | "projectRoot" : "q:/Dev/VCMI/vcmi-android", 8 | "sdkRoot" : "Q:/P/Android/android-sdk", 9 | "javaRoot": "Q:/P/Java/8", 10 | "abis" : "armeabi-v7a arm64-v8a x86", 11 | "boostFolderName" : "boost_1_68_0", 12 | "androidApi" : 21, 13 | "cmakeBuildMode" : "Release" 14 | } -------------------------------------------------------------------------------- /vcmiconf.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import json 3 | import vcmiutil 4 | 5 | def updateProjectProps(): 6 | replacements = [ vcmiutil.ReplacementEntry("PROJECT_PATH_BASE", "PROJECT_PATH_BASE = " + config["projectRoot"]) ] 7 | vcmiutil.fixFile("./project/gradle.properties", replacements, False) 8 | 9 | def createLocalProps(): 10 | vcmiutil.rewriteFile("./project/local.properties", 11 | "sdk.dir=" + config["sdkRoot"].replace(":", "\\:")) 12 | 13 | config = [] 14 | with open("./vcmiconf.json", "r") as confFile: 15 | try: 16 | config = json.loads(confFile.read()) 17 | config["extOutput"] = config["projectRoot"] + "/ext-output" 18 | config["bash"]["extOutput"] = config["bash"]["projectRoot"] + "/ext-output" 19 | except Exception as ex: 20 | print("Could not load config", ex) 21 | sys.exit(1) -------------------------------------------------------------------------------- /vcmiutil.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | 4 | class ReplacementEntry: 5 | def __init__(self, src, dst): 6 | self.src = src 7 | self.dst = dst 8 | 9 | def rewriteFile(path, content): 10 | replacementFile = open(path + "__tmp", "w") 11 | replacementFile.write(content) 12 | replacementFile.close() 13 | os.replace(path + "__tmp", path) 14 | 15 | def entryMatches(entry, line, fullMatch): 16 | if fullMatch: 17 | return entry == line 18 | else: 19 | return str.find(line, entry) == 0 # basically line.startsWith(entry) 20 | 21 | def fixFile(path, replacements, fullMatch=True): 22 | try: 23 | inputFile = open(path, "r") 24 | outputContent = "" 25 | replacedCount = 0 26 | for line in inputFile: 27 | replaced = False 28 | for rep in replacements: 29 | if entryMatches(rep.src.strip(), line.strip(), fullMatch): 30 | outputContent += rep.dst + "\n" 31 | replacedCount = replacedCount + 1 32 | replaced = True 33 | break 34 | if replaced == False: 35 | outputContent += line 36 | inputFile.close() 37 | rewriteFile(path, outputContent) 38 | 39 | if replacedCount > 0: 40 | print("Fixed " + path + " (replaced " + str(replacedCount) + " lines)") 41 | else: 42 | print("Didn't fix anything in " + path + " (already fixed?)") 43 | except FileNotFoundError: 44 | print("File " + path + " not found; skipping") 45 | 46 | def flatCopyWithExt(srcDir, dstDir, ext): 47 | if not os.path.exists(dstDir): 48 | os.makedirs(dstDir) 49 | for basename in os.listdir(srcDir): 50 | if basename.endswith(ext): 51 | pathname = os.path.join(srcDir, basename) 52 | if os.path.isfile(pathname): 53 | shutil.copy2(pathname, dstDir) 54 | 55 | def copytree(src, dst, symlinks=False, ignore=None): 56 | if not os.path.exists(dst): 57 | os.makedirs(dst) 58 | for item in os.listdir(src): 59 | s = os.path.join(src, item) 60 | d = os.path.join(dst, item) 61 | if os.path.isdir(s): 62 | copytree(s, d, symlinks, ignore) 63 | else: 64 | if not os.path.exists(d) or os.stat(s).st_mtime - os.stat(d).st_mtime > 1: 65 | shutil.copy2(s, d) --------------------------------------------------------------------------------