ihaveamac / ninfs

FUSE filesystem Python scripts for Nintendo console files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows ARM64 support

ihaveamac opened this issue · comments

WinFSP should already support x86 and x86-64 programs on ARM64 but I haven't tested that. I should do that and also make a proper ARM64 release. That depends on cx-Freeze and probably NSIS supporting it too.

Python 3.11 has had an experimental ARM64 build since 3.11.0a5.

I managed to run this on Windows 11 for ARM64 natively after the following workarounds:

  1. Patch pycryptodome to not use _addcarry_u64 which seems to only be an x86 thing (basically: remove this ifdef and only use the one in "else"): https://github.com/Legrandin/pycryptodome/blob/5dace638b70ac35bb5d9b565f3e75f7869c9d851/src/multiply_64.c#L41-L60
  2. Force fusepy to use a specific path for the WinFSP dll, because it can't find it on its own: set "FUSE_LIBRARY_PATH=C: \Program Files (x86)\WinFsp\bin\winfsp-a64.dll"

After this I was able to mount an encrypted cia and verify that it decrypted something properly. (I just checked if the "NCCH" string at 0x100 of an ncch file was valid, I didn't do any further checks.)

pycryptodome finally supports ARM64: https://github.com/Legrandin/pycryptodome/releases/tag/v3.18.0

fusepy will need some changes to use winfsp-a64.dll when appropriate:

ninfs/ninfs/fuse.py

Lines 117 to 118 in 1aee094

if _libfuse_path:
_libfuse_path += r"bin\winfsp-%s.dll" % ("x64" if sys.maxsize > 0xffffffff else "x86")

platform.machine() returns ARM64 when running a native ARM build and AMD64 otherwise (even for the 32-bit x86 build on my 64-bit VM).