Retropie with Kodi configuration

# install additional packages
apt install vim autofs -y
systemctl enable autofs

# alter vim config
echo ":set mouse-=a" > ~/.vimrc

# add rom and media shares to autofs
echo "/-       /etc/auto.cifs-shares" >> /etc/auto.master

# edit the rom shares
vim /etc/auto.cifs-shares

..
/home/pi/RetroPie/roms -fstype=cifs,credentials=/home/pi/.smb,uid=pi,gid=pi,ro ://nas/roms
/home/pi/RetroPie/BIOS -fstype=cifs,credentials=/home/pi/.smb,uid=pi,gid=pi,ro ://nas/bios
/home/pi/RetroPie/saves -fstype=cifs,credentials=/home/pi/.smb,uid=pi,gid=pi,rw, ://nas/saves
/mnt/smb/tv-series -fstype=cifs,credentials=/home/pi/.smb,uid=pi,gid=pi,ro ://nas/tv-series
/mnt/smb/movies -fstype=cifs,credentials=/home/pi/.smb,uid=pi,gid=pi,ro ://nas/movies
/mnt/smb/backup -fstype=cifs,credentials=/home/pi/.smb,uid=pi,gid=pi,rw ://nas/pibackup
..

# add your credentials
vim /home/pi/.smb

..
username=
password=
domain=
..

# fix cec, overscan, 4kp60 and VRAM for kodi

vim /boot/config.txt

..
[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=1

[all]
#dtoverlay=vc4-fkms-v3d
#overscan_scale=1
# kodi will still work at 4k
hdmi_enable_4kp60=1
gpu_mem=320
hdmi_ignore_cec_init=1
hdmi_force_hotplug=0
# force boot and emustation to 720p
hdmi_group=1
hdmi_mode=4

# overclocking
over_voltage=6
arm_freq=2100
gpu_freq=750
..

# change the default saves directory
vim /opt/retropie/configs/all/retroarch.cfg

..
savefile_directory = /home/pi/RetroPie/saves
savestate_directory = /home/pi/RetroPie/saves
savestate_auto_index = true
sort_savefiles_enable = "true"
sort_savestates_enable = "true"
..

# fix redream save locations

mkdir -p /home/pi/RetroPie/saves/dreamcast/redream/saves
mkdir -p /home/pi/RetroPie/saves/dreamcast/redream/states
su pi
ln -s /home/pi/RetroPie/saves/dreamcast/redream/saves /opt/retropie/emulators/redream/saves
ln -s /home/pi/RetroPie/saves/dreamcast/redream/states /opt/retropie/emulators/redream/states

Install redream, lr-flycast and kodi packages via retropie_setup. lt-flycast appears to be more stable when built from source.

redream and lr-flycast both have similar issues crashing when saving state or loading an existing state which has been corrupted on save. This is why auto indexing is turned on above. Save regularly or use the memory card feature.

Important…

Within Kodi, set resolution to 1920x1080p @ 59.94, then whitelist the related refresh rates except 60hz. Do not set to 4096×2160 as most TV’s will not support it > 30p.

Also set refresh rate switching delay to 0.5 seconds, and refresh ate switching to On start.

Install this update for plugin.program.autocompletion to fix autocomplete in add-on searches