Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to py qt6 #66

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{
"recommendations": [
"ms-pyright.pyright",
"ms-python.vscode-pylance",
"ms-python.python",
"sonarsource.sonarlint-vscode",
"davidanson.vscode-markdownlint"
"davidanson.vscode-markdownlint",
"shardulm94.trailing-spaces",
"eamodio.gitlens"
],
"unwantedRecommendations": [
"ms-pyright.pyright",
"esbenp.prettier-vscode"
]
}
23 changes: 12 additions & 11 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,13 @@
120,
]
},
"[py]": {
"editor.tabSize": 4,
"editor.rulers": [
72,
79,
120,
]
},
"//1": "Keeping autoformat to false for now to keep minimal changes",
// Keeping autoformat to false for now to keep minimal changes
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll": false,
},
"python.linting.pylintEnabled": false,
"//2": "Using flake8 as other linters are incomplete or have too many false positives last I tried",
// Using flake8 as other linters are incomplete or have too many false positives last I tried
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.linting.pycodestyleEnabled": false,
Expand All @@ -43,6 +35,15 @@
"python.formatting.autopep8Args": [
"--max-line-length=120"
],
"python.pythonPath": "",
"files.insertFinalNewline": true,
"trailing-spaces.deleteModifiedLinesOnly": true,
"trailing-spaces.includeEmptyLines": true,
"trailing-spaces.trimOnSave": true,
"trailing-spaces.syntaxIgnore": [
"markdown"
],
"files.associations": {
"*.qrc": "xml",
"*.ui": "xml"
},
}
47 changes: 35 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
# <img src="https://raw.githubusercontent.com/austinryan/Auto-Split/master/icon.ico" alt="LiveSplit" height="42" width="45" align="top"/> AutoSplit</h1>
# <img src="https://raw.githubusercontent.com/Toufool/Auto-Split/master/res/icon.ico" alt="LiveSplit" height="42" width="45" align="top"/> AutoSplit</h1>

This program compares split images to a capture region of any window (OBS, xsplit, etc.) and automatically hits your split hotkey when there is a match. It can be used in tandem with any speedrun timer that accepts hotkeys (LiveSplit, wsplit, etc.). The purpose of this program is to remove the need to manually press your split hotkey and also increase the accuracy of your splits.
This program compares split images to a capture region of any window (OBS, xsplit, etc.) and automatically hits your split hotkey when there is a match. It can be used in tandem with any speedrun timer that accepts hotkeys (LiveSplit, wsplit, etc.). The purpose of this program is to remove the need to manually press your split hotkey and also increase the accuracy of your splits.

<p align="center">
<img src="https://github.com/austinryan/Auto-Split/blob/master/example1.5.0.gif" />
</p>
![example](res/example1.5.0.gif)

# TUTORIAL

## DOWNLOAD AND OPEN

### Compatability
- Windows 7, 10, and 11

- Windows 7, 10, and 11.

### Building

- Read [requirements.txt](/scripts/requirements.txt) for information on how to install, run and build the python code.

### Opening the program
- Download the [latest version](https://github.com/austinryan/Auto-Split/releases)

- Download the [latest version](/Toufool/Auto-Split/releases)
- Extract the file and open AutoSplit.exe.

### Building

- Read [requirements.txt](/requirements.txt) for information on how to run/build the python code (this is not required for normal use).

## Split Image Folder

- Supported image file types: .png, .jpg, .jpeg, .bmp, and [more](https://docs.opencv.org/3.0-beta/modules/imgcodecs/doc/reading_and_writing_images.html#imread).
- Images can be any size.
- Images are matched in alphanumerical order.
Expand All @@ -29,6 +35,7 @@ This program compares split images to a capture region of any window (OBS, xspli
- Images can be created using Print Screen, [Snipping Tool](https://support.microsoft.com/en-us/help/4027213/windows-10-open-snipping-tool-and-take-a-screenshot), or AutoSplit's Take Screenshot button.

## Capture Region

- This is the region that your split images are compared to. Usually, this is going to be the full game screen.
- Click "Select Region"
- Click and drag to form a rectangle over the region you want to capture.
Expand All @@ -39,33 +46,41 @@ This program compares split images to a capture region of any window (OBS, xspli
- You can save a screenshot of the capture region to your split image folder using the Take Screenshot button.

## Max FPS

- Calculates the maximum 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.

## OPTIONS

### Comparison Method

- There are three comparison methods to choose from: L2 Norm, Histograms, and pHash.
- L2 Norm: This method 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.
- 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.
- pHash: 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.
- Note: v1.0 used L2 Norm.

### Show Live Similarity

- Displays the live similarity between the capture region and the current split image. This number is between 0 and 1, with 1 being a perfect match.

### Show Highest Similarity

- Shows the highest similarity between the capture region and current split image.

### Similarity Threshold

- When the live similarity goes above this value, the program hits your split hotkey and moves to the next split image.

### Pause Time

- Time in seconds that the program stops comparison after a split. Useful for if you have two of the same split images in a row and want to avoid double-splitting. Also useful for reducing CPU usage.

### Delay Time

- Time in milliseconds that the program waits before hitting the split hotkey for that specific split.

### Custom Split Image Settings

- Each split image can have different thresholds, pause times, delay split times, loop amounts, and can be flagged.
- These settings are handled in the image's filename.
- Custom thresholds are place between parenthesis `()` in the filename and the custom thresholds checkbox must be checked. All images must have a custom threshold if the box is checked.
Expand All @@ -85,22 +100,24 @@ This program compares split images to a capture region of any window (OBS, xspli
- `004_SplitName(0.9)_[10]_#3500#_@3@_{b}.png` is the fourth split image with a threshold of 0.9, pause time of 10 seconds, delay split time of 3.5 seconds, will loop 3 times, and will split when similarity is below the threshold rather than above.

### How to Create a Masked Image

The best way to create a masked image is to set your capture region as the entire game screen, take a screenshot, and use a program like [paint.net](https://www.getpaint.net/) to "erase" (make transparent) everything you don't want the program to compare. More on how to creating images with transparency using paint.net can be found in [this tutorial](https://www.youtube.com/watch?v=v53kkUYFVn8). The last thing you need to do is add {m} to the filename. For visualization, here is what the capture region compared to a masked split image looks like if you would want to split on "Shine Get!" text in Super Mario Sunshine:

<p align="center">
<img src="https://raw.githubusercontent.com/Toufool/Auto-Split/master/mask_example_image.PNG" />
</p>
![mask_example](res/mask_example_image.PNG)

### Reset image

You can have one (and only one) image with the keyword `reset` in its name. AutoSplit will press the reset button when it finds this image. This image will only be used for resets and it will not be tied to any split. You can set a probability and pause time for it. A custom threshold MUST be applied to this image. The pause time is the amount of seconds AutoSplit will wait before checking for the reset image once the run starts. Also the image can be masked, for example: `Reset_(0.95)_[10]_{m}.png`.

### Timer Global Hotkeys

- Click "Set Hotkey" on each hotkey to set the hotkeys to AutoSplit. The Start / Split hotkey and Pause hotkey must be the same as the one used in your preferred timer program in order for the splitting/pausing to work properly.
- Make sure that Global Hotkeys are enabled in your speedrun timer.
- All of these actions can also be handled by their corresponding buttons.
- Note that pressing your Pause Hotkey does not serve any function in AutoSplit itself and is strictly used for the Pause flag.

### Group dummy splits when undoing / skipping

If this option is disabled, AutoSplit will not account for dummy splits when undoing/skipping. Meaning it will cycle through ths splits normally even if they are dummy splits (this was the normal behavior in versions 1.2.0 and older).

If it is enabled, AutoSplit will group dummy splits together with a real split when undoing/skipping. This basically allows you to tie one or more dummy splits to a real split to keep it in sync with LiveSplit/wsplit.
Expand All @@ -118,11 +135,13 @@ In this situation you would have only 3 splits in LiveSplit/wsplit (even though
Please note this option cannot currently be used if you have any loop parameter `@@` greater than 1 in any image.

### Loop Split Images

If this option is enabled, when the last split meets the threshold and splits, AutoSplit will loop back to the first split image and continue comparisons.
If this option is disabled, when the last split meets the threshold and splits, AutoSplit will stop running comparisons.
This option does not loop single, specific images. See the Custom Split Image Settings section above for this feature.

### Auto Start On Reset

If this option is enabled, when the reset hotkey is hit, the reset button is pressed, or the reset split image meets its threshold, AutoSplit will reset and automatically start again back at the first split image.
If this option is disabled, when the reset hotkey is hit, the reset button is pressed, or the reset split image meets its threshold, AutoSplit will stop running comparisons.

Expand All @@ -134,27 +153,31 @@ If this option is disabled, when the reset hotkey is hit, the reset button is pr
- If you are upgrading to Windows 11, it's possible that save files may not transfer perfectly. You may need to readjust or reselect your Capture Region, for example.

## Known Limitations

- For many games, it will be difficult to find a split image for the last split of the run.
- The window of the capture region cannot be minimized.

## Known Issues

- Using numpad number keys when numlock is on does not split correctly. Either avoid using numpad or turn numlock off to avoid this issue.
- LiveSplit and wsplit will not split correctly if you are holding shift, ctrl, or alt when a match occurs.
- Numlock on keys are linked to numlock-off keys. For example, if you set your reset hotkey to 2, you can hit arrow down and it will reset and vice versa.

## Resources

- Still need help? [Open an issue](https://github.com/Toufool/Auto-Split/issues)
- Join the [AutoSplit Discord](https://discord.gg/Qcbxv9y)


## Credits
- https://github.com/harupy/ for the snipping tool code that I used to integrate into the autosplitter.

- <https://github.com/harupy/> for the snipping tool code that I used to integrate into the autosplitter.
- [amaringos](https://twitter.com/amaringos) for the icon.
- [ZanasoBayncuh](https://twitter.com/ZanasoBayncuh) for motivating me to start this project back up and for all of the time spent testing and suggesting improvements.
- [Avasam](https://twitter.com/Avasam06) for their continued work on making an incredible amount of improvements and changes to AutoSplit while I have not had the time/motivation to do so.
- Created by [Toufool](https://twitter.com/Toufool) and [Faschz](https://twitter.com/faschz).

## Donate

If you enjoy using the program, please consider donating. Thank you!

[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=BYRHQG69YRHBA&item_name=AutoSplit+development&currency_code=USD&source=url)
22 changes: 0 additions & 22 deletions requirements.txt

This file was deleted.

49 changes: 26 additions & 23 deletions res/about.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
<rect>
<x>0</x>
<y>0</y>
<width>276</width>
<height>249</height>
<width>264</width>
<height>250</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>276</width>
<height>249</height>
<width>264</width>
<height>250</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>276</width>
<height>249</height>
<width>264</width>
<height>250</height>
</size>
</property>
<property name="windowTitle">
Expand All @@ -32,10 +32,10 @@
<widget class="QPushButton" name="okButton">
<property name="geometry">
<rect>
<x>190</x>
<x>180</x>
<y>220</y>
<width>71</width>
<height>21</height>
<width>75</width>
<height>24</height>
</rect>
</property>
<property name="text">
Expand All @@ -47,52 +47,55 @@
<rect>
<x>10</x>
<y>44</y>
<width>151</width>
<height>16</height>
<width>161</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Created by &lt;a href=&quot;https://twitter.com/toufool&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Toufool&lt;/span&gt;&lt;/a&gt; and &lt;a href=&quot;https://twitter.com/faschz&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Faschz&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Created by &lt;a href=&quot;https://twitter.com/toufool&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Toufool&lt;/span&gt;&lt;/a&gt; and &lt;a href=&quot;https://twitter.com/faschz&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Faschz&lt;/span&gt;&lt;/a&gt;&lt;br/&gt;Maintained by &lt;a href=&quot;https://twitter.com/Avasam06&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Avasam&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="versionLabel">
<property name="geometry">
<rect>
<x>10</x>
<y>21</y>
<width>71</width>
<width>161</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Version: 1.2.0</string>
<string>Version:</string>
</property>
</widget>
<widget class="QLabel" name="donatetextLabel">
<property name="geometry">
<rect>
<x>46</x>
<x>30</x>
<y>95</y>
<width>191</width>
<height>41</height>
<width>204</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string>If you enjoy using this program, please
consider donating. Thank you!</string>
consider donating. Thank you!</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="donatebuttonLabel">
<property name="geometry">
<rect>
<x>52</x>
<y>127</y>
<width>171</width>
<height>91</height>
<x>60</x>
<y>150</y>
<width>147</width>
<height>47</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://www.paypal.com/cgi-bin/webscr?cmd=_donations&amp;business=BYRHQG69YRHBA&amp;item_name=AutoSplit+development&amp;currency_code=USD&amp;source=url&quot;&gt;&lt;img src=&quot;:/resources/donatebutton.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://www.paypal.com/cgi-bin/webscr?cmd=_donations&amp;amp;business=BYRHQG69YRHBA&amp;amp;item_name=AutoSplit+development&amp;amp;currency_code=USD&amp;amp;source=url&quot;&gt;&lt;img src=&quot;:/resources/btn_donateCC_LG.png&quot;/&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
Expand Down
Binary file added res/btn_donateCC_LG.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading