Archipelago icon indicating copy to clipboard operation
Archipelago copied to clipboard

Pokémon Gen 3 Adjuster: implement main code

Open RhenaudTheLukark opened this issue 7 months ago • 7 comments

What is this fixing or adding?

This pull request adds an adjuster that allows applying sprite packs to Pokémon Emerald, Pokémon Firered and Pokémon Leafgreen.

This is only the internal and UI code for the adjuster, other pull requests have been made on the Pokémon Emerald world fork and the Pokémon Firered/Leafgreen world fork. These contain the bindings that add the adjuster as a component to Archipelago, as well as the documentation surrounding the adjuster.

This commit also adds a function that allows world maintainers to open PIL images securely, named open_image_secure in Utils.py. The addition of Pillow for world folders was discussed in the Discord server, and it was agreed upon with the condition that a function would be made to securely load PNG files without allowing other types of files to be opened (ex: Ghostscript files), and that Pillow integration would be disabled for kivy (which is not something I was told to do myself).

How was this tested?

Manually, over many asyncs.

RhenaudTheLukark avatar Jun 05 '25 17:06 RhenaudTheLukark

The system should be good now, apologies for the last commits, I noticed a couple of small graphical issues in my latest async, but there should not be any more issues to tackle.

RhenaudTheLukark avatar Jun 10 '25 02:06 RhenaudTheLukark

The Utils.py changes add a dependency to Utils.py which will cause a missing PIL module error when frozen with the setup.py process, so that needs adjustments.

TreZc0 avatar Jun 28 '25 14:06 TreZc0

As I've expressed in my main message, there has been talks about unfreezing PIL and giving worlds access to it. Would that point be enough for you or do you need an actual change?

RhenaudTheLukark avatar Jun 28 '25 14:06 RhenaudTheLukark

Currently can't get this to work using the FRLG apworld, may be Linux-specific.

When I run the adjuster from the launcher, I get this error:

Process PokemonGen3Adjuster:
Traceback (most recent call last):
  File "/usr/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/lib/python3.11/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/run/media/files/Games/Archipelago Adjuster/worlds/_pokemon_gen3_adjuster/adjuster.py", line 1141, in launch
    asyncio.run(main())
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/run/media/files/Games/Archipelago Adjuster/worlds/_pokemon_gen3_adjuster/adjuster.py", line 172, in main
    adjust_gui()
  File "/run/media/files/Games/Archipelago Adjuster/worlds/_pokemon_gen3_adjuster/adjuster.py", line 197, in adjust_gui
    window = Tk()
             ^^^^
  File "/usr/lib/python3.11/tkinter/tix.py", line 221, in __init__
    self.tk.eval('package require Tix')
_tkinter.TclError: can't find package Tix

I'm on EndeavourOS with the python311 AUR package. I can run the other adjusters just fine so it likely isn't a tk issue on my system.

FlitPix avatar Aug 01 '25 03:08 FlitPix

The last line says the error: you're missing a package, specifically the package Tix (tix-dev). I believe you have to install it on your machine with apt-get!

RhenaudTheLukark avatar Aug 01 '25 07:08 RhenaudTheLukark

Looked further into it. Tix is not in the Arch repos, nor is it an active AUR package. It also doesn't appear to be in active development, so I doubt this will change anytime soon: https://sourceforge.net/projects/tix/

EDIT: Per Python docs, it's deprecated, so we really shouldn't use this: https://docs.python.org/3.11/library/tkinter.tix.html

On August 1, 2025 3:02:00 AM EDT, Rhenaud Dubois @.***> wrote:

RhenaudTheLukark left a comment (ArchipelagoMW/Archipelago#5085)

The last line says the error: you're missing a package, specifically the package Tix. I'll try to add it as a dependency whenever I can!

-- Reply to this email directly or view it on GitHub: https://github.com/ArchipelagoMW/Archipelago/pull/5085#issuecomment-3143091593 You are receiving this because you commented.

Message ID: @.***>

FlitPix avatar Aug 01 '25 13:08 FlitPix

There is a remake of the UI in the works so it uses kivy instead of tkinter, which should remove this dependency. In the meantime, the main reason I'm using Tix is so I can include tooltips in the app. I could remove them, but I'm currently working on the kivy remake, which should just be better overall.

RhenaudTheLukark avatar Aug 01 '25 19:08 RhenaudTheLukark