non-pch modules made into layers

This commit is contained in:
jacob 2025-07-28 16:55:20 -05:00
parent 70e5e115c9
commit 809994ebd4
80 changed files with 272 additions and 258 deletions

21
build.c
View File

@ -442,7 +442,7 @@ void OnBuild(StringList cli_args)
D_Tag res_dir = D_TagFromPath(&perm, Lit("res"), D_TagKind_Dir); D_Tag res_dir = D_TagFromPath(&perm, Lit("res"), D_TagKind_Dir);
D_Tag icon_file = D_TagFromPath(&perm, Lit("icon.ico"), D_TagKind_File); D_Tag icon_file = D_TagFromPath(&perm, Lit("icon.ico"), D_TagKind_File);
D_Tag inc_src_file = D_TagFromPath(&perm, Lit("src/inc.c"), D_TagKind_File); D_Tag inc_src_file = D_TagFromPath(&perm, Lit("src/inc/inc_core.c"), D_TagKind_File);
D_Tag rc_res_file = D_TagFromPath(&perm, StringF(&perm, Lit("%F/rc.res"), FmtStr(out_obj_dir_path)), D_TagKind_File); D_Tag rc_res_file = D_TagFromPath(&perm, StringF(&perm, Lit("%F/rc.res"), FmtStr(out_obj_dir_path)), D_TagKind_File);
/* ========================== * /* ========================== *
@ -496,7 +496,6 @@ void OnBuild(StringList cli_args)
"-fno-strict-aliasing " "-fno-strict-aliasing "
"-fno-finite-loops " "-fno-finite-loops "
"-fwrapv " "-fwrapv "
"-I src/ "
"-msse4.1 " "-msse4.1 "
"-msse4.2 ")); "-msse4.2 "));
@ -962,14 +961,30 @@ void OnBuild(StringList cli_args)
D_GetDirContents(&perm, &src_files, src_dir, 0); D_GetDirContents(&perm, &src_files, src_dir, 0);
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/base/base.c"), D_TagKind_File)); D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/base/base.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/prof/prof.cpp"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/sys/sys.c"), D_TagKind_File)); D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/sys/sys.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/gp/gp.c"), D_TagKind_File)); D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/gp/gp.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/resource/resource.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/watch/watch.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/tar/tar.c"), D_TagKind_File)); D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/tar/tar.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/ase/ase.c"), D_TagKind_File)); D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/ase/ase.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/mp3/mp3.c"), D_TagKind_File)); D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/mp3/mp3.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/json/json.c"), D_TagKind_File)); D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/json/json.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/ttf/ttf.cpp"), D_TagKind_File)); D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/ttf/ttf.cpp"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/dxc/dxc.cpp"), D_TagKind_File)); D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/dxc/dxc.cpp"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/sprite/sprite.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/font/font.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/sound/sound.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/draw/draw.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/inc/inc.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/host/host.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/asset_cache/asset_cache.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/mixer/mixer.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/settings/settings.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/space/space.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/collider/collider.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/app/app.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/playback/playback.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/sim/sim.c"), D_TagKind_File)); D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/sim/sim.c"), D_TagKind_File));
D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/user/user.c"), D_TagKind_File)); D_TagListAppend(&perm, &src_files, D_TagFromPath(&perm, Lit("src/user/user.c"), D_TagKind_File));
@ -993,7 +1008,7 @@ void OnBuild(StringList cli_args)
if (PlatformWindows) { if (PlatformWindows) {
ignore = !(StringEqual(name, Lit("sys_win32.c")) || ignore = !(StringEqual(name, Lit("sys_win32.c")) ||
StringEqual(name, Lit("gp_dx12.c")) || StringEqual(name, Lit("gp_dx12.c")) ||
StringEqual(name, Lit("playback_wasapi.c")) || StringEqual(name, Lit("playback_win32.c")) ||
StringEqual(name, Lit("mp3_mmf.c")) || StringEqual(name, Lit("mp3_mmf.c")) ||
StringEqual(name, Lit("ttf_dwrite.cpp")) || StringEqual(name, Lit("ttf_dwrite.cpp")) ||
StringEqual(name, Lit("dxc.cpp"))); StringEqual(name, Lit("dxc.cpp")));

3
src/app/app.c Normal file
View File

@ -0,0 +1,3 @@
#include "app.h"
#include "app_core.c"

24
src/app/app.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef APP_H
#define APP_H
#include "../base/base.h"
#include "../sys/sys.h"
#include "../ttf/ttf.h"
#include "../gp/gp.h"
#include "../sim/sim.h"
#include "../user/user.h"
#include "../sprite/sprite.h"
#include "../watch/watch.h"
#include "../draw/draw.h"
#include "../sound/sound.h"
#include "../font/font.h"
#include "../asset_cache/asset_cache.h"
#include "../mixer/mixer.h"
#include "../settings/settings.h"
#include "../host/host.h"
#include "../resource/resource.h"
#include "../playback/playback.h"
#include "app_core.h"
#endif

View File

@ -1,22 +1,3 @@
#include "app.h"
#include "base/base.h"
#include "sys/sys.h"
#include "ttf/ttf.h"
#include "gp/gp.h"
#include "sim/sim.h"
#include "user/user.h"
#include "playback.h"
#include "resource.h"
#include "asset_cache.h"
#include "font.h"
#include "sprite.h"
#include "mixer.h"
#include "sound.h"
#include "settings.h"
#include "draw.h"
#include "host.h"
#include "watch.h"
GLOBAL struct { GLOBAL struct {
struct arena *arena; struct arena *arena;
struct string write_path; struct string write_path;

View File

@ -1,6 +1 @@
#ifndef APP_H
#define APP_H
struct string app_write_path_cat(struct arena *arena, struct string filename); struct string app_write_path_cat(struct arena *arena, struct string filename);
#endif

View File

@ -0,0 +1,3 @@
#include "asset_cache.h"
#include "asset_cache_core.c"

View File

@ -0,0 +1,9 @@
#ifndef ASSET_CACHE_H
#define ASSET_CACHE_H
#include "../base/base.h"
#include "../sys/sys.h"
#include "asset_cache_core.h"
#endif

View File

@ -1,7 +1,3 @@
#include "asset_cache.h"
#include "base/base.h"
#include "sys/sys.h"
/* ========================== * /* ========================== *
* Global state * Global state
* ========================== */ * ========================== */

View File

@ -1,9 +1,3 @@
#ifndef ASSET_CACHE_H
#define ASSET_CACHE_H
#include "base/base.h"
#include "sys/sys.h"
enum asset_status { enum asset_status {
ASSET_STATUS_NONE, ASSET_STATUS_NONE,
@ -49,5 +43,3 @@ struct asset_cache_store asset_cache_store_open(void);
void asset_cache_store_close(struct asset_cache_store *store); void asset_cache_store_close(struct asset_cache_store *store);
u64 asset_cache_hash(struct string key); u64 asset_cache_hash(struct string key);
#endif

View File

@ -2,8 +2,9 @@
#include "base_fiber.c" #include "base_fiber.c"
#include "base_arena.c" #include "base_arena.c"
#include "base_buddy.c" #include "base_gstat.c"
#include "base_memory.c" #include "base_memory.c"
#include "base_buddy.c"
#include "base_rand.c" #include "base_rand.c"
#include "base_string.c" #include "base_string.c"
#include "base_bitbuff.c" #include "base_bitbuff.c"

View File

@ -1,11 +1,12 @@
#ifndef BASE_H #ifndef BASE_H
#define BASE_H #define BASE_H
#include "../gstat.h" #include "../prof/prof.h"
#include "base_intrinsics.h" #include "base_intrinsics.h"
#include "base_atomic.h" #include "base_atomic.h"
#include "base_fiber.h" #include "base_fiber.h"
#include "base_gstat.h"
#include "base_memory.h" #include "base_memory.h"
#include "base_arena.h" #include "base_arena.h"
#include "base_buddy.h" #include "base_buddy.h"

View File

@ -1,5 +1,3 @@
#include "gstat.h"
#if GSTAT_ENABLED #if GSTAT_ENABLED
struct _gstats _g_gstats = ZI; struct _gstats _g_gstats = ZI;
#endif #endif

View File

@ -1,12 +1,7 @@
#ifndef GSTAT_H
#define GSTAT_H
/* Program-wide statistics */ /* Program-wide statistics */
#if GSTAT_ENABLED #if GSTAT_ENABLED
#include "base/base.h"
struct _gstats { struct _gstats {
struct atomic64_padded GSTAT_SOCK_BYTES_SENT; struct atomic64_padded GSTAT_SOCK_BYTES_SENT;
struct atomic64_padded GSTAT_SOCK_BYTES_RECEIVED; struct atomic64_padded GSTAT_SOCK_BYTES_RECEIVED;
@ -30,6 +25,3 @@ extern struct _gstats _g_gstats;
#define gstat_get(name) 0 #define gstat_get(name) 0
#endif #endif
#endif

3
src/collider/collider.c Normal file
View File

@ -0,0 +1,3 @@
#include "collider.h"
#include "collider_core.c"

8
src/collider/collider.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef COLLIDER_H
#define COLLIDER_H
#include "../base/base.h"
#include "collider_core.h"
#endif

View File

@ -1,7 +1,3 @@
#include "collider.h"
#include "base/base.h"
#include "gstat.h"
/* How close can non-overlapping shapes be before collision is considered */ /* How close can non-overlapping shapes be before collision is considered */
#define COLLISION_TOLERANCE 0.005f #define COLLISION_TOLERANCE 0.005f

View File

@ -1,6 +1,3 @@
#ifndef COLLIDER_H
#define COLLIDER_H
struct collider_support_point { struct collider_support_point {
struct v2 p; struct v2 p;
u32 i; /* Index of original point in shape */ u32 i; /* Index of original point in shape */
@ -70,5 +67,3 @@ f32 collider_time_of_impact(struct collider_shape *c0, struct collider_shape *c1
struct v2_array menkowski(struct arena *arena, struct collider_shape *shape0, struct collider_shape *shape1, struct xform xf0, struct xform xf1, u32 detail); struct v2_array menkowski(struct arena *arena, struct collider_shape *shape0, struct collider_shape *shape1, struct xform xf0, struct xform xf1, u32 detail);
struct v2_array cloud(struct arena *arena, struct collider_shape *shape0, struct collider_shape *shape1, struct xform xf0, struct xform xf1); struct v2_array cloud(struct arena *arena, struct collider_shape *shape0, struct collider_shape *shape1, struct xform xf0, struct xform xf1);
#endif

View File

@ -680,17 +680,6 @@ INLINE f64 clamp_f64(f64 v, f64 min, f64 max) { return v < min ? min : v > max ?
#include "config.h" #include "config.h"
/* ========================== *
* Profiling
* ========================== */
#include "prof_tracy.h"
#define PROF_THREAD_GROUP_FIBERS -(i64)GIBI(1)
#define PROF_THREAD_GROUP_SCHEDULER -(i64)MEBI(3)
#define PROF_THREAD_GROUP_WINDOW -(i64)MEBI(2)
#define PROF_THREAD_GROUP_MAIN -(i64)MEBI(1)
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -82,6 +82,11 @@
/* If enabled, things like network writes & memory allocations will be tracked in a global statistics struct */ /* If enabled, things like network writes & memory allocations will be tracked in a global statistics struct */
#define GSTAT_ENABLED 1 #define GSTAT_ENABLED 1
#define PROF_THREAD_GROUP_FIBERS -(i64)GIBI(1)
#define PROF_THREAD_GROUP_SCHEDULER -(i64)MEBI(3)
#define PROF_THREAD_GROUP_WINDOW -(i64)MEBI(2)
#define PROF_THREAD_GROUP_MAIN -(i64)MEBI(1)
/* ========================== * /* ========================== *
* Settings * Settings
* ========================== */ * ========================== */

3
src/draw/draw.c Normal file
View File

@ -0,0 +1,3 @@
#include "draw.h"
#include "draw_core.c"

12
src/draw/draw.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef DRAW_H
#define DRAW_H
#include "../base/base.h"
#include "../gp/gp.h"
#include "../sprite/sprite.h"
#include "../font/font.h"
#include "../collider/collider.h"
#include "draw_core.h"
#endif

View File

@ -1,9 +1,3 @@
#include "draw.h"
#include "base/base.h"
#include "font.h"
#include "sprite.h"
#include "collider.h"
GLOBAL struct { GLOBAL struct {
struct gp_resource *solid_white_texture; struct gp_resource *solid_white_texture;
} G = ZI, DEBUG_ALIAS(G, G_draw); } G = ZI, DEBUG_ALIAS(G, G_draw);

View File

@ -1,8 +1,3 @@
#ifndef DRAW_H
#define DRAW_H
#include "gp/gp.h"
struct font; struct font;
struct font_startup_receipt; struct font_startup_receipt;
@ -138,5 +133,3 @@ struct draw_text_params {
}; };
struct rect draw_text(struct gp_render_sig *sig, struct draw_text_params params); struct rect draw_text(struct gp_render_sig *sig, struct draw_text_params params);
#endif

3
src/font/font.c Normal file
View File

@ -0,0 +1,3 @@
#include "font.h"
#include "font_core.c"

12
src/font/font.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef FONT_H
#define FONT_H
#include "../base/base.h"
#include "../ttf/ttf.h"
#include "../gp/gp.h"
#include "../resource/resource.h"
#include "../asset_cache/asset_cache.h"
#include "font_core.h"
#endif

View File

@ -1,10 +1,3 @@
#include "font.h"
#include "base/base.h"
#include "ttf/ttf.h"
#include "gp/gp.h"
#include "asset_cache.h"
#include "resource.h"
#define LOOKUP_TABLE_SIZE (256) #define LOOKUP_TABLE_SIZE (256)
GLOBAL u32 g_font_codes[] = { GLOBAL u32 g_font_codes[] = {
0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F,0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F,0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF

View File

@ -1,8 +1,3 @@
#ifndef FONT_H
#define FONT_H
#include "base/base.h"
struct asset; struct asset;
struct asset_cache_startup_receipt; struct asset_cache_startup_receipt;
struct ttf_startup_receipt; struct ttf_startup_receipt;
@ -35,5 +30,3 @@ struct font *font_load_async(struct string path, f32 point_size);
struct font *font_load(struct string path, f32 point_size); struct font *font_load(struct string path, f32 point_size);
struct font_glyph *font_get_glyph(struct font *font, u32 codepoint); struct font_glyph *font_get_glyph(struct font *font, u32 codepoint);
#endif

View File

@ -6,6 +6,9 @@
#include "../tar/tar.h" #include "../tar/tar.h"
#include "../ase/ase.h" #include "../ase/ase.h"
#include "../dxc/dxc.h" #include "../dxc/dxc.h"
#include "../inc/inc.h"
#include "../resource/resource.h"
#include "../watch/watch.h"
#include "gp_core.h" #include "gp_core.h"

View File

@ -1,8 +1,5 @@
#include "../sprite.h" /* TODO: Remove this */
#include "../gstat.h" #include "../sprite/sprite.h"
#include "../resource.h"
#include "../inc.h"
#include "../watch.h"
/* Include common shader types */ /* Include common shader types */
#define SH_CPU 1 #define SH_CPU 1

3
src/host/host.c Normal file
View File

@ -0,0 +1,3 @@
#include "host.h"
#include "host_core.c"

9
src/host/host.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef HOST_H
#define HOST_H
#include "../base/base.h"
#include "../sys/sys.h"
#include "host_core.h"
#endif

View File

@ -1,7 +1,3 @@
#include "host.h"
#include "base/base.h"
#include "sys/sys.h"
/* TODO: /* TODO:
* *
* Rate limiting. * Rate limiting.

View File

@ -1,9 +1,3 @@
#ifndef HOST_H
#define HOST_H
#include "base/base.h"
#include "sys/sys.h"
#define HOST_CHANNEL_ID_NIL (struct host_channel_id) { .gen = 0, .idx = 0 } #define HOST_CHANNEL_ID_NIL (struct host_channel_id) { .gen = 0, .idx = 0 }
#define HOST_CHANNEL_ID_ALL (struct host_channel_id) { .gen = U32_MAX, .idx = U32_MAX } #define HOST_CHANNEL_ID_ALL (struct host_channel_id) { .gen = U32_MAX, .idx = U32_MAX }
@ -137,5 +131,3 @@ INLINE b32 host_channel_id_is_nil(struct host_channel_id id) { return id.gen ==
struct host_event_list host_update_begin(struct arena *arena, struct host *host); struct host_event_list host_update_begin(struct arena *arena, struct host *host);
void host_update_end(struct host *host); void host_update_end(struct host *host);
#endif

3
src/inc/inc.c Normal file
View File

@ -0,0 +1,3 @@
#include "inc.h"
#include "inc_core.c"

8
src/inc/inc.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef INC_H
#define INC_H
#include "../base/base.h"
#include "inc_core.h"
#endif

View File

@ -1,6 +1,3 @@
#include "inc.h"
#include "base/base.h"
/* This is the file that actually includes binary data meant to be embedded in /* This is the file that actually includes binary data meant to be embedded in
* the executable. Embedded files should be added as dependencies to this source * the executable. Embedded files should be added as dependencies to this source
* file via the build system to ensure this translation unit is recompiled upon * file via the build system to ensure this translation unit is recompiled upon

View File

@ -1,10 +1,5 @@
#ifndef INC_H
#define INC_H
#if RESOURCES_EMBEDDED #if RESOURCES_EMBEDDED
struct string inc_res_tar(void); struct string inc_res_tar(void);
#endif #endif
struct string inc_dxc_tar(void); struct string inc_dxc_tar(void);
#endif

3
src/mixer/mixer.c Normal file
View File

@ -0,0 +1,3 @@
#include "mixer.h"
#include "mixer_core.c"

10
src/mixer/mixer.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef MIXER_H
#define MIXER_H
#include "../base/base.h"
#include "../sys/sys.h"
#include "../sound/sound.h"
#include "mixer_core.h"
#endif

View File

@ -1,8 +1,3 @@
#include "mixer.h"
#include "base/base.h"
#include "sys/sys.h"
#include "sound.h"
/* TODO: Cap max sounds playing. */ /* TODO: Cap max sounds playing. */
/* Terminology: /* Terminology:

View File

@ -1,6 +1,3 @@
#ifndef MIXER_H
#define MIXER_H
struct sound; struct sound;
#define MIXER_FLAG_NONE 0x0 #define MIXER_FLAG_NONE 0x0
@ -50,5 +47,3 @@ void mixer_set_listener(struct v2 pos, struct v2 dir);
/* Mixing */ /* Mixing */
struct mixed_pcm_f32 mixer_update(struct arena *arena, u64 frame_request_count); struct mixed_pcm_f32 mixer_update(struct arena *arena, u64 frame_request_count);
#endif

7
src/playback/playback.c Normal file
View File

@ -0,0 +1,7 @@
#include "playback.h"
#if PLATFORM_WINDOWS
# include "playback_core_win32.c"
#else
# error Playback core not implemented for this platform
#endif

10
src/playback/playback.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef PLAYBACK_H
#define PLAYBACK_H
#include "../base/base.h"
#include "../sys/sys.h"
#include "../mixer/mixer.h"
#include "playback_core.h"
#endif

View File

@ -1,9 +1,4 @@
#ifndef PLAYBACK_H
#define PLAYBACK_H
struct mixer_startup_receipt; struct mixer_startup_receipt;
struct playback_startup_receipt { i32 _; }; struct playback_startup_receipt { i32 _; };
struct playback_startup_receipt playback_startup(struct mixer_startup_receipt *mixer_sr); struct playback_startup_receipt playback_startup(struct mixer_startup_receipt *mixer_sr);
#endif

View File

@ -5,12 +5,6 @@
* https://gist.github.com/mmozeiko/5a5b168e61aff4c1eaec0381da62808f#file-win32_wasapi-h * https://gist.github.com/mmozeiko/5a5b168e61aff4c1eaec0381da62808f#file-win32_wasapi-h
* ========================== */ * ========================== */
#include "playback.h"
#include "base/base.h"
#include "sys/sys.h"
#include "mixer.h"
#include "app.h"
#define COBJMACROS #define COBJMACROS
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#define UNICODE #define UNICODE

3
src/prof/prof.cpp Normal file
View File

@ -0,0 +1,3 @@
#include "prof.h"
#include "prof_core_tracy.cpp"

6
src/prof/prof.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef PROF_H
#define PROF_H
#include "prof_core_tracy.h"
#endif

View File

View File

@ -1,6 +1,3 @@
#ifndef PROF_H
#define PROF_H
#if PROFILING #if PROFILING
#if COMPILER_MSVC #if COMPILER_MSVC
@ -153,5 +150,3 @@ FORCE_NO_INLINE INLINE void __prof_fiber_leave(void) { TracyCFiberLeave; }
# define __prof_fiber_enter(fiber_name, profiler_group) # define __prof_fiber_enter(fiber_name, profiler_group)
# define __prof_fiber_leave() # define __prof_fiber_leave()
#endif #endif
#endif

View File

@ -1,9 +0,0 @@
#if PROFILING
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
#define TRACY_FIBERS
# include TRACY_CLIENT_SRC_PATH
#pragma clang diagnostic pop
#endif

3
src/resource/resource.c Normal file
View File

@ -0,0 +1,3 @@
#include "resource.h"
#include "resource_core.c"

14
src/resource/resource.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef RESOURCE_H
#define RESOURCE_H
#include "../base/base.h"
#include "../sys/sys.h"
#include "../tar/tar.h"
#if RESOURCES_EMBEDDED
# include "../inc/inc.h"
#endif
#include "resource_core.h"
#endif

View File

@ -1,17 +1,7 @@
#include "resource.h"
#include "app.h"
#include "base/base.h"
#include "sys/sys.h"
#include "tar/tar.h"
/* ========================== * /* ========================== *
* Global data * Global data
* ========================== */ * ========================== */
#if RESOURCES_EMBEDDED
# include "inc.h"
#endif
/* Add resource data to binary */ /* Add resource data to binary */
GLOBAL struct { GLOBAL struct {

View File

@ -1,8 +1,3 @@
#ifndef RESOURCE_H
#define RESOURCE_H
#include "sys/sys.h"
#define RESOURCE_NAME_LEN_MAX 256 #define RESOURCE_NAME_LEN_MAX 256
/* A resource contains data that can be retrieved globally by name. /* A resource contains data that can be retrieved globally by name.
@ -53,5 +48,3 @@ struct resource resource_open(struct string name);
#else #else
#define resource_get_name(res_ptr) STRING((res_ptr)->_name_len, (res_ptr)->_name_text) #define resource_get_name(res_ptr) STRING((res_ptr)->_name_len, (res_ptr)->_name_text)
#endif #endif
#endif

3
src/settings/settings.c Normal file
View File

@ -0,0 +1,3 @@
#include "settings.h"
#include "settings_core.c"

10
src/settings/settings.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef SETTINGS_H
#define SETTINGS_H
#include "../base/base.h"
#include "../sys/sys.h"
#include "../json/json.h"
#include "settings_core.h"
#endif

View File

@ -1,8 +1,3 @@
#include "settings.h"
#include "base/base.h"
#include "sys/sys.h"
#include "json/json.h"
struct string settings_serialize(struct arena *arena, const struct sys_window_settings *settings) struct string settings_serialize(struct arena *arena, const struct sys_window_settings *settings)
{ {
__prof; __prof;

View File

@ -1,9 +1,5 @@
#ifndef SETTINGS_H
#define SETTINGS_H
struct sys_window_settings; struct sys_window_settings;
struct string settings_serialize(struct arena *arena, const struct sys_window_settings *settings); struct string settings_serialize(struct arena *arena, const struct sys_window_settings *settings);
struct sys_window_settings *settings_deserialize(struct arena *arena, struct string src, struct string *error_out);
#endif struct sys_window_settings *settings_deserialize(struct arena *arena, struct string src, struct string *error_out);

View File

@ -2,11 +2,11 @@
#define SIM_H #define SIM_H
#include "../base/base.h" #include "../base/base.h"
#include "../collider.h" #include "../sprite/sprite.h"
#include "../sprite.h" #include "../collider/collider.h"
#include "../space.h" #include "../space/space.h"
#include "../host.h" #include "../host/host.h"
#include "../mixer.h" #include "../mixer/mixer.h"
#include "sim_core.h" #include "sim_core.h"
#include "sim_phys.h" #include "sim_phys.h"

3
src/sound/sound.c Normal file
View File

@ -0,0 +1,3 @@
#include "sound.h"
#include "sound_core.c"

12
src/sound/sound.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef SOUND_H
#define SOUND_H
#include "../base/base.h"
#include "../sys/sys.h"
#include "../mp3/mp3.h"
#include "../resource/resource.h"
#include "../asset_cache/asset_cache.h"
#include "sound_core.h"
#endif

View File

@ -1,10 +1,3 @@
#include "sound.h"
#include "base/base.h"
#include "sys/sys.h"
#include "resource.h"
#include "asset_cache.h"
#include "mp3/mp3.h"
#define SOUND_SAMPLE_RATE 48000 #define SOUND_SAMPLE_RATE 48000
struct sound_task_params { struct sound_task_params {

View File

@ -1,6 +1,3 @@
#ifndef SOUND_H
#define SOUND_H
#define SOUND_FLAG_NONE 0x0 #define SOUND_FLAG_NONE 0x0
#define SOUND_FLAG_STEREO 0x1 #define SOUND_FLAG_STEREO 0x1
@ -18,5 +15,3 @@ struct sound_startup_receipt sound_startup(struct asset_cache_startup_receipt *a
struct asset *sound_load_asset(struct string path, u32 flags, b32 wait); struct asset *sound_load_asset(struct string path, u32 flags, b32 wait);
struct sound *sound_load_async(struct string path, u32 flags); struct sound *sound_load_async(struct string path, u32 flags);
struct sound *sound_load(struct string path, u32 flags); struct sound *sound_load(struct string path, u32 flags);
#endif

3
src/space/space.c Normal file
View File

@ -0,0 +1,3 @@
#include "space.h"
#include "space_core.c"

9
src/space/space.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef SPACE_H
#define SPACE_H
#include "../base/base.h"
#include "../collider/collider.h"
#include "space_core.h"
#endif

View File

@ -1,7 +1,3 @@
#include "space.h"
#include "base/base.h"
#include "collider.h"
/* FIXME: Default space entry & cell pointers to nil */ /* FIXME: Default space entry & cell pointers to nil */
/* Offset in bytes from start of space struct to start of entry array (assume adjacently allocated) */ /* Offset in bytes from start of space struct to start of entry array (assume adjacently allocated) */

View File

@ -1,6 +1,3 @@
#ifndef SPACE_H
#define SPACE_H
struct space_cell_bin; struct space_cell_bin;
struct space_entry { struct space_entry {
@ -132,5 +129,3 @@ void space_entry_update_aabb(struct space_entry *entry, struct aabb new_aabb);
struct space_iter space_iter_begin_aabb(struct space *space, struct aabb aabb); struct space_iter space_iter_begin_aabb(struct space *space, struct aabb aabb);
struct space_entry *space_iter_next(struct space_iter *iter); struct space_entry *space_iter_next(struct space_iter *iter);
#define space_iter_end(i) #define space_iter_end(i)
#endif

3
src/sprite/sprite.c Normal file
View File

@ -0,0 +1,3 @@
#include "sprite.h"
#include "sprite_core.c"

13
src/sprite/sprite.h Normal file
View File

@ -0,0 +1,13 @@
#ifndef SPRITE_H
#define SPRITE_H
#include "../base/base.h"
#include "../sys/sys.h"
#include "../gp/gp.h"
#include "../ase/ase.h"
#include "../resource/resource.h"
#include "../watch/watch.h"
#include "sprite_core.h"
#endif

View File

@ -1,12 +1,3 @@
#include "sprite.h"
#include "base/base.h"
#include "sys/sys.h"
#include "ase/ase.h"
#include "resource.h"
#include "app.h"
#include "gp/gp.h"
#include "watch.h"
/* The evictor will begin evicting once cache usage is > threshold. /* The evictor will begin evicting once cache usage is > threshold.
* It will entries until the budget has shrunk < target. */ * It will entries until the budget has shrunk < target. */
#define CACHE_MEMORY_BUDGET_THRESHOLD (MEBI(256)) #define CACHE_MEMORY_BUDGET_THRESHOLD (MEBI(256))

View File

@ -1,8 +1,3 @@
#ifndef SPRITE_H
#define SPRITE_H
#include "base/base.h"
struct sprite_sheet_span; struct sprite_sheet_span;
struct sprite_sheet_slice_group; struct sprite_sheet_slice_group;
@ -136,5 +131,3 @@ struct sprite_sheet_slice sprite_sheet_get_slice(struct sprite_sheet *sheet, str
/* Returns all slices with name in frame */ /* Returns all slices with name in frame */
struct sprite_sheet_slice_array sprite_sheet_get_slices(struct sprite_sheet *sheet, struct string name, u32 frame_index); struct sprite_sheet_slice_array sprite_sheet_get_slices(struct sprite_sheet *sheet, struct string name, u32 frame_index);
#endif

View File

@ -2,8 +2,6 @@
#define SYS_H #define SYS_H
#include "../base/base.h" #include "../base/base.h"
#include "../app.h"
#include "../gstat.h"
#include "sys_snc.h" #include "sys_snc.h"
#include "sys_sleep.h" #include "sys_sleep.h"

View File

@ -3,7 +3,7 @@
extern "C" extern "C"
{ {
#include "../font.h" #include "../font/font.h"
} }
#pragma warning(push, 0) #pragma warning(push, 0)

View File

@ -3,6 +3,12 @@
#include "../base/base.h" #include "../base/base.h"
#include "../sim/sim.h" #include "../sim/sim.h"
#include "../gp/gp.h"
#include "../sprite/sprite.h"
#include "../font/font.h"
#include "../collider/collider.h"
#include "../draw/draw.h"
#include "../host/host.h"
#include "user_core.h" #include "user_core.h"

View File

@ -1,18 +1,3 @@
#include "user.h"
#include "base/base.h"
#include "sys/sys.h"
#include "gp/gp.h"
#include "sim/sim.h"
#include "font.h"
#include "sprite.h"
#include "draw.h"
#include "asset_cache.h"
#include "mixer.h"
#include "collider.h"
#include "host.h"
#include "gstat.h"
#include "app.h"
struct bind_state { struct bind_state {
b32 is_held; /* Is this bind held down this frame */ b32 is_held; /* Is this bind held down this frame */
u32 num_presses; /* How many times was this bind's pressed since last frame */ u32 num_presses; /* How many times was this bind's pressed since last frame */

View File

@ -1,6 +1,3 @@
#include "base/base.h"
#include "sys/sys.h"
struct font_startup_receipt; struct font_startup_receipt;
struct sprite_startup_receipt; struct sprite_startup_receipt;
struct draw_startup_receipt; struct draw_startup_receipt;

3
src/watch/watch.c Normal file
View File

@ -0,0 +1,3 @@
#include "watch.h"
#include "watch_core.c"

9
src/watch/watch.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef WATCH_H
#define WATCH_H
#include "../base/base.h"
#include "../sys/sys.h"
#include "watch_core.h"
#endif

View File

@ -1,10 +1,5 @@
#include "watch.h"
#if RESOURCE_RELOADING #if RESOURCE_RELOADING
#include "base/base.h"
#include "sys/sys.h"
struct watch_event { struct watch_event {
struct string name; struct string name;
struct watch_event *next; struct watch_event *next;

View File

@ -1,6 +1,3 @@
#ifndef WATCH_H
#define WATCH_H
#define WATCH_CALLBACK_FUNC_DEF(func_name, arg_name) void func_name(struct string arg_name) #define WATCH_CALLBACK_FUNC_DEF(func_name, arg_name) void func_name(struct string arg_name)
typedef WATCH_CALLBACK_FUNC_DEF(watch_callback, name); typedef WATCH_CALLBACK_FUNC_DEF(watch_callback, name);
@ -11,5 +8,3 @@ void watch_register_callback(watch_callback *callback);
#else #else
#define watch_register_callback(callback) #define watch_register_callback(callback)
#endif #endif
#endif