GBZ-Menu

Show off your completed Game Boy Zero, or post your build logs here!
somatorio
Posts: 24
Joined: Sat Dec 02, 2017 3:47 pm
Location: Porto Alegre - Brazil
Has thanked: 6 times
Been thanked: 14 times

GBZ-Menu

Post by somatorio » Mon Mar 19, 2018 1:47 pm

Hi folks :)

YaYa already posted about it along with his amazing build + optimization guide, but i felt that i needed to post it too :lol:

I have made a simple program that reads an yaml file and "renders" (i really don't know if this is the right word) it as a menu, it looks like this right now:
SpoilerShow
Image
just to clarify, that is not an emulationstation screen without theme, i plan to make it render just like the theme being used at ES, but that will take some time.
The reason i made this is:
  1. I think we should be able to do (almost) everything using only the handheld, or at least the more things we can do with only it, the better.
  2. I think the retropie-setup menu (made with dialog) is ugly (don't get me wrong, i really like dialog, but it doesn't look right together with ES... it doesn't look "handheldish").
  3. I wanted to learn golang =P (i still want to be honest, lol).
Wait, you said it "renders" the menu from an yaml... that means i can make my own menus?!?!?!
Yes. :)

The only menu item type you can use right now (yeah, i plan to have more types at some point) is "run"... which means it will run something when you "click" it.
As an example, here is how "yayapoweroptimizations.yml" is right now (i'll probably update it soon with some more itens, but the idea is the same):

Code: Select all

---
name: "Yaya's power optimization"

options:
  samba:
    desc: "Samba - Enabled"
    desc2: "Samba - Disabled"
    cmd: "/home/pi/RetroPie-Setup/retropie_packages.sh samba depends remove"
    undocmd: "/home/pi/RetroPie-Setup/retropie_packages.sh samba depends install && /home/retropie/RetroPie-Setup/retropie_packages.sh samba install_shares"
    check: "test -r /etc/samba/smb.conf"

  romservice:
    desc: "ROMService (for USB keys) - Enabled"
    desc2: "ROMService (for USB keys) - Disabled"
    cmd: "/home/pi/RetroPie-Setup/retropie_packages.sh usbromservice enable"
    undocmd: "/home/retropie/RetroPie-Setup/retropie_packages.sh usbromservice disable"
    check: "test ! -r /opt/retropie/supplementary/usbromservice/disabled"

  tv:
    desc:    "TV and HDMI signals - Enabled"
    desc2:   "TV and HDMI signals - Disabled"
    cmd:     "echo '/usr/bin/tvservice -o' >> /etc/rc.local && /usr/bin/tvservice -o"
    undocmd: "sed -in -e '/tvservice -o/d' /etc/rc.local"
    check:   "grep -iq '/usr/bin/tvservice -o' /etc/rc.local"

  pileds:
    desc:    "Pi status LEDs - Enabled"
    desc2:   "Pi status LEDs - Disabled"
    cmd:     "echo -e '# Disable pi status LED\ndtparam=act_led_trigger=none\ndtparam=act_led_activelow=on' >> /boot/config.txt"
    undocmd: "sed -in -e '/# Disable pi status LED/,/dtparam=act_led_activelow=on/d' /boot/config.txt"
    check:   "grep -iq 'dtparam=act_led_trigger=none' /boot/config.txt"

  sdperf:
    desc:    "SD performance - Default"
    desc2:   "SD performance - Improved"
    cmd:     "sed -in -e 's/elevator=deadline/elevator=noop/' /boot/cmdline.txt"
    undocmd: "sed -in -e 's/elevator=noop/elevator=deadline/' /boot/cmdline.txt"
    check:   "grep -iq 'elevator=noop' /boot/cmdline.txt"

  swap:
    desc:    "Swap - Default"
    desc2:   "Swap - Adjusted"
    cmd:     "echo 'vm.swappiness = 1' >> /etc/sysctl.conf"
    undocmd: "sed -in -e '/vm.swappiness = 1/d' /etc/sysctl.conf"
    check:   "grep -iq 'vm.swappiness = 1' /etc/sysctl.conf"
    
  tweakfs:
    desc:    "Tweak filesystem for fewer writes - Disabled"
    desc2:   "Tweak filesystem for fewer writes - Enabled"
    cmd:     "sed -i -re 's/(.*boot.*) defaults (.*)/\\1 defaults,noatime \\2/' /etc/fstab"
    undocmd: "sed -i -re 's/(.*boot.*) defaults,noatime (.*)/\\1 defaults \\2/' /etc/fstab"
    check:   "grep -q 'boot.* defaults,noatime' /etc/fstab"

  avahi:
    desc:    "Avahi service - Enabled"
    desc2:   "Avahi service - Disabled"
    cmd:     "systemctl disable avahi-daemon && systemctl stop avahi-daemon"
    undocmd: "systemctl enable avahi-daemon && systemctl start avahi-daemon"
    check:   "! systemctl is-enabled avahi-daemon"

  wifi:
    desc:    "WiFi - Enabled"
    desc2:   "WiFi - Disabled"
    cmd:     "echo -'# Disable wifi\ndtoverlay=pi3-disable-wifi' >> /boot/config.txt && ifdown wlan0"
    undocmd: "sed -i '/# Disable wifi/,/dtoverlay=pi3-disable-wifi/d' /boot/config.txt && ifup wlan0"
    check:   "grep -q 'dtoverlay=pi3-disable-wifi' /boot/config.txt"

  bluetooth:
    desc:    "Bluetooth - Enabled"
    desc2:   "Bluetooth - Disabled"
    cmd:     "echo -e '# Disable bluetooth\ndtoverlay=pi3-disable-bt' >> /boot/config.txt"
    undocmd: "sed -i '/# Disable bluetooth/,/dtoverlay=pi3-disable-bt/d' /boot/config.txt"
    check:   "grep -q 'dtoverlay=pi3-disable-bt' /boot/config.txt"
Explaining:

Code: Select all

---
name: "Yaya's power optimization" <- title

options: <- so the code can identify the options (yeah, couldn't figure it out how to make them "root" itens)
  samba: <- item name
    desc: "Samba - Enabled" <- description of the item if check code returns something different from 0
    desc2: "Samba - Disabled" <- description of the item if check code returns 0
    cmd: "/home/pi/RetroPie-Setup/retropie_packages.sh samba depends remove" <- command to be run
    undocmd: "/home/pi/RetroPie-Setup/retropie_packages.sh samba depends install && /home/retropie/RetroPie-Setup/retropie_packages.sh samba install_shares" <- command to undo what cmd does
    check: "test -r /etc/samba/smb.conf" <- check code
If you don't need an undo, then you can remove desc2, undocmd and check =)

If i make a new menu and want it to be shared with others, how do i make it so?
By default the menus are downloaded from this github repository: https://github.com/somatorio/gbz-menu-yamls you just need to make a Pull Request and wait for it to be merged :)
(i'm all open to a better way to do this, actually i'm all open to any ideas or helping)

Yada, yada, yada, i just want to use it... how do i install?
It's actually pretty simple, you can install it by running the following at your pi (using SSH, pluging a keyboard, etc.):

Code: Select all

curl -fsSL gbz-menu.somatorio.org | sudo sh
It will download and install the requirements and the program itself... just check the script at http://gbz-menu.somatorio.org to make sure someone didn't injected nasty code in it and stuff like that.

This installer is based on the one made for Docker (http://get.docker.com) =P and you can customize some settings using environment variables.

The ES theme it will use is a copy of your theme-set's game boy theme, just with the system logo replaced, feel free to customize it. :)

Please note that the menu YAML's will be shown as "roms", and the "emulator" will be gbz-menu (if i'm not mistaken the binary is called just "menu")...

I have a problem, how do i report it?
As much as i'll probably read it if you post it here at this thread, it's best if you post it here: https://github.com/somatorio/gbz-config-menu/issues as it will be easier to keep track. :)
Last edited by somatorio on Fri Mar 23, 2018 7:44 am, edited 1 time in total.

User avatar
moooarcuuuus
Posts: 232
Joined: Tue Jul 04, 2017 1:28 am
Has thanked: 2 times
Been thanked: 94 times

Re: GBZ-Menu

Post by moooarcuuuus » Thu Mar 22, 2018 7:22 am

Very nice... I like the idea/syntax of go.

I can not see the image. It is on your google account.
Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep... Game Over

somatorio
Posts: 24
Joined: Sat Dec 02, 2017 3:47 pm
Location: Porto Alegre - Brazil
Has thanked: 6 times
Been thanked: 14 times

Re: GBZ-Menu

Post by somatorio » Thu Mar 22, 2018 8:48 am

moooarcuuuus wrote:
Thu Mar 22, 2018 7:22 am
Very nice... I like the idea/syntax of go.

I can not see the image. It is on your google account.
oh snap, i could swear i test it out from an anonimous tab too :(

does this url works? https://photos.app.goo.gl/Gt6OMQgJHVVOfZQD3

User avatar
moooarcuuuus
Posts: 232
Joined: Tue Jul 04, 2017 1:28 am
Has thanked: 2 times
Been thanked: 94 times

Re: GBZ-Menu

Post by moooarcuuuus » Thu Mar 22, 2018 8:56 am

Yes it works. :)
Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep, Eat, Sleep... Game Over

somatorio
Posts: 24
Joined: Sat Dec 02, 2017 3:47 pm
Location: Porto Alegre - Brazil
Has thanked: 6 times
Been thanked: 14 times

Re: GBZ-Menu

Post by somatorio » Fri Mar 23, 2018 7:45 am

updated the first post with a url that works at the image tag =p

User avatar
YaYa
Posts: 1719
Joined: Mon Jun 26, 2017 12:42 pm
Location: brittany - France
Has thanked: 871 times
Been thanked: 687 times
Contact:

Re: GBZ-Menu

Post by YaYa » Sun Mar 25, 2018 11:36 am

you already know that i find your menu system awesome, but i felt like i need to make my coming out and shout to the whole planet that you made an awesome job :D

this is definetiley a must have, and my code was usefull but may sounded hard for a noob, but with this, now, nobody has excuses lol

edwardthehuman
Posts: 38
Joined: Sun Feb 04, 2018 11:13 am
Has thanked: 15 times
Been thanked: 5 times

Re: GBZ-Menu

Post by edwardthehuman » Sun Mar 25, 2018 12:41 pm

Would try this. Would be nice if it's not its own menu but under the config.

User avatar
YaYa
Posts: 1719
Joined: Mon Jun 26, 2017 12:42 pm
Location: brittany - France
Has thanked: 871 times
Been thanked: 687 times
Contact:

Re: GBZ-Menu

Post by YaYa » Sun Mar 25, 2018 12:43 pm

edwardthehuman wrote:
Sun Mar 25, 2018 12:41 pm
Would try this. Would be nice if it's not its own menu but under the config.
under the config ? which config ? that way it's completely standalone, under ES menus, we would have to recompile and rewrite ES

edwardthehuman
Posts: 38
Joined: Sun Feb 04, 2018 11:13 am
Has thanked: 15 times
Been thanked: 5 times

Re: GBZ-Menu

Post by edwardthehuman » Sun Mar 25, 2018 12:56 pm

Yes, like Eazy Hax's Toolkit, it is installed under the Retropie Configuration Menu. Just wondering if it's doable that way. Thanks.

somatorio
Posts: 24
Joined: Sat Dec 02, 2017 3:47 pm
Location: Porto Alegre - Brazil
Has thanked: 6 times
Been thanked: 14 times

Re: GBZ-Menu

Post by somatorio » Sun Mar 25, 2018 5:23 pm

Oh, great idea, this way we don't even need a new system =p
I really haven't noticed before that the configuration menu lists .sh as options too, so that's easy to do :)
Tomorrow i'll test it and update the install/update script :)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest