mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-11 01:41:02 +00:00
Shared runtime code now goes through runtime/platform/platform.h, implemented by platform/win32.c and a new platform/linux.c: futex locks, a userfaultfd and PAGEMAP_SCAN write watch, signal-based async preemption, our own fiber switch, and a SIGSEGV handler for the thaw and crash hooks. The window, input, menu and software keyboard get SDL3 back ends beside the Win32 ones, with the swapchain (gfx_present.c) and input merging (input.c) shared. SHA-256 replaces BCrypt, ELF builds get their own override sections, and the build tools gain Linux branches. On Linux the selftest and the gfx-abi, astc, nvn and window probes pass. probe-vkmem still fails: imported guest memory cannot be write-watched on Linux, which the shadow buffers in vk_memory.c will address.
17 lines
548 B
C
17 lines
548 B
C
// SHA-256 (FIPS 180-4), streaming. Uses the x86 SHA extensions when the CPU has them, portable C otherwise.
|
|
#pragma once
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
typedef struct {
|
|
uint32_t h[8];
|
|
uint64_t bytes; // message bytes so far
|
|
uint8_t buf[64]; // a partial block
|
|
uint32_t used;
|
|
} Sha256;
|
|
|
|
void sha256_init(Sha256 *s);
|
|
void sha256_update(Sha256 *s, const void *data, size_t n);
|
|
void sha256_final(Sha256 *s, uint8_t out[32]);
|
|
void sha256(const void *data, size_t n, uint8_t out[32]); // the three above in one call
|