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.
25 lines
857 B
C
25 lines
857 B
C
#include "save_header.h"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
int main(int argc, char **argv) {
|
|
if (argc != 3) return 2;
|
|
char *end = NULL;
|
|
unsigned long requested = strtoul(argv[2], &end, 10);
|
|
if (!end || *end || requested > 1024 * 1024 + 1) return 2;
|
|
uint8_t *guarded = malloc(requested + 16);
|
|
if (!guarded) return 2;
|
|
memset(guarded, 0xa5, requested + 16);
|
|
int status = factorio_save_prefix(argv[1], guarded + 8, requested);
|
|
for (unsigned i=0;i<8;++i) {
|
|
if (guarded[i] != 0xa5 || guarded[requested+8+i] != 0xa5) return 3;
|
|
}
|
|
if (status) for (unsigned long i=0;i<requested;++i) if (guarded[i+8]!=0xa5) return 4;
|
|
printf("{\"status\":%d,\"prefix_hex\":\"", status);
|
|
if (!status) for (unsigned long i=0;i<requested;++i) printf("%02x",guarded[i+8]);
|
|
puts("\"}");
|
|
free(guarded);
|
|
return status ? 1 : 0;
|
|
}
|