├── .github ├── nim.json └── workflows │ └── CI.yml ├── CNAME ├── README.md ├── _config.yml ├── packages.json └── scripts └── Invoke-NativeCommand.ps1 /.github/nim.json: -------------------------------------------------------------------------------- 1 | { 2 | "problemMatcher": [ 3 | { 4 | "owner": "nim", 5 | "pattern": [ 6 | { 7 | "regexp": "^(.+)\\((\\d+),\\s(\\d+)\\)\\s(Error|Warning|Hint):\\s(.+)$", 8 | "file": 1, 9 | "line": 2, 10 | "column": 3, 11 | "severity": 4, 12 | "message": 5 13 | } 14 | ] 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /.github/workflows/CI.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: CI 4 | 5 | env: 6 | bds_version: 1.16.201.02 7 | nim_version: 1.4.2 8 | 9 | on: 10 | push: 11 | branches: 12 | - main 13 | repository_dispatch: 14 | types: [build] 15 | 16 | jobs: 17 | build: 18 | runs-on: windows-latest 19 | steps: 20 | - name: Checkout scripts 21 | uses: actions/checkout@v2 22 | - name: Checkout snapshot 23 | uses: actions/checkout@v2 24 | with: 25 | repository: Element-0/snapshot 26 | path: snapshot 27 | submodules: recursive 28 | token: ${{ secrets.PUSH_SNAPSHOT_TOKEN }} 29 | - name: Setup git user 30 | run: | 31 | . .\scripts\Invoke-NativeCommand.ps1 32 | Push-Location snapshot 33 | Invoke-NativeCommand { git config --local user.name "GitHub Actions" } 34 | Invoke-NativeCommand { git config --local user.email "actions@users.noreply.github.com" } 35 | Pop-Location 36 | - name: Write version info 37 | run: | 38 | Push-Location snapshot 39 | [pscustomobject]@{ 40 | bedrock_server = "${{ env.bds_version }}" 41 | nim = "${{ env.nim_version }}" 42 | } | ConvertTo-Json | Out-File -Encoding utf8 version 43 | Pop-Location 44 | - name: Fetch latest version 45 | id: fetch-snapshot 46 | run: | 47 | . .\scripts\Invoke-NativeCommand.ps1 48 | Push-Location snapshot 49 | Write-Output "::group::Pull from github" 50 | Invoke-NativeCommand { git submodule update --remote } 51 | Write-Output "::endgroup::" 52 | $ChangedFiles = git status --porcelain | measure | select -expand Count 53 | if ($ChangedFiles -gt 0) { 54 | Write-Output "::group::Create commit" 55 | $CurrentDateTime = Get-Date -Format o -AsUTC 56 | Invoke-NativeCommand { git diff } 57 | Invoke-NativeCommand { git add . } 58 | Invoke-NativeCommand { git commit -m "Snapshot from $CurrentDateTime" } 59 | echo "::set-output name=updated::true" 60 | Write-Output "::endgroup::" 61 | } 62 | $hash = git log -1 --pretty=format:%h 63 | echo "::set-output name=hash::$hash" 64 | Pop-Location 65 | - name: Download rcedit.exe 66 | uses: robinraju/release-downloader@v1 67 | with: 68 | repository: electron/rcedit 69 | latest: true 70 | fileName: rcedit-x64.exe 71 | out-file-path: ${{ runner.tool_cache }}/rcedit 72 | - name: Setup rcedit 73 | run: | 74 | Rename-Item ${{ runner.tool_cache }}\rcedit\rcedit-x64.exe ${{ runner.tool_cache }}\rcedit\rcedit.exe 75 | Write-Output "${{ runner.tool_cache }}\rcedit" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append 76 | - name: Set up Visual Studio shell 77 | uses: egor-tensin/vs-shell@v2 78 | - name: Install nim 79 | uses: jiro4989/setup-nim-action@v1 80 | with: 81 | nim-version: ${{ env.nim_version }} 82 | - name: Setup nim problem matcher 83 | run: | 84 | echo "::add-matcher::.github/nim.json" 85 | - name: Refresh package repo 86 | id: nimble-refresh 87 | run: | 88 | . .\scripts\Invoke-NativeCommand.ps1 89 | Invoke-NativeCommand { nimble.exe refresh } 90 | $PackageHash = Get-FileHash ~\.nimble\packages_official.json | select -expand Hash 91 | echo "::set-output name=hash::$PackageHash" 92 | - name: Cache nimble 93 | uses: actions/cache@v2 94 | id: nimble-cache 95 | with: 96 | path: | 97 | ~/.nimble 98 | !~/.nimble/pkgs/ezchakra-* 99 | key: nimble-${{ steps.fetch-snapshot.outputs.hash }}-${{ steps.nimble-refresh.outputs.hash }} 100 | - name: Install dependencies 101 | if: steps.nimble-cache.outputs.cache-hit != 'true' 102 | run: | 103 | . .\scripts\Invoke-NativeCommand.ps1 104 | Push-Location snapshot 105 | $Folders = .\Get-InstallOrder.ps1 106 | foreach ($Folder in $Folders) { 107 | Write-Output "::group::Install $Folder" 108 | Push-Location $Folder 109 | Invoke-NativeCommand { nimble.exe install --cc:vcc } 110 | Pop-Location 111 | Write-Output "::endgroup::" 112 | } 113 | Write-Output "::group::Install ezmgr" 114 | Push-Location packages\ezmgr 115 | Invoke-NativeCommand { nimble.exe install --cc:vcc --passC:-MD --debuginfo:on } 116 | Pop-Location 117 | Write-Output "::endgroup::" 118 | - name: Build and install chakra.dll 119 | run: | 120 | . .\scripts\Invoke-NativeCommand.ps1 121 | Push-Location snapshot\packages\chakra 122 | Invoke-NativeCommand { nimble.exe install -y } 123 | Pop-Location 124 | - name: Cache BDS 125 | uses: actions/cache@v2 126 | id: bds-cache 127 | with: 128 | path: base 129 | key: bds-${{ env.bds_version }} 130 | - name: Download BDS 131 | if: steps.bds-cache.outputs.cache-hit != 'true' 132 | run: | 133 | $tmp = New-TemporaryFile | Rename-Item -NewName { $_ -replace 'tmp$', 'zip' } –PassThru 134 | $url = "https://minecraft.azureedge.net/bin-win/bedrock-server-${{ env.bds_version }}.zip" 135 | Invoke-WebRequest -OutFile $tmp $url 136 | $tmp | Expand-Archive -DestinationPath base 137 | - name: Generate Symbol Database 138 | run: | 139 | . .\scripts\Invoke-NativeCommand.ps1 140 | Push-Location base 141 | Write-Output "::group::Creating db" 142 | Invoke-NativeCommand { ezpdbparser.cmd bedrock_server.pdb --database:bedrock_server.db } 143 | Write-Output "::endgroup::" 144 | Pop-Location 145 | - name: Create dist 146 | run: | 147 | function Copy-Item-Display($src, $dst) { 148 | Write-Output "::group::copy $src $dst" 149 | Copy-Item $src $dst 150 | Write-Output "::endgroup::" 151 | } 152 | function Get-Nimble-Path($name) { 153 | (nimble.exe path $name).trim() 154 | } 155 | function Copy-Nimble-Artifact($name) { 156 | Get-Nimble-Path $name | 157 | Get-ChildItem | 158 | Where-Object { $_.Extension -in '.dll', '.pdb', '.exe' } | 159 | Foreach-Object { Copy-Item-Display $_ (Join-Path "dist\" $_.Name) } 160 | } 161 | New-Item -Name "dist" -ItemType "directory" | OUt-Null 162 | Copy-Item-Display base\bedrock_server.db dist\bedrock_server.db 163 | Copy-Nimble-Artifact ezmodutils 164 | Copy-Nimble-Artifact ezchakra 165 | Copy-Nimble-Artifact ezmgr 166 | - name: Upload dist 167 | uses: actions/upload-artifact@v2 168 | with: 169 | name: dist-${{ steps.fetch-snapshot.outputs.hash }} 170 | path: dist/ 171 | - name: Update snapshot 172 | if: success() && steps.fetch-snapshot.outputs.updated 173 | run: | 174 | Push-Location snapshot 175 | git push 176 | Pop-Location 177 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | element-0.win -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ElementZero Redesigned 2 | 3 | STATE: WIP 4 | 5 | [Nim package list](packages.json) 6 | 7 | ## Features 8 | 9 | 1. (Built-in feature) Seprated data folder 10 | 2. (**TODO**) Mod loading and configuation 11 | 3. (**TODO**) Mod and configuation manager (GUI and CLI) 12 | 4. (**TODO**) Remote control interface (WEB) 13 | 14 | ## How to build and install 15 | 16 | 0. Prepare bedrock server from official website 17 | 1. Install msvc with clang_cl support 18 | 2. Install nim 1.4.2 19 | 3. Append 20 | ``` 21 | [PackageList] 22 | name = "ElementZero" 23 | url = "https://element-0.win/packages.json" 24 | ``` 25 | into %APPDATA%\nimble\nimble.ini 26 | 4. Run `nimble refresh` 27 | 5. Run `nimble install ezchakra` in vs environment (x64 Native Tools Command Prompt for VS 2019) 28 | 6. Copy dll/pdb from `nim path ezchakra` to bds folder 29 | 7. Run `ezpdbparser bedrock_server.pdb --database:bedrock_server.db` in bds folder (with x64 Native Tools Command Prompt for VS 2019) 30 | 8. Done -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-modernist -------------------------------------------------------------------------------- /packages.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "ezutils", 4 | "url": "https://github.com/Element-0/utils.git", 5 | "method": "git", 6 | "tags": [ 7 | "elementzero", 8 | "ezlib" 9 | ], 10 | "description": "Common code for ElementZero", 11 | "license": "LGPL-3.0", 12 | "web": "https://github.com/Element-0/utils" 13 | }, 14 | { 15 | "name": "cppinterop", 16 | "url": "https://github.com/Element-0/cppinterop.git", 17 | "method": "git", 18 | "tags": [ 19 | "elementzero", 20 | "ezlib", 21 | "cpp" 22 | ], 23 | "description": "C++ interop for ElementZero", 24 | "license": "LGPL-3.0", 25 | "web": "https://github.com/Element-0/cppinterop" 26 | }, 27 | { 28 | "name": "ezprompt", 29 | "url": "https://github.com/Element-0/nim-prompt.git", 30 | "method": "git", 31 | "tags": [ 32 | "elementzero", 33 | "ezlib", 34 | "cli", 35 | "prompt" 36 | ], 37 | "description": "Feature-rich readline replacement for ElementZero", 38 | "license": "BSD", 39 | "web": "https://github.com/Element-0/nim-prompt" 40 | }, 41 | { 42 | "name": "ezfunchook", 43 | "url": "https://github.com/Element-0/funchook.git", 44 | "method": "git", 45 | "tags": [ 46 | "elementzero", 47 | "ezlib", 48 | "funchook" 49 | ], 50 | "description": "FuncHook for ElementZero", 51 | "license": "LGPL-3.0", 52 | "web": "https://github.com/Element-0/funchook" 53 | }, 54 | { 55 | "name": "ntapi", 56 | "url": "https://github.com/Element-0/ntapi.git", 57 | "method": "git", 58 | "tags": [ 59 | "elementzero", 60 | "ezlib", 61 | "windows" 62 | ], 63 | "description": "NTAPI for ElementZero", 64 | "license": "LGPL-3.0", 65 | "web": "https://github.com/Element-0/ntapi" 66 | }, 67 | { 68 | "name": "ezsqlite3", 69 | "url": "https://github.com/Element-0/sqlite3.git", 70 | "method": "git", 71 | "tags": [ 72 | "elementzero", 73 | "ezlib", 74 | "sqlite3" 75 | ], 76 | "description": "SQLite3 for ElementZero", 77 | "license": "LGPL-3.0", 78 | "web": "https://github.com/Element-0/sqlite3" 79 | }, 80 | { 81 | "name": "ezxmlcfg", 82 | "url": "https://github.com/Element-0/xmlcfg.git", 83 | "method": "git", 84 | "tags": [ 85 | "elementzero", 86 | "ezlib" 87 | ], 88 | "description": "XMLCFG for ElementZero", 89 | "license": "LGPL-3.0", 90 | "web": "https://github.com/Element-0/xmlcfg" 91 | }, 92 | { 93 | "name": "ezcurl", 94 | "url": "https://github.com/Element-0/curl.git", 95 | "method": "git", 96 | "tags": [ 97 | "elementzero", 98 | "ezlib" 99 | ], 100 | "description": "Curl bindings for ElementZero", 101 | "license": "LGPL-3.0", 102 | "web": "https://github.com/Element-0/curl" 103 | }, 104 | { 105 | "name": "ezcommon", 106 | "url": "https://github.com/Element-0/common.git", 107 | "method": "git", 108 | "tags": [ 109 | "elementzero", 110 | "ezlib" 111 | ], 112 | "description": "Shared code for ElementZero", 113 | "license": "LGPL-3.0", 114 | "web": "https://github.com/Element-0/common" 115 | }, 116 | { 117 | "name": "binpak", 118 | "url": "https://github.com/Element-0/binpak.git", 119 | "method": "git", 120 | "tags": [ 121 | "elementzero", 122 | "ezlib" 123 | ], 124 | "description": "Binary I/O Library", 125 | "license": "LGPL-3.0", 126 | "web": "https://github.com/Element-0/binpak" 127 | }, 128 | { 129 | "name": "ezpipe", 130 | "url": "https://github.com/Element-0/pipe.git", 131 | "method": "git", 132 | "tags": [ 133 | "elementzero", 134 | "ezlib", 135 | "windows", 136 | "pipe" 137 | ], 138 | "description": "Named pipes for ElementZero", 139 | "license": "LGPL-3.0", 140 | "web": "https://github.com/Element-0/pipe" 141 | }, 142 | { 143 | "name": "ezmgr", 144 | "url": "https://github.com/Element-0/ezmgr.git", 145 | "method": "git", 146 | "tags": [ 147 | "elementzero", 148 | "ezlib", 149 | "bin" 150 | ], 151 | "description": "Manager for ElementZero", 152 | "license": "LGPL-3.0", 153 | "web": "https://github.com/Element-0/ezmgr" 154 | }, 155 | { 156 | "name": "ezmodutils", 157 | "url": "https://github.com/Element-0/ezmodutils.git", 158 | "method": "git", 159 | "tags": [ 160 | "elementzero", 161 | "bin" 162 | ], 163 | "description": "Mod utility for ElementZero", 164 | "license": "LGPL-3.0", 165 | "web": "https://github.com/Element-0/ezmodutils" 166 | }, 167 | { 168 | "name": "ezpdbparser", 169 | "url": "https://github.com/Element-0/pdbparser.git", 170 | "method": "git", 171 | "tags": [ 172 | "elementzero", 173 | "ezlib", 174 | "windows", 175 | "bin" 176 | ], 177 | "description": "PDB Parser for ElementZero", 178 | "license": "LGPL-3.0", 179 | "web": "https://github.com/Element-0/pdbparser" 180 | }, 181 | { 182 | "name": "ezchakra", 183 | "url": "https://github.com/Element-0/chakra.git", 184 | "method": "git", 185 | "tags": [ 186 | "elementzero", 187 | "ezlib", 188 | "windows", 189 | "dll" 190 | ], 191 | "description": "Chakra Loader for ElementZero", 192 | "license": "LGPL-3.0", 193 | "web": "https://github.com/Element-0/chakra" 194 | } 195 | ] -------------------------------------------------------------------------------- /scripts/Invoke-NativeCommand.ps1: -------------------------------------------------------------------------------- 1 | function Invoke-NativeCommand { 2 | param 3 | ( 4 | [ScriptBlock] $ScriptBlock, 5 | [string] $StderrPrefix = "", 6 | [int[]] $AllowedExitCodes = @(0) 7 | ) 8 | 9 | $backupErrorActionPreference = $script:ErrorActionPreference 10 | 11 | $script:ErrorActionPreference = "Continue" 12 | try 13 | { 14 | & $ScriptBlock 2>&1 | ForEach-Object -Process ` 15 | { 16 | if ($_ -is [System.Management.Automation.ErrorRecord]) 17 | { 18 | "$StderrPrefix$_" 19 | } 20 | else 21 | { 22 | "$_" 23 | } 24 | } 25 | if ($AllowedExitCodes -notcontains $LASTEXITCODE) 26 | { 27 | throw "Execution failed with exit code $LASTEXITCODE" 28 | } 29 | } 30 | finally 31 | { 32 | $script:ErrorActionPreference = $backupErrorActionPreference 33 | } 34 | } --------------------------------------------------------------------------------