Skip to content

Commit 971ff8a

Browse files
committed
Merge branch 'camera-capture-split-cam-option' of https://github.com/Avasam/Auto-Split into More-capture-options
2 parents 69dba56 + 4e89cf1 commit 971ff8a

40 files changed

+1048
-454
lines changed

.flake8

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ per-file-ignores=
1818
; Line too long
1919
; Naming conventions can't be controlled for external libraries
2020
typings/**: Q000,E704,E501,N8
21-
2221
; PyQt methods
2322
ignore-names=closeEvent,paintEvent,keyPressEvent,mousePressEvent,mouseMoveEvent,mouseReleaseEvent
2423
; McCabe max-complexity is also taken care of by Pylint and doesn't fail the build there

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939

4040
# Initializes the CodeQL tools for scanning.
4141
- name: Initialize CodeQL
42-
uses: github/codeql-action/init@v1
42+
uses: github/codeql-action/init@v2
4343
with:
4444
languages: ${{ matrix.language }}
4545
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -50,7 +50,7 @@ jobs:
5050
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5151
# If this step fails, then you should remove it and run the build manually (see below)
5252
- name: Autobuild
53-
uses: github/codeql-action/autobuild@v1
53+
uses: github/codeql-action/autobuild@v2
5454

5555
# ℹ️ Command-line programs to run using the OS shell.
5656
# 📚 https://git.io/JvXDl
@@ -64,4 +64,4 @@ jobs:
6464
# make release
6565

6666
- name: Perform CodeQL Analysis
67-
uses: github/codeql-action/analyze@v1
67+
uses: github/codeql-action/analyze@v2

.github/workflows/lint-and-build.yml

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ jobs:
3636
uses: actions/setup-python@v4
3737
with:
3838
python-version: ${{ matrix.python-version }}
39+
cache: 'pip'
40+
cache-dependency-path: 'scripts/requirements-dev.txt'
3941
- name: Install dependencies
4042
run: |
41-
python -m pip install --upgrade pip
42-
pip install wheel
43-
pip install -r "scripts/requirements.txt"
43+
pip install -r "scripts/requirements-dev.txt"
4444
npm install -g pyright
4545
npm list -g pyright
46-
- run: scripts/compile_resources.bat
47-
- name: Analysing the code with ${{ github.job }}
46+
- run: scripts/compile_resources.ps1
47+
- name: Analysing the code with Pyright
4848
run: pyright --warnings
4949
Pylint:
5050
runs-on: windows-latest
@@ -59,14 +59,13 @@ jobs:
5959
uses: actions/setup-python@v4
6060
with:
6161
python-version: ${{ matrix.python-version }}
62+
cache: 'pip'
63+
cache-dependency-path: 'scripts/requirements-dev.txt'
6264
- name: Install dependencies
63-
run: |
64-
python -m pip install --upgrade pip
65-
pip install wheel
66-
pip install -r "scripts/requirements.txt"
67-
- run: scripts/compile_resources.bat
68-
- name: Analysing the code with ${{ github.job }}
69-
run: pylint --reports=y --output-format=colorized $(git ls-files '**/*.py')
65+
run: pip install -r "scripts/requirements-dev.txt"
66+
- run: scripts/compile_resources.ps1
67+
- name: Analysing the code with Pylint
68+
run: pylint --reports=y --output-format=colorized src/
7069
Flake8:
7170
runs-on: windows-latest
7271
strategy:
@@ -80,13 +79,12 @@ jobs:
8079
uses: actions/setup-python@v4
8180
with:
8281
python-version: ${{ matrix.python-version }}
82+
cache: 'pip'
83+
cache-dependency-path: 'scripts/requirements-dev.txt'
8384
- name: Install dependencies
84-
run: |
85-
python -m pip install --upgrade pip
86-
pip install wheel
87-
pip install -r "scripts/requirements.txt"
88-
- run: scripts/compile_resources.bat
89-
- name: Analysing the code with ${{ github.job }}
85+
run: pip install -r "scripts/requirements-dev.txt"
86+
- run: scripts/compile_resources.ps1
87+
- name: Analysing the code with Flake8
9088
run: flake8
9189
Bandit:
9290
runs-on: windows-latest
@@ -101,13 +99,12 @@ jobs:
10199
uses: actions/setup-python@v4
102100
with:
103101
python-version: ${{ matrix.python-version }}
102+
cache: 'pip'
103+
cache-dependency-path: 'scripts/requirements-dev.txt'
104104
- name: Install dependencies
105-
run: |
106-
python -m pip install --upgrade pip
107-
pip install wheel
108-
pip install -r "scripts/requirements.txt"
109-
- run: scripts/compile_resources.bat
110-
- name: Analysing the code with ${{ github.job }}
105+
run: pip install -r "scripts/requirements-dev.txt"
106+
- run: scripts/compile_resources.ps1
107+
- name: Analysing the code with Bandit
111108
run: bandit -n 1 --severity-level medium --recursive src
112109
Build:
113110
runs-on: windows-latest
@@ -122,12 +119,10 @@ jobs:
122119
uses: actions/setup-python@v4
123120
with:
124121
python-version: ${{ matrix.python-version }}
122+
cache: 'pip'
125123
- name: Install dependencies
126-
run: |
127-
python -m pip install --upgrade pip
128-
pip install wheel
129-
pip install -r "scripts/requirements.txt"
130-
- run: scripts/build.bat
124+
run: pip install -r "scripts/requirements.txt"
125+
- run: scripts/build.ps1
131126
- name: Upload Build Artifact
132127
uses: actions/upload-artifact@v3
133128
with:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
22

3+
# Caches
4+
.cache/
5+
36
# Byte-compiled / optimized / DLL files
47
__pycache__/
58

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,11 @@
7777
// Just another wrapper, use Flake8 OR this
7878
"python.linting.pylamaEnabled": false,
7979
"python.linting.banditEnabled": true,
80+
"powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline",
81+
"powershell.codeFormatting.autoCorrectAliases": true,
82+
"powershell.codeFormatting.trimWhitespaceAroundPipe": true,
83+
"powershell.codeFormatting.useConstantStrings": true,
84+
"powershell.codeFormatting.useCorrectCasing": true,
85+
"powershell.codeFormatting.whitespaceBetweenParameters": true,
86+
"powershell.integratedConsole.showOnStartup": false,
8087
}

.vscode/tasks.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Build AutoSplit",
6+
"type": "shell",
7+
"command": "scripts/build.ps1",
8+
"group": {
9+
"kind": "build",
10+
"isDefault": true
11+
}
12+
}
13+
],
14+
}

README.md

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,25 @@ This program can be used to automatically start, split, and reset your preferred
1818

1919
## DOWNLOAD AND OPEN
2020

21-
### Compatibility
22-
23-
- Windows 7, 10, and 11.
21+
- Download the [latest version](/../../releases/latest)
2422

25-
### Opening the program
23+
### Compatibility
2624

27-
- Download the [latest version](/../../releases/latest)
28-
- Extract the file and open AutoSplit.exe.
25+
- Windows 10 and 11.
2926

3027
### Building
3128

3229
(This is not required for normal use)
3330

34-
- Python 3.8 - 3.10
35-
- Microsoft Visual C++ 14.0 or greater may be required to build the executable. Get it with [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/)
31+
- Python 3.9 - 3.10.
32+
- Microsoft Visual C++ 14.0 or greater may be required to build the executable. Get it with [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/).
3633
- Node is optional, but required for complete linting (using Pyright).
37-
- Read [requirements.txt](/scripts/requirements.txt) for more information on how to install, run and build the python code
38-
- Run `.\scripts\install.bat` to install all dependencies
39-
- Run the app directly with `.\scripts\start.bat [--auto-controlled]`
40-
- Run `.\scripts\build.bat` to build an executable
41-
- Recompile resources after modifications by running `.\scripts\compile_resources.bat`
34+
- Read [requirements.txt](/scripts/requirements.txt) for more information on how to install, run and build the python code.
35+
- Run `./scripts/install.ps1` to install all dependencies.
36+
- Run the app directly with `./scripts/start.ps1 [--auto-controlled]`.
37+
- Run `./scripts/build.ps1` to build an executable.
38+
- Recompile resources after modifications by running `.\scripts\compile_resources.ps1`.
39+
- All configured for VSCode, including Run (F5) and Build (Ctrl+Shift+B) commands.
4240

4341
## OPTIONS
4442

@@ -54,36 +52,37 @@ This program can be used to automatically start, split, and reset your preferred
5452
#### Capture Region
5553

5654
- This is the region that your split images are compared to. Usually, this is going to be the full game screen.
57-
- Click "Select Region"
55+
- Click "Select Region".
5856
- Click and drag to form a rectangle over the region you want to capture.
5957
- Adjust the x, y, width, and height of the capture region manually to make adjustments as needed.
60-
- If you want to align your capture region by using a reference image, click "Align Region"
58+
- If you want to align your capture region by using a reference image, click "Align Region".
6159
- You can freely move the window that the program is capturing, but resizing the window will cause the capture region to change.
6260
- Once you are happy with your capture region, you may unselect Live Capture Region to decrease CPU usage if you wish.
6361
- You can save a screenshot of the capture region to your split image folder using the Take Screenshot button.
6462

6563
#### Avg. FPS
6664

67-
- Calculates the average comparison rate of the capture region to split images. This value will likely be much higher than needed (unless you [Force Full-Content-Rendering](#Full-Content-Rendering)), so it is highly recommended to limit your FPS depending on the frame rate of the game you are capturing.
65+
- Calculates the average comparison rate of the capture region to split images. This value will likely be much higher than needed, so it is highly recommended to limit your FPS depending on the frame rate of the game you are capturing.
6866

6967
### Settings
7068

7169
#### Comparison Method
7270

7371
- There are three comparison methods to choose from: L2 Norm, Histograms, and Perceptual Hash (or pHash).
74-
- L2 Norm: This method should be fine to use for most cases. it finds the difference between each pixel, squares it, and sums it over the entire image and takes the square root. This is very fast but is a problem if your image is high frequency. Any translational movement or rotation can cause similarity to be very different.
72+
- L2 Norm: This method should be fine to use for most cases. it finds the difference between each pixel, squares it, sums it over the entire image and takes the square root. This is very fast but is a problem if your image is high frequency. Any translational movement or rotation can cause similarity to be very different.
7573
- Histograms: An explanation on Histograms comparison can be found [here](https://mpatacchiola.github.io/blog/2016/11/12/the-simplest-classifier-histogram-intersection.html). This is a great method to use if you are using several masked images.
7674
- Perceptual Hash: An explanation on pHash comparison can be found [here](http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html). It is highly recommended to NOT use pHash if you use masked images. It is very inaccurate.
7775

7876
#### Capture Method
7977

8078
- **BitBlt** (fastest, least compatible)
81-
A good default fast option. Also allows recording background windows (as long as they still actually render when in the background), but it cannot properly record OpenGL, Hardware Accelerated or Exclusive Fullscreen windows.
82-
The smaller the region, the more efficient it is.
83-
- **Windows Graphics Capture** (fast, most compatible but less features)
79+
A good default fast option. But it cannot properly record OpenGL, Hardware Accelerated or Exclusive Fullscreen windows.
80+
The smaller the selected region, the more efficient it is.
81+
- **Windows Graphics Capture** (fast, most compatible, capped at 60fps)
8482
Only available in Windows 10.0.17134 and up.
8583
Due to current technical limitations, it requires having at least one audio or video Capture Device connected and enabled. Even if it won't be used.
8684
Allows recording UWP apps, Hardware Accelerated and Exclusive Fullscreen windows.
85+
Adds a yellow border on Windows 10 (not on Windows 11).
8786
Caps at around 60 FPS.
8887
- **Direct3D Desktop Duplication** (slower, bound to display)
8988
Duplicates the desktop using Direct3D.
@@ -93,6 +92,10 @@ This program can be used to automatically start, split, and reset your preferred
9392
- **Force Full Content Rendering** (very slow, can affect rendering pipeline)
9493
Uses BitBlt behind the scene, but passes a special flag to PrintWindow to force rendering the entire desktop.
9594
About 10-15x slower than BitBlt based on original window size and can mess up some applications' rendering pipelines.
95+
- **Video Capture Device** (very slow, see below)
96+
Uses a Video Capture Device, like a webcam, virtual cam, or capture card.
97+
There are currently performance issues, but it might be more convenient.
98+
If you want to use this with OBS' Virtual Camera, use the [Virtualcam plugin](https://obsproject.com/forum/resources/obs-virtualcam.949/) instead.
9699

97100
#### Show Live Similarity
98101

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ ignore-paths = [
7878
# Auto generated
7979
"^src/gen/.*$",
8080
# We expect stub files to be incomplete or contain useless statements
81-
"^.*\\.pyi$",
81+
"^.*.pyi$",
8282
]
83-
extension-pkg-allow-list = ["PyQt6", "win32ui"]
83+
extension-pkg-allow-list = ["PyQt6", "PySide6", "win32ui"]
8484

8585
[tool.pylint.FORMAT]
8686
max-line-length = 120

0 commit comments

Comments
 (0)