├── Assets ├── FilezillaActiveFTPMode.png ├── FilezillaSettings.png ├── PS2-OPL-settings.png └── smbshare.PNG ├── README.md ├── automount-usb.sh ├── provisionRelease.sh ├── samba-init.sh ├── setup-wifi-access-point.sh ├── setup.sh └── wifi-to-eth-route.sh /Assets/FilezillaActiveFTPMode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toolboc/psx-pi-smbshare/20fec3c7a818049066954ef41c1b4b4a3b904787/Assets/FilezillaActiveFTPMode.png -------------------------------------------------------------------------------- /Assets/FilezillaSettings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toolboc/psx-pi-smbshare/20fec3c7a818049066954ef41c1b4b4a3b904787/Assets/FilezillaSettings.png -------------------------------------------------------------------------------- /Assets/PS2-OPL-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toolboc/psx-pi-smbshare/20fec3c7a818049066954ef41c1b4b4a3b904787/Assets/PS2-OPL-settings.png -------------------------------------------------------------------------------- /Assets/smbshare.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toolboc/psx-pi-smbshare/20fec3c7a818049066954ef41c1b4b4a3b904787/Assets/smbshare.PNG -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # psx-pi-smbshare 2 | psx-pi-smbshare began with the intent of allowing SMB sharing to Multiman and Open Playstation Loader from a Raspberry Pi. It has evolved into a Pi-based swiss army knife for enhancing classic game consoles. 3 | 4 | You can see it in action in this video from [@versatileninja](https://github.com/versatileninja) which walks through the setup process and demonstrates how to use it: 5 | 6 | [![Play PS2 Games Over SMB Using Raspberry Pi 3b+ and psx-pi-smbshare (2019)](https://img.youtube.com/vi/Ilx5NYoUkNA/0.jpg)](https://www.youtube.com/watch?v=Ilx5NYoUkNA) 7 | 8 | ## Upgrading an existing install 9 | The following commands can be used to upgrade an existing psx-pi-smbshare device. These instructions can also be used to convert an unsupported device into a psx-pi-smbshare (for example [Raspberry Pi4](https://github.com/toolboc/psx-pi-smbshare/issues/10) and potentially other devices running a debian based OS with an accessible ethernet port). 10 | ``` 11 | cd ~ 12 | wget -O setup.sh https://raw.githubusercontent.com/toolboc/psx-pi-smbshare/master/setup.sh 13 | chmod 755 setup.sh 14 | ./setup.sh 15 | ``` 16 | 17 | ## How it works 18 | psx-pi-smbshare is a preconfigured Raspbian based image for Raspberry Pi 1, 2, 3 and [4](https://www.youtube.com/watch?v=8qaJcbSye-E). It runs a [Samba](https://en.wikipedia.org/wiki/Samba_(software)) share, a pi-compatible build of [ps3netsrv](https://github.com/dirkvdb/ps3netsrv--), and reconfigures the ethernet port to act as a router. This gives low-latency, direct access to the Samba service through an ethernet cable connection between a PS2/PS3 and Raspberry Pi. This configuration is achieved by running [setup.sh](/setup.sh). A pre-supplied [image](https://github.com/toolboc/psx-pi-smbshare/releases/) can be applied directly to a Micro-SD card using something like [etcher.io](https://etcher.io/). The image allows you to use the full available space on the SD card after the OS is first booted. 19 | 20 | An [XLink Kai](http://www.teamxlink.co.uk/) client is also included and accessible on the device at http://smbshare:34522/. This allows for multi-player gaming over extended LAN. The service is possible to use on a variety of devices including PS2, PS3, PS4, Xbox, Xbox 360, Xbox One, Gamecube, Switch, Wii, Wii U (and PSP). Just connect an ethernet cable to your game console and access the XLink Kai Service over Wi-Fi with a smart phone, tablet, or computer. 21 | 22 | ![image](https://user-images.githubusercontent.com/2018336/102703167-08004c00-4231-11eb-931d-3046ccd117ac.png) 23 | 24 | ## What you can do with it 25 | psx-pi-smbshare works out of the box on PS3 with [MultiMAN](http://www.psx-place.com/threads/update2-multiman-v-04-81-00-01-02-base-update-stealth-for-cex-dex-updates-by-deank.12145/). This functionality allows you to stream and backup up various games and media to the Samba share service running on the Raspberry Pi. 26 | 27 | psx-pi-smbshare also works out of the box on PS2 with [Open Playstation Loader](https://github.com/ifcaro/Open-PS2-Loader) and supports streaming of PS2 backups located on the Samba share service. It can also work with [POPStarter for SMB](https://bitbucket.org/ShaolinAssassin/popstarter-documentation-stuff/wiki/smb-mode) to allow streaming of PS1 games from Open Playstation Loader. 28 | 29 | psx-pi-smbshare supports an ability to route traffic from the ethernet port through a wireless network connection to the outside world. With this configuration, the XLink Kai Service can be used on pretty much any device with an ethernet port. This includes Xbox, Xbox 360, PS2, PS3, and Gamecube. There is also support for Ad-Hoc multiplayer on PSP using XLink Kai. 30 | 31 | # Quickstart 32 | 33 | *Prerequisites* 34 | * Raspberry Pi 1, 2, or 3 35 | * Micro-SD Card (8GB+ suggested) 36 | 37 | A detailed [video guide](https://www.youtube.com/watch?time_continue=1&v=Ilx5NYoUkNA) is provided by Project Phoenix Media which walks through the processes described below. 38 | 39 | ## Flash the image 40 | Download the latest [psx-pi-smbshare release image](https://github.com/toolboc/psx-pi-smbshare/releases/) and burn it to a Micro-SD card with [etcher.io](http://etcher.io) 41 | 42 | ## Configuring Wireless Network 43 | If you wish to configure the wireless network on a Raspberry Pi 2 or 3, you need to add a file to **/boot** on the Micro-SD card. 44 | 45 | Create a file on **/boot** named **wpa_supplicant.conf** and supply the following (change country to a [valid 2 letter code](https://en.wikipedia.org/wiki/ISO_3166-1)): 46 | 47 | ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev 48 | update_config=1 49 | country=US 50 | 51 | network={ 52 | ssid="" 53 | psk="" 54 | } 55 | 56 | When the pi is next booted, it will attempt to connect to the wireless network in this configuration. You are then able to access the raspberry pi on the network and allow for outbound connections from a PS2/PS3 over the wireless network. 57 | The raspberry pi is configured to have a hostname `smbshare` with a user `pi` and a password of `raspberry`. 58 | 59 | ## Disable DHCP server on Raspberry Pi 60 | 61 | The default behavior of psx-pi-smbshare is to enable a console-to-pi connection by means of the high speed ethernet port available on many video game consoles. This connection is used to provide a direct access from the console to the services on the pi (WiFi, XLinkKai, SMB, ps3netsrv etc), and by default, a DHCP server runs on the ethernet interface (eth0) to facilitate this. The following steps will describe how to disable this mechanism and is not recommended for typical users. Please be aware that disabling the DHCP server will produce a side-effect of [no longer being able to directly connect your video game console to the pi via the ethernet interface](https://github.com/toolboc/psx-pi-smbshare/issues/22#issuecomment-667469343). 62 | 63 | In some use cases, the user may wish to connect the Raspberry Pi via ethernet to an external router (for example: [to have psx-pi-smbshare act as an XLinkKai server for primarily PSP games](https://github.com/toolboc/psx-pi-smbshare/issues/21)). To disable the DHCP server that would usually run automatically on this interface, [ssh into your device](https://www.raspberrypi.org/documentation/remote-access/ssh/) and execute the following command to modify the startup scripts that run at boot time: 64 | ``` 65 | crontab -e 66 | ``` 67 | Next, find and comment the line containing `@reboot sudo bash /home/pi/wifi-to-eth-route.sh` by adding a '#' as shown below: 68 | ``` 69 | #@reboot sudo bash /home/pi/wifi-to-eth-route.sh 70 | ``` 71 | 72 | ## Accessing the XLink Kai Service 73 | Visit http://smbshare:34522/ or http://:34522/ 74 | 75 | ## Accessing the SMB Share 76 | With a wireless network configured, you should be able to access the SMB share by visiting `\\SMBSHARE\share` on windows or `smb://smbshare/share` on Mac / Linux. 77 | 78 | ![Accessing SMB](/Assets/smbshare.PNG) 79 | 80 | The share is preconfigured with a folder structure to accomodate ps3netsrv and Open Playstation Loader expected file paths. 81 | 82 | ## Accessing USB drive(s) on the SMB Share 83 | Plug and play auto-sharing of USB storage devices over SMB is supported: 84 | 85 | * USB Drives are automounted to the /media/ directory 86 | 87 | * When a USB drive is plugged in, the USB Drive becomes available on the SMB Share @ `\\SMBSHARE\share` 88 | 89 | * When a USB drive is removed, the device falls back to sharing the Micro-SD card @ `\\SMBSHARE\share` 90 | 91 | * Note that some USB drives (particularly larger enclosure types) may require use of a powered USB Hub to supply adequate current to the device 92 | 93 | ## Forwarding Active FTP session to a connected device 94 | Assuming your console / device has an ip of 192.168.2.2, you may run the following script to forward an Active FTP session: 95 | 96 | sudo iptables -t nat -A PREROUTING -p tcp --dport 21 -j DNAT --to-destination 192.168.2.2:21 97 | sudo modprobe ip_nat_ftp ports=21 98 | 99 | If you wish to permanently enable FTP forwarding, it is suggested to set a static ip of 192.168.2.2 on your console(s) when used with psx-pi-smbshare and modify "wifi-to-eth-route.sh" in the home directory of the pi to run the commands above by adding them directly before: 100 | 101 | `sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward" ` 102 | 103 | This will ensure that Active FTP sessions are forwarded automatically at startup. 104 | 105 | After you enable forwarding of Active FTP sessions to your console, it is suggested to use [Filezilla](https://filezilla-project.org/download.php?type=client) to connect to your console via "File => Site Manager => New Site" and connecting with the following settings: 106 | 107 | ![Accessing SMB](/Assets/FilezillaSettings.png) 108 | 109 | ![Accessing SMB](/Assets/FilezillaActiveFTPMode.png) 110 | 111 | This configuration will forward all ftp requests made to the host ip of the psx-pi-smbshare device to the internal ip assigned to the connected console. If using another FTP client, it is very important that it is configured to connect using an Active FTP transfer mode. 112 | 113 | ## Configuring for use with MultiMAN on PS3 114 | 115 | *Prerequisites* 116 | * Playstation 3 running a [recent release of MultiMAN](http://store.brewology.com/ahomebrew.php?brewid=24) 117 | 118 | *Steps* 119 | 1. Connect the pi ethernet port into the ethernet port of the PS3 and power the pi using the PS3 usb or an external power supply 120 | 2. In the PS3 XMB select "Settings" => "Network Settings" => "Internet Connection Settings" and configure to connect using the ethernet connection as follows: 121 | 122 | "Internet Connection Settings" => "Custom" => "Wired" => "Auto-Detect" => "Manual" 123 | 124 | IP Address = 192.168.2.2 125 | Subnet Mask = 255.255.255.0 126 | Default Router = 192.168.2.1 127 | Primary DNS = 1.1.1.1 128 | Secondary DNS = 129 | 130 | "Automatic" => "Do Not Use" => "Enable" 131 | 3. Launch MultiMAN 132 | 4. Select "Settings" => "Network Servers" 133 | 5. Configure using the Ip Address '192.168.2.1' (ip to the smbshare assigned by dhcp server running on the Pi) and Port '38008' (default) 134 | 6. You should see new section for the network server under 'Photos' / 'Music' / 'Video' / 'Retro' and a new location to copy games to when using copy ISO in the 'Games' menu. 135 | 136 | PS3 Games backed up to the network server can be found and loaded from the "Games" menu in MultiMAN. 137 | PS1, PS2, and PSP games can be found and loaded from "Retro" => "PSONE" "PS2" OR "PSP" 138 | PS2 backups must be loaded from the HDD but can be copied directly to the SMB server. 139 | 140 | ## Configuring for use with Open Playstation Loader 141 | 142 | *Prerequisites* 143 | * Playstation 2 fat or slim running a [recent release of Open Playstation Loader](http://www.ps2-home.com/forum/viewtopic.php?p=29251#p29251) 144 | 145 | *Steps* 146 | 1. Connect the pi ethernet port into the ethernet port of the PS2 and power the pi using the PS2 usb or an external power supply 147 | 2. Boot Open Playstation Loader and select "Settings" => "Network Config". 148 | Ensure that the following options are set: 149 | 150 | Ethernet Link Mode = Auto 151 | PS2 152 | IP address type = Static 153 | IP address = 192.168.2.2 154 | Mask = 255.255.255.0 155 | Gateway = 192.168.2.1 156 | DNS Server = 1.1.1.1 157 | SMB Server 158 | Address Type = IP 159 | Address = 192.168.2.1 160 | Port = 445 161 | Share = share 162 | Password = 163 | 164 | ![PS2 OPL Settings](/Assets/PS2-OPL-settings.png) 165 | 166 | Don't forget to select "Save Config" when you return to "Settings" 167 | 168 | 3. Reconnect or restart Open Playstation Loader 169 | 4. PS2 Games will be listed under "ETH Games". To add PS2 games, copy valid .iso backups to `\\SMBSHARE\share\DVD` or `\\SMBSHARE\share\CD` 170 | 171 | ## Configuring for use with POPSLoader on Open Playstation Loader 172 | 173 | *Prerequisites* 174 | * Ensure that you have successfully followed the steps above for "Configuring for use with Open Playstation Loader" 175 | 176 | *Steps* 177 | 1. Download the [ps2 network modules](https://bitbucket.org/ShaolinAssassin/popstarter-documentation-stuff/downloads/network_modules.7z) 178 | 2. Extract the POPSTARTER folder 179 | 3. Modify IPCONFIG.DAT to: 180 | 181 | 192.168.2.2 255.255.255.0 192.168.2.1 182 | 4. Modify SMBCONFIG.DATA to: 183 | 184 | 192.168.2.1 share 185 | 5. Copy the POPSTARTER folder to your memory card 186 | 6. Hop on the internet and look for a copy of a file named "POPS_IOX.PAK" with md5sum "a625d0b3036823cdbf04a3c0e1648901" and copy it to `\\SMBSHARE\share\POPS`. This file is not included for "reasons". 187 | 7. PS1 backups must be converted to .VCD and run through a special renaming program in order to show up in OPL. 188 | 189 | To convert .bin + .cue backups, you can use the included "CUE2POP_2_3.EXE" located in `\\SMBSHARE\share\POPS\CUE2POPS v2.3` 190 | Copy your .VCD backups to `\\SMBSHARE\share\POPS` then run `\\SMBSHARE\share\POPS\OPLM\OPL_Manager.exe` to rename your files appropriately. 191 | 192 | Once converted and properly renamed, your games will show up under the "PS1 Games" section of OPL 193 | 194 | A detailed guide is available @ http://www.ps2-home.com/forum/viewtopic.php?f=64&t=5002 195 | 196 | ## Playing LAN enabled Nintendo Switch games online with XLink Kai on Nintendo Switch 197 | 198 | *Prerequisites* 199 | * A Nintendo Switch 200 | * A LAN compatible Switch game 201 | * An XLink Kai account from http://www.teamxlink.co.uk/ 202 | 203 | *Steps* 204 | 1. Burn the [latest psx-pi-smbshare image](https://github.com/toolboc/psx-pi-smbshare/releases) to a Micro-SD card 205 | 2. Configure Wi-fi per the steps above in ["Configuring the Wireless Network"](https://github.com/toolboc/psx-pi-smbshare#configuring-wireless-network) 206 | 3. Add a second Wi-fi dongle to the pi as described in [Using a second wifi interface as an access point to XLink Kai](https://github.com/toolboc/psx-pi-smbshare#using-a-second-wifi-interface-as-an-access-point-to-xlink-kai) 207 | 4. Configure your Switch to connect to the "XLinkKai" access point and set the `DNS Settings` to manual and set the `Primary DNS` to 10.254.0.1 and ensure that `Autoconnect` is set to "on" as described in the [XLinkKai Nintendo Switch Tutorial](https://www.teamxlink.co.uk/wiki/Nintendo_Switch_XLink_Kai_Setup). 208 | 4. Vist the XLink Kai service running on the pi @ http://smbshare:34522 or http://:34522/ and login with your XLink Kai account 209 | 5. In the XLink Kai portal, select `Configuration` and ensure that `Network Adapter` is set to to `wlan1` to ensure that XLinkKai captures packets from the proper wireless interface. 210 | 6. In the XLink Kai portal , select `Game Arenas` and navigate to the room for the game that you wish to play 211 | 7. Launch the game on your Switch and start up LAN mode and create a LAN game (Do not confuse with Local Wireless, many games involve a special keypress combination to enable LAN mode, please research accordingly). If asked to connect to a network during this process, select the "XLinkKai" SSID that is being served from the raspberry pi. 212 | 8. Wait for players to join and have fun! 213 | 214 | ## Playing Halo 2 online with XLink Kai on Xbox 215 | 216 | ### Video Demonstration 217 | 218 | [![Halo 2 XLink Kai Raspberry Pi Wireless Gameplay](https://img.youtube.com/vi/3m1nWdHbVOI/0.jpg)](https://www.youtube.com/watch?v=3m1nWdHbVOI) 219 | 220 | *Prerequisites* 221 | * An original Xbox or Xbox 360 with backwards compatibility support 222 | * A copy of Halo 2 223 | * An XLink Kai account from http://www.teamxlink.co.uk/ 224 | 225 | *Steps* 226 | 1. Burn the [latest psx-pi-smbshare image](https://github.com/toolboc/psx-pi-smbshare/releases) to a Micro-SD card 227 | 2. Configure Wi-fi per the steps above in ["Configuring the Wireless Network"](https://github.com/toolboc/psx-pi-smbshare#configuring-wireless-network) 228 | 3. Plug the pi into the Xbox ethernet port and verify that you are able to obtain an ip automatically in Network Settings 229 | 4. Vist the XLink Kai service running on the pi @ http://smbshare:34522 or http://:34522/ and login with your XLink Kai account 230 | 5. Select an available Halo game from the XLink Kai portal (there are usually a few running in South America) 231 | 6. Launch Halo 2 and select "System Link" 232 | 7. Join a game and have fun! 233 | 234 | ## Playing SOCOM 2 online with XLink Kai on PS2 235 | 236 | *Prerequisites* 237 | * A Fat PS2 with Network Adapter or Slim PS2 238 | * A copy of SOCOM 2 for PS2 239 | * An XLink Kai account from http://www.teamxlink.co.uk/ 240 | 241 | *Steps* 242 | 1. Burn the [latest psx-pi-smbshare image](https://github.com/toolboc/psx-pi-smbshare/releases) to a Micro-SD card 243 | 2. Configure Wi-fi per the steps above in ["Configuring the Wireless Network"](https://github.com/toolboc/psx-pi-smbshare#configuring-wireless-network) 244 | 3. Plug the pi into the PS2 ethernet port 245 | 4. The following setup needs to be performed one time: Boot your PS2 up with SOCOM 2 and select "Online" at the title screen. Once you hit the first blue screen hit edit network configuration to be sent to the network setup. Now delete any old network settings and create a new one. Using Automatic settings is fine but you may wish to set the following manual settings if you have issues: 246 | 247 | Console IP: 192.168.2.2 248 | Subnet Mask: 255.255.255.0 249 | Router IP/Gateway: 192.168.2.1 250 | 5. Vist the XLink Kai service running on the pi @ http://smbshare:34522 or http://:34522/ and login with your XLink Kai account 251 | 6. Select an available SOCOM 2 game from the XLink Kai portal (there is usually one running at all times) 252 | 7. Head back to the SOCOM 2 title screen and select "LAN" 253 | 8. Join a game and have fun! 254 | 255 | ## Using a Second WiFi interface as an Access Point to XLink Kai 256 | *Prerequisites* 257 | * 1 external wifi dongle for RPi 2/3 or 2 external wifi dongles for RPi 1 258 | 259 | *Steps* 260 | 1. Burn the [latest psx-pi-smbshare image](https://github.com/toolboc/psx-pi-smbshare/releases) to a Micro-SD card 261 | 2. Plug in the external wifi dongle(s) 262 | 3. Configure Wi-fi per the steps above in ["Configuring the Wireless Network"](https://github.com/toolboc/psx-pi-smbshare#configuring-wireless-network) 263 | 4. Configure the device to connect to "XLinkKai" SSID when the pi has booted using Password `XLinkKai` 264 | 265 | Note: XLinkKai will only work on one network interface (wifi or ethernet) at a time and will lock onto the first interface connected to from a compatible device until reboot 266 | 267 | ## Playing PSP games online with XLink Kai on PSP 268 | 269 | *Prerequisites* 270 | * A wifi capable PSP 271 | * 1 external wifi dongle for RPi 2/3 or 2 external wifi dongles for RPi 1 (*tested with an [Edimax-EW-7811Un](https://www.amazon.com/Edimax-EW-7811Un-150Mbps-Raspberry-Supports/dp/B003MTTJOY) wifi dongle*) 272 | * A Multiplayer game which supports Ad-Hoc 273 | * An XLink Kai account from http://www.teamxlink.co.uk/ 274 | 275 | *Steps* 276 | 1. Burn the [latest psx-pi-smbshare image](https://github.com/toolboc/psx-pi-smbshare/releases) to a Micro-SD card 277 | 2. Configure Wi-fi per the steps above in ["Configuring the Wireless Network"](https://github.com/toolboc/psx-pi-smbshare#configuring-wireless-network) 278 | 3. SSH to you psx-pi-smbshare instance using the default username `pi` and default password `raspberry` 279 | 4. Ensure that your PSP is set to Automatic in Network Settings under Ad Hoc Mode 280 | 5. Run the following commands to disable the hostapd access point and enable Ad-Hoc Wifi: 281 | 282 | sudo service hostapd stop 283 | sudo iw wlan1 set type ibss 284 | 285 | 7. Start an Ad-Hoc multiplayer session from a game on the PSP 286 | 6. Run the follwoing command 287 | 288 | sudo iw wlan1 scan | grep PSP_ -B 5 289 | 290 | You will receive an output similar to: 291 | 292 | freq: 2462 293 | beacon interval: 100 TUs 294 | capability: IBSS ShortPreamble (0x0022) 295 | signal: -42.00 dBm 296 | last seen: 0 ms ago 297 | SSID: PSP_S000000001_L_GameShar 298 | 299 | Take note of the frequency and SSID 300 | 7. Using the information in the previous step, execute the following while the multiplayer session is waiting: 301 | 302 | sudo iw wlan1 ibss join 303 | 304 | Ex: sudo iw wlan1 ibss join PSP_S000000001_L_GameShar 2462 305 | 306 | If you receive "Operation not supported (-95)" then your wifi adapter may not be compatible 307 | 308 | Once you know this command, you can re-use the following script at any time to enable PSP Ad-Hoc mode: 309 | 310 | sudo service hostapd stop 311 | sudo iw wlan1 set type ibss 312 | sudo iw wlan1 ibss join 313 | 314 | Note: You must run this script after starting an Ad-Hoc multiplayer session on the PSP 315 | 316 | 8. Exit the Ad-Hoc multiplayer session and start a new one 317 | 9. Vist the XLink Kai service running @ http://smbshare:34522 or http://:34522/ and login with your XLink Kai account 318 | 10. Select "Metrics" and scroll down to "Found Consoles" and you should see your PSP device 319 | 11. Select an available PSP game from the XLink Kai portal 320 | 12. Join a game and have fun! 321 | 322 | ## Playing Mario Kart Double Dash online with XLink Kai on Gamecube 323 | 324 | ### Video Demonstration 325 | 326 | [![GameCube online with psx-pi-smbshare](https://img.youtube.com/vi/pa-AM05EwQ4/0.jpg)](https://www.youtube.com/watch?v=pa-AM05EwQ4) 327 | 328 | See this [article on the NintendoDuo Tumblr page](https://nintendoduo.tumblr.com/post/185437788676/how-to-take-your-gamecube-online-with-a-raspberry) or the [XLink Kai GameCube Guide](https://www.teamxlink.co.uk/wiki/Nintendo_GameCube_Tutorial) for a detailed guide on "How to Take Your GameCube Online With a Raspberry Pi and psx-pi-smbshare". 329 | 330 | # Demos 331 | * [Launching PS2 Backups with OPL](https://www.youtube.com/watch?v=FJEdWW6YhJo&feature=youtu.be) 332 | * [Launching PS1 Backups with POPSLoader](https://youtu.be/qCiezaKglMs) 333 | 334 | # Credits 335 | Thx to the following: 336 | * Jay-Jay for [OPL Daily Builds](https://github.com/Jay-Jay-OPL/OPL-Daily-Builds) 337 | * danielb for [OPLM](http://www.ps2-home.com/forum/viewtopic.php?f=64&t=189) 338 | * dirkvdb for [ps3netsrv--](https://github.com/dirkvdb/ps3netsrv--) 339 | * arpitjindal97 for [wifi-to-eth-route.sh](https://github.com/arpitjindal97/raspbian-recipes/blob/master/wifi-to-eth-route.sh) 340 | * Team XLink for [XLink Kai](http://www.teamxlink.co.uk/) 341 | * Pul Gasari for [Testing streaming games from Raspberry Pi to PS2 using psx-pi-smbshare](https://www.youtube.com/watch?v=FJEdWW6YhJo&feature=youtu.be) 342 | -------------------------------------------------------------------------------- /automount-usb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # psx-pi-smbshare automout-usb script 5 | # 6 | # *What it does* 7 | # This script configures raspbian to automount any usb storage to /media/sd 8 | # This allows for use of USB & HDD in addition to Micro-SD 9 | # It also creates a new Samba configuration which exposes the last attached USB drive @ //SMBSHARE/ 10 | 11 | USER=`whoami` 12 | 13 | # Update packages 14 | sudo apt-get update 15 | 16 | # Install NTFS Read/Write Support and udisks2 17 | sudo apt-get install -y ntfs-3g udisks2 18 | 19 | # Add user to disk group 20 | sudo usermod -a -G disk ${USER} 21 | 22 | # Create polkit rule 23 | sudo mkdir -p /etc/polkit-1/rules.d/ 24 | sudo mkdir -p /etc/polkit-1/localauthority/50-local.d/ 25 | 26 | # For polkit > 105 27 | sudo cat <<'EOF' | sudo tee /etc/polkit-1/rules.d/10-udisks2.rules 28 | // Allow udisks2 to mount devices without authentication 29 | // for users in the "disk" group. 30 | polkit.addRule(function(action, subject) { 31 | if ((action.id == "org.freedesktop.udisks2.filesystem-mount-system" || 32 | action.id == "org.freedesktop.udisks2.filesystem-mount" || 33 | action.id == "org.freedesktop.udisks2.filesystem-mount-other-seat") && 34 | subject.isInGroup("disk")) { 35 | return polkit.Result.YES; 36 | } 37 | }); 38 | EOF 39 | 40 | # For polkit <= 105 41 | sudo cat <<'EOF' | sudo tee /etc/polkit-1/localauthority/50-local.d/10-udisks2.pkla 42 | [Authorize mounting of devices for group disk] 43 | Identity=unix-group:disk 44 | Action=org.freedesktop.udisks2.filesystem-mount-system;org.freedesktop.udisks2.filesystem-mount;org.freedesktop.udisks2.filesystem-mount-other-seat 45 | ResultAny=yes 46 | ResultInactive=yes 47 | ResultActive=yes 48 | EOF 49 | 50 | # Create udev rule 51 | sudo cat <<'EOF' | sudo tee /etc/udev/rules.d/usbstick.rules 52 | ACTION=="add", KERNEL=="sd[a-z][0-9]", TAG+="systemd", ENV{SYSTEMD_WANTS}="usbstick-handler@%k" 53 | ENV{DEVTYPE}=="usb_device", ACTION=="remove", SUBSYSTEM=="usb", RUN+="/bin/systemctl --no-block restart usbstick-cleanup@%k.service" 54 | EOF 55 | 56 | # Configure systemd 57 | sudo cat <<'EOF' | sudo tee /lib/systemd/system/usbstick-handler@.service 58 | [Unit] 59 | Description=Mount USB sticks 60 | BindsTo=dev-%i.device 61 | After=dev-%i.device 62 | 63 | [Service] 64 | Type=oneshot 65 | RemainAfterExit=yes 66 | ExecStart=/usr/local/bin/automount.sh %I 67 | ExecStop=/usr/bin/udisksctl unmount -b /dev/%I 68 | EOF 69 | 70 | sudo cat <<'EOF' | sudo tee /lib/systemd/system/usbstick-cleanup@.service 71 | [Unit] 72 | Description=Cleanup USB sticks 73 | BindsTo=dev-%i.device 74 | 75 | [Service] 76 | Type=oneshot 77 | RemainAfterExit=yes 78 | ExecStart=/usr/local/bin/samba-init.sh 79 | EOF 80 | 81 | # Configure script to run when an automount event is triggered 82 | sudo cat <<'EOF' | sudo tee /usr/local/bin/automount.sh 83 | #!/bin/bash 84 | 85 | PART=$1 86 | UUID=`blkid /dev/${PART} -o value -s UUID` 87 | FS_LABEL=`lsblk -o name,label | grep ${PART} | awk '{print $2}'` 88 | 89 | if [ -z ${PART} ] 90 | then 91 | exit 92 | fi 93 | 94 | runuser userplaceholder -s /bin/bash -c "udisksctl mount -b /dev/${PART} --no-user-interaction" 95 | 96 | if [ -f /usr/local/bin/ps3netsrv++ ]; then 97 | pkill ps3netsrv++ 98 | /usr/local/bin/ps3netsrv++ -d /media/userplaceholder/$UUID 99 | fi 100 | 101 | #create a new smb share for the mounted drive 102 | cat < ~/.bash_history && history -c && exit -------------------------------------------------------------------------------- /samba-init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #If a USB drive is present, do not initialize the samba share 4 | USBDisk_Present=`sudo fdisk -l | grep /dev/sd` 5 | if [ -n "${USBDisk_Present}" ] 6 | then 7 | echo "exited to due to presence of USB storage" 8 | exit 9 | fi 10 | 11 | #if /usr/local/bin/ps3netsrv++ exists 12 | if [ -f /usr/local/bin/ps3netsrv++ ]; then 13 | #restart ps3netsrv++ 14 | pkill ps3netsrv++ 15 | /usr/local/bin/ps3netsrv++ -d /share 16 | fi 17 | 18 | sudo cat <<'EOF' | sudo tee /etc/samba/smb.conf 19 | [global] 20 | server min protocol = NT1 21 | workgroup = WORKGROUP 22 | usershare allow guests = yes 23 | map to guest = bad user 24 | allow insecure wide links = yes 25 | [share] 26 | Comment = shared folder 27 | Path = /share 28 | Browseable = yes 29 | Writeable = Yes 30 | only guest = no 31 | create mask = 0777 32 | directory mask = 0777 33 | Public = yes 34 | Guest ok = yes 35 | force user = userplaceholder 36 | follow symlinks = yes 37 | wide links = yes 38 | EOF 39 | 40 | #if you wish to create a samba user with password you can use the following: 41 | #sudo smbpasswd -a userplaceholder 42 | sudo /etc/init.d/smbd restart 43 | -------------------------------------------------------------------------------- /setup-wifi-access-point.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # psx-pi-smbshare setup-wifi-access-point script 5 | # 6 | # *What it does* 7 | # This script will install and configure an external wifi dongle for access to XlinkKai & samba 8 | # This allows for configuring devices without ethernet to have access to these services 9 | # The default SSID name for the wifi network is XlinkKai 10 | # 11 | # Be sure to change the wpa_passphrase to a custom password 12 | 13 | # Configure hostapd 14 | sudo cat <<'EOF' | sudo tee /etc/default/hostapd 15 | DAEMON_CONF="/etc/hostapd/hostapd.conf" 16 | EOF 17 | 18 | sudo cat <<'EOF' | sudo tee /etc/hostapd/hostapd.conf 19 | interface=wlan1 20 | #driver=nl80211 21 | ssid=XlinkKai 22 | hw_mode=g 23 | channel=7 24 | #ieee80211n=1 25 | wmm_enabled=0 26 | macaddr_acl=0 27 | auth_algs=1 28 | ignore_broadcast_ssid=0 29 | wpa=2 30 | wpa_passphrase=XlinkKai 31 | wpa_key_mgmt=WPA-PSK 32 | wpa_pairwise=TKIP 33 | rsn_pairwise=CCMP 34 | EOF 35 | 36 | # Configure dhcpcd 37 | sudo cat <<'EOF' | sudo tee /etc/dhcpcd.conf 38 | interface wlan1 39 | static ip_address=10.254.0.1/16 40 | nohook wpa_supplicant 41 | EOF 42 | 43 | # Configure dnsmasq 44 | sudo cat <<'EOF' | sudo tee -a /etc/dnsmasq.d/custom-dnsmasq.conf 45 | 46 | interface=wlan1 47 | bind-dynamic 48 | dhcp-range=10.254.0.2,10.254.0.100,12h 49 | EOF 50 | 51 | # Forward additional ports 52 | #sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE 53 | sudo iptables -A FORWARD -i wlan0 -o wlan1 -m state --state RELATED,ESTABLISHED -j ACCEPT 54 | sudo iptables -A FORWARD -p ALL -i wlan1 -o wlan0 -j ACCEPT 55 | 56 | # Restart services 57 | sudo systemctl stop hostapd 58 | sudo systemctl stop dnsmasq 59 | sudo systemctl start hostapd 60 | sudo systemctl start dnsmasq 61 | -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # psx-pi-smbshare setup script 5 | # 6 | # *What it does* 7 | # This script will install and configure an smb share at /share 8 | # It will also compile ps3netsrv from source to allow operability with PS3/Multiman 9 | # It also configures the pi ethernet port to act as dhcp server for connected devices and allows those connections to route through wifi on wlan0 10 | # Finally, XLink Kai is installed for online play. 11 | # 12 | # *More about the network configuration* 13 | # This configuration provides an ethernet connected PS2 or PS3 a low-latency connection to the smb share running on the raspberry pi 14 | # The configuration also allows for outbound access from the PS2 or PS3 if wifi is configured on the pi 15 | # This setup should work fine out the box with OPL and multiman 16 | # Per default configuration, the smbserver is accessible on 192.168.2.1 17 | 18 | 19 | USER=`whoami` 20 | 21 | # Make sure we're not root otherwise the paths will be wrong 22 | if [ $USER = "root" ]; then 23 | echo "Do not run this script as root or with sudo" 24 | exit 1 25 | fi 26 | 27 | if whiptail --yesno "Would you like to enable ps3netsrv for PS3 support? (SMB is enabled either way for PS2 support etc.)" 8 55; then 28 | PS3NETSRV=true 29 | else 30 | PS3NETSRV=false 31 | fi 32 | 33 | if whiptail --yesno "Would you like to enable XLink Kai?" 8 55; then 34 | XLINKKAI=true 35 | else 36 | XLINKKAI=false 37 | fi 38 | 39 | if whiptail --yesno "Would you like to enable wifi access point for a direct wifi connection?" 8 55; then 40 | WIFIACCESSPOINT=true 41 | else 42 | WIFIACCESSPOINT=false 43 | fi 44 | 45 | if whiptail --yesno "Would you like to share wifi over ethernet, for devices without wifi? (Ethernet will no longer work for providing the pi an internet connection)" 9 55; then 46 | ETHROUTE=true 47 | else 48 | ETHROUTE=false 49 | fi 50 | 51 | # Update packages 52 | sudo apt-get -y update 53 | sudo apt-get -y upgrade 54 | 55 | # Ensure basic tools are present 56 | sudo apt-get -y install screen wget git curl coreutils iptables hostapd 57 | 58 | # Install and configure Samba 59 | sudo apt-get install -y samba samba-common-bin 60 | wget https://raw.githubusercontent.com/toolboc/psx-pi-smbshare/master/samba-init.sh -O /home/${USER}/samba-init.sh 61 | sed -i "s/userplaceholder/${USER}/g" /home/${USER}/samba-init.sh 62 | chmod 755 /home/${USER}/samba-init.sh 63 | sudo cp /home/${USER}/samba-init.sh /usr/local/bin 64 | sudo mkdir -m 1777 /share 65 | 66 | # Install ps3netsrv if PS3NETSRV is true 67 | if [ "$PS3NETSRV" = true ]; then 68 | sudo rm /usr/local/bin/ps3netsrv++ 69 | sudo apt-get install -y git gcc 70 | git clone https://github.com/dirkvdb/ps3netsrv--.git 71 | cd ps3netsrv-- 72 | git submodule update --init 73 | make CXX=g++ 74 | sudo cp ps3netsrv++ /usr/local/bin 75 | fi 76 | 77 | if [ "$ETHROUTE" = true ]; then 78 | # Install wifi-to-eth route settings 79 | sudo apt-get install -y dnsmasq 80 | wget https://raw.githubusercontent.com/toolboc/psx-pi-smbshare/master/wifi-to-eth-route.sh -O /home/${USER}/wifi-to-eth-route.sh 81 | else 82 | touch /home/${USER}/wifi-to-eth-route.sh 83 | fi 84 | chmod 755 /home/${USER}/wifi-to-eth-route.sh 85 | 86 | if [ "$WIFIACCESSPOINT" = true ]; then 87 | # Install setup-wifi-access-point settings 88 | sudo apt-get install -y hostapd bridge-utils 89 | wget https://raw.githubusercontent.com/toolboc/psx-pi-smbshare/master/setup-wifi-access-point.sh -O /home/${USER}/setup-wifi-access-point.sh 90 | else 91 | touch /home/${USER}/setup-wifi-access-point.sh 92 | fi 93 | chmod 755 /home/${USER}/setup-wifi-access-point.sh 94 | 95 | # Install XLink Kai if XLINKKAI is true 96 | if [ "$XLINKKAI" = true ]; then 97 | 98 | # Remove old XLink Kai Repo if present 99 | sudo rm -rf /etc/apt/sources.list.d/teamxlink.list 100 | 101 | # Set up teamxlink repository and install XLink Kai 102 | 103 | sudo apt-get install -y ca-certificates curl gnupg 104 | sudo mkdir -m 0755 -p /etc/apt/keyrings 105 | sudo rm /etc/apt/keyrings/teamxlink.gpg 106 | curl -fsSL https://dist.teamxlink.co.uk/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/teamxlink.gpg 107 | sudo chmod a+r /etc/apt/keyrings/teamxlink.gpg 108 | echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/teamxlink.gpg] https://dist.teamxlink.co.uk/linux/debian/static/deb/release/ /" | sudo tee /etc/apt/sources.list.d/teamxlink.list > /dev/null 109 | sudo apt-get update 110 | sudo apt-get install -y xlinkkai 111 | 112 | # Write XLink Kai launch script 113 | cat <<'EOF' > /home/${USER}/launchkai.sh 114 | echo "Checking for XLink Kai updates" 115 | sudo apt-get install xlinkkai -y 116 | echo "Launching XLink Kai" 117 | while true; do 118 | screen -dmS kai kaiengine 119 | sleep 5 120 | done 121 | EOF 122 | else 123 | touch /home/${USER}/launchkai.sh 124 | 125 | #End of XLink Kai install 126 | fi 127 | chmod 755 /home/${USER}/launchkai.sh 128 | 129 | # Install USB automount settings 130 | wget https://raw.githubusercontent.com/toolboc/psx-pi-smbshare/master/automount-usb.sh -O /home/${USER}/automount-usb.sh 131 | chmod 755 /home/${USER}/automount-usb.sh 132 | /home/${USER}/automount-usb.sh 133 | 134 | # Set samba-init + ps3netsrv, wifi-to-eth-route, setup-wifi-access-point, and XLink Kai to run on startup 135 | { echo -e "@reboot sudo bash /usr/local/bin/samba-init.sh\n@reboot sudo bash /home/${USER}/wifi-to-eth-route.sh && sudo bash /home/${USER}/setup-wifi-access-point.sh\n@reboot bash /home/${USER}/launchkai.sh"; } | crontab -u ${USER} - 136 | 137 | # Not a bad idea to reboot 138 | sudo reboot 139 | -------------------------------------------------------------------------------- /wifi-to-eth-route.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Share Wifi with Eth device 4 | # 5 | # 6 | # This script is created to work with Raspbian Stretch 7 | # but it can be used with most of the distributions 8 | # by making few changes. 9 | # 10 | # Make sure you have already installed `dnsmasq` 11 | # Please modify the variables according to your need 12 | # Don't forget to change the name of network interface 13 | # Check them with `ifconfig` 14 | 15 | ip_address="192.168.2.1" 16 | netmask="255.255.255.0" 17 | dhcp_range_start="192.168.2.2" 18 | dhcp_range_end="192.168.2.100" 19 | dhcp_time="12h" 20 | eth="eth0" 21 | wlan="wlan0" 22 | 23 | sudo systemctl start network-online.target &> /dev/null 24 | 25 | sudo iptables -F 26 | sudo iptables -t nat -F 27 | sudo iptables -t nat -A POSTROUTING -o $wlan -j MASQUERADE 28 | sudo iptables -A FORWARD -i $wlan -o $eth -m state --state RELATED,ESTABLISHED -j ACCEPT 29 | sudo iptables -A FORWARD -i $eth -o $wlan -j ACCEPT 30 | 31 | sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward" 32 | 33 | sudo ifconfig $eth $ip_address netmask $netmask 34 | 35 | # Remove default route created by dhcpcd 36 | sudo ip route del 0/0 dev $eth &> /dev/null 37 | 38 | sudo systemctl stop dnsmasq 39 | 40 | sudo rm -rf /etc/dnsmasq.d/* 41 | 42 | echo -e "interface=$eth\n\ 43 | bind-dynamic\n\ 44 | server=1.1.1.1\n\ 45 | domain-needed\n\ 46 | bogus-priv\n\ 47 | dhcp-range=$dhcp_range_start,$dhcp_range_end,$dhcp_time" > /etc/dnsmasq.d/custom-dnsmasq.conf 48 | 49 | sudo systemctl start dnsmasq --------------------------------------------------------------------------------