Skip to content

Commit 8b3930c

Browse files
committed
more lua stuff
1 parent 8ea4cdb commit 8b3930c

File tree

7 files changed

+475
-71
lines changed

7 files changed

+475
-71
lines changed

Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ CFLAGS += -pedantic
4343
CFLAGS += -std=c99
4444
CFLAGS += -I.
4545
CFLAGS += -Iext
46-
CFLAGS += -Iext/lua/src
4746
CFLAGS += -Wno-unused-function
4847
CFLAGS += -Wno-unused-variable
4948
CFLAGS += -Wno-missing-braces
@@ -134,7 +133,8 @@ PREFIX := /usr/local
134133

135134
LUA_PATH := ext/lua
136135
LUA_LIB := lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c lauxlib.c lbaselib.c lcorolib.c ldblib.c liolib.c lmathlib.c loadlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c linit.c
137-
LUA_SRC := $(addprefix $(LUA_PATH)/src/, $(LUA_LIB))
136+
LUA_SRC := $(addprefix $(LUA_PATH)/src/, $(LUA_LIB)) ext/stb_vorbis.c
137+
LUA_CFLAGS += -I$(LUA_PATH)/src
138138
LUA_CFLAGS += -Wno-gnu-label-as-value
139139
LUA_CFLAGS += -Wno-incompatible-pointer-types-discards-qualifiers
140140

@@ -227,6 +227,10 @@ $(BIN_PATH)/dirty: dirty.c *.h
227227
runlua: $(BIN_PATH)/dlua
228228
$< $(ARGS)
229229

230+
.PHONY: install
231+
installlua: $(BIN_PATH)/dlua
232+
install $< $(PREFIX)/bin/dlua
233+
230234
.PHONY: runscript
231235
runscript: $(BIN_PATH)/dirty
232236
$< $(ARGS)

d_audio.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -453,11 +453,11 @@ static short *resample(
453453
return output;
454454
}
455455

456-
static uint8_t ogg_sig[] = { 0x4f, 0x67, 0x67, 0x53 };
457-
static uint8_t wav_sig[] = { 0x52, 0x49, 0x46, 0x46 };
456+
static uint8_t OGG_SIG[] = { 0x4f, 0x67, 0x67, 0x53 };
457+
static uint8_t WAV_SIG[] = { 0x52, 0x49, 0x46, 0x46 };
458458

459459
d_sound d_sound_parse(uint8_t* bytes, size_t size) {
460-
if (memcmp(bytes, ogg_sig, sizeof(ogg_sig)) == 0) {
460+
if (memcmp(bytes, OGG_SIG, sizeof(OGG_SIG)) == 0) {
461461
#ifdef STB_VORBIS_IMPLEMENTATION
462462
d_sound snd = d_sound_empty();
463463
int num_channels, sample_rate;

d_gfx.h

+11
Original file line numberDiff line numberDiff line change
@@ -1916,5 +1916,16 @@ d_model d_model_load(char* path) {
19161916
#endif // #ifdef D_FS_H
19171917
#endif // #ifdef CGLTF_IMPLEMENTATION
19181918

1919+
void d_model_free(d_model* model) {
1920+
for (int i = 0; i < model->num_images; i++) {
1921+
d_img_free(&model->images[i]);
1922+
}
1923+
free(model->images);
1924+
for (int i = 0; i < model->num_nodes; i++) {
1925+
d_free_model_node(&model->nodes[i]);
1926+
}
1927+
free(model->nodes);
1928+
}
1929+
19191930
#endif // #ifndef D_GFX_IMPL_ONCE
19201931
#endif // #ifdef D_GFX_IMPL

0 commit comments

Comments
 (0)