;title='Alchemist'
;display_title='Alchemist '
;creator=ppkantorski
;version=1.0.6
;about='This package was designed for managing, converting, and installing mods.'
;credits='Special thanks to Fl4sh9174, KeatonTheBot, StevensND, cucholix and theboy181.'
;color=#a264fa
;show_widget=true

[@Enhance]

[gap]
;mode=table
;background=false
;gap=6

[Title ID]
;mode=table
;polling=true
'Title ID'='{title_id}'
'Build ID'='{build_id}'

[Manage Mods]

[*exeFS Patches]
;mode=forwarder
package_source ./include/exefs_patches.ini


[*Contents Mods?1]
;mode=forwarder
package_source ./include/contents_mods.ini


[Convert pchtxt]

[*pchtxt  ips]
;grouping=split2
file_source './pchtxts/*/*.pchtxt'
mkdir "/atmosphere/exefs_patches/{folder_name}/"
pchtxt2ips "{file_source}" "/atmosphere/exefs_patches/{folder_name}/"

[*pchtxt  cheat]
;grouping=split2
file_source './pchtxts/*/*.pchtxt'
pchtxt2cheat "{file_source}" "{folder_name}"



[gap]
;mode=table
;background=false
;gap=12

[*Delete pchtxt]
;grouping=split2
;hold=true
file_source './pchtxts/*/*.pchtxt'
delete "{file_source}"



[@Integrate]

[gap]
;mode=table
;background=false
;gap=6

[Title ID]
;mode=table
;polling=true
'Title ID'='{title_id}'
'Build ID'='{build_id}'

[Mod Repos]

[*Install pchtxt]
;mode=forwarder
package_source ./include/pchtxt_install.ini


[*Install Contents]
;mode=forwarder
package_source ./include/contents_install.ini



[Miscellaneous]
[*Tools]
[Dot Clean]
dot-clean '/atmosphere/'
dot-clean '/switch/'
dot-clean '/config/'

[gap]
;mode=table
;background=false
;gap=10

[Dot Clean Info]
;mode=table
;background=false
;alignment=left
;offset=38
;spacing=10
''='Remove all `._` and `.DS_Store` files within'
''='`/atmosphere/`, `/switch/`, and `/config/`.'

[gap]
;mode=table
;background=false
;gap=14

[Dot Clean All]
dot-clean '/'

[gap]
;mode=table
;background=false
;gap=10

[Dot Clean All Info]
;mode=table
;background=false
;alignment=left
;offset=38
;spacing=10
''='Remove all `._` and `.DS_Store` files.'

[Miscellaneous]
[*Software Update]
;mode=forwarder

package_source ./include/software_update.ini

try:
delete ./RELEASE.ini
set-ini-val ./include/config.ini 'Update Alchemist' footer ''
delete ./repos/RELEASE.ini
set-ini-val ./include/config.ini '*Update Repos' footer ''
set-ini-val ./include/config.ini 'Update All' footer ''

download https://raw.githubusercontent.com/ppkantorski/Alchemist/refs/heads/main/RELEASE.ini ./RELEASE.ini
ini_file ./RELEASE.ini
set-ini-val ./include/config.ini 'Update Alchemist' footer '{ini_file(Release Info,latest_version)}'
json '{"null":"true","{package_version}":"false"}'
set-ini-val ./include/config.ini 'Update Alchemist' footer_highlight '{json({ini_file(Release Info,latest_version)})}'


download https://raw.githubusercontent.com/ppkantorski/Alchemist-Repos/refs/heads/main/RELEASE.ini ./repos/RELEASE.ini
ini_file ./repos/RELEASE.ini
set-ini-val ./include/config.ini '*Update Repos' footer '{ini_file(Release Info,latest_version)}'
set-ini-val ./include/config.ini 'Update All' footer '{ini_file(Release Info,latest_version)}'

ini_file ./repos/CURRENT.ini
json '{"null":"true","{ini_file(Release Info,latest_version)}":"false"}'
ini_file ./repos/RELEASE.ini
set-ini-val ./include/config.ini '*Update Repos' footer_highlight '{json({ini_file(Release Info,latest_version)})}'
set-ini-val ./include/config.ini 'Update All' footer_highlight '{json({ini_file(Release Info,latest_version)})}'


ini_file ./RELEASE.ini
json '{"null":"notify","{package_version}":""}'
'{json({ini_file(Release Info,latest_version)})}' '  Alchemist update is available!' 22

ini_file ./repos/CURRENT.ini
json '{"null":"notify","{ini_file(Release Info,latest_version)}":""}'
ini_file ./repos/RELEASE.ini
'{json({ini_file(Release Info,latest_version)})}' '  Repos update is available!' 22
