Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compiling scripts feature, add support for decompiling 4.3 scripts #183

Merged
merged 34 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c062105
GodotVer: Add as_tag(), use "dev" for prerelease field
nikitalita Jan 23, 2024
7f0bbf3
Fix .app loading with CLI
nikitalita Jan 23, 2024
0fea0ea
fix zip project recovery
nikitalita Jan 23, 2024
442c2bb
Fail on loading pack if 2.1/3.1 patch can't be detected
nikitalita Jan 23, 2024
d6d484b
massive bytecode refactor
nikitalita Jan 23, 2024
bab00f4
Add script compile for all supported bytecode versions
nikitalita Jan 23, 2024
59bd6f1
fix release builds
nikitalita Feb 7, 2024
7fcb828
CI: update vulkan sdk to 1.3.250.1
nikitalita Feb 7, 2024
e3db099
fix `PackedFileInfo::fix_path()`
nikitalita Feb 7, 2024
4a07f0b
resync on master @ d3352813
nikitalita Mar 12, 2024
3dedb01
CI: use godot vulkan install script
nikitalita Mar 12, 2024
b939fd1
fix CI
nikitalita Apr 25, 2024
808dc9f
add prelim gdscript 2.0 support
nikitalita Aug 5, 2024
5cb8baf
Add 4.3.0-stable to bytecode-versions.json
nikitalita Sep 12, 2024
84e3e8e
resync master @ 72cff2ed591ca6da76ef287d2afcca35d59402df
nikitalita Sep 29, 2024
805aa42
fix file_exists() in FileAccessGDRE
nikitalita Sep 30, 2024
2751555
Add support for Text format 4 and Binary format 6
nikitalita Sep 30, 2024
47b87c6
Add 4.3 decompile support
nikitalita Sep 30, 2024
d52ffff
fix formatting on bytecode_generator
nikitalita Sep 30, 2024
ff9ed53
fix error message when setting bogus scene ids
nikitalita Sep 30, 2024
5751877
change CI to use new resync
nikitalita Sep 30, 2024
ac6ec3f
fix formatting
nikitalita Sep 30, 2024
1de8b82
fix ci
nikitalita Sep 30, 2024
89dfd66
fix compile on MSVC
nikitalita Sep 30, 2024
1267b79
fix CI
nikitalita Sep 30, 2024
17f56fe
fix ci
nikitalita Sep 30, 2024
5327f86
fix export
nikitalita Sep 30, 2024
f16539f
fix export ci
nikitalita Sep 30, 2024
ad7ad38
fix invalid dereference on shutdown
nikitalita Sep 30, 2024
7141d6f
fix export CI
nikitalita Sep 30, 2024
7b8a832
fix ci
nikitalita Sep 30, 2024
3f3ca55
REALLY FIX IT THIS TIME
nikitalita Sep 30, 2024
2f6713d
update bytecode history
nikitalita Sep 30, 2024
2d97210
fix crashes at start and exit
nikitalita Sep 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/actions/install-swiftshader/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ inputs:
default: false
vulkan_sdk_version:
description: If installing the SDK, which version to install
default: 1.3.204.1
default: 1.3.250.1

# backend:
# description: Vulkan or GLES.
Expand All @@ -27,9 +27,9 @@ runs:
shell: bash
if: inputs.install_vulkan_sdk == 'true'
run : |
wget "https://sdk.lunarg.com/sdk/download/${{ inputs.vulkan_sdk_version }}/mac/vulkansdk-macos-${{ inputs.vulkan_sdk_version }}.dmg?Human=true" -O vulkansdk.dmg
hdiutil attach vulkansdk.dmg
sudo /Volumes/vulkansdk-macos-${{ inputs.vulkan_sdk_version }}/InstallVulkan.app/Contents/MacOS/InstallVulkan --root $GITHUB_WORKSPACE/vulkansdk-macos-${{ inputs.vulkan_sdk_version }} --accept-licenses --default-answer --confirm-command install
wget "https://sdk.lunarg.com/sdk/download/${{ inputs.vulkan_sdk_version }}/mac/vulkansdk-macos-${{ inputs.vulkan_sdk_version }}.dmg?Human=true" -O vulkan-sdk.dmg
hdiutil attach vulkan-sdk.dmg
sudo /Volumes/vulkan-sdk/InstallVulkan.app/Contents/MacOS/InstallVulkan --root $GITHUB_WORKSPACE/vulkansdk-macos-${{ inputs.vulkan_sdk_version }} --accept-licenses --default-answer --confirm-command install
hdiutil detach /Volumes/vulkansdk-macos-${{ inputs.vulkan_sdk_version }}
echo "VULKAN_SDK_PATH=$GITHUB_WORKSPACE/vulkansdk-macos-${{ inputs.vulkan_sdk_version }}" >> $GITHUB_ENV
echo "VULKAN_SDK=$VULKAN_SDK_PATH/macOS" >> $GITHUB_ENV
Expand Down
55 changes: 31 additions & 24 deletions .github/workflows/all_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ on:
env:
GODOT_BASE_BRANCH: master
# Change the README too
GODOT_MAIN_SYNC_REF: daeb1c7292cbb426fd45c5ca98b1c7da40b390ba
GODOT_MAIN_SYNC_REF: 72cff2ed591ca6da76ef287d2afcca35d59402df
SCONSFLAGS: verbose=yes warnings=all werror=no module_text_server_fb_enabled=yes minizip=yes debug_symbols=no deprecated=yes
SCONSFLAGS_TEMPLATE: no_editor_splash=yes module_bmp_enabled=no module_camera_enabled=no module_cvtt_enabled=no module_mbedtls_enabled=no module_tga_enabled=no module_enet_enabled=no module_mobile_vr_enabled=no module_upnp_enabled=no module_noise_enabled=no module_websocket_enabled=no module_xatlas_unwrap_enabled=no module_squish_enabled=yes use_static_cpp=yes builtin_freetype=yes builtin_libpng=yes builtin_zlib=yes builtin_libwebp=yes builtin_libvorbis=yes builtin_libogg=yes module_csg_enabled=yes module_gridmap_enabled=yes disable_3d=no
SCONSFLAGS_TEMPLATE: no_editor_splash=yes module_camera_enabled=no module_mbedtls_enabled=no module_enet_enabled=no module_mobile_vr_enabled=no module_upnp_enabled=no module_noise_enabled=no module_websocket_enabled=no use_static_cpp=yes builtin_freetype=yes builtin_libpng=yes builtin_zlib=yes builtin_libwebp=yes builtin_libvorbis=yes builtin_libogg=yes module_csg_enabled=yes module_gridmap_enabled=yes disable_3d=no
SCONS_CACHE_MSVC_CONFIG: true

concurrency:
Expand Down Expand Up @@ -65,19 +65,19 @@ jobs:
platform: macos
sconsflags: use_volk=no vulkan_sdk_path=$VULKAN_SDK_PATH
sconsflags-template: optimize=size use_lto=yes use_volk=no vulkan_sdk_path=$VULKAN_SDK_PATH
command-export: ${env:GITHUB_WORKSPACE}/bin/godot.macos.editor.x86_64
command-export: ${env:GITHUB_WORKSPACE}/bin/godot.macos.editor.arm64
export-preset: "macOS"
export-name: .export/gdre_tools.universal.zip

steps:
- name: checkout-godot
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: godotengine/godot
ref: ${{env.GODOT_MAIN_SYNC_REF}}

- name: checkout-gdsdecomp
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: modules/gdsdecomp
fetch-depth: 0
Expand All @@ -87,31 +87,32 @@ jobs:
run: |
cp -R modules/gdsdecomp/.github/actions/* .github/actions/

- name: Setup Godot build cache
uses: ./.github/actions/godot-cache
- name: Restore Godot build cache
uses: ./.github/actions/godot-cache-restore
id: restore-cache
with:
cache-name: ${{ matrix.platform }}-editor-and-standalone
continue-on-error: true

# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Install Linux deps
if: matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \
libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev \
libudev-dev libxi-dev libxrandr-dev yasm clang-format-8
sudo apt-get install libwayland-bin

- name: Setup python and scons
uses: ./.github/actions/godot-deps

- name: Install Vulkan SDK
uses: ./.github/actions/install-swiftshader
- name: Setup Vulkan SDK
if: matrix.platform == 'macos'
with:
install_vulkan_sdk: true
install_swiftshader: false
run: |
sh misc/scripts/install_vulkan_sdk_macos.sh

- name: Compilation
- name: Compile Editor
id: compile-editor
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
Expand All @@ -123,13 +124,14 @@ jobs:
- name: Prepare artifact
uses: ./.github/actions/godot-prepare-artifact

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: GDRE_tools-editor-${{ matrix.platform }}
path: ${{github.workspace}}/bin/*
retention-days: 90

- name: Compile godot export template (x86_64)
id: compile-template
uses: ./.github/actions/godot-build
with:
sconsflags: arch=x86_64 ${{ env.SCONSFLAGS }} ${{ env.SCONSFLAGS_TEMPLATE }} ${{ matrix.sconsflags-template }}
Expand All @@ -148,6 +150,13 @@ jobs:
tests: false
scons-cache-limit: 4096

- name: Save Godot build cache
if: success() || (steps.restore-cache.outputs.cache-hit == 'false' && steps.compile-editor.outcome != 'skipped' )
uses: ./.github/actions/godot-cache-save
with:
cache-name: ${{ matrix.platform }}-editor-and-standalone
continue-on-error: true

- name: Prepare template artifact
uses: ./.github/actions/godot-prepare-artifact

Expand Down Expand Up @@ -180,16 +189,14 @@ jobs:
shell: pwsh
run: |
cd ${{github.workspace}}/modules/gdsdecomp/standalone
mkdir .export
$proc = Start-Process -NoNewWindow -PassThru -FilePath "${{ matrix.command-export }}" -ArgumentList '--headless -e --quit'
Wait-Process -Id $proc.id -Timeout 300
$proc = Start-Process -NoNewWindow -PassThru -FilePath "${{ matrix.command-export }}" -ArgumentList '--headless --export-release "${{ matrix.export-preset }}" ${{ matrix.export-name }}'
Wait-Process -Id $proc.id -Timeout 300
pwsh -File ${{github.workspace}}/modules/gdsdecomp/.scripts/export.ps1 "${{ matrix.export-preset }}" -path "${{ matrix.export-name }}"

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: GDRE_tools-standalone-${{ matrix.platform }}
path: ${{github.workspace}}/modules/gdsdecomp/standalone/.export/*
if-no-files-found: error
include-hidden-files: true
retention-days: 90

release:
Expand All @@ -200,17 +207,17 @@ jobs:
needs: build
steps:
- name: Download Linux artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: GDRE_tools-standalone-linux
path: artifacts/linux
- name: Download MacOS artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: GDRE_tools-standalone-macos
path: artifacts/macos
- name: Download Windows artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: GDRE_tools-standalone-windows
path: artifacts/windows
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/check_api_sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ env:
GODOT_BASE_BRANCH: master
GDSDECOMP_BASE_BRANCH: master
# Temp fix for check_api_sync, `disable_3d=yes` currently causes the build to fail on linux
SCONSFLAGS: debug_symbols=no warnings=extra optimize=size use_lto=yes disable_3d=no no_editor_splash=yes module_bmp_enabled=no module_bullet_enabled=no module_camera_enabled=no module_csg_enabled=no module_cvtt_enabled=no module_mbedtls_enabled=no module_tga_enabled=no module_enet_enabled=no module_mobile_vr_enabled=no module_upnp_enabled=no module_gdnative_enabled=no module_opensimplex_enabled=no module_pvr_enabled=no module_webm_enabled=no module_websocket_enabled=no module_gridmap_enabled=no module_xatlas_unwrap_enabled=no module_squish_enabled=no use_static_cpp=yes builtin_freetype=yes builtin_libpng=yes builtin_zlib=yes
SCONSFLAGS: verbose=yes warnings=all werror=no module_text_server_fb_enabled=yes minizip=yes debug_symbols=no deprecated=yes
SCONSFLAGS_TEMPLATE: no_editor_splash=yes module_camera_enabled=no module_mbedtls_enabled=no module_enet_enabled=no module_mobile_vr_enabled=no module_upnp_enabled=no module_noise_enabled=no module_websocket_enabled=no use_static_cpp=yes builtin_freetype=yes builtin_libpng=yes builtin_zlib=yes builtin_libwebp=yes builtin_libvorbis=yes builtin_libogg=yes module_csg_enabled=yes module_gridmap_enabled=yes disable_3d=no
jobs:
check:
name: "Test master API Sync"
Expand Down Expand Up @@ -50,6 +51,7 @@ jobs:
sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \
libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev \
libudev-dev libxi-dev libxrandr-dev yasm clang-format-8
sudo apt-get install libwayland-bin

- name: Setup Godot build cache
uses: ./.github/actions/godot-cache
Expand All @@ -63,9 +65,8 @@ jobs:
- name: Compilation
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
sconsflags: ${{ env.SCONSFLAGS }} ${{ env.SCONSFLAGS_TEMPLATE }}
platform: ${{ matrix.platform }}
target: ${{ matrix.target }}
tools: ${{ matrix.tools }}
tests: ${{ matrix.tests }}
scons-cache-limit: 4096
119 changes: 119 additions & 0 deletions .scripts/export.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
echo "Exporting standalone project"
# check if the args are less than 1
if ($args.Length -lt 1) {
$script_name = $MyInvocation.MyCommand.Name
echo "Usage: $script_name <export_preset> [-cmd <export_command>] [-path <export_path>]"
exit 1
}

$export_preset = $args[0]

$export_command = ""
$export_path = ""

# check if the args are more than 1
if ($args.Length -gt 1) {
for ($i = 1; $i -lt $args.Length; $i++) {
$arg = $args[$i]
switch ($arg) {
"-cmd" {
$i++
$export_command = $args[$i]
}
"-path" {
$i++
$export_path = $args[$i]
}
default {
echo "Unknown argument: $arg"
exit 1
}
}
}
}

if ($export_path -ne "") {
# check if it is an absolute path; if not, make it absolute
if (-not ([System.IO.Path]::IsPathRooted($export_path))) {
$curr_dir = Get-Location
$export_path = Join-Path $curr_dir $export_path
}
}

# get the current script path
$scriptPath = $MyInvocation.MyCommand.Path
$scriptDir = Split-Path $scriptPath
$scriptDir = $scriptDir -replace '\\', '/'
$standaloneDir = $scriptDir -replace '/.scripts', '/standalone'
# we're in ${workspaceDir}/modules/gdsdecomp/.scripts, need to be in ${workspaceDir}/bin
$godotBinDir = $scriptDir -replace '/modules/gdsdecomp/.scripts', '/bin'

# check if $export_command is empty
if ($export_command -eq "") {
$godotEditor = Get-ChildItem $godotBinDir -Filter "*editor*" -Recurse | Sort-Object LastWriteTime -Descending | Select-Object -First 1
if ($godotEditor -eq $null) {
echo "Godot editor path not given and not found in $godotBinDir"
exit 1
}
# get the path of the godot executable
$export_command = $godotEditor.FullName
}

cd $standaloneDir
if ($export_path -ne "") {
$export_dir = Split-Path $export_path
} else {
$export_dir = ".export"
}
mkdir -p $export_dir

$version = $(git describe --tags --abbrev=6) -replace '^v', ''
$number_only_version = $version -split '-', 2 | Select-Object -First 1
# if the version is like 0.6.2-42-g17f56f, we want the number in-between the '-' (e.g. 42)
$build_num = $version -split '-', 3 | Select-Object -Index 1
if ($build_num -eq $null) {
$build_num = 0
}
$version = $version -replace 'v', ''


echo "Godot editor binary: $export_command"
echo "Export preset: $export_preset"
$echoed_path = $export_path
if ($export_path -eq "") {
$echoed_path = "<DEFAULT>"
}
echo "Export path: $echoed_path"
echo "Version: $version"
echo "Number only version: $number_only_version"
echo "Build number: $build_num"

$export_presets = Get-Content export_presets.cfg
$export_presets = $export_presets -replace 'application/short_version=".*"', "application/short_version=""$version"""
$export_presets = $export_presets -replace 'application/version=".*"', "application/version=""$version"""
$export_presets = $export_presets -replace 'application/file_version=".*"', "application/file_version=""$number_only_version.$build_num"""
$export_presets = $export_presets -replace 'application/product_version=".*"', "application/product_version=""$number_only_version.$build_num"""

#output the processed export_presets.cfg
$export_presets | Set-Content export_presets.cfg

# turn echo on

$ErrorActionPreference = "Stop"

echo "running: $export_command --headless -e --quit"
Set-PSDebug -Trace 1
$proc = Start-Process -NoNewWindow -PassThru -FilePath "$export_command" -ArgumentList '--headless -e --quit'
Wait-Process -Id $proc.id -Timeout 300
Set-PSDebug -Trace 0
$export_args = "--headless --export-release `"$export_preset`" `"$export_path`""
echo "running: $export_command $export_args"
Set-PSDebug -Trace 1
$proc = Start-Process -NoNewWindow -PassThru -FilePath "$export_command" -ArgumentList "$export_args"
Wait-Process -Id $proc.id -Timeout 300
Set-PSDebug -Trace 0
# list the exported files in the $export_dir
echo "Exported files:"
Get-ChildItem $export_dir -Recurse | ForEach-Object {
echo $_.FullName
}
12 changes: 7 additions & 5 deletions BYTECODE_HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@

### Branch 4.0 (master)

| Release | Commit | Date | Bytecode | Changes |
| ------------------------- | -------------------------------------------------------------- | ------------ | ---------------- | --------------------------------------------------------------- |
| | [506df14](https://github.com/godotengine/godot/commit/506df14) | `2020.02.12` | 13 | Removed `decimals` function |
| | [f3f05dc](https://github.com/godotengine/godot/commit/f3f05dc) | `2020.02.13` | 13 | Removed `SYNC` and `SLAVE` tokens |
| GDScript 2.0 | [5d6e853](https://github.com/godotengine/godot/commit/5d6e853) | `2020.07.24` | N/A | **Compiled mode is not implemented yet** |

| Release | Commit | Date | Bytecode | Changes |
| ------------ | -------------------------------------------------------------- | ------------ | -------- | ------------------------------------------- |
| | [506df14](https://github.com/godotengine/godot/commit/506df14) | `2020.02.12` | 13 | Removed `decimals` function |
| | [f3f05dc](https://github.com/godotengine/godot/commit/f3f05dc) | `2020.02.13` | 13 | Removed `SYNC` and `SLAVE` tokens |
| GDScript 2.0 | [5d6e853](https://github.com/godotengine/godot/commit/5d6e853) | `2020.07.24` | N/A | **Compiled mode not implemented until 4.3** |
| **4.3** | [77af6ca](https://github.com/godotengine/godot/commit/77af6ca) | `2024.02.09` | 100 | Added compiled mode |
Loading
Loading