Files
Joshua Brest (杰成)andMattKC 78b923719c Add iOS support with build scripts, toolchain, and assets (#302)
* feat: add iOS support

* ios: clean up icon

* ci: add ios build

* fix(gui): revert asset lookups to use "%s/assets/%s/%s" for macOS

* refactor(gui): remove extra `iconv` linkage for iOS

* chore(gitignore): remove unused `xcuserdata` and `DerivedData` entries

* fix(gui): use provided `LibXML2` in non-vendored builds

* fix(ci): add Xcode setup step for iOS build

* fix(pipe): prevent relay threads from using freed stack memory

* fix(input): replace bitfields with explicit wire packing for touch and gyro data

* fix merge issues

* fix cmake merge bug

* cmake: attempt iOS SDL fix

* older ios

* feat: add iOS support

* ios: clean up icon

* ci: add ios build

* refactor(gui): remove extra `iconv` linkage for iOS

* chore(gitignore): remove unused `xcuserdata` and `DerivedData` entries

* fix(ci): add Xcode setup step for iOS build

* cmake: attempt iOS SDL fix

* older ios

* cleanup

* build signed macOS app alongside iOS app

* cmake: detect ios version and include liquid glass icon if available

* ci: upload continuous release

* cmake: move more ios code to toolchain

* remove ios simulator target

* improvements

* remove CMakePresets.json

* Update ios-toolchain.cmake

* move ios folder to gui folder

* converge Info.plist templates

* update comments and readme

* cmake: remove redundant code

* remove redundant ios folder

* cmake: add comments to cache strings

* cmake/ci: maybe fix new apple builds

* cmake: fix new ios build

* cmake: fix macOS build?

---------

Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com>
2026-09-09 02:25:50 -07:00

57 lines
1.5 KiB
C

#include "platform.h"
#include <SDL_filesystem.h>
#include <SDL_log.h>
#include <stdio.h>
#include "ui/ui_util.h"
static char pref_path[4096] = {0};
void vpi_config_filename(char *out, size_t out_size)
{
vpi_get_data_filename(out, out_size, "config.xml", NULL);
}
void vpi_get_data_filename(char *out, size_t out_size, const char *filename, const char *preferred_dir)
{
if (preferred_dir && preferred_dir[0]) {
snprintf(out, out_size, "%s/%s", preferred_dir, filename);
} else {
if (!pref_path[0]) {
char *s = SDL_GetPrefPath("", "Vanilla");
vui_strncpy(pref_path, s, sizeof(pref_path));
SDL_free(s);
}
snprintf(out, out_size, "%s%s", pref_path, filename);
}
}
void vpilog_va(const char *fmt, va_list va)
{
SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, va);
}
void vpilog(const char *fmt, ...)
{
va_list va;
va_start(va, fmt);
vpilog_va(fmt, va);
va_end(va);
}
void vpi_asset_filename(char *buf, size_t size, const char *type, const char *filename)
{
#if defined(ANDROID)
snprintf(buf, size, "%s/%s", type, filename);
#elif defined(_WIN32) || defined(__APPLE__)
char *base_path = SDL_GetBasePath();
snprintf(buf, size, "%s/assets/%s/%s", base_path, type, filename);
SDL_free(base_path);
#else
char *base_path = SDL_GetBasePath();
snprintf(buf, size, "%s/../share/vanilla/assets/%s/%s", base_path, type, filename);
SDL_free(base_path);
#endif
}