Compare commits

..

No commits in common. "cb30231c2f42927f328292a2764d115d9084a90f" and "1ff46c397552fecd55556b1d679ed3ca0b10a2b2" have entirely different histories.

4 changed files with 16 additions and 47 deletions

View file

@ -1,5 +1,4 @@
PROCS != nproc --all
MAKEFLAGS = -j $(PROCS)
MAKEFLAGS = --jobs=8
UNAME != uname
MAKEDIR != pwd
# Options
@ -73,7 +72,7 @@ else
CPPFLAGS += -O2
endif
CPPFLAGS += -DHAVE_CEIL -DCP_USE_CGTYPES=0 -DCP_USE_DOUBLES=0 -DHAVE_FLOOR -DHAVE_FMOD -DHAVE_LRINT -DHAVE_LRINTF $(includeflag) $(WARNING_FLAGS) -I. -DVER=\"$(SEM)\" -DCOM=\"$(COM)\" -DINFO=\"$(INFO)\" #-DENABLE_SINC_MEDIUM_CONVERTER -DENABLE_SINC_FAST_CONVERTER -DCP_COLLISION_TYPE_TYPE=uintptr_t -DCP_BITMASK_TYPE=uintptr_t
CPPFLAGS += -DHAVE_CEIL -DCP_USE_CGTYPES=0 -DCP_USE_DOUBLES=0 -DHAVE_FLOOR -DHAVE_FMOD -DHAVE_LRINT -DHAVE_LRINTF $(includeflag) -MD $(WARNING_FLAGS) -I. -DVER=\"$(SEM)\" -DCOM=\"$(COM)\" -DINFO=\"$(INFO)\" #-DENABLE_SINC_MEDIUM_CONVERTER -DENABLE_SINC_FAST_CONVERTER -DCP_COLLISION_TYPE_TYPE=uintptr_t -DCP_BITMASK_TYPE=uintptr_t
CPPFLAGS += -DCONFIG_VERSION=\"2024-02-14\" -DCONFIG_BIGNUM #for quickjs
# ENABLE_SINC_[BEST|FAST|MEDIUM]_CONVERTER
@ -171,39 +170,20 @@ LDPATHS := $(STEAM)/redistributable_bin/$(PLATFORM)
LDPATHS := $(addprefix -L, $(LDPATHS))
DEPENDS = $(OBJS:.o=.d)
ifndef VERBOSE
.SILENT:
endif
DEPFLAGS = -MT $(@:.d=.o) -MM -MG $< -o $@
%$(INFO).d: %.c
@echo Making deps $@
$(CROSS)$(CC) $(CPPFLAGS) $(DEPFLAGS)
%$(INFO).d: %.cpp
@echo Making deps $@
$(CROSS)$(CXX) $(CPPFLAGS) $(DEPFLAGS)
%$(INFO).d: %.m
@echo Making deps $@
$(CROSS)$(CC) $(CPPFLAGS) $(DEPFLAGS)
ifneq ($(MAKECMDGOALS), clean)
include $(DEPENDS)
endif
-include $(DEPENDS)
.DEFAULT_GOAL := all
all: $(NAME)
cp -f $(NAME) $(APP)$(EXT)
prereqs: source/engine/core.cdb.h
$(NAME): $(OBJS) $(DEPS)
@echo Linking $(NAME)
$(CROSS)$(LD) $^ $(CPPFLAGS) $(LDFLAGS) -L. $(LDPATHS) $(LDLIBS) -o $@
@echo Finished build
%$(INFO).o: %.c
%$(INFO).o: %.c prereqs
@echo Making C object $@
$(CROSS)$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
@ -215,7 +195,9 @@ $(NAME): $(OBJS) $(DEPS)
@echo Making Objective-C object $@
$(CROSS)$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
CORE != (ls icons/* fonts/* shaders/*.cg scripts/*.js*)
SCRIPTS := $(shell ls scripts/*.js*)
CORE != (ls icons/* fonts/*)
CORE := $(CORE) $(SCRIPTS)
packer: tools/packer.c source/engine/miniz.c
@echo Making packer
@ -225,7 +207,7 @@ core.cdb: packer $(CORE)
@echo Packing core.cdb
./packer $@ $(CORE)
core.cdb.h: core.cdb
source/engine/core.cdb.h: core.cdb
@echo Making $@
xxd -i $< > $@

View file

@ -1556,9 +1556,8 @@ Math.sortpointsccw = function(points)
var yaml = {};
yaml.tojson = function(yaml)
{
// Replace key value pairs that are strings with quotation marks around them
yaml = yaml.replace(/(\w+):/g, '"$1":');
yaml = yaml.replace(/: ([\w\.\/]+)/g, ': "$1"'); // TODO: make this more general
yaml = yaml.replace(/: ([\w\.]+)/g, ': "$1"');
yaml = yaml.split("\n");
var cont = {};

View file

@ -110,17 +110,12 @@ function global_uni(uni, stage)
return false;
}
render.make_shader = function(shader)
{
var file = shader;
shader = io.slurp(shader);
console.info(shader);
if (!shader) {
console.info(`not found! slurping shaders/${file}`);
shader = io.slurp(`shaders/${file}`);
}
var writejson = `.prosperon/${file.name()}.shader.json`;
var writejson = `${file.name()}_c.json`;
var st = profile.now();
breakme: if (io.exists(writejson)) {
@ -138,18 +133,15 @@ render.make_shader = function(shader)
return obj;
}
var out = `.prosperon/${file.name()}.shader`;
var out = `${file.name()}.shader`;
var files = [file];
var incs = shader.match(/#include <.*>/g);
if (incs)
for (var inc of incs) {
var filez = inc.match(/#include <(.*)>/)[1];
var macro = io.slurp(filez);
if (!macro)
macro = io.slurp(`shaders/${filez}`);
shader = shader.replace(inc, macro);
files.push(filez);
}
@ -185,7 +177,7 @@ render.make_shader = function(shader)
var yamlfile = `${out}_reflection.yaml`;
console.info(`slurping ${yamlfile}`);
var jjson = yaml.tojson(io.slurp(yamlfile));
var obj = json.decode(jjson);
var obj = json.decode(jjson);
io.rm(yamlfile);
obj = obj.shaders[0].programs[0];

View file

@ -1219,10 +1219,6 @@ JSValue js_io_slurpbytes(JSContext *js, JSValue self, int argc, JSValue *argv)
char *f = js2str(argv[0]);
size_t len;
unsigned char *d = slurp_file(f,&len);
if (!d) {
JS_FreeCString(js,f);
return JS_UNDEFINED;
}
JSValue ret = JS_NewArrayBufferCopy(js,d,len);
JS_FreeCString(js,f);
free(d);