From ad5248a3e1bafc1b7dec4c8af82d56ed324ef314 Mon Sep 17 00:00:00 2001 From: Vasco Date: Mon, 24 Aug 2026 03:53:16 +0100 Subject: Slimed out podium. Updated math. Rend kinda works but still bugged. --- Peak/src/peak.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) (limited to 'Peak/src/peak.c') diff --git a/Peak/src/peak.c b/Peak/src/peak.c index 6c4c038..e6e7655 100644 --- a/Peak/src/peak.c +++ b/Peak/src/peak.c @@ -1,3 +1,6 @@ +#include +#include + static uint32_t * peak_window_sync(PeakWindow *win, size_t *width, size_t *height) { @@ -20,6 +23,7 @@ peak_init(void) void peak_quit(void) { + peak_audio_stop(); peak_platform_quit(); } @@ -116,3 +120,79 @@ peak_window_run(PeakWindow *win, int (*peak_tick)(PeakWindow *win, void *userdat while (win->running && win->tick(win, win->userdata)); #endif } + +int +peak_audio_start(uint32_t channels, uint32_t rate, void (*fill)(int16_t *out, size_t frames, void *userdata), void *userdata) +{ + if (!fill || !channels || !rate) + return 0; + peak_audio_stop(); + return peak_platform_audio_start(channels, rate, fill, userdata); +} + +void +peak_audio_stop(void) +{ + peak_platform_audio_stop(); +} + +uint64_t +peak_get_time(void) +{ + return peak_platform_get_time(); +} + +void +peak_sleep_ns(int64_t ns) +{ + peak_platform_sleep_ns(ns); +} + +int +peak_file_exists(const char *path) +{ + FILE *f; + if (!path) return 0; + f = fopen(path, "rb"); + if (!f) return 0; + fclose(f); + return 1; +} + +void * +peak_file_alloc(const char *path, unsigned long *buf_size) +{ + FILE *f; + long n; + void *p; + if (!path) return NULL; + f = fopen(path, "rb"); + if (!f) return NULL; + if (fseek(f, 0, SEEK_END) != 0) { fclose(f); return NULL; } + n = ftell(f); + if (n < 0) { fclose(f); return NULL; } + rewind(f); + p = malloc((size_t)n + (n == 0)); + if (!p) { fclose(f); return NULL; } + if (n && fread(p, 1, (size_t)n, f) != (size_t)n) { + free(p); + fclose(f); + return NULL; + } + fclose(f); + if (buf_size) *buf_size = (unsigned long)n; + return p; +} + +const char ** +peak_vulkan_get_extensions(uint32_t *count) +{ + return peak_platform_vulkan_get_extensions(count); +} + +int +peak_vulkan_create_surface(PeakWindow *win, void *instance, const void *allocator, void *out_surface) +{ + if (!win || !instance || !out_surface) return 0; + return peak_platform_vulkan_create_surface(&win->internal, instance, allocator, out_surface); +} -- cgit v1.3.1