From 3de4056df4ea5d0afbcea388ad8d681daea1aac3 Mon Sep 17 00:00:00 2001 From: SulfurNitride Date: Wed, 8 Apr 2026 03:30:04 -0500 Subject: Remove NaK/Rust dependency, port remaining functionality to native C++ Replace NaK Rust crate and nak_ffi with native C++ implementations: - Game detection (Steam, Heroic, Bottles), VDF parser, icon extraction - Prefix symlinks, SLR manager, Steam path detection - Known games database Add FUSE VFS optimizations: zero-copy reads via fuse_reply_data, default_permissions mount option, FUSE_CAP_ASYNC_DIO, FUSE_CAP_EXPIRE_ONLY, lookup cache parent index, cached mode bits, increased I/O buffer sizes. Update build system, prefix setup, and various fixes. Co-Authored-By: Claude Opus 4.6 (1M context) --- libs/nak_ffi/include/nak_ffi.h | 230 ----------------------------------------- 1 file changed, 230 deletions(-) delete mode 100644 libs/nak_ffi/include/nak_ffi.h (limited to 'libs/nak_ffi/include') diff --git a/libs/nak_ffi/include/nak_ffi.h b/libs/nak_ffi/include/nak_ffi.h deleted file mode 100644 index 7a40863..0000000 --- a/libs/nak_ffi/include/nak_ffi.h +++ /dev/null @@ -1,230 +0,0 @@ -#ifndef NAK_FFI_H -#define NAK_FFI_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* ======================================================================== - * Tier 1: Game Detection - * ======================================================================== */ - -/** A detected game installation */ -typedef struct { - char *name; - char *app_id; - char *install_path; - char *prefix_path; /* NULL if no prefix */ - char *launcher; /* display name string */ - char *my_games_folder; /* NULL if not applicable */ - char *appdata_local_folder; /* NULL if not applicable */ - char *appdata_roaming_folder; /* NULL if not applicable */ - char *registry_path; /* NULL if not applicable */ - char *registry_value; /* NULL if not applicable */ -} NakGame; - -/** List of detected games */ -typedef struct { - NakGame *games; - size_t count; - size_t steam_count; - size_t heroic_count; - size_t bottles_count; -} NakGameList; - -/** Detect all installed games across all launchers */ -NakGameList nak_detect_all_games(void); - -/** Free a NakGameList returned by nak_detect_all_games */ -void nak_game_list_free(NakGameList list); - -/** A known game definition (static data, do NOT free) */ -typedef struct { - const char *name; - const char *steam_app_id; - const char *gog_app_id; /* NULL if none */ - const char *epic_app_id; /* NULL if none */ - const char *my_games_folder; /* NULL if not applicable */ - const char *appdata_local_folder; /* NULL if not applicable */ - const char *appdata_roaming_folder; /* NULL if not applicable */ - const char *registry_path; - const char *registry_value; - const char *steam_folder; -} NakKnownGame; - -/** Get the list of all known games (static data, do NOT free). - * Returns pointer to array; writes count to *out_count. */ -const NakKnownGame *nak_get_known_games(size_t *out_count); - -/* ======================================================================== - * Tier 2: Proton Detection - * ======================================================================== */ - -/** An installed Proton version */ -typedef struct { - char *name; - char *config_name; - char *path; - int is_steam_proton; - int is_experimental; -} NakSteamProton; - -/** List of detected Proton installations */ -typedef struct { - NakSteamProton *protons; - size_t count; -} NakProtonList; - -/** Find all installed Proton versions */ -NakProtonList nak_find_steam_protons(void); - -/** Free a NakProtonList */ -void nak_proton_list_free(NakProtonList list); - -/* ======================================================================== - * Tier 3: Steam Paths - * ======================================================================== */ - -/** Find the Steam installation path. - * Returns newly allocated string (free with nak_string_free), or NULL. */ -char *nak_find_steam_path(void); - -/* ======================================================================== - * Tier 4: Dependency Installation (callback-based) - * ======================================================================== */ - -/** Callback for status/log messages */ -typedef void (*NakStatusCallback)(const char *message); -typedef void (*NakLogCallback)(const char *message); - -/** Callback for progress updates (0.0 to 1.0) */ -typedef void (*NakProgressCallback)(float progress); - -/** Install all Wine prefix dependencies (blocking call). - * cancel_flag: pointer to int, set non-zero to cancel. - * Returns NULL on success, or error message (free with nak_string_free). */ -char *nak_install_all_dependencies( - const char *prefix_path, - const char *proton_name, - const char *proton_path, - NakStatusCallback status_cb, - NakLogCallback log_cb, - NakProgressCallback progress_cb, - const int *cancel_flag, - uint32_t app_id -); - -/** Apply Wine registry settings to a prefix. - * Returns NULL on success, or error message (free with nak_string_free). */ -char *nak_apply_wine_registry_settings( - const char *prefix_path, - const char *proton_name, - const char *proton_path, - NakLogCallback log_cb, - uint32_t app_id -); - -/** Apply a game's registry entry with a custom install path. - * Looks up game_name in KNOWN_GAMES and writes registry pointing to install_path. - * Returns NULL on success, or an error message (free with nak_string_free). */ -char *nak_apply_registry_for_game_path( - const char *prefix_path, - const char *proton_name, - const char *proton_path, - const char *game_name, - const char *install_path, - NakLogCallback log_cb -); - -/* ======================================================================== - * Tier 5: Prefix Symlinks - * ======================================================================== */ - -/** Ensure AppData/Local/Temp exists in the Wine prefix. - * Call during prefix creation. */ -void nak_ensure_temp_directory(const char *prefix_path); - -/** Detect games and create symlinks from the prefix to game prefixes. - * Call during prefix creation. */ -void nak_create_game_symlinks_auto(const char *prefix_path); - -/* ======================================================================== - * Tier 6: Logging - * ======================================================================== */ - -/** Callback for NaK log messages: (level, message). - * Levels: "info", "warning", "error", "install", "action", "download" */ -typedef void (*NakLogLevelCallback)(const char *level, const char *message); - -/** Initialize NaK logging with a callback. - * Call once at startup before any other nak_* functions. */ -void nak_init_logging(NakLogLevelCallback cb); - -/* ======================================================================== - * Tier 7: DXVK Configuration - * ======================================================================== */ - -/** Ensure the DXVK config file exists, downloading if necessary. - * Returns NULL on success, or error message (free with nak_string_free). */ -char *nak_ensure_dxvk_conf(void); - -/** Get the path to the DXVK config file. - * Returns newly allocated string (free with nak_string_free). */ -char *nak_get_dxvk_conf_path(void); - -/* ======================================================================== - * Tier 8: Steam Linux Runtime (SLR) - * ======================================================================== */ - -/** Returns 1 if SteamLinuxRuntime_sniper is installed and the run script exists, 0 otherwise. */ -int nak_slr_is_installed(void); - -/** Get the path to the SLR run script. - * Returns NULL if SLR is not installed. - * Caller must free with nak_string_free(). */ -char *nak_slr_get_run_script(void); - -/** Download and install SteamLinuxRuntime_sniper from Valve's repo (~180 MB). - * Skips if already at the latest version (checked via BUILD_ID). - * progress_cb: 0.0..1.0 during download (may be NULL). - * status_cb: human-readable status strings (may be NULL). - * cancel_flag: pointer to int, set non-zero to cancel (may be NULL). - * Returns NULL on success, or error message (free with nak_string_free). */ -char *nak_download_slr( - NakProgressCallback progress_cb, - NakStatusCallback status_cb, - const int *cancel_flag -); - -/* ======================================================================== - * Tier 9: PE Icon Extraction - * ======================================================================== */ - -/** Result of icon extraction */ -typedef struct { - uint8_t *data; /**< Raw ICO file bytes (NULL if extraction failed) */ - size_t len; /**< Length in bytes (0 if extraction failed) */ -} NakIconData; - -/** Extract the best icon from a Windows PE executable (.exe/.dll). - * Returns raw ICO bytes. Free with nak_icon_data_free(). */ -NakIconData nak_extract_exe_icon(const char *exe_path); - -/** Free icon data returned by nak_extract_exe_icon */ -void nak_icon_data_free(NakIconData icon); - -/* ======================================================================== - * General - * ======================================================================== */ - -/** Free a string returned by any nak_* function */ -void nak_string_free(char *s); - -#ifdef __cplusplus -} -#endif - -#endif /* NAK_FFI_H */ -- cgit v1.3.1