ihaveamac / ninfs

FUSE filesystem Python scripts for Nintendo console files
MIT License
436 stars 18 forks source link

REQ: Add support for fuse-t on macOS #103

Closed mbirth closed 1 year ago

mbirth commented 1 year ago

There's a FUSE replacement for macOS that doesn't need a kext anymore: macos-fuse-t/fuse-t. It's supposed to be a drop-in replacement for osxfuse/macfuse, but just adding find_library('fuse-t') to the list in fuse.py now produces this error when trying to mount my Switch's eMMC:

$ sudo mount_nandhac -d --keys keys/prod_mbirth.keys /dev/disk8 ./fuse
ninfs v1.6.1 - https://github.com/ihaveamac/ninfs
- Note: This should *not* be run as root.
- The mount will not be normally accessible by other users.
- This should be run from a non-root terminal.
- If you want root to be able to access the mount,
-   you can add `-o allow_root` to the arguments.
FUSE library version: 2.9.9
nullpath_ok: 0
nopath: 0
utime_omit_ok: 0
unique: 2, opcode: INIT (26), nodeid: 0, insize: 56, pid: 0
INIT: 7.18
flags=0xfe00007b
max_readahead=0x00000000
   INIT: 7.19
   flags=0x00000011
   max_readahead=0x00000000
   max_write=0x02000000
   max_background=0
   congestion_threshold=0
   unique: 2, success, outsize: 40
unique: 3, opcode: STATFS (17), nodeid: 1, insize: 40, pid: 0
statfs /
   unique: 3, success, outsize: 96
unique: 4, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 0
getattr /
   unique: 4, success, outsize: 136
unique: 5, opcode: LOOKUP (1), nodeid: 1, insize: 47, pid: 0
LOOKUP /disk8)
getattr /disk8)
   unique: 5, error: -2 (No such file or directory), outsize: 16
short read on fuse device

So this might need a few more tweaks, I guess.

ihaveamac commented 1 year ago

The core of this issue may be due to how fuse-t handles parsing options and it not liking a slash. Notice at the end that it's trying to open "/disk8" in the filesystem. This path would have been displayed in the volume name in the form of "Nintendo Switch NAND (dev/disk8)".

I tested this with the 3dsx mount and found that a volname of "3DSX Homebrew (Downloads/FBI.3dsx)" crashes, but "3DSX Homebrew" alone doesn't. Or any other name without a slash.

So what I'll probably do instead is only display the filename and not its containing folder.

ihaveamac commented 1 year ago

By the way you can also set FUSE_LIBRARY_PATH=/usr/local/lib/libfuse-t.dylib to force fusepy to load fuse-t without any source code edits.

ihaveamac commented 1 year ago

0b33c846f6bc8534ec2759fb58ec40ca677fb3df will try to load fuse-t if it can't find macFUSE.