Simple ini switcher script (profile manager)

Discussion of developmental aspects of the MiSTer Project.
User avatar
morf77
Posts: 63
Joined: Fri Aug 28, 2020 1:42 pm
Has thanked: 12 times
Been thanked: 24 times

Simple ini switcher script (profile manager)

Unread post by morf77 »

This script should be useful if you have more ini files than you can fit into the current MiSTer.ini and two alt ini's (eg 4x.ini, 5x.ini, 31khz.ini, 15khz.ini)

The menu will display all your custom ini files (in /media/fat) and overwrite your MiSTer.ini with the ini you selected then reboot.
Do not to edit Mister.ini itself when using this script, because changes will be lost - instead edit your custom ini template files.

https://github.com/morfeus77/MiSTerTool ... tag/v0.2.1

iniswitcher.png
iniswitcher.png (60.6 KiB) Viewed 6975 times

Script does not come with ini files nor do I take responsibility for your Mister.ini file getting lost.
Stupid Dufus
Posts: 157
Joined: Sun Aug 30, 2020 12:04 am
Has thanked: 98 times
Been thanked: 46 times

Re: Simple ini switcher script (profile manager)

Unread post by Stupid Dufus »

I love the idea for this, thanks!

Only things I'd like to note:
1) After selecting and applying an ini through this, my mister will freeze when trying to load the Console directory from the core list. I found that doing a cold reboot through the main menu (press and hold) or powering off and then back on solves this. Could just be something with my setup though.
2) Might be nice to add a backup option. Selecting that saves a copy of the current ini as MiSTer_backup.ini or MiSTer.ini.bak or something like that. Or at least a note when the script is running it's destructive and will erase the current MiSTer.ini

But I really do like this!
User avatar
morf77
Posts: 63
Joined: Fri Aug 28, 2020 1:42 pm
Has thanked: 12 times
Been thanked: 24 times

Re: Simple ini switcher script (profile manager)

Unread post by morf77 »

Haven't been able to replicate 1) if more people have this issue let me know.
For point 2) I might add a backup option, although the whole point of this script is you no longer use MiSTer.ini to save anything permanent. It becomes a placeholder. When using this script, you should save any (permanent) changes to the templates (custom ini filenames), never the MiSTer.ini or alt_ini files.

Edit: Backup feature added (as well as a delete option to delete ini's from the menu)
Edit: Warning and confirmation popups added
User avatar
morf77
Posts: 63
Joined: Fri Aug 28, 2020 1:42 pm
Has thanked: 12 times
Been thanked: 24 times

Re: Simple ini switcher script (profile manager)

Unread post by morf77 »

Stupid Dufus wrote: Sun Aug 29, 2021 2:23 am I love the idea for this, thanks!

Only things I'd like to note:
1) After selecting and applying an ini through this, my mister will freeze when trying to load the Console directory from the core list. I found that doing
Make sure your source ini is okay. I had one with bad linefeeds I was testing with.
Stupid Dufus
Posts: 157
Joined: Sun Aug 30, 2020 12:04 am
Has thanked: 98 times
Been thanked: 46 times

Re: Simple ini switcher script (profile manager)

Unread post by Stupid Dufus »

Sorry, didn't see the response to this.

The source ini files are ok, afaik. Using a default from a fresh install or swapping between atrac17's customer 5x and 6x ones gives the same results.

But now I'm having the issue of the script not running at all. Tried removing and regrabbing it from github, but I get the following error.

Code: Select all

/media/fat/Scripts# iniswitcher.sh
Traceback (most recent call last):
  File "/media/fat/Scripts/iniswitcher.sh", line 245, in <module>
    main()
  File "/media/fat/Scripts/iniswitcher.sh", line 168, in main
    curses.wrapper(IniProfileSwitcher)
  File "/usr/lib/python3.9/curses/__init__.py", line 94, in wrapper
  File "/media/fat/Scripts/iniswitcher.sh", line 165, in __init__
    main_menu.display()
  File "/media/fat/Scripts/iniswitcher.sh", line 74, in display
    self.window.addstr(y+8, 52, line)
_curses.error: addwstr() returned ERR
I haven't run update.sh or update_all.sh since Sept. 10. Think an update from there or before broke the script?
User avatar
Malan
Posts: 53
Joined: Sun Dec 27, 2020 5:58 pm
Has thanked: 11 times
Been thanked: 8 times

Re: Simple ini switcher script (profile manager)

Unread post by Malan »

[message deleted ignore this, thanks!]
And I like the idea too! I'll try it later.
User avatar
morf77
Posts: 63
Joined: Fri Aug 28, 2020 1:42 pm
Has thanked: 12 times
Been thanked: 24 times

Re: Simple ini switcher script (profile manager)

Unread post by morf77 »

Stupid Dufus wrote: Mon Sep 20, 2021 3:01 pm

Code: Select all

/media/fat/Scripts# iniswitcher.sh
Traceback (most recent call last):
  File "/media/fat/Scripts/iniswitcher.sh", line 245, in <module>
    main()
  File "/media/fat/Scripts/iniswitcher.sh", line 168, in main
    curses.wrapper(IniProfileSwitcher)
  File "/usr/lib/python3.9/curses/__init__.py", line 94, in wrapper
  File "/media/fat/Scripts/iniswitcher.sh", line 165, in __init__
    main_menu.display()
  File "/media/fat/Scripts/iniswitcher.sh", line 74, in display
    self.window.addstr(y+8, 52, line)
_curses.error: addwstr() returned ERR
I haven't run update.sh or update_all.sh since Sept. 10. Think an update from there or before broke the script?
I was able to replicate this error running at video_mode=6. There isn't enough room on the screen to display the mr kun ascii art at those resolutions.
Released a new version that takes height and width of the resolution into account (eg for video_mode=6 no mr kun ascii art is not displayed as there is too little space available on screen)

Get the new version here https://github.com/morfeus77/MiSTerTool ... tag/v0.2.1

Concerning your other issues, I would check if you have similar kind of problems when manually downloading an ini file if that's the case something else is wrong with your install.
Stupid Dufus
Posts: 157
Joined: Sun Aug 30, 2020 12:04 am
Has thanked: 98 times
Been thanked: 46 times

Re: Simple ini switcher script (profile manager)

Unread post by Stupid Dufus »

Thanks for the quick reply and fix. Working great now =)
Post Reply