diff --git a/tools/skap/include/skap_defines.h b/tools/skap/include/skap_defines.h
new file mode 100644
index 0000000..ec72edc
--- /dev/null
+++ b/tools/skap/include/skap_defines.h
@@ -0,0 +1,27 @@
+/*
+ * GNU Sparky --- A 5v5 character-based libre tactical shooter
+ * Copyright (C) 2024 Wasym A. Alonso
+ *
+ * This file is part of Sparky.
+ *
+ * Sparky is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Sparky is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Sparky. If not, see .
+ */
+
+
+#pragma once
+
+#include
+
+typedef uint8_t u8;
+typedef uint64_t u64;
diff --git a/tools/skap/include/skap_header.h b/tools/skap/include/skap_header.h
new file mode 100644
index 0000000..9bcf113
--- /dev/null
+++ b/tools/skap/include/skap_header.h
@@ -0,0 +1,32 @@
+/*
+ * GNU Sparky --- A 5v5 character-based libre tactical shooter
+ * Copyright (C) 2024 Wasym A. Alonso
+ *
+ * This file is part of Sparky.
+ *
+ * Sparky is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Sparky is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Sparky. If not, see .
+ */
+
+
+#pragma once
+
+#include
+
+typedef struct {
+ char signature[4];
+ u8 fmt_ver;
+ u64 build_ver;
+} skap_header;
+
+skap_header skap_header_create(void);
diff --git a/tools/skap/src/skap.c b/tools/skap/src/skap.c
index f775530..ad958c0 100644
--- a/tools/skap/src/skap.c
+++ b/tools/skap/src/skap.c
@@ -19,48 +19,11 @@
*/
-#include
#include
-#include
-
-typedef uint8_t u8;
-typedef uint64_t u64;
-
-typedef struct {
- char signature[4];
- u8 fmt_ver;
- u64 build_ver;
-} skap_header;
-
-static u64 concat_num(u64 x, u64 y) {
- u64 n = 10;
- while (y >= n) n *= 10;
- return n * x + y;
-}
-
-static u64 compute_build_ver(void) {
- time_t t = time(0);
- struct tm *t_spec = localtime(&t);
- u64 t_spec_arr[] = {
- t_spec->tm_mon + 1,
- t_spec->tm_mday,
- t_spec->tm_hour,
- t_spec->tm_min
- };
- u64 build_ver = t_spec->tm_year + 1900;
- for (size_t i = 0; i < 4; ++i) {
- if (t_spec_arr[i] < 10) build_ver *= 10;
- build_ver = concat_num(build_ver, t_spec_arr[i]);
- }
- return build_ver;
-}
+#include
int main(void) {
- skap_header header = {
- .signature = { 'S', 'K', 'A', 'P' },
- .fmt_ver = 1,
- .build_ver = compute_build_ver()
- };
+ skap_header header = skap_header_create();
printf("header.signature => %s\n", header.signature);
printf("header.fmt_ver => %hhu\n", header.fmt_ver);
printf("header.build_ver => %ld\n", header.build_ver);
diff --git a/tools/skap/src/skap_header.c b/tools/skap/src/skap_header.c
new file mode 100644
index 0000000..d91a011
--- /dev/null
+++ b/tools/skap/src/skap_header.c
@@ -0,0 +1,54 @@
+/*
+ * GNU Sparky --- A 5v5 character-based libre tactical shooter
+ * Copyright (C) 2024 Wasym A. Alonso
+ *
+ * This file is part of Sparky.
+ *
+ * Sparky is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Sparky is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Sparky. If not, see .
+ */
+
+
+#include
+#include
+
+static u64 concat_num(u64 x, u64 y) {
+ u64 n = 10;
+ while (y >= n) n *= 10;
+ return n * x + y;
+}
+
+static u64 compute_build_ver(void) {
+ time_t t = time(0);
+ struct tm *t_spec = localtime(&t);
+ u64 t_spec_arr[] = {
+ t_spec->tm_mon + 1,
+ t_spec->tm_mday,
+ t_spec->tm_hour,
+ t_spec->tm_min
+ };
+ u64 build_ver = t_spec->tm_year + 1900;
+ for (size_t i = 0; i < 4; ++i) {
+ if (t_spec_arr[i] < 10) build_ver *= 10;
+ build_ver = concat_num(build_ver, t_spec_arr[i]);
+ }
+ return build_ver;
+}
+
+skap_header skap_header_create(void) {
+ return (skap_header) {
+ .signature = { 'S', 'K', 'A', 'P' },
+ .fmt_ver = 1,
+ .build_ver = compute_build_ver()
+ };
+}