hot reloading with trampoline

This commit is contained in:
peterino2 2026-01-06 09:14:02 -08:00
parent e69a8d13ec
commit a518a89798
2 changed files with 6 additions and 17 deletions

View File

@ -299,11 +299,12 @@ pub fn start_module_(map: *SpecVariantMap, args: anytype, allocator: std.mem.All
gEngine.* = try Engine.init(allocator); gEngine.* = try Engine.init(allocator);
staticsInitialized = true; staticsInitialized = true;
_ = try createObject(ModuleLoader, .{});
try console.start(); try console.start();
const engineName = try std.fmt.allocPrint(allocator, "{s}Engine.ini", .{name}); const engineName = try std.fmt.allocPrint(allocator, "{s}Engine.ini", .{name});
defer allocator.free(engineName); defer allocator.free(engineName);
try algorithm.string_pool.setup(allocator);
gEngine.stringContext = algorithm.string_pool.gStringContext;
try configVars.setupConfigs(engineName); try configVars.setupConfigs(engineName);
@ -311,15 +312,11 @@ pub fn start_module_(map: *SpecVariantMap, args: anytype, allocator: std.mem.All
try logging.setupLogging(gEngine); try logging.setupLogging(gEngine);
} }
try ecs.setup(allocator); _ = try createObject(ModuleLoader, .{});
_ = try gEngine.createObject(ecs.EcsRegistry, .{ .can_tick = true, .isCore = true });
_ = try gEngine.createObject(scene.SceneSystem, .{ .can_tick = true }); _ = try gEngine.createObject(scene.SceneSystem, .{ .can_tick = true });
_ = try gEngine.createObject(scene.SceneSystem, .{ .can_tick = true });
try algorithm.string_pool.setup(allocator); _ = try gEngine.createObject(inputs.InputStack, .{});
gEngine.stringContext = algorithm.string_pool.gStringContext;
_ = try createObject(GameObjectSystem, .{ .can_tick = true });
_ = try inputs.initInputStack();
// components define // components define
try ecs.defineComponentList(ComponentList, allocator); try ecs.defineComponentList(ComponentList, allocator);

View File

@ -29,14 +29,6 @@ pub export fn startup_module(p_allocator: *anyopaque, p_a: ?*anyopaque) bool {
const moduleArgs = core.startup_getArgs(p_a.?); const moduleArgs = core.startup_getArgs(p_a.?);
// firstLoad: bool,
// engine: *core.Engine,
// nameRegistry: *p2.NameRegistry,
// packerFS: *core.PackerFS,
// // luaState: *anyopaque,
// // luaAllocator: *anyopaque,
// debugDrawInterface: ?*debug.DebugDrawInterface,
if (moduleArgs.firstLoad) { if (moduleArgs.firstLoad) {
inline for (backlog.moduleList) |feature| { inline for (backlog.moduleList) |feature| {
if (@hasDecl(backlog, feature) and !std.mem.eql(u8, "core", feature)) { if (@hasDecl(backlog, feature) and !std.mem.eql(u8, "core", feature)) {