trampoline loading is now working for coreTest... now onto hot reloading
This commit is contained in:
parent
81132ac97b
commit
17b3a4c23d
|
|
@ -189,22 +189,35 @@ pub const Program = struct {
|
|||
exe.root_module.addImport("backlog", gameApi);
|
||||
}
|
||||
|
||||
const installed = self.buildSystem.b.addInstallArtifact(exe, .{});
|
||||
|
||||
{
|
||||
const runArtifact = b.addRunArtifact(exe);
|
||||
const run = b.addSystemCommand(&.{b.fmt("zig-out/bin/{s}", .{self.name})});
|
||||
run.step.dependOn(&installed.step);
|
||||
|
||||
if (b.args) |args| {
|
||||
runArtifact.addArgs(args);
|
||||
run.addArgs(args);
|
||||
}
|
||||
|
||||
const run_exe = b.step(b.fmt("run-{s}", .{self.name}), "runs the program");
|
||||
run_exe.dependOn(&runArtifact.step);
|
||||
run_exe.dependOn(&run.step);
|
||||
|
||||
// const runArtifact = b.addRunArtifact(exe);
|
||||
// if (b.args) |args| {
|
||||
// runArtifact.addArgs(args);
|
||||
// }
|
||||
|
||||
// // Set CWD to the build.zig directory so the exe can find zig-out/modules/
|
||||
// runArtifact.setCwd(b.path("."));
|
||||
|
||||
// const run_exe = b.step(b.fmt("run-{s}", .{self.name}), "runs the program");
|
||||
// run_exe.dependOn(&runArtifact.step);
|
||||
}
|
||||
|
||||
// 2. create the actual library that the loader will try to load
|
||||
|
||||
// 3. set up linking, if static then we will link against the loader
|
||||
|
||||
self.buildSystem.b.installArtifact(exe);
|
||||
|
||||
// return the actual library not the loader
|
||||
return exe;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -314,6 +314,7 @@ pub fn start_module_(map: *SpecVariantMap, args: anytype, allocator: std.mem.All
|
|||
_ = try gEngine.createObject(scene.SceneSystem, .{ .can_tick = true });
|
||||
|
||||
try algorithm.string_pool.setup(allocator);
|
||||
gEngine.stringContext = algorithm.string_pool.gStringContext;
|
||||
|
||||
_ = try createObject(GameObjectSystem, .{ .can_tick = true });
|
||||
_ = try inputs.initInputStack();
|
||||
|
|
@ -328,6 +329,7 @@ pub fn setupFromModule(__args: ModuleLoaderArgs) !void {
|
|||
gEngine = __args.engine;
|
||||
gPackerFS = __args.packerFS;
|
||||
algorithm.names.gRegistry = __args.nameRegistry;
|
||||
algorithm.string_pool.gStringContext = gEngine.stringContext;
|
||||
logging.setupLoggingFromModule();
|
||||
staticsInitialized = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ pub const Engine = struct {
|
|||
first: bool = true,
|
||||
|
||||
shutdownModuleFunction: ?*const fn () callconv(.c) void = null,
|
||||
stringContext: *core.algorithm.string_pool.StringContext = undefined,
|
||||
|
||||
pub fn init(allocator: std.mem.Allocator) !@This() {
|
||||
const rv = Engine{
|
||||
|
|
|
|||
|
|
@ -110,9 +110,9 @@ pub fn startEngine(spec: *core.SpecVariantMap) bool {
|
|||
|
||||
if (core.getEngine().shutdownModuleFunction) |f| {
|
||||
f();
|
||||
}
|
||||
|
||||
} else {
|
||||
core.shutdown_module(allocator);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -144,4 +144,10 @@ pub fn main() !void {
|
|||
|
||||
// panickers.attachSegfaultHandler();
|
||||
// try realMain.main();
|
||||
|
||||
shutdown_hook();
|
||||
}
|
||||
|
||||
pub fn shutdown_hook() void {
|
||||
std.debug.print("[engine] shutting down now! goodbye!", .{});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ pub export fn shutdown_module() void {
|
|||
|
||||
shutdownList.deinit(gAllocator);
|
||||
shutdownModuleNames.deinit(gAllocator);
|
||||
|
||||
core.shutdown_module(gAllocator);
|
||||
}
|
||||
|
||||
const gamespec = @import("gamespec");
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ const std = @import("std");
|
|||
// main purpose of this string-pool is to provide an RC-ableinterface for interface
|
||||
// with GC'ed systems such as lua
|
||||
|
||||
var gStringContext: *StringContext = undefined;
|
||||
pub var gStringContext: *StringContext = undefined;
|
||||
|
||||
pub const String = struct {
|
||||
index: u24,
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ pub fn build(b: *std.Build) void {
|
|||
"coreTest",
|
||||
);
|
||||
coreTest.setIconPath("projects/content/icons/icon.ico");
|
||||
coreTest.setModuleEnabled("audio", true);
|
||||
coreTest.setModuleEnabled("imgui", true);
|
||||
coreTest.setModuleEnabled("net", true);
|
||||
coreTest.setModuleEnabled("physics", true);
|
||||
coreTest.setModuleEnabled("ui", true);
|
||||
// coreTest.setModuleEnabled("audio", true);
|
||||
// coreTest.setModuleEnabled("imgui", true);
|
||||
// coreTest.setModuleEnabled("net", true);
|
||||
// coreTest.setModuleEnabled("physics", true);
|
||||
// coreTest.setModuleEnabled("ui", true);
|
||||
_ = coreTest.compileInstall();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue