Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows ARM64 support #91

Open
ihaveamac opened this issue Mar 25, 2022 · 3 comments
Open

Windows ARM64 support #91

ihaveamac opened this issue Mar 25, 2022 · 3 comments

Comments

@ihaveamac
Copy link
Owner

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
Copy link
Owner Author

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
Copy link
Owner Author

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

@ihaveamac
Copy link
Owner Author

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

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

No branches or pull requests

1 participant