Files
factorio-ios/runtime/guest_heap.h
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

20 lines
794 B
C

#ifndef FACTORIO_GUEST_HEAP_H
#define FACTORIO_GUEST_HEAP_H
#include <stddef.h>
#include <stdint.h>
/* A bounded, per-run arena of guest offsets. No native pointers enter guest RAM.
* Allocations are 16-byte aligned and uninitialized; reset discards the arena.
* This does not implement C++ destruction, free, or exception unwinding. */
typedef struct {
uint8_t *memory;
uint64_t memory_size, begin, cursor, end;
unsigned allocations;
} FactorioGuestHeap;
int factorio_guest_heap_init(FactorioGuestHeap *heap, uint8_t *memory,
uint64_t memory_size, uint64_t begin, uint64_t end);
/* 0 success, 1 exhausted, 2 invalid. Output and heap unchanged on failure. */
int factorio_guest_heap_allocate(FactorioGuestHeap *heap, uint64_t size, uint64_t *out);
#endif