Sunday, August 11, 2024

How to set up a self booting dedicated Moonlight (Sunshine client of Nvidia's GameStream) on a Raspberry Pi 3B+

8/11/2024:  This guide shows you how to set up a Raspberry Pi 3B+ (and older?) to stream your desktop PC from anywhere on your home network to any TV in your house using Gamestream/Sunshine via Moonlight.

I use this so I can run full speed games and full sound applications and full video streaming from my main PC to my various TV's around the house and (shhhhh) to a monitor on KVM on my work from home desk setup.  Basically, these little ancient Pi 3B+'s are more than powerful enough to run full speed 1080p Moonlight.  Especially with wired ethernet.

---------------------------

Disclaimer: I am not an expert.  I'm bad at Linux.  I figured this out reading lots and lots of README's and proper wiki and FAQ's and TONS and TONS of message board posts.  The three main links you need:

https://www.raspberrypi.com/software/ - Bullseye 32 Bit Lite
https://www.raspberrypi.com/documentation/computers/configuration.html - How to use Raspi-Config
https://github.com/moonlight-stream/moonlight-embedded/wiki/Packages - Commandlines to install Moonlight.
https://github.com/moonlight-stream/moonlight-embedded/wiki/Usage - Commands for using moonlight.
https://www.makeuseof.com/what-is-systemd-launch-programs-raspberry-pi/ - Basics on how to set a SYSTEMD service to autoboot.

---------------------------
If you want to speed run this guide and are fluent in Linux/Raspian, try the following shorthand steps.  (HOWEVER, I have no idea what updates will be made by the Moonlight Embedded devs and Raspian devs, so please read the verbose version after this and use the hyperlinks in it if you want to be sure it's all still valid.)

  1. Install Bullseye 32 bit lite with Raspberry Pi Imager on a 4GB or higher USB device.  Make sure to set localization and, if using wifi, your wifi credentials with OS Customization.
  2. Plug in Keyboard, Mouse, and xBox controller to USB ports on Pi.
  3. Run first boot, and at the command line
  4. curl -1sLf 'https://dl.cloudsmith.io/public/moonlight-game-streaming/moonlight-embedded/setup.deb.sh' | distro=raspbian sudo -E bash
  5. sudo apt install moonlight-embedded
  6. sudo apt update
  7. sudo apt upgrade
  8. sudo nano /boot/config.txt and change "dtoverlay" to be dtoverlay=vc4-fkms-v3d
  9. sudo raspi-config and turn on 
    1. autologin, 
    2. Network at boot, and 
    3. set the GPU Memory to 256.
    4. If it doesn't reboot for you, do another sudo reboot
  10. Pair Moonlight with: moonlight pair.  (You'll need to get the Pair code from your PC running Sunshine.)
  11. Test moonlight with: moonlight stream -1080 -app "Desktop"
  12. Exit moonlight with: Shift-Ctrl-Option-Q
  13. Establish SYSTEMD service file:
    sudo nano /lib/systemd/system/moonlight.service
  14. Text of moonlight.service should read:

  15. [Unit]
    Description=StartMoonlight
    After=network.target

    [Service]
    ExecStart=moonlight stream -1080 -app "Desktop"
    #Restart=always
    User=pi

    [Install]
    WantedBy=multi-user.target

    (Note, the Restart=always is just needed if you want to auto-restart due to some kind of failure.  The # in front means it is disabled/commented out.)

  16. Test with: sudo systemctl start moonlight.service
  17. Quit Moonlight with Shift-Ctrl-Alt-Q.
  18. Now, we need to enable the service to run on every reboot with: 
    sudo systemctl enable moonlight.service
  19. And now, do a sudo reboot
  20. Enjoy your autobooting moonlight Raspberry Pi3+!

---------------
Below is my patented horribly wordy, document for myself by typing outloud and probably never going back and editing guide to setting up Moonlight on an ancient, dusty Raspberry Pi 3B+!  Worked for me as of 8/11/24.

Background: Ok, so, I had this set up and working great... and then my card died magically one day... AND I realized I had forgot to back it up and make a standard image for myself.  It's not too hard to set up, except the Autoboot isn't obvious and various Reddit threads via Google searching give too many options.  This will be the 3rd or 4th time I've done it without documenting the steps because of setting up various versions on different dedicated and PINN implementations.   And, there are lots of help files I used along the way, so since I have to look it all up again, I figured I should document this time!

You can set this up as one of your PINN OS's if you want, or just as a straight full OS.  The whole build fits on a 4GB SD card or USB drive (I'm gonna see if it fits on a 1GB drive someday, since I have a bunch of 1 GB USB thumbdrives laying around).  And also, since it's essentially a dumb client to your PC with no involvement on your end other than turning it on, and doesn't do any read/write cycles really... you can run it with the Pi as a physically switched on/off device.

Yes... Essentially, what I do is just turn on my Pi, set my TV to the Pi's in port... and the mouse, keyboard, and xBox controller just "work" like I'm on my actual PC.  With wired ethernet, it's almost just like you're at your regular gaming PC.   (Even on wireless, the streaming speed and lag is remarkably good.)

Quite honestly, I'm blown away at how good this works.

What does this build get you?

  1. Install of Bullseye lite (Legacy 32 Bit version) of Raspbian OS for Raspberry Pi 3B+ (YMMV on other Pi's) using Raspberry Pi Imager (https://www.raspberrypi.com/software/).
  2. Install of Moonlight Embedded.  (https://github.com/moonlight-stream/moonlight-embedded)
    1. Must use the "Embedded" version on this age/vintage of Raspberry Pi.
  3. Command lines to configure Moonlight.
  4. Command lines to set up Moonlight to autoboot.
  5. I don't offer advice on how to set up Sunshine (Main site: https://app.lizardbyte.dev/Sunshine/ Download link as of today: https://app.lizardbyte.dev/Sunshine/?lng=en-US#Download  Github as of today: https://github.com/LizardByte/Sunshine) or Gamestream, but I must say that setting up Sunshine on my Windows PC's was one of the easiest, "set and forget" and "completely negligible impact on performance" things I've set up.  The only thing weird about it is it goes through a web browser for the interface.  Don't let that throw you.  It works fine, but if you're a person like me who keeps 8 billion tabs in 3 million windows open in my browser, it can become odd to wait for your browser to open up.



Alright...  Here's the verbose steps...
  1. Grab an SD card or USB card...  I will assume you have some familiarity with Raspberry Pi Imager and that you have a 4GB or bigger SD card or USB card.  
    1. I highly recommend testing said card with h2testw or similar.  The official site for h2testw is https://www.heise.de/.  As of this writing, the h2testw download page is https://www.heise.de/download/product/h2testw-50539.  Please note that h2testw is wonderful for testing and seeing real world speed with the simple idea of writing over your whole card and then reading it back for errors.  HOWEVER, I have found that it _won't_ detect when super cheap chinese knockoff cards have issues with holding the 10k and 100k and more files you might like to have on an emulation system.  This is because it only stores 10-100 or so files on a typical USB drive or card.
    2. If you plan to boot from USB, 2 lessons learned... 
      1. There's thorough but somewhat confusing documentation here:  https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#usb-boot-modes
      2. This Instructable cuts directly to what you actually need to do:  https://www.instructables.com/Booting-Raspberry-Pi-3-B-With-a-USB-Drive/
      3. Often, you need to use a powered USB hub to put enough power to some USB drives.  I've needed a powered USB hub to be consistent with a 128GB drive that had a huge old LED on it, and also a 256GB SSD in a USB enclosure.  Other USB zip drives work fine.  YMMV.

  2. In Raspberry Pi Imager, choose your Pi 3 from the list, and then choose the older Bullseye Lite 32bit.  Other lite versions can work, but the good ol 32bit is all we want and need here.

  3. Then, pick your storage, and when it asks you to do the customizations, I highly recommend doing that.  Yes, you can use Raspi-Config to do it yourself or to change anything.  But it's tedious setting your localizations that way, so please do that here.   (One thing to consider... If you plan on using only wired... consider NOT putting in your wireless even though you can.  No point in confusing the damn thing.)

    (Choose "Edit Settings" and then "Yes". )
    (If you want SSH enabled by default, make sure to do that under services)



  4. Ok, now you should have a bootable plain jane install...  One that you can either plug an mouse and keyboard in directly to in order to configure.  Or one that you can SSH / Terminal into use the settings you put in on the OS customization step.  Run the machine for the first time.

  5. Optional: If you're using SSH, figure out your IP address or use raspberry.local and get a terminal.  Example, since I'm using my MacBook to write and take screenshots, I went to my wireless router's device list, and found the raspberrypi and the IP, and then at the command line of terminal, you just type "ssh 192.168.1.xxx", accept the fingerprint, mess up the password, get the password right finally, and you're in!  Please note the note below... don't use the default password!


  6. Now, we install Moonlight.  Unless you're really into code and compiling, just do the "package" version of the instructions: https://github.com/moonlight-stream/moonlight-embedded/wiki/Packages

    NOTE: please use what they say on the proper github... but, for documentation sake, you can see them in the screenshot here...  First step is the curl instruction that does all the prelim setup.

    Then the next step... actually install moonlight-embedded... make sure you answer "y" for yes, and then be patient for a while...

    Now, twiddle your thumbs even more as you get everything updated...  Again, another "y" for you here...

  7. Ok, so you've rebooted, and now it wants you to login.  Yuck.  We want this thing to autoboot.  So, 
    1. log in (or SSH in), and then type "sudo raspi-config".
    2. Select "System Options".
    3. Choose "Boot / Auto Login".
    4. Choose "Console Autologin".
  8. Next, we are going to tell it to wait for the network connection on boot.  This is important, I think, because with an autoboot of moonlight, you want the network connection going before it actually tries to launch and connect.
    1. Select "System Options" again.
    2. Choose "Network at Boot".  And tell it YES, you want to wait.
  9. Next Raspi-Config option... we need to dedicate lots more GPU Memory, so,
    1. Select "Performance Options" this time.
    2. Go to "GPU Memory".
    3. Type in 256.
  10. Good optional Raspi-Config option... if you'd like... Go to the optional and "Expand Filesystem".  That's a standard RetroPi thing, and not necessarily necessary on this build.  But, you might as well...
  11. Other Raspi-Config options are really cool.  And if you didn't localize your keyboard and such with the Pi Imager, do that now to prevent headaches.  But, I won't be covering them here as we don't need to deal with them.  One thing that is kinda cool is that Moonlight does work and look great on a CRT if you want to use the composite output.  It's not perfect, but it's a pretty quick and dirty way to output a modern Windows PC to a classic CRT Retro Television.  Just make sure to tweak your Moonlight settings.

  12. Go ahead and exit RASPI-CONFIG and reboot.

  13. Now, you'll need to fix your graphics.  
    1. There is a separate section on here about needing to update via rpi-update first.  I didn't have this issue.  I did it once on one Pi and I didn't like what it did, but I forget why.  The trick to the fix if you don't run it and break your system....is that every PC/OS flavor and text editor can read and edit the config.txt file on your card if you didn't do the rpi-update and need to.  (OR, you can start all over again and just repeat these steps in this guide again...)
    2. So, either way, you need to change the graphics driver in config.txt.  If you've never used nano before, here's what you do.
    3. Enter "sudo nano /boot/config.txt"
    4. Use your arrow keys to navigate to the right section, and add an "f" to the dtoverlay string.  (This is the part you'd revert back to by removing the "f" if you, for some reason, needed to do the rpi-update step.)

    5. Then press "Control x" to exit.  Press "y" to save.  And press "ENTER" to confirm the file name.
    6. And, give it the old "sudo reboot".

  14. Now we configure MOONLIGHT EMBEDDED!
    1. Use the commands here to get yourself going: https://github.com/moonlight-stream/moonlight-embedded/wiki/Usage
    2. If you've used the graphical interface of Moonlight before, these commands roughly correlate to the UI you're used to.
    3. First we start by Pairing to the target PC.  
      1. REMINDER: This guide is intended to set you up with a single, auto-booting install to one PC.  Turn on Pi, Pi Boots, you see your remote computer.  ... You may not want that... If so, you can stop here and just always do command lines from now on.
      2. Type "Moonlight Pair", and if you're only running one Sunshine computer on your network, it should find it on the network, and give you a PIN to enter on that Sunshine computer.  Enter it, and Moonlight is happy at the command line.
        (If you forgot, the default password for sunshine is sunshine...)

  15. So now, you can try your first shot at streaming. 
    1. Default is the Steam application.  But, that's not what I like, I like the default Desktop, as you can then just use all of windows and then just launch Steam from the desktop like normal.
    2. Type in the following command line: moonlight stream -1080 -app "Desktop".
      1. Note, on the graphical interface, I often like to double the bitrate that's suggested.  You can do that here with "-bitrate <bitrate> Specify the bitrate in Kbps".  But... I forget here what that standard is because it wants it in Kbps and not Mbps and I'm just too lazy writing this right now to play with that.  It's not really important what I do as you can always play with the command lines until you get it right for yourself and your situation.
    3. And, if you did everything right, you should be off to the races and live and streaming your Sunshine hosted system as if you were right there at the PC (or whatever you put in for the -app parameter.
    4. Remember, Shift-Ctrl-Option-Q is how you quit out of Moonlight to get back to the command line.   If you're using a remote terminal, you don't need to worry as "sudo reboot" also lets you reboot.  Hey, for fun, you can Moonlight to your computer running the remote terminal and run terminal virtually which is super cool of course!

  16. Now, it's the part that I always need to look up and mess up...  Autobooting.  The reason I always mess this up is that there are MULTIPLE methods of automating start-up tasks.  (Example: Great encyclopedic articles like this (read, but don't try to use because it's not a code/example type article): https://www.dexterindustries.com/howto/run-a-program-on-your-raspberry-pi-at-startup/)  A few are deprecated but people love them anyway.  And a few are XWindows specific and don't apply here (I'm looking at you, autostart).  
    1. My best success is SYSTEMD.  #4 on the cool article I've crossed out above.  SYSTEMD, from what I've read, is the current modern and standard default way to launch things.   The problem is it's amazingly powerful and configurable to the point of not being easy obvious.  And, it also suffers from having a folder location change for the settings from version to version.  Joy.
    2. So, here's the straightforward steps I took to make it work.  (Many thanks to this page for having a very simple/clear "hello world" example that I modified just slightly.  https://www.makeuseof.com/what-is-systemd-launch-programs-raspberry-pi/)
    3. First, we create a service for moonlight launching: 
      sudo nano /lib/systemd/system/moonlight.service

    4. Then, we enter the following as the contents
      [Unit]
      Description=StartMoonlight
      After=network.target

      [Service]
      ExecStart=moonlight stream -1080 -app "Desktop"
      #Restart=always
      User=pi

      [Install]
      WantedBy=multi-user.target

      (Note, the Restart=always is just needed if you want to auto-restart due to some kind of failure.  The # in front means it is disabled/commented out.)

    5. Now, Control X, Yes, and Enter to save.
    6. Test it at the command line if you like with: 
      sudo systemctl start moonlight.service

    7. Remember, you can quit Moonlight with Shift-Ctrl-Alt-Q.
    8. Now, we need to enable the service to run on every reboot with: 
      sudo systemctl enable moonlight.service

    9. And now, do a sudo reboot.  And with any luck, you're done!
Hopefully, this all worked!  I'm NOT A LINUX EXPERT AND LEARNED ALL THIS BY THE HELP FILES OF THE REFERENCED AUTHORS AND A THOUSAND MESSAGE BOARDS.   THANK YOU.   If anything here is wrong, or needs edited, please let me know.  Thanks!

Monday, October 10, 2022

Triple boot iMac with Snow Leopard, El Capitan, and Batocera... Notes, Tips, Tricks, and Hints

Well, well, well.   I think I got it?  Use my notes at your own risk.  BACK UP BEFORE PARITIONING AND ERASE HD DATA!

Here's the basics for creating a triple boot Batocera on Intel Mac...  probably most iMacs, Macs, MacMini's, MacBooks, etc.

1. Find a wired keyboard.  If a windows one, remember "Windows" = "Apple/Command".
2. Create/validate 4 partitions... 
- A Rosetta capable MacOSX like Snow Leopard. 
- The lastest MacOS that runs on your hardware (it was El Capitan for me).
- A MSDOS-Fat32 partition of about 5-10 GB that is named "BATOCERA"
- A ExFAT partition named "Userdata".

3. Download Batocera for Intel Macs here https://batocera.org/download.
- Expand and open the .img.
- Copy everything from that image to your BATOCERA parition.
- (BalenEtcher is not required.)

4. Install rEFInd (you might need to use your Recovery Partition or a USB boot disc to get to Terminal to install if SIP is enabled.)  https://www.rodsbooks.com/refind/

5. Verify in Files that it found the Userdata partition, and then use the EmulationStation Developer menu item to run "Format" on the "Internal" drive to EXT4 format.  Reboot.

6. Add roms and have fun!

That's it.  The wordy section with tips and pitfalls follows.  Thanks


----------------wordy section------------------


I saved an iMac with 3GB of memory and a 320 GB drive and a dual core Intel processor from the dump.  A friend got it for $10 and couldn't figure out how to fix and flip.  I got into it, made a boot USB for the OS's I wanted, and got it all repaired and fixed.  (The max Rosetta/MacOS9 compatible OS is Snow Leopard, so that's one 120 GB partition, The max OS for this OS is El Capitan, so that's next at another 120 GB, then I have a 10 GB FAT partition for Batocera, and then finally 70 left for the Userdata partition.

I didn't find a lot of information on how to set up Batocera on a dual boot Mac from google, and so I thought I'd document what worked.  (Note: Some message boards forward you to this page... https://wiki.batocera.org/dual_boot_ubuntu_batocera.linux  But, that doesn't have ANY information for MacOS and is written like this dual boot stuff is all horribly impossible and ill advised.  But, with what I did below, well...  it ended up working just fine.)

As with a lot of these dumps, this is not going to be highly formatted or pretty.  I just wanted to get it all down before I went on to the next thing.

1. Windows keyboards on Mac...  The windows key is the command/"four circles weird icon"/Apple key.  Also, a wireless Logitech doesn't always work for the Command-R (to start in recovery mode) or the very important Alt (to start in boot picker) methods of holding those as the computer restarts.  So, having a wired keyboard during this is important.  (Once you are booted to the mode you want, everything is fine...)

2. Getting the partitions right.  Ugh.  (You'll probably want to put windows on your machine.  I just didn't do that.   But shouldn't have any issue. But, it's a really old mac and I have lots of windows machines.)  So, I was focused on having a solid Rosetta machine again to run old stuff.  I always regretted updating past that.  Regardless, you can do as many partitions as you want.  Except for that the partition manager is really weird and wonky on the Mac DiskUtility.  

What I finally figured out through all of this was that the way to "fix" issues where the partitions won't get set, is to just take the last MacOSJournaled partition and have it reoccupy all the remaining open space by deleting all the partitions that aren't just working right.  

Once you've done that... it's actually simple.  

2. a. Just select the last MacOSJournaled partition that is too big and has free-space, and hit "+" and then "+" again.  Then resize those as you want.  And on the 2 new partitions... I HAD to partition them as MacOSJournaled FIRST.  Every time I tried to go straight to the formats I wanted... then it failed.

2. b. But if you get the partitions right with MacOSJournaled _THEN_ it's time to change them and rename them.  So, call the first tiny one BATOCERA and formatted it as FAT.  (I made it 10GB to prevent against future expansions).  

2. c. And then I called the bigger one "Userdata" and formatted it as EXFAT (for now... we'll fix that to EXT4 cause FuturePinball - https://wiki.batocera.org/systems:fpinball says it prefers that, even though I assume this computer is too slow for that.)

So, now, you should have all your "legit" partitions for MacOS versions and Windows and Linux versions... and then for me... 

To summarize step 2... I made my last 2 partitions... "BATOCERA" (MS-DOS FAT) and "Userdata" (ExFAT)...  Which is how ye old USB partitions look when you make a USB drive.

(NOTE: This method _really_ scared me and confused me.  I thought I could just install this on BATOCERA as a BIG ASS FAT32 DRIVE cause that's what mounted on the USB stick I'd made at first... But one big FAT32 drive had no space when I did ROM transfer... but that's because of how "Userdata" works... it's a separate partition with lots of space that is leveraged by the BATOCERA Linux boot.

I found one thread that clued me into this all here: https://wiki.batocera.org/batocera.linux_architecture  And it very clearly explains that you need 2 partitions!  I should have had that _duh_ moment, but I didn't because I'd read that horrible link I crossed through up at the start.  I thought somehow that "Userdata" was materialized by magic by the first launch.  I thought it would maybe create a rogue Userdata that took over my good partitions.  I was scared.

I spend at lot of time switching between "External" and "Internal" and the various drives that EmulationStation offered.... But, what _I_ wanted was MacOS installed on my harddrive.  No USB or external or network stuff.  Just _there_ whenever I wanted to boot in.  So, 2 partitions is the trick.  (Spoiler, first boot with "Userdata" as a partition existing... IT FOUND IT AUTOMATICALLY when "internal", the default, is set in Emulation Station.))

Where was I.  Ok, so, I have my partitions.

3. Next step, go to https://batocera.org/download and get the MacOS Intel version.

3. a. (NOTE: Do they want you to use BalenEtcher to install and all that in the documentation???  yeah, they do.  But do you need to???  Not really.   Not really at all.  Why???  BECAUSE... Emulation Station has a very scary formatting utility built in.  Ack!  So, you don't actually need to do anything but dump the Image's BATOCERA data into the BATOCERA partition.  That's it.)

3. b.  Just open the .img, and you'll get _only_ BATOCERA... Just copy all the files (batocera-boot.conf, and the folders boot, EFI, and tools) over to your partition... also named BATOCERA.

3. c. But but but... they said to use BalenEtcher.  I know.  But, you don't need to.

4. At this point, you will probably have gotten here because you're struggle and have had to hold "ALT" about a million times to play with things.  Here's part of what makes all this weird... most of the guides and message board posts whine about not being able to have a graceful autoboot menu by default.  That's because they haven't messed with rEFInd.  (https://wiki.batocera.org/dual_boot_ubuntu_batocera.linux, the x'd out link above, does mention rEFInd, but it's under an "iOS" section and makes it sound like you'd better hope and pray it finds your partition.  Poppycock.  Not sure who wrote that, but it clued me into reading about the utility, and it's great.)

4. a. rEFInd... Set up the boot menu with an amazing boot utility that replaces the "hold ALT during reboot" with a cool booting utility by Roderick W. Smith.  https://www.rodsbooks.com/refind/  Go ahead and get that.  The documentation is wonderfully verbose and accurate.  I had to use the SIP workaround in bash at the terminal after booting from an install USB because my recovery partition wouldn't boot (likely because this dang computer had a hell of a hard life and had something go corrupt on the original owner in the boot sequence - They messed up something somehow... anyway...).  If you can be methodical and follow directions, it is doable.  I highly recommend it so you can have your Mac boot the way you want.

5. So, now it's time to boot up BATOCERA with rEFInd.  Once you're in, it's too loud (hope you're keyboard has volume controls on it), and then it's too loud again.  You'll wake up the wife.  

5. a.  It will take a long time your first time, as I assume it's going ahead and creating the default files and folders on Userdata.  (You will be destroying them in a second.)

5. b. Once you have the interface, hit the F1 key and go to the file browser.  Make sure that when you go to Roms or Bios or Userdata, that the free size on all of them is what you made that partition.  (In my case, it was the 70 GiB partition.)

5. c. For sure for sure make sure that's right.  Cause, the next step is for you to delete it and put EXT4 on it!  So, the way you do this is to quit Files, and then hit space bar, and then go into the Menu.  As documented by the amazing link here: https://wiki.batocera.org/batocera.linux_architecture , you can then follow it's advice to go to Menu -> System Settings -> Frontend Developer -> Format. 

5. d. Ugh... Formatting is scary.  Scary scary.  But, remember... You made your partitions.  You defaulted to "Internal" as the location.  And, most importantly, you did step 5. b. and verified that the "Internal" partition it found was indeed Userdata because the size of the drive matched the size of your partition.

5. e. You are making regular backups of your main system, right?  And you did before you started partitioning everything, right?  Right?

5. f. So, go ahead and format it to EXT4.  And ta-da, it happens so fast, you barely realize it.

5. g. This is where I point out that it seems like _ANY_ EXT4 capable partitioning software will work.  But, most guides need all sorts of Ubuntu USB or MacFUSE installs or what have you...  And this built in functionality works great after you get over being scared.

6. So, that's pretty much it.  Reboot into batocera, and see that, now, tada, you now have an EXT4 userdata drive.  The MacOS won't love it (unless maybe if you use MacFUSE), but who cares.  Moving ROMS is super simple using the myriad of guides for either using \\BATOCERA or using FTP or using SMB or what have you.  The only downside of course is that you'll need an extra computer or laptop to interface...  This is where an Ubuntu boot USB or MacFUSE might help... and also... I haven't tried mapping the other drives as I'm not a linux-y kind of guy.  If that is you, it might work.

6. a. Note: YOU GOTTA TELL EMULATIONSTATION TO HOOK UP TO YOUR WIFI NETWORK MANUALLY THROUGH THE MENU all the time.... Ugh...


Anyway, I hope that long ass wordy guide helped someone struggling/scared with making a dual boot Mac that runs Batocera.


Good Luck!

Saturday, August 6, 2022

Notes on Rebuilding Title.db on my 3DS after 3hs hshop loss of battery and out of space on SD Card using save3ds and rebuild-title-database

Huge thank yous to all the 3DS homebrew developers including ihaveamac, wwylele, Ryuzaki_MrL, all the MacOS rust and brew and python devs, and to ZeroSkill for publishing their code and doing all the real work.  Hopefully this guide can help someone use their amazing tools to recover their 3DS titles after an SD card corruption.

So, I found out there is the amazing hshop homebrew https://hshop.erista.me/3hs for 3DS installation of games on a luma / godmode9 hacked 3DS via https://3ds.hacks.guide

I went nuts on it like a kid in a candy shop, and twice, corrupted my 3DS's title.db!

The symptoms of a corrupted title.db is that everything but DSiware titles and native 3DS utilities disappear from your 3DS!  Ack!  Panic!  All my icons are gone!  SD card is fine...  hmmm...  everything still in all the folders.  Did Nintendo find out I've been naughty and zap me?  I was in a panic.

But, I hopped on the 3hs discord support forum, and ZeroSkill quickly pointed me in the right direction.

Documenting this here for future folks as the reality of a title.db recovery is that it's pretty convoluted and extensive.  So I'm putting the notes I remember here.  This won't be definitive as a guide.  I'm writing it wordy and horrible as my brain remembers.  So, my apologies for lack of editing and clarity.

But hopefully it helps someone in need get there faster and with less pain.

Before you begin...

So, there are two main utilities you will need.  

https://github.com/ihaveamac/rebuild-title-database

https://github.com/wwylele/save3ds

These utilities 100% worked for me, but they are _not_ set up as easy to use applications yet.  You will need Linux or MacOSX to use Save3ds.  Yes.  I put that in the worst font possible.  I tried to find some geocities flash code even, but alas...  Don't get halfway through this on a windows machine, only to realize you're screwed halfway through.  You need to be comfortable with command lines, or willing to learn.  And you might need to find a way to run Linux if you don't have a Mac available.

Again, Save3ds requires Linux or MacOSX.  And it requires use of command lines.  If you don't have those available... well...

As for me, I started on Windows just doing the first part of rebuild-title-database, only to get to save3ds, and be lucky that I am in a house with Windows, Mac, and Linux machines.

So, not only will you need those 2, but you'll need to be able to compile and run them... which takes a ton of stuff too, like Python and compiling things like rust on Mac's Terminal.  I'm in that zone of knowing enough to figure it out, but being scared and confused the whole way.

BUT I DID IT!  lol

So, first... I was on Windows 7 and I got rebuild-title-database to work finally.  Then, I switched to my MacBook to finish with Save3ds.  (If you are using Linux, hopefully you are smarter than me and will laugh mockingly at my commandline skills.)

Steps (27)!

1. Before you start, you have to follow this guide:  https://ihaveamac.github.io/dump.html Turns out for me, the way to get it to work was to launch my 2DSXL without the SD card in it, and then after hitting save on the default luma screen, it opens straight into GodMode9 / GM9.  This was important because when your title.db on your SD card dies, you don't have the icon anymore to open God Mode, and the methods on the dump page weren't working for me.

NOTE: It was easiest for me in the command line, to mount the SD card on my pc and then drag the boot9.bin and moveable.sed files to the same folder where I unzipped rebuild-title-database.  You can leave them on the SD card in the out folder and reference them there.  But, it's a lot of typing.

2. Then, you go back, and you realize, for me at least, that Python wasn't installed.  So, I had to install Python.  

Quick note, if you're on Windows 7 like I am on my game/mame/virtual pin pc... you need to scroll down through lots of versions of Python before you find one that is compatible with Windows 7.  Took me a bit to figure that out.

Another quick note, when you install python, you have to check "add Python to your path".  If you don't, then the command line doesn't work.  I had to uninstall and reinstall to recheck the box.

3. Once python is installed, you go to your terminal, and you change the location you're at to the location you unzipped your download of rebuild-title-database.  For me, I had unzipped to me F: drive.  Turns out, in the examples, they use "F:" to be the location of SD card...  That confused me.  Ope!

<py3-cmd> rebuild-title-database.py -b boot9.bin -m movable.sed -s F: -o out

This is what is on the readme page.  So, mine actually ended up looking like this...

python rebuild-title-database.py -b boot9.bin -m movable.sed -s M: -o out

This is because 1. I moved boot9.bin and movable.sed to the folder that contains rebuild-title-database.py.  And, because I changed from c:\whatever\ to the folder I actually unzipped, which was f:.   So, on the terminal, it looked like 

F:\> python rebuild-title-database.py -b boot9.bin -m movable.sed -s M: -0 out

I'm pretty sure, if M: is your SD card, and you didn't move boot9.bin, you could have put M:\gm9\out\boot9.bin in that line...

F:\> python rebuild-title-database.py -b M:\gm9\out\boot9.bin -m M:\gm9\out\movable.sed -s M: -0 out

NOTE: At some point, I believe I also needed to get seeddb.bin and put it in the same folder as the rest of rebuild-title-database.  You can find that here:  https://github.com/ihaveamac/3DS-rom-tools/wiki/SeedDB-list

4. Ok, so, when you run rebuild-title-database after a corruption like mine, what happens, is it starts parsing out the files in your ID0/ID1 folder structure...

5. And it saves those file ID's out to the "out" folder... Which, in my example, was F:\out\.  Because we only defined the word "out" in that statement.  (I assume, again, you could change the word "out" in the statement, to _any_ windows path.

6. BUT, when I'd run this, it would Fail.  Over and over.  I couldn't figure out why.  But, finally, I figured it out.  The failure occurs at the file when hshop died.  The first time, hshop failed because the battery died mid download.  The second time, hshop failed because I ran out of space on the SD card.  The trick is to read the first 8 and the last 8 digits of the file ID near the end of the error code, and then go find those folders, and delete the final folder from the SD card.

The ID will look like 0004000e001d1300 in the error message.

The path on your SD card will look like this...  

\Nintendo 3DS\dbxxxxxxID0xxxxxxxxx14\f6axxxxxxxxID1xxxxxxxx44d\title\0004000e\001d1300\

You will want to delete this Folder: \001d1300\

7. Once you delete the offending folder, you will lose the partially downloaded/corrupt game.  But, it will free everything else back up for when you rerun rebuild-title-database again.

8. When you are successfully, you will now have a folder called "out" with a ton of files that look like "0004000e001d1300".  This is all the installed titles on your 3DS's SD card, minus the one you just deleted.

IMPORTANT:  Copy this "out" folder to your SD Card!  Because you need the folder on your Mac or Unix system for the next step...  I renamed the folder to "titleexport" for myself to keep track of it because "out" is used a lot by other apps on the 3DS card.  

9. So, NOW, with your titles exported by rebuild-title-database, you'll need to use https://github.com/wwylele/save3ds to rebuild and reseed the title.db.  (I also did this to import.db also, see later.)

10. So, Save3Ds isn't hard to use, but it's a pain to install if you're not a programmer.  I did _not_ write down everything I went through when I installed this, but needless to say, you have to go through a bunch of help files to get everything set up.

11. Installing Rust is required.  Good luck.  I forget everything I did to get it going, but somehow I did.  https://www.rust-lang.org/tools/install looks right, but I think I actually had to use this...  https://ports.macports.org/port/cargo/  with the help file from here... https://doc.rust-lang.org/cargo/getting-started/installation.html

12. Then, the command for mac is to "brew" a "cask".  It seems that "cask" is used differently now, and "brew" is something you have to install yourself..

brew cask install osxfuse && brew install pkg-config

13. So, you can get Brew through here...  https://brew.sh/

14. But, then, it didn't run, and so I think I had to change where "cask" was, and possibly had to do the 2 installs separately.  Again, I was in pure "get this done" mode, and wasn't thinking about documenting.  My browser history has this link, so I assume I was able to get brew working with one of the commands here...  OR, I found the install location and ran it from that.  https://apple.stackexchange.com/questions/148901/why-does-my-brew-installation-not-work

15. Anyway, somehow, I got it installed!  Yay!

16. And then, I tried to run the line...  And oh my, if you're not used to command lines for apps that do a million things, hold on to your seat!  https://github.com/wwylele/save3ds has really good documentation, but it's still super confusing on a Mac to make work because of MacOSX's quirks and because, as a super useful tool, save3ds has a ton of options for a multitude of uses beyond just this task.

17.  First tip, my SD card was called by my Mac - NO NAME.  That space in "NO NAME" really messed me up.  So, I had to title my SD Card.  I used the wonderful fix of ... "NONAME".

18. Next, much like needing to be in the proper folder where the .py file is when running the python script, you need to spend time figuring out where to point things and locate things on the Mac.  One trick... If you find a folder you like, and you don't know the path, you can drag the folder into terminal, and it writes the path for you.  That REALLY helps when you are a newb.

19. Cut to the chase, here's the lines that worked for me on the terminal...  And, I'll explain what they are in subsequent steps...

/Users/mbpuser/save3ds-master/target/debug/save3ds_fuse --db sdtitle /Users/mbpuser/save3ds-master/target/titleexport --sd /Volumes/NONAME --movable /Volumes/NONAME/gm9/out/movable.sed --boot9 /Volumes/NONAME/gm9/out/boot9.bin --import


Users/mbpuser/save3ds-master/target/debug/save3ds_fuse --db sdimport /Users/mbpuser/save3ds-master/target/titleexport --sd /Volumes/NONAME --movable /Volumes/NONAME/gm9/out/movable.sed --boot9 /Volumes/NONAME/gm9/out/boot9.bin --import


/Users/mbpuser/save3ds-master/target/titleexport  

(All Titles exported by the python script into the "out" folder by rebuild-title-database on the Windows machine need to go here.  Other names would _certainly_ work, including "out".)


20.  So, the first thing is that save3ds worked best for me with everything simply held in the default locations of the save3ds install.  Part of my struggle was the "NO NAME" vs. "NONAME" problem.  So, I probably could have left files on the SD card but as I was fixing errors, placing the files in the same folder as the install got me past those issues.

Here's what each part of my command line statements means...
/Users/mbpuser/save3ds-master/target/debug/save3ds_fuse    <-This is where my install of save3ds was located.
--db sdtitle  <- This tells save3ds that it is a database action and that it's rebuilding sdtitle ON YOUR SD CARD
/Users/mbpuser/save3ds-master/target/titleexport    <- This is the folder where all of the rebuild-title-database files in the "out" folder were stored by me.  You should set it to the folder where your output is.  I assume it could be on the SD card in a folder named "out" for most people.
--sd /Volumes/NONAME   <- This is the path to the root of my SD card.  
--movable /Volumes/NONAME/gm9/out/movable.sed   <- This is the path on my SD card to the movable.sed file that GodMode9 exported back in step 1.
--boot9 /Volumes/NONAME/gm9/out/boot9.bin  <- This is the path on my SD card to the boot9.bin file that GodMode9 exported back in step 1.
--import   <- This tells save3ds that you are wanting to import the file to the proper place on your SD card.

On the second statement, the only thing different is "sdimport" instead of "sdtitle".  These are how the save3ds readme defines these:
  • sdtitle refers to the file SDMC:/Nintendo 3DS/<ID0>/<ID1>/dbs/title.db
  • sdimport refers to the file SDMC:/Nintendo 3DS/<ID0>/<ID1>/dbs/import.db
I honestly don't know if I needed to do import.db.  But, since it was in the same folder as title.db, I did it anyway.

21.   So, if you run the utility, and everything goes right, all that work just results in a title.db and import.db of almost the same size with a new date and time stamp.

22.  Excitedly, you run, put your SD card into the slot, and...  NOTHING.  Nothing happens like a fix.  You boot the 3DS, and it looks like it all failed and nothing new has happened.

23.  Cry, a little, panic.  Restart a couple times, put the card in and out.  IDK  what I did, but both times, after a few cycles of this, all the sudden... poof!  Hundreds of new install gift boxes appear.  Yay!

24.  *sigh*  So, you do lose all your nice folders and structure for everything.  But, at least all your apps are back.  

Note: You also lose all your badge placements in apps.  (Folder badges seem to stay in place.)  But, this definitely messes up using GYTB because it can't find anything and errors out.

25.  But first, unwrapping all those is a pain in the ass.  Fortunately, you can use chthulu to unwrap them all.  https://gbatemp.net/threads/release-cthulhu-app-for-managing-play-time-step-history-and-cached-icon-data.439485/  It's available in Universal Updater.

26. Since your badges get messed up, you have to rebuild them.  So, you can redo your badges by going into data management, deleting the badge arcade's extra data, and then restoring it in the badge arcade as guided by the app.  https://www.reddit.com/r/3DS/comments/3te5at/nintendo_badge_arcade_error/ is one example of a thread on this.

27.  So, that's pretty much it.  Again, my thanks to the entire community of folks who make these tools. I'm always in awe of the generosity of those who make their code opensource and release for people like me to use.  Thank you thank you thank you.

Tuesday, December 22, 2020

PinGun Parts list and prices

Current Total Costs and Estimates -

Since Starting Project in Late September or early October 2020
- $400 

Additional Cost, if I had to obtain them again at going prices of parts I have laying around - probably $500 more...  - But those are all things collected and paid for over the last 30 years.  Literally all kinds of spares and tear downs and mistake buys plus my normal console systems I was already playing.

Remaining estimate left to spend?  $100 for cabinet and tmolding and art, $50-80 for proper spinner, $20 for caps, $60-$120 for NES Everdrive.  Glass for cabinet, maybe $50?  So, probably about $300 left to spend.  (Slight chance I can't repair TV properly, and will need to actually buy one.  Probably $80 on marketplace.)

Stuff I plan to sell that's extras - Probably can make $200 on PSOne and Guns.  Probably can make $100 on the 2nd PS2 if I sell it hacked.  Probably can make $150 selling my NES Zapper cartridges.  Probably can make $80 selling my Dreamcast physical games.

Final Estimate Cost - $170

    $700 out of pocket - $530 recouped selling redundant games/systems = $170.
            (I will update this post as I go with actuals...)

Build Plans

Cabinet plans

  • Goal: I love the Granny and the Gators black on Green style.
  • Nothing yet.  Have priced out neon green/galaxian tmolding though, and asked around about cabs.  Have no wood or hardware for it yet.  Or paint or art.  But, have one friend who volunteered to route for the t-molding, and a cousin of my wife's who volunteered to help me fab it.  Might put a green LCD strip I have somewhere tastefully in it.  Maybe a cutout of the art so that it glows behind it?

Monitor plans

  • Goal: 
    • CRT up Top - Gun capable and most emulators, and also for backglass on Virtual pins.
    • LCD on bottom, mounted vertical, for Virtual Pin and certain emulators.
  • Got a free Samsung 39" LCD off of FB Marketplace.  Has some sort of issue where the screen goes bad and the whole thing freezes.  Wiggle the whole thing a bit, and boom, it's back to perfect.  Seems to have an HDMI auto power on function.  Hoping I can decase and find just a loose edge connector or something.
  • Random Sony Trinitrons and CRT's...  Right now, sitting on an obscene number of "so close" machines.  I really would love a 24" curved CRT with component, composite, and Svideo... But, alas, the Insignia I got like that has _wicked_ extra overscan, AND, most importantly, always turns on to the TV channel.  A Phillips 27" I got is _perfect_... except it won't power on when power connected if left on.  And, 27" is just too big really.  The Trinitrons, though flat, have the wonderful "power on when plugged in if left powered on" feature, but the 3 I got must have caps going bad and one has a bad yoke position or magnetized degauss coil or something.  So far, they all look like crap.  2 are 27", but, I have hope for the 24" I got, that I can cap kit it fairly inexpensively and get it up and beautiful again.  So far, I only spent $20 on the 24" CRT, and that's cause the old lady who had it was a trip!
  • Manual Phillips switch - $5 off fb Marketplace - This badboy is mechanical and has 4 ports, all with SVideo and Composite, plus 3 of the 4 also have Component and Ethernet.  And they're set up in such a way so that, as long as you double up the Audio inputs, that you could do basically 4 Svideo/Composites and 3 components, all hooked up at the same time.  
    • An additional thought I've had is to chain a second physical switch in the reverse way going out of this one so that I can route a more traditionally mounted TV that people can sit in front of that I mount separately.  Not sure of that plan yet.

Control Panel Plans

  •  Goals.
    • Primary
      • Tron stick
      • Spinner
      • Trackball
      • Ikari rotary with 8way
    • Maybe
      • Robotron capability?
      • 4 way capability?
      • Racing pedals (and time crisis style pedal)
      • Plunger
      • Nudge
  • Inches to work with - Basic pinball width is 23" basically.  So, probably 21"
  • Stock on hand from previous projects that I never finished - got nearly all of this 15-18 years ago off ebay when the kids were less than 3 and I had no idea how much time I'd spend being a dad vs. setting up machines.
    • 1 Saitek flightstick, USB.  Very "tron" like joystick with a bunch of buttons.  Hoping to be able to use this as a Tron stick as is with no driver issues.  Just plug in and go.  Will need to hack around on it in order to make it fit where i want to.  The base is HUGE.  Or, I'm going to make it mountable/removable.  Or, I'll just steal the top and put on my own joystick?  I dunno yet.
    • 1 3" HAPP Trackball, really nice condition with mounting plate.  1 2 1/4" HAPP Trackball that needs new rollers to be 100%.  I'm probably going to go with the 3" because then I can basically make it like a golden Tee, and it still should work ok for Centipede. However, Centipede is my main trackball game, so I might just stick with the 2 1/4 for those reasons as well as space?
    • Horrible Arkanoid spinners - I bought like 10 "bad" ones in an auction years ago, assuming I'd be able to make at least one good one out of the bunch.  Have not been able to make that happen.  IDK what I'm going to do.  I REALLY want a spinner that lets me play Tempest great and can do pretty good on everything else.  I thought an Arkanoid spinner would do the trick, but even the best one I could cobble together from the parts has so much play in  it so that the inertia always causes a few extra clicks the wrong way.  And the higher resolution screws it all up.  Still not sure what I'm going to do here as Tempest spinners don't have the resolution needed.  Just want it to feel and play Tempest right, is that so wrong?
    • 1 HAPP Optical Rotary joystick for Ikari.  Has a black top, round, like a regular competition.  Needs a new microswitch.  
    • 2 HAPP competition 8 ways and a bunch of microswitch buttons. Honestly, I hate the clicky click.  However, they are paired, they work great, and I'm not really using them.
    • 1 sanwa style 4 way with a pink ball top.  I have this wired into an old USB flightstick I wired in the hatswitch to it.  It has this HUGE base and was great back in the day for me playing Amidar and pacman properly.  
    • 1 extra leaf switch ball top.  Two I think?  I think they were OEM Robotron pulls.  Probably need new grommets.  They feel sooo nice.  8 way.
    • I have a mini-pac from Ultimarc as well as a cheap chinese Playstation style USB encoder.  (It's possible I can use the PS style USB encoder to also make the 8 way joystick and flight stick and buttons dual compatible with the PS2?  I'm already working on the guncon2 drivers.
  • Guns
    • ACT LABS PC USB Light gun - SVideo Version.  "bug" style.  Owned it for 15+ years and never have had a setup going for it.  Have finally tested it with my new build and an ancient TView Micro VGA to SVideo conversion box that works great.  I've owned that for 20+ years.
    • Mad Catz Guncon2/GC1/Justifier compatible guns - I've bought 3 off of eBay this year.  One for $14.69 and 2 for $25.90.  All listed as untested or partially tested, all work well.  One kind of has a bad bottom button.  HOPING I can get Wingun or Topgun or one of the other rogue drivers to work with these.  I already tested, and these work just fine while plugged into both the PS1 and PS2's simultaneously (one PS1 connector and one USB connector on each.)  And, I plan to get them wired simultaneously for the TV Micro Video also.  Possibly with a USB hub switch on a physical 2 way switch.  Part of my plan is to _hopefully_ be able to have portions of my CP which map to both PS2 and to the PC.
    • Also considering a flightstick hack for Operation Wolf and Crossbow style mounted guns that used 5V's  maybe? Someday?

PC Plans

  • PC Case with Powersupply, AM3+ motherboard, 16 gigs of ram - $50 off facebook marketplace.
  • EVGA GeForce GTX750 ti - $40 off facebook marketplace (overclocked at +225 and +500 memory and +12 mV)
  • AMD Phenom II 460 - 4 core (overclocked to 3.8GHz)  (Accidentally bought this for $36 a year ago and couldn't use it on my other motherboard.  This motherboard could take it though.)
  • TView Micro VGA to SVideo converter. (Have had forever)
  • Mostly plan to use Future Pinball and Visual Pinball.  Plus supplemented with console pinball games through emulators.  Will probably end up buying FX3 and possibly Pinball Arcade titles off Steam if they do sales on cool looking titles and if I can get the backglass to work on FX3.  might also try to use a spare Kinect again for BAM, or get a cheapo webcam.

Console plans

  • 1 Playstation 1 (PS1) with a PSIO pre installed - $154 off eBay.  (Will offset price by Selling off my PSOne with Screen and carrying case and miscellanous PS1 guns including Pointblank 1, 2, 3 and the Time Crisis games including 2 GunCons.)
  • 1 Playstation 2 (PS2) - $40 plus extras on fb marketplace (actually got a second for $50 too - Lot of games and memory cards with both.)
    • with FreeMCBoot on IDE Network Adapter and IDE harddrive (from friend, and from my old backup drives)
    • On Second one, had also set it up with a $5 fb marketplace router and another old USB backup drive I had laying around.  Not sure which one I will use, but will probably sell off the other or donate to a friend.
  • 2 Energizer Multi system cables with full component, composite, and SVideo for PS, PS2, Wii, and xBox360 -  $9.97 and $5.19 on eBay.
    • One for SVideo out on PS1, One for Component out on PS2. Assuming I should be able to use as piggy backs for the composite hookup for the guns.
  • 1 Wii - Hacked with standard tools.  Will need to add an external harddrive.  Have had these for years, got them all cheap (Under $50) at various times.
  • 1 NES with Zapper (Owned since college, will sell off all of my Gun Game cartridges, all US gun games, including Chiller and Baby Boomer to eventually offset cost of buying an Everdrive so I don't have to change cartridges.  I will come out ahead and make $ here, so I might get an authentic Everdrive.)
  • 1 Dreamcast with 1 GDEMU and 1 VGA Adapter that has an SVideo out too.  Have had dreamcast and adapter for years.  Guns seem to be acting up and need cap kits probably.  GDEMU was $35 off of Ali Express.  Did the 12V removal mod, and had the MicroSD card (I think I used a 64GB) laying around.

Thursday, December 17, 2020

The next big thing - My Virtual Pin/Gun Game

 



And so it begins (or well, it did back in late September/Early October 2020).  I'm still working on my Scramble, getting the monitor right, finishing off the multigame switch.  But, a huge case of Covid blues hit me this summer, and I lost a lot of ground.

Enter the next fighter for my attention...  A combo virtual pinball and light gun game, roughly configured like Granny and the Gators or Baby Pacman or even in a way the Pinball 2000 games.  I say this explicitly because I need a CRT for the guns.

While most Virtual Pins seem to be using backglasses today, I am space confined.  And, I have always had a CRT for gun games mounted up to my 6'2" frame at a height like a real arcade game because standing is really the only way to play gun games, IMHO.  Same with Pinball.  So, after looking at the local retro gamer's group where one guy converted an unrecoverable Baby Pacman cabinet to a dual virtual pacman virtual pinball setup, and another guy built himself a multi-console gun cabinet... I looked over at my PS1, my Dreamcast, my NES, and my sad sad SVideo model Act Labs USB PC Gun that I bought and never hooked up properly... and I thought... TODAY IS THE DAY.  Then I went nuts, and started measuring and sketching and scheming.  That was a few months ago, and I decided I needed to document it as I'm getting closer to scrounging up all the pieces, before I make the cabinet.

Maybe I'll call it FUZzy and the Flippers, or Captain Goatee and His Gunners.  IDK yet.  I ended up calling the mini pacman build (that I failed to document here) "FUZ's Fourway".

I want to also populate it with my oddball controls, with a Control Panel layout just like Baby Pacman.  I have a 3 inch HAPP trackball, an arkanoid spinner, a trigger finger USB flight stick, and a HAPP optical Rotary Joystick that are all sitting around and wishing they could be on a system.  Since I'm space constrained, I'm planning to shove them all on the CP of this thing.

Of note... one dimension is wrong up there.  The width of a standard lockbar in pinball is approx 22.25", not 13+13=26, as I have diagrammed.  I'm not quite sure what I'm going to do.  I am so used to that exact width, but I also want to cram in everything.  So, we shall see.  I'm considering making the CP modular, so that I can swap in what I want.  Especially since I'd also like to be able to sometime attach a console steering wheel and play racing games too.

Next thread will be my list of purchases and costs, and I'm a Cheap Daddy and one of my goals is to see just how cheap I can make this for, and still have it be exactly what I want/need/expected.  And then, I'll fill in the gaps of tracking down each component.

Sunday, December 6, 2020

Hints, Tips, and Tricks - My Project Eris installation notes and FAQ for the mini Playstation Classic

Recently I installed Project Eris on a mini Playstation Classic I'd bought from Best Buy for $25 when they cleared them out a long time ago.  I'm not a PS1 guy, save for the gun games, and so it basically just collected dust for years as I messed with hacks on other systems I won't mention because I don't want people coming here because of the search engines.  

Then, a few weeks ago, my buddy is like, "Man, I miss Chrono Trigger."  And I said... I can hook you up.

I was able to used guides and searches to get it done pretty well, but there were a few things I discovered that I'm not sure everyone else in the world might know.  So, I'm going to put them here now.

WHAT USB DRIVE WORKS?

I don't have Amazon sponsored links set up.  (Click through one of my ads here to support me maybe?)  But, basically, I used the Amazon version of the 128 GB drive sold by Microcenter for $9 (2 pack for $18.)  That drive WILL DIE in the front from not enough current, so you do need to use a separate, smaller drive to do the install.  I used a standard low end 32GB PNY drive to do that.  I buy those by the 5 pack (about $3.50 apiece in bulk) to put my SN-S Mini build on that has 14,000 games.

WHAT OTG CABLE WORKS?

I used one of the generic Chinese crap ones that looks like this...  You can find them for about $4.50 to $7 depending on what site.  I got one off eBay that took 5 weeks to get here.

NOTE: JUST LEAVE IT ON THE CHARGE SETTING AND IT WORKS FINE.  Seems to actually run faster on charge than on OTG.  Not sure it matters.


 

WHERE DO I FIND RETROARCH content when I want to "load content" (i.e. Roms and ISO's)?

Say you're not feeling like using Emulation Station, and you just want to run a rom.  You open up retroarch, and load a core, and then go to load your content... And there's a mess of options, and none seem to work.  Turns out the root of SONY where "roms" and "games" live is mapped to "/Media/".  Easy Peasy.

 

WHERE DO I FIND RETROARCH and EMULATION STATION on the USB drive if I'm wanting to tweak settings on my PC?

SONY\project_eris\opt\ has it all!


 

IMAGES IN EMULATIONSTATION

First of all, Skraper is a new tool that I discovered everyone talking about on the boards since the last time I had Skraped anything, and let me tell you.  It is awesome.  Well done, fast, and most importantly, it really found everything in my folders.  Well, ok, out of 9000 roms, it didn't find like 3 weird roms that aren't really games.  Skraper uses https://www.screenscraper.fr/.  (One hint... signing up for ScreenScraper was simple, and takes you from 10,000 items to 20,000 items per day.  Mortals really only need 10,000 items.  So, my advice is don't sign up until it runs out of requests.  Then, sign up, and get another 20,000 that day.)  Honestly, I was impressed.  There are some quirks to it that I did learn...

Before you do anything, "recalbox" is what you want to pretend to be on Skraper.  It uses emulation station, so everything it configures is what you want.

First, as noted in a number of videos, you want to generate a gamelist.xml!  It's important.  It's fine if these stay in the folder with the roms.  But, if you use "generic", it's not created.  On some of the other options, you _can_ make sure you've selected it.  And, honestly, it works great.

Second
, when you are downloading your media, you may think you are having fun and downloading all sorts of media, and it's great.  Don't.  Pick 1 image.  EmulationStation themes really only use one image.  So, why download a ton of extra stuff?  The "mix" images are great, and really show off the system.

Third, videos won't work.  End stop.  This is because the Project Eris folks haven't built any drivers in.  Same with the "kodi" system that some EmulationStation files have notes on.  It just uses ffmpeg.  But, as far as I can tell, it's not installed.  When I was trying to find reasons the ffmpeg core wouldn't work, I came across this great breakout of all of the dependencies.  To get video themes to work, that team might just be able to add the missing files to the build?  I'm not sure.  I'm unfortunately not very good at Linux.  https://github.com/libretro/libretro-meta/issues/113

Fourth, when you are downloading your 1 image, there is a quirk to the Skraper interface about naming the folders.  In general, what you are really needing is for the EmulationStation themes to point properly to the folder.  This is easier than it sounds.  But can be a huge frustration at first.  Turns out, the gamelist.xml you make will point to the folder.  HOWEVER!  Themes really only look for the image folder that the gamelist.xml defines.  And, if you download a ton of different images (see 2nd point above), each one goes into its own folder.  

What folder are they going to?  Well, at the bottom of the media screen, you want these settings.  You want the 1 image you picked, to save to media\images in your rom folder.  And you want your Gamelist Link to be "Link from node '<image>'.  That is the entire magic.  Your Gamelist.xml defines where <image> is, which in Skraper is your output folder, and your theme looks to the gamelist.xml for an <image>.  (Your theme might be crazy and look for other graphics too, and in that case, the node <whatthemeislookingfor> needs to be defined.) 

Skraper kind of knows this somehow, and what I found is that it has some sort of internal logic where it desperately tries to output your image type that you choose to a proper folder.  <marquee> comes up sometimes.  <video> too if you are desperately trying to get those.  But again, since ES Themes really only use one image, you don't need the rest for Project Eris.  And man, the 5 mix looks GREAT at 400 pixels wide in the Retrowave theme!

 

THEMES

I mentioned EmulationStation themes above.  As far as I can tell, themes for all versions of EmulationStation all work fine in Project Eris.  This includes R-tro P-e themes.  (Again, not putting that here so the search engines don't confuse things.)  You find them by googling "es-themes github" and downloading from the regular repositories.  Download the ENTIRE folder of the theme.  Which will be some xml files plus folders for every single romset/core you might use.  Preferably just download the zip of the whole thing as "code".  Don't worry about what's inside.  There's no uncompiling.  Then unzip and name the entire folder whatever you want the theme to be named in the menu option in Emulation Station.

If you've set up the gameslist.xml properly from scraper, nearly every theme has a basic view and a detailed view.  Some have grid views.  And every one I found uses <image>.  So, you should be all set.

 

WHAT IS THE BEST THEME?

Retrowave.  I think it's preinstalled.  It's themed the same on the PS Classic side and in Emulation Station.  If it's not on the EmulationStation side, here's a link to it.  https://www.reddit.com/r/RetroPie/comments/bq5g6s/retrowave_80s_synthwave_inspired_theme_for/

 https://imgur.com/gallery/IrDJTS8

 

WHERE DO I PUT EMULATIONSTATION THEMES?

\SONY\project_eris\opt\emulationstation\.emulationstation\themes

 

HOW DO I GET OUT OF REGULAR PLAYSTATION GAMES?

Select-Triangle gets you a cool little menu.  It has an exit option, as well as disc changing and all sorts of other settings for the PSX emulator.

 

HOW DO I GET OUT OF EMULATIONSTATION GAMES?

Select-Start gets you to Retroarch, then you hit back once, and go to Quit Retroarch.

But wait, some will say, why aren't you teaching people to assign a hotkey.  I did that, and man.  ARGH!  I started getting all kinds of weird quit behavior from random button presses.  IDK if it was just my system or what.  But, I took off the "Quit" hotkey in retroarch, and the problem went away.

 

MAME GAMES LET ME FIRE BUT DON'T LET ME MOVE.  EVERY OTHER CORE IN RETROARCH WORKS FINE?

Ok, so, IDK why it does this, but it turns out that the trick to fixing this is to switch the default controller type from digital to analog.  My hint as to why the default USB controller that ships with the Playstation Classic mini will show Axis +/- as how it is mapping the up down left right.  That is usually an analog stick indicator.  I tried all kinds of mapping, and it turns out that setting it in retroarch under the general control configs fixed it for both controllers in MAME.  

 

I INSTALLED Arc the Lad AND Final Fantasy AND ALL THE DISC IMAGES ARE STORED UNDER ONE TITLE AND ONLY THE FIRST ONE LAUNCHES.  WHAT DO I DO?

Ok, this took me forever to figure out.  Arc the Lad I, II, and III plus Arc Arena all install under a single "Arc the Lad Collection" disc.  Same thing with multipacs of Final Fantasy Origins, Final Fantasy Anthology, Final Fantasy Chronicles with Final Fantasy IV and ChronoTrigger, and Final Fantasy I and II Premium Package.  Then you "Select - Triangle", you can see that the "transfer" folder put the discs in the folder, but these games shipped as separate discs that each boot on their own.  They are "Disc 1, 2, 3, 4" sets.  They are Disc 1 and Disc 1, shipped in a multi disc package.

So, here is the workaround I found that was easiest to install them separately.  Basically, the "transfer" folder sees them as collections, and any combination of renaming file names is not going to work if you transfer them all at the same time.  Transfer will still find the hash, still know it's part of the collection, and group whatever you give it into the same folder.  Likewise, you can't put them in your own 1, 2, 3, 4 folder as created in the "games" folder, because it doesn't write to the official game list.  They just sit there orphaned.

So....  the trick?  Transfer 1 game at a time from the collection.

Put 1 game's disc images in the transfer folder.  Plug in your USB drive.  Start it up.  Let it process.  Shut it down.  Put the 2nd game's disc image in the transfer folder.  And, the next time, it creates _another_ new folder.  It will call it the same collection again.  But, the only disc in the 2 folders will be the single game.  And, the 2nd game now is set to boot properly.  Then, go into Game Manager, and you can rename them.  (I also assume you could go on your PC, and change the game art, but I felt just changing the name in the game interface was enough.)

 

Atari 2600 DOESN'T WORK!  Argh!

Turns out the wrong core was named in \SONY\project_eris\opt\emulationstation\.emulationstation\es_systems.cfg. 
  <system>
    <name>atari2600</name>
    <fullname>Atari 2600</fullname>
    <path>/media/roms/a2600</path>
    <extension>.bin .a26 .rom .zip .7z .gz</extension>
    <command>es_launch_ra stella2014_libretro.so %ROM%</command>
    <platform>atari2600</platform>
    <theme>atari2600</theme>
  </system>
Turns out, the core I had was 2014, not plain Stella.  So, I added the "2014" in the name.

 

Super Turbo Grafx DOESN'T WORK!  Argh!

I had put all of my TurboGrafx 16 and Super Turbo Grafx roms inside of the PCEngine folder.  The Super Turbo Grafx didn't work.  And when I tried the general core for 16 and Super, the framerates sucked.  But but, .pce is on all of them?  Doesn't matter.

Turns out, these was what I needed...  I put the 5 roms in a proper supergrafx folder and use the dedicated SuperGrafx core on them.  Now they work great.
  <system>
    <name>supergrafx</name>
    <fullname>Supergrafx</fullname>
    <path>/media/roms/supergrafx</path>
    <extension>.pce .zip .7z</extension>
    <command>es_launch_ra mednafen_supergrafx_libretro.so %ROM%</command>
    <platform>supergrafx</platform>
    <theme>supergrafx</theme>
  </system>
\SONY\project_eris\opt\emulationstation\.emulationstation\es_systems.cfg 

 

DON'T USE THE HIGHLIGHTED ONE!  DEDICATE Turbo Grafx to the "fast" PC Engine, and DEDICATE Super Grafx to the PC Engine SuperGrafx.

AGAIN, DON'T USE BEETLE PCE!

 

WHERE CAN YOU FIND EXTRA CORES FOR PROJECT ERIS? 

Same place as anywhere else... Libretro.  I think at least.  Might need to be a different Linux flavor.  But, give it a shot!  https://buildbot.libretro.com/nightly/linux/x86_64/latest/

 

And, finally my greatest trick!  HOW CAN I PUT PLAYSTATION BUTTONS AS THE ICONS IN EMULATIONSTATION?

 

I found a number of links to people saying it was somehow built into Project Eris at a compile level, and that you couldn't switch them around.  There were other people who thought it might be a setting.  I just did a hack.  I copied the triangle, square, circle, and cross icons into the names of a, b, x, y and north, south, east, and west location.

Basically, all of the start, select, a, b, x, y icons are stored here:

\SONY\project_eris\opt\emulationstation\.emulationstation\resources\help\

They are in .svg format, and don't look like anything because they are transparent.  But, they are hard coded in somewhere in ProjectEris or EmulationStation.  And, they are what is used in the interface.  (I had assumed they were stored in the themes, and spent forever reading all the .xml files for clues.  Then I realized that those icons don't change in any theme.)

So, anyway, what you do is, First, back up the whole set of help icons.  I put them in a folder called "OriginalHelpButtons".  

Next, delete or rename the a, b, x, y and north, south, east, and west buttons.  

Then, copy the triangle, circle, square, and cross icons and paste them twice.

Finally, rename them properly to a, b, x, y, and north, south, east, and west.

In the interface, the a, b, x, y buttons seem to be xbox mapped in EmulationStation.  But, in the "Map controller" interface, the north, south, east, west assignments seem to be Nintendo mapped to the a, b, x, y locations.  ARGH!

As an old guy, this makes my brain hurt.  :(


I am going off memory, but I believe this is what you want...
Button Name > Button Content
button_b.svg > button_circle.svg
button_east.svg > button_cross.svg
button_a.svg > button_cross.svg
button_south.svg > button_circle.svg
button_y.svg > button_triangle.svg
button_north.svg > button_square.svg
button_x.svg > button_square.svg
button_west.svg> button_triangle.svg

Tada!

 


Basically, if this remapping doesn't work, try swapping them. 

How to set up a self booting dedicated Moonlight (Sunshine client of Nvidia's GameStream) on a Raspberry Pi 3B+

8/11/2024:  This guide shows you how to set up a Raspberry Pi 3B+ (and older?) to stream your desktop PC from anywhere on your home network ...