Skip to content

macOS (Apple Silicon) support, part 1: platform layer, no change on Windows - #32

Merged
osnsyc merged 1 commit into
osnsyc:mainfrom
thelohdown:mac/platform-layer
Nov 19, 2026
Merged

osnsyc merged 1 commit into
osnsyc:mainfrom
thelohdown:mac/platform-layer

Conversation

@thelohdown

Copy link
Copy Markdown
Contributor

Hi! I’ve ported FMMatchLens’s capture to FM27 on Apple Silicon Macs, running on the community macOS BepInEx IL2CPP package from sortitoutsi. It captures a full match, checked against FM’s own full-time stats, including tactics and attributes. I’d like to send it upstream in small, easy-to-review pieces.

This first PR only adds the platform layer:

MacNative: macOS memory region queries and finding the loaded game_plugin image (used by the hook in the next PR).
VirtualMemory: the region lookup moved into TryQueryRegion, which uses MacNative on macOS and VirtualQuery otherwise. The Windows logic is unchanged, just moved.
PluginOptions: the macOS default graphics path; the Windows default is unchanged.

Planned next, if you’re happy with the approach:
2. macOS hook discovery (an arm64 byte pattern, plus a small compatibility layer for the MonoMod version in the macOS BepInEx package).
3. macOS offsets for FM 27.1, chosen at runtime by platform so every Windows value stays the same.
4. Optionally, macOS developer scripts and an offline test harness.

Happy to restructure if you’d prefer a different approach, for example separate offset files per platform. Thanks for FMMatchLens!

@thelohdown
thelohdown requested a review from osnsyc as a code owner November 19, 2026 03:18
Groundwork for running FMMatchLens on macOS (Apple Silicon) with the
community macOS BepInEx IL2CPP package:

- MacNative: macOS memory region queries (mach_vm_region) and finding
  the loaded game_plugin image, used by the hook in a follow-up PR.
- VirtualMemory: region lookup moved into TryQueryRegion, which uses
  MacNative on macOS and VirtualQuery otherwise. The Windows logic is
  unchanged, only moved into the helper.
- PluginOptions: default graphics path under ~/Library/Application
  Support on macOS; Windows default unchanged.

@osnsyc osnsyc left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! Looking forward to full macOS support.

@osnsyc
osnsyc merged commit 5deac7a into osnsyc:main Nov 19, 2026
1 check passed
@osnsyc

osnsyc commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Thanks for your contribution! I really appreciate your work on bringing FMMatchLens to macOS. I'll merge this PR.

FMMatchLens was originally developed with only Windows in mind, so quite a few parts of the code are platform-dependent. I'm also not sure how much work is needed to support macOS, and how different the memory offsets are.

But no worries, please feel free to continue with your plans. The approach in this PR looks good to me. It's fine to keep macOS specific code in separate files and use simple platform checks in the existing code where needed. I'd rather prioritize getting all features working on macOS than spend too much time on architectural changes at this stage. Once macOS support is fully working, I'll look into refactoring the code and properly abstracting the platform-specific parts.

Thanks again for taking this on!

@thelohdown

Copy link
Copy Markdown
Contributor Author

superb - yes will open up a couple more I think I have everything working at least from the testing I've done. been super cool to use this so really appreciate all of your work!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants