You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var libName = pkgName.replaceAll('-', '_') + '.wasm';
75
-
if (!(libName in LDSO.loadedLibsByName)) {
80
+
let script = std::ffi::CString::new(format!(
81
+
r#"var pkgName = '{}';
82
+
var snakePkgName = pkgName.replaceAll('-', '_');
83
+
var libName = {};
84
+
if (!(libName in LDSO.loadedLibsByName)) {{
76
85
// Always print to console, even if the error is suppressed.
77
-
console.error(`godot-rust could not find the Wasm module '${libName}', needed to load the '${pkgName}' crate. Please ensure a file named '${libName}' exists in the game's web export files. This may require updating Wasm paths in the crate's corresponding '.gdextension' file, or just renaming the Wasm file to the correct name otherwise.`);
78
-
throw new Error(`Wasm module '${libName}' not found. Check the console for more information.`);
79
-
}
86
+
console.error(`godot-rust could not find the Wasm module '${{libName}}', needed to load the '${{pkgName}}' crate. Please ensure a file named '${{libName}}' exists in the game's web export files. This may require updating Wasm paths in the crate's corresponding '.gdextension' file, or just renaming the Wasm file to the correct name otherwise.`);
87
+
throw new Error(`Wasm module '${{libName}}' not found. Check the console for more information.`);
88
+
}}
80
89
var dso = LDSO.loadedLibsByName[libName];
81
90
// This property was renamed as of emscripten 3.1.34
82
91
var dso_exports = "module" in dso ? dso["module"] : dso["exports"];
83
92
var registrants = [];
84
-
for (sym in dso_exports) {
85
-
if (sym.startsWith("dynCall_")) {
86
-
if (!(sym in Module)) {
87
-
console.log(`Patching Module with ${sym}`);
93
+
for (sym in dso_exports) {{
94
+
if (sym.startsWith("dynCall_")) {{
95
+
if (!(sym in Module)) {{
96
+
console.log(`Patching Module with ${{sym}}`);
88
97
Module[sym] = dso_exports[sym];
89
-
}
90
-
} else if (sym.startsWith("__godot_rust_registrant_")) {
98
+
}}
99
+
}} else if (sym.startsWith("__godot_rust_registrant_")) {{
91
100
registrants.push(sym);
92
-
}
93
-
}
94
-
for (sym of registrants) {
95
-
console.log(`Running registrant ${sym}`);
101
+
}}
102
+
}}
103
+
for (sym of registrants) {{
104
+
console.log(`Running registrant ${{sym}}`);
96
105
dso_exports[sym]();
97
-
}
106
+
}}
98
107
console.log("Added", registrants.length, "plugins to registry!");
99
-
"#)).expect("Unable to create CString from script");
108
+
"#, env!("CARGO_PKG_NAME"), #wasm_binary)).expect("Unable to create CString from script");
0 commit comments