mirror of
https://github.com/fallout2-ce/fallout2-ce.git
synced 2026-07-27 16:47:11 -07:00
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
979a035fea | ||
|
|
df068a7294 | ||
|
|
f59b3a34c1 | ||
|
|
153710bb48 | ||
|
|
9e82c9a847 | ||
|
|
d0646fb77a | ||
|
|
458db6bddc | ||
|
|
859d590e26 | ||
|
|
06c3636b6d | ||
|
|
1d73725333 | ||
|
|
f850fc6665 | ||
|
|
d64c906d4f |
@@ -1,96 +0,0 @@
|
||||
name: Build and deploy webassembly version
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
|
||||
jobs:
|
||||
build_webassembly_version:
|
||||
name: Build webassembly version
|
||||
runs-on: ubuntu-latest
|
||||
permissions: write-all
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Emscripten SDK
|
||||
run: |
|
||||
git clone https://github.com/emscripten-core/emsdk.git
|
||||
cd emsdk
|
||||
./emsdk install 4.0.4
|
||||
./emsdk activate 4.0.4
|
||||
|
||||
- name: Build fallout2 wasm module
|
||||
run: |
|
||||
source emsdk/emsdk_env.sh
|
||||
git config --global --add safe.directory "*"
|
||||
mkdir -p build
|
||||
cd build
|
||||
emcmake cmake ../ -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release && emmake make VERBOSE=1 -j 4
|
||||
cd ..
|
||||
|
||||
- name: Add node
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- name: Checkout web interface
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ololoken/fallout2-ce-ems
|
||||
ref: 0764f9fdd0abf27bd9b0d3997ca0a8e61f380058
|
||||
path: fallout2-ce-ems
|
||||
|
||||
- name: Set deployment path
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
|
||||
id: set-path
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||
echo "DEST_DIR=PR-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
|
||||
echo "SITE_BASE=/fallout2-ce/PR-${{ github.event.pull_request.number }}/" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "DEST_DIR=." >> $GITHUB_OUTPUT
|
||||
echo "SITE_BASE=/fallout2-ce/" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
echo ===============================
|
||||
cat $GITHUB_OUTPUT
|
||||
|
||||
- name: Build web interface
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
|
||||
run: |
|
||||
cd fallout2-ce-ems
|
||||
npm install
|
||||
cp ../build/fallout2-ce.js src/assets/fallout2ce
|
||||
cp ../build/fallout2-ce.wasm src/assets/fallout2ce
|
||||
sed -i 's/Starting wasm module/Starting wasm module ${{github.event.pull_request.head.sha || github.sha }}/' src/pages/Launcher.tsx
|
||||
npm run build
|
||||
env:
|
||||
SITE_BASE: ${{ steps.set-path.outputs.SITE_BASE }}
|
||||
|
||||
- name: Install rsync (required for the next step)
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install -y rsync
|
||||
|
||||
- name: Deploy PR preview or main site
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
|
||||
uses: JamesIves/github-pages-deploy-action@v4
|
||||
with:
|
||||
branch: gh-pages
|
||||
folder: fallout2-ce-ems/dist
|
||||
target-folder: ${{ steps.set-path.outputs.DEST_DIR }}
|
||||
clean: false
|
||||
|
||||
- name: Comment preview URL on PR
|
||||
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
|
||||
run: |
|
||||
gh pr comment ${{ github.event.pull_request.number }} \
|
||||
--body "🚀 WebAssembly PR Preview for ${{github.event.pull_request.head.sha || github.sha }} is available at: https://${{ github.repository_owner }}.github.io/fallout2-ce/PR-${{ github.event.pull_request.number }}/"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -32,40 +32,58 @@ jobs:
|
||||
run: cppcheck --std=c++17 src/
|
||||
|
||||
code-format:
|
||||
name: Code format check
|
||||
name: Code format check and apply
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: write # Allows the workflow to push changes back to the repository
|
||||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fetch-depth: 0 # Ensures full history and correct branch checkout
|
||||
ref: ${{ github.head_ref }} # Uses the original branch:
|
||||
|
||||
- name: Show clang-format version
|
||||
run: |
|
||||
clang-format --version
|
||||
|
||||
- name: clang-format
|
||||
- name: Find and format files
|
||||
run: find src -type f \( -name \*.cc -o -name \*.h \) | xargs clang-format -i
|
||||
|
||||
- name: Commit and push changes (if any)
|
||||
run: |
|
||||
echo "Showing PR labels..."
|
||||
gh pr view ${{ github.event.pull_request.number }} --repo "${{ github.repository }}" --json labels
|
||||
echo "Checking labels on PR..."
|
||||
if gh pr view ${{ github.event.pull_request.number }} --repo "${{ github.repository }}" --json labels --jq '.labels[].name' | grep -q "skip-formatting"; then
|
||||
echo "skip-formatting label found — skipping job."
|
||||
if [[ -n "$(git status --porcelain)" ]]; then
|
||||
|
||||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||
if [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then
|
||||
echo "This is a PR from forked repository. Open a PR from branch using this repository or fix the formatting manually."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add .
|
||||
git commit -m "Apply clang-format to submitted files"
|
||||
git push origin HEAD:${{ github.head_ref }}
|
||||
echo "Changes pushed. Exiting early to avoid workflow stuck."
|
||||
exit 0
|
||||
|
||||
else
|
||||
echo "No formatting changes to commit."
|
||||
fi
|
||||
echo "skip-formatting label not found — continuing job."
|
||||
|
||||
find src -type f \( -name \*.cc -o -name \*.h \) | xargs clang-format --dry-run --Werror
|
||||
|
||||
echo "Code is formatted correctly"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
android:
|
||||
name: Android
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
needs: code-format
|
||||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
@@ -114,6 +132,8 @@ jobs:
|
||||
|
||||
runs-on: macos-14
|
||||
|
||||
needs: code-format
|
||||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
@@ -149,6 +169,8 @@ jobs:
|
||||
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
needs: code-format
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -203,6 +225,8 @@ jobs:
|
||||
|
||||
runs-on: ubuntu-22.04-arm
|
||||
|
||||
needs: code-format
|
||||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
@@ -243,6 +267,8 @@ jobs:
|
||||
|
||||
runs-on: ubuntu-22.04-arm
|
||||
|
||||
needs: code-format
|
||||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
@@ -274,6 +300,8 @@ jobs:
|
||||
|
||||
runs-on: macos-14
|
||||
|
||||
needs: code-format
|
||||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
@@ -309,6 +337,8 @@ jobs:
|
||||
|
||||
runs-on: windows-2019
|
||||
|
||||
needs: code-format
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -347,6 +377,58 @@ jobs:
|
||||
path: out/build/windows-${{ matrix.arch }}/RelWithDebInfo/fallout2-ce-${{ matrix.arch }}.exe
|
||||
retention-days: 7
|
||||
|
||||
build_webassembly_version:
|
||||
name: Build webassembly version
|
||||
runs-on: ubuntu-latest
|
||||
container: emscripten/emsdk:4.0.4
|
||||
needs: code-format
|
||||
permissions: write-all
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build fallout2 wasm module
|
||||
run: |
|
||||
git config --global --add safe.directory "*"
|
||||
mkdir -p build
|
||||
cd build
|
||||
emcmake cmake ../ -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release && emmake make VERBOSE=1 -j 4
|
||||
cd ..
|
||||
|
||||
- name: Add node
|
||||
if: github.ref == 'refs/heads/main'
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- name: Checkout web interface
|
||||
if: github.ref == 'refs/heads/main'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ololoken/fallout2-ce-ems
|
||||
ref: 46ac3be3da9d01ef204779073b1c1254fa037021
|
||||
path: fallout2-ce-ems
|
||||
|
||||
- name: Build web interface
|
||||
if: github.ref == 'refs/heads/main'
|
||||
run: |
|
||||
cd fallout2-ce-ems
|
||||
npm install
|
||||
cp ../build/fallout2-ce.js src/assets/fallout2ce
|
||||
cp ../build/fallout2-ce.wasm src/assets/fallout2ce
|
||||
sed -i 's/\/fallout2-ce-ems/\/fallout2-ce/' vite.config.ts
|
||||
npm run build
|
||||
|
||||
- name: Install rsync (required for the next step)
|
||||
run: |
|
||||
apt-get update && apt-get install -y rsync
|
||||
|
||||
- name: Deploy to gh-pages
|
||||
uses: JamesIves/github-pages-deploy-action@v4
|
||||
if: github.ref == 'refs/heads/main'
|
||||
with:
|
||||
branch: gh-pages
|
||||
folder: fallout2-ce-ems/dist
|
||||
|
||||
release:
|
||||
name: Release Continuous build
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
name: Cleanup PR Preview
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- closed
|
||||
|
||||
jobs:
|
||||
delete_pr_preview:
|
||||
name: Delete PR preview from gh-pages
|
||||
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout gh-pages branch
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: gh-pages
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Remove PR preview folder
|
||||
run: |
|
||||
PR_FOLDER="PR-${{ github.event.pull_request.number }}"
|
||||
echo "Removing preview folder: $PR_FOLDER"
|
||||
git rm -r --ignore-unmatch "$PR_FOLDER" || true
|
||||
|
||||
- name: Commit and push changes
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git commit -am "đźš® Remove preview for closed PR #${{ github.event.pull_request.number }}"
|
||||
git push
|
||||
+7
-19
@@ -2091,7 +2091,7 @@ static void _ShowSlotList(int windowType)
|
||||
// 0x47E8E0
|
||||
static void _DrawInfoBox(int slot)
|
||||
{
|
||||
blitBufferToBuffer(_loadsaveFrmImages[LOAD_SAVE_FRM_BACKGROUND].getData() + LS_WINDOW_WIDTH * 253 + 396, 164, 60, LS_WINDOW_WIDTH, gLoadSaveWindowBuffer + LS_WINDOW_WIDTH * 253 + 396, 640);
|
||||
blitBufferToBuffer(_loadsaveFrmImages[LOAD_SAVE_FRM_BACKGROUND].getData() + LS_WINDOW_WIDTH * 254 + 396, 164, 60, LS_WINDOW_WIDTH, gLoadSaveWindowBuffer + LS_WINDOW_WIDTH * 254 + 396, 640);
|
||||
|
||||
unsigned char* dest;
|
||||
const char* text;
|
||||
@@ -2101,8 +2101,7 @@ static void _DrawInfoBox(int slot)
|
||||
case SLOT_STATE_OCCUPIED:
|
||||
if (1) {
|
||||
LoadSaveSlotData* ptr = &(_LSData[slot]);
|
||||
// raise this one pixel as well to match above
|
||||
fontDrawText(gLoadSaveWindowBuffer + LS_WINDOW_WIDTH * 253 + 396, ptr->characterName, LS_WINDOW_WIDTH, LS_WINDOW_WIDTH, color);
|
||||
fontDrawText(gLoadSaveWindowBuffer + LS_WINDOW_WIDTH * 254 + 396, ptr->characterName, LS_WINDOW_WIDTH, LS_WINDOW_WIDTH, color);
|
||||
|
||||
snprintf(_str,
|
||||
sizeof(_str),
|
||||
@@ -2113,7 +2112,7 @@ static void _DrawInfoBox(int slot)
|
||||
100 * ((ptr->gameTime / 600) / 60 % 24) + (ptr->gameTime / 600) % 60);
|
||||
|
||||
int v2 = fontGetLineHeight();
|
||||
fontDrawText(gLoadSaveWindowBuffer + LS_WINDOW_WIDTH * (255 + v2) + 397, _str, LS_WINDOW_WIDTH, LS_WINDOW_WIDTH, color);
|
||||
fontDrawText(gLoadSaveWindowBuffer + LS_WINDOW_WIDTH * (256 + v2) + 397, _str, LS_WINDOW_WIDTH, LS_WINDOW_WIDTH, color);
|
||||
|
||||
snprintf(_str,
|
||||
sizeof(_str),
|
||||
@@ -2121,27 +2120,16 @@ static void _DrawInfoBox(int slot)
|
||||
mapGetCityName(ptr->map),
|
||||
mapGetName(ptr->map, ptr->elevation));
|
||||
|
||||
int y = v2 + 2 + v2 + 255;
|
||||
int y = v2 + 3 + v2 + 256;
|
||||
short beginnings[WORD_WRAP_MAX_COUNT];
|
||||
short count;
|
||||
if (wordWrap(_str, 164, beginnings, &count) == 0) {
|
||||
for (int index = 0; index < count - 1; index += 1) {
|
||||
char* beginning = _str + beginnings[index];
|
||||
char* ending = _str + beginnings[index + 1];
|
||||
|
||||
// Calculate length of the substring
|
||||
size_t lineLength = ending - beginning;
|
||||
|
||||
// Create a temporary buffer to hold the substring
|
||||
char temp[256]; // Ensure the buffer size is sufficient
|
||||
strncpy(temp, beginning, lineLength);
|
||||
temp[lineLength] = '\0'; // Null-terminate the copied substring
|
||||
|
||||
// Add a one-pixel shift to the x-coordinate for the second and subsequent lines for tapering readout display
|
||||
int xShift = (index > 0) ? 2 : 0;
|
||||
|
||||
// Draw the substring
|
||||
fontDrawText(gLoadSaveWindowBuffer + LS_WINDOW_WIDTH * y + 399 + xShift, temp, 164, LS_WINDOW_WIDTH, color);
|
||||
char c = *ending;
|
||||
*ending = '\0';
|
||||
fontDrawText(gLoadSaveWindowBuffer + LS_WINDOW_WIDTH * y + 399, beginning, 164, LS_WINDOW_WIDTH, color);
|
||||
y += v2 + 2;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user