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)) {
89
+
let script = format!(
90
+
r#"var pkgName = '{pkg_name}';
91
+
var snakePkgName = pkgName.replaceAll('-', '_');
92
+
var libName = {wasm_binary};
93
+
if (!(libName in LDSO.loadedLibsByName)) {{
76
94
// 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
-
}
95
+
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.`);
96
+
throw new Error(`Wasm module '${{libName}}' not found. Check the console for more information.`);
97
+
}}
80
98
var dso = LDSO.loadedLibsByName[libName];
81
99
// This property was renamed as of emscripten 3.1.34
82
100
var dso_exports = "module" in dso ? dso["module"] : dso["exports"];
83
101
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}`);
102
+
for (sym in dso_exports) {{
103
+
if (sym.startsWith("dynCall_")) {{
104
+
if (!(sym in Module)) {{
105
+
console.log(`Patching Module with ${{sym}}`);
88
106
Module[sym] = dso_exports[sym];
89
-
}
90
-
} else if (sym.startsWith("__godot_rust_registrant_")) {
107
+
}}
108
+
}} else if (sym.startsWith("__godot_rust_registrant_")) {{
91
109
registrants.push(sym);
92
-
}
93
-
}
94
-
for (sym of registrants) {
95
-
console.log(`Running registrant ${sym}`);
110
+
}}
111
+
}}
112
+
for (sym of registrants) {{
113
+
console.log(`Running registrant ${{sym}}`);
96
114
dso_exports[sym]();
97
-
}
115
+
}}
98
116
console.log("Added", registrants.length, "plugins to registry!");
99
-
"#)).expect("Unable to create CString from script");
117
+
"#);
118
+
119
+
let script = std::ffi::CString::new(script).expect("Unable to create CString from script");
0 commit comments