RetroPi
基本设置
https://thepi.io/how-to-install-kodi-on-retropie/
https://www.lxx1.com/4305
默认密码: pi /raspberry
国内的朋友确保切换到阿里源
sudo nano /etc/apt/sources.list
替换为
deb http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib rpi deb-src http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib rpi
如果出现 [Waiting for headers] 的错误
sudo mv /etc/apt/sources.list.d/wolfram.list /etc/apt/sources.list.d/wolfram.disabled
注意当前DNS是否正确
sudo vi /etc/resolv.conf
还是失败就尝试清除缓存
sudo apt-get clean sudo rm -rf /var/cache/apt/archives/ sudo rm /var/lib/apt/lists/* sudo rm /var/lib/apt/lists/partial/* sudo apt-get clean
再次运行
sudo apt-get upgrade -y sudo apt-get upgrade
修改locale
运行 locale 查看当前编码是否为如下
LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=en_US.UTF-8
如果不是,Edit your /etc/locale.gen then uncomment the following line: sudo vi /etc/locale.gen 找到如下行 #en_US.UTF-8 UTF-8 取消前面的注释 # 依次运行
sudo locale-gen en_US.UTF-8 UTF-8 sudo update-locale en_US.UTF-8 UTF-8 sudo export LANGUAGE=en_US.UTF-8 sudo export LC_ALL=en_US.UTF-8 sudo export LANG=en_US.UTF-8 sudo export LANGUAGE=en_US.UTF-8
然后 sudo reboot重启生效 安装 RetroPie-Setup
sudo apt-get install git lsb-release 如果现在是root用户,切换到默认的pi用户 su - pi git clone --depth=1 https://github.com/RetroPie/RetroPie-Setup.git
cd RetroPie-Setup chmod +x retropie_setup.sh sudo ./retropie_setup.sh
完成后出现选择栏,选择第一项完整安装即可
若emulationstation提示: error while loading shared libraries: libbrcmEGL.so: cannot open shared object file: No such file or directory 运行 sudo rpi-update
开机启动RetroPie 运行 sudo ./retropie_setup.sh 进入 Configuration / tools>>autostart, 选择 Start EmulationStation at Boot: Boots into EmulationStation 此时虽设置了开机启动,但默认开机后需要输入用户名密码才能自动进入,可以这样设置跳过输入步骤(本方法实测试可用于Jessie) sudo vi /etc/inittab 找到这一行 1:2345:respawn:/sbin/getty --noclear 38400 tty1 修改为 1:2345:respawn:/sbin/getty --autologin {USERNAME} --noclear 38400 tty1 替换{USERNAME}为你的用户名,如 1:2345:respawn:/sbin/getty --autologin pi --noclear 38400 tty1 声音问题
如果是通过HDMI连接,运行游戏没有声音并提示: VolumeControl::Init() - Failed to attach to default card vi /boot/config.txt 末行加上 dtparam=audio=on 找到并修改 hdmi_drive=2 以及 hdmi_force_hotplug=1 hdmi_force_edid_audio=1 如没有在末行加上即可 如运行游戏时提示 VolumeControl::init() - Failed to find mixer elements,或切换显示器时,确保
运行raspi-config,audio 里设置为 HDMI 运行 sudo ./retropie_setup.sh,audio 里设置为 HDMI 进入RetroPie界面,audio 里设置为 HDMI
开始游戏
把相应的游戏rom放到 ~/RetroPie/roms/SYSTEMNAME 下就可直接游戏,SYSTEMNAME为相关的模拟器,比如模拟 NES 游戏,把 yourgame.nes 拷贝到 ~/RetroPie/roms/nes 下即可。现在进入RetroPie,即可看到该游戏。
使用 NAS 来上传游戏 rom 安装 samba,如已安装可跳过 sudo apt-get install samba samba-common-bin 配置 sudo vi /etc/samba/smb.conf 末行加上 在最后加上
[pi] comment = pi path = "/home/pi/" writeable = yes guest ok = yes create mask = 0644 directory mask = 0755 force user = pi
在 Mac 下打开 smb://yourip 或在 PC 打开 \\yourip,复制 rom 到对应到模拟器目录即可 从 nas 运行nas
这是一个很不错到方案,可以省略拷贝到 SD 到过程,参考 从 nas 运行 rom 从 ssh 进入 emulationstation
ssh 下直接运行 emulationstation 可以进入,但是一旦退出 ssh,emulationstation 也会退出。解决方法:改为运行 nohup emulationstation & 可建立一个 shell 方便运行 touch ~/es.sh chmod +x ~/ex.sh vi es.sh 复制以下内容
#!/bin/bash export DISPLAY=:0 nohup emulationstation &
按a 进入编辑模式,ctrl + v 粘贴,esc 进入命令模式,输入 wq 后回车退出 按键设置
首次进入 emulationstation 会自动进入按键设置界面,长按手柄任意按键后开始设置,最后一项 HOTKEY ENABLE 如果设置了,则在游戏中退出的快捷键为(该建 + start),进入控制列表快捷键为(该键 + X),否则为(select + start)和(select + X)
大功告成,祝玩得愉快 _
发现有些地方的设置不一样了,可以直接接入键盘和手柄
1. 第一个问题就是利用进入游戏不全屏,进入游戏前,按下任意一个按键,在ROM配置界面,video output选择DMT 35(未完美解决,实际还是有一点黑边)
2. 没有声音,在retropie界面audio-强制选择HDMI声音输出(已解决)
3. 我这里键盘作为主控,设置Enter回车键为进入游戏,但是退出游戏默认也是Enter,input_exit_emulator = enter。
在/opt/retropie/configures/all/retropieconfig.cfg
文件中我修改为
input_exit_emulator = b 和下面那句input_reset = f5
这里其实体现了一个思路,游戏手柄没有那么多按键,组合键input_enable_hotkey 和这里的input_exit_emulator两个按键同时按下,就是强制退出游戏,回到游戏模拟器列表。组合键input_enable_hotkey 和input_reset所表示的按键同时按下,就是重启游戏回到人数选择、关卡选择界面,特别是玩家1和玩家2都是手柄的时候。
当然我这里玩家1用键盘,玩家2用手柄,我的键盘键位多,就可以不开启input_enable_hotkey 而直接设置input_exit_emulator和input_reset的键值。在cfg文件中直接注释input_enable_hotkey 就好——还需改善(以前我设置的escape键,好像不起作用)
4. 关于键盘布局。因为树莓派是英国的所以键盘布局也是英式的,和平常的美式键盘布局不一样, 最大的问题就是,你输入@和#号的时候,发现变化了。输入|\变为井号键#,输入@键变为了“,简单修改个配置就还好,日常使用还是需要改改的。
sudo raspi-config
选择Internationalistation Options 选项
然后选择change keyboard layout 修改键盘布局
选择Generic 104-key pc
再选择English(US)
Altgr选择the default for the keyboard layout
compose key选择no compose key
此外,还有一种方法是debian系的自己的键盘布局选择工具
sudo apt-get update
sudo apt-get install console-data
sudo dpkg-reconfigure console-data 然后选择最下面那一项中的,pc ——qwerty——Unitied States——standard——standard,Raspian可以变回正常,但是这里不行
6. 游玩时间那些关掉
Main Menu——Other Settings——Save Metadata On Exit:off
7. ROM读写权限归为普通用户pi(表现在用sftp从树莓派中拷ROM出来做备份的时候,有些会拷贝不出来)
Configuration / Tools >> resetromdirs
========================================================
https://retropie.org.uk/docs/First-Installation/
Hotkeys
Hotkeys enable you to press a combination of buttons to access functions such as saving, loading, and exiting emulators. The following chart shows the default hotkey combinations. By default, the hotkey is select so that means you hold down select while pressing another button to execute a command. Note that hotkeys are only specific to the retroarch/libretro based emulators.
Xbox手机的Xbox键为select
Hotkeys | Action |
---|---|
Select+Start | Exit |
Select+Right Shoulder | Save |
Select+Left Shoulder | Load |
Select+Right | Input State Slot Increase |
Select+Left | Input State Slot Decrease |
Select+X | RGUI Menu |
Select+B | Reset |
How do I change which buttons to press to exit an emulator with a controller?
Hotkeys are combinations of buttons you can press in order to access options such as saving, loading, and exiting games. The following defaults are set automatically the first time you set up your controller from emulationstation. Default joypad hotkeys:
Hotkeys | Action | Code Example | |
---|---|---|---|
Select | Hotkey | input_enable_hotkey = "6" | |
Select+Start | Exit | input_exit_emulator_btn = "7" | |
Select+Right Shoulder | Save | input_save_state_btn = "5" | |
Select+Left Shoulder | Load | input_load_state_btn = "4" | |
Select+Right | Input State Slot Increase | input_state_slot_increase_btn = "h0right" | |
Select+Left | Input State Slot Decrease | input_state_slot_decrease_btn = "h0left" | |
Select+X | RGUI Menu | input_menu_toggle_btn = "3" | |
Select+B | Reset | input_reset_btn = "0" |
You can adapt the above code example and choose the button number to your desired button for each hotkey function in the retroarch.cfg files for most systems (at least all the emulators that are part of RetroArch)
You can change it per controller with your autoconfig file here
/opt/retropie/configs/all/retroarch-joypads/yourgamepad.cfg
You can Hardcode it globally for all systems here:
/opt/retropie/configs/all/retroarch.cfg
or set it by system
/opt/retropie/configs/SYSTEMNAME/retroarch.cfg
See HERE for more information on custom controller configs
========================================================
SSH as root anymore?
The root password is disabled by default (as is the case for Raspbian and many other linux distros).
before setting a root password, the following must be edited
sudo nano /etc/ssh/sshd_config
look for
PermitRootLogin without-password
change it to
PermitRootLogin yes
then ctrl+x to save,
next set your root password:
sudo passwd root
restart your Pi to register your changes
see these posts for more details:
https://www.raspberrypi.org/documentation/linux/usage/root.md
http://elinux.org/R-Pi_Troubleshooting#I_don.27t_know_the_root_password Where did the desktop go?
The PIXEL (formerly LXDE) desktop environment was removed from the RetroPie image to keep it smaller.
It can easily be installed from the RetroPie Setup Script
in Configuration / Tools >> Raspbiantools >> Install Pixel Desktop Environment
after installation it will be accessible from the ports menu of EmulationStation or can be called from the command line with startx
raspbian
You can also install it manually with:
sudo apt-get install --no-install-recommends lxde sudo apt-get install xorg raspberrypi-ui-mods rpi-chromium-mods
And then you can access it from the terminal by typing in
startx
After installation your pi will boot into the desktop environment, you can change the behaviour to boot into emulationstation by selecting the autostart option for emulationstation from the configuration/tools section of the setup script, or you can set the autologin to console option from the boot options of the raspi-config menu.
Note that failing to run startx after the installation may prevent other XWindow-based applications from starting (e.g. Micropolis port), so do launch the desktop after installation to ensure that it is fully set up.
Note that you cannot run PIXEL and Retropie at the same time. You will need to log out of PIXEL completely to start EmulationStation
==================================
关于分辨率问题
https://retropie.org.uk/docs/Smaller-RetroArch-Screen/
https://retropie.org.uk/docs/Video-Issues/
http://elinux.org/RPiconfig#Video_mode_options
确定自己的显示器支持什么格式
Setting in /boot/config.txt
hdmi_group=1
hdmi_mode=1
Set the output format to VGA 60 Hz (hdmi_group=1 hdmi_mode=1) and boot up the Raspberry Pi
Enter the following command to give a list of CEA supported modes
/opt/vc/bin/tvservice -m CEA
Enter the following command to give a list of DMT supported modes
/opt/vc/bin/tvservice -m DMT
Enter the following command to show your current state
/opt/vc/bin/tvservice -s
Enter the following commands to dump more detailed information from your monitor
/opt/vc/bin/tvservice -d edid.dat /opt/vc/bin/edidparser edid.dat
The edid.dat should also be provided when troubleshooting problems with the default HDMI mode
================================================================
/opt/retropie/configs/nes/retroarch.cfg
- Settings made here will only override settings in the global retroarch.cfg if placed above the #include line
input_remapping_directory = "/opt/retropie/configs/nes/"
input_autodetect_enable = false input_libretro_device_p1 = 3 input_libretro_device_p2 = 5
input_player1_a = "j" input_player1_b = "k" input_player1_x = "u" input_player1_y = "i" input_player1_start = "enter" input_player1_select = "b" input_player1_up = "w" input_player1_down = "s" input_player1_left = "a" input_player1_right = "d"
input_player2_joypad_index = 0 input_player2_a_btn = "14" input_player2_b_btn = "13" input_player2_x_btn = "15" input_player2_y_btn = "12" input_player2_left_btn = "7" input_player2_right_btn = "5" input_player2_up_btn = "4" input_player2_down_btn = "6" input_player2_start_btn = "3" input_player2_select_btn = "0" input_player2_l_x_plus = "+0" input_player2_l_x_minus = "-0" input_player2_l_y_plus = "-1" input_player2_l_y_minus = "+1"
input_player2_r_x_plus = "+2" input_player2_r_x_minus = "-2" input_player2_r_y_plus = "-3" input_player2_r_y_minus = "+3"
input_enable_hotkey = nul input_reset = "h" input_exit_emulator = "escape" input_menu_toggle = "F1"
#include "/opt/retropie/configs/all/retroarch.cfg"