ihaveamac / ninfs

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

Windows ARM64 support #91

Open ihaveamac opened 2 years ago

ihaveamac commented 2 years ago

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.

ihaveamac commented 2 years ago

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.)

ihaveamac commented 1 year ago

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: https://github.com/ihaveamac/ninfs/blob/1aee094a3e7c6e464c0533cd5b749081c1a30c0a/ninfs/fuse.py#L117-L118

ihaveamac commented 1 year ago

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).