Skip to content

Instantly share code, notes, and snippets.

@phil294
Last active October 3, 2023 05:42
Show Gist options
  • Save phil294/193fe7fc5f9ce79c045cb66f6adb518f to your computer and use it in GitHub Desktop.
Save phil294/193fe7fc5f9ce79c045cb66f6adb518f to your computer and use it in GitHub Desktop.
Running Keity/Katsukity's n3DS_view.exe for 2DS Capture Card on Linux using QEMU VM and USB passthrough

Solution for running n3DS_view.exe, the driver software for 2DS (old 3DS) made by NON-STANDARD, on Linux devices.

Cute3DSCapture is great but it cannot handle Keity cards, it only works with Loopy cards. WineHQ does not seem feasible either because I don't think there is a way to install the USB driver. When contacted, Non-Standard said they do not plan on releasing a Linux-compatible build of the software. Running some kind of VM seems the only viable solution – thus this guide.

I tested the following on Manjaro Linux (Arch Linux based) with n3DSview_ver701_r6 (Keity_old3dsview from merki.net). _r5 etc. should also work, they simply refer to different revisions but may not include the DirectX setup which you then need to install manually on the Windows guest. Please note that you will need a Windows license, and Audio capture does not work. You can still record from the headphone output, of course. The Arch Linux Wiki has a lot of amazing info on QEMU.

  • Setting up QEMU, adjusted from https://wiki.gentoo.org/wiki/QEMU/Windows_guest

    1. sudo pacman -S qemu
    2. qemu-img create -f qcow2 WindowsVM.img 25G
    3. File WindowsVM.sh:
    #!/bin/sh
    set -e
    cd "$( dirname "${BASH_SOURCE[0]}" )"
    mkdir -p share
    sudo exec qemu-system-x86_64 -enable-kvm -cpu host -drive file=WindowsVM.img,if=virtio -m 1G -monitor stdio -name "Windows" \
        net nic -net user,hostname=windowsvm,smb="$PWD"/share \
        -device usb-ehci \
        -device usb-host,vendorid=0x04b4,productid=0x8613 \
        -device usb-host,vendorid=0x0752,productid=0xf2b1 \
        "$@"
    

    Several things to note:

    • net nic enables internet access on the machine and is required for when you need the next option
    • smb=... is one of the many ways of sharing files with the guest see arch wiki. We'll use it to copy the driver files to the VM
    • Alternatives to usb-ehci are e.g. qemu-xhci or nec-usb-xhci, but in my experience only the first one works and is free of lags
    • sudo (root access) seems necessary to be able to access the usb ports. Maybe this can be solved nother way, I did not investigate further
    • The vendor/product ids might differ on your machine. They describe the same device with two different drivers. Find the first driver pair of hex numbers by plugging in the NDS/CaptureCard and reading lsusb, in my case the numbers origin from Bus 001 Device 004: ID 04b4:6014 Cypress Semiconductor Corp.. We will edit the second pair later.
    1. Download virtio-win iso from here into the same directory
    2. Download Windows ISO from here into the same directory
    3. Boot Windows with ./WindowsVM.sh -boot d -drive file=WINDOWS-ISO-NAME.iso,media=cdrom -drive file=VIRTIO-DRIVER-NAME.iso,media=cdrom
    4. Go through the installation process. During installation at the partition step Windows doesn't detect the VirtIO hard drive. You have to tell Windows to use the viostor driver from the driver image.
  • For followup VM starts after installation, start the script just with ./WindowsVM.sh.

  • On the host, put the driver files into the share folder (it should exist by now). In Windows, open \\10.0.2.4\qemu via Explorer and copy the files to Desktop, for example

  • You probably want to turn off screen timeout after 10 minutes of inactivity in Windows settings

  • Install both driver and DirectX (maybe included in the zip)

  • Now, on the host, again with lsusb, you should see different output for the usb device. Put that hex number pair into WindowsVM.sh, too. In my case, it was 0752:f2b1 (see script above). If the numbers differ on your machine, you now need to reboot the VM.

  • Your device should be recognized in Windows

  • Your FPS vary greatly depending on the settings. For almost 60 FPS, i needed to set Windows screen size to 800x600 and in the viewer set

    • Limited to 30 FPS not selected
    • Transfer mode light (first option)
    • Back bufer size 800x960
    • Dot by dot x1
    • Calibration: Lower screen CLOCK to 11. 10 and 9 introduce glitchy pixels
    • (Console Type 2DS)
  • Audio is possible (see Wiki), but unfortunately the viewer does not seem to output anything on light transfer mode. The third transfer mode would include autio but it is greyed out

  • When the VM is turned off, you can compress the img file using qemu-img convert -c -0 qcow2 inputfile.img outputfile.img. This reduces the size from ~10GB to ~6GB.

  • To spare yourself the slow bootup times, you can create a snapshot: When the VM is running, type in the console savevm snapshotname. Afterwards, you should shut down the VM normally, not by closing the window. Once the VM is off and has turned black, you can close the window because otherwise it stays up indefinitely. Now start qemu with ./WindowsVM.sh -loadvm snapshotname. Know that snapshots disappear when you compress the img like in the previous step, resulting in the previous file size.

  • If you want, you can delete share/driver... files and both ISO files on the host, and make backups from the final .img file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment