Run the original macOS ARM64 game code on iOS: - tools/retarget.py: header-only Mach-O retargeting to an iOS dylib - platform/native: UIKit host and macOS API shims (AppKit for SDL's Cocoa backend, CoreGraphics displays, CoreAudio device, Metal device properties, Wuffs PNG decoding, Steam and peripheral stubs) - touch, overlay, iOS keyboard and hardware keyboard input - tools/build_native.py: build, sign, install, data copy, launch - docs: build guide, controls, architecture Also includes the earlier static-translation research (ARM64 -> WASM -> native) under docs/research, runtime/, tests/ and tools/. No game files are included; the build reads them from a local install.
44 lines
1.7 KiB
Objective-C
44 lines
1.7 KiB
Objective-C
// Shared declarations for the macOS-API shims used by the retargeted Factorio binary.
|
|
#pragma once
|
|
#include <CoreGraphics/CoreGraphics.h>
|
|
#include <stdint.h>
|
|
|
|
#define FX_DISPLAY_ID 1u
|
|
#define FX_EXPORT __attribute__((visibility("default")))
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
FX_EXPORT void fx_log(const char *format, ...) __attribute__((format(printf, 1, 2)));
|
|
FX_EXPORT CGSize fx_screen_points(void);
|
|
FX_EXPORT double fx_screen_scale(void);
|
|
FX_EXPORT double fx_render_divisor(void);
|
|
FX_EXPORT double fx_game_per_uikit(void);
|
|
#ifdef __OBJC__
|
|
FX_EXPORT void fx_main_sync(void (^block)(void));
|
|
#endif
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#ifdef __OBJC__
|
|
#import <Foundation/Foundation.h>
|
|
// Selectors sent to Factorio's own SDL classes (declared so ARC accepts the sends).
|
|
@protocol FXAppKitCallbacks
|
|
@optional
|
|
- (void)mouseDown:(id)e; - (void)mouseUp:(id)e; - (void)mouseDragged:(id)e; - (void)mouseMoved:(id)e;
|
|
- (void)rightMouseDown:(id)e; - (void)rightMouseUp:(id)e; - (void)rightMouseDragged:(id)e;
|
|
- (void)otherMouseDown:(id)e; - (void)otherMouseUp:(id)e; - (void)otherMouseDragged:(id)e;
|
|
- (void)scrollWheel:(id)e; - (void)keyDown:(id)e; - (void)keyUp:(id)e; - (void)flagsChanged:(id)e;
|
|
- (void)mouseEntered:(id)e; - (void)mouseExited:(id)e;
|
|
- (void)touchesBeganWithEvent:(id)e; - (void)touchesMovedWithEvent:(id)e;
|
|
- (void)touchesEndedWithEvent:(id)e; - (void)touchesCancelledWithEvent:(id)e;
|
|
- (void)windowDidBecomeKey:(NSNotification *)n; - (void)windowDidResignKey:(NSNotification *)n;
|
|
- (void)applicationDidFinishLaunching:(NSNotification *)n;
|
|
- (NSInteger)tag;
|
|
- (void)insertText:(id)text replacementRange:(NSRange)range;
|
|
@end
|
|
@interface NSObject (FXAppKitCallbacks) <FXAppKitCallbacks>
|
|
@end
|
|
#endif
|