diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index 17728a493..7b14db293 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -471,7 +471,7 @@ $(OBJ)/luaJIT_BC_%.$o: $(MAKEFILE_COMMON_DIR)/source/lunatic/%.lua $(COMPILE_STATUS) if $(LUAJIT) -bg $(LUAJIT_BCOPTS) $< $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi -# Same thing for defs.ilua which I'm too reluctant to rename now: +# Same thing for defs*.ilua which I'm too reluctant to rename now: # NOTE: The target path must match EXACTLY with that of the DEFS_BC_SIZE # determination in Makefile.common, because it is embedded into the bytecode as # debugging information. diff --git a/polymer/eduke32/Makefile.common b/polymer/eduke32/Makefile.common index 2795942ba..1eb13a0b8 100644 --- a/polymer/eduke32/Makefile.common +++ b/polymer/eduke32/Makefile.common @@ -479,10 +479,16 @@ ifneq ($(LUNATIC),0) ifndef DEFS_BC_SIZE DEFS_BC_SIZE := $(shell $(LUAJIT) -bg -t h $(MAKEFILE_COMMON_DIR)/source/lunatic/defs.ilua -) DEFS_BC_SIZE := $(word 3, $(DEFS_BC_SIZE)) - # Pass the bytecode size to the sub-makes, too. + # Pass it to the sub-makes, too. export DEFS_BC_SIZE endif - BASECOMMONFLAGS+= -DLUNATIC_DEFS_BC_SIZE=$(DEFS_BC_SIZE) + # Determine size of defs_m32.ilua bytecode once. + ifndef DEFS_M32_BC_SIZE + DEFS_M32_BC_SIZE := $(shell $(LUAJIT) -bg -t h $(MAKEFILE_COMMON_DIR)/source/lunatic/defs_m32.ilua -) + DEFS_M32_BC_SIZE := $(word 3, $(DEFS_M32_BC_SIZE)) + export DEFS_M32_BC_SIZE + endif + BASECOMMONFLAGS+= -DLUNATIC_DEFS_BC_SIZE=$(DEFS_BC_SIZE) -DLUNATIC_DEFS_M32_BC_SIZE=$(DEFS_M32_BC_SIZE) ifeq ($(PLATFORM),WINDOWS) BASELIBS+= -lluajit diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 10c45387e..0f21531ca 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -10507,7 +10507,10 @@ int32_t ExtInit(void) #ifdef LUNATIC if (Em_CreateState(&g_EmState) == 0) { - i = L_RunOnce(&g_EmState, "defs_m32.ilua"); + extern const char luaJIT_BC_defs_m32[]; + + i = L_RunString(&g_EmState, (char *)luaJIT_BC_defs_m32, 0, + LUNATIC_DEFS_M32_BC_SIZE, "defs_m32.ilua"); if (i != 0) { Em_DestroyState(&g_EmState); diff --git a/polymer/eduke32/source/lunatic/dynsymlist_m32 b/polymer/eduke32/source/lunatic/dynsymlist_m32 index 1a16f8235..42e1080fe 100644 --- a/polymer/eduke32/source/lunatic/dynsymlist_m32 +++ b/polymer/eduke32/source/lunatic/dynsymlist_m32 @@ -90,6 +90,7 @@ OSD_Printf; crc32once; +luaJIT_BC_defs_m32; luaJIT_BC_defs_common; luaJIT_BC_engine_maptext; luaJIT_BC_engine;