├── .github └── workflows │ ├── build_android.yml │ ├── build_darwin.yml │ ├── build_linux.yml │ ├── build_web.yml │ ├── build_win.yml │ └── build_win_msvc.yml ├── .gitignore ├── .gitmodules ├── .vscode ├── c_cpp_properties.json └── launch.json ├── CMakeLists.txt ├── LICENSE ├── README.md ├── asset ├── icon1.ico ├── icon1.png └── icon1.rc ├── docker ├── Dockerfile_android ├── Dockerfile_emcc ├── Dockerfile_linuxarm64 ├── Dockerfile_linuxx64 ├── Dockerfile_mingw64 ├── docker_android.sh ├── docker_emcc.sh ├── docker_linuxarm64.sh ├── docker_linuxx64.sh └── docker_mingw64.sh ├── screenshot ├── onsyuri_mo2_linuxtest.jpg ├── onsyuri_mo2_linuxtest2.png ├── onsyuri_mo2_webtest.png ├── onsyuri_mo2_webtest2.png ├── onsyuri_mo2_webtest3.jpg ├── onsyuri_ui_androidtest1.jpg └── onsyuri_ui_androidtest2.jpg ├── script ├── _android.sh ├── _fetch.sh ├── _linux32.sh ├── _linux64.sh ├── _linuxa32.sh ├── _linuxa64.sh ├── _llvmmingw32.sh ├── _llvmmingw64.sh ├── _mingw32.sh ├── _mingw64.sh ├── cross_android.sh ├── cross_linux32.sh ├── cross_linux64.sh ├── cross_linuxa32.sh ├── cross_linuxa64.sh ├── cross_llvmmingw32.sh ├── cross_llvmmingw64.sh ├── cross_mingw32.sh ├── cross_mingw64.sh ├── cross_web.sh ├── local_darwin.sh ├── local_linux32.sh ├── local_linux64.sh ├── local_msys2mingw32.sh └── local_msys2mingw64.sh ├── src ├── onsyuri │ ├── AVIWrapper.cpp │ ├── AVIWrapper.h │ ├── AnimationInfo.cpp │ ├── AnimationInfo.h │ ├── BaseReader.h │ ├── ButtonLink.h │ ├── COPYING │ ├── DirectReader.cpp │ ├── DirectReader.h │ ├── DirtyRect.cpp │ ├── DirtyRect.h │ ├── FontInfo.cpp │ ├── FontInfo.h │ ├── LUAHandler.cpp │ ├── LUAHandler.h │ ├── NsaReader.cpp │ ├── NsaReader.h │ ├── ONScripter.cpp │ ├── ONScripter.h │ ├── ONScripter_animation.cpp │ ├── ONScripter_command.cpp │ ├── ONScripter_effect.cpp │ ├── ONScripter_effect_breakup.cpp │ ├── ONScripter_event.cpp │ ├── ONScripter_file.cpp │ ├── ONScripter_file2.cpp │ ├── ONScripter_image.cpp │ ├── ONScripter_lut.cpp │ ├── ONScripter_rmenu.cpp │ ├── ONScripter_sound.cpp │ ├── ONScripter_text.cpp │ ├── Parallel.cpp │ ├── Parallel.h │ ├── README.md │ ├── README.old │ ├── SarReader.cpp │ ├── SarReader.h │ ├── ScriptHandler.cpp │ ├── ScriptHandler.h │ ├── ScriptParser.cpp │ ├── ScriptParser.h │ ├── ScriptParser_command.cpp │ ├── Utils.h │ ├── builtin_dll │ │ ├── ONScripter_effect_cascade.cpp │ │ ├── ONScripter_effect_trig.cpp │ │ ├── layer_oldmovie.cpp │ │ └── layer_snow.cpp │ ├── builtin_layer.h │ ├── coding2utf16.cpp │ ├── coding2utf16.h │ ├── gbk2utf16.cpp │ ├── gbk2utf16.h │ ├── onscripter_main.cpp │ ├── renderer │ │ ├── gles2funcs.h │ │ ├── gles_renderer.cpp │ │ ├── gles_renderer.h │ │ └── shader │ │ │ └── post_cas.h │ ├── resize_image.cpp │ ├── resize_image.h │ ├── simd │ │ ├── int16x16.h │ │ ├── int16x16.inl │ │ ├── int16x4.h │ │ ├── int16x4.inl │ │ ├── int16x8.h │ │ ├── int16x8.inl │ │ ├── int32x2.h │ │ ├── int32x2.inl │ │ ├── int32x4.h │ │ ├── int32x4.inl │ │ ├── int8x16.h │ │ ├── int8x16.inl │ │ ├── int8x32.h │ │ ├── int8x32.inl │ │ ├── int8x4.h │ │ ├── int8x4.inl │ │ ├── int8x8.h │ │ ├── int8x8.inl │ │ ├── simd.h │ │ ├── vec128.h │ │ ├── vec128.inl │ │ ├── vec256.h │ │ └── vec256.inl │ ├── simple_aviplay.cpp │ ├── sjis2utf16.cpp │ ├── sjis2utf16.h │ ├── tool │ │ ├── conv_shared.cpp │ │ ├── nsaconv.cpp │ │ ├── nsadec.cpp │ │ ├── nscriptdecode.cpp │ │ ├── sarconv.cpp │ │ └── sardec.cpp │ └── version.h ├── onsyuri_android │ ├── .idea │ │ ├── .gitignore │ │ ├── compiler.xml │ │ ├── gradle.xml │ │ ├── misc.xml │ │ └── modules │ │ │ └── app │ │ │ ├── onsyuri.app.androidTest.iml │ │ │ └── onsyuri.app.unitTest.iml │ ├── app │ │ ├── AndroidManifest.xml │ │ ├── build.gradle │ │ ├── cpp │ │ │ └── CMakeLists.txt │ │ ├── java │ │ │ ├── com │ │ │ │ └── yuri │ │ │ │ │ └── onscripter │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ ├── ONScripter.java │ │ │ │ │ └── SafFile.java │ │ │ └── org │ │ │ │ └── libsdl │ │ │ │ └── app │ │ │ │ ├── HIDDevice.java │ │ │ │ ├── HIDDeviceBLESteamController.java │ │ │ │ ├── HIDDeviceManager.java │ │ │ │ ├── HIDDeviceUSB.java │ │ │ │ ├── SDL.java │ │ │ │ ├── SDLActivity.java │ │ │ │ ├── SDLAudioManager.java │ │ │ │ ├── SDLControllerManager.java │ │ │ │ └── SDLSurface.java │ │ ├── proguard-rules.pro │ │ ├── res │ │ │ ├── layout │ │ │ │ ├── activity_main.xml │ │ │ │ ├── layout_gameconfig.xml │ │ │ │ ├── layout_gamedetail.xml │ │ │ │ └── layout_gameinfo.xml │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values-night │ │ │ │ ├── colors.xml │ │ │ │ └── themes.xml │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ ├── strings.xml │ │ │ │ └── themes.xml │ │ │ └── xml │ │ │ │ ├── backup_rules.xml │ │ │ │ ├── data_extraction_rules.xml │ │ │ │ └── file_paths.xml │ │ └── sign.jks │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── onsyuri_libretro │ ├── CMakeLists.txt │ ├── SDL_libretro.c │ ├── SDL_libretro.h │ ├── cursor_png.h │ ├── deps │ │ ├── SDL_config.h │ │ ├── SDL_dynapi.h │ │ ├── close_code.h │ │ └── lua.hpp │ ├── libretro.cpp │ ├── libretro.h │ ├── link.T │ └── onsyuri_libretro.info └── onsyuri_web │ ├── dummy.c │ ├── onsyuri.html │ └── onsyuri_index.py └── vcpkg.json /.github/workflows/build_android.yml: -------------------------------------------------------------------------------- 1 | name: build android 2 | on: 3 | push: {tags: ['v*']} # Push events to matching v*, i.e. v1.0, v20.15.10 4 | pull_request: 5 | 6 | permissions: 7 | contents: write 8 | 9 | jobs: 10 | build_android: 11 | runs-on: ubuntu-24.04 12 | steps: 13 | - uses: actions/checkout@v3 14 | 15 | - uses: actions/setup-java@v3 16 | with: 17 | java-version: '11' 18 | distribution: 'temurin' 19 | cache: gradle 20 | 21 | - name: build onsyuri_android 22 | env: 23 | SIGN_KEY_ALIAS: ${{ secrets.SIGN_KEY_ALIAS }} 24 | SIGN_KEY_PASS: ${{ secrets.SIGN_KEY_PASS }} 25 | SIGN_STORE_PASS: ${{ secrets.SIGN_STORE_PASS }} 26 | run: | 27 | if [ -z "$(echo ${{ github.ref_name }} | grep merge)" ]; then 28 | sed -i -E 's/#define ONS_YURI_VERSION "(.+?)"/#define ONS_YURI_VERSION "${{ github.ref_name }}"/g' src/onsyuri/version.h 29 | fi 30 | cd script 31 | bash ./cross_android.sh 32 | cd - 33 | file build_android/outputs/apk/release/*.apk 34 | 35 | - name: prepare to release 36 | if: github.event_name == 'push' 37 | run: cp ./build_android/outputs/apk/release/*.apk onsyuri_${{ github.ref_name }}_android.apk 38 | 39 | - name: create release 40 | uses: ncipollo/release-action@v1 41 | if: github.event_name == 'push' 42 | with: 43 | artifacts: "onsyuri_${{ github.ref_name }}_android.apk" 44 | allowUpdates: "true" 45 | token: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.github/workflows/build_darwin.yml: -------------------------------------------------------------------------------- 1 | name: build MacOS 2 | on: 3 | push: {tags: ['v*']} # Push events to matching v*, i.e. v1.0, v20.15.10 4 | pull_request: 5 | 6 | permissions: 7 | contents: write 8 | 9 | jobs: 10 | build_darwin_aarch64: 11 | runs-on: macos-14 12 | steps: 13 | - uses: actions/checkout@v3 14 | 15 | - name: Install dependencies 16 | run: | 17 | brew install sdl2 sdl2_ttf sdl2_image sdl2_mixer lua bzip2 18 | 19 | - name: Build 20 | run: | 21 | cd script 22 | bash ./local_darwin.sh 23 | 24 | - name: prepare release 25 | if: github.event_name == 'push' 26 | run: | 27 | cd build_darwin 28 | mv onsyuri onsyuri_${{ github.ref_name }}_aarch64_darwin 29 | 30 | - name: create release 31 | uses: ncipollo/release-action@v1 32 | if: github.event_name == 'push' 33 | with: 34 | artifacts: "./build_darwin/onsyuri_${{ github.ref_name }}_aarch64_darwin" 35 | allowUpdates: "true" 36 | token: ${{ secrets.GITHUB_TOKEN }} 37 | 38 | build_darwin_x86-64: 39 | runs-on: macos-13 40 | steps: 41 | - uses: actions/checkout@v3 42 | 43 | - name: Install dependencies 44 | run: | 45 | brew install sdl2 sdl2_ttf sdl2_image sdl2_mixer lua bzip2 46 | 47 | - name: Build 48 | run: | 49 | cd script 50 | bash ./local_darwin.sh 51 | 52 | - name: prepare release 53 | if: github.event_name == 'push' 54 | run: | 55 | cd build_darwin 56 | mv onsyuri onsyuri_${{ github.ref_name }}_x86-64_darwin 57 | 58 | - name: create release 59 | uses: ncipollo/release-action@v1 60 | if: github.event_name == 'push' 61 | with: 62 | artifacts: "./build_darwin/onsyuri_${{ github.ref_name }}_x86-64_darwin" 63 | allowUpdates: "true" 64 | token: ${{ secrets.GITHUB_TOKEN }} 65 | -------------------------------------------------------------------------------- /.github/workflows/build_linux.yml: -------------------------------------------------------------------------------- 1 | name: build linux x86, x64, arm32, arm64 2 | on: 3 | push: {tags: ['v*']} # Push events to matching v*, i.e. v1.0, v20.15.10 4 | pull_request: 5 | 6 | permissions: 7 | contents: write 8 | 9 | jobs: 10 | install_thirdparty_build: 11 | runs-on: ubuntu-22.04 # default batch, powershell 12 | steps: 13 | - uses: actions/checkout@v3 14 | 15 | - name: check or download thirdparty_build cache 16 | id: check_thirdparty_build 17 | uses: actions/cache@v3 18 | with: 19 | path: ./thirdparty 20 | key: thirdparty_build 21 | 22 | - name: download thirdparty_build 23 | if: steps.check_thirdparty_build.outputs.cache-hit != 'true' 24 | run: | 25 | curl -fsSL https://github.com/YuriSizuku/OnscripterYuri/releases/download/v0.6/thirdparty_build.tar.gz -O 26 | tar xvzf thirdparty_build.tar.gz 27 | 28 | build_linux: 29 | strategy: 30 | matrix: 31 | arch: [{suffix2: 32, suffix: x86}, {suffix2: 64, suffix: x64}, {suffix2: a32, suffix: arm32}, {suffix2: a64, suffix: arm64}] 32 | 33 | runs-on: ubuntu-22.04 34 | needs: install_thirdparty_build 35 | steps: 36 | - uses: actions/checkout@v3 37 | 38 | - name: get thirdparty_build cache 39 | uses: actions/cache@v3 40 | with: 41 | key: thirdparty_build 42 | path: ./thirdparty 43 | 44 | - name: prepare enviroment 45 | run: | 46 | sudo apt-get update 47 | sudo apt-get -y install gcc-multilib g++-multilib 48 | sudo apt-get -y install crossbuild-essential-i386 49 | sudo apt-get -y install crossbuild-essential-armhf 50 | sudo apt-get -y install crossbuild-essential-arm64 51 | 52 | - name: build onsyuri_${{ matrix.arch.suffix }}_linux 53 | run: | 54 | if [ -z "$(echo ${{ github.ref_name }} | grep merge)" ]; then 55 | sed -i -E 's/#define ONS_YURI_VERSION "(.+?)"/#define ONS_YURI_VERSION "${{ github.ref_name }}"/g' src/onsyuri/version.h 56 | fi 57 | cd script 58 | SKIP_PORTS=yes bash cross_linux${{ matrix.arch.suffix2 }}.sh 59 | 60 | - name: prepare release 61 | if: github.event_name == 'push' 62 | run: | 63 | cd build_linux${{ matrix.arch.suffix2 }} 64 | mv onsyuri onsyuri_${{ github.ref_name }}_${{ matrix.arch.suffix }}_linux 65 | 66 | - name: create release 67 | uses: ncipollo/release-action@v1 68 | if: github.event_name == 'push' 69 | with: 70 | artifacts: "build_linux${{ matrix.arch.suffix2 }}/onsyuri_*" 71 | allowUpdates: "true" 72 | token: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.github/workflows/build_web.yml: -------------------------------------------------------------------------------- 1 | name: build web 2 | on: 3 | push: {tags: ['v*']} # Push events to matching v*, i.e. v1.0, v20.15.10 4 | pull_request: 5 | 6 | permissions: 7 | contents: write 8 | 9 | env: 10 | EMSDK_HOME: /opt/emsdk 11 | BUILD_NAME: onsyuri_web 12 | 13 | jobs: 14 | install_emsdk: 15 | runs-on: ubuntu-24.04 # default batch, powershell 16 | steps: 17 | - uses: actions/checkout@v3 18 | 19 | - name: check or make emsdk cache 20 | id: check_emsdk 21 | uses: actions/cache@v3 22 | with: 23 | path: ${{ env.EMSDK_HOME }} 24 | key: emsdk 25 | 26 | - name: install emsdk 27 | if: steps.check_emsdk.outputs.cache-hit != 'true' 28 | run: | 29 | git clone https://github.com/emscripten-core/emsdk.git ${{ env.EMSDK_HOME }} 30 | cd ${{ env.EMSDK_HOME }} 31 | ./emsdk install latest && ./emsdk activate latest 32 | source ./emsdk_env.sh 33 | embuilder build sdl2 sdl2_ttf sdl2_image sdl2_mixer bzip2 ogg vorbis mpg123 34 | 35 | build_web: 36 | runs-on: ubuntu-24.04 37 | needs: install_emsdk 38 | steps: 39 | - uses: actions/checkout@v3 40 | 41 | - name: get emsdk cache 42 | uses: actions/cache@v3 43 | with: 44 | key: emsdk 45 | path: ${{ env.EMSDK_HOME }} 46 | 47 | - name: build onsyuri_web 48 | run: | 49 | if [ -z "$(echo ${{ github.ref_name }} | grep merge)" ]; then 50 | sed -i -E 's/#define ONS_YURI_VERSION "(.+?)"/#define ONS_YURI_VERSION "${{ github.ref_name }}"/g' src/onsyuri/version.h 51 | fi 52 | cd script 53 | EMCSDK=${{ env.EMCSDK }} bash ./cross_web.sh 54 | 55 | - name: prepare release 56 | if: github.event_name == 'push' 57 | run: | 58 | cd build_web 59 | mkdir ${{ env.BUILD_NAME }} 60 | cp onsyuri{.html,.js,.wasm} ${{ env.BUILD_NAME }}/ 61 | cp onsyuri_index.py ${{ env.BUILD_NAME }}/ 62 | 7z a -t7z -mtc=on -ms=off -mx=5 -m0=lzma2 ${{ env.BUILD_NAME }}.7z ${{ env.BUILD_NAME }} 63 | mv ${{ env.BUILD_NAME }}.7z onsyuri_${{ github.ref_name }}_web.7z 64 | 65 | - name: create release 66 | uses: ncipollo/release-action@v1 67 | if: github.event_name == 'push' 68 | with: 69 | artifacts: "./build_web/onsyuri_${{ github.ref_name }}_web.7z" 70 | allowUpdates: "true" 71 | token: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.github/workflows/build_win.yml: -------------------------------------------------------------------------------- 1 | name: build windows x86, x64 2 | on: 3 | push: {tags: ['v*']} # Push events to matching v*, i.e. v1.0, v20.15.10 4 | pull_request: 5 | 6 | permissions: 7 | contents: write 8 | 9 | jobs: 10 | install_thirdparty_build: 11 | runs-on: ubuntu-22.04 # default batch, powershell 12 | steps: 13 | - uses: actions/checkout@v3 14 | 15 | - name: check or download thirdparty_build cache 16 | id: check_thirdparty_build 17 | uses: actions/cache@v3 18 | with: 19 | path: ./thirdparty 20 | key: thirdparty_build 21 | 22 | # this should be fixed to download the inital commit thirdparty 23 | - name: download thirdparty_build 24 | if: steps.check_thirdparty_build.outputs.cache-hit != 'true' 25 | run: | 26 | curl -fsSL https://github.com/YuriSizuku/OnscripterYuri/releases/download/v0.6/thirdparty_build.tar.gz -O 27 | tar xvzf thirdparty_build.tar.gz 28 | 29 | build_win: 30 | strategy: 31 | matrix: 32 | arch: [{suffix2: 32, suffix: x86}, {suffix2: 64, suffix: x64}] 33 | 34 | runs-on: ubuntu-22.04 35 | needs: install_thirdparty_build 36 | steps: 37 | - uses: actions/checkout@v3 38 | 39 | - name: get thirdparty_build cache 40 | uses: actions/cache@v3 41 | with: 42 | key: thirdparty_build 43 | path: ./thirdparty 44 | 45 | - name: Set up MinGW 46 | uses: egor-tensin/setup-mingw@v2 47 | with: 48 | platform: ${{ matrix.arch.suffix }} 49 | 50 | - name: build onsyuri_${{ matrix.arch.suffix }}_win.exe 51 | run: | 52 | if [ -z "$(echo ${{ github.ref_name }} | grep merge)" ]; then 53 | sed -i -E 's/#define ONS_YURI_VERSION "(.+?)"/#define ONS_YURI_VERSION "${{ github.ref_name }}"/g' src/onsyuri/version.h 54 | fi 55 | cd script 56 | SKIP_PORTS=yes bash cross_mingw${{ matrix.arch.suffix2 }}.sh 57 | 58 | - name: prepare release 59 | if: github.event_name == 'push' 60 | run: | 61 | cd build_mingw${{ matrix.arch.suffix2 }} 62 | mv onsyuri.exe onsyuri_${{ github.ref_name }}_${{ matrix.arch.suffix }}_win.exe 63 | 64 | - name: create release 65 | uses: ncipollo/release-action@v1 66 | if: github.event_name == 'push' 67 | with: 68 | artifacts: "build_mingw${{ matrix.arch.suffix2 }}/onsyuri_*.exe" 69 | allowUpdates: "true" 70 | token: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # general 2 | .vscode/settings.json 3 | asset/*test*/** 4 | asset/stdout.txt 5 | asset/stderr.txt 6 | build/** 7 | build_*/** 8 | thirdparty/** 9 | script/*.json 10 | save 11 | 12 | # android 13 | local.properties 14 | sign.properties 15 | src/onsyuri_android/.gradle 16 | src/onsyuri_android/local.properties 17 | src/onsyuri_android/.idea/caches 18 | src/onsyuri_android/.idea/libraries 19 | src/onsyuri_android/.idea/vcs.xml 20 | src/onsyuri_android/.idea/modules.xml 21 | src/onsyuri_android/.idea/workspace.xml 22 | src/onsyuri_android/.idea/navEditor.xml 23 | src/onsyuri_android/.idea/migrations.xml 24 | src/onsyuri_android/.idea/assetWizardSettings.xml 25 | src/onsyuri_android/.idea/deploymentTargetDropDown.xml 26 | src/onsyuri_android/.idea/deploymentTargetSelector.xml 27 | src/onsyuri_android/.idea/inspectionProfiles 28 | src/onsyuri_android/app/cpp/thirdparty/** 29 | src/onsyuri_android/app/.cxx/** 30 | src/onsyuri_android/app/debug/** 31 | src/onsyuri_android/app/release/** -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/onsyuri_libretro/deps/SDL"] 2 | path = src/onsyuri_libretro/deps/SDL 3 | url = https://github.com/libsdl-org/SDL.git 4 | [submodule "src/onsyuri_libretro/deps/SDL_mixer"] 5 | path = src/onsyuri_libretro/deps/SDL_mixer 6 | url = https://github.com/libsdl-org/SDL_mixer.git 7 | [submodule "src/onsyuri_libretro/deps/SDL_ttf"] 8 | path = src/onsyuri_libretro/deps/SDL_ttf 9 | url = https://github.com/libsdl-org/SDL_ttf.git 10 | [submodule "src/onsyuri_libretro/deps/SDL_image"] 11 | path = src/onsyuri_libretro/deps/SDL_image 12 | url = https://github.com/libsdl-org/SDL_image.git 13 | [submodule "src/onsyuri_libretro/deps/bzip2"] 14 | path = src/onsyuri_libretro/deps/bzip2 15 | url = https://github.com/libarchive/bzip2.git 16 | [submodule "src/onsyuri_libretro/deps/lua"] 17 | path = src/onsyuri_libretro/deps/lua 18 | url = https://github.com/lua/lua.git 19 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { // edit your env here 3 | "msys2sdk": "${env:MSYS2_HOME}", 4 | "mingwsdk" : "${env:LLVMMINGW_HOME}", 5 | "emsdk": "${env:EMSDK_HOME}" 6 | }, 7 | "configurations": [ 8 | { 9 | "name": "Win_llvmmingw32", 10 | "includePath": [ 11 | "${workspaceFolder}/src/onsyuri/**", 12 | "${workspaceFolder}/thirdparty/build/arch_llvmmingw32/include/**", 13 | "${mingwsdk}/include" 14 | ], 15 | "defines": [ 16 | "_WIN32", 17 | "USE_LUA", 18 | "USE_PARALLEL", 19 | "USE_BUILTIN_LAYER_EFFECTS", 20 | "USE_GLES", 21 | "USE_FILELOG" 22 | ], 23 | "compilerPath": "${mingwsdk}/bin/clang.exe", 24 | "intelliSenseMode": "windows-clang-x86", 25 | "compilerArgs": [ "-m32" ] 26 | }, 27 | { 28 | "name": "Win_llvmmingw64", 29 | "includePath": [ 30 | "${workspaceFolder}/src/onsyuri/**", 31 | "${workspaceFolder}/thirdparty/build/arch_llvmmingw64/include/**", 32 | "${mingwsdk}/include" 33 | ], 34 | "defines": [ 35 | "_WIN32", 36 | "USE_LUA", 37 | "USE_PARALLEL", 38 | "USE_SIMD", 39 | "USE_SIMD_X86_SSE2", 40 | "USE_BUILTIN_LAYER_EFFECTS", 41 | "USE_GLES", 42 | "USE_FILELOG" 43 | ], 44 | "compilerPath": "${mingwsdk}/bin/clang.exe", 45 | "intelliSenseMode": "windows-clang-x64", 46 | "compilerArgs": [ "-m64" ] 47 | }, 48 | { 49 | "name": "Linux_x64", 50 | "includePath": [ 51 | "${workspaceFolder}/src/onsyuri/**", 52 | "${workspaceFolder}/thirdparty/build/arch_linux64/include", 53 | "/usr/include" 54 | ], 55 | "defines": [ 56 | "LINUX", 57 | "USE_LUA", 58 | "USE_PARALLEL" 59 | ], 60 | "compilerPath": "/usr/bin/gcc", 61 | "cStandard": "c99", 62 | "cppStandard": "c++11", 63 | "intelliSenseMode": "linux-gcc-x64", 64 | "compilerArgs": [] 65 | }, 66 | { 67 | "name": "Linux_aacrh64", 68 | "includePath": [ 69 | "${workspaceFolder}/src/onsyuri/**", 70 | "${workspaceFolder}/thirdparty/build/arch_linuxa64/include/**" 71 | ], 72 | "defines": [ 73 | "LINUX", 74 | "USE_LUA", 75 | "USE_PARALLEL" 76 | ], 77 | "compilerPath": "/usr/bin/aarch64-linux-gnu-gcc", 78 | "cStandard": "c99", 79 | "cppStandard": "c++11", 80 | "intelliSenseMode": "linux-gcc-arm64", 81 | "compilerArgs": [] 82 | }, 83 | { 84 | "name": "Web_wasm", 85 | "includePath": [ 86 | "${workspaceFolder}/src/onsyuri/**", 87 | "${workspaceFolder}/thirdparty/build/arch_wasm/include", 88 | "${emsdk}/upstream/emscripten/cache/sysroot/include" 89 | ], 90 | "defines": [ 91 | "WEB", 92 | "LINUX", 93 | "USE_LUA", 94 | "USE_PARALLEL", 95 | "USE_BUILTIN_LAYER_EFFECTS" 96 | ], 97 | "compilerPath": "${emsdk}/upstream/bin/clang", 98 | "cStandard": "c99", 99 | "cppStandard": "c++11", 100 | "intelliSenseMode": "linux-clang-x64" 101 | } 102 | ], 103 | "version": 4 104 | } -------------------------------------------------------------------------------- /asset/icon1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuriSizuku/OnscripterYuri/ff12c7eaef2560a77a1f90fc796f63970216f42d/asset/icon1.ico -------------------------------------------------------------------------------- /asset/icon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuriSizuku/OnscripterYuri/ff12c7eaef2560a77a1f90fc796f63970216f42d/asset/icon1.png -------------------------------------------------------------------------------- /asset/icon1.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON "icon1.ico" 2 | 3 | 1 VERSIONINFO 4 | FILEVERSION 1,0,0,0 5 | PRODUCTVERSION 1,0,0,0 6 | BEGIN 7 | BLOCK "StringFileInfo" 8 | BEGIN 9 | BLOCK "080904E4" 10 | BEGIN 11 | VALUE "CompanyName", "YuriSizuku" 12 | VALUE "FileDescription", "An enhancement ONScripter project porting to many platforms, especially web" 13 | VALUE "FileVersion", "0.7.6" 14 | VALUE "InternalName", "onsyuri" 15 | VALUE "OriginalFilename", "onsyuri.exe" 16 | VALUE "ProductName", "ONScripterYuri" 17 | VALUE "ProductVersion", "0.7.6" 18 | END 19 | END 20 | BLOCK "VarFileInfo" 21 | BEGIN 22 | VALUE "Translation", 0x809, 1252 23 | END 24 | END -------------------------------------------------------------------------------- /docker/Dockerfile_android: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye 2 | MAINTAINER devseed 3 | 4 | ENV ANDROID_HOME /opt/sdk/androidsdk 5 | ENV CMDTOOL_URL https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip 6 | 7 | RUN apt-get -y update \ 8 | && apt-get -y install tar git wget p7zip-full \ 9 | && apt-get -y install openjdk-11-jdk ninja-build 10 | RUN echo $ANDROID_HOME \ 11 | && mkdir -p $ANDROID_HOME \ 12 | && wget -P /tmp $CMDTOOL_URL > /dev/nul \ 13 | && 7z x $(ls /tmp/*.zip) -o$ANDROID_HOME \ 14 | && rm -rf /tmp/*.zip 15 | RUN cd $ANDROID_HOME/cmdline-tools/bin \ 16 | && yes | ./sdkmanager --sdk_root=$ANDROID_HOME --licenses \ 17 | && yes | ./sdkmanager --sdk_root=$ANDROID_HOME --install \ 18 | "build-tools;33.0.2" "cmake;3.22.1" \ 19 | "platform-tools" "platforms;android-31" "ndk;25.2.9519653" -------------------------------------------------------------------------------- /docker/Dockerfile_emcc: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye 2 | MAINTAINER devseed 3 | 4 | ENV EMSDK_HOME /opt/sdk/emsdk 5 | ENV EMSDK_VERSION 3.1.34 6 | 7 | RUN apt-get -y update \ 8 | && apt-get -y install make cmake tar xz-utils bzip2 git wget curl \ 9 | && apt-get -y install python3 10 | RUN echo $EMSDK_HOME $EMSDK_VERSION \ 11 | && mkdir -p $EMSDK_HOME \ 12 | && git clone https://github.com/emscripten-core/emsdk.git $EMSDK_HOME \ 13 | && cd $EMSDK_HOME \ 14 | && ./emsdk install $EMSDK_VERSION \ 15 | && ./emsdk activate $EMSDK_VERSION \ 16 | && echo "source $EMSDK_HOME/emsdk_env.sh" > ~.bashrc -------------------------------------------------------------------------------- /docker/Dockerfile_linuxarm64: -------------------------------------------------------------------------------- 1 | FROM --platform=aarch64 debian:bullseye 2 | MAINTAINER devseed 3 | 4 | RUN dpkg --add-architecture armhf && apt-get -y update \ 5 | && apt-get -y install make cmake tar git wget curl \ 6 | && apt-get -y install build-essential crossbuild-essential-armhf\ 7 | && apt-get -y install libx11-dev libxext-dev libasound2-dev \ 8 | && apt-get -y install libgl1-mesa-dev mesa-utils \ 9 | && apt-get -y install libx11-dev:armhf libxext-dev:armhf libasound2-dev:armhf \ 10 | && apt-get -y install libgl1-mesa-dev:armhf mesa-utils:armhf -------------------------------------------------------------------------------- /docker/Dockerfile_linuxx64: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye 2 | MAINTAINER devseed 3 | 4 | RUN dpkg --add-architecture i386 && apt-get -y update \ 5 | && apt-get -y install make cmake tar git wget curl \ 6 | && apt-get -y install build-essential gcc-multilib g++-multilib \ 7 | && apt-get -y install libx11-dev libxext-dev libasound2-dev \ 8 | && apt-get -y install libgl1-mesa-dev mesa-utils \ 9 | && apt-get -y install libx11-dev:i386 libxext-dev:i386 libasound2-dev:i386 \ 10 | && apt-get -y install libgl1-mesa-dev:i386 mesa-utils:i386 -------------------------------------------------------------------------------- /docker/Dockerfile_mingw64: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye 2 | MAINTAINER devseed 3 | 4 | RUN apt-get -y update \ 5 | && apt-get -y install make cmake tar git wget curl \ 6 | && apt-get -y install mingw-w64 zstd pkg-config -------------------------------------------------------------------------------- /docker/docker_android.sh: -------------------------------------------------------------------------------- 1 | # export SKIP_PORTS=yes && ./docker_android.sh 2 | 3 | PROJECT_PATH=$(pwd)/.. 4 | DOCKER_TYPE=android 5 | DOCKER_IMAGE=onsyuri_${DOCKER_TYPE} 6 | DOCKER_RUN=${DOCKER_IMAGE}_run 7 | DOKCER_FILE=Dockerfile_${DOCKER_TYPE} 8 | ANDROID_HOME=/opt/sdk/android_sdk 9 | 10 | if [ -z "$(docker images | grep ${DOCKER_IMAGE})" ]; then 11 | docker build -f ${DOKCER_FILE} -t ${DOCKER_IMAGE} \ 12 | --build-arg ANDROID_HOME=$ANDROID_HOME ./ 13 | fi 14 | 15 | if [ -z "$(docker ps | grep ${DOCKER_RUN})" ]; then 16 | docker run -d -it --rm -v ${PROJECT_PATH}:/project \ 17 | --name ${DOCKER_RUN} ${DOCKER_IMAGE} bash 18 | fi 19 | 20 | docker exec -i -e TARGETS=$@ -e BUILD_TYPE=$BUILD_TYPE \ 21 | ${DOCKER_RUN} bash -c \ 22 | "cd /project/script &&bash cross_android.sh" -------------------------------------------------------------------------------- /docker/docker_emcc.sh: -------------------------------------------------------------------------------- 1 | # export SKIP_PORTS=yes && ./docker_emcc.sh 2 | 3 | PROJECT_PATH=$(pwd)/.. 4 | DOCKER_TYPE=emcc 5 | DOCKER_IMAGE=onsyuri_${DOCKER_TYPE} 6 | DOCKER_RUN=${DOCKER_IMAGE}_run 7 | DOKCER_FILE=Dockerfile_${DOCKER_TYPE} 8 | EMSDK_HOME=/opt/sdk/emsdk 9 | 10 | if [ -z "$(docker images | grep ${DOCKER_IMAGE})" ]; then 11 | docker build -f ${DOKCER_FILE} -t ${DOCKER_IMAGE} \ 12 | --build-arg EMSDK_HOME=${EMSDK_HOME} ./ 13 | fi 14 | 15 | if [ -z "$(docker ps | grep ${DOCKER_RUN})" ]; then 16 | docker run -d -it --rm -v ${PROJECT_PATH}:/project \ 17 | --name ${DOCKER_RUN} ${DOCKER_IMAGE} bash 18 | fi 19 | 20 | docker exec -i -e TARGETS=$@ -e BUILD_TYPE=$BUILD_TYPE \ 21 | ${DOCKER_RUN} bash -c \ 22 | "cd /project/script && export EMSDK=$EMSDK_HOME &&bash cross_web.sh" -------------------------------------------------------------------------------- /docker/docker_linuxarm64.sh: -------------------------------------------------------------------------------- 1 | # export SKIP_PORTS=yes && ./docker_linuxarm64.sh 2 | 3 | PROJECT_PATH=$(pwd)/.. 4 | DOCKER_TYPE=linuxarm64 5 | DOCKER_IMAGE=onsyuri_${DOCKER_TYPE} 6 | DOCKER_RUN=${DOCKER_IMAGE}_run 7 | DOKCER_FILE=Dockerfile_${DOCKER_TYPE} 8 | 9 | if [ -z "$(docker images | grep ${DOCKER_IMAGE})" ]; then 10 | docker buildx build --platform linux/arm64 \ 11 | -f ${DOKCER_FILE} -t ${DOCKER_IMAGE} ./ 12 | fi 13 | 14 | if [ -z "$(docker ps | grep ${DOCKER_RUN})" ]; then 15 | docker run -d -it --rm -v ${PROJECT_PATH}:/project \ 16 | --name ${DOCKER_RUN} ${DOCKER_IMAGE} bash 17 | fi 18 | 19 | docker exec -i -e TARGETS=$@ -e SYSROOT=/ \ 20 | -e BUILD_TYPE=$BUILD_TYPE -e SKIP_PORTS=$SKIP_PORTS \ 21 | ${DOCKER_RUN} bash -c "cd /project/script && bash cross_linuxa64.sh" 22 | 23 | docker exec -i -e TARGETS=$@ -e SYSROOT=/ \ 24 | -e BUILD_TYPE=$BUILD_TYPE -e SKIP_PORTS=$SKIP_PORTS \ 25 | ${DOCKER_RUN} bash -c "cd /project/script && bash cross_linuxa32.sh" -------------------------------------------------------------------------------- /docker/docker_linuxx64.sh: -------------------------------------------------------------------------------- 1 | # export SKIP_PORTS=yes && export USE_STATIC_PORTS=yes && ./docker_linuxx64.sh 2 | 3 | PROJECT_PATH=$(pwd)/.. 4 | DOCKER_TYPE=linuxx64 5 | DOCKER_IMAGE=onsyuri_${DOCKER_TYPE} 6 | DOCKER_RUN=${DOCKER_IMAGE}_run 7 | DOKCER_FILE=Dockerfile_${DOCKER_TYPE} 8 | 9 | if [ -z "$(docker images | grep ${DOCKER_IMAGE})" ]; then 10 | docker build -f ${DOKCER_FILE} -t ${DOCKER_IMAGE} ./ 11 | fi 12 | 13 | if [ -z "$(docker ps | grep ${DOCKER_RUN})" ]; then 14 | docker run -d -it --rm -v ${PROJECT_PATH}:/project \ 15 | --name ${DOCKER_RUN} ${DOCKER_IMAGE} bash 16 | fi 17 | 18 | docker exec -i -e TARGETS=$@ -e BUILD_TYPE=$BUILD_TYPE \ 19 | -e SKIP_PORTS=$SKIP_PORTS -e USE_STATIC_PORTS=$USE_STATIC_PORTS \ 20 | ${DOCKER_RUN} bash -c "cd /project/script && bash local_linux64.sh" 21 | 22 | docker exec -i -e TARGETS=$@ -e BUILD_TYPE=$BUILD_TYPE \ 23 | -e SKIP_PORTS=$SKIP_PORTS -e USE_STATIC_PORTS=$USE_STATIC_PORTS \ 24 | ${DOCKER_RUN} bash -c "cd /project/script && bash local_linux32.sh" -------------------------------------------------------------------------------- /docker/docker_mingw64.sh: -------------------------------------------------------------------------------- 1 | # export SKIP_PORTS=yes && ./docker_mingw64.sh 2 | 3 | PROJECT_PATH=$(pwd)/.. 4 | DOCKER_TYPE=mingw64 5 | DOCKER_IMAGE=onsyuri_${DOCKER_TYPE} 6 | DOCKER_RUN=${DOCKER_IMAGE}_run 7 | DOKCER_FILE=Dockerfile_${DOCKER_TYPE} 8 | 9 | if [ -z "$(docker images | grep ${DOCKER_IMAGE})" ]; then 10 | docker build -f ${DOKCER_FILE} -t ${DOCKER_IMAGE} ./ 11 | fi 12 | 13 | if [ -z "$(docker ps | grep ${DOCKER_RUN})" ]; then 14 | docker run -d -it --rm -v ${PROJECT_PATH}:/project \ 15 | --name ${DOCKER_RUN} ${DOCKER_IMAGE} bash 16 | fi 17 | 18 | docker exec -i -e TARGETS=$@ \ 19 | -e BUILD_TYPE=$BUILD_TYPE -e SKIP_PORTS=$SKIP_PORTS \ 20 | ${DOCKER_RUN} bash -c "cd /project/script && bash cross_mingw64.sh" 21 | 22 | docker exec -i -e TARGETS=$@ \ 23 | -e BUILD_TYPE=$BUILD_TYPE -e SKIP_PORTS=$SKIP_PORTS \ 24 | ${DOCKER_RUN} bash -c "cd /project/script && bash cross_mingw32.sh" -------------------------------------------------------------------------------- /screenshot/onsyuri_mo2_linuxtest.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuriSizuku/OnscripterYuri/ff12c7eaef2560a77a1f90fc796f63970216f42d/screenshot/onsyuri_mo2_linuxtest.jpg -------------------------------------------------------------------------------- /screenshot/onsyuri_mo2_linuxtest2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuriSizuku/OnscripterYuri/ff12c7eaef2560a77a1f90fc796f63970216f42d/screenshot/onsyuri_mo2_linuxtest2.png -------------------------------------------------------------------------------- /screenshot/onsyuri_mo2_webtest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuriSizuku/OnscripterYuri/ff12c7eaef2560a77a1f90fc796f63970216f42d/screenshot/onsyuri_mo2_webtest.png -------------------------------------------------------------------------------- /screenshot/onsyuri_mo2_webtest2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuriSizuku/OnscripterYuri/ff12c7eaef2560a77a1f90fc796f63970216f42d/screenshot/onsyuri_mo2_webtest2.png -------------------------------------------------------------------------------- /screenshot/onsyuri_mo2_webtest3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuriSizuku/OnscripterYuri/ff12c7eaef2560a77a1f90fc796f63970216f42d/screenshot/onsyuri_mo2_webtest3.jpg -------------------------------------------------------------------------------- /screenshot/onsyuri_ui_androidtest1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuriSizuku/OnscripterYuri/ff12c7eaef2560a77a1f90fc796f63970216f42d/screenshot/onsyuri_ui_androidtest1.jpg -------------------------------------------------------------------------------- /screenshot/onsyuri_ui_androidtest2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuriSizuku/OnscripterYuri/ff12c7eaef2560a77a1f90fc796f63970216f42d/screenshot/onsyuri_ui_androidtest2.jpg -------------------------------------------------------------------------------- /script/_android.sh: -------------------------------------------------------------------------------- 1 | # must use after _fetch.sh from cross_android.sh 2 | # not used now as it directly build by android studio -------------------------------------------------------------------------------- /script/_fetch.sh: -------------------------------------------------------------------------------- 1 | # prepare dirs 2 | if ! [ -d $CMAKELISTS_PATH/thirdparty/port ]; then mkdir -p $CMAKELISTS_PATH/thirdparty/port; fi 3 | if ! [ -d $CMAKELISTS_PATH/thirdparty/build/arch_mingw32 ]; then mkdir -p $CMAKELISTS_PATH/thirdparty/build/arch_mingw32; fi 4 | if ! [ -d $CMAKELISTS_PATH/thirdparty/build/arch_mingw64 ]; then mkdir -p $CMAKELISTS_PATH/thirdparty/build/arch_mingw64; fi 5 | if ! [ -d $CMAKELISTS_PATH/thirdparty/build/arch_linux32 ]; then mkdir -p $CMAKELISTS_PATH/thirdparty/build/arch_linux32; fi 6 | if ! [ -d $CMAKELISTS_PATH/thirdparty/build/arch_linux64 ]; then mkdir -p $CMAKELISTS_PATH/thirdparty/build/arch_linux64; fi 7 | if ! [ -d $CMAKELISTS_PATH/thirdparty/build/arch_linuxa64 ]; then mkdir -p $CMAKELISTS_PATH/thirdparty/build/arch_linuxa64; fi 8 | if ! [ -d $CMAKELISTS_PATH/thirdparty/build/arch_wasm ]; then mkdir -p $CMAKELISTS_PATH/thirdparty/build/arch_wasm; fi 9 | 10 | # urlbase, name, outpath 11 | function fetch_port() 12 | { 13 | if ! [ -d "$CMAKELISTS_PATH/thirdparty/port/$2" ]; then 14 | echo "## fetch_port $1 $2" 15 | curl -fsSL $1/$2.tar.gz -o $CMAKELISTS_PATH/thirdparty/port/$2.tar.gz 16 | tar zxf $CMAKELISTS_PATH/thirdparty/port/$2.tar.gz -C $CMAKELISTS_PATH/thirdparty/port 17 | fi 18 | } 19 | 20 | # fetch by curl 21 | function fetch_lua() 22 | { 23 | LUA_NAME=lua-5.4.4 24 | LUA_SRC=$CMAKELISTS_PATH/thirdparty/port/$LUA_NAME 25 | fetch_port http://www.lua.org/ftp $LUA_NAME 26 | } 27 | 28 | function fetch_jpeg() 29 | { 30 | JPEG_NAME=jpeg-9 31 | JPEG_SRC=$CMAKELISTS_PATH/thirdparty/port/$JPEG_NAME 32 | fetch_port http://www.ijg.org/files jpegsrc.v9 33 | } 34 | 35 | function fetch_bz2() 36 | { 37 | BZ2_NAME=bzip2-1.0.8 38 | BZ2_SRC=$CMAKELISTS_PATH/thirdparty/port/$BZ2_NAME 39 | fetch_port https://sourceware.org/pub/bzip2 $BZ2_NAME 40 | } 41 | 42 | function fetch_sdl2() 43 | { 44 | SDL2_NAME=SDL2-2.26.3 45 | SDL2_SRC=$CMAKELISTS_PATH/thirdparty/port/$SDL2_NAME 46 | fetch_port https://github.com/libsdl-org/SDL/releases/download/release-2.26.3 $SDL2_NAME 47 | } 48 | 49 | function fetch_sdl2_image() 50 | { 51 | SDL2_IMAGE_NAME=SDL2_image-2.6.3 52 | SDL2_IMAGE_SRC=$CMAKELISTS_PATH/thirdparty/port/$SDL2_IMAGE_NAME 53 | fetch_port https://github.com/libsdl-org/SDL_image/releases/download/release-2.6.3 $SDL2_IMAGE_NAME 54 | } 55 | 56 | function fetch_sdl2_ttf() 57 | { 58 | SDL2_TTF_NAME=SDL2_ttf-2.20.2 59 | SDL2_TTF_SRC=$CMAKELISTS_PATH/thirdparty/port/$SDL2_TTF_NAME 60 | fetch_port https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.20.2 $SDL2_TTF_NAME 61 | } 62 | 63 | function fetch_sdl2_mixer() 64 | { 65 | SDL2_MIXER_NAME=SDL2_mixer-2.6.3 66 | SDL2_MIXER_SRC=$CMAKELISTS_PATH/thirdparty/port/$SDL2_MIXER_NAME 67 | fetch_port https://github.com/libsdl-org/SDL_mixer/releases/download/release-2.6.3 $SDL2_MIXER_NAME 68 | } 69 | 70 | # fetch unused port 71 | function fetch_stb() 72 | { 73 | STB_NAME=stb 74 | STB_SRC=$CMAKELISTS_PATH/thirdparty/port/$STB_NAME 75 | git clone https://github.com/nothings/stb.git $STB_SRC 76 | } 77 | 78 | function fetch_pulse() 79 | { 80 | PULSE_NAME=pulseaudio-16.1 81 | PULSE_SRC=$CMAKELISTS_PATH/thirdparty/port/$PULSE_NAME 82 | fetch_port https://freedesktop.org/software/pulseaudio/releases/ $PULSE_NAME 83 | } -------------------------------------------------------------------------------- /script/_linux32.sh: -------------------------------------------------------------------------------- 1 | # must use after _fetch.sh from cross_linux32.sh 2 | 3 | function build_lua() 4 | { 5 | echo "## LUA_SRC=$LUA_SRC" 6 | 7 | make -C $LUA_SRC clean 8 | make -C $LUA_SRC all PLAT=linux CC="$CC -m32" -j$CORE_NUM 9 | make -C $LUA_SRC install INSTALL_TOP=$PORTBUILD_PATH 10 | } 11 | 12 | function build_jpeg() 13 | { 14 | if ! [ -d "${JPEG_SRC}/build_${PLATFORM}" ]; then mkdir -p "${JPEG_SRC}/build_${PLATFORM}"; fi 15 | echo "## JPEG_SRC=$JPEG_SRC" 16 | 17 | export CFLAGS="-m32" 18 | pushd "${JPEG_SRC}/build_${PLATFORM}" 19 | ../configure --host=i386-linux-gnu \ 20 | --prefix=$PORTBUILD_PATH 21 | make -j$CORE_NUM && make install 22 | popd 23 | } 24 | 25 | function build_bz2() 26 | { 27 | echo "## BZ2_SRC=$BZ2_SRC" 28 | 29 | make -C $BZ2_SRC clean 30 | make -C $BZ2_SRC all CC="$CC -m32" -j$CORE_NUM 31 | make -C $BZ2_SRC install PREFIX=$PORTBUILD_PATH 32 | } 33 | 34 | function build_sdl2() 35 | { 36 | if ! [ -d "${SDL2_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_SRC}/build_${PLATFORM}"; fi 37 | echo "## SDL2_SRC=$SDL2_SRC" 38 | 39 | export CFLAGS="-Os" 40 | export CXXFLAGS="-Os" 41 | pushd "${SDL2_SRC}/build_${PLATFORM}" 42 | ../configure --host=i686-linux-gnu \ 43 | "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" \ 44 | --disable-3dnow --disable-sse --disable-sse3 \ 45 | --disable-video-wayland --disable-video-offscreen \ 46 | --enable-video-x11 --enable-x11-shared \ 47 | --prefix=$PORTBUILD_PATH 48 | make -j$CORE_NUM && make install 49 | popd 50 | } 51 | 52 | # after build_sdl2 53 | function build_sdl2_image() 54 | { 55 | if ! [ -d "${SDL2_IMAGE_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_IMAGE_SRC}/build_${PLATFORM}"; fi 56 | echo "## SDL2_IMAGE_SRC=$SDL2_IMAGE_SRC" 57 | 58 | export PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig # this is important for find SDL path 59 | pushd "${SDL2_IMAGE_SRC}/build_${PLATFORM}" 60 | ../configure --host=i686-linux-gnu \ 61 | "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" \ 62 | --enable-stb_image \ 63 | --prefix=$PORTBUILD_PATH 64 | make -j$CORE_NUM && make install 65 | popd 66 | } 67 | 68 | # after build_sdl2 69 | function build_sdl2_ttf() 70 | { 71 | if ! [ -d "${SDL2_TTF_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_TTF_SRC}/build_${PLATFORM}"; fi 72 | echo "## SDL2_TTF_SRC=$SDL2_TTF_SRC" 73 | 74 | export PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig # this is important for find SDL path 75 | # harfbuzz makes very large 76 | pushd "${SDL2_TTF_SRC}//build_${PLATFORM}" 77 | ../configure --host=i686-linux-gnu \ 78 | "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" \ 79 | --disable-harfbuzz \ 80 | --prefix=$PORTBUILD_PATH 81 | make -j$CORE_NUM && make install 82 | popd 83 | } 84 | 85 | # after build_sdl2 86 | function build_sdl2_mixer() 87 | { 88 | if ! [ -d "${SDL2_MIXER_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_MIXER_SRC}/build_${PLATFORM}"; fi 89 | echo "## SDL2_MIXER_SRC=$SDL2_MIXER_SRC" 90 | 91 | export PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig # this is important for find SDL path 92 | pushd "${SDL2_MIXER_SRC}/build_${PLATFORM}" 93 | ../configure --host=i686-linux-gnu \ 94 | "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" \ 95 | --prefix=$PORTBUILD_PATH 96 | make -j$CORE_NUM && make install 97 | popd 98 | } -------------------------------------------------------------------------------- /script/_linux64.sh: -------------------------------------------------------------------------------- 1 | # must use after _fetch.sh from cross_linux64.sh 2 | 3 | function build_lua() 4 | { 5 | echo "## LUA_SRC=$LUA_SRC" 6 | 7 | make -C $LUA_SRC clean 8 | make -C $LUA_SRC all PLAT=linux CC="$CC -m64" -j$CORE_NUM 9 | make -C $LUA_SRC install INSTALL_TOP=$PORTBUILD_PATH 10 | } 11 | 12 | function build_jpeg() 13 | { 14 | if ! [ -d "${JPEG_SRC}/build_${PLATFORM}" ]; then mkdir -p "${JPEG_SRC}/build_${PLATFORM}"; fi 15 | echo "## JPEG_SRC=$JPEG_SRC" 16 | 17 | export CFLAGS="-m64" 18 | pushd "${JPEG_SRC}/build_${PLATFORM}" 19 | ../configure --host=x86_64-linux-gnu \ 20 | --prefix=$PORTBUILD_PATH 21 | make -j$CORE_NUM && make install 22 | popd 23 | } 24 | 25 | function build_bz2() 26 | { 27 | echo "## BZ2_SRC=$BZ2_SRC" 28 | 29 | make -C $BZ2_SRC clean 30 | make -C $BZ2_SRC all CC="gcc -m64" -j$CORE_NUM 31 | make -C $BZ2_SRC install PREFIX=$PORTBUILD_PATH 32 | } 33 | 34 | function build_sdl2() 35 | { 36 | if ! [ -d "${SDL2_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_SRC}/build_${PLATFORM}"; fi 37 | echo "## SDL2_SRC=$SDL2_SRC" 38 | 39 | export CFLAGS="-Os" 40 | export CXXFLAGS="-Os" 41 | pushd "${SDL2_SRC}/build_${PLATFORM}" 42 | ../configure --host=x86_64-linux-gnu \ 43 | "CFLAGS=-m64" "CXXFLAGS=-m64" "LDFLAGS=-m64" \ 44 | --disable-3dnow --disable-sse --disable-sse3 \ 45 | --disable-video-wayland --disable-video-offscreen \ 46 | --enable-video-x11 --enable-x11-shared \ 47 | --prefix=$PORTBUILD_PATH 48 | make -j$CORE_NUM && make install 49 | popd 50 | } 51 | 52 | # after build_sdl2 53 | function build_sdl2_image() 54 | { 55 | if ! [ -d "${SDL2_IMAGE_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_IMAGE_SRC}/build_${PLATFORM}"; fi 56 | echo "## SDL2_IMAGE_SRC=$SDL2_IMAGE_SRC" 57 | 58 | export PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig # this is important for find SDL path 59 | pushd "${SDL2_IMAGE_SRC}/build_${PLATFORM}" 60 | ../configure --host=x86_64-linux-gnu \ 61 | "CFLAGS=-m64" "CXXFLAGS=-m64" "LDFLAGS=-m64" \ 62 | --enable-stb_image \ 63 | --prefix=$PORTBUILD_PATH 64 | make -j$CORE_NUM && make install 65 | popd 66 | } 67 | 68 | # after build_sdl2 69 | function build_sdl2_ttf() 70 | { 71 | if ! [ -d "${SDL2_TTF_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_TTF_SRC}/build_${PLATFORM}"; fi 72 | echo "## SDL2_TTF_SRC=$SDL2_TTF_SRC" 73 | 74 | export PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig # this is important for find SDL path 75 | # harfbuzz makes very large 76 | pushd "${SDL2_TTF_SRC}//build_${PLATFORM}" 77 | ../configure --host=x86_64-linux-gnu \ 78 | "CFLAGS=-m64" "CXXFLAGS=-m64" "LDFLAGS=-m64" \ 79 | --disable-harfbuzz \ 80 | --prefix=$PORTBUILD_PATH 81 | make -j$CORE_NUM && make install 82 | popd 83 | } 84 | 85 | # after build_sdl2 86 | function build_sdl2_mixer() 87 | { 88 | if ! [ -d "${SDL2_MIXER_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_MIXER_SRC}/build_${PLATFORM}"; fi 89 | echo "## SDL2_MIXER_SRC=$SDL2_MIXER_SRC" 90 | 91 | export PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig # this is important for find SDL path 92 | pushd "${SDL2_MIXER_SRC}/build_${PLATFORM}" 93 | ../configure --host=x86_64-linux-gnu \ 94 | "CFLAGS=-m64" "CXXFLAGS=-m64" "LDFLAGS=-m64" \ 95 | --prefix=$PORTBUILD_PATH 96 | make -j$CORE_NUM && make install 97 | popd 98 | } -------------------------------------------------------------------------------- /script/_linuxa32.sh: -------------------------------------------------------------------------------- 1 | # must use after _fetch.sh from cross_linuxa64.sh 2 | 3 | function build_lua() 4 | { 5 | echo "## LUA_SRC=$LUA_SRC" 6 | 7 | make -C $LUA_SRC clean 8 | make -C $LUA_SRC all PLAT=linux CC=arm-linux-gnueabihf-gcc AR="arm-linux-gnueabihf-ar rcu" -j$CORE_NUM 9 | make -C $LUA_SRC install INSTALL_TOP=$PORTBUILD_PATH 10 | } 11 | 12 | function build_jpeg() 13 | { 14 | if ! [ -d "${JPEG_SRC}/build_${PLATFORM}" ]; then mkdir -p "${JPEG_SRC}/build_${PLATFORM}"; fi 15 | echo "## JPEG_SRC=$JPEG_SRC" 16 | 17 | pushd "${JPEG_SRC}/build_${PLATFORM}" 18 | ../configure --host=arm-linux-gnueabihf \ 19 | --prefix=$PORTBUILD_PATH 20 | make -j$CORE_NUM && make install 21 | popd 22 | } 23 | 24 | function build_bz2() 25 | { 26 | echo "## BZ2_SRC=$BZ2_SRC" 27 | 28 | make -C $BZ2_SRC clean 29 | make -C $BZ2_SRC all CC=arm-linux-gnueabihf-gcc AR=arm-linux-gnueabihf-ar -j$CORE_NUM 30 | make -C $BZ2_SRC install PREFIX=$PORTBUILD_PATH 31 | } 32 | 33 | function build_sdl2() 34 | { 35 | if ! [ -d "${SDL2_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_SRC}/build_${PLATFORM}"; fi 36 | echo "## SDL2_SRC=$SDL2_SRC" 37 | 38 | export CFLAGS="-Os" 39 | export CXXFLAGS="-Os" 40 | SDL2_SYSROOT=/ 41 | if [ -n "$SYSROOT" ]; then SDL2_SYSROOT=$SYSROOT; fi 42 | echo "## SDL2_SYSROOT $SDL2_SYSROOT" 43 | pushd "${SDL2_SRC}/build_${PLATFORM}" 44 | ../configure --host=arm-linux-gnueabihf \ 45 | --disable-pulseaudio \ 46 | --enable-video-x11 --enable-x11-shared --enable-video-x11-xcursor --enable-video-x11-xinput --enable-video-x11-xrandr \ 47 | --disable-video-wayland \ 48 | --enable-arm-simd --enable-arm-neon \ 49 | --prefix=$PORTBUILD_PATH --with-sysroot=$SDL2_SYSROOT 50 | make -j$CORE_NUM && make install 51 | popd 52 | } 53 | 54 | # after build_sdl2 55 | function build_sdl2_image() 56 | { 57 | if ! [ -d "${SDL2_IMAGE_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_IMAGE_SRC}/build_${PLATFORM}"; fi 58 | echo "## SDL2_IMAGE_SRC=$SDL2_IMAGE_SRC" 59 | 60 | export PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig # this is important for find SDL path 61 | pushd "${SDL2_IMAGE_SRC}/build_${PLATFORM}" 62 | ../configure --host=arm-linux-gnueabihf \ 63 | --enable-stb_image \ 64 | --prefix=$PORTBUILD_PATH 65 | make -j$CORE_NUM && make install 66 | popd 67 | } 68 | 69 | # after build_sdl2 70 | function build_sdl2_ttf() 71 | { 72 | if ! [ -d "${SDL2_TTF_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_TTF_SRC}/build_${PLATFORM}"; fi 73 | echo "## SDL2_TTF_SRC=$SDL2_TTF_SRC" 74 | 75 | export PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig # this is important for find SDL path 76 | # harfbuzz makes very large 77 | pushd "${SDL2_TTF_SRC}//build_${PLATFORM}" 78 | ../configure --host=arm-linux-gnueabihf \ 79 | --disable-harfbuzz \ 80 | --prefix=$PORTBUILD_PATH 81 | make -j$CORE_NUM && make install 82 | popd 83 | } 84 | 85 | # after build_sdl2 86 | function build_sdl2_mixer() 87 | { 88 | if ! [ -d "${SDL2_MIXER_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_MIXER_SRC}/build_${PLATFORM}"; fi 89 | echo "## SDL2_MIXER_SRC=$SDL2_MIXER_SRC" 90 | 91 | export PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig # this is important for find SDL path 92 | pushd "${SDL2_MIXER_SRC}/build_${PLATFORM}" 93 | ../configure --host=arm-linux-gnueabihf \ 94 | --prefix=$PORTBUILD_PATH 95 | make -j$CORE_NUM && make install 96 | popd 97 | } -------------------------------------------------------------------------------- /script/_linuxa64.sh: -------------------------------------------------------------------------------- 1 | # must use after _fetch.sh from cross_linuxa64.sh 2 | 3 | function build_lua() 4 | { 5 | echo "## LUA_SRC=$LUA_SRC" 6 | 7 | make -C $LUA_SRC clean 8 | make -C $LUA_SRC all PLAT=linux CC=aarch64-linux-gnu-gcc AR="aarch64-linux-gnu-ar rcu" -j$CORE_NUM 9 | make -C $LUA_SRC install INSTALL_TOP=$PORTBUILD_PATH 10 | } 11 | 12 | function build_jpeg() 13 | { 14 | if ! [ -d "${JPEG_SRC}/build_${PLATFORM}" ]; then mkdir -p "${JPEG_SRC}/build_${PLATFORM}"; fi 15 | echo "## JPEG_SRC=$JPEG_SRC" 16 | 17 | pushd "${JPEG_SRC}/build_${PLATFORM}" 18 | ../configure --host=aarch64-linux-gnu \ 19 | --prefix=$PORTBUILD_PATH 20 | make -j$CORE_NUM && make install 21 | popd 22 | } 23 | 24 | function build_bz2() 25 | { 26 | echo "## BZ2_SRC=$BZ2_SRC" 27 | 28 | make -C $BZ2_SRC clean 29 | make -C $BZ2_SRC all CC=aarch64-linux-gnu-gcc AR=aarch64-linux-gnu-ar -j$CORE_NUM 30 | make -C $BZ2_SRC install PREFIX=$PORTBUILD_PATH 31 | } 32 | 33 | function build_sdl2() 34 | { 35 | if ! [ -d "${SDL2_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_SRC}/build_${PLATFORM}"; fi 36 | echo "## SDL2_SRC=$SDL2_SRC" 37 | 38 | export CFLAGS="-Os" 39 | export CXXFLAGS="-Os" 40 | SDL2_SYSROOT=/ 41 | if [ -n "$SYSROOT" ]; then SDL2_SYSROOT=$SYSROOT; fi 42 | echo "## SDL2_SYSROOT $SDL2_SYSROOT" 43 | pushd "${SDL2_SRC}/build_${PLATFORM}" 44 | ../configure --host=aarch64-linux-gnu \ 45 | --disable-pulseaudio \ 46 | --enable-video-x11 --enable-x11-shared --enable-video-x11-xcursor --enable-video-x11-xinput --enable-video-x11-xrandr \ 47 | --disable-video-wayland \ 48 | --enable-arm-simd --enable-arm-neon \ 49 | --prefix=$PORTBUILD_PATH --with-sysroot=$SDL2_SYSROOT 50 | make -j$CORE_NUM && make install 51 | popd 52 | } 53 | 54 | # after build_sdl2 55 | function build_sdl2_image() 56 | { 57 | if ! [ -d "${SDL2_IMAGE_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_IMAGE_SRC}/build_${PLATFORM}"; fi 58 | echo "## SDL2_IMAGE_SRC=$SDL2_IMAGE_SRC" 59 | 60 | export PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig # this is important for find SDL path 61 | pushd "${SDL2_IMAGE_SRC}/build_${PLATFORM}" 62 | ../configure --host=aarch64-linux-gnu \ 63 | --enable-stb_image \ 64 | --prefix=$PORTBUILD_PATH 65 | make -j$CORE_NUM && make install 66 | popd 67 | } 68 | 69 | # after build_sdl2 70 | function build_sdl2_ttf() 71 | { 72 | if ! [ -d "${SDL2_TTF_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_TTF_SRC}/build_${PLATFORM}"; fi 73 | echo "## SDL2_TTF_SRC=$SDL2_TTF_SRC" 74 | 75 | export PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig # this is important for find SDL path 76 | # harfbuzz makes very large 77 | pushd "${SDL2_TTF_SRC}//build_${PLATFORM}" 78 | ../configure --host=aarch64-linux-gnu \ 79 | --disable-harfbuzz \ 80 | --prefix=$PORTBUILD_PATH 81 | make -j$CORE_NUM && make install 82 | popd 83 | } 84 | 85 | # after build_sdl2 86 | function build_sdl2_mixer() 87 | { 88 | if ! [ -d "${SDL2_MIXER_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_MIXER_SRC}/build_${PLATFORM}"; fi 89 | echo "## SDL2_MIXER_SRC=$SDL2_MIXER_SRC" 90 | 91 | export PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig # this is important for find SDL path 92 | pushd "${SDL2_MIXER_SRC}/build_${PLATFORM}" 93 | ../configure --host=aarch64-linux-gnu \ 94 | --prefix=$PORTBUILD_PATH 95 | make -j$CORE_NUM && make install 96 | popd 97 | } -------------------------------------------------------------------------------- /script/_llvmmingw32.sh: -------------------------------------------------------------------------------- 1 | # must use after _fetch.sh from cross_llvmmingw32.sh 2 | 3 | function build_lua() 4 | { 5 | echo "## LUA_SRC=$LUA_SRC" 6 | 7 | make -C $LUA_SRC clean 8 | make -C $LUA_SRC all PLAT=mingw -j$CORE_NUM \ 9 | CC=$CC AR="${CC%-*}-ar rcu" 10 | cp $LUA_SRC/src/lua.exe $LUA_SRC/src/lua 11 | cp $LUA_SRC/src/luac.exe $LUA_SRC/src/luac 12 | make -C $LUA_SRC install INSTALL_TOP=$PORTBUILD_PATH 13 | } 14 | 15 | function build_jpeg() 16 | { 17 | if ! [ -d "${JPEG_SRC}/build_${PLATFORM}" ]; then mkdir -p "${JPEG_SRC}/build_${PLATFORM}"; fi 18 | echo "## JPEG_SRC=$JPEG_SRC" 19 | 20 | # problems for llvm-mingw 21 | pushd "${JPEG_SRC}/build_${PLATFORM}" 22 | ../configure --host=${CC%-*} \ 23 | --prefix=$PORTBUILD_PATH 24 | make -j$CORE_NUM && make install 25 | popd 26 | } 27 | 28 | function build_bz2() 29 | { 30 | echo "## BZ2_SRC=$BZ2_SRC CC=$CC" 31 | 32 | make -C $BZ2_SRC clean 33 | make -C $BZ2_SRC bzip2 -j$CORE_NUM # this has some problem by mingw 34 | make -C $BZ2_SRC install PREFIX=$PORTBUILD_PATH 35 | } 36 | 37 | function build_sdl2() 38 | { 39 | if ! [ -d "${SDL2_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_SRC}/build_${PLATFORM}"; fi 40 | echo "## SDL2_SRC=$SDL2_SRC" 41 | 42 | export CFLAGS="-Os" 43 | export CXXFLAGS="-Os" 44 | pushd "${SDL2_SRC}/build_${PLATFORM}" 45 | ../configure --host=${CC%-*} \ 46 | --disable-3dnow --disable-sse --disable-sse3 \ 47 | --disable-video-vulkan --disable-video-offscreen \ 48 | --prefix=$PORTBUILD_PATH 49 | make -j$CORE_NUM && make install 50 | popd 51 | } 52 | 53 | # after build_sdl2 54 | function build_sdl2_image() 55 | { 56 | if ! [ -d "${SDL2_IMAGE_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_IMAGE_SRC}/build_${PLATFORM}"; fi 57 | echo "## SDL2_IMAGE_SRC=$SDL2_IMAGE_SRC" 58 | 59 | pushd "${SDL2_IMAGE_SRC}/build_${PLATFORM}" 60 | cmake .. -G "Unix Makefiles" \ 61 | -DCMAKE_INSTALL_PREFIX=$PORTBUILD_PATH \ 62 | -DSDL2IMAGE_BACKEND_STB=on \ 63 | -DSDL2IMAGE_SAMPLES=off \ 64 | -DBUILD_SHARED_LIBS=off 65 | make -j$CORE_NUM && make install 66 | popd 67 | } 68 | 69 | # after build_sdl2 70 | function build_sdl2_ttf() 71 | { 72 | if ! [ -d "${SDL2_TTF_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_TTF_SRC}/build_${PLATFORM}"; fi 73 | echo "## SDL2_TTF_SRC=$SDL2_TTF_SRC" 74 | 75 | # harfbuzz makes very large, using cmake needs -lfreetype 76 | pushd "${SDL2_TTF_SRC}/build_${PLATFORM}" 77 | cmake .. -G "Unix Makefiles" \ 78 | -DCMAKE_INSTALL_PREFIX=$PORTBUILD_PATH \ 79 | -DSDL2TTF_VENDORED=on \ 80 | -DSDL2TTF_HARFBUZZ=off \ 81 | -DSDL2TTF_SAMPLES=off \ 82 | -DBUILD_SHARED_LIBS=off 83 | make -j$CORE_NUM && make install 84 | popd 85 | } 86 | 87 | # after build_sdl2s 88 | function build_sdl2_mixer() 89 | { 90 | if ! [ -d "${SDL2_MIXER_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_MIXER_SRC}/build_${PLATFORM}"; fi 91 | echo "## SDL2_MIXER_SRC=$SDL2_MIXER_SRC" 92 | 93 | pushd "${SDL2_MIXER_SRC}/build_${PLATFORM}" 94 | cmake .. -G "Unix Makefiles" \ 95 | -DCMAKE_INSTALL_PREFIX=$PORTBUILD_PATH \ 96 | -DSDL2MIXER_SAMPLES=off \ 97 | -DSDL2MIXER_VORBIS=STB \ 98 | -DSDL2MIXER_OPUS=off \ 99 | -DSDL2MIXER_FLAC=off \ 100 | -DSDL2MIXER_MOD=off \ 101 | -DSDL2MIXER_MIDI=off \ 102 | -DBUILD_SHARED_LIBS=off 103 | make -j$CORE_NUM && make install 104 | popd 105 | } -------------------------------------------------------------------------------- /script/_llvmmingw64.sh: -------------------------------------------------------------------------------- 1 | # must use after _fetch.sh from cross_llvmmingw64.sh 2 | 3 | function build_lua() 4 | { 5 | echo "## LUA_SRC=$LUA_SRC" 6 | 7 | make -C $LUA_SRC clean 8 | make -C $LUA_SRC all PLAT=mingw -j$CORE_NUM \ 9 | CC=$CC AR="${CC%-*}-ar rcu" 10 | cp $LUA_SRC/src/lua.exe $LUA_SRC/src/lua 11 | cp $LUA_SRC/src/luac.exe $LUA_SRC/src/luac 12 | make -C $LUA_SRC install INSTALL_TOP=$PORTBUILD_PATH 13 | } 14 | 15 | function build_jpeg() 16 | { 17 | if ! [ -d "${JPEG_SRC}/build_${PLATFORM}" ]; then mkdir -p "${JPEG_SRC}/build_${PLATFORM}"; fi 18 | echo "## JPEG_SRC=$JPEG_SRC" 19 | 20 | # problems for llvm-mingw 21 | pushd "${JPEG_SRC}/build_${PLATFORM}" 22 | ../configure --host=${CC%-*} \ 23 | --prefix=$PORTBUILD_PATH 24 | make -j$CORE_NUM && make install 25 | popd 26 | } 27 | 28 | function build_bz2() 29 | { 30 | echo "## BZ2_SRC=$BZ2_SRC CC=$CC" 31 | 32 | make -C $BZ2_SRC clean 33 | make -C $BZ2_SRC bzip2 -j$CORE_NUM # this has some problem by mingw 34 | make -C $BZ2_SRC install PREFIX=$PORTBUILD_PATH 35 | } 36 | 37 | function build_sdl2() 38 | { 39 | if ! [ -d "${SDL2_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_SRC}/build_${PLATFORM}"; fi 40 | echo "## SDL2_SRC=$SDL2_SRC" 41 | 42 | export CFLAGS="-Os" 43 | export CXXFLAGS="-Os" 44 | pushd "${SDL2_SRC}/build_${PLATFORM}" 45 | ../configure --host=${CC%-*} \ 46 | --disable-3dnow --disable-sse --disable-sse3 \ 47 | --disable-video-vulkan --disable-video-offscreen \ 48 | --prefix=$PORTBUILD_PATH 49 | make -j$CORE_NUM && make install 50 | popd 51 | } 52 | 53 | # after build_sdl2 54 | function build_sdl2_image() 55 | { 56 | if ! [ -d "${SDL2_IMAGE_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_IMAGE_SRC}/build_${PLATFORM}"; fi 57 | echo "## SDL2_IMAGE_SRC=$SDL2_IMAGE_SRC" 58 | 59 | pushd "${SDL2_IMAGE_SRC}/build_${PLATFORM}" 60 | cmake .. -G "Unix Makefiles" \ 61 | -DCMAKE_INSTALL_PREFIX=$PORTBUILD_PATH \ 62 | -DSDL2IMAGE_BACKEND_STB=on \ 63 | -DSDL2IMAGE_SAMPLES=off \ 64 | -DBUILD_SHARED_LIBS=off 65 | make -j$CORE_NUM && make install 66 | popd 67 | } 68 | 69 | # after build_sdl2 70 | function build_sdl2_ttf() 71 | { 72 | if ! [ -d "${SDL2_TTF_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_TTF_SRC}/build_${PLATFORM}"; fi 73 | echo "## SDL2_TTF_SRC=$SDL2_TTF_SRC" 74 | 75 | # harfbuzz makes very large, using cmake needs -lfreetype 76 | pushd "${SDL2_TTF_SRC}/build_${PLATFORM}" 77 | cmake .. -G "Unix Makefiles" \ 78 | -DCMAKE_INSTALL_PREFIX=$PORTBUILD_PATH \ 79 | -DSDL2TTF_VENDORED=on \ 80 | -DSDL2TTF_HARFBUZZ=off \ 81 | -DSDL2TTF_SAMPLES=off \ 82 | -DBUILD_SHARED_LIBS=off 83 | make -j$CORE_NUM && make install 84 | popd 85 | } 86 | 87 | # after build_sdl2s 88 | function build_sdl2_mixer() 89 | { 90 | if ! [ -d "${SDL2_MIXER_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_MIXER_SRC}/build_${PLATFORM}"; fi 91 | echo "## SDL2_MIXER_SRC=$SDL2_MIXER_SRC" 92 | 93 | pushd "${SDL2_MIXER_SRC}/build_${PLATFORM}" 94 | cmake .. -G "Unix Makefiles" \ 95 | -DCMAKE_INSTALL_PREFIX=$PORTBUILD_PATH \ 96 | -DSDL2MIXER_SAMPLES=off \ 97 | -DSDL2MIXER_VORBIS=STB \ 98 | -DSDL2MIXER_OPUS=off \ 99 | -DSDL2MIXER_FLAC=off \ 100 | -DSDL2MIXER_MOD=off \ 101 | -DSDL2MIXER_MIDI=off \ 102 | -DBUILD_SHARED_LIBS=off 103 | make -j$CORE_NUM && make install 104 | popd 105 | } -------------------------------------------------------------------------------- /script/_mingw32.sh: -------------------------------------------------------------------------------- 1 | # must use after _fetch.sh from cross_mingw32.sh 2 | 3 | function build_lua() 4 | { 5 | echo "## LUA_SRC=$LUA_SRC" 6 | 7 | make -C $LUA_SRC clean 8 | make -C $LUA_SRC all PLAT=mingw -j$CORE_NUM \ 9 | CC=i686-w64-mingw32-gcc AR="i686-w64-mingw32-ar rcu" 10 | cp $LUA_SRC/src/lua.exe $LUA_SRC/src/lua 11 | cp $LUA_SRC/src/luac.exe $LUA_SRC/src/luac 12 | make -C $LUA_SRC install INSTALL_TOP=$PORTBUILD_PATH 13 | } 14 | 15 | function build_jpeg() 16 | { 17 | if ! [ -d "${JPEG_SRC}/build_${PLATFORM}" ]; then mkdir -p "${JPEG_SRC}/build_${PLATFORM}"; fi 18 | echo "## JPEG_SRC=$JPEG_SRC" 19 | 20 | pushd "${JPEG_SRC}/build_${PLATFORM}" 21 | ../configure --host=i686-w64-mingw32 \ 22 | --prefix=$PORTBUILD_PATH 23 | make -j$CORE_NUM && make install 24 | popd 25 | } 26 | 27 | function build_bz2() 28 | { 29 | echo "## BZ2_SRC=$BZ2_SRC CC=$CC" 30 | 31 | make -C $BZ2_SRC clean 32 | make -C $BZ2_SRC -j$CORE_NUM # this has some problem by mingw 33 | make -C $BZ2_SRC install PREFIX=$PORTBUILD_PATH 34 | 35 | pushd $CMAKELISTS_PATH/thirdparty/port/ 36 | curl -fsSL https://mirror.msys2.org/mingw/mingw32/mingw-w64-i686-bzip2-1.0.8-2-any.pkg.tar.zst -O 37 | tar xf mingw-w64-i686-bzip2-1.0.8-2-any.pkg.tar.zst mingw32/lib/libbz2.a 38 | cp mingw32/lib/libbz2.a $PORTBUILD_PATH/lib/ 39 | rm -rf mingw32 40 | popd 41 | } 42 | 43 | 44 | function build_sdl2() 45 | { 46 | if ! [ -d "${SDL2_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_SRC}/build_${PLATFORM}"; fi 47 | echo "## SDL2_SRC=$SDL2_SRC" 48 | 49 | export CFLAGS="-Os" 50 | export CXXFLAGS="-Os" 51 | pushd "${SDL2_SRC}/build_${PLATFORM}" 52 | ../configure --host=i686-w64-mingw32 \ 53 | --disable-3dnow --disable-sse --disable-sse3 \ 54 | --disable-video-vulkan --disable-video-offscreen \ 55 | --prefix=$PORTBUILD_PATH 56 | make -j$CORE_NUM && make install 57 | popd 58 | } 59 | 60 | # after build_sdl2 61 | function build_sdl2_image() 62 | { 63 | if ! [ -d "${SDL2_IMAGE_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_IMAGE_SRC}/build_${PLATFORM}"; fi 64 | echo "## SDL2_IMAGE_SRC=$SDL2_IMAGE_SRC" 65 | 66 | export PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig # this is important for find SDL path 67 | # stb_image.h already included 68 | pushd "${SDL2_IMAGE_SRC}/build_${PLATFORM}" 69 | ../configure --host=i686-w64-mingw32 \ 70 | --enable-stb_image \ 71 | --prefix=$PORTBUILD_PATH 72 | make -j$CORE_NUM && make install 73 | popd 74 | } 75 | 76 | # after build_sdl2 77 | function build_sdl2_ttf() 78 | { 79 | if ! [ -d "${SDL2_TTF_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_TTF_SRC}/build_${PLATFORM}"; fi 80 | echo "## SDL2_TTF_SRC=$SDL2_TTF_SRC" 81 | 82 | export PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig # this is important for find SDL path 83 | # harfbuzz makes very large 84 | pushd "${SDL2_TTF_SRC}//build_${PLATFORM}" 85 | ../configure --host=i686-w64-mingw32 \ 86 | --disable-harfbuzz \ 87 | --prefix=$PORTBUILD_PATH 88 | make -j$CORE_NUM && make install 89 | popd 90 | } 91 | 92 | # after build_sdl2 93 | function build_sdl2_mixer() 94 | { 95 | if ! [ -d "${SDL2_MIXER_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_MIXER_SRC}/build_${PLATFORM}"; fi 96 | echo "## SDL2_MIXER_SRC=$SDL2_MIXER_SRC" 97 | 98 | export PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig # this is important for find SDL path 99 | pushd "${SDL2_MIXER_SRC}/build_${PLATFORM}" 100 | ../configure --host=i686-w64-mingw32 \ 101 | --prefix=$PORTBUILD_PATH 102 | make -j$CORE_NUM && make install 103 | popd 104 | } -------------------------------------------------------------------------------- /script/_mingw64.sh: -------------------------------------------------------------------------------- 1 | # must use after _fetch.sh from cross_mingw64.sh 2 | 3 | function build_lua() 4 | { 5 | echo "## LUA_SRC=$LUA_SRC" 6 | 7 | make -C $LUA_SRC clean 8 | make -C $LUA_SRC all PLAT=mingw -j$CORE_NUM \ 9 | CC=x86_64-w64-mingw32-gcc AR="x86_64-w64-mingw32-ar rcu" 10 | cp $LUA_SRC/src/lua.exe $LUA_SRC/src/lua 11 | cp $LUA_SRC/src/luac.exe $LUA_SRC/src/luac 12 | make -C $LUA_SRC install INSTALL_TOP=$PORTBUILD_PATH 13 | } 14 | 15 | function build_jpeg() 16 | { 17 | if ! [ -d "${JPEG_SRC}/build_${PLATFORM}" ]; then mkdir -p "${JPEG_SRC}/build_${PLATFORM}"; fi 18 | echo "## JPEG_SRC=$JPEG_SRC" 19 | 20 | pushd "${JPEG_SRC}/build_${PLATFORM}" 21 | ../configure --host=x86_64-w64-mingw32 \ 22 | --prefix=$PORTBUILD_PATH 23 | make -j$CORE_NUM && make install 24 | popd 25 | } 26 | 27 | function build_bz2() 28 | { 29 | echo "## BZ2_SRC=$BZ2_SRC CC=$CC" 30 | 31 | make -C $BZ2_SRC clean 32 | # this has some problem by mingw, as can not find export function 33 | make -C $BZ2_SRC -j$CORE_NUM 34 | make -C $BZ2_SRC install PREFIX=$PORTBUILD_PATH 35 | 36 | # get from msys2, need to install zstd 37 | pushd $CMAKELISTS_PATH/thirdparty/port/ 38 | curl -fsSL https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-bzip2-1.0.8-2-any.pkg.tar.zst -O 39 | tar xf mingw-w64-x86_64-bzip2-1.0.8-2-any.pkg.tar.zst mingw64/lib/libbz2.a 40 | cp mingw64/lib/libbz2.a $PORTBUILD_PATH/lib/ 41 | rm -rf mingw64 42 | popd 43 | } 44 | 45 | function build_sdl2() 46 | { 47 | if ! [ -d "${SDL2_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_SRC}/build_${PLATFORM}"; fi 48 | echo "## SDL2_SRC=$SDL2_SRC" 49 | 50 | export CFLAGS="-Os" 51 | export CXXFLAGS="-Os" 52 | pushd "${SDL2_SRC}/build_${PLATFORM}" 53 | ../configure --host=x86_64-w64-mingw32 \ 54 | --disable-3dnow --disable-sse --disable-sse3 \ 55 | --disable-video-vulkan --disable-video-offscreen \ 56 | --prefix=$PORTBUILD_PATH 57 | make -j$CORE_NUM && make install 58 | popd 59 | } 60 | 61 | # after build_sdl2 62 | function build_sdl2_image() 63 | { 64 | if ! [ -d "${SDL2_IMAGE_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_IMAGE_SRC}/build_${PLATFORM}"; fi 65 | echo "## SDL2_IMAGE_SRC=$SDL2_IMAGE_SRC" 66 | 67 | # this is important for find SDL path 68 | # if not usING pkg-config in linux, must add SDL2.dll dir to $PATH 69 | # llvm-mingw failed for autoconf becuase of la.lnkscript: unknown file type 70 | export PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig 71 | # stb_image.h already included 72 | pushd "${SDL2_IMAGE_SRC}/build_${PLATFORM}" 73 | ../configure --host=x86_64-w64-mingw32 \ 74 | --enable-stb_image \ 75 | --prefix=$PORTBUILD_PATH 76 | make -j$CORE_NUM && make install 77 | popd 78 | } 79 | 80 | # after build_sdl2 81 | function build_sdl2_ttf() 82 | { 83 | if ! [ -d "${SDL2_TTF_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_TTF_SRC}/build_${PLATFORM}"; fi 84 | echo "## SDL2_TTF_SRC=$SDL2_TTF_SRC" 85 | 86 | export PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig # this is important for find SDL path 87 | # harfbuzz makes very large 88 | pushd "${SDL2_TTF_SRC}//build_${PLATFORM}" 89 | ../configure --host=x86_64-w64-mingw32 \ 90 | --disable-harfbuzz \ 91 | --prefix=$PORTBUILD_PATH 92 | make -j$CORE_NUM && make install 93 | popd 94 | } 95 | 96 | # after build_sdl2s 97 | function build_sdl2_mixer() 98 | { 99 | if ! [ -d "${SDL2_MIXER_SRC}/build_${PLATFORM}" ]; then mkdir -p "${SDL2_MIXER_SRC}/build_${PLATFORM}"; fi 100 | echo "## SDL2_MIXER_SRC=$SDL2_MIXER_SRC" 101 | 102 | export PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig # this is important for find SDL path 103 | pushd "${SDL2_MIXER_SRC}/build_${PLATFORM}" 104 | ../configure --host=x86_64-w64-mingw32 \ 105 | --prefix=$PORTBUILD_PATH 106 | make -j$CORE_NUM && make install 107 | popd 108 | } -------------------------------------------------------------------------------- /script/cross_android.sh: -------------------------------------------------------------------------------- 1 | # bash -c "export SKIP_PORTS=yes && ./cross_android.sh" 2 | PLATFORM=android 3 | BUILD_PATH=./../build_${PLATFORM} 4 | CMAKELISTS_PATH=$(pwd)/.. 5 | PORTBUILD_PATH=$CMAKELISTS_PATH/thirdparty/build/arch_$PLATFORM 6 | CORE_NUM=$(cat /proc/cpuinfo | grep -c ^processor) 7 | TARGETS=$@ 8 | 9 | # prepare_port portname 10 | function prepare_port() 11 | { 12 | _name=$(basename "$1") 13 | if [ -f "$1/external/download.sh" ]; then 14 | chmod +x "$1/external/download.sh" 15 | "$1/external/download.sh" 16 | fi 17 | } 18 | 19 | # SKIP_PORTS="yes" 20 | if [ -z "$SKIP_PORTS" ]; then 21 | source ./_fetch.sh 22 | source ./_$PLATFORM.sh 23 | fetch_bz2 ; prepare_port $BZ2_SRC 24 | fetch_lua ; prepare_port $LUA_SRC 25 | fetch_sdl2 ; prepare_port $SDL2_SRC 26 | fetch_sdl2_image ; prepare_port $SDL2_IMAGE_SRC 27 | fetch_sdl2_ttf ; prepare_port $SDL2_TTF_SRC 28 | fetch_sdl2_mixer ; prepare_port $SDL2_MIXER_SRC 29 | fi 30 | 31 | # config and build project 32 | if [ -z "$BUILD_TYPE" ]; then BUILD_TYPE=MinSizeRel; fi 33 | if [ -z "$TARGETS" ]; then TARGETS=assembleRelease; fi 34 | 35 | pushd ${CMAKELISTS_PATH}/src/onsyuri_android 36 | echo "ANDROID_HOME=$ANDROID_HOME" 37 | chmod +x ./gradlew && ./gradlew $TARGETS --no-daemon 38 | popd -------------------------------------------------------------------------------- /script/cross_linux32.sh: -------------------------------------------------------------------------------- 1 | # bash -c "BUILD_TYPE=Debug SKIP_PORTS=yes ./cross_linux32.sh" 2 | PLATFORM=linux32 3 | BUILD_PATH=./../build_${PLATFORM} 4 | CMAKELISTS_PATH=$(pwd)/.. 5 | PORTBUILD_PATH=$CMAKELISTS_PATH/thirdparty/build/arch_$PLATFORM 6 | CORE_NUM=$(cat /proc/cpuinfo | grep -c ^processor) 7 | TARGETS=$@ 8 | 9 | # config env 10 | if [ -z "$CC" ]; then 11 | export CC=i686-linux-gnu-gcc 12 | export CXX=i686-linux-gnu-g++ 13 | fi 14 | if [ -z "$BUILD_TYPE" ]; then BUILD_TYPE=MinSizeRel; fi 15 | if [ -z "$TARGETS" ]; then TARGETS=all; fi 16 | 17 | # build ports 18 | echo "BUILD_TYPE=$BUILD_TYPE" 19 | echo "## PORTBUILD_PATH=$PORTBUILD_PATH" 20 | if [ -z "$SKIP_PORTS" ]; then 21 | source _fetch.sh 22 | source _$PLATFORM.sh 23 | fetch_jpeg ; build_jpeg 24 | fetch_bz2 ; build_bz2 25 | fetch_lua ; build_lua 26 | fetch_sdl2 ; build_sdl2 27 | fetch_sdl2_image ; build_sdl2_image 28 | fetch_sdl2_ttf ; build_sdl2_ttf 29 | fetch_sdl2_mixer ; build_sdl2_mixer 30 | fi 31 | 32 | # config project 33 | cmake -B $BUILD_PATH -S $CMAKELISTS_PATH \ 34 | -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 35 | -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \ 36 | -DSTATIC_PORT_ROOT=$PORTBUILD_PATH 37 | 38 | # build project 39 | make -C $BUILD_PATH $TARGETS -j$CORE_NUM -------------------------------------------------------------------------------- /script/cross_linux64.sh: -------------------------------------------------------------------------------- 1 | # bash -c "BUILD_TYPE=Debug SKIP_PORTS=yes ./cross_linux64.sh" 2 | PLATFORM=linux64 3 | BUILD_PATH=./../build_${PLATFORM} 4 | CMAKELISTS_PATH=$(pwd)/.. 5 | PORTBUILD_PATH=$CMAKELISTS_PATH/thirdparty/build/arch_$PLATFORM 6 | CORE_NUM=$(cat /proc/cpuinfo | grep -c ^processor) 7 | TARGETS=$@ 8 | 9 | # config env 10 | if [ -z "$CC" ]; then 11 | export CC=x86_64-linux-gnu-gcc 12 | export CXX=x86_64-linux-gnu-g++ 13 | fi 14 | if [ -z "$BUILD_TYPE" ]; then BUILD_TYPE=MinSizeRel; fi 15 | if [ -z "$TARGETS" ]; then TARGETS=all; fi 16 | 17 | # build ports 18 | echo "BUILD_TYPE=$BUILD_TYPE" 19 | echo "## PORTBUILD_PATH=$PORTBUILD_PATH" 20 | if [ -z "$SKIP_PORTS" ]; then 21 | source _fetch.sh 22 | source _$PLATFORM.sh 23 | fetch_jpeg ; build_jpeg 24 | fetch_bz2 ; build_bz2 25 | fetch_lua ; build_lua 26 | fetch_sdl2 ; build_sdl2 27 | fetch_sdl2_image ; build_sdl2_image 28 | fetch_sdl2_ttf ; build_sdl2_ttf 29 | fetch_sdl2_mixer ; build_sdl2_mixer 30 | fi 31 | 32 | # config project 33 | cmake -B $BUILD_PATH -S $CMAKELISTS_PATH \ 34 | -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 35 | -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \ 36 | -DSTATIC_PORT_ROOT=$PORTBUILD_PATH 37 | 38 | # build project 39 | make -C $BUILD_PATH $TARGETS -j$CORE_NUM -------------------------------------------------------------------------------- /script/cross_linuxa32.sh: -------------------------------------------------------------------------------- 1 | # bash -c "export BUILD_TYPE=Debug && export SKIP_PORTS=1 && ./cross_linuxa64.sh" 2 | PLATFORM=linuxa32 3 | BUILD_PATH=./../build_${PLATFORM} 4 | CMAKELISTS_PATH=$(pwd)/.. 5 | PORTBUILD_PATH=$CMAKELISTS_PATH/thirdparty/build/arch_$PLATFORM 6 | CORE_NUM=$(cat /proc/cpuinfo | grep -c ^processor) 7 | TARGETS=$@ 8 | 9 | # config env 10 | CC=arm-linux-gnueabihf-gcc 11 | CXX=arm-linux-gnueabihf-g++ 12 | 13 | # SKIP_PORTS="yes" 14 | # sdl2 has too many bindings to system, 15 | # so just compile these libs in the target machine and link the build cache 16 | echo "## PORTBUILD_PATH=$PORTBUILD_PATH" 17 | if [ -z "$SKIP_PORTS" ]; then 18 | source _fetch.sh 19 | source _$PLATFORM.sh 20 | # https://swarminglogic.com/article/2014_11_crosscompile2 21 | fetch_jpeg && build_jpeg 22 | fetch_bz2 && build_bz2 23 | fetch_lua && build_lua 24 | fetch_sdl2 && build_sdl2 25 | fetch_sdl2_image && build_sdl2_image 26 | fetch_sdl2_ttf && build_sdl2_ttf 27 | fetch_sdl2_mixer && build_sdl2_mixer 28 | fi 29 | 30 | # config and build project 31 | if [ -z "$BUILD_TYPE" ]; then BUILD_TYPE=MinSizeRel; fi 32 | if [ -z "$TARGETS" ]; then TARGETS=all; fi 33 | if [ -z "$SYSROOT" ]; then SYSROOT=$PORTBUILD_PATH; fi 34 | PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig 35 | 36 | echo "BUILD_TYPE=$BUILD_TYPE" 37 | cmake -B $BUILD_PATH -S $CMAKELISTS_PATH \ 38 | -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 39 | -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \ 40 | -DCMAKE_SYSROOT=$SYSROOT \ 41 | -DSTATIC_PORT_ROOT=$PORTBUILD_PATH 42 | make -C $BUILD_PATH $TARGETS -j$CORE_NUM -------------------------------------------------------------------------------- /script/cross_linuxa64.sh: -------------------------------------------------------------------------------- 1 | # bash -c "export BUILD_TYPE=Debug && export SKIP_PORTS=1 && ./cross_linuxa64.sh" 2 | PLATFORM=linuxa64 3 | BUILD_PATH=./../build_${PLATFORM} 4 | CMAKELISTS_PATH=$(pwd)/.. 5 | PORTBUILD_PATH=$CMAKELISTS_PATH/thirdparty/build/arch_$PLATFORM 6 | CORE_NUM=$(cat /proc/cpuinfo | grep -c ^processor) 7 | TARGETS=$@ 8 | 9 | # config env 10 | CC=aarch64-linux-gnu-gcc 11 | CXX=aarch64-linux-gnu-g++ 12 | 13 | # SKIP_PORTS="yes" 14 | # sdl2 has too many bindings to system, 15 | # so just compile these libs in the target machine and link the build cache 16 | echo "## PORTBUILD_PATH=$PORTBUILD_PATH" 17 | if [ -z "$SKIP_PORTS" ]; then 18 | source _fetch.sh 19 | source _$PLATFORM.sh 20 | # https://swarminglogic.com/article/2014_11_crosscompile2 21 | fetch_jpeg && build_jpeg 22 | fetch_bz2 && build_bz2 23 | fetch_lua && build_lua 24 | fetch_sdl2 && build_sdl2 25 | fetch_sdl2_image && build_sdl2_image 26 | fetch_sdl2_ttf && build_sdl2_ttf 27 | fetch_sdl2_mixer && build_sdl2_mixer 28 | fi 29 | 30 | # config and build project 31 | if [ -z "$BUILD_TYPE" ]; then BUILD_TYPE=MinSizeRel; fi 32 | if [ -z "$TARGETS" ]; then TARGETS=all; fi 33 | if [ -z "$SYSROOT" ]; then SYSROOT=$PORTBUILD_PATH; fi 34 | 35 | echo "BUILD_TYPE=$BUILD_TYPE" 36 | PKG_CONFIG_PATH=${PORTBUILD_PATH}/lib/pkgconfig 37 | cmake -B $BUILD_PATH -S $CMAKELISTS_PATH \ 38 | -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 39 | -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \ 40 | -DCMAKE_SYSROOT=$SYSROOT \ 41 | -DSTATIC_PORT_ROOT=$PORTBUILD_PATH 42 | make -C $BUILD_PATH $TARGETS -j$CORE_NUM -------------------------------------------------------------------------------- /script/cross_llvmmingw32.sh: -------------------------------------------------------------------------------- 1 | # bash -c "BUILD_TYPE=Debug SKIP_PORTS=1 ./cross_llvmmingw32.sh" 2 | PLATFORM=llvmmingw32 3 | BUILD_PATH=./../build_${PLATFORM} 4 | CMAKELISTS_PATH=$(pwd)/.. 5 | PORTBUILD_PATH=$CMAKELISTS_PATH/thirdparty/build/arch_$PLATFORM 6 | if [ -z "$CORE_NUM" ]; then 7 | CORE_NUM=$(cat /proc/cpuinfo | grep -c ^processor) 8 | fi 9 | TARGETS=$@ 10 | 11 | # config env 12 | if [ -z "$CC" ]; then 13 | export CC=i686-w64-mingw32-clang 14 | export CXX=i686-w64-mingw32-clang++ 15 | export RC=i686-w64-mingw32-windres 16 | fi 17 | 18 | if [ -z "$BUILD_TYPE" ]; then BUILD_TYPE=MinSizeRel; fi 19 | if [ -z "$TARGETS" ]; then TARGETS=all; fi 20 | 21 | echo "## PORTBUILD_PATH=$PORTBUILD_PATH" 22 | if [ -z "$SKIP_PORTS" ]; then 23 | source _fetch.sh 24 | source _$PLATFORM.sh 25 | fetch_bz2 ; build_bz2 26 | fetch_lua ; build_lua 27 | fetch_sdl2 ; build_sdl2 28 | fetch_sdl2_image ; build_sdl2_image 29 | fetch_sdl2_ttf ; build_sdl2_ttf 30 | fetch_sdl2_mixer ; build_sdl2_mixer 31 | fi 32 | 33 | # config project 34 | echo "BUILD_TYPE=$BUILD_TYPE" 35 | cmake -B $BUILD_PATH -S $CMAKELISTS_PATH \ 36 | -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 37 | -DCMAKE_C_COMPILER=$CC \ 38 | -DCMAKE_CXX_COMPILER=$CXX \ 39 | -DCMAKE_RC_COMPILER=$RC \ 40 | -DCMAKE_SYSTEM_NAME="Windows" \ 41 | -DSTATIC_PORT_ROOT=$PORTBUILD_PATH \ 42 | -DEXTRA_SDL_LIB=ON 43 | 44 | # build project 45 | make -C $BUILD_PATH $TARGETS -j$CORE_NUM -------------------------------------------------------------------------------- /script/cross_llvmmingw64.sh: -------------------------------------------------------------------------------- 1 | # bash -c "BUILD_TYPE=Debug SKIP_PORTS=1 ./cross_llvmmingw64.sh" 2 | PLATFORM=llvmmingw64 3 | BUILD_PATH=./../build_${PLATFORM} 4 | CMAKELISTS_PATH=$(pwd)/.. 5 | PORTBUILD_PATH=$CMAKELISTS_PATH/thirdparty/build/arch_$PLATFORM 6 | if [ -z "$CORE_NUM" ]; then 7 | CORE_NUM=$(cat /proc/cpuinfo | grep -c ^processor) 8 | fi 9 | TARGETS=$@ 10 | 11 | # config env 12 | if [ -z "$CC" ]; then 13 | export CC=x86_64-w64-mingw32-clang 14 | export CXX=x86_64-w64-mingw32-clang++ 15 | export RC=x86_64-w64-mingw32-windres 16 | fi 17 | 18 | if [ -z "$BUILD_TYPE" ]; then BUILD_TYPE=MinSizeRel; fi 19 | if [ -z "$TARGETS" ]; then TARGETS=all; fi 20 | 21 | echo "## PORTBUILD_PATH=$PORTBUILD_PATH" 22 | if [ -z "$SKIP_PORTS" ]; then 23 | source _fetch.sh 24 | source _$PLATFORM.sh 25 | fetch_bz2 ; build_bz2 26 | fetch_lua ; build_lua 27 | fetch_sdl2 ; build_sdl2 28 | fetch_sdl2_image ; build_sdl2_image 29 | fetch_sdl2_ttf ; build_sdl2_ttf 30 | fetch_sdl2_mixer ; build_sdl2_mixer 31 | fi 32 | 33 | # config project 34 | echo "BUILD_TYPE=$BUILD_TYPE" 35 | cmake -B $BUILD_PATH -S $CMAKELISTS_PATH \ 36 | -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 37 | -DCMAKE_C_COMPILER=$CC \ 38 | -DCMAKE_CXX_COMPILER=$CXX \ 39 | -DCMAKE_RC_COMPILER=$RC \ 40 | -DCMAKE_SYSTEM_NAME="Windows" \ 41 | -DSTATIC_PORT_ROOT=$PORTBUILD_PATH \ 42 | -DEXTRA_SDL_LIB=ON 43 | 44 | # build project 45 | make -C $BUILD_PATH $TARGETS -j$CORE_NUM -------------------------------------------------------------------------------- /script/cross_mingw32.sh: -------------------------------------------------------------------------------- 1 | # bash -c "BUILD_TYPE=Debug SKIP_PORTS=1 ./cross_mingw32.sh" 2 | PLATFORM=mingw32 3 | BUILD_PATH=./../build_${PLATFORM} 4 | CMAKELISTS_PATH=$(pwd)/.. 5 | PORTBUILD_PATH=$CMAKELISTS_PATH/thirdparty/build/arch_$PLATFORM 6 | CORE_NUM=$(cat /proc/cpuinfo | grep -c ^processor) 7 | TARGETS=$@ 8 | 9 | # config env 10 | CC=i686-w64-mingw32-gcc 11 | CXX=i686-w64-mingw32-g++ 12 | RC=i686-w64-mingw32-windres 13 | 14 | if [ -z "$BUILD_TYPE" ]; then BUILD_TYPE=MinSizeRel; fi 15 | if [ -z "$TARGETS" ]; then TARGETS=all; fi 16 | 17 | echo "## PORTBUILD_PATH=$PORTBUILD_PATH" 18 | if [ -z "$SKIP_PORTS" ]; then 19 | source _fetch.sh 20 | source _$PLATFORM.sh 21 | fetch_jpeg ; build_jpeg 22 | fetch_bz2 ; build_bz2 23 | fetch_lua ; build_lua 24 | fetch_sdl2 ; build_sdl2 25 | fetch_sdl2_image ; build_sdl2_image 26 | fetch_sdl2_ttf ; build_sdl2_ttf 27 | fetch_sdl2_mixer ; build_sdl2_mixer 28 | fi 29 | 30 | # config project 31 | echo "BUILD_TYPE=$BUILD_TYPE" 32 | cmake -B $BUILD_PATH -S $CMAKELISTS_PATH \ 33 | -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 34 | -DCMAKE_C_COMPILER=$CC \ 35 | -DCMAKE_CXX_COMPILER=$CXX \ 36 | -DCMAKE_RC_COMPILER=$RC \ 37 | -DCMAKE_SYSTEM_NAME="Windows" \ 38 | -DSTATIC_PORT_ROOT=$PORTBUILD_PATH 39 | 40 | # build project 41 | make -C $BUILD_PATH $TARGETS -j$CORE_NUM -------------------------------------------------------------------------------- /script/cross_mingw64.sh: -------------------------------------------------------------------------------- 1 | # bash -c "BUILD_TYPE=Debug SKIP_PORTS=1 ./cross_mingw64.sh" 2 | PLATFORM=mingw64 3 | BUILD_PATH=./../build_${PLATFORM} 4 | CMAKELISTS_PATH=$(pwd)/.. 5 | PORTBUILD_PATH=$CMAKELISTS_PATH/thirdparty/build/arch_$PLATFORM 6 | CORE_NUM=$(cat /proc/cpuinfo | grep -c ^processor) 7 | TARGETS=$@ 8 | 9 | # config env 10 | CC=x86_64-w64-mingw32-gcc 11 | CXX=x86_64-w64-mingw32-g++ 12 | RC=x86_64-w64-mingw32-windres 13 | 14 | if [ -z "$BUILD_TYPE" ]; then BUILD_TYPE=MinSizeRel; fi 15 | if [ -z "$TARGETS" ]; then TARGETS=all; fi 16 | 17 | echo "## PORTBUILD_PATH=$PORTBUILD_PATH" 18 | if [ -z "$SKIP_PORTS" ]; then 19 | source _fetch.sh 20 | source _$PLATFORM.sh 21 | fetch_jpeg ; build_jpeg 22 | fetch_bz2 ; build_bz2 23 | fetch_lua ; build_lua 24 | fetch_sdl2 ; build_sdl2 25 | fetch_sdl2_image ; build_sdl2_image 26 | fetch_sdl2_ttf ; build_sdl2_ttf 27 | fetch_sdl2_mixer ; build_sdl2_mixer 28 | fi 29 | 30 | # config project 31 | echo "BUILD_TYPE=$BUILD_TYPE" 32 | cmake -B $BUILD_PATH -S $CMAKELISTS_PATH \ 33 | -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 34 | -DCMAKE_C_COMPILER=$CC \ 35 | -DCMAKE_CXX_COMPILER=$CXX \ 36 | -DCMAKE_RC_COMPILER=$RC \ 37 | -DCMAKE_SYSTEM_NAME="Windows" \ 38 | -DSTATIC_PORT_ROOT=$PORTBUILD_PATH 39 | 40 | # build project 41 | make -C $BUILD_PATH $TARGETS -j$CORE_NUM -------------------------------------------------------------------------------- /script/cross_web.sh: -------------------------------------------------------------------------------- 1 | # sh -c "BUILD_TYPE=Debug ./cross_web.sh" 2 | BUILD_PATH=$(pwd)/../build_web 3 | CMAKELISTS_PATH=$(pwd)/.. 4 | PORTBUILD_PATH=$CMAKELISTS_PATH/thirdparty/build/arch_wasm 5 | CORE_NUM=$(cat /proc/cpuinfo | grep -c ^processor) 6 | TARGETS=$@ 7 | 8 | # config env 9 | source ./_fetch.sh 10 | if [ -n "$(uname -a | grep Msys)" ]; then # fix python problem in windows 11 | PATH=$MSYS2_HOME/mingw32/bin/:$PATH 12 | fi 13 | source "$EMSDK_HOME/emsdk_env.sh" 14 | if [ -z "$BUILD_TYPE" ]; then BUILD_TYPE=MinSizeRel; fi 15 | if [ -z "$TARGETS" ]; then TARGETS=all; fi 16 | 17 | # build ports 18 | function build_lua() 19 | { 20 | echo "## LUA_SRC=$LUA_SRC" 21 | if ! [ -d "$PORTBUILD_PATH/lua" ]; then mkdir -p "$PORTBUILD_PATH/lua"; fi 22 | make -C $LUA_SRC clean 23 | make -C $LUA_SRC all PLAT=linux CC=emcc AR="emar rcu" -j$CORE_NUM 24 | make -C $LUA_SRC install INSTALL_TOP=$PORTBUILD_PATH -j$CORE_NUM 25 | } 26 | 27 | fetch_lua && build_lua 28 | embuilder build sdl2 sdl2_ttf sdl2_image sdl2_mixer bzip2 ogg vorbis mpg123 29 | emcc $CMAKELISTS_PATH/src/onsyuri_web/dummy.c \ 30 | -o $BUILD_PATH/dummy.js \ 31 | -sUSE_SDL=2 -sUSE_SDL_IMAGE=2 -sUSE_SDL_MIXER=2 \ 32 | -sSDL2_IMAGE_FORMATS=bmp,png,jpg \ 33 | -sSDL2_MIXER_FORMATS=ogg,mp3,mid -sUSE_OGG=1 -sUSE_VORBIS=1 -sUSE_MPG123=1 34 | 35 | # config and build project 36 | # rm -rf $BUILD_PATH/* 37 | if [ -n "$GAME_PATH" ]; then cp -rf $GAME_PATH/* $BUILD_PATH; fi 38 | emcmake cmake -G "Unix Makefiles" \ 39 | -S $CMAKELISTS_PATH -B $BUILD_PATH \ 40 | -DCMAKE_BUILD_TYPE=$BUILD_TYPE 41 | make -C $BUILD_PATH $TARGETS -j$CORE_NUM -------------------------------------------------------------------------------- /script/local_darwin.sh: -------------------------------------------------------------------------------- 1 | # bash -c "export BUILD_TYPE=Debug && export USE_STATIC_PORTS=yes && export SKIP_PORTS=yes && ./local_linux64.sh" 2 | PLATFORM=darwin 3 | BUILD_PATH=./../build_${PLATFORM} 4 | CMAKELISTS_PATH=$(pwd)/.. 5 | CORE_NUM=$(nproc) 6 | TARGETS=$@ 7 | 8 | # config env 9 | CC=gcc 10 | CXX=g++ 11 | if [ -z "$BUILD_TYPE" ]; then BUILD_TYPE=MinSizeRel; fi 12 | if [ -z "$TARGETS" ]; then TARGETS=all; fi 13 | 14 | # config and build project 15 | # USE_STATIC_PORTS=yes 16 | # SKIP_PORTS=yes 17 | echo "BUILD_TYPE=$BUILD_TYPE" 18 | cmake -B $BUILD_PATH -S $CMAKELISTS_PATH \ 19 | -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 20 | 21 | make -C $BUILD_PATH $TARGETS -j$CORE_NUM -------------------------------------------------------------------------------- /script/local_linux32.sh: -------------------------------------------------------------------------------- 1 | # bash -c "BUILD_TYPE=Debug OBTAIN_DEPENDS=yes ./local_linux32.sh" 2 | PLATFORM=linux32 3 | BUILD_PATH=./../build_${PLATFORM} 4 | CMAKELISTS_PATH=$(pwd)/.. 5 | PORTBUILD_PATH=$CMAKELISTS_PATH/thirdparty/build/arch_$PLATFORM 6 | CORE_NUM=$(cat /proc/cpuinfo | grep -c ^processor) 7 | TARGETS=$@ 8 | 9 | # config env 10 | CC=gcc 11 | CXX=g++ 12 | if [ -z "$BUILD_TYPE" ]; then BUILD_TYPE=MinSizeRel; fi 13 | if [ -z "$TARGETS" ]; then TARGETS=all; fi 14 | 15 | # ports from debian 16 | if [ -n "$OBTAIN_DEPENDS" ]; then 17 | sudo dpkg --add-architecture i386 18 | sudo apt-get update 19 | sudo apt-get -y install gcc-multilib g++-multilib 20 | sudo apt-get -y install libsdl2-dev:i386 libsdl2-ttf-dev:i386 libsdl2-image-dev:i386 libsdl2-mixer-dev:i386 21 | sudo apt-get -y install libbz2-dev:i386 libjpeg-dev:i386 libpng-dev:i386 22 | sudo apt-get -y install liblua5.3-dev:i386 libgl1-mesa-dev:i386 23 | fi 24 | 25 | # config and build project 26 | echo "BUILD_TYPE=$BUILD_TYPE" 27 | 28 | cmake -B $BUILD_PATH -S $CMAKELISTS_PATH \ 29 | -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 30 | -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \ 31 | -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 32 | 33 | make -C $BUILD_PATH $TARGETS -j$CORE_NUM -------------------------------------------------------------------------------- /script/local_linux64.sh: -------------------------------------------------------------------------------- 1 | # bash -c "BUILD_TYPE=Debug OBTAIN_DEPENDS=yes ./local_linux64.sh" 2 | PLATFORM=linux64 3 | BUILD_PATH=./../build_${PLATFORM} 4 | CMAKELISTS_PATH=$(pwd)/.. 5 | PORTBUILD_PATH=$CMAKELISTS_PATH/thirdparty/build/arch_$PLATFORM 6 | CORE_NUM=$(cat /proc/cpuinfo | grep -c ^processor) 7 | TARGETS=$@ 8 | 9 | # config env 10 | CC=gcc 11 | CXX=g++ 12 | if [ -z "$BUILD_TYPE" ]; then BUILD_TYPE=MinSizeRel; fi 13 | if [ -z "$TARGETS" ]; then TARGETS=all; fi 14 | 15 | # ports from debian 16 | if [ -n "$OBTAIN_DEPENDS" ]; then 17 | sudo apt-get update 18 | sudo apt-get -y install libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev 19 | sudo apt-get -y install libbz2-dev libjpeg-dev libpng-dev 20 | sudo apt-get -y install liblua5.3-dev libgl1-mesa-dev 21 | fi 22 | 23 | # config and build project 24 | echo "BUILD_TYPE=$BUILD_TYPE" 25 | 26 | cmake -B $BUILD_PATH -S $CMAKELISTS_PATH \ 27 | -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 28 | -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \ 29 | -DCMAKE_C_FLAGS=-m64 -DCMAKE_CXX_FLAGS=-m64 30 | 31 | make -C $BUILD_PATH $TARGETS -j$CORE_NUM -------------------------------------------------------------------------------- /script/local_msys2mingw32.sh: -------------------------------------------------------------------------------- 1 | # sh -c "export BUILD_TYPE=Debug && export MSYS2_HOME=/path/to/msys2 && ./local_msys2mingw32.sh" 2 | BUILD_PATH=./../build_msys2mingw32 3 | CMAKELISTS_PATH=./../ 4 | CORE_NUM=$(cat /proc/cpuinfo | grep -c ^processor) 5 | TARGETS=$@ 6 | 7 | # config env 8 | CC=$MSYS2_HOME/mingw32/bin/gcc 9 | CXX=$MSYS2_HOME/mingw32/bin/g++ 10 | if [ -n "$(uname -a | grep Msys)" ]; then 11 | CC+=".exe" 12 | CXX+=".exe" 13 | fi 14 | PATH=$MSYS2_HOME/mingw32/bin/:$PATH 15 | if [ -z "$BUILD_TYPE" ]; then BUILD_TYPE=MinSizeRel; fi 16 | if [ -z "$TARGETS" ]; then TARGETS=all; fi 17 | 18 | # config and build project 19 | echo "BUILD_TYPE=$BUILD_TYPE, MSYS2_HOME=$MSYS2_HOME", CC=$CC 20 | cmake -B $BUILD_PATH -S $CMAKELISTS_PATH \ 21 | -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 22 | -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \ 23 | -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 24 | make -C $BUILD_PATH $TARGETS -j$CORE_NUM -------------------------------------------------------------------------------- /script/local_msys2mingw64.sh: -------------------------------------------------------------------------------- 1 | # sh -c "export BUILD_TYPE=Debug && export MSYS2_HOME=/path/to/msys2 && ./local_msys2mingw64.sh" 2 | BUILD_PATH=./../build_msys2mingw64 3 | CMAKELISTS_PATH=./../ 4 | CORE_NUM=$(cat /proc/cpuinfo | grep -c ^processor) 5 | TARGETS=$@ 6 | 7 | # config env 8 | CC=$MSYS2_HOME/mingw64/bin/gcc 9 | CXX=$MSYS2_HOME/mingw64/bin/g++ 10 | if [ -n "$(uname -a | grep Msys)" ]; then 11 | CC+=".exe" 12 | CXX+=".exe" 13 | fi 14 | PATH=$MSYS2_HOME/mingw64/bin/:$PATH 15 | if [ -z "$BUILD_TYPE" ]; then BUILD_TYPE=MinSizeRel; fi 16 | if [ -z "$TARGETS" ]; then TARGETS=all; fi 17 | 18 | # config and build project 19 | echo "BUILD_TYPE=$BUILD_TYPE, MSYS2_HOME=$MSYS2_HOME", CC=$CC 20 | cmake -B $BUILD_PATH -S $CMAKELISTS_PATH \ 21 | -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 22 | -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \ 23 | -DCMAKE_C_FLAGS=-m64 -DCMAKE_CXX_FLAGS=-m64 24 | make -C $BUILD_PATH $TARGETS -j$CORE_NUM -------------------------------------------------------------------------------- /src/onsyuri/AVIWrapper.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * AVIWrapper.h - avifile library wrapper class to play AVI video & audio stream 4 | * 5 | * Copyright (c) 2001-2008 Ogapee. All rights reserved. 6 | * 7 | * ogapee@aqua.dti2.ne.jp 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | */ 23 | 24 | #ifndef __AVI_WRAPPER_H__ 25 | #define __AVI_WRAPPER_H__ 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | class AVIWrapper 34 | { 35 | public: 36 | enum { AVI_STOP = 0, 37 | AVI_PLAYING = 1 38 | }; 39 | AVIWrapper(); 40 | ~AVIWrapper(); 41 | 42 | int init( char *filename, bool debug_flag ); 43 | int initAV( SDL_Surface *surface, bool audio_open_flag ); 44 | int play( bool click_flag ); 45 | 46 | void audioCallback( void *userdata, Uint8 *stream, int len ); 47 | int playVideo( void *userdata ); 48 | 49 | unsigned int getWidth(){ return width; }; 50 | unsigned int getHeight(){ return height; }; 51 | 52 | private: 53 | double getAudioTime(); 54 | int drawFrame( avm::CImage *image ); 55 | 56 | SDL_Overlay *screen_overlay; 57 | SDL_Rect screen_rect; 58 | unsigned int width; 59 | unsigned int height; 60 | 61 | IAviReadFile *i_avi; 62 | IAviReadStream *v_stream; 63 | IAviReadStream *a_stream; 64 | int remaining_count; 65 | char *remaining_buffer; 66 | 67 | bool debug_flag; 68 | int status; 69 | SDL_Thread *thread_id; 70 | int64_t time_start; 71 | double frame_start; 72 | }; 73 | 74 | #endif // __AVI_WRAPPER_H__ 75 | -------------------------------------------------------------------------------- /src/onsyuri/BaseReader.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * BaseReader.h - Base class of archive reader 4 | * 5 | * Copyright (c) 2001-2018 Ogapee. All rights reserved. 6 | * (C) 2014-2018 jh10001 7 | * 8 | * ogapee@aqua.dti2.ne.jp 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | */ 24 | 25 | #ifndef __BASE_READER_H__ 26 | #define __BASE_READER_H__ 27 | 28 | #include 29 | #if defined(ANDROID) && !defined(__LIBRETRO__) 30 | extern "C" int stat_ons(const char *path, struct stat *statbuf); 31 | extern "C" FILE *fopen_ons(const char *str, const char *mode); 32 | #define fopen fopen_ons 33 | extern "C" int mkdir_ons(const char *path, mode_t mode); 34 | #define mkdir mkdir_ons 35 | #endif 36 | 37 | #if defined(WEB) 38 | extern "C" FILE *fopen_ons(const char *str, const char *mode); 39 | #define fopen fopen_ons 40 | #endif 41 | 42 | #ifndef SEEK_END 43 | #define SEEK_END 2 44 | #endif 45 | 46 | #if defined(LINUX) || defined(MACOSX) 47 | #define DELIMITER '/' 48 | #elif defined(WIN32) || defined(_WIN32) 49 | #define DELIMITER '\\' 50 | #elif defined(MACOS9) 51 | #define DELIMITER ':' 52 | #define RELATIVEPATH ":" 53 | #define RELATIVEPATHLENGTH 1 54 | #else 55 | #define DELIMITER '/' 56 | #endif 57 | #ifndef RELATIVEPATH 58 | #define RELATIVEPATH "" 59 | #define RELATIVEPATHLENGTH 0 60 | #endif 61 | 62 | struct BaseReader 63 | { 64 | enum { 65 | NO_COMPRESSION = 0, 66 | SPB_COMPRESSION = 1, 67 | LZSS_COMPRESSION = 2, 68 | NBZ_COMPRESSION = 4 69 | }; 70 | 71 | enum { 72 | ARCHIVE_TYPE_NONE = 0, 73 | ARCHIVE_TYPE_SAR = 1, 74 | ARCHIVE_TYPE_NSA = 2, 75 | ARCHIVE_TYPE_NS2 = 4 //new format since NScr2.91, uses ext ".ns2" 76 | }; 77 | 78 | struct FileInfo{ 79 | char name[256]; 80 | int compression_type; 81 | size_t offset; 82 | size_t length; 83 | size_t original_length; 84 | }; 85 | 86 | struct ArchiveInfo{ 87 | ArchiveInfo *next; 88 | FILE *file_handle; 89 | int power_resume_number; // currently only for PSP 90 | char *file_name; 91 | FileInfo *fi_list; 92 | unsigned int num_of_files; 93 | unsigned long base_offset; 94 | 95 | ArchiveInfo(){ 96 | next = NULL; 97 | file_handle = NULL; 98 | power_resume_number = 0; 99 | file_name = NULL; 100 | fi_list = NULL; 101 | num_of_files = 0; 102 | } 103 | ~ArchiveInfo(){ 104 | if (file_handle) fclose( file_handle ); 105 | if (file_name) delete[] file_name; 106 | if (fi_list) delete[] fi_list; 107 | } 108 | }; 109 | 110 | virtual ~BaseReader(){}; 111 | 112 | virtual int open( const char *name=NULL ) = 0; 113 | virtual int close() = 0; 114 | 115 | virtual const char *getArchiveName() const = 0; 116 | virtual int getNumFiles() = 0; 117 | virtual void registerCompressionType( const char *ext, int type ) = 0; 118 | 119 | //virtual FileInfo getFileByIndex( unsigned int index ) = 0; 120 | virtual size_t getFileLength( const char *file_name ) = 0; 121 | virtual size_t getFile( const char *file_name, unsigned char *buffer, int *location=NULL ) = 0; 122 | }; 123 | 124 | #endif // __BASE_READER_H__ 125 | -------------------------------------------------------------------------------- /src/onsyuri/ButtonLink.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * ButtonLink.h - Base button class 4 | * 5 | * Copyright (c) 2001-2013 Ogapee. All rights reserved. 6 | * 7 | * ogapee@aqua.dti2.ne.jp 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | */ 23 | 24 | #ifndef __BUTTON_LINK_H__ 25 | #define __BUTTON_LINK_H__ 26 | 27 | #include "AnimationInfo.h" 28 | 29 | struct ButtonLink{ 30 | enum { NORMAL_BUTTON = 0, 31 | SPRITE_BUTTON = 1, 32 | LOOKBACK_BUTTON = 2, 33 | TMP_SPRITE_BUTTON = 3 34 | }; 35 | 36 | ButtonLink *next; 37 | int button_type; 38 | int no; 39 | int sprite_no; 40 | char *exbtn_ctl[3]; 41 | SDL_Rect select_rect; 42 | SDL_Rect image_rect; 43 | AnimationInfo *anim[2]; 44 | int show_flag; // 0...show nothing, 1... show anim[0], 2 ... show anim[1] 45 | 46 | ButtonLink(){ 47 | button_type = NORMAL_BUTTON; 48 | next = NULL; 49 | exbtn_ctl[0] = exbtn_ctl[1] = exbtn_ctl[2] = NULL; 50 | anim[0] = anim[1] = NULL; 51 | show_flag = 0; 52 | }; 53 | 54 | ~ButtonLink(){ 55 | if ( (button_type == NORMAL_BUTTON || button_type == TMP_SPRITE_BUTTON) && 56 | anim[0] ) delete anim[0]; 57 | for (int i=0 ; i<3 ; i++) 58 | if ( exbtn_ctl[i] ) delete[] exbtn_ctl[i]; 59 | }; 60 | 61 | void insert( ButtonLink *button ){ 62 | button->next = this->next; 63 | this->next = button; 64 | }; 65 | 66 | void removeSprite( int no ){ 67 | ButtonLink *bl = this; 68 | while( bl->next ){ 69 | if ( bl->next->sprite_no == no && 70 | bl->next->button_type == SPRITE_BUTTON ){ 71 | ButtonLink *bl2 = bl->next; 72 | bl->next = bl->next->next; 73 | delete bl2; 74 | } 75 | else{ 76 | bl = bl->next; 77 | } 78 | } 79 | }; 80 | }; 81 | 82 | #endif // __BUTTON_LINK_H__ 83 | -------------------------------------------------------------------------------- /src/onsyuri/DirtyRect.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * DirtyRect.cpp - Invalid region on text_surface which should be updated 4 | * 5 | * Copyright (c) 2001-2012 Ogapee. All rights reserved. 6 | * (c) 2014 jh10001 7 | * 8 | * ogapee@aqua.dti2.ne.jp 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | */ 24 | 25 | #include "DirtyRect.h" 26 | 27 | DirtyRect::DirtyRect() 28 | { 29 | screen_width = screen_height = 0; 30 | bounding_box.w = bounding_box.h = 0; 31 | } 32 | 33 | DirtyRect::DirtyRect( const DirtyRect &d ) 34 | { 35 | screen_width = d.screen_width; 36 | screen_height = d.screen_height; 37 | bounding_box = d.bounding_box; 38 | } 39 | 40 | DirtyRect& DirtyRect::operator =( const DirtyRect &d ) 41 | { 42 | screen_width = d.screen_width; 43 | screen_height = d.screen_height; 44 | bounding_box = d.bounding_box; 45 | 46 | return *this; 47 | } 48 | 49 | DirtyRect::~DirtyRect() 50 | { 51 | } 52 | 53 | void DirtyRect::setDimension(int w, int h) 54 | { 55 | screen_width = w; 56 | screen_height = h; 57 | } 58 | 59 | void DirtyRect::add( SDL_Rect src ) 60 | { 61 | //utils::printInfo("add %d %d %d %d\n", src.x, src.y, src.w, src.h ); 62 | if ( src.w == 0 || src.h == 0 ) return; 63 | 64 | if (src.x < 0){ 65 | if (src.w < -src.x) return; 66 | src.w += src.x; 67 | src.x = 0; 68 | } 69 | if (src.y < 0){ 70 | if (src.h < -src.y) return; 71 | src.h += src.y; 72 | src.y = 0; 73 | } 74 | 75 | if (src.x >= screen_width) return; 76 | if (src.x+src.w >= screen_width) 77 | src.w = screen_width-src.x; 78 | 79 | if (src.y >= screen_height) return; 80 | if (src.y+src.h >= screen_height) 81 | src.h = screen_height-src.y; 82 | 83 | bounding_box = calcBoundingBox( bounding_box, src ); 84 | } 85 | 86 | SDL_Rect DirtyRect::calcBoundingBox( SDL_Rect src1, SDL_Rect &src2 ) 87 | { 88 | if ( src2.w == 0 || src2.h == 0 ){ 89 | return src1; 90 | } 91 | if ( src1.w == 0 || src1.h == 0 ){ 92 | return src2; 93 | } 94 | 95 | if ( src1.x > src2.x ){ 96 | src1.w += src1.x - src2.x; 97 | src1.x = src2.x; 98 | } 99 | if ( src1.y > src2.y ){ 100 | src1.h += src1.y - src2.y; 101 | src1.y = src2.y; 102 | } 103 | if ( src1.x + src1.w < src2.x + src2.w ){ 104 | src1.w = src2.x + src2.w - src1.x; 105 | } 106 | if ( src1.y + src1.h < src2.y + src2.h ){ 107 | src1.h = src2.y + src2.h - src1.y; 108 | } 109 | 110 | return src1; 111 | } 112 | 113 | void DirtyRect::clear() 114 | { 115 | bounding_box.w = bounding_box.h = 0; 116 | } 117 | 118 | void DirtyRect::fill( int w, int h ) 119 | { 120 | bounding_box.x = bounding_box.y = 0; 121 | bounding_box.w = w; 122 | bounding_box.h = h; 123 | } 124 | -------------------------------------------------------------------------------- /src/onsyuri/DirtyRect.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * DirtyRect.h - Invalid region on text_surface which should be updated 4 | * 5 | * Copyright (c) 2001-2012 Ogapee. All rights reserved. 6 | * 7 | * ogapee@aqua.dti2.ne.jp 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | */ 23 | 24 | #ifndef __DIRTY_RECT__ 25 | #define __DIRTY_RECT__ 26 | 27 | #if defined(ANDROID) 28 | #include "SDL.h" 29 | #else 30 | #include 31 | #endif 32 | 33 | struct DirtyRect 34 | { 35 | DirtyRect(); 36 | DirtyRect( const DirtyRect &d ); 37 | DirtyRect& operator =( const DirtyRect &d ); 38 | ~DirtyRect(); 39 | 40 | void setDimension(int w, int h); 41 | void add( SDL_Rect src ); 42 | void clear(); 43 | void fill( int w, int h ); 44 | 45 | SDL_Rect calcBoundingBox( SDL_Rect src1, SDL_Rect &src2 ); 46 | 47 | int screen_width, screen_height; 48 | SDL_Rect bounding_box; 49 | }; 50 | 51 | #endif // __DIRTY_RECT__ 52 | -------------------------------------------------------------------------------- /src/onsyuri/FontInfo.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * FontInfo.h - Font information storage class of ONScripter 4 | * 5 | * Copyright (c) 2001-2016 Ogapee. All rights reserved. 6 | * (C) 2016 jh10001 7 | * 8 | * ogapee@aqua.dti2.ne.jp 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | */ 24 | 25 | #ifndef __FONT_INFO_H__ 26 | #define __FONT_INFO_H__ 27 | 28 | 29 | #if defined(ANDROID) 30 | #include "SDL.h" 31 | #else 32 | #include 33 | #endif 34 | #include "BaseReader.h" 35 | 36 | typedef unsigned char uchar3[3]; 37 | 38 | class FontInfo{ 39 | public: 40 | enum { YOKO_MODE = 0, 41 | TATE_MODE = 1 42 | }; 43 | static char *cache_font_file; 44 | static void *font_cache; 45 | static int font_cache_size; 46 | void *ttf_font[2]; // 0...normal rendering, 1...outline rendering 47 | uchar3 color; 48 | uchar3 on_color, off_color, nofile_color; 49 | int font_size_xy[2]; 50 | int top_xy[2]; // Top left origin 51 | int num_xy[2]; // Row and column of the text windows 52 | int xy[2]; // Current position 53 | int old_xy[2]; 54 | int pitch_xy[2]; // Width and height of a character 55 | int wait_time; 56 | bool is_bold; 57 | bool is_shadow; 58 | bool is_transparent; 59 | bool is_newline_accepted; 60 | uchar3 window_color; 61 | 62 | int line_offset_xy[2]; // ruby offset for each line 63 | bool rubyon_flag; 64 | int tateyoko_mode; 65 | 66 | FontInfo(); 67 | void reset(); 68 | void *openFont( char *font_file, int ratio1, int ratio2 ); 69 | void setTateyokoMode( int tateyoko_mode ); 70 | int getTateyokoMode(); 71 | int getRemainingLine(); 72 | 73 | int x(bool use_ruby_offset=true); 74 | int y(bool use_ruby_offset=true); 75 | void setXY( int x=-1, int y=-1 ); 76 | void clear(); 77 | void newLine(); 78 | void setLineArea(int num); 79 | 80 | bool isEndOfLine(int margin=0); 81 | bool isLineEmpty(); 82 | void advanceCharInHankaku(int offest); 83 | void addLineOffset(int margin); 84 | void setRubyOnFlag(bool flag); 85 | 86 | SDL_Rect calcUpdatedArea(int start_xy[2], int ratio1, int ratio2); 87 | void addShadeArea(SDL_Rect &rect, int dx, int dy, int dw, int dh); 88 | int initRuby(FontInfo &body_info, int body_count, int ruby_count); 89 | }; 90 | 91 | #endif // __FONT_INFO_H__ 92 | -------------------------------------------------------------------------------- /src/onsyuri/LUAHandler.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * LUAHandler.h - LUA handler for ONScripter 4 | * 5 | * Copyright (c) 2001-2015 Ogapee. All rights reserved. 6 | * 7 | * ogapee@aqua.dti2.ne.jp 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | */ 23 | 24 | #if !defined(__LUA_HANDLER_H__) && defined(USE_LUA) 25 | #define __LUA_HANDLER_H__ 26 | 27 | #include 28 | 29 | class ONScripter; 30 | class ScriptHandler; 31 | 32 | class LUAHandler{ 33 | public: 34 | enum { LUA_TAG, 35 | LUA_TEXT0, 36 | LUA_TEXT, 37 | LUA_ANIMATION, 38 | LUA_CLOSE, 39 | LUA_END, 40 | LUA_SAVEPOINT, 41 | LUA_SAVE, 42 | LUA_LOAD, 43 | LUA_RESET, 44 | MAX_CALLBACK 45 | }; 46 | 47 | LUAHandler(); 48 | ~LUAHandler(); 49 | 50 | void init(ONScripter *ons, ScriptHandler *sh, 51 | int screen_ratio1, int screen_ratio2); 52 | void loadInitScript(); 53 | void addCallback(const char *label); 54 | 55 | int callFunction(bool is_callback, const char *cmd, void *data=NULL); 56 | 57 | bool isCallbackEnabled(int val); 58 | 59 | bool is_animatable; 60 | int duration_time; 61 | int next_time; 62 | 63 | //private: 64 | ONScripter *ons; 65 | lua_State *state; 66 | ScriptHandler *sh; 67 | int screen_ratio1, screen_ratio2; 68 | 69 | char error_str[256]; 70 | 71 | bool callback_state[MAX_CALLBACK]; 72 | }; 73 | 74 | #endif // __LUA_HANDLER_H__ 75 | -------------------------------------------------------------------------------- /src/onsyuri/NsaReader.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * NsaReader.h - Reader from a NSA archive 4 | * 5 | * Copyright (c) 2001-2014 Ogapee. All rights reserved. 6 | * 7 | * ogapee@aqua.dti2.ne.jp 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | */ 23 | 24 | #ifndef __NSA_READER_H__ 25 | #define __NSA_READER_H__ 26 | 27 | #include "SarReader.h" 28 | #define MAX_EXTRA_ARCHIVE 9 29 | #define MAX_NS2_ARCHIVE 100 30 | 31 | class NsaReader : public SarReader 32 | { 33 | public: 34 | NsaReader( unsigned int nsa_offset=0, char *path=NULL, int archive_type=ARCHIVE_TYPE_NSA, const unsigned char *key_table=NULL ); 35 | ~NsaReader(); 36 | 37 | int open( const char *nsa_path=NULL ); 38 | const char *getArchiveName() const; 39 | int getNumFiles(); 40 | 41 | size_t getFileLength( const char *file_name ); 42 | size_t getFile( const char *file_name, unsigned char *buf, int *location=NULL ); 43 | FileInfo getFileByIndex( unsigned int index ); 44 | 45 | int openForConvert( char *nsa_name, int archive_type=ARCHIVE_TYPE_NSA, unsigned int nsa_offset=0 ); 46 | int writeHeader( FILE *fp, int archive_type=ARCHIVE_TYPE_NSA, int nsa_offset=0 ); 47 | size_t putFile( FILE *fp, int no, size_t offset, size_t length, size_t original_length, int compression_type, bool modified_flag, unsigned char *buffer ); 48 | 49 | private: 50 | bool sar_flag; 51 | int nsa_offset; 52 | int archive_type; 53 | int num_of_nsa_archives; 54 | int num_of_ns2_archives; 55 | const char *nsa_archive_ext; 56 | const char *ns2_archive_ext; 57 | ArchiveInfo archive_info2[MAX_EXTRA_ARCHIVE]; 58 | ArchiveInfo archive_info_ns2[MAX_NS2_ARCHIVE]; 59 | 60 | size_t getFileLengthSub( ArchiveInfo *ai, const char *file_name ); 61 | }; 62 | 63 | #endif // __NSA_READER_H__ 64 | -------------------------------------------------------------------------------- /src/onsyuri/Parallel.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * Parallel.cpp 4 | * 5 | * Copyright (C) 2018-2019 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | #if defined(USE_PARALLEL) 23 | #include "Parallel.h" 24 | 25 | using namespace parallel; 26 | 27 | ThreadPool parallel::threadPool; 28 | 29 | namespace parallel { 30 | void ThreadPool::createThread() { 31 | assert(threadCreated < thread_num); 32 | Thread *thread = &threads[threadCreated]; 33 | thread->threadData.sem = SDL_CreateSemaphore(0); 34 | thread->thread = SDL_CreateThread([](void *ptr) { 35 | auto *td = (Thread::ThreadData*)ptr; 36 | for (;;) { 37 | td->body(td->data); 38 | int status = Thread::Status::IDLE; 39 | SDL_AtomicSet(&td->status, status); 40 | while (status != Thread::Status::RUNNING) { 41 | if (status == Thread::Status::EXIT) goto exit_thread; 42 | SDL_SemWait(td->sem); 43 | status = SDL_AtomicGet(&td->status); 44 | } 45 | } 46 | exit_thread: 47 | SDL_DestroySemaphore(td->sem); 48 | return 0; 49 | }, "Parallel", &thread->threadData); 50 | SDL_DetachThread(thread->thread); 51 | ++threadCreated; 52 | } 53 | 54 | ThreadPool::~ThreadPool() { 55 | sync(); 56 | for (int i = 0; i < threadCreated; ++i) { 57 | SDL_AtomicSet(&threads[i].threadData.status, Thread::Status::EXIT); 58 | SDL_SemPost(threads[i].threadData.sem); 59 | } 60 | } 61 | 62 | ThreadPool::Thread* ThreadPool::newThread(void(*func)(void *body), void* threadData) { 63 | assert(threadNum < thread_num); 64 | Thread *thread = &threads[threadNum]; 65 | Thread::ThreadData &td = thread->threadData; 66 | td.body = func; 67 | td.data = threadData; 68 | SDL_AtomicSet(&td.status, Thread::Status::RUNNING); 69 | if (threadNum + 1 > threadCreated) createThread(); 70 | else SDL_SemPost(td.sem); 71 | ++threadNum; 72 | return thread; 73 | } 74 | 75 | void ThreadPool::sync() { 76 | for (int i = threadNum - 1; i >= 0; --i) { 77 | while (SDL_AtomicGet(&threads[i].threadData.status) != Thread::Status::IDLE) SDL_Delay(0); 78 | --threadNum; 79 | } 80 | } 81 | } 82 | #endif 83 | -------------------------------------------------------------------------------- /src/onsyuri/README.md: -------------------------------------------------------------------------------- 1 | ONScripter-Jh 2 | ============= 3 | 4 | Migrate from Bitbucket to Github 5 | 6 | Original repo: ~~https://bitbucket.org/jh10001/onscripter-jh/~~ -------------------------------------------------------------------------------- /src/onsyuri/README.old: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuriSizuku/OnscripterYuri/ff12c7eaef2560a77a1f90fc796f63970216f42d/src/onsyuri/README.old -------------------------------------------------------------------------------- /src/onsyuri/SarReader.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * SarReader.h - Reader from a SAR archive 4 | * 5 | * Copyright (c) 2001-2014 Ogapee. All rights reserved. 6 | * 7 | * ogapee@aqua.dti2.ne.jp 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | */ 23 | 24 | #ifndef __SAR_READER_H__ 25 | #define __SAR_READER_H__ 26 | 27 | #include "DirectReader.h" 28 | 29 | class SarReader : public DirectReader 30 | { 31 | public: 32 | SarReader( const char *path=NULL, const unsigned char *key_table=NULL ); 33 | ~SarReader(); 34 | 35 | int open( const char *name=NULL ); 36 | int close(); 37 | const char *getArchiveName() const; 38 | int getNumFiles(); 39 | 40 | size_t getFileLength( const char *file_name ); 41 | size_t getFile( const char *file_name, unsigned char *buf, int *location=NULL ); 42 | FileInfo getFileByIndex( unsigned int index ); 43 | 44 | int writeHeader( FILE *fp ); 45 | size_t putFile( FILE *fp, int no, size_t offset, size_t length, size_t original_length, bool modified_flag, unsigned char *buffer ); 46 | 47 | protected: 48 | ArchiveInfo archive_info; 49 | ArchiveInfo *root_archive_info, *last_archive_info; 50 | int num_of_sar_archives; 51 | 52 | void readArchive( ArchiveInfo *ai, int archive_type = ARCHIVE_TYPE_SAR, unsigned int offset=0 ); 53 | int readArchiveSub( ArchiveInfo *ai, int archive_type = ARCHIVE_TYPE_SAR, bool check_size = true ); 54 | int getIndexFromFile( ArchiveInfo *ai, const char *file_name ); 55 | size_t getFileSub( ArchiveInfo *ai, const char *file_name, unsigned char *buf ); 56 | 57 | int writeHeaderSub( ArchiveInfo *ai, FILE *fp, int archive_type = ARCHIVE_TYPE_SAR, int nsa_offset=0 ); 58 | size_t putFileSub( ArchiveInfo *ai, FILE *fp, int no, size_t offset, size_t length, size_t original_length, int compression_type, bool modified_flag, unsigned char *buffer ); 59 | }; 60 | 61 | #endif // __SAR_READER_H__ 62 | -------------------------------------------------------------------------------- /src/onsyuri/coding2utf16.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * coding2utf16.cpp 4 | * 5 | * Copyright (C) 2014 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | #include "coding2utf16.h" 23 | 24 | 25 | char Coding2UTF16::space[4] = " "; 26 | char Coding2UTF16::minus[4] = "-"; 27 | char Coding2UTF16::bracket[8] = "【】"; 28 | char Coding2UTF16::num_str[24] = "0123456789"; 29 | char Coding2UTF16::DEFAULT_START_KINSOKU[40] = "」』)]}、。,.。?!ー" ; 30 | char Coding2UTF16::DEFAULT_END_KINSOKU[12] = "「『("; 31 | char Coding2UTF16::DEFAULT_SAVE_MENU_NAME[12] = "<save>"; 32 | char Coding2UTF16::DEFAULT_LOAD_MENU_NAME[12] = "<load>"; 33 | char Coding2UTF16::DEFAULT_SAVE_ITEM_NAME[8] = "data"; 34 | char Coding2UTF16::MESSAGE_SAVE_EXIST[24] = "%s%s %s/%s—%s:%s"; 35 | char Coding2UTF16::MESSAGE_SAVE_EMPTY[32] = "%s%s ————————"; 36 | char Coding2UTF16::MESSAGE_SAVE_CONFIRM[40] = "`Save slot %s%s?"; 37 | char Coding2UTF16::MESSAGE_LOAD_CONFIRM[40] = "`Load slot %s%s?"; 38 | char Coding2UTF16::MESSAGE_RESET_CONFIRM[36] = "`Return Title?"; 39 | char Coding2UTF16::MESSAGE_END_CONFIRM[32] = "`Exit Game?"; 40 | char Coding2UTF16::MESSAGE_YES[8] = "Yes"; 41 | char Coding2UTF16::MESSAGE_NO[8] = "No"; 42 | char Coding2UTF16::MESSAGE_OK[8] = "OK"; 43 | char Coding2UTF16::MESSAGE_CANCEL[12] = "Cancel"; 44 | 45 | int Coding2UTF16::convUTF16ToUTF8(unsigned char dst[4], uint16_t src) const { 46 | if (src & 0xff80) { 47 | if (src & 0xf800) { 48 | // UCS-2 = U+0800 - U+FFFF -> UTF-8 (3 bytes) 49 | dst[0] = 0xe0 | (src >> 12); 50 | dst[1] = 0x80 | ((src >> 6) & 0x3f); 51 | dst[2] = 0x80 | (src & 0x3f); 52 | dst[3] = 0; 53 | 54 | return 3; 55 | } 56 | 57 | // UCS-2 = U+0080 - U+07FF -> UTF-8 (2 bytes) 58 | dst[0] = 0xc0 | (src >> 6); 59 | dst[1] = 0x80 | (src & 0x3f); 60 | dst[2] = 0; 61 | 62 | return 2; 63 | } 64 | 65 | // UCS-2 = U+0000 - U+007F -> UTF-8 (1 byte) 66 | dst[0] = src; 67 | dst[1] = 0; 68 | 69 | return 1; 70 | } 71 | 72 | unsigned short Coding2UTF16::convUTF8ToUTF16(const char **src) { 73 | unsigned short utf16=0; 74 | 75 | if (**src & 0x80) { 76 | if (**src & 0x20) { 77 | utf16 |= ((unsigned short)((*(*src)++)&0x0f)) << 12; 78 | utf16 |= ((unsigned short)((*(*src)++)&0x3f)) << 6; 79 | utf16 |= ((unsigned short)((*(*src)++)&0x3f)); 80 | } else { 81 | utf16 |= ((unsigned short)((*(*src)++)&0x1f)) << 6; 82 | utf16 |= (unsigned short)((*(*src)++)&0x3f); 83 | } 84 | } else { 85 | utf16 |= (unsigned short)(*(*src)++); 86 | } 87 | 88 | return utf16; 89 | } 90 | -------------------------------------------------------------------------------- /src/onsyuri/coding2utf16.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * coding2utf16.h 4 | * 5 | * Copyright (C) 2014-2015 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | #ifndef __CODING2UTF16_H__ 23 | #define __CODING2UTF16_H__ 24 | 25 | #include 26 | 27 | class Coding2UTF16{ 28 | public: 29 | bool force_utf8=false; 30 | static char space[4]; 31 | static char minus[4]; 32 | static char bracket[8]; 33 | static char num_str[24]; 34 | static char DEFAULT_START_KINSOKU[40]; 35 | static char DEFAULT_END_KINSOKU[12]; 36 | static char DEFAULT_SAVE_MENU_NAME[12]; 37 | static char DEFAULT_LOAD_MENU_NAME[12]; 38 | static char DEFAULT_SAVE_ITEM_NAME[8]; 39 | static char MESSAGE_SAVE_EXIST[24]; 40 | static char MESSAGE_SAVE_EMPTY[32]; 41 | static char MESSAGE_SAVE_CONFIRM[40]; 42 | static char MESSAGE_LOAD_CONFIRM[40]; 43 | static char MESSAGE_RESET_CONFIRM[36]; 44 | static char MESSAGE_END_CONFIRM[32]; 45 | static char MESSAGE_YES[8]; 46 | static char MESSAGE_NO[8]; 47 | static char MESSAGE_OK[8]; 48 | static char MESSAGE_CANCEL[12]; 49 | virtual void init() = 0; 50 | virtual uint16_t conv2UTF16(uint16_t) const = 0; 51 | virtual uint16_t convUTF162Coding(uint16_t) const = 0; 52 | int convUTF16ToUTF8(unsigned char*,uint16_t) const; 53 | unsigned short convUTF8ToUTF16(const char**); 54 | virtual ~Coding2UTF16() {}; 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/onsyuri/gbk2utf16.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuriSizuku/OnscripterYuri/ff12c7eaef2560a77a1f90fc796f63970216f42d/src/onsyuri/gbk2utf16.cpp -------------------------------------------------------------------------------- /src/onsyuri/gbk2utf16.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * gbk2utf16.h 4 | * 5 | * Copyright (c) 2014 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | #ifndef __GBK2UTF16_H__ 23 | #define __GBK2UTF16_H__ 24 | 25 | #include "coding2utf16.h" 26 | 27 | class GBK2UTF16 : public Coding2UTF16 { 28 | public: 29 | void init() final; 30 | uint16_t conv2UTF16(uint16_t) const final; 31 | uint16_t convUTF162Coding(uint16_t) const final; 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/onsyuri/renderer/gles_renderer.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * gles_renderer.h 4 | * 5 | * Copyright (C) 2022 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #pragma once 22 | #if defined(USE_GLES) 23 | 24 | #if defined(ANDROID) 25 | #include "SDL.h" 26 | #include 27 | #include 28 | #include 29 | #else 30 | #include 31 | #define SDL_USE_BUILTIN_OPENGL_DEFINITIONS 32 | #include 33 | #endif 34 | 35 | 36 | class GlesRenderer { 37 | SDL_Window *window; 38 | SDL_Texture *texture; 39 | SDL_GLContext context; 40 | GLuint vert_shader; 41 | GLuint frag_shader; 42 | GLuint post_program; 43 | GLuint vertex_buffer; 44 | GLfloat vertex_data[8]; 45 | GLfloat cas_con[4*2]; 46 | GLint const_buffer_location[3]; 47 | int output_size[2]; 48 | bool _pause = false; 49 | 50 | #if !(defined(IOS) || defined(ANDROID)) 51 | // dynamic binding at class initialize 52 | // #define SDL_PROC(ret,func,params) ret (APIENTRY *func) params; 53 | #define SDL_PROC(ret,func,params) \ 54 | ret (APIENTRY *func) params = (ret (APIENTRY *) params) SDL_GL_GetProcAddress(#func); 55 | #include "gles2funcs.h" 56 | #undef SDL_PROC 57 | #endif 58 | 59 | GLuint createShader(GLenum shader_type, const GLchar* shader_src); 60 | void initVertexData(); 61 | public: 62 | GlesRenderer(SDL_Window *window, SDL_Texture *texture, const float input_size[2], const float output_size[2], float sharpness); 63 | ~GlesRenderer(); 64 | 65 | void copy(const int window_x, const int window_y); 66 | void setConstBuffer(const float input_size[2], const float output_size[2], float sharpness); 67 | void pause(); 68 | void resume(); 69 | }; 70 | #endif 71 | -------------------------------------------------------------------------------- /src/onsyuri/resize_image.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * resize_image.h - resize image using smoothing and resampling 4 | * 5 | * Copyright (c) 2001-2004 Ogapee. All rights reserved. 6 | * 7 | * ogapee@aqua.dti2.ne.jp 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | */ 23 | 24 | void resizeImage( unsigned char *dst_buffer, int dst_width, int dst_height, int dst_total_width, 25 | unsigned char *src_buffer, int src_width, int src_height, int src_total_width, 26 | int byte_per_pixel, unsigned char *tmp_buffer, int tmp_total_width, bool palette_flag ); 27 | -------------------------------------------------------------------------------- /src/onsyuri/simd/int16x16.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * int16x16.h 4 | * 5 | * Copyright (C) 2018-2019 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #pragma once 22 | 23 | #ifndef __SIMD_H__ 24 | #error "This file must be included through simd.h" 25 | #endif 26 | #include 27 | 28 | namespace simd { 29 | class uint8x32; 30 | class uint16x8; 31 | class uint16x16 { 32 | #ifdef USE_SIMD_X86_AVX2 33 | __m256i v_; 34 | #endif 35 | public: 36 | uint16x16() = default; 37 | uint16x16(const uint16x16&) = default; 38 | uint16x16 &operator=(const uint16x16&) = default; 39 | #ifdef USE_SIMD_X86_AVX2 40 | uint16x16(__m256i v) : v_(v) {}; 41 | operator __m256i() const { return v_; } 42 | uint16x16(uint16_t rm) { v_ = _mm256_set1_epi16(rm); } 43 | static uint16x16 set4(uint16_t m1, uint16_t m2, uint16_t m3, uint16_t m4) { 44 | return _mm256_set_epi16(m4, m4, m4, m4, m3, m3, m3, m3, m2, m2, m2, m2, m1, m1, m1, m1); 45 | } 46 | uint16x8 lo() { return _mm256_castsi256_si128(v_); } 47 | #endif 48 | }; 49 | 50 | //Arithmetic 51 | static uint16x16 operator-(uint16x16 a, uint16x16 b); 52 | 53 | static uint16x16 operator-=(uint16x16 &a, uint16x16 b); 54 | 55 | static uint16x16 operator*(uint16x16 a, uint16x16 b); 56 | 57 | static uint16x16 operator*=(uint16x16 &a, uint16x16 b); 58 | 59 | //Miscellaneous 60 | static uint8x32 pack_hz(uint16x16 a, uint16x16 b); 61 | 62 | //Set 63 | static void setzero(uint16x16 &a); 64 | 65 | //Shift 66 | static uint16x16 operator>>(uint16x16 a, immint<8> imm8); 67 | 68 | static uint16x16 operator>>=(uint16x16 &a, immint<8> imm8); 69 | } 70 | -------------------------------------------------------------------------------- /src/onsyuri/simd/int16x16.inl: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * int16x16.inl 4 | * 5 | * Copyright (C) 2018 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #ifndef __SIMD_H__ 22 | #error "This file must be included through simd.h" 23 | #endif 24 | 25 | namespace simd { 26 | //Arithmetic 27 | inline uint16x16 operator-(uint16x16 a, uint16x16 b) { 28 | #ifdef USE_SIMD_X86_AVX2 29 | return _mm256_sub_epi16(a, b); 30 | #endif 31 | } 32 | 33 | inline uint16x16 operator-=(uint16x16 &a, uint16x16 b) { 34 | return a = a - b; 35 | } 36 | 37 | inline uint16x16 operator*(uint16x16 a, uint16x16 b) { 38 | #ifdef USE_SIMD_X86_AVX2 39 | return _mm256_mullo_epi16(a, b); 40 | #endif 41 | } 42 | 43 | inline uint16x16 operator*=(uint16x16 &a, uint16x16 b) { 44 | return a = a * b; 45 | } 46 | 47 | //Miscellaneous 48 | inline uint8x32 pack_hz(uint16x16 a, uint16x16 b) { 49 | #ifdef USE_SIMD_X86_AVX2 50 | return _mm256_packus_epi16(a, b); 51 | #endif 52 | } 53 | 54 | //Set 55 | inline void setzero(uint16x16 &a) { 56 | #ifdef USE_SIMD_X86_AVX2 57 | a = _mm256_setzero_si256(); 58 | #endif 59 | } 60 | 61 | //Shift 62 | template 63 | inline uint16x16 shiftr(uint16x16 a) { 64 | #ifdef USE_SIMD_X86_AVX2 65 | return _mm256_srli_epi16(a, imm8); 66 | #endif 67 | } 68 | 69 | inline uint16x16 operator>>(uint16x16 a, immint<8> imm8) { return shiftr<8>(a); } 70 | inline uint16x16 operator>>=(uint16x16 &a, immint<8> imm8) { return a = a >> imm8; } 71 | } -------------------------------------------------------------------------------- /src/onsyuri/simd/int16x4.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * int16x4.h 4 | * 5 | * Copyright (C) 2015 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #pragma once 22 | 23 | #ifndef __SIMD_H__ 24 | #error "This file must be included through simd.h" 25 | #endif 26 | 27 | namespace simd { 28 | class uint16x4 { 29 | #ifdef USE_SIMD_X86_SSE2 30 | __m128i v_; 31 | #elif USE_SIMD_ARM_NEON 32 | uint16x4_t v_; 33 | #endif 34 | public: 35 | uint16x4() = default; 36 | uint16x4(const uint16x4&) = default; 37 | uint16x4 &operator=(const uint16x4&) = default; 38 | #ifdef USE_SIMD_X86_SSE2 39 | uint16x4(__m128i v) : v_(v) {}; 40 | operator __m128i() const { return v_; } 41 | uint16x4(uint16_t rm) { v_ = _mm_shufflelo_epi16(_mm_cvtsi32_si128(rm), 0); /*MOVD r32, xmm, PSHUFLW xmm1, xmm2, imm*/ } 42 | #elif USE_SIMD_ARM_NEON 43 | uint16x4(uint16x4_t v) : v_(v) {}; 44 | operator uint16x4_t() const { return v_; } 45 | uint16x4(uint16_t rm) { v_ = vdup_n_u16(rm); } 46 | #endif 47 | }; 48 | 49 | //Arithmetic 50 | static uint16x4 operator+(uint16x4 a, uint16x4 b); 51 | 52 | static uint16x4 operator+=(uint16x4 &a, uint16x4 b); 53 | 54 | static uint16x4 operator-(uint16x4 a, uint16x4 b); 55 | 56 | static uint16x4 operator-=(uint16x4 &a, uint16x4 b); 57 | 58 | static uint16x4 operator*(uint16x4 a, uint16x4 b); 59 | 60 | static uint16x4 operator*=(uint16x4 &a, uint16x4 b); 61 | 62 | //Miscellaneous 63 | static uint8x4 narrow_hz(uint16x4 a); 64 | 65 | //Shift 66 | static uint16x4 operator>>(uint16x4 a, immint<8> imm8); 67 | 68 | static uint16x4 operator>>=(uint16x4 &a, immint<8> imm8); 69 | } -------------------------------------------------------------------------------- /src/onsyuri/simd/int16x4.inl: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * int16x4.inl 4 | * 5 | * Copyright (C) 2015 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #ifndef __SIMD_H__ 22 | #error "This file must be included through simd.h" 23 | #endif 24 | #include 25 | #include "int8x16.h" 26 | 27 | namespace simd{ 28 | //Arithmetic 29 | inline uint16x4 operator+(uint16x4 a, uint16x4 b) { 30 | #ifdef USE_SIMD_X86_SSE2 31 | return _mm_add_epi16(a, b); //PADDW xmm1, xmm2 32 | #elif USE_SIMD_ARM_NEON 33 | return vadd_u16(a, b); 34 | #endif 35 | } 36 | 37 | inline uint16x4 operator+=(uint16x4 &a, uint16x4 b) { 38 | return a = a + b; 39 | } 40 | 41 | inline uint16x4 operator-(uint16x4 a, uint16x4 b) { 42 | #ifdef USE_SIMD_X86_SSE2 43 | return _mm_sub_epi16(a, b); //PSUBW xmm1, xmm2 44 | #elif USE_SIMD_ARM_NEON 45 | return vsub_u16(a, b); 46 | #endif 47 | } 48 | 49 | inline uint16x4 operator-=(uint16x4 &a, uint16x4 b) { 50 | return a = a - b; 51 | } 52 | 53 | inline uint16x4 operator*(uint16x4 a, uint16x4 b) { 54 | #ifdef USE_SIMD_X86_SSE2 55 | return _mm_mullo_epi16(a, b); //PMULLW xmm1, xmm2 56 | #elif USE_SIMD_ARM_NEON 57 | return vmul_u16(a, b); 58 | #endif 59 | } 60 | 61 | inline uint16x4 operator*=(uint16x4 &a, uint16x4 b) { 62 | return a = a * b; 63 | } 64 | 65 | //Miscellaneous 66 | inline uint8x4 narrow_hz(uint16x4 a) { 67 | #ifdef USE_SIMD_X86_SSE2 68 | return _mm_packus_epi16(a, a); 69 | #elif USE_SIMD_ARM_NEON 70 | uint8x8_t t = vreinterpret_u8_u16(static_cast(a)); 71 | return vuzp_u8(t, t).val[0]; 72 | #endif 73 | } 74 | 75 | //Shift 76 | template 77 | inline uint16x4 shiftr(uint16x4 a) { 78 | #ifdef USE_SIMD_X86_SSE2 79 | return _mm_srli_epi16(a, imm8); //PSRLW xmm1, imm 80 | #elif USE_SIMD_ARM_NEON 81 | return vshr_n_u16(a, imm8); 82 | #endif 83 | } 84 | 85 | inline uint16x4 operator>>(uint16x4 a, immint<8> imm8) { return shiftr<8>(a); } 86 | inline uint16x4 operator>>=(uint16x4 &a, immint<8> imm8) { return a = a >> imm8; } 87 | } -------------------------------------------------------------------------------- /src/onsyuri/simd/int16x8.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * int16x8.h 4 | * 5 | * Copyright (C) 2015 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #pragma once 22 | 23 | #ifndef __SIMD_H__ 24 | #error "This file must be included through simd.h" 25 | #endif 26 | #include 27 | 28 | namespace simd { 29 | class uint8x16; 30 | class uint16x4; 31 | class uint16x8 { 32 | #ifdef USE_SIMD_X86_SSE2 33 | __m128i v_; 34 | #elif USE_SIMD_ARM_NEON 35 | uint16x8_t v_; 36 | #endif 37 | public: 38 | uint16x8() = default; 39 | uint16x8(const uint16x8&) = default; 40 | uint16x8 &operator=(const uint16x8&) = default; 41 | #ifdef USE_SIMD_X86_SSE2 42 | uint16x8(__m128i v) : v_(v) {}; 43 | operator __m128i() const { return v_; } 44 | uint16x8(uint16_t rm) { v_ = _mm_set1_epi16(rm); } 45 | uint16x4 lo() { return v_; } 46 | #elif USE_SIMD_ARM_NEON 47 | uint16x8(uint16x8_t v) : v_(v) {}; 48 | operator uint16x8_t() const { return v_; } 49 | uint16x8(uint16_t rm) { v_ = vdupq_n_u16(rm); } 50 | uint16x4 lo() { return vget_low_u16(v_); } 51 | #endif 52 | //Swizzle 53 | static uint16x8 set2(uint16_t rm1, uint16_t rm2) { 54 | #ifdef USE_SIMD_X86_SSE2 55 | uint16x8 r; 56 | r = _mm_cvtsi32_si128(rm1); // MOVD r32, xmm 57 | r = _mm_shufflelo_epi16(r, 0); //PSHUFLW xmm1, xmm2, imm 58 | r = _mm_insert_epi16(r, rm2, 4); //PINSRW xmm, r32, imm 59 | r = _mm_shufflehi_epi16(r, 0); //PSUFHW xmm1, xmm2, imm 60 | return r; 61 | #elif USE_SIMD_ARM_NEON 62 | uint16x4_t rl = vdup_n_u16(rm1), rr = vdup_n_u16(rm2); 63 | return vcombine_u16(rl, rr); 64 | #endif 65 | }; 66 | }; 67 | 68 | //Arithmetic 69 | static uint16x8 operator-(uint16x8 a, uint16x8 b); 70 | 71 | static uint16x8 operator-=(uint16x8 &a, uint16x8 b); 72 | 73 | static uint16x8 operator*(uint16x8 a, uint16x8 b); 74 | 75 | static uint16x8 operator*=(uint16x8 &a, uint16x8 b); 76 | 77 | //Miscellaneous 78 | static uint8x16 pack_hz(uint16x8 a, uint16x8 b); 79 | 80 | //Set 81 | static void setzero(uint16x8 &a); 82 | 83 | //Shift 84 | static uint16x8 operator>>(uint16x8 a, immint<8> imm8); 85 | 86 | static uint16x8 operator>>=(uint16x8 &a, immint<8> imm8); 87 | } 88 | -------------------------------------------------------------------------------- /src/onsyuri/simd/int16x8.inl: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * int16x8.inl 4 | * 5 | * Copyright (C) 2015 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #ifndef __SIMD_H__ 22 | #error "This file must be included through simd.h" 23 | #endif 24 | 25 | namespace simd { 26 | //Arithmetic 27 | inline uint16x8 operator-(uint16x8 a, uint16x8 b) { 28 | #ifdef USE_SIMD_X86_SSE2 29 | return _mm_sub_epi16(a, b); //PSUBW xmm1, xmm2 30 | #elif USE_SIMD_ARM_NEON 31 | return vsubq_u16(a, b); 32 | #endif 33 | } 34 | 35 | inline uint16x8 operator-=(uint16x8 &a, uint16x8 b) { 36 | return a = a - b; 37 | } 38 | 39 | inline uint16x8 operator*(uint16x8 a, uint16x8 b) { 40 | #ifdef USE_SIMD_X86_SSE2 41 | return _mm_mullo_epi16(a, b); //PMULLW xmm1, xmm2 42 | #elif USE_SIMD_ARM_NEON 43 | return vmulq_u16(a, b); 44 | #endif 45 | } 46 | 47 | inline uint16x8 operator*=(uint16x8 &a, uint16x8 b) { 48 | return a = a * b; 49 | } 50 | 51 | //Miscellaneous 52 | inline uint8x16 pack_hz(uint16x8 a, uint16x8 b) { 53 | #ifdef USE_SIMD_X86_SSE2 54 | return _mm_packus_epi16(a, b); 55 | #elif USE_SIMD_ARM_NEON 56 | #ifdef _MSC_VER 57 | return *reinterpret_cast(&vuzpq_u8(*reinterpret_cast(&static_cast(a)), *reinterpret_cast(&static_cast(b)))); 58 | #else 59 | return vuzpq_u8(reinterpret_cast(static_cast(a)), reinterpret_cast(static_cast(b))).val[0]; 60 | #endif 61 | #endif 62 | } 63 | 64 | //Set 65 | inline void setzero(uint16x8 &a) { 66 | #ifdef USE_SIMD_X86_SSE2 67 | a = _mm_setzero_si128(); //PXOR xmm, xmm 68 | #elif USE_SIMD_ARM_NEON 69 | a = veorq_u16(a, a); 70 | #endif 71 | } 72 | 73 | //Shift 74 | template 75 | inline uint16x8 shiftr(uint16x8 a) { 76 | #ifdef USE_SIMD_X86_SSE2 77 | return _mm_srli_epi16(a, imm8); //PSRLW xmm1, imm 78 | #elif USE_SIMD_ARM_NEON 79 | return vshrq_n_u16(a, imm8); 80 | #endif 81 | } 82 | 83 | inline uint16x8 operator>>(uint16x8 a, immint<8> imm8) { return shiftr<8>(a); } 84 | inline uint16x8 operator>>=(uint16x8 &a, immint<8> imm8) { return a = a >> imm8; } 85 | } -------------------------------------------------------------------------------- /src/onsyuri/simd/int32x2.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * int32x2.h 4 | * 5 | * Copyright (C) 2015 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #pragma once 22 | 23 | #ifndef __SIMD_H__ 24 | #error "This file must be included through simd.h" 25 | #endif 26 | #include 27 | 28 | namespace simd { 29 | class uint32x2 { 30 | #ifdef USE_SIMD_X86_SSE2 31 | __m128i v_; 32 | #elif USE_SIMD_ARM_NEON 33 | uint32x2_t v_; 34 | #endif 35 | public: 36 | uint32x2() = default; 37 | uint32x2(const uint32x2&) = default; 38 | uint32x2 &operator=(const uint32x2&) = default; 39 | #ifdef USE_SIMD_X86_SSE2 40 | uint32x2(__m128i v) : v_(v) {}; 41 | operator __m128i() const { return v_; } 42 | uint32x2(uint32_t rm) { v_ = _mm_set1_epi32(rm); } 43 | static uint32x2 cvt2vec(uint32_t rm) { return _mm_cvtsi32_si128(rm); /* MOVD xmm, r32 */ } 44 | static uint32_t cvt2i32(uint32x2 a) { return _mm_cvtsi128_si32(a); /* MOVD r32, xmm */ } 45 | __m128i cvt2vu8() const { return v_; } 46 | #elif USE_SIMD_ARM_NEON 47 | uint32x2(uint32x2_t v) : v_(v) {}; 48 | operator uint32x2_t() const { return v_; } 49 | uint32x2(uint32_t rm) { v_ = vdup_n_u32(rm); } 50 | static uint32x2 cvt2vec(uint32_t rm) { 51 | uint32x2 r; 52 | r = vset_lane_u32(rm, r, 0); 53 | return r; 54 | } 55 | static uint32_t cvt2i32(uint32x2 a) { return vget_lane_u32(a, 0); } 56 | uint8x8_t cvt2vu8() const { return vreinterpret_u8_u32(v_); } 57 | #endif 58 | }; 59 | } 60 | -------------------------------------------------------------------------------- /src/onsyuri/simd/int32x2.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuriSizuku/OnscripterYuri/ff12c7eaef2560a77a1f90fc796f63970216f42d/src/onsyuri/simd/int32x2.inl -------------------------------------------------------------------------------- /src/onsyuri/simd/int32x4.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * int32x4.h 4 | * 5 | * Copyright (C) 2015 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #pragma once 22 | 23 | #ifndef __SIMD_H__ 24 | #error "This file must be included through simd.h" 25 | #endif 26 | #include 27 | 28 | namespace simd { 29 | class uint32x4 { 30 | #ifdef USE_SIMD_X86_SSE2 31 | __m128i v_; 32 | #elif USE_SIMD_ARM_NEON 33 | uint32x4_t v_; 34 | #endif 35 | public: 36 | uint32x4() = default; 37 | uint32x4(const uint32x4&) = default; 38 | uint32x4 &operator=(const uint32x4&) = default; 39 | #ifdef USE_SIMD_X86_SSE2 40 | uint32x4(__m128i v) : v_(v) {} 41 | operator __m128i() const { return v_; } 42 | uint32x4(uint32_t rm) : v_(_mm_set1_epi32(rm)) {} 43 | static uint32x4 cvt2vec(uint32_t rm) { return _mm_cvtsi32_si128(rm); /* MOVD xmm, r32 */ } 44 | static uint32_t cvt2i32(uint32x4 a) { return _mm_cvtsi128_si32(a); /* MOVD r32, xmm */ } 45 | #elif USE_SIMD_ARM_NEON 46 | uint32x4(uint32x4_t v) : v_(v) {}; 47 | operator uint32x4_t() const { return v_; } 48 | uint32x4(uint32_t rm) { v_ = vdupq_n_u32(rm); } 49 | static uint32x4 cvt2vec(uint32_t rm) { 50 | uint32x4 r; 51 | r = vsetq_lane_u32(rm, r, 0); 52 | return r; 53 | } 54 | static uint32_t cvt2i32(uint32x4 a) { return vgetq_lane_u32(a, 0); } 55 | #endif 56 | }; 57 | 58 | //Logical 59 | static uint32x4 operator|(uint32x4 a, uint32x4 b); 60 | 61 | static uint32x4 operator|=(uint32x4 &a, uint32x4 b); 62 | } 63 | -------------------------------------------------------------------------------- /src/onsyuri/simd/int32x4.inl: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * int32x4.inl 4 | * 5 | * Copyright (C) 2015 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #ifndef __SIMD_H__ 22 | #error "This file must be included through simd.h" 23 | #endif 24 | 25 | namespace simd { 26 | //Logical 27 | inline uint32x4 operator|(uint32x4 a, uint32x4 b) { 28 | #ifdef USE_SIMD_X86_SSE2 29 | return _mm_or_si128(a, b); //POR xmm1, xmm2 30 | #elif USE_SIMD_ARM_NEON 31 | return vorrq_u32(a, b); 32 | #endif 33 | } 34 | 35 | inline uint32x4 operator|=(uint32x4 &a, uint32x4 b) { 36 | return a = a | b; 37 | } 38 | } -------------------------------------------------------------------------------- /src/onsyuri/simd/int8x32.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * int8x32.h 4 | * 5 | * Copyright (C) 2018-2019 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #pragma once 22 | 23 | #ifndef __SIMD_H__ 24 | #error "This file must be included through simd.h" 25 | #endif 26 | 27 | namespace simd { 28 | class uint8x32 { 29 | #ifdef USE_SIMD_X86_AVX2 30 | __m256i v_; 31 | #endif 32 | public: 33 | uint8x32() = default; 34 | uint8x32(const uint8x32&) = default; 35 | uint8x32 &operator=(const uint8x32&) = default; 36 | #ifdef USE_SIMD_X86_AVX2 37 | uint8x32(__m256i v) : v_(v) {}; 38 | operator __m256i() const { return v_; } 39 | uint8x16 lo() { return _mm256_castsi256_si128(v_); } 40 | #endif 41 | 42 | static uint8x32 set(uint8_t rm1, uint8_t rm2, uint8_t rm3, uint8_t rm4) { 43 | #ifdef USE_SIMD_X86_AVX2 44 | return _mm256_set_epi8(rm4, rm3, rm2, rm1, rm4, rm3, rm2, rm1, rm4, rm3, rm2, rm1, rm4, rm3, rm2, rm1, 45 | rm4, rm3, rm2, rm1, rm4, rm3, rm2, rm1, rm4, rm3, rm2, rm1, rm4, rm3, rm2, rm1); 46 | #endif 47 | } 48 | 49 | static uint8x32 set8(uint8_t m1, uint8_t m2, uint8_t m3, uint8_t m4, uint8_t m5, uint8_t m6, uint8_t m7, uint8_t m8) { 50 | #ifdef USE_SIMD_X86_AVX2 51 | return _mm256_set_epi8(m8, m8, m8, m8, m7, m7, m7, m7, m6, m6, m6, m6, m5, m5, m5, m5, 52 | m4, m4, m4, m4, m3, m3, m3, m3, m2, m2, m2, m2, m1, m1, m1, m1); 53 | #endif 54 | } 55 | }; 56 | 57 | //Arithmetic 58 | static uint8x32 operator+(uint8x32 a, uint8x32 b); 59 | 60 | static uint8x32 operator+=(uint8x32 &a, uint8x32 b); 61 | 62 | static uint8x32 adds(uint8x32 a, uint8x32 b); 63 | 64 | //Logical 65 | static uint8x32 operator|(uint8x32 a, uint8x32 b); 66 | 67 | static uint8x32 operator|=(uint8x32 &a, uint8x32 b); 68 | 69 | //Set 70 | static void setzero(uint8x32 &a); 71 | 72 | //Shuffle 73 | static uint8x32 shuffle(uint8x32 a, uint8x32 mask); 74 | 75 | //Swizzle 76 | class uint16x16; 77 | static uint16x16 widen_hi(uint8x32 a, uint8x32 b); 78 | 79 | static uint16x16 widen_lo(uint8x32 a, uint8x32 b); 80 | } -------------------------------------------------------------------------------- /src/onsyuri/simd/int8x32.inl: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * int8x32.inl 4 | * 5 | * Copyright (C) 2018-2019 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #ifndef __SIMD_H__ 22 | #error "This file must be included through simd.h" 23 | #endif 24 | #include "int16x16.h" 25 | 26 | namespace simd { 27 | //Arithmetic 28 | inline uint8x32 operator+(uint8x32 a, uint8x32 b){ 29 | #ifdef USE_SIMD_X86_AVX2 30 | return _mm256_add_epi8(a, b); //PADDB xmm1, xmm2 31 | #endif 32 | } 33 | 34 | inline uint8x32 operator+=(uint8x32 &a, uint8x32 b){ 35 | return a = a + b; 36 | } 37 | 38 | inline uint8x32 adds(uint8x32 a, uint8x32 b) { 39 | #ifdef USE_SIMD_X86_AVX2 40 | return _mm256_adds_epu8(a, b); //PADDUSB xmm1, xmm2 41 | #endif 42 | } 43 | 44 | //Logical 45 | inline uint8x32 operator|(uint8x32 a, uint8x32 b) { 46 | #ifdef USE_SIMD_X86_AVX2 47 | return _mm256_or_si256(a, b); //POR xmm1, xmm2 48 | #endif 49 | } 50 | 51 | inline uint8x32 operator|=(uint8x32 &a, uint8x32 b) { 52 | return a = a | b; 53 | } 54 | 55 | //Set 56 | inline void setzero(uint8x32 &a) { 57 | #ifdef USE_SIMD_X86_AVX2 58 | a = _mm256_setzero_si256(); //PXOR xmm, xmm 59 | #endif 60 | } 61 | 62 | //Shuffle 63 | inline uint8x32 shuffle(uint8x32 a, uint8x32 mask) { 64 | #ifdef USE_SIMD_X86_AVX2 65 | return _mm256_shuffle_epi8(a, mask); 66 | #endif 67 | } 68 | 69 | //Swizzle 70 | inline uint16x16 widen_hi(uint8x32 a, uint8x32 b) { 71 | #ifdef USE_SIMD_X86_AVX2 72 | return _mm256_unpackhi_epi8(a, b); 73 | #endif 74 | } 75 | 76 | inline uint16x16 widen_lo(uint8x32 a, uint8x32 b) { 77 | #ifdef USE_SIMD_X86_AVX2 78 | return _mm256_unpacklo_epi8(a, b); 79 | #endif 80 | } 81 | } -------------------------------------------------------------------------------- /src/onsyuri/simd/int8x4.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * int8x4.h 4 | * 5 | * Copyright (C) 2015 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #pragma once 22 | 23 | #ifndef __SIMD_H__ 24 | #error "This file must be included through simd.h" 25 | #endif 26 | #include 27 | 28 | namespace simd { 29 | class uint8x4 { 30 | #ifdef USE_SIMD_X86_SSE2 31 | __m128i v_; 32 | #elif USE_SIMD_ARM_NEON 33 | uint8x8_t v_; 34 | #endif 35 | public: 36 | uint8x4() = default; 37 | uint8x4(const uint8x4&) = default; 38 | uint8x4 &operator=(const uint8x4&) = default; 39 | #ifdef USE_SIMD_X86_SSE2 40 | uint8x4(__m128i v) : v_(v) {}; 41 | operator __m128i() const { return v_; } 42 | static uint8x4 cvt2vec(uint32_t rm) { return _mm_cvtsi32_si128(rm); /* MOVD xmm, r32 */ } 43 | static uint32_t cvt2i32(uint8x4 a) { return _mm_cvtsi128_si32(a); /* MOVD r32, xmm */ } 44 | #elif USE_SIMD_ARM_NEON 45 | uint8x4(uint8x8_t v) : v_(v) {}; 46 | operator uint8x8_t() const { return v_; } 47 | static uint8x4 cvt2vec(uint32_t rm) { 48 | uint32x2_t r; 49 | return vreinterpret_u8_u32(vset_lane_u32(rm, r, 0)); 50 | } 51 | static uint32_t cvt2i32(uint8x4 a) { return vget_lane_u32(vreinterpret_u32_u8(a.v_), 0); } 52 | #endif 53 | }; 54 | 55 | //Arithmetic 56 | static uint8x4 operator+(uint8x4 a, uint8x4 b); 57 | 58 | static uint8x4 operator+=(uint8x4 &a, uint8x4 b); 59 | 60 | static uint8x4 adds(uint8x4 a, uint8x4 b); 61 | 62 | //load 63 | static uint8x4 load(const uint32_t *rm); 64 | 65 | //Set 66 | static void setzero(uint8x4 &a); 67 | 68 | //Swizzle 69 | class uint16x4; 70 | static uint16x4 widen(uint8x4 a, uint8x4 b); 71 | } -------------------------------------------------------------------------------- /src/onsyuri/simd/int8x4.inl: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * int8x4.inl 4 | * 5 | * Copyright (C) 2015 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #ifndef __SIMD_H__ 22 | #error "This file must be included through simd.h" 23 | #endif 24 | #include "int16x4.h" 25 | 26 | namespace simd { 27 | //Arithmetic 28 | inline uint8x4 operator+(uint8x4 a, uint8x4 b) { 29 | #ifdef USE_SIMD_X86_SSE2 30 | return _mm_add_epi8(a, b); //PADDW xmm1, xmm2 31 | #elif USE_SIMD_ARM_NEON 32 | return vadd_u8(a, b); 33 | #endif 34 | } 35 | 36 | inline uint8x4 operator+=(uint8x4 &a, uint8x4 b) { 37 | return a = a + b; 38 | } 39 | 40 | inline uint8x4 adds(uint8x4 a, uint8x4 b) { 41 | #ifdef USE_SIMD_X86_SSE2 42 | return _mm_adds_epu8(a, b); //PADDUSB xmm1, xmm2 43 | #elif USE_SIMD_ARM_NEON 44 | return vqadd_u8(a, b); 45 | #endif 46 | } 47 | 48 | //Load 49 | inline uint8x4 load(const uint32_t *rm) { 50 | #ifdef USE_SIMD_X86_SSE2 51 | return uint8x4::cvt2vec(*rm); 52 | #elif USE_SIMD_ARM_NEON 53 | uint32x2_t a; 54 | return vreinterpret_u8_u32(vld1_lane_u32(rm, a, 0)); 55 | #endif 56 | } 57 | 58 | //Set 59 | inline void setzero(uint8x4 &a) { 60 | #ifdef USE_SIMD_X86_SSE2 61 | a = _mm_setzero_si128(); //PXOR xmm, xmm 62 | #elif USE_SIMD_ARM_NEON 63 | a = veor_u8(a, a); 64 | #endif 65 | } 66 | 67 | //Swizzle 68 | inline uint16x4 widen(uint8x4 a,uint8x4 b) { 69 | #ifdef USE_SIMD_X86_SSE2 70 | return _mm_unpacklo_epi8(a, b); 71 | #elif USE_SIMD_ARM_NEON 72 | return vget_low_u16(vmovl_u8(a)); 73 | #endif 74 | } 75 | } -------------------------------------------------------------------------------- /src/onsyuri/simd/int8x8.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * int8x8.h 4 | * 5 | * Copyright (C) 2015 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #pragma once 22 | 23 | #ifndef __SIMD_H__ 24 | #error "This file must be included through simd.h" 25 | #endif 26 | 27 | namespace simd { 28 | class uint8x8 { 29 | #ifdef USE_SIMD_X86_SSE2 30 | __m128i v_; 31 | #elif USE_SIMD_ARM_NEON 32 | uint8x8_t v_; 33 | #endif 34 | public: 35 | uint8x8() = default; 36 | uint8x8(const uint8x8&) = default; 37 | uint8x8 &operator=(const uint8x8&) = default; 38 | #ifdef USE_SIMD_X86_SSE2 39 | uint8x8(__m128i v) : v_(v) {}; 40 | operator __m128i() const { return v_; } 41 | #elif USE_SIMD_ARM_NEON 42 | uint8x8(uint8x8_t v) : v_(v) {}; 43 | operator uint8x8_t() const { return v_; } 44 | #endif 45 | }; 46 | 47 | class uint16x8; 48 | static uint16x8 widen(uint8x8 a, uint8x8 b); 49 | } -------------------------------------------------------------------------------- /src/onsyuri/simd/int8x8.inl: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * int8x8.inl 4 | * 5 | * Copyright (C) 2015 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #ifndef __SIMD_H__ 22 | #error "This file must be included through simd.h" 23 | #endif 24 | #include "int16x8.h" 25 | 26 | namespace simd { 27 | inline uint16x8 widen(uint8x8 a, uint8x8 b) { 28 | #ifdef USE_SIMD_X86_SSE2 29 | return _mm_unpacklo_epi8(a, b); 30 | #elif USE_SIMD_ARM_NEON 31 | return vmovl_u8(a); 32 | #endif 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/onsyuri/simd/simd.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * simd.h 4 | * 5 | * Copyright (C) 2015-2018 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #pragma once 22 | #define __SIMD_H__ 23 | 24 | #ifdef USE_SIMD_X86_AVX2 25 | #include 26 | #define USE_SIMD_X86_SSSE3 1 27 | #endif 28 | 29 | #ifdef USE_SIMD_X86_SSSE3 30 | #include 31 | #define USE_SIMD_X86_SSE3 1 32 | #endif 33 | 34 | #ifdef USE_SIMD_X86_SSE3 35 | #include 36 | #define USE_SIMD_X86_SSE2 1 37 | #endif 38 | 39 | #ifdef USE_SIMD_X86_SSE2 40 | #include 41 | #define USE_SIMD_X86_SSE 1 42 | #endif 43 | 44 | #ifdef USE_SIMD_X86_SSE 45 | #include 46 | #endif 47 | 48 | #ifdef USE_SIMD_ARM_NEON 49 | #ifdef _M_ARM64 50 | #include 51 | #else 52 | #include 53 | #endif 54 | #endif 55 | 56 | #ifdef __GNUC__ 57 | #define inline static __inline __attribute__((__always_inline__)) 58 | #elif defined(_MSC_VER) 59 | #define inline __forceinline 60 | #endif 61 | 62 | namespace simd { 63 | template 64 | struct immint { 65 | #if _MSC_VER < 1900 66 | static const int value = imm; 67 | operator int() const { return value; } 68 | #else 69 | static constexpr int value = imm; 70 | constexpr operator int() const { return value; } 71 | #endif 72 | }; 73 | } 74 | 75 | #if defined(USE_SIMD_X86_SSE2) || defined(USE_SIMD_ARM_NEON) 76 | #include "int8x4.h" 77 | #include "int8x4.inl" 78 | #include "int8x8.h" 79 | #include "int8x8.inl" 80 | #include "int8x16.h" 81 | #include "int8x16.inl" 82 | #include "int16x4.h" 83 | #include "int16x4.inl" 84 | #include "int16x8.h" 85 | #include "int16x8.inl" 86 | #include "int32x2.h" 87 | #include "int32x2.inl" 88 | #include "int32x4.h" 89 | #include "int32x4.inl" 90 | #include "vec128.h" 91 | #include "vec128.inl" 92 | #ifdef USE_SIMD_X86_AVX2 93 | #include "int8x32.h" 94 | #include "int8x32.inl" 95 | #include "int16x16.h" 96 | #include "int16x16.inl" 97 | #include "vec256.h" 98 | #include "vec256.inl" 99 | #endif 100 | #endif 101 | 102 | #undef inline 103 | -------------------------------------------------------------------------------- /src/onsyuri/simd/vec128.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * vec128.h 4 | * 5 | * Copyright (C) 2015 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #pragma once 22 | 23 | #ifndef __SIMD_H__ 24 | #error "This file must be included through simd.h" 25 | #endif 26 | 27 | namespace simd { 28 | class uint8x4; 29 | class uint8x8; 30 | class uint8x16; 31 | class uint16x4; 32 | class uint16x8; 33 | class ivec128 { 34 | #ifdef USE_SIMD_X86_SSE2 35 | __m128i v_; 36 | #endif 37 | public: 38 | ivec128() = default; 39 | ivec128(const ivec128&) = default; 40 | ivec128 &operator=(const ivec128&) = default; 41 | #ifdef USE_SIMD_X86_SSE2 42 | ivec128(__m128i v) : v_(v) {}; 43 | operator __m128i() const { return v_; } 44 | operator uint8x4() const { return v_; } 45 | operator uint8x8() const { return v_; } 46 | operator uint8x16() const { return v_; } 47 | operator uint16x4() const { return v_; } 48 | operator uint16x8() const { return v_; } 49 | static ivec128 zero() { return _mm_setzero_si128(); } 50 | #elif USE_SIMD_ARM_NEON 51 | static ivec128 zero() { return ivec128(); } 52 | operator uint8x4() const { return uint8x4(); } 53 | operator uint8x8() const { return uint8x8(); } 54 | operator uint8x16() const { return uint8x16(); } 55 | operator uint16x4() const { return uint16x4(); } 56 | operator uint16x8() const { return uint16x8(); } 57 | #endif 58 | }; 59 | } -------------------------------------------------------------------------------- /src/onsyuri/simd/vec128.inl: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * vec128.inl 4 | * 5 | * Copyright (C) 2018 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | #ifndef __SIMD_H__ 23 | #error "This file must be included through simd.h" 24 | #endif 25 | -------------------------------------------------------------------------------- /src/onsyuri/simd/vec256.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * vec256.h 4 | * 5 | * Copyright (C) 2018-2019 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | #pragma once 22 | 23 | #ifndef __SIMD_H__ 24 | #error "This file must be included through simd.h" 25 | #endif 26 | 27 | namespace simd { 28 | class uint8x32; 29 | class uint16x16; 30 | class ivec256 { 31 | #ifdef USE_SIMD_X86_AVX2 32 | __m256i v_; 33 | #endif 34 | public: 35 | ivec256() = default; 36 | ivec256(const ivec256&) = default; 37 | ivec256 &operator=(const ivec256&) = default; 38 | #ifdef USE_SIMD_X86_AVX2 39 | ivec256(__m256i v) : v_(v) {}; 40 | operator __m256i() const { return v_; } 41 | operator uint8x32() const { return v_; } 42 | operator uint16x16() const { return v_; } 43 | ivec128 lo() { return _mm256_castsi256_si128(v_); } 44 | static ivec256 zero() { return _mm256_setzero_si256(); } 45 | #endif 46 | }; 47 | 48 | //Load 49 | static ivec256 load256_u(const void* m); 50 | 51 | //Store 52 | static void store256_u(void* m, __m256i a); 53 | } 54 | -------------------------------------------------------------------------------- /src/onsyuri/simd/vec256.inl: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * vec256.inl 4 | * 5 | * Copyright (C) 2018 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | #ifndef __SIMD_H__ 23 | #error "This file must be included through simd.h" 24 | #endif 25 | 26 | namespace simd { 27 | //Load 28 | inline ivec256 load256_a(const void *m) { 29 | #if USE_SIMD_X86_AVX2 30 | return _mm256_load_si256(reinterpret_cast(m)); 31 | #endif 32 | } 33 | 34 | inline ivec256 load256_u(const void *m) { 35 | #if USE_SIMD_X86_AVX2 36 | return _mm256_lddqu_si256(reinterpret_cast(m)); 37 | #endif 38 | } 39 | 40 | //Store 41 | inline void store256_a(void* m, __m256i a) { 42 | #ifdef USE_SIMD_X86_AVX2 43 | _mm256_store_si256(reinterpret_cast<__m256i*>(m), a); 44 | #endif 45 | } 46 | 47 | inline void store256_u(void* m, __m256i a) { 48 | #ifdef USE_SIMD_X86_AVX2 49 | _mm256_storeu_si256(reinterpret_cast<__m256i*>(m), a); 50 | #endif 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/onsyuri/simple_aviplay.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * simple_aviplay.cpp - sample program for AVIWrapper class 4 | * 5 | * Copyright (c) 2001-2004 Ogapee. All rights reserved. 6 | * 7 | * ogapee@aqua.dti2.ne.jp 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "AVIWrapper.h" 31 | 32 | #define DEFAULT_AUDIOBUF 4096 33 | #define ONS_MIX_CHANNELS 50 34 | 35 | int main( int argc, char **argv ) 36 | { 37 | if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO ) < 0 ){ 38 | fprintf( stderr, "Couldn't initialize SDL: %s\n", SDL_GetError() ); 39 | exit(-1); 40 | } 41 | 42 | AVIWrapper avi; 43 | if ( avi.init( argv[1], true ) ) exit(-1); 44 | SDL_Surface *screen_surface = SDL_SetVideoMode( avi.getWidth(), avi.getHeight(), 32, SDL_SWSURFACE ); 45 | if ( avi.initAV( screen_surface, true ) ) exit(-1); 46 | avi.play( true ); 47 | 48 | exit(0); 49 | } 50 | -------------------------------------------------------------------------------- /src/onsyuri/sjis2utf16.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuriSizuku/OnscripterYuri/ff12c7eaef2560a77a1f90fc796f63970216f42d/src/onsyuri/sjis2utf16.cpp -------------------------------------------------------------------------------- /src/onsyuri/sjis2utf16.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * sjis2utf16.h 4 | * 5 | * Copyright (c) 2014-2016 jh10001 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program 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 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | #ifndef __SJIS2UTF16_H__ 23 | #define __SJIS2UTF16_H__ 24 | 25 | #include "coding2utf16.h" 26 | 27 | class SJIS2UTF16 : public Coding2UTF16 { 28 | public: 29 | void init() final; 30 | uint16_t conv2UTF16(uint16_t) const final; 31 | uint16_t convUTF162Coding(uint16_t) const final; 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/onsyuri/tool/nsadec.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * nsadec.cpp - NSA archive decoder 4 | * 5 | * Copyright (c) 2001-2015 Ogapee. All rights reserved. 6 | * (C) 2014-2015 jh10001 7 | * 8 | * ogapee@aqua.dti2.ne.jp 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | */ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include "NsaReader.h" 32 | #include "coding2utf16.h" 33 | #include "gbk2utf16.h" 34 | #ifdef _WIN32 35 | #include 36 | inline int mkdir(const char *pathname, int unused){ 37 | return _mkdir(pathname); 38 | } 39 | #endif 40 | 41 | extern int errno; 42 | Coding2UTF16 *coding2utf16; 43 | 44 | int main( int argc, char **argv ) 45 | { 46 | NsaReader cNR; 47 | unsigned int nsa_offset = 0; 48 | unsigned long length; 49 | unsigned char *buffer; 50 | char file_name[256], dir_name[256]; 51 | unsigned int i, j, count; 52 | int archive_type = BaseReader::ARCHIVE_TYPE_NSA; 53 | FILE *fp; 54 | struct stat file_stat; 55 | 56 | if ( argc >= 2 ){ 57 | while ( argc > 2 ){ 58 | if (!strcmp(argv[1], "-ns2")) { 59 | archive_type = BaseReader::ARCHIVE_TYPE_NS2; 60 | } else if ( !strcmp( argv[1], "-offset") ){ 61 | nsa_offset = atoi(argv[2]); 62 | argc--; 63 | argv++; 64 | } 65 | 66 | argc--; 67 | argv++; 68 | } 69 | } 70 | if ( argc != 2 ){ 71 | fprintf( stderr, "Usage: nsadec [-offset ##] [-ns2] arc_file\n"); 72 | exit(-1); 73 | } 74 | cNR.openForConvert( argv[1], archive_type, nsa_offset ); 75 | count = cNR.getNumFiles(); 76 | 77 | SarReader::FileInfo sFI; 78 | 79 | for ( i=0 ; i 2 | int main(int argc,char *argv[]){ 3 | FILE *pFile = fopen(*(argv+1), "rb"); 4 | if(pFile != nullptr){ 5 | fseek(pFile,0,SEEK_END); 6 | int lSize = ftell(pFile); 7 | rewind(pFile); 8 | char *buffer = new char[lSize]; 9 | int result = fread(buffer,1,lSize,pFile); 10 | fclose(pFile); 11 | for (int i = 0; i < lSize; ++i) { 12 | int ch = buffer[i]; 13 | ch ^= 0x84; 14 | buffer[i] = ch; 15 | } 16 | FILE *pOutFile = fopen(*(argv+2), "wb"); 17 | fwrite(buffer, sizeof(char),lSize,pOutFile); 18 | delete[] buffer; 19 | fclose(pOutFile); 20 | } 21 | return 0; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/onsyuri/tool/sardec.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * 3 | * sardec.cpp - SAR archive decoder 4 | * 5 | * Copyright (c) 2001-2004 Ogapee. All rights reserved. 6 | * (C) 2014 jh10001 7 | * 8 | * ogapee@aqua.dti2.ne.jp 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | */ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include "SarReader.h" 32 | #ifdef _WIN32 33 | #include 34 | inline int mkdir(const char *pathname, int unused){ 35 | return _mkdir(pathname); 36 | } 37 | #endif 38 | 39 | extern int errno; 40 | 41 | int main( int argc, char **argv ) 42 | { 43 | SarReader cSR; 44 | unsigned long length, buffer_length = 0; 45 | unsigned char *buffer = NULL; 46 | char file_name[256], dir_name[256]; 47 | unsigned int i, j, count; 48 | FILE *fp; 49 | struct stat file_stat; 50 | 51 | if ( argc != 2 ){ 52 | fprintf( stderr, "Usage: sardec arc_file\n"); 53 | exit(-1); 54 | } 55 | if (cSR.open( argv[1] ) != 0){ 56 | fprintf( stderr, "can't open file %s\n", argv[1] ); 57 | exit(-1); 58 | } 59 | count = cSR.getNumFiles(); 60 | 61 | SarReader::FileInfo sFI; 62 | 63 | for ( i=0 ; i buffer_length ){ 69 | if ( buffer ) delete[] buffer; 70 | buffer = new unsigned char[length]; 71 | buffer_length = length; 72 | } 73 | if ( cSR.getFile( sFI.name, buffer ) != length ){ 74 | fprintf( stderr, "file %s can't be retrieved\n", sFI.name ); 75 | continue; 76 | } 77 | 78 | strcpy( file_name, sFI.name ); 79 | for ( j=0 ; j 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/onsyuri_android/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 19 | 20 | -------------------------------------------------------------------------------- /src/onsyuri_android/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | -------------------------------------------------------------------------------- /src/onsyuri_android/.idea/modules/app/onsyuri.app.androidTest.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/onsyuri_android/.idea/modules/app/onsyuri.app.unitTest.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/onsyuri_android/app/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 36 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/onsyuri_android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | } 4 | 5 | android { 6 | namespace 'com.yuri.onscripter' 7 | compileSdk 31 8 | ndkVersion '25.2.9519653' 9 | buildToolsVersion '33.0.2' 10 | compileOptions { 11 | sourceCompatibility JavaVersion.VERSION_11 12 | targetCompatibility JavaVersion.VERSION_11 13 | } 14 | 15 | defaultConfig { 16 | applicationId "com.yuri.onscripter" 17 | minSdk 22 18 | targetSdk 36 19 | packagingOptions { 20 | // doNotStrip '**.so' // important for debug so 21 | } 22 | ndk { 23 | abiFilters 'armeabi-v7a', 'arm64-v8a' 24 | } 25 | externalNativeBuild { 26 | cmake { 27 | arguments "-Wno-dev", "-DANDROID_ARM_NEON=TRUE" 28 | } 29 | } 30 | versionCode 7 31 | versionName '0.7.6' 32 | } 33 | signingConfigs { 34 | release { 35 | def signPropsFile = file('sign.properties') 36 | storeFile file('sign.jks') 37 | if (signPropsFile.exists()) { 38 | Properties signProps = new Properties() 39 | signProps.load(new FileInputStream(signPropsFile)) 40 | keyAlias signProps['SIGN_KEY_ALIAS'] 41 | keyPassword signProps['SIGN_KEY_PASS'] 42 | storePassword signProps['SIGN_STORE_PASS'] 43 | } 44 | else { 45 | keyAlias System.getenv("SIGN_KEY_ALIAS") 46 | keyPassword System.getenv("SIGN_KEY_PASS") 47 | storePassword System.getenv("SIGN_STORE_PASS") 48 | } 49 | } 50 | } 51 | buildTypes { 52 | release { 53 | minifyEnabled true // this may cause jni crash 54 | debuggable false 55 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 56 | if(file('sign.properties').exists() || System.getenv("SIGN_KEY_ALIAS")) { 57 | signingConfig signingConfigs.release 58 | } 59 | } 60 | debug { 61 | minifyEnabled false 62 | debuggable true 63 | if(file('sign.properties').exists() || System.getenv("SIGN_KEY_ALIAS")) { 64 | signingConfig signingConfigs.release 65 | } 66 | } 67 | } 68 | 69 | sourceSets { 70 | main { 71 | manifest.srcFile 'AndroidManifest.xml' 72 | java.srcDirs = ['java'] 73 | res.srcDirs = ['res'] 74 | } 75 | } 76 | externalNativeBuild { 77 | cmake { 78 | version '3.22.1' 79 | path 'cpp/CMakeLists.txt' 80 | // this might be some problem with ninja 81 | // buildStagingDirectory './../../../build_android' 82 | } 83 | } 84 | android.applicationVariants.all { variant -> 85 | variant.outputs.all { 86 | outputFileName = "onsyuri[${namespace}]_v${defaultConfig.versionName}.apk" 87 | } 88 | } 89 | } 90 | 91 | dependencies { 92 | implementation 'androidx.appcompat:appcompat:1.4.1' 93 | implementation 'com.google.android.material:material:1.5.0' 94 | implementation 'androidx.constraintlayout:constraintlayout:2.1.3' 95 | testImplementation 'junit:junit:4.13.2' 96 | androidTestImplementation 'androidx.test.ext:junit:1.1.3' 97 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' 98 | } -------------------------------------------------------------------------------- /src/onsyuri_android/app/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16.3) 2 | project(onsyuri_android) 3 | 4 | # configure path 5 | set(ONSYURI_DIR ${CMAKE_SOURCE_DIR}/../../../..) 6 | set(THIRDPARTY_PORT "${ONSYURI_DIR}/thirdparty/port") 7 | set(SDL2_DIR ${THIRDPARTY_PORT}/SDL2-2.26.3) 8 | SET(SDL2IMAGE_DIR ${THIRDPARTY_PORT}/SDL2_image-2.6.3) 9 | set(SDL2TTF_DIR ${THIRDPARTY_PORT}/SDL2_ttf-2.20.2) 10 | set(SDL2MIXER_DIR ${THIRDPARTY_PORT}/SDL2_mixer-2.6.3) 11 | set(JPEG_DIR ${THIRDPARTY_PORT}/SDL2_image-2.6.3/external/jpeg) 12 | set(LUA_DIR ${THIRDPARTY_PORT}/lua-5.4.4) 13 | set(BZ2_DIR ${THIRDPARTY_PORT}/bzip2-1.0.8) 14 | 15 | # build sdl2 16 | set(ANDROID TRUE) 17 | set(CMAKE_SYSTEM_NAME Linux) 18 | add_subdirectory(${SDL2_DIR} ${ONSYURI_DIR}/build_android/thirdparty/sdl2) 19 | 20 | # build sdl2_image 21 | set(SDL2IMAGE_INSTALL off) 22 | set(SDL2IMAGE_SAMPLES off) 23 | add_subdirectory(${SDL2IMAGE_DIR} ${ONSYURI_DIR}/build_android/thirdparty/sdl2image) 24 | 25 | # build sdl2_ttf 26 | set(SDL2TTF_SAMPLES off) 27 | set(SDL2TTF_INSTALL off) 28 | set(SDL2TTF_VENDORED on) # use external ttf in source code 29 | add_subdirectory(${SDL2TTF_DIR} ${ONSYURI_DIR}/build_android/thirdparty/sdl2ttf) 30 | 31 | # build sdl2 mixer 32 | set(SDL2MIXER_SAMPLES off) 33 | set(SDL2MIXER_INSTALL off) 34 | set(SDL2MIXER_OPUS off) 35 | set(SDL2MIXER_FLAC off) 36 | set(SDL2MIXER_VORBIS_STB on) 37 | set(SDL2MIXER_VENDORED on) 38 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-dev") 39 | add_subdirectory(${SDL2MIXER_DIR} ${ONSYURI_DIR}/build_android/thirdparty/sdl2mixer) 40 | 41 | # build jpeg 42 | add_subdirectory(${JPEG_DIR} ${ONSYURI_DIR}/build_android/thirdparty/jpeg) 43 | 44 | # build lua 45 | set(LUASRC_DIR ${LUA_DIR}/src) 46 | set(LUA_CODE 47 | ${LUASRC_DIR}/lapi.c ${LUASRC_DIR}/lcode.c ${LUASRC_DIR}/lctype.c ${LUASRC_DIR}/ldebug.c ${LUASRC_DIR}/ldo.c 48 | ${LUASRC_DIR}/ldump.c ${LUASRC_DIR}/lfunc.c ${LUASRC_DIR}/lgc.c ${LUASRC_DIR}/llex.c ${LUASRC_DIR}/lmem.c 49 | ${LUASRC_DIR}/lobject.c ${LUASRC_DIR}/lopcodes.c ${LUASRC_DIR}/lparser.c ${LUASRC_DIR}/lstate.c ${LUASRC_DIR}/lstring.c 50 | ${LUASRC_DIR}/ltable.c ${LUASRC_DIR}/ltm.c ${LUASRC_DIR}/lundump.c ${LUASRC_DIR}/lvm.c ${LUASRC_DIR}/lzio.c 51 | ${LUASRC_DIR}/lauxlib.c ${LUASRC_DIR}/lbaselib.c ${LUASRC_DIR}/lcorolib.c ${LUASRC_DIR}/ldblib.c ${LUASRC_DIR}/liolib.c 52 | ${LUASRC_DIR}/lmathlib.c ${LUASRC_DIR}/loadlib.c ${LUASRC_DIR}/loslib.c ${LUASRC_DIR}/lstrlib.c ${LUASRC_DIR}/ltablib.c 53 | ${LUASRC_DIR}/lutf8lib.c ${LUASRC_DIR}/linit.c 54 | ) 55 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations") 56 | add_library(lua SHARED ${LUA_CODE}) 57 | 58 | # build bz2 59 | set(BZ2SRC_DIR ${BZ2_DIR}) 60 | set(BZ2_CODE 61 | ${BZ2SRC_DIR}/blocksort.c ${BZ2SRC_DIR}/huffman.c ${BZ2SRC_DIR}/crctable.c ${BZ2SRC_DIR}/randtable.c 62 | ${BZ2SRC_DIR}/compress.c ${BZ2SRC_DIR}/decompress.c ${BZ2SRC_DIR}/bzlib.c 63 | ) 64 | add_library(bz2 SHARED ${BZ2_CODE}) 65 | target_compile_options(bz2 PRIVATE -D_FILE_OFFSET_BITS=64) 66 | 67 | # build onsyuri_android 68 | set(CMAKE_SYSTEM_NAME Android) 69 | #set(CMAKE_BUILD_TYPE Debug) 70 | include_directories( 71 | ${BZ2_DIR} 72 | ${LUASRC_DIR} 73 | ) 74 | add_subdirectory(${ONSYURI_DIR} ${ONSYURI_DIR}/build_android) -------------------------------------------------------------------------------- /src/onsyuri_android/app/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 | -------------------------------------------------------------------------------- /src/onsyuri_android/app/java/org/libsdl/app/SDL.java: -------------------------------------------------------------------------------- 1 | package org.libsdl.app; 2 | 3 | import android.content.Context; 4 | 5 | import java.lang.Class; 6 | import java.lang.reflect.Method; 7 | 8 | /** 9 | SDL library initialization 10 | */ 11 | public class SDL { 12 | 13 | // This function should be called first and sets up the native code 14 | // so it can call into the Java classes 15 | public static void setupJNI() { 16 | SDLActivity.nativeSetupJNI(); 17 | SDLAudioManager.nativeSetupJNI(); 18 | SDLControllerManager.nativeSetupJNI(); 19 | } 20 | 21 | // This function should be called each time the activity is started 22 | public static void initialize() { 23 | setContext(null); 24 | 25 | SDLActivity.initialize(); 26 | SDLAudioManager.initialize(); 27 | SDLControllerManager.initialize(); 28 | } 29 | 30 | // This function stores the current activity (SDL or not) 31 | public static void setContext(Context context) { 32 | mContext = context; 33 | } 34 | 35 | public static Context getContext() { 36 | return mContext; 37 | } 38 | 39 | public static void loadLibrary(String libraryName) throws UnsatisfiedLinkError, SecurityException, NullPointerException { 40 | 41 | if (libraryName == null) { 42 | throw new NullPointerException("No library name provided."); 43 | } 44 | 45 | try { 46 | // Let's see if we have ReLinker available in the project. This is necessary for 47 | // some projects that have huge numbers of local libraries bundled, and thus may 48 | // trip a bug in Android's native library loader which ReLinker works around. (If 49 | // loadLibrary works properly, ReLinker will simply use the normal Android method 50 | // internally.) 51 | // 52 | // To use ReLinker, just add it as a dependency. For more information, see 53 | // https://github.com/KeepSafe/ReLinker for ReLinker's repository. 54 | // 55 | Class relinkClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker"); 56 | Class relinkListenerClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker$LoadListener"); 57 | Class contextClass = mContext.getClassLoader().loadClass("android.content.Context"); 58 | Class stringClass = mContext.getClassLoader().loadClass("java.lang.String"); 59 | 60 | // Get a 'force' instance of the ReLinker, so we can ensure libraries are reinstalled if 61 | // they've changed during updates. 62 | Method forceMethod = relinkClass.getDeclaredMethod("force"); 63 | Object relinkInstance = forceMethod.invoke(null); 64 | Class relinkInstanceClass = relinkInstance.getClass(); 65 | 66 | // Actually load the library! 67 | Method loadMethod = relinkInstanceClass.getDeclaredMethod("loadLibrary", contextClass, stringClass, stringClass, relinkListenerClass); 68 | loadMethod.invoke(relinkInstance, mContext, libraryName, null, null); 69 | } 70 | catch (final Throwable e) { 71 | // Fall back 72 | try { 73 | System.loadLibrary(libraryName); 74 | } 75 | catch (final UnsatisfiedLinkError ule) { 76 | throw ule; 77 | } 78 | catch (final SecurityException se) { 79 | throw se; 80 | } 81 | } 82 | } 83 | 84 | protected static Context mContext; 85 | } 86 | -------------------------------------------------------------------------------- /src/onsyuri_android/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 | -keep class com.yuri.onscripter.ONScripter { 16 | public *; 17 | } 18 | 19 | -keep class org.libsdl.app.** { 20 | public *; 21 | } 22 | 23 | # Uncomment this to preserve the line number information for 24 | # debugging stack traces. 25 | #-keepattributes SourceFile,LineNumberTable 26 | 27 | # If you keep the line number information, uncomment this to 28 | # hide the original source file name. 29 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /src/onsyuri_android/app/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 15 | 16 | 27 | 28 | 38 | 39 | 47 | 48 | 49 | 50 | 54 | 55 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/onsyuri_android/app/res/layout/layout_gameinfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 18 | 19 | 23 | 24 | 28 | 29 | 40 | 41 | 47 | 48 | 59 | 60 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /src/onsyuri_android/app/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuriSizuku/OnscripterYuri/ff12c7eaef2560a77a1f90fc796f63970216f42d/src/onsyuri_android/app/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /src/onsyuri_android/app/res/values-night/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | #202020 11 | #4C7131 12 | #9B6161 13 | 14 | -------------------------------------------------------------------------------- /src/onsyuri_android/app/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /src/onsyuri_android/app/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | #FFFFFFFF 11 | #CBFDA0 12 | #FFD1D1 13 | 14 | -------------------------------------------------------------------------------- /src/onsyuri_android/app/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ONScripter-Yuri 3 | v0.7.6 4 | 5 | An enhancement of ONScripter, developed by YuriSizuku \n\n 6 | 1. Game Dir \n 7 | use SAF or put game files in app, ext app dir \n 8 | /storage/emulated/0/Android/data/com.yuri.onscripter/files \n 9 | /storage/XXXX-XXXX/0/Android/data/com.yuri.onscripter/files \n\n 10 | 2. Game Setting \n 11 | setting game parameter like `strech fullscreen` \n\n 12 | 3. Game Gesture \n 13 | [long click/3 fingers] to invoke menu \n 14 | [4 fingers] to skip text 15 | 16 | -------------------------------------------------------------------------------- /src/onsyuri_android/app/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | 17 | -------------------------------------------------------------------------------- /src/onsyuri_android/app/res/xml/backup_rules.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | -------------------------------------------------------------------------------- /src/onsyuri_android/app/res/xml/data_extraction_rules.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 12 | 13 | 19 | -------------------------------------------------------------------------------- /src/onsyuri_android/app/res/xml/file_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/onsyuri_android/app/sign.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuriSizuku/OnscripterYuri/ff12c7eaef2560a77a1f90fc796f63970216f42d/src/onsyuri_android/app/sign.jks -------------------------------------------------------------------------------- /src/onsyuri_android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | plugins { 3 | id 'com.android.application' version '7.4.2' apply false 4 | id 'com.android.library' version '7.4.2' apply false 5 | } 6 | 7 | allprojects { 8 | buildDir = "./../../../build_android" 9 | } -------------------------------------------------------------------------------- /src/onsyuri_android/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 | # Enables namespacing of each library's R class so that its R class includes only the 19 | # resources declared in the library itself and none from the library's dependencies, 20 | # thereby reducing the size of the R class for that library 21 | android.nonTransitiveRClass=true -------------------------------------------------------------------------------- /src/onsyuri_android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuriSizuku/OnscripterYuri/ff12c7eaef2560a77a1f90fc796f63970216f42d/src/onsyuri_android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/onsyuri_android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Feb 19 23:10:01 JST 2023 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /src/onsyuri_android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /src/onsyuri_android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | gradlePluginPortal() 6 | } 7 | } 8 | dependencyResolutionManagement { 9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 10 | repositories { 11 | google() 12 | mavenCentral() 13 | } 14 | } 15 | include ':app' 16 | rootProject.name = "onsyuri_android" 17 | -------------------------------------------------------------------------------- /src/onsyuri_libretro/SDL_libretro.h: -------------------------------------------------------------------------------- 1 | #ifndef SDL_LIBRETO_H 2 | #define SDL_LIBRETO_H 3 | 4 | #include "SDL.h" 5 | #include "libretro.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | void SDL_libretro_RefreshVideo(retro_video_refresh_t video_cb); 12 | void SDL_libretro_ProduceAudio(retro_audio_sample_batch_t audio_batch_t); 13 | void SDL_libretro_KeyboardCallback(bool down, unsigned keycode, 14 | uint32_t character, uint16_t key_modifiers); 15 | void SDL_libretro_SendMouseMotion(int relative, int x, int y); 16 | void SDL_libretro_SendMouseButton(Uint8 state, Uint8 button); 17 | 18 | int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/onsyuri_libretro/cursor_png.h: -------------------------------------------------------------------------------- 1 | // Generated by adobe-bin2c from 'left-arrow' in the KDE breeze theme. 2 | 3 | const char cursor_png[] = "\ 4 | \211PNG\r\n\ 5 | \032\n\ 6 | \000\000\000\rIHDR\000\000\000(\000\000\000(\b\006\000\000\000\214\376\270m\000\000\002\217IDATX\205\355\327\277O\023a\034\307\361\367\035\327\213\325JPK\032!\232\0207\\D\302\302\330\030\247\".mB\330T\026\313`\354\000[G\231\b\033\211\t\t\306\305\201\211\215 !\370\027\320\260\230\100\241cCZ \222\273 \367\343\353p-\026A\244\320\037\227\330Or\303\rO\236\327}\356y.\367\100+\377S\322\351\264j\333v\322\262\254\227\200\322l\317\237Q\212\305\342\240\210\210eY\356\321\321\321;\100m6\252\022\240\356\357\357w\210\b\243\243\243\212\252\252\323\246i\372\002Y\216\266\261\2611\344\272\256\000\222H\044\344\370\370\330=</\2458\205B\341\333\362\362\362+\340\016\327|\360S\250\253\016\f\006\203D\"\021wkk\353\323\334\334\334\227\251\251\251,`\000\077\001\267V\300\312\234\273I:;;\245\247\247\347L\203\375\375\375\"\"2<<\374\004\210\000\355\300\r\240\255\036\2703\300P(\044\023\023\023rpp \333\333\333\022\016\207O\001\273\273\273EDduu\365Y\005\254\256\347\230\2235\230J\245\244P(\210\210\210a\0309\3030\262+++\022\b\004N\200\272\256\213\210H.\227{C\r\327\334\205\300\371\371\371\307\266m\033\216\343\330\273\273\273_\027\026\026^\353\272\336;99\371\334\262\254\037\263\263\263'\300\201\201\001\021\021\311\347\363i \320\b`\033\320\236L&\237\216\215\215\r\002\217\200. \f\334_[[\033\027\021wqqQfff\244X,\212\210\310\346\346\3468\240\323\200c\252R\232\250\003\270\v\334\306[[\001\340&\320\225\315f\077JE\f\303\370\036\217\307\037\322\240\006\313H\255t\251\245{\005\257\335\020\360`ii\351\355\316\316\316\347L&\363!\032\215\366\342\355\336\272\355\334j^\213\006\004\201[xM;x\337=\003\260\361\326f\315S\rP\301k\265\334\256\340\301\034\352\204+Oz\2351u\203\265\322J+\255\264\342\345\027\024\370D\205o\345\302~\000\000\000\000IEND\256B`\202"; 7 | const size_t cursor_png_len = sizeof(cursor_png) - 1; 8 | -------------------------------------------------------------------------------- /src/onsyuri_libretro/deps/SDL_dynapi.h: -------------------------------------------------------------------------------- 1 | #ifndef SDL_dynapi_h_ 2 | #define SDL_dynapi_h_ 3 | 4 | #define SDL_DYNAMIC_API 0 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /src/onsyuri_libretro/deps/close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2024 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 SDL_begin_code_h 30 | #error close_code.h included without matching begin_code.h 31 | #endif 32 | #undef SDL_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 | 42 | /* libretro: Treat Android as Linux */ 43 | #undef ANDROID 44 | #undef __ANDROID__ 45 | -------------------------------------------------------------------------------- /src/onsyuri_libretro/deps/lua.hpp: -------------------------------------------------------------------------------- 1 | // lua.hpp 2 | // Lua header files for C++ 3 | // <> not supplied automatically because Lua also compiles as C++ 4 | 5 | extern "C" { 6 | #include "lua/lua.h" 7 | #include "lua/lualib.h" 8 | #include "lua/lauxlib.h" 9 | } 10 | -------------------------------------------------------------------------------- /src/onsyuri_libretro/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | -------------------------------------------------------------------------------- /src/onsyuri_libretro/onsyuri_libretro.info: -------------------------------------------------------------------------------- 1 | # Software Information 2 | display_name = "ONScripter Yuri" 3 | display_version = "0.7.4+2" 4 | authors = "Studio O.G.A.|jh10001|YuriSizuku" 5 | categories = "Game engine" 6 | license = "GPLv2+" 7 | permissions = "" 8 | supported_extensions = "txt|dat|___|nt2|nt3|ons|/" 9 | 10 | # Hardware Information 11 | manufacturer = "ONScripter" 12 | systemname = "ONScripter Yuri" 13 | systemid = "onsyuri" 14 | 15 | # Libretro Features 16 | database = "ONScripter" 17 | supports_no_game = "false" 18 | libretro_saves = "false" 19 | cheats = "false" 20 | needs_fullpath = "true" 21 | disk_control = "false" 22 | 23 | description = "A port of the ONScripter Yuri visual novel games engine to libretro." 24 | -------------------------------------------------------------------------------- /src/onsyuri_web/dummy.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void mainloop() 5 | { 6 | 7 | } 8 | 9 | int main(int argc, char **argv) 10 | { 11 | emscripten_set_main_loop(mainloop, -1, -1); 12 | return 0; 13 | } -------------------------------------------------------------------------------- /src/onsyuri_web/onsyuri_index.py: -------------------------------------------------------------------------------- 1 | import os 2 | import json 3 | import argparse 4 | 5 | def make_lazyindex(name, indir): 6 | # use npm i -g browserfs before 7 | os.system(f"pushd {indir} && npx make_xhrfs_index > {name}") 8 | 9 | def make_filelist(inpath, urlbase): 10 | files = [] 11 | for _root, _dirs, _files in os.walk(inpath): 12 | for file in _files: 13 | path = os.path.join(_root, file) 14 | relpath = os.path.relpath(path, inpath).replace('\\', '/') 15 | url = urlbase + relpath if urlbase!="" else "" 16 | if url=="": files.append({"path": relpath}) 17 | else :files.append({"path": relpath, "url": url}) 18 | return files 19 | 20 | def debug(): 21 | cmdstr="-i ./asset/test_mo2demo/ -o ./build_web/onsyuri_index.json --urlbase http://localhost:5500/build_web/ --lazyload" 22 | main(cmdstr) 23 | 24 | def main(cmdstr=None): 25 | parser = argparse.ArgumentParser( 26 | description="Generate onsyuri_index.json for web\n" 27 | "v0.1, developed by devseed") 28 | parser.add_argument('-i', '--inpath', type=str, default='./') 29 | parser.add_argument('-o', '--outpath', type=str) 30 | parser.add_argument('--title', type=str, help="game title, default indir name") 31 | parser.add_argument('--gamedir', type=str, help="gamedir in web fs, default /onsyuri/{title}") 32 | parser.add_argument('--savedir', type=str, help="savedir in web fs, default /onsyuri_save/{title}") 33 | parser.add_argument('--urlbase', type=str, default='', help="load files from this url default ./") 34 | parser.add_argument('--lazyload', action='store_true', help="lazyload by fetching file with filemap ") 35 | parser.add_argument('--lazyindex', type=str, help="the index file name for lazyload by BrowerFS (deprecated)") 36 | parser.add_argument('--args', type=str, nargs='+', default=[], help="args except --root, --save-path to onscripter") 37 | 38 | if cmdstr is None: args = parser.parse_args() 39 | else: args = parser.parse_args(cmdstr.split(' ')) 40 | inpath = args.inpath 41 | outpath = args.outpath 42 | title = args.title 43 | gamedir = args.gamedir 44 | savedir = args.savedir 45 | urlbase = args.urlbase 46 | lazyindex = args.lazyindex 47 | lazyload = args.lazyload 48 | onsargs = args.args 49 | 50 | inpath = os.path.abspath(inpath) 51 | if outpath==None: outpath = os.path.join(inpath, "onsyuri_index.json") 52 | if not title: title = os.path.basename(inpath) 53 | if not gamedir: gamedir = "/onsyuri/" + title 54 | if not savedir: savedir = "/onsyuri_save/"+title 55 | 56 | if lazyindex is not None: 57 | if lazyindex=="": lazyindex="onsyuri_lazyindex.json" 58 | make_lazyindex(lazyindex, inpath) 59 | files = make_filelist(inpath, urlbase) 60 | 61 | onsyuri_index = { 62 | 'title': title, 63 | 'gamedir': gamedir, 64 | 'savedir': savedir, 65 | 'args': onsargs, 66 | 'lazyload': lazyload, 67 | 'files':files 68 | } 69 | if lazyindex is not None: onsyuri_index["lazyindex"] = lazyindex 70 | with open(outpath, 'w') as fp: 71 | json.dump(onsyuri_index, fp, indent=2) 72 | 73 | if __name__ == '__main__': 74 | # debug() 75 | main() -------------------------------------------------------------------------------- /vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", 3 | "builtin-baseline": "ce613c41372b23b1f51333815feb3edd87ef8a8b", 4 | "dependencies": [ 5 | { 6 | "name": "sdl2", 7 | "version>=": "2.26.3#1" 8 | }, 9 | { 10 | "name": "bzip2", 11 | "version>=": "1.0.8#3" 12 | }, 13 | { 14 | "name": "libjpeg-turbo", 15 | "version>=": "2.1.5" 16 | }, 17 | { 18 | "name": "sdl2-image", 19 | "features": [ 20 | "libjpeg-turbo", 21 | "libwebp" 22 | ], 23 | "version>=": "2.6.3" 24 | }, 25 | { 26 | "name": "sdl2-mixer", 27 | "features": [ 28 | "libvorbis" 29 | ], 30 | "version>=": "2.6.3" 31 | }, 32 | { 33 | "name": "sdl2-ttf", 34 | "features": [ 35 | "harfbuzz" 36 | ], 37 | "version>=": "2.20.2" 38 | }, 39 | { 40 | "name": "lua", 41 | "version>=": "5.4.4#4" 42 | }, 43 | { 44 | "name": "libogg" 45 | } 46 | ], 47 | "$fuckMicrosoft": "see https://learn.microsoft.com/en-us/vcpkg/consume/lock-package-versions", 48 | "overrides": [ 49 | { 50 | "name": "sdl2", 51 | "version": "2.26.3#1" 52 | }, 53 | { 54 | "name": "bzip2", 55 | "version": "1.0.8#3" 56 | }, 57 | { 58 | "name": "libjpeg-turbo", 59 | "version": "2.1.5" 60 | }, 61 | { 62 | "name": "sdl2-image", 63 | "version": "2.6.3" 64 | }, 65 | { 66 | "name": "sdl2-mixer", 67 | "version": "2.6.3" 68 | }, 69 | { 70 | "name": "sdl2-ttf", 71 | "version": "2.20.2" 72 | }, 73 | { 74 | "name": "lua", 75 | "version": "5.4.4#4" 76 | } 77 | ], 78 | "name": "onscripter-yuri", 79 | "version": "0.1.0" 80 | } 81 | --------------------------------------------------------------------------------