@cyperghost The output of my raspi-gpio get 3 was "level=0 fsel=0 func=INPUT", but if I put it in line 322 the Pi always turns off as soon as emulationstation loads, even if completely disconnected from the case.
However, I just realised something... the power socket on the MEGAPi case it's not just a cutout, like the HDMI port, but it has its own little board, I didn't notice until now, I just mindlessly plugged the power directly to the Pi, and that was the problem, the multi_switch.sh now works perfectly. Sorry for wasting your time :( (however, the fact that multiswitch086.sh almost worked without using the power board was in itself impressive).
As a partial way to make amends I'll correct an error on the installation instructions of the script:
Here you have to add a sudo before chmod, otherwise it gives you "permission denied"
wget https://raw.githubusercontent.com/crcerror/ES-generic-shutdown/master/multi_switch.sh && chmod +x multi_switch.sh