Files
factorio-ios/tests/save_layout_probe.c
T
SashaGoncharov19 51d085e865 Native iPhone port of Factorio 2.0.77
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.
2026-10-23 15:27:58 +04:00

30 lines
1.2 KiB
C

#include "save_layout.h"
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc,char **argv) {
if(argc!=3) return 2;
FactorioSaveLayout result;
memset(&result,0xa5,sizeof(result));
FactorioSaveLayout before=result;
int status;
size_t needed=0;
if(!strcmp(argv[1],"zip")) status=factorio_save_map_header(argv[2],&result);
else if(!strcmp(argv[1],"bytes")) {
FILE *file=fopen(argv[2],"rb"); if(!file) return 2;
uint8_t *bytes=malloc(1024*1024); if(!bytes) return 2;
size_t count=fread(bytes,1,1024*1024,file); fclose(file);
status=factorio_save_layout_bytes(bytes,count,&result,&needed); free(bytes);
} else return 2;
if(status && memcmp(&before,&result,sizeof(result))) return 3;
printf("{\"status\":%d,\"needed\":%zu",status,needed);
if(!status) printf(",\"header_offset\":%zu,\"next_offset\":%zu,\"mod_count\":%u,"
"\"tick_fields_hex\":[\"%016" PRIx64 "\",\"%016" PRIx64 "\",\"%016" PRIx64 "\"]",
result.header_offset,result.next_offset,result.mod_count,
result.header.tick_fields[0],result.header.tick_fields[1],result.header.tick_fields[2]);
puts("}");
return status ? 1 : 0;
}