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:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
on:
push:
branches: [ "master" ]
......@@ -13,9 +15,6 @@ on:
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
ocgcore-url: ${{ steps.parse-pr-override.outputs.ocgcore-url }}
ocgcore-branch: ${{ steps.parse-pr-override.outputs.ocgcore-branch }}
steps:
- name: Parse pull request description for dependency overrides
......@@ -24,52 +23,44 @@ jobs:
PR_BODY: ${{ github.event.pull_request.body }}
shell: python
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.
# Expected description format:
# > name: owner/repo@branch
# (leading >, dependency name, followed by GitHub repository, optional branch)
# > name: NNN
# (leading >, dependency name, followed by a PR number)
# Example:
# > ocgcore: mercury233/ygopro-core@patch-branch
# > ocgcore: 123
# Supported dependencies:
# ocgcore, irrlicht
import re, os
body = os.environ.get('PR_BODY', '')
# Default URLs and branches for dependencies
ocgcore_url = 'https://github.com/Fluorohydride/ygopro-core'
ocgcore_branch = ''
irrlicht_url = 'https://github.com/mercury233/irrlicht'
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)
# Default: empty means no override
ocgcore_ref = ''
irrlicht_ref = ''
m = re.search(r'(?m)^\s*>\s*ocgcore\s*:\s*(\d+)\s*$', body)
if m:
ocgcore_url = f'https://github.com/{m.group(1)}'
if m.group(2):
ocgcore_branch = m.group(2)
m = re.search(rf'(?m)^\s*>\s*irrlicht\s*:\s*({REPO_RE})(?:@({BRANCH_RE}))?\s*$', body)
ocgcore_ref = f'refs/pull/{m.group(1)}/head'
m = re.search(r'(?m)^\s*>\s*irrlicht\s*:\s*(\d+)\s*$', body)
if m:
irrlicht_url = f'https://github.com/{m.group(1)}'
if m.group(2):
irrlicht_branch = m.group(2)
# Output the parsed URLs and branches for downstream jobs
irrlicht_ref = f'refs/pull/{m.group(1)}/head'
# Output the parsed refs for downstream jobs
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
f.write(f'ocgcore-url={ocgcore_url}\n')
f.write(f'ocgcore-branch={ocgcore_branch}\n')
f.write(f'irrlicht-url={irrlicht_url}\n')
f.write(f'irrlicht-branch={irrlicht_branch}\n')
f.write(f'ocgcore-ref={ocgcore_ref}\n')
f.write(f'irrlicht-ref={irrlicht_ref}\n')
- name: Download irrlicht
run: |
branch="${{ steps.parse-pr-override.outputs.irrlicht-branch }}"
if [ -n "$branch" ]; then
git clone --depth=1 -b "$branch" ${{ steps.parse-pr-override.outputs.irrlicht-url }} irrlicht
else
git clone --depth=1 ${{ steps.parse-pr-override.outputs.irrlicht-url }} irrlicht
fi
- name: Fetch ocgcore
uses: actions/checkout@v4
with:
repository: Fluorohydride/ygopro-core
path: ocgcore
ref: ${{ steps.parse-pr-override.outputs.ocgcore-ref }}
- name: Fetch Irrlicht
uses: actions/checkout@v4
with:
repository: mercury233/irrlicht
path: irrlicht
ref: ${{ steps.parse-pr-override.outputs.irrlicht-ref }}
- name: Download lua
id: lua
......@@ -97,6 +88,7 @@ jobs:
lua/
miniaudio/
irrlicht/
ocgcore/
prepare-static-dependencies:
runs-on: ubuntu-latest
......@@ -237,21 +229,10 @@ jobs:
uses: actions/checkout@v4
with:
submodules: false
- name: Update submodules
# Here we use override URLs and branches from the prepare job, which can be set by pull request description,
# to make sure we are testing the correct code. Only the ocgcore submodule is required for the build.
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 ..
# Git submodules are ignored in this CI script. The `prepare` job downloads them.
# For local development, use `git clone --recursive` when cloning the repository,
# and then check out the submodules to the `master` branch.
# (The submodule references recorded in this repository may be outdated).
- name: Download prepare sources
uses: actions/download-artifact@v4
......@@ -375,18 +356,6 @@ jobs:
with:
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
uses: actions/download-artifact@v4
with:
......@@ -504,18 +473,6 @@ jobs:
with:
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
uses: actions/download-artifact@v4
with:
......
......@@ -91,7 +91,6 @@ video::IImage* SGUITTGlyph::createGlyphImage(const FT_Bitmap& bits, video::IVide
}
image_data += image_pitch;
}
image->unlock();
break;
}
......@@ -114,7 +113,6 @@ video::IImage* SGUITTGlyph::createGlyphImage(const FT_Bitmap& bits, video::IVide
}
glyph_data += bits.pitch;
}
image->unlock();
break;
}
default:
......
......@@ -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->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
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);
ebStar = env->addEditBox(L"", irr::core::rect<irr::s32>(60, 60 + 100 / 6, 100, 80 + 100 / 6), true, wFilter, EDITBOX_INPUTS);
editbox_list.push_back(ebStar);
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, 95, 80 + 100 / 6), true, wFilter, EDITBOX_INPUTS);
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);
ebScale = env->addEditBox(L"", irr::core::rect<irr::s32>(150, 60 + 100 / 6, 195, 80 + 100 / 6), true, wFilter, EDITBOX_INPUTS);
editbox_list.push_back(ebStar);
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);
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);
......@@ -851,7 +851,7 @@ bool Game::Initialize() {
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));
}
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->setDrawTitlebar(false);
wCategories->setDraggable(false);
......@@ -866,7 +866,7 @@ bool Game::Initialize() {
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));
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));
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"");
......@@ -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));
btnRSNo = env->addButton(irr::core::rect<irr::s32>(170, 80, 240, 105), wReplaySave, BUTTON_REPLAY_CANCEL, dataManager.GetSysString(1212));
//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);
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));
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, 130, 85, 150), wReplayControl, BUTTON_REPLAY_EXIT, dataManager.GetSysString(1347));
btnReplayExit = env->addButton(irr::core::rect<irr::s32>(5, 105, 85, 125), wReplayControl, BUTTON_REPLAY_EXIT, dataManager.GetSysString(1347));
//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->setDraggable(false);
wChat->setDrawTitlebar(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);
//swap
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() {
for (auto ptr : editbox_list)
ptr->setMax(LEN_CHAT_MSG - 1);
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;
xScale = window_size.Width / 1024.0;
yScale = window_size.Height / 640.0;
......@@ -2381,9 +2381,9 @@ void Game::OnResize() {
wReplayControl->setRelativePosition(Resize(205, 143, 295, 273));
btnReplayStart->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));
btnReplayUndo->setRelativePosition(Resize(5, 80, 85, 100));
btnReplaySwap->setRelativePosition(Resize(5, 30, 85, 50));
btnReplayExit->setRelativePosition(Resize(5, 105, 85, 125));
btnSpectatorSwap->setRelativePosition(Resize(205, 100, 295, 135));
......
......@@ -74,11 +74,8 @@ bool ImageResizer::imageScaleSTB(irr::video::IImage* src, irr::video::IImage* de
}
void* srcPtr = src->lock();
if(!srcPtr)
return false;
void* destPtr = dest->lock();
if(!destPtr) {
src->unlock();
if(!srcPtr || !destPtr) {
return false;
}
......@@ -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);
cache.samplers_built = (stbir_build_samplers(&cache.resize) != 0);
if(!cache.samplers_built) {
dest->unlock();
src->unlock();
return false;
}
} else {
......@@ -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);
}
const int ok = stbir_resize_extended(&cache.resize);
dest->unlock();
src->unlock();
return ok != 0;
return (stbir_resize_extended(&cache.resize) != 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