Commit 3b8d3235 authored by nanahira's avatar nanahira

Merge remote-tracking branch 'fh/master' into merge-20260320

# Conflicts:
#	gframe/game.cpp
parents 6e1d263f 4ca24856
...@@ -4,6 +4,8 @@ concurrency: ...@@ -4,6 +4,8 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
permissions: {}
on: on:
push: push:
branches: [ "master" ] branches: [ "master" ]
...@@ -13,9 +15,6 @@ on: ...@@ -13,9 +15,6 @@ on:
jobs: jobs:
prepare: prepare:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs:
ocgcore-url: ${{ steps.parse-pr-override.outputs.ocgcore-url }}
ocgcore-branch: ${{ steps.parse-pr-override.outputs.ocgcore-branch }}
steps: steps:
- name: Parse pull request description for dependency overrides - name: Parse pull request description for dependency overrides
...@@ -24,52 +23,44 @@ jobs: ...@@ -24,52 +23,44 @@ jobs:
PR_BODY: ${{ github.event.pull_request.body }} PR_BODY: ${{ github.event.pull_request.body }}
shell: python shell: python
run: | run: |
# You can override the URLs and branches of dependencies by adding lines in the pull request description. # You can override dependencies by specifying a pull request number in the pull request description.
# This is useful when you want to test changes which require modifications in the submodules or dependencies. # This is useful when you want to test changes which require modifications in the submodules or dependencies.
# Expected description format: # Expected description format:
# > name: owner/repo@branch # > name: NNN
# (leading >, dependency name, followed by GitHub repository, optional branch) # (leading >, dependency name, followed by a PR number)
# Example: # Example:
# > ocgcore: mercury233/ygopro-core@patch-branch # > ocgcore: 123
# Supported dependencies: # Supported dependencies:
# ocgcore, irrlicht # ocgcore, irrlicht
import re, os import re, os
body = os.environ.get('PR_BODY', '') body = os.environ.get('PR_BODY', '')
# Default URLs and branches for dependencies # Default: empty means no override
ocgcore_url = 'https://github.com/Fluorohydride/ygopro-core' ocgcore_ref = ''
ocgcore_branch = '' irrlicht_ref = ''
irrlicht_url = 'https://github.com/mercury233/irrlicht' m = re.search(r'(?m)^\s*>\s*ocgcore\s*:\s*(\d+)\s*$', body)
irrlicht_branch = ''
# Regex patterns for parsing:
# REPO_RE: matches format "owner/repo" (e.g., "user/repo-name")
# BRANCH_RE: matches branch names with dots, slashes, and hyphens (e.g., "feature/my-branch", "v1.0")
REPO_RE = r'[\w][\w.-]*/[\w][\w.-]*'
BRANCH_RE = r'[\w][\w./-]*'
m = re.search(rf'(?m)^\s*>\s*ocgcore\s*:\s*({REPO_RE})(?:@({BRANCH_RE}))?\s*$', body)
if m: if m:
ocgcore_url = f'https://github.com/{m.group(1)}' ocgcore_ref = f'refs/pull/{m.group(1)}/head'
if m.group(2): m = re.search(r'(?m)^\s*>\s*irrlicht\s*:\s*(\d+)\s*$', body)
ocgcore_branch = m.group(2)
m = re.search(rf'(?m)^\s*>\s*irrlicht\s*:\s*({REPO_RE})(?:@({BRANCH_RE}))?\s*$', body)
if m: if m:
irrlicht_url = f'https://github.com/{m.group(1)}' irrlicht_ref = f'refs/pull/{m.group(1)}/head'
if m.group(2): # Output the parsed refs for downstream jobs
irrlicht_branch = m.group(2)
# Output the parsed URLs and branches for downstream jobs
with open(os.environ['GITHUB_OUTPUT'], 'a') as f: with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
f.write(f'ocgcore-url={ocgcore_url}\n') f.write(f'ocgcore-ref={ocgcore_ref}\n')
f.write(f'ocgcore-branch={ocgcore_branch}\n') f.write(f'irrlicht-ref={irrlicht_ref}\n')
f.write(f'irrlicht-url={irrlicht_url}\n')
f.write(f'irrlicht-branch={irrlicht_branch}\n')
- name: Download irrlicht - name: Fetch ocgcore
run: | uses: actions/checkout@v4
branch="${{ steps.parse-pr-override.outputs.irrlicht-branch }}" with:
if [ -n "$branch" ]; then repository: Fluorohydride/ygopro-core
git clone --depth=1 -b "$branch" ${{ steps.parse-pr-override.outputs.irrlicht-url }} irrlicht path: ocgcore
else ref: ${{ steps.parse-pr-override.outputs.ocgcore-ref }}
git clone --depth=1 ${{ steps.parse-pr-override.outputs.irrlicht-url }} irrlicht
fi - name: Fetch Irrlicht
uses: actions/checkout@v4
with:
repository: mercury233/irrlicht
path: irrlicht
ref: ${{ steps.parse-pr-override.outputs.irrlicht-ref }}
- name: Download lua - name: Download lua
id: lua id: lua
...@@ -97,6 +88,7 @@ jobs: ...@@ -97,6 +88,7 @@ jobs:
lua/ lua/
miniaudio/ miniaudio/
irrlicht/ irrlicht/
ocgcore/
prepare-static-dependencies: prepare-static-dependencies:
runs-on: ubuntu-latest runs-on: ubuntu-latest
...@@ -237,21 +229,10 @@ jobs: ...@@ -237,21 +229,10 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
submodules: false submodules: false
# Git submodules are ignored in this CI script. The `prepare` job downloads them.
- name: Update submodules # For local development, use `git clone --recursive` when cloning the repository,
# Here we use override URLs and branches from the prepare job, which can be set by pull request description, # and then check out the submodules to the `master` branch.
# to make sure we are testing the correct code. Only the ocgcore submodule is required for the build. # (The submodule references recorded in this repository may be outdated).
shell: bash
run: |
git submodule update --init --no-fetch ocgcore
cd ocgcore
git fetch --depth=1 ${{ needs.prepare.outputs.ocgcore-url }} ${{ needs.prepare.outputs.ocgcore-branch }}
git checkout FETCH_HEAD
cd ..
# cd script
# git checkout master
# git pull origin master
# cd ..
- name: Download prepare sources - name: Download prepare sources
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
...@@ -375,18 +356,6 @@ jobs: ...@@ -375,18 +356,6 @@ jobs:
with: with:
submodules: false submodules: false
- name: Update submodules
run: |
git submodule update --init --no-fetch ocgcore
cd ocgcore
git fetch --depth=1 ${{ needs.prepare.outputs.ocgcore-url }} ${{ needs.prepare.outputs.ocgcore-branch }}
git checkout FETCH_HEAD
cd ..
# cd script
# git checkout master
# git pull origin master
# cd ..
- name: Download prepare sources - name: Download prepare sources
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
...@@ -504,18 +473,6 @@ jobs: ...@@ -504,18 +473,6 @@ jobs:
with: with:
submodules: false submodules: false
- name: Update submodules
run: |
git submodule update --init --no-fetch ocgcore
cd ocgcore
git fetch --depth=1 ${{ needs.prepare.outputs.ocgcore-url }} ${{ needs.prepare.outputs.ocgcore-branch }}
git checkout FETCH_HEAD
cd ..
# cd script
# git checkout master
# git pull origin master
# cd ..
- name: Download prepare sources - name: Download prepare sources
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
......
...@@ -91,7 +91,6 @@ video::IImage* SGUITTGlyph::createGlyphImage(const FT_Bitmap& bits, video::IVide ...@@ -91,7 +91,6 @@ video::IImage* SGUITTGlyph::createGlyphImage(const FT_Bitmap& bits, video::IVide
} }
image_data += image_pitch; image_data += image_pitch;
} }
image->unlock();
break; break;
} }
...@@ -114,7 +113,6 @@ video::IImage* SGUITTGlyph::createGlyphImage(const FT_Bitmap& bits, video::IVide ...@@ -114,7 +113,6 @@ video::IImage* SGUITTGlyph::createGlyphImage(const FT_Bitmap& bits, video::IVide
} }
glyph_data += bits.pitch; glyph_data += bits.pitch;
} }
image->unlock();
break; break;
} }
default: default:
......
...@@ -833,12 +833,12 @@ bool Game::Initialize() { ...@@ -833,12 +833,12 @@ bool Game::Initialize() {
ebDefense = env->addEditBox(L"", irr::core::rect<irr::s32>(260, 40 + 75 / 6, 340, 60 + 75 / 6), true, wFilter, EDITBOX_INPUTS); ebDefense = env->addEditBox(L"", irr::core::rect<irr::s32>(260, 40 + 75 / 6, 340, 60 + 75 / 6), true, wFilter, EDITBOX_INPUTS);
ebDefense->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); ebDefense->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
editbox_list.push_back(ebDefense); editbox_list.push_back(ebDefense);
stStar = env->addStaticText(dataManager.GetSysString(1324), irr::core::rect<irr::s32>(10, 62 + 100 / 6, 80, 82 + 100 / 6), false, false, wFilter); stStar = env->addStaticText(dataManager.GetSysString(1324), irr::core::rect<irr::s32>(10, 62 + 100 / 6, 70, 82 + 100 / 6), false, false, wFilter);
ebStar = env->addEditBox(L"", irr::core::rect<irr::s32>(60, 60 + 100 / 6, 100, 80 + 100 / 6), true, wFilter, EDITBOX_INPUTS); ebStar = env->addEditBox(L"", irr::core::rect<irr::s32>(60, 60 + 100 / 6, 95, 80 + 100 / 6), true, wFilter, EDITBOX_INPUTS);
editbox_list.push_back(ebStar);
ebStar->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); ebStar->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
stScale = env->addStaticText(dataManager.GetSysString(1336), irr::core::rect<irr::s32>(101, 62 + 100 / 6, 150, 82 + 100 / 6), false, false, wFilter); editbox_list.push_back(ebStar);
ebScale = env->addEditBox(L"", irr::core::rect<irr::s32>(150, 60 + 100 / 6, 195, 80 + 100 / 6), true, wFilter, EDITBOX_INPUTS); stScale = env->addStaticText(dataManager.GetSysString(1336), irr::core::rect<irr::s32>(105, 62 + 100 / 6, 165, 82 + 100 / 6), false, false, wFilter);
ebScale = env->addEditBox(L"", irr::core::rect<irr::s32>(155, 60 + 100 / 6, 195, 80 + 100 / 6), true, wFilter, EDITBOX_INPUTS);
ebScale->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); ebScale->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
editbox_list.push_back(ebScale); editbox_list.push_back(ebScale);
stSearch = env->addStaticText(dataManager.GetSysString(1325), irr::core::rect<irr::s32>(205, 62 + 100 / 6, 280, 82 + 100 / 6), false, false, wFilter); stSearch = env->addStaticText(dataManager.GetSysString(1325), irr::core::rect<irr::s32>(205, 62 + 100 / 6, 280, 82 + 100 / 6), false, false, wFilter);
...@@ -851,7 +851,7 @@ bool Game::Initialize() { ...@@ -851,7 +851,7 @@ bool Game::Initialize() {
btnStartFilter->setRelativePosition(irr::core::rect<irr::s32>(260, 80 + 125 / 6, 390, 100 + 125 / 6)); btnStartFilter->setRelativePosition(irr::core::rect<irr::s32>(260, 80 + 125 / 6, 390, 100 + 125 / 6));
btnClearFilter = env->addButton(irr::core::rect<irr::s32>(205, 80 + 125 / 6, 255, 100 + 125 / 6), wFilter, BUTTON_CLEAR_FILTER, dataManager.GetSysString(1304)); btnClearFilter = env->addButton(irr::core::rect<irr::s32>(205, 80 + 125 / 6, 255, 100 + 125 / 6), wFilter, BUTTON_CLEAR_FILTER, dataManager.GetSysString(1304));
} }
wCategories = env->addWindow(irr::core::rect<irr::s32>(600, 60, 1000, 305), false, L""); wCategories = env->addWindow(irr::core::rect<irr::s32>(600, 55, 1000, 300), false, L"");
wCategories->getCloseButton()->setVisible(false); wCategories->getCloseButton()->setVisible(false);
wCategories->setDrawTitlebar(false); wCategories->setDrawTitlebar(false);
wCategories->setDraggable(false); wCategories->setDraggable(false);
...@@ -866,7 +866,7 @@ bool Game::Initialize() { ...@@ -866,7 +866,7 @@ bool Game::Initialize() {
for(int i = 0; i < 32; ++i) for(int i = 0; i < 32; ++i)
chkCategory[i] = env->addCheckBox(false, irr::core::recti(10 + (i % 4) * catewidth, 5 + (i / 4) * 25, 10 + (i % 4 + 1) * catewidth, 5 + (i / 4 + 1) * 25), wCategories, -1, dataManager.GetSysString(1100 + i)); chkCategory[i] = env->addCheckBox(false, irr::core::recti(10 + (i % 4) * catewidth, 5 + (i / 4) * 25, 10 + (i % 4 + 1) * catewidth, 5 + (i / 4 + 1) * 25), wCategories, -1, dataManager.GetSysString(1100 + i));
int wcatewidth = catewidth * 4 + 16; int wcatewidth = catewidth * 4 + 16;
wCategories->setRelativePosition(irr::core::rect<irr::s32>(1000 - wcatewidth, 60, 1000, 305)); wCategories->setRelativePosition(irr::core::rect<irr::s32>(1000 - wcatewidth, 55, 1000, 300));
btnCategoryOK->setRelativePosition(irr::core::recti(wcatewidth / 2 - 50, 210, wcatewidth / 2 + 50, 235)); btnCategoryOK->setRelativePosition(irr::core::recti(wcatewidth / 2 - 50, 210, wcatewidth / 2 + 50, 235));
btnMarksFilter = env->addButton(irr::core::rect<irr::s32>(60, 80 + 125 / 6, 195, 100 + 125 / 6), wFilter, BUTTON_MARKS_FILTER, dataManager.GetSysString(1374)); btnMarksFilter = env->addButton(irr::core::rect<irr::s32>(60, 80 + 125 / 6, 195, 100 + 125 / 6), wFilter, BUTTON_MARKS_FILTER, dataManager.GetSysString(1374));
wLinkMarks = env->addWindow(irr::core::rect<irr::s32>(700, 30, 820, 150), false, L""); wLinkMarks = env->addWindow(irr::core::rect<irr::s32>(700, 30, 820, 150), false, L"");
...@@ -954,21 +954,21 @@ bool Game::Initialize() { ...@@ -954,21 +954,21 @@ bool Game::Initialize() {
btnRSYes = env->addButton(irr::core::rect<irr::s32>(70, 80, 140, 105), wReplaySave, BUTTON_REPLAY_SAVE, dataManager.GetSysString(1341)); btnRSYes = env->addButton(irr::core::rect<irr::s32>(70, 80, 140, 105), wReplaySave, BUTTON_REPLAY_SAVE, dataManager.GetSysString(1341));
btnRSNo = env->addButton(irr::core::rect<irr::s32>(170, 80, 240, 105), wReplaySave, BUTTON_REPLAY_CANCEL, dataManager.GetSysString(1212)); btnRSNo = env->addButton(irr::core::rect<irr::s32>(170, 80, 240, 105), wReplaySave, BUTTON_REPLAY_CANCEL, dataManager.GetSysString(1212));
//replay control //replay control
wReplayControl = env->addStaticText(L"", irr::core::rect<irr::s32>(205, 118, 295, 273), true, false, 0, -1, true); wReplayControl = env->addStaticText(L"", irr::core::rect<irr::s32>(205, 143, 295, 273), true, false, 0, -1, true);
wReplayControl->setVisible(false); wReplayControl->setVisible(false);
btnReplayStart = env->addButton(irr::core::rect<irr::s32>(5, 5, 85, 25), wReplayControl, BUTTON_REPLAY_START, dataManager.GetSysString(1343)); btnReplayStart = env->addButton(irr::core::rect<irr::s32>(5, 5, 85, 25), wReplayControl, BUTTON_REPLAY_START, dataManager.GetSysString(1343));
btnReplayPause = env->addButton(irr::core::rect<irr::s32>(5, 30, 85, 50), wReplayControl, BUTTON_REPLAY_PAUSE, dataManager.GetSysString(1344)); btnReplayPause = env->addButton(irr::core::rect<irr::s32>(5, 5, 85, 25), wReplayControl, BUTTON_REPLAY_PAUSE, dataManager.GetSysString(1344));
btnReplaySwap = env->addButton(irr::core::rect<irr::s32>(5, 30, 85, 50), wReplayControl, BUTTON_REPLAY_SWAP, dataManager.GetSysString(1346));
btnReplayStep = env->addButton(irr::core::rect<irr::s32>(5, 55, 85, 75), wReplayControl, BUTTON_REPLAY_STEP, dataManager.GetSysString(1345)); btnReplayStep = env->addButton(irr::core::rect<irr::s32>(5, 55, 85, 75), wReplayControl, BUTTON_REPLAY_STEP, dataManager.GetSysString(1345));
btnReplayUndo = env->addButton(irr::core::rect<irr::s32>(5, 80, 85, 100), wReplayControl, BUTTON_REPLAY_UNDO, dataManager.GetSysString(1360)); btnReplayUndo = env->addButton(irr::core::rect<irr::s32>(5, 80, 85, 100), wReplayControl, BUTTON_REPLAY_UNDO, dataManager.GetSysString(1360));
btnReplaySwap = env->addButton(irr::core::rect<irr::s32>(5, 105, 85, 125), wReplayControl, BUTTON_REPLAY_SWAP, dataManager.GetSysString(1346)); btnReplayExit = env->addButton(irr::core::rect<irr::s32>(5, 105, 85, 125), wReplayControl, BUTTON_REPLAY_EXIT, dataManager.GetSysString(1347));
btnReplayExit = env->addButton(irr::core::rect<irr::s32>(5, 130, 85, 150), wReplayControl, BUTTON_REPLAY_EXIT, dataManager.GetSysString(1347));
//chat //chat
wChat = env->addWindow(irr::core::rect<irr::s32>(305, 615, 1020, 640), false, L""); wChat = env->addWindow(irr::core::rect<irr::s32>(307, 615, 1024, 640), false, L"");
wChat->getCloseButton()->setVisible(false); wChat->getCloseButton()->setVisible(false);
wChat->setDraggable(false); wChat->setDraggable(false);
wChat->setDrawTitlebar(false); wChat->setDrawTitlebar(false);
wChat->setVisible(false); wChat->setVisible(false);
ebChatInput = env->addEditBox(L"", irr::core::rect<irr::s32>(3, 2, 710, 22), true, wChat, EDITBOX_CHAT); ebChatInput = env->addEditBox(L"", irr::core::rect<irr::s32>(3, 2, 711, 22), true, wChat, EDITBOX_CHAT);
editbox_list.push_back(ebChatInput); editbox_list.push_back(ebChatInput);
//swap //swap
btnSpectatorSwap = env->addButton(irr::core::rect<irr::s32>(205, 100, 295, 135), 0, BUTTON_REPLAY_SWAP, dataManager.GetSysString(1346)); btnSpectatorSwap = env->addButton(irr::core::rect<irr::s32>(205, 100, 295, 135), 0, BUTTON_REPLAY_SWAP, dataManager.GetSysString(1346));
...@@ -1042,7 +1042,7 @@ bool Game::Initialize() { ...@@ -1042,7 +1042,7 @@ bool Game::Initialize() {
for (auto ptr : editbox_list) for (auto ptr : editbox_list)
ptr->setMax(LEN_CHAT_MSG - 1); ptr->setMax(LEN_CHAT_MSG - 1);
auto size = driver->getScreenSize(); auto size = driver->getScreenSize();
if(window_size != size) { if(window_size != size) { // On the first run, window_size is (0, 0), so this condition always triggers a resize
window_size = size; window_size = size;
xScale = window_size.Width / 1024.0; xScale = window_size.Width / 1024.0;
yScale = window_size.Height / 640.0; yScale = window_size.Height / 640.0;
...@@ -2381,9 +2381,9 @@ void Game::OnResize() { ...@@ -2381,9 +2381,9 @@ void Game::OnResize() {
wReplayControl->setRelativePosition(Resize(205, 143, 295, 273)); wReplayControl->setRelativePosition(Resize(205, 143, 295, 273));
btnReplayStart->setRelativePosition(Resize(5, 5, 85, 25)); btnReplayStart->setRelativePosition(Resize(5, 5, 85, 25));
btnReplayPause->setRelativePosition(Resize(5, 5, 85, 25)); btnReplayPause->setRelativePosition(Resize(5, 5, 85, 25));
btnReplaySwap->setRelativePosition(Resize(5, 30, 85, 50));
btnReplayStep->setRelativePosition(Resize(5, 55, 85, 75)); btnReplayStep->setRelativePosition(Resize(5, 55, 85, 75));
btnReplayUndo->setRelativePosition(Resize(5, 80, 85, 100)); btnReplayUndo->setRelativePosition(Resize(5, 80, 85, 100));
btnReplaySwap->setRelativePosition(Resize(5, 30, 85, 50));
btnReplayExit->setRelativePosition(Resize(5, 105, 85, 125)); btnReplayExit->setRelativePosition(Resize(5, 105, 85, 125));
btnSpectatorSwap->setRelativePosition(Resize(205, 100, 295, 135)); btnSpectatorSwap->setRelativePosition(Resize(205, 100, 295, 135));
......
...@@ -74,11 +74,8 @@ bool ImageResizer::imageScaleSTB(irr::video::IImage* src, irr::video::IImage* de ...@@ -74,11 +74,8 @@ bool ImageResizer::imageScaleSTB(irr::video::IImage* src, irr::video::IImage* de
} }
void* srcPtr = src->lock(); void* srcPtr = src->lock();
if(!srcPtr)
return false;
void* destPtr = dest->lock(); void* destPtr = dest->lock();
if(!destPtr) { if(!srcPtr || !destPtr) {
src->unlock();
return false; return false;
} }
...@@ -98,8 +95,6 @@ bool ImageResizer::imageScaleSTB(irr::video::IImage* src, irr::video::IImage* de ...@@ -98,8 +95,6 @@ bool ImageResizer::imageScaleSTB(irr::video::IImage* src, irr::video::IImage* de
stbir_set_filters(&cache.resize, STBIR_FILTER_BOX, STBIR_FILTER_BOX); stbir_set_filters(&cache.resize, STBIR_FILTER_BOX, STBIR_FILTER_BOX);
cache.samplers_built = (stbir_build_samplers(&cache.resize) != 0); cache.samplers_built = (stbir_build_samplers(&cache.resize) != 0);
if(!cache.samplers_built) { if(!cache.samplers_built) {
dest->unlock();
src->unlock();
return false; return false;
} }
} else { } else {
...@@ -107,10 +102,7 @@ bool ImageResizer::imageScaleSTB(irr::video::IImage* src, irr::video::IImage* de ...@@ -107,10 +102,7 @@ bool ImageResizer::imageScaleSTB(irr::video::IImage* src, irr::video::IImage* de
stbir_set_buffer_ptrs(&cache.resize, srcPtr, srcStride, destPtr, destStride); stbir_set_buffer_ptrs(&cache.resize, srcPtr, srcStride, destPtr, destStride);
} }
const int ok = stbir_resize_extended(&cache.resize); return (stbir_resize_extended(&cache.resize) != 0);
dest->unlock();
src->unlock();
return ok != 0;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment