diff --git a/.github/workflows/APK.yml b/.github/workflows/APK.yml new file mode 100644 index 00000000..9eb657c0 --- /dev/null +++ b/.github/workflows/APK.yml @@ -0,0 +1,75 @@ +name: Mobile Release + +on: + workflow_dispatch: + inputs: + tag_name: + description: "Release tag (e.g. `v0.0.3 or bugfix`)" + required: true + prerelease: + description: 'Mark as a pre-release? (true/false)' + default: 'false' + required: false + +permissions: + contents: write + +env: + TAG_NAME: ${{ github.event.inputs.tag_name }} + +jobs: + create-nightly-tag: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Create and push tag + run: | + git config --global user.name "${{ github.actor }}" + git config --global user.email "${{ github.actor }}@users.noreply.github.com" + git tag ${{ env.TAG_NAME }} + git push origin ${{ env.TAG_NAME }} + + build: + name: Build + needs: create-nightly-tag + uses: ./.github/workflows/APK.yml + with: + buildFlags: officialBuild + + release-android: + name: Release Android Build + needs: [build] + runs-on: ubuntu-latest + steps: + - name: Download Android artifact + uses: actions/download-artifact@main + with: + name: androidBuild + - name: Upload Android Build to Release + uses: svenstaro/upload-release-action@2.5.0 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ env.TAG_NAME }} + file: Expung-engine-release.apk + asset_name: FNF-expunged-Engine.apk + overwrite: false + + release-ios: + name: Release iOS Build + needs: [build] + runs-on: ubuntu-latest + steps: + - name: Download iOS artifact + uses: actions/download-artifact@main + with: + name: iOSBuild + - name: Upload iOS Build to Release + uses: svenstaro/upload-release-action@2.5.0 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ env.TAG_NAME }} + file: JSEngine.ipa + asset_name: FNF-expungeg-engine.ipa + overwrite: false diff --git a/.github/workflows/Android.yml b/.github/workflows/Android.yml new file mode 100644 index 00000000..90851cfd --- /dev/null +++ b/.github/workflows/Android.yml @@ -0,0 +1,145 @@ +name: Psych Engine Android 12 + +on: + push: + branches: [ main ] + workflow_dispatch: + +jobs: + android: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + + - name: Java 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Haxe 4.3.5 + uses: krdlab/setup-haxe@v1 + with: + haxe-version: 4.3.5 + + - name: Haxelib +name: Build Psych Engine 1.0.4 Android APK + +on: + push: + branches: [ 1.0.4 ] + workflow_dispatch: # permite rodar manual + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: 1.0.4 + fetch-depth: 0 + + - name: Install Haxe 4.3.2 + uses: funkincrew/ci-haxe@v3.1.0 + with: + haxe-version: 4.3.2 + + - name: Setup Haxelib + run: | + mkdir ~/haxelib + haxelib setup ~/haxelib + + - name: Install System Dependencies + run: | + sudo apt update + sudo apt install -y clang build-essential libc6-dev g++ make libssl-dev git cmake pkg-config libboost-all-dev libstdc++6 libc++-dev libc++abi-dev + + - name: Install Haxe Libs (Psych 1.0.4) + run: | + haxelib install hxcpp 4.3.2 + haxelib set hxcpp 4.3.2 + haxelib install lime openfl flixel flixel-addons flixel-ui hscript newgrounds hxCodec Brewscript + haxelib run lime setup flixel + haxelib install flixel-tools + haxelib run flixel-tools setup + # Git libs exatas pro 1.0.4 + haxelib git polymod https://github.com/larsiusprime/polymod.git + haxelib git discord_rpc https://github.com/Aidan63/linc_discord-rpc + haxelib git flixel-addons https://github.com/HaxeFlixel/flixel-addons + haxelib git linc_luajit https://github.com/superpowers04/linc_luajit + haxelib git hxCodec https://github.com/polybiusproxy/hxCodec.git + haxelib git flxanimate https://github.com/ShadowMario/flxanimate dev + haxelib git flxanimate https://github.com/Dot-Stuff/flxanimate 768740a56b26aa0c072720e0d1236b94afe68e3e + haxelib git linc_luajit https://github.com/superpowers04/linc_luajit.git + haxelib git funkin.vis https://github.com/FunkinCrew/funkVis 22b1ce089dd924f15cdc4632397ef3504d464e90 + haxelib git grig.audio https://gitlab.com/haxe-grig/grig.audio.git cbf91e2180fd2e374924fe74844086aab7891666 + # Sets exatos + haxelib set flixel 5.6.1 + haxelib set flixel-addons 3.2.2 + haxelib set flixel-tools 1.5.1 + haxelib set hxvlc 2.0.1 + haxelib set lime 8.1.2 + haxelib set openfl 9.3.3 + haxelib set tjson 1.4.0 + haxelib set hxdiscord_rpc 1.2.4 + haxelib set hxcpp-debug-server 1.2.4 + + - name: Run Psych Setup + run: bash setup/unix.sh + + - name: Setup JDK 11 + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 11 + + - name: Setup Android SDK/NDK (compatível com Psych) + uses: android-actions/setup-android@v3 + with: + api-level: 31 + ndk-version: r21e # Essencial pro hxcpp 4.3.2! + components: build-tools-31.0.0 + + - name: Configure Android Paths + run: | + mkdir -p $HOME/.android + echo 'sdk.dir=$ANDROID_SDK_ROOT' > $HOME/.android/repositories.cfg + echo 'ndk.dir=$ANDROID_NDK_ROOT' >> $HOME/.android/repositories.cfg + export ANDROID_HOME=$ANDROID_SDK_ROOT + export ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT + export JAVA_HOME=$JAVA_HOME + export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$ANDROID_NDK_ROOT + + - name: Lime Setup Android + run: | + haxelib run lime setup android -- --ANDROID_SDK=$ANDROID_SDK_ROOT --ANDROID_NDK_DIR=$ANDROID_NDK_ROOT --JAVA_HOME=$JAVA_HOME + haxelib run lime config ANDROID_SETUP true + + - name: Build APK Release + run: | + haxelib run lime build android -release + + - name: Upload APK Artifact + uses: actions/upload-artifact@v4 + with: + name: psych-engine-1.0.4-apk + path: export/android/bin/*.apk + retention-days: 30 + sdkmanager "platforms;android-31" \ + "build-tools;31.0.0" \ + "ndk;23.2.8568313" + + - name: Build APK (Android 12) + run: | + export ANDROID_SDK_ROOT=$ANDROID_HOME + export ANDROID_NDK_ROOT=$ANDROID_HOME/ndk/23.2.8568313 + lime build android -debug + + - name: Upload APK + uses: actions/upload-artifact@v4 + with: + name: PsychEngine-Android12 + path: export/android/bin/app/build/outputs/apk/debug/*.apk diff --git a/assets/base_game/shared/weeks/tutorial.json b/assets/base_game/shared/weeks/tutorial.json deleted file mode 100644 index 6ac6083f..00000000 --- a/assets/base_game/shared/weeks/tutorial.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "songs": [ - ["Tutorial", "gf", [165, 0, 77]] - ], - - "weekCharacters": [ - "", - "bf", - "gf" - ], - "weekBackground": "stage", - - "storyName": "", - "weekBefore": "tutorial", - "weekName": "Tutorial", - "startUnlocked": true, - - "hideStoryMode": false, - "hideFreeplay": false -} diff --git a/assets/base_game/shared/weeks/week1.json b/assets/base_game/shared/weeks/week1.json deleted file mode 100644 index 1ff2b009..00000000 --- a/assets/base_game/shared/weeks/week1.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "songs": [ - ["Bopeebo", "dad", [146, 113, 253]], - ["Fresh", "dad", [146, 113, 253]], - ["Dad Battle", "dad", [146, 113, 253]] - ], - - "weekCharacters": [ - "dad", - "bf", - "gf" - ], - "weekBackground": "stage", - - "storyName": "Daddy Dearest", - "weekBefore": "tutorial", - "weekName": "Week 1", - "startUnlocked": true, - - "hideStoryMode": false, - "hideFreeplay": false -} \ No newline at end of file diff --git a/assets/base_game/shared/weeks/week2.json b/assets/base_game/shared/weeks/week2.json deleted file mode 100644 index 54f06390..00000000 --- a/assets/base_game/shared/weeks/week2.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "songs": [ - ["Spookeez", "spooky", [34, 51, 68]], - ["South", "spooky", [34, 51, 68]], - ["Monster", "monster", [34, 51, 68]] - ], - - "weekCharacters": [ - "spooky", - "bf", - "gf" - ], - "weekBackground": "halloween", - - "storyName": "Spooky Month", - "weekBefore": "week1", - "weekName": "Week 2", - "startUnlocked": true, - - "hideStoryMode": false, - "hideFreeplay": false -} \ No newline at end of file diff --git a/assets/base_game/shared/weeks/week3.json b/assets/base_game/shared/weeks/week3.json deleted file mode 100644 index 3a86b4c3..00000000 --- a/assets/base_game/shared/weeks/week3.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "songs": [ - ["Pico", "pico", [148, 22, 83]], - ["Philly Nice", "pico", [148, 22, 83]], - ["Blammed", "pico", [148, 22, 83]] - ], - - "weekCharacters": [ - "pico", - "bf", - "gf" - ], - "weekBackground": "philly", - - "storyName": "PICO", - "weekBefore": "week2", - "weekName": "Week 3", - "startUnlocked": true, - - "hideStoryMode": false, - "hideFreeplay": false -} \ No newline at end of file diff --git a/assets/base_game/shared/weeks/week4.json b/assets/base_game/shared/weeks/week4.json deleted file mode 100644 index c7198563..00000000 --- a/assets/base_game/shared/weeks/week4.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "songs": [ - ["Satin Panties", "mom", [252, 150, 215]], - ["High", "mom", [252, 150, 215]], - ["Milf", "mom", [252, 150, 215]] - ], - - "weekCharacters": [ - "mom", - "bf", - "gf" - ], - "weekBackground": "limo", - - "storyName": "MOMMY MUST MURDER", - "weekBefore": "week3", - "weekName": "Week 4", - "startUnlocked": true, - - "hideStoryMode": false, - "hideFreeplay": false -} \ No newline at end of file diff --git a/assets/base_game/shared/weeks/week5.json b/assets/base_game/shared/weeks/week5.json deleted file mode 100644 index 6d4102f7..00000000 --- a/assets/base_game/shared/weeks/week5.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "songs": [ - ["Cocoa", "parents", [160, 209, 255]], - ["Eggnog", "parents", [160, 209, 255]], - ["Winter Horrorland", "monster", [160, 209, 255]] - ], - - "weekCharacters": [ - "parents-christmas", - "bf", - "gf" - ], - "weekBackground": "christmas", - - "storyName": "RED SNOW", - "weekBefore": "week4", - "weekName": "Week 5", - "startUnlocked": true, - - "hideStoryMode": false, - "hideFreeplay": false -} \ No newline at end of file diff --git a/assets/base_game/shared/weeks/week6.json b/assets/base_game/shared/weeks/week6.json deleted file mode 100644 index 95c735d6..00000000 --- a/assets/base_game/shared/weeks/week6.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "songs": [ - ["Senpai", "senpai-pixel", [255, 120, 191]], - ["Roses", "senpai-pixel", [255, 120, 191]], - ["Thorns", "spirit-pixel", [255, 120, 191]] - ], - - "weekCharacters": [ - "senpai", - "bf", - "gf" - ], - "weekBackground": "school", - - "storyName": "hating simulator ft. moawling", - "weekBefore": "week5", - "weekName": "Week 6", - "startUnlocked": true, - - "hideStoryMode": false, - "hideFreeplay": false -} \ No newline at end of file diff --git a/assets/base_game/shared/weeks/week7.json b/assets/base_game/shared/weeks/week7.json deleted file mode 100644 index c0f69205..00000000 --- a/assets/base_game/shared/weeks/week7.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "songs": [ - [ - "Ugh", - "tankman", - [ - 246, - 182, - 4 - ] - ], - [ - "Guns", - "tankman", - [ - 246, - 182, - 4 - ] - ], - [ - "Stress", - "tankman", - [ - 246, - 182, - 4 - ] - ] - ], - "hideFreeplay": false, - "weekBackground": "tank", - "weekCharacters": [ - "tankman", - "bf", - "gf" - ], - "storyName": "Tankman", - "weekName": "Week 7", - "freeplayColor": [ - 146, - 113, - 253 - ], - "hideStoryMode": false, - "weekBefore": "week6", - "startUnlocked": true -} \ No newline at end of file diff --git a/assets/base_game/shared/weeks/weekend1.json b/assets/base_game/shared/weeks/weekend1.json deleted file mode 100644 index 856d66e8..00000000 --- a/assets/base_game/shared/weeks/weekend1.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "songs": [ - ["Darnell", "darnell", [65, 60, 174]], - ["Lit Up", "darnell", [65, 60, 174]], - ["2Hot", "darnell", [65, 60, 174]], - ["Blazin", "darnell", [65, 60, 174]] - ], - - "weekCharacters": [ - "darnell", - "pico-player", - "nene" - ], - "weekBackground": "phillystreets", - - "storyName": "Due Debts", - "weekBefore": "", - "weekName": "Weekend 1", - "startUnlocked": true, - - "hideStoryMode": false, - "hideFreeplay": false, - "difficulties": "Easy, Normal, Hard" -} \ No newline at end of file diff --git a/example_mods/modTemplate.zip b/example_mods/modTemplate.zip deleted file mode 100644 index 21ef6c95..00000000 Binary files a/example_mods/modTemplate.zip and /dev/null differ diff --git a/example_mods/readme.txt b/example_mods/readme.txt deleted file mode 100644 index 4162b894..00000000 --- a/example_mods/readme.txt +++ /dev/null @@ -1,13 +0,0 @@ -Psych's mods/ folder. - -If you're a beginner, we recommend you extract modTemplate.zip to get started on developing your mod. -Read the Psych GitHub wiki here: -https://github.com/ShadowMario/FNF-PsychEngine/wiki -Read the Lua Script API here: -https://shadowmario.github.io/psychengine.lua/ - -You can also add or edit specific files without the mod template, you just have to re-create the path to said file. - -ABOUT EDITING: -If you want to change something, for example, within assets/shared/images or assets/base_game/images, -said edited files *must* be put in mods/images, the engine will handle the rest. \ No newline at end of file diff --git a/source/render/VideoRenderState.hx b/source/render/VideoRenderState.hx new file mode 100644 index 00000000..c3c5f9b7 --- /dev/null +++ b/source/render/VideoRenderState.hx @@ -0,0 +1,67 @@ +package render; + +import flixel.FlxG; +import flixel.FlxState; +import openfl.display.BitmapData; +import openfl.display.PNGEncoderOptions; +import sys.io.File; +import sys.FileSystem; +import openfl.utils.ByteArray; + +class VideoRenderState extends FlxState +{ + public static var enabled:Bool = false; + public static var fps:Int = 60; + public static var frameCount:Int = 0; + + override public function create() + { + super.create(); + + if (enabled) + { + FlxG.updateFramerate = fps; + FlxG.drawFramerate = fps; + + if (!FileSystem.exists("gameRenders")) + FileSystem.createDirectory("gameRenders"); + } + } + + override public function draw() + { + super.draw(); + + if (enabled) + { + saveFrame(); + } + } + + static function saveFrame() + { + var bmp:BitmapData = new BitmapData( + FlxG.width, + FlxG.height, + false, + 0xFF000000 + ); + + bmp.draw(FlxG.stage); + + var bytes:ByteArray = bmp.encode( + bmp.rect, + new PNGEncoderOptions() + ); + + var name:String = StringTools.lpad( + Std.string(frameCount), + "0", + 6 + ); + + File.saveBytes("gameRenders/frame_" + name + ".png", bytes); + frameCount++; + bmp.dispose(); + } +}