Skip to content
Open
46 changes: 16 additions & 30 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,28 @@ name: Build Check
on:
pull_request:
permissions:
contents: write
contents: read
jobs:
build:
strategy:
matrix:
platform: [
{name: "Linux Debug", os: "ubuntu-22.04", ext: "tar.gz", config: "Debug"},
{name: "Linux Release", os: "ubuntu-24.04", ext: "tar.gz", config: "Release"},
{name: "Windows Debug", os: "windows-2022", ext: "zip", config: "Debug"},
{name: "Windows Release", os: "windows-2022", ext: "zip", config: "Release"},
{name: "macOS Debug", os: "macos-15", ext: "tar.gz", config: "Debug"},
{name: "macOS Release", os: "macos-15", ext: "tar.gz", config: "Release"}
{name: "Linux Debug", os: "ubuntu-22.04", config: "Debug"},
{name: "Linux Release", os: "ubuntu-24.04", config: "Release"},
{name: "Windows Debug", os: "windows-2022", config: "Debug"},
{name: "Windows Release", os: "windows-2022", config: "Release"},
{name: "macOS Debug", os: "macos-15", config: "Debug"},
{name: "macOS Release", os: "macos-15", config: "Release"}
]
runs-on: ${{ matrix.platform.os }}
name: ${{ matrix.platform.name }}
steps:
- uses: actions/checkout@v4
- name: Install macOS deps
if: runner.os == 'macOS'
run: brew install llvm
- name: Configure
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.platform.config }}
- name: Build
working-directory: ./build
run: cmake --build . --config ${{ matrix.platform.config }}
- name: Package
shell: bash
run: |
mkdir -p build/install
cmake --install build --config ${{ matrix.platform.config }} --prefix build/install
cd build/install
if [ "${{ matrix.platform.ext }}" = "zip" ]; then
7z a ../../fsminit-${{ matrix.platform.config }}-${{ matrix.platform.os }}.${{ matrix.platform.ext }} *
else
tar -czf ../../fsminit-${{ matrix.platform.config }}-${{ matrix.platform.os }}.${{ matrix.platform.ext }} .
fi
- uses: softprops/action-gh-release@v2
with:
files: fsminit-${{ matrix.platform.config }}-${{ matrix.platform.os }}.*
- uses: actions/checkout@v4
- name: Install macOS deps
if: runner.os == 'macOS'
run: brew install llvm
- name: Configure
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.platform.config }}
- name: Build
working-directory: ./build
run: cmake --build . --config ${{ matrix.platform.config }}
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# More reliable source listing (avoids globbing issues)
set(SRCS src/main.c src/file_subsystem.c)
set(SRCS src/main.c src/file_subsystem.c src/boilerplate_subsystem.c )

add_executable(FSMINIT ${SRCS})
target_include_directories(FSMINIT PRIVATE include)
Expand Down
26 changes: 26 additions & 0 deletions include/boilerplate_subsystem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#pragma once

#include "def_type.h"

/* Boilerplate string literals. Use macros so they remain constant expressions. */
#define BPL_WEP_PRIMARY \
"#Primary Weapons\n" \
"$Name: placeholder\n" \
"#End\n"

/* Helper array */
static const char *bpl_wep_primary_variants[] = {
BPL_WEP_PRIMARY};

/* Boilerplate table — keys must match base_name for .tbl and modular_suffix for .tbm */
static const BPL_ENTRY bpl_table[] = {
{"weapons", bpl_wep_primary_variants, 1}, // for weapons.tbl
{"-wep", bpl_wep_primary_variants, 1} // for XXX‑wep.tbm
};

static const size_t bpl_table_count = sizeof(bpl_table) / sizeof(bpl_table[0]);
/* Public functions */
bool verify_mod_structure(const char *base_path);
TABLE_FILE_LIST *verify_tables_directory(const char *base_path_tables);
const BPL_ENTRY *find_boilerplate(const char *filename);
void write_to_tables(const BPL_ENTRY *entry, const char *filepath, OP *operation);
26 changes: 23 additions & 3 deletions include/def_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#include <stddef.h>
#include <stdbool.h>

#ifndef PATH_MAX
#define PATH_MAX 4096
#endif

/* =======================
CLI Option Structure
======================= */
Expand All @@ -19,6 +23,9 @@ typedef struct OP
int dirs_created;
int tables_created;
int errors;

/* For Boilerplates */
int gen_boilerplate;
} OP;

/* =======================
Expand Down Expand Up @@ -107,9 +114,22 @@ typedef struct FS_TABLES
const char *name;
} FS_TABLES;

/* =======================
External Declarations
======================= */
typedef struct BPL_ENTRY
{
const char *key; /* "-wep" or "weapons", etc... */
const char **variants; /* array of boilerplate strings */
size_t variant_count;
} BPL_ENTRY;

typedef struct TABLE_FILE_LIST
{
char **paths;
size_t count;
} TABLE_FILE_LIST;

/* =======================
External Declarations
======================= */
extern const char *voice_subdirs[];
extern const size_t voice_subdirs_count;

Expand Down
3 changes: 2 additions & 1 deletion include/file_subsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ void create_directories(OP *operation);
void create_tbl_tables(OP *operation);
void create_tbm_tables(OP *operation);
void create_static_tables(OP *operation);
bool check_if_mod_structure_exists(const char *base_path);
bool check_if_mod_structure_exists(const char *base_path);
bool path_is_dir(const char *path);
Loading
Loading