Skip to content

Commit

Permalink
added wiki button+fixed linux build (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
chpoit committed Jun 22, 2022
1 parent ca6d3ac commit 1f12453
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 38 deletions.
30 changes: 30 additions & 0 deletions PATCHNOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Patch Notes (Updated June 22nd 2022)
- 1.6
- Added an app language dropdown
- Version Checker automatically updates language files
- Other updates (main app, skills and corrections) are still "on demand" when there is an update
- App and game language are now stored inside a config file
- Added a --reset cmd option to clear the config file
- Languages in language dropdowns should show up in the actual language
- NOTE: They are probably wrong
- Added a "Go to Set Searcher" button


# Older patch notes

- 1.5.3 (FEB 3rd 2022)
- Updated where language packs are downloaded from,
- Github changed where "raw" data was fetched from and broke "fresh" installs
- Updated the bundle tesseract to be version 5
- Shouldn't really change anything
- General update to bundled corrections and others
- For some reason the PC version of the game has the `Quick Sheath` skill as `Quick Sheathe`, added a correction to map it
- 1.5.2
- Adds update checking
- Allows for independent skills/auto-corrections/localization updates
- Adds initial support for localization (only through command line flags however (`-a` or `--app-language`))
- 1.5.1
- Resolves issues with local directory creation found in #20
- 1.5
- Now with a User Interface
- Support for [Multiple Game languages](#supported-game-language)
57 changes: 27 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,39 @@ This repo contains code that will allow you to extract all of your charms in Mon

It's called Utsushi's charm because I thought it would be funny to make a complementary "Utsushi's Armor Search System", but [this armor set searcher](https://mhrise.wiki-db.com/sim/?hl=en) exists. I might still try to port Athena's ASS for MHW to MHR, but for now this works for me.

# Patch Notes (Updated Feb 3rd 2022)
- 1.5.3
- Updated where language packs are downloaded from,
- Github changed where "raw" data was fetched from and broke "fresh" installs
- Updated the bundle tesseract to be version 5
- Shouldn't really change anything
- General update to bundled corrections and others
- For some reason the PC version of the game has the `Quick Sheath` skill as `Quick Sheathe`, added a correction to map it
- 1.5.2
- Adds update checking
- Allows for independent skills/auto-corrections/localization updates
- Adds initial support for localization (only through command line flags however (`-a` or `--app-language`))
- 1.5.1
- Resolves issues with local directory creation found in #20
- 1.5
- Now with a User Interface
- Support for [Multiple Game languages](#supported-game-language)
# Patch Notes (Updated June 22nd 2022)
- 1.6
- Added an app language dropdown
- Version Checker automatically updates language files
- Other updates (main app, skills and corrections) are still "on demand" when there is an update
- App and game language are now stored inside a config file
- Added a --reset cmd option to clear the config file
- Languages in language dropdowns should show up in the actual language
- NOTE: They are probably wrong
- Added a "Go to Set Searcher" button

The rest of the patch notes can be found [here](PATCHNOTES.md)

# Usage

## Requirements
- A computer (Windows)
- Linux and Mac might work too, you won’t be able to run the EXE and will have to run from source in a terminal window. Refer to [Running from source](#Running-from-source)
- A 1.5.3 build for arch linux is provided, but it likely wont work, no bad in trying it anyway.
- A 1.6.0 build for Arch Linux is provided, since it's pyinstaller it *should* work everywhere, but lets get real, it probably wont
- ~~A MacOS build is also provided for 1.6.0, but it's built on a hackintosh VM so you should assume it doesn't work and run from source.~~
- A USB cable to connect your switch to transfer files
- [The latest version of this](https://github.com/chpoit/utsushis-charm/releases/latest) downloaded to your computer (Utsushis-Charm_**vx_x**.zip)
- You only need the executable. The inputs folder is only there for faster setup
- Alternatively use a capture card and record the screen. View the [FAQ](#faq) for Genki Shadowcast information
- [The latest version of Utsushi's Charm](https://github.com/chpoit/utsushis-charm/releases/latest) downloaded to your computer (Utsushis-Charm_**vx_x**.zip)
- You only need the executable. The inputs folder is only there for faster setup (Put the videos in there)
- Being able to read

## Steps

0. Unequip all jewels. You will create "fake" charms otherwise.
- Item Box -> Manage Equipment -> Set Decorations -> Equipment Box -> Remove all (Press '-' on controller)
- Don't ask, this is way out of scope for something that takes you 30 seconds to do.
1. Download the release bundle and follow the [Requirements](##Requirements) section (Utsushis-Charm_**vx_x**.zip)
- It wont break your loadouts, if you re-equip them, they will be put back in.
1. Download the release bundle and follow the [Requirements](##Requirements) section (Utsushis-Charm_**vx_x**.zip) (You should have done this already)
2. Record clips similar to the following of you going through your charms. Try placing the UI in front of something that is very "flat" in color and doesn't have NPCs walking in front.
- I can easily go through 2-3 pages of charms in 30 seconds.
- Use a stopwatch on your phone if you have trouble timing the 30 seconds. I saved a clip every ~25 seconds.
Expand Down Expand Up @@ -118,6 +116,10 @@ Having translations for the instructions for other languages might be useful, bu
- Q: Does this Work for the PC version
- Yes. As long as your resolution is 720p or above, and has a 16:9 ratio, it should
- Basically, 1080p, 1440p, 4k and above should work without issues, albeit, the higher the resolution, the slower.
- Q: I'm trying to enter a skill in the Skill Correction thing and it doesn't work
- This might be because the PC version has a different name for the skill, add it to the corrections.lang.csv file, or tell me to do it.
- An example of this would be `Quick Sheath`, which is named `Quick Sheathe` on PC
- Make sure you give me both versions of the skill name if you think the PC version messed up again.

# Notes
- Version 1.5 is the last version that will officially support console mode, I may fix it from time to time if I need it for dev reasons, but I don't want to maintain a secondary workflow that will likely be used by nobody.
Expand Down Expand Up @@ -185,15 +187,10 @@ In all seriousness, the work is done in a few broad steps:
- Please use the default settings of `black` to format the python source code.

# TODOS:
- [ ] Throw out Google Tesseract/Try newer version
- Version 4 works great, this is going on the back burner for a while
- Version 3 has trouble with quite a few words (Slugger, Recovery, Earplugs, Counterstrike, Maestro, etc.)
- I'm considering going full monkey brain and having one "mask" per skill like I'm doing for the slots and skill levels.
- The monkey brain approach would probably make it so this can be run completely unattended, at the cost of some extra storage space.
- Monkey brain results:
- Monkey brain is less accurate
- Tesseract 4 works great
- Need to do some "pixel poking" to make sure everything is lined up the same
- [ ] Add an "Eager" mode where only a fraction of the frames are kept (should try to calculate the min frames to change to a charm and double or 1.5 times it)
- [ ] Maybe finish the "charm value calculator #23" (The more I worked on it the less I find it useful)
- [ ] Maybe add a "This charm isn'T actully empty" thing. Some of my Special Ammo Boost lvl2s are just invisible (might be related to something else)
- [ ] Improve the skill corrections UI/behavior
- [ ] Make the code not a mess
- [ ] ~~Multithreading for some of that SPEEEEED~~
- Unfortunately, the joblib 'loky' backend wont work with frozen executables, and the other backends offer no noticeable gain in performance. This is getting shelved until a potential rewrite under a "faster" rewrite. Current execution time is 4-8 minutes so it's really not too bad.
Expand Down
5 changes: 4 additions & 1 deletion data/translations/eng.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,8 @@
"new-app-update": "A new version for Utsushi's Charm is available (You: {}, New: {}), do you want to download it?",
"new-skill-update": "New skills were released in-game (You: {}, New: {}), do you want to update your skill list?",
"new-app-language-update": "An updated language file for Utsushi's Charm is available (You: {}, New: {}), do you want to download it?",
"new-skill-correction-update": "New automatic skill corrections were submitted (You: {}, New: {}), do you download them?"
"new-skill-correction-update": "New automatic skill corrections were submitted (You: {}, New: {}), do you download them?",
"wiki-button": "Open MHR Set Searcher",
"wiki-clipboard": "Copy URL",
"wiki-attempt": "Attempting to open the website..."
}
5 changes: 4 additions & 1 deletion data/translations/fra.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,8 @@
"new-app-update": "une nouvelle version d'Utsushi's Charm est disponible (Locale: {}, Nouvelle: {}), voulez-vous la télécharger?",
"new-skill-update": "Une nouvelle liste de skills est disponible (Locale: {}, Nouvelle: {}), voulez-vous la mettre à jour?",
"new-app-language-update": "Une nouveau fichier de traduction pour Utsushi's Charm est disponible (Locale: {}, Nouvelle: {}), voulez-vous la télécharger?",
"new-skill-correction-update": "Des nouvelles corrections automatiques ont été soumises, (Locale: {}, Nouvelle: {}), voulez-vous les télécharger?"
"new-skill-correction-update": "Des nouvelles corrections automatiques ont été soumises, (Locale: {}, Nouvelle: {}), voulez-vous les télécharger?",
"wiki-button": "Visiter le MHR Set Searcher",
"wiki-clipboard": "Copier l'URL",
"wiki-attempt": "Tentative d'ouverture du site web..."
}
4 changes: 2 additions & 2 deletions data/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"app": "1.5.3",
"skills": "3.0",
"languages": {
"eng": "1.0.1",
"eng": "1.1",
"jpn": 0,
"fra": "1.0.0",
"fra": "1.1",
"ita": 0,
"deu": 0,
"spa": 0,
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sub=_
version_str="${version/./$sub}"
archive_name="Utsushis-Charm_v${version_str}_linux.zip"

python ./scripts/update_ver.py %version%
python ./scripts/update_ver.py $version

rm -f $archive_name
rm -rf "./build"
Expand Down
6 changes: 6 additions & 0 deletions scripts/update_ver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

new_version = sys.argv[-1]

if new_version is sys.argv[0]:
print("Version was not updated")
exit()

print("Writing", new_version, "to file")

with open(os.path.join("data", "versions.json"), "r") as f:
versions = json.load(f)
versions["app"] = new_version
Expand Down
2 changes: 1 addition & 1 deletion src/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def main(args):
version_checker = VersionChecker()

language_versions = version_checker.get_language_versions()
print(language_versions)

for language_version in language_versions:
lang, code, local, remote = language_version
if local < remote:
Expand Down
2 changes: 2 additions & 0 deletions src/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

HOME = str(Path.home())
WINDOWS = platform.system() == "Windows"
LINUX = platform.system() == "Linux"
MAC = platform.system() == "Darwin"


def get_all_skills(lang="eng"):
Expand Down
6 changes: 5 additions & 1 deletion src/tesseract/tesseract_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ def _is_pyinstaller():

def _get_pyinstaller_tesseract_path():
base_path = sys._MEIPASS
bundled_path = os.path.join(base_path, "Tesseract-OCR", "libtesseract-5.dll")
if WINDOWS:
bundled_path = os.path.join(base_path, "Tesseract-OCR", "libtesseract-5.dll")
else:
bundled_path = os.path.join(base_path, "libtesseract.so.5")
print("Expected Tesseract location", bundled_path)
return bundled_path


Expand Down
24 changes: 23 additions & 1 deletion src/ui/MainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from ..charm_extraction import extract_charms, save_charms, remove_duplicates
from ..charm_encoding import encode_charms
from ..Charm import Charm, CharmList
from ..arg_builder import build_args
from ..utils import print_licenses # TODO
from ..resources import (
get_language_from_code,
Expand All @@ -22,11 +21,13 @@
from ..translator import Translator
from .PbarWrapper import PbarWrapper
from .ParseRepairWindow import ParseRepairWindow
import webbrowser


class MainWindow(tk.Tk):
def __init__(self, _: Translator, args, skill_language_code, app_langs):
super().__init__()
self.wiki_url = "https://mhrise.wiki-db.com/sim/?hl=en"
self.charms = CharmList()
self.args = args
self._unchanged_langs = app_langs
Expand Down Expand Up @@ -81,6 +82,17 @@ def _update_game_lang(self, language: str):
self._skill_language_code = code
save_game_language(code)

def _open_wiki(self, _: Translator = None):
if not _:
_ = self._
print(_("wiki-attempt"))
webbrowser.open(self.wiki_url)

def _copy_wiki_url(self):
self.clipboard_clear()
self.clipboard_append(self.wiki_url)
self.update()

def _build_ui(self, _: Translator = None):
if not _:
_ = self._
Expand Down Expand Up @@ -150,6 +162,14 @@ def _buttons(parent=self):
command=self._update_lang,
)

self.wiki_button = tk.Button(
button_frame, text=_("wiki-button"), command=self._open_wiki
)

self.wiki_clipboard_button = tk.Button(
button_frame, text=_("wiki-clipboard"), command=self._copy_wiki_url
)

self.app_lang_menu.grid(column=0, row=0, sticky="w")
self.input_btn.grid(column=0, row=1, sticky="w")
self.frame_btn.grid(column=0, row=2, sticky="w")
Expand All @@ -162,6 +182,8 @@ def _buttons(parent=self):

self.save_charms_btn.grid(column=0, row=4, sticky="w")
self.copy_to_clip_btn.grid(column=0, row=5, sticky="w")
self.wiki_button.grid(column=0, row=6, sticky="w")
self.wiki_clipboard_button.grid(column=0, row=7, sticky="w")

return button_frame

Expand Down

0 comments on commit 1f12453

Please sign in to comment.