Skip to content

Commit d254e69

Browse files
authored
rewrite using c++ (#1)
1 parent 43f179b commit d254e69

26 files changed

Lines changed: 1497 additions & 877 deletions

.github/workflows/release.yml

Lines changed: 115 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,77 +3,144 @@ name: Release Build
33
on:
44
push:
55
branches: [ "main", "master" ]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Release version (e.g., 1.0.0)'
10+
required: true
11+
type: string
12+
changelog:
13+
description: 'Changelog/Release notes (use " - " to separate items)'
14+
required: false
15+
type: string
16+
default: 'Manual release'
617

718
permissions:
819
contents: write
920

1021
jobs:
1122
build-and-release:
12-
if: contains(github.event.head_commit.message, 'release:')
23+
if: github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, 'release:')
1324
runs-on: windows-latest
1425

1526
steps:
1627
- uses: actions/checkout@v4
1728
with:
1829
fetch-depth: 0
1930

20-
- name: Set up Python
21-
uses: actions/setup-python@v5
31+
- name: Install Qt
32+
uses: jurplel/install-qt-action@v3
2233
with:
23-
python-version: '3.13'
24-
cache: 'pip'
34+
version: '6.6.0'
35+
host: 'windows'
36+
target: 'desktop'
37+
arch: 'win64_mingw'
38+
modules: 'qtnetworkauth'
39+
cache: true
2540

26-
- name: Install dependencies
41+
- name: Setup MinGW
2742
run: |
28-
python -m pip install --upgrade pip
29-
if (Test-Path requirements.txt) { pip install -r requirements.txt }
30-
# Ensure PyInstaller is installed if not in requirements (it should be)
31-
pip install pyinstaller
43+
choco install mingw --version=11.2.0.07112021 --force -y
44+
echo "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
45+
shell: pwsh
46+
47+
- name: Setup CMake
48+
uses: jwlawson/actions-setup-cmake@v1.14
49+
with:
50+
cmake-version: '3.27.x'
51+
52+
- name: Configure CMake
53+
run: |
54+
mkdir build
55+
cd build
56+
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ..
57+
shell: cmd
58+
59+
- name: Build
60+
run: |
61+
cd build
62+
cmake --build . --config Release
63+
shell: cmd
64+
65+
- name: Create Distribution Package
66+
run: |
67+
mkdir dist
68+
copy build\SteamLuaPatcher.exe dist\
69+
if exist logo.ico copy logo.ico dist\
70+
cd dist
71+
windeployqt SteamLuaPatcher.exe --release --no-translations
72+
shell: cmd
73+
74+
- name: Create Installer (Optional - using NSIS)
75+
run: |
76+
echo "Skipping installer creation - direct exe distribution"
77+
shell: cmd
3278

33-
- name: Build with PyInstaller
79+
- name: Package Release
3480
run: |
35-
python build.py
81+
cd dist
82+
7z a ..\SteamLuaPatcher-Windows.zip *
83+
shell: cmd
3684

3785
- name: Extract Version from Commit Message
3886
id: get_info
3987
shell: pwsh
4088
run: |
41-
$msg = "${{ github.event.head_commit.message }}"
42-
# Regex to find "release: <version>" (case insensitive)
43-
if ($msg -match "(?i)release:\s*v?([\d\.]+)") {
44-
$version = $matches[1]
89+
# Check if this is a manual trigger
90+
if ("${{ github.event_name }}" -eq "workflow_dispatch") {
91+
$version = "${{ github.event.inputs.version }}"
4592
echo "VERSION=$version" >> $env:GITHUB_OUTPUT
46-
echo "Found version: $version"
93+
echo "Manual trigger - Version: $version"
4794
} else {
48-
echo "VERSION=latest" >> $env:GITHUB_OUTPUT
49-
echo "No specific version found, using 'latest'"
95+
# Extract from commit message
96+
$msg = "${{ github.event.head_commit.message }}"
97+
if ($msg -match "(?i)release:\s*v?([\d\.]+)") {
98+
$version = $matches[1]
99+
echo "VERSION=$version" >> $env:GITHUB_OUTPUT
100+
echo "Commit trigger - Found version: $version"
101+
} else {
102+
echo "VERSION=latest" >> $env:GITHUB_OUTPUT
103+
echo "No specific version found, using 'latest'"
104+
}
50105
}
51106
52107
- name: Generate Changelog
53108
id: changelog
54109
shell: pwsh
55110
run: |
56-
$msg = "${{ github.event.head_commit.message }}"
57-
58-
# Split by " - " which the user uses as separator
59-
# using -split with Regex escape might be safer, but simple string split works for " - "
60-
$parts = $msg -split " - "
61-
62-
$changelog = ""
63-
foreach ($part in $parts) {
64-
# Skip the "release:" part if it's the first one, or just clean it up
65-
if ($part -match "^release:") { continue }
66-
67-
# Format as list item
68-
$changelog += "- $part`n"
111+
# Check if this is a manual trigger
112+
if ("${{ github.event_name }}" -eq "workflow_dispatch") {
113+
$changelog = "${{ github.event.inputs.changelog }}"
114+
if ($changelog) {
115+
# Split by " - " if multiple items
116+
$parts = $changelog -split " - "
117+
$formattedLog = ""
118+
foreach ($part in $parts) {
119+
$part = $part.Trim()
120+
if ($part) {
121+
$formattedLog += "- $part`n"
122+
}
123+
}
124+
$changelog = $formattedLog
125+
} else {
126+
$changelog = "- Manual release"
127+
}
128+
echo "Manual trigger changelog"
129+
} else {
130+
# Extract from commit message
131+
$msg = "${{ github.event.head_commit.message }}"
132+
$parts = $msg -split " - "
133+
$changelog = ""
134+
foreach ($part in $parts) {
135+
if ($part -match "^release:") { continue }
136+
$changelog += "- $part`n"
137+
}
138+
if (-not $changelog) {
139+
$changelog = $msg
140+
}
69141
}
70142
71-
if (-not $changelog) {
72-
# Fallback if split didn't find " - "
73-
$changelog = $msg
74-
}
75-
76-
# Escape newlines for GitHub Actions output
143+
# Escape for GitHub Actions output
77144
$changelog = $changelog -replace '%', '%25' -replace '\n', '%0A' -replace '\r', '%0D'
78145
echo "LOGS=$changelog" >> $env:GITHUB_OUTPUT
79146
@@ -85,7 +152,17 @@ jobs:
85152
body: |
86153
## Changes
87154
${{ steps.changelog.outputs.LOGS }}
155+
156+
## Installation
157+
1. Download `SteamLuaPatcher-Windows.zip`
158+
2. Extract the archive
159+
3. Run `SteamLuaPatcher.exe`
160+
161+
## Requirements
162+
- Windows 10/11
163+
- Visual C++ Redistributable (usually pre-installed)
88164
files: |
165+
SteamLuaPatcher-Windows.zip
89166
dist/SteamLuaPatcher.exe
90167
draft: false
91168
prerelease: false

.gitignore

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,48 @@
1-
# Python
2-
__pycache__/
3-
*.pyc
4-
5-
# PyInstaller
1+
# CMake
62
build/
3+
CMakeCache.txt
4+
CMakeFiles/
5+
cmake_install.cmake
6+
Makefile
7+
*.cmake
8+
!CMakeLists.txt
9+
10+
# Build outputs
711
dist/
8-
*.spec
12+
*.exe
13+
*.dll
14+
*.so
15+
*.dylib
16+
*.a
17+
*.lib
18+
19+
# Qt
20+
*.pro.user
21+
*.qm
22+
.qmake.stash
23+
moc_*.cpp
24+
ui_*.h
25+
qrc_*.cpp
926

1027
# IDE
1128
.vscode/
1229
.idea/
30+
*.swp
31+
*.swo
32+
*~
33+
.DS_Store
34+
35+
# Compiler
36+
*.o
37+
*.obj
38+
*.pdb
39+
*.ilk
40+
*.exp
41+
42+
# Logs
43+
*.log
1344

14-
# Environment
15-
venv/
16-
env/
17-
/All Games Files
18-
games_data.zip
19-
pygame.py
20-
test_logic.py
21-
/webserver/games
45+
# Temporary
46+
*.tmp
47+
*.bak
48+
*.backup

CMakeLists.txt

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
project(SteamLuaPatcher VERSION 1.0 LANGUAGES CXX)
3+
4+
set(CMAKE_CXX_STANDARD 17)
5+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
6+
set(CMAKE_AUTOMOC ON)
7+
set(CMAKE_AUTORCC ON)
8+
set(CMAKE_AUTOUIC ON)
9+
10+
# Find Qt6
11+
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Network)
12+
13+
# Application icon resource (optional)
14+
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/resources/app.rc")
15+
set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_CURRENT_SOURCE_DIR}/resources/app.rc")
16+
else()
17+
set(APP_ICON_RESOURCE_WINDOWS "")
18+
endif()
19+
20+
# Source files
21+
set(SOURCES
22+
src/main.cpp
23+
src/mainwindow.cpp
24+
src/glassbutton.cpp
25+
src/loadingspinner.cpp
26+
src/workers/indexdownloadworker.cpp
27+
src/workers/luadownloadworker.cpp
28+
src/workers/restartworker.cpp
29+
src/utils/paths.cpp
30+
src/utils/colors.cpp
31+
)
32+
33+
set(HEADERS
34+
src/mainwindow.h
35+
src/glassbutton.h
36+
src/loadingspinner.h
37+
src/workers/indexdownloadworker.h
38+
src/workers/luadownloadworker.h
39+
src/workers/restartworker.h
40+
src/utils/paths.h
41+
src/utils/colors.h
42+
src/config.h
43+
)
44+
45+
# Create executable
46+
if(WIN32 AND APP_ICON_RESOURCE_WINDOWS)
47+
add_executable(SteamLuaPatcher WIN32 ${SOURCES} ${HEADERS} ${APP_ICON_RESOURCE_WINDOWS})
48+
else()
49+
add_executable(SteamLuaPatcher ${SOURCES} ${HEADERS})
50+
endif()
51+
52+
# Link Qt libraries
53+
target_link_libraries(SteamLuaPatcher PRIVATE
54+
Qt6::Core
55+
Qt6::Gui
56+
Qt6::Widgets
57+
Qt6::Network
58+
)
59+
60+
# Windows-specific settings
61+
if(WIN32)
62+
set_target_properties(SteamLuaPatcher PROPERTIES
63+
WIN32_EXECUTABLE TRUE
64+
)
65+
endif()
66+
67+
# Install
68+
install(TARGETS SteamLuaPatcher
69+
RUNTIME DESTINATION bin
70+
)

app.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
IDI_ICON1 ICON DISCARDABLE "logo.ico"

build.bat

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
@echo off
2+
echo Building Steam Lua Patcher (C++ Qt6)...
3+
echo.
4+
5+
REM Clean previous build
6+
if exist build rmdir /s /q build
7+
if exist dist rmdir /s /q dist
8+
9+
REM Create build directory
10+
mkdir build
11+
cd build
12+
13+
REM Configure with CMake
14+
echo Configuring with CMake...
15+
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ..
16+
if errorlevel 1 (
17+
echo CMake configuration failed!
18+
pause
19+
exit /b 1
20+
)
21+
22+
REM Build
23+
echo.
24+
echo Building...
25+
cmake --build . --config Release
26+
if errorlevel 1 (
27+
echo Build failed!
28+
pause
29+
exit /b 1
30+
)
31+
32+
REM Create distribution folder
33+
echo.
34+
echo Creating distribution...
35+
cd ..
36+
mkdir dist
37+
copy build\SteamLuaPatcher.exe dist\
38+
copy logo.ico dist\ 2>nul
39+
40+
REM Deploy Qt dependencies
41+
echo Deploying Qt dependencies...
42+
windeployqt dist\SteamLuaPatcher.exe --release --no-translations
43+
44+
echo.
45+
echo Build complete! Executable is in 'dist' folder.
46+
echo.
47+
pause

0 commit comments

Comments
 (0)