#!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="supermodel-mechafatnick" rp_module_desc="Sega supermodel 3 version by Mechafatnick and Pi-friendly" rp_module_help="\ WARNING: Still under construction\n\n\ Created in such a way so it should not conflict with other supermodel installs\n\n\ ROM Extensions: .zip\n\n\ Copy your games to $romdir/supermodel\n\n\ Supermodel emulator directories and files are added in:\n\ ~/RetroPie/roms/supermodel/model3emu/mechafatnick\n\ (NVRAM, Saves, Supermodel.ini and Supermodel.log)\n\n\ If needed then add these lines to your Supermodel.ini,\n\ and alter them to your needs under [GLOBAL]:\n\ XResolution=800 ; Default value 496\n\ YResolution=600 ; Default value 384\n\ FullScreen=1; Default value 0\n\ WideScreen=0\n\ Stretch=1; Default value 0\n\ WideBackground=0\n\ \n\n\ Select a good equivalent resolution video mode in the RetroPie boot menu to get a proper fullscreen.\ If you use the regular runcommand then the resolution of the Supermodel.ini file is used.\ Otherwise the resolution is used of the runcommands with the adding the resolution.\ If you know your resolution and you have added it to your ini file,\ or you have selected the runcommand with the proper resolution,\ then changing the video mode should not be nessecary.\ " rp_module_section="exp" rp_module_flags="" function depends_supermodel-mechafatnick() { getDepends xorg subversion libsdl2-dev libsdl2-net-dev } function sources_supermodel-mechafatnick() { downloadAndExtract https://github.com/Mechafatnick/SuperModelPi/archive/refs/heads/master.zip $md_build } function build_supermodel-mechafatnick() { cd $md_build/SuperModelPi-master cp Makefiles/Makefile.UNIX Makefile make } function install_supermodel-mechafatnick() { #note: it should remove all files in $md_inst if there are any, so no need to remove links or files #note: command "mv" and "cp" won't work here, you get a "cannot stat error" in this function #prevent an error if the NVRAM and Saves directory are not in the source! if [[ -d "$md_build/SuperModelPi-master/NVRAM" ]] && [[ -d "$md_build/SuperModelPi-master/Saves" ]] ;then md_ret_files=( 'SuperModelPi-master/bin/supermodel' 'SuperModelPi-master/Config' 'SuperModelPi-master/NVRAM' 'SuperModelPi-master/Saves' ) else md_ret_files=( 'SuperModelPi-master/bin/supermodel' 'SuperModelPi-master/Config' ) fi } function configure_supermodel-mechafatnick() { mkRomDir "supermodel" mkRomDir "supermodel/model3emu" mkRomDir "supermodel/model3emu/mechafatnick" mkRomDir "supermodel/model3emu/mechafatnick/NVRAM" mkRomDir "supermodel/model3emu/mechafatnick/Saves" addEmulator 0 "Supermodel-mechafatnick" "supermodel" "XINIT:pushd /opt/retropie/emulators/supermodel-mechafatnick;./supermodel %ROM%" addEmulator 0 "Supermodel-mechafatnick-496x384" "supermodel" "XINIT:pushd /opt/retropie/emulators/supermodel-mechafatnick;./supermodel -res=496,384 %ROM%" addEmulator 0 "Supermodel-mechafatnick-800x600" "supermodel" "XINIT:pushd /opt/retropie/emulators/supermodel-mechafatnick;./supermodel -res=800,600 %ROM%" addEmulator 0 "Supermodel-mechafatnick-1024x768" "supermodel" "XINIT:pushd /opt/retropie/emulators/supermodel-mechafatnick;./supermodel -res=1024,768 %ROM%" addEmulator 0 "Supermodel-mechafatnick-1600x900" "supermodel" "XINIT:pushd /opt/retropie/emulators/supermodel-mechafatnick;./supermodel -res=1600,900 %ROM%" addEmulator 0 "Supermodel-mechafatnick-1920x1080" "supermodel" "XINIT:pushd /opt/retropie/emulators/supermodel-mechafatnick;./supermodel -res=1920,1080 %ROM%" addEmulator 0 "TEST auto resolution" "supermodel" "XINIT:pushd /opt/retropie/emulators/supermodel-mechafatnick;./supermodel -res=%XRES%,%YRES% %ROM%" addSystem "supermodel" "Sega supermodel 3" ".zip" #using "sudo ./retropie_packages.sh supermodel-mechafatnick install" for testing this function, #you have to prevent nested links within the linked directories ! #if the link NVRAM doesn't exist, others will too, like: Saves,bin/Supermodel.ini and Supermodel.log #then we can assume the installed directories are in place and we can move them and create symlinks #else we do nothing otherwise we are going to push links into links! if [[ ! -L "$md_inst/NVRAM" ]];then #move and update the files mv $md_inst/NVRAM/* $romdir/supermodel/model3emu/mechafatnick/NVRAM 2>&- mv $md_inst/Saves/* $romdir/supermodel/model3emu/mechafatnick/Saves 2>&- #we have to remove those directories otherwise we get nested links when we create the links rm -r $md_inst/NVRAM rm -r $md_inst/Saves #we want to make sure we make a backup of Supermodel.ini if it exists, remove an old Supermodel.ini.old first #then move the existing Supermodel.ini to Supermodel.ini.old rm $romdir/supermodel/model3emu/mechafatnick/Supermodel.ini.old 2>&- mv $romdir/supermodel/model3emu/mechafatnick/Supermodel.ini $romdir/supermodel/model3emu/mechafatnick/Supermodel.ini.old 2>&- mv $md_inst/Config/Supermodel.ini $romdir/supermodel/model3emu/mechafatnick/Supermodel.ini #fix permissions chown $user:$user -R "$romdir/supermodel/model3emu/mechafatnick" #make symlinks ln -sv $romdir/supermodel/model3emu/mechafatnick/NVRAM $md_inst/NVRAM ln -sv $romdir/supermodel/model3emu/mechafatnick/Saves $md_inst/Saves ln -sv $romdir/supermodel/model3emu/mechafatnick/Supermodel.ini $md_inst/Config/Supermodel.ini ln -sv $romdir/supermodel/model3emu/mechafatnick/Supermodel.log $md_inst/Supermodel.log 2>&- fi }