Skip to content

armgit / gecko

Public Imported from GitHub
0

A GameCube/Wii emulator and debugger written in Rust.

updated scripting (luau+jit) and added docker for web

Layle394c89e29aaa
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..4b78373
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,18 @@
+submodules/gcwii-resources/
+submodules/lilyskategc/
+.claude/
+private/
+target/
+_site/
+docs/
+.git/
+*.svg
+*.iso
+*.gcm
+*.wbfs
+*.rvz
+*.dol
+*.bin
+*.log
+*.txt
+perf.*
\ No newline at end of file
diff --git a/Cargo.lock b/Cargo.lock
index aa0c656..7bcc4b0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1035,6 +1035,12 @@ dependencies = [
"syn",
]
+[[package]]
+name = "env_home"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c7f84e12ccf0a7ddc17a6c41c93326024c42920d7ee630d04950e6926645c0fe"
+
[[package]]
name = "epaint"
version = "0.33.3"
@@ -1941,6 +1947,34 @@ dependencies = [
"logos-codegen",
]
+[[package]]
+name = "lua-src"
+version = "547.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1edaf29e3517b49b8b746701e5648ccb5785cde1c119062cbabbc5d5cd115e42"
+dependencies = [
+ "cc",
+]
+
+[[package]]
+name = "luajit-src"
+version = "210.5.12+a4f56a4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b3a8e7962a5368d5f264d045a5a255e90f9aa3fc1941ae15a8d2940d42cac671"
+dependencies = [
+ "cc",
+ "which",
+]
+
+[[package]]
+name = "luau0-src"
+version = "0.12.3+luau663"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "76ae337c644bbf86a8d8e9ce3ee023311833d41741baf5e51acc31b37843aba1"
+dependencies = [
+ "cc",
+]
+
[[package]]
name = "malloc_buf"
version = "0.0.6"
@@ -2007,6 +2041,7 @@ checksum = "c1f5f8fbebc7db5f671671134b9321c4b9aa9adeafccfd9a8c020ae45c6a35d0"
dependencies = [
"bstr",
"either",
+ "libloading",
"mlua-sys",
"num-traits",
"parking_lot",
@@ -2022,6 +2057,9 @@ checksum = "380c1f7e2099cafcf40e51d3a9f20a346977587aa4d012eae1f043149a728a93"
dependencies = [
"cc",
"cfg-if",
+ "lua-src",
+ "luajit-src",
+ "luau0-src",
"pkg-config",
]
@@ -4094,6 +4132,18 @@ dependencies = [
"num-traits",
]
+[[package]]
+name = "which"
+version = "7.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24d643ce3fd3e5b54854602a080f34fb10ab75e0b813ee32d00ca2b44fa74762"
+dependencies = [
+ "either",
+ "env_home",
+ "rustix 1.1.4",
+ "winsafe",
+]
+
[[package]]
name = "winapi"
version = "0.3.9"
@@ -4461,6 +4511,12 @@ dependencies = [
"memchr",
]
+[[package]]
+name = "winsafe"
+version = "0.0.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904"
+
[[package]]
name = "wit-bindgen"
version = "0.51.0"
diff --git a/Cargo.toml b/Cargo.toml
index 8e5bf36..76ad98c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -44,6 +44,7 @@ egui-winit = { git = "https://github.com/ioncodes/egui.git" }
[profile.release]
codegen-units = 1
lto = "fat"
+debug = true
[profile.dev]
opt-level = 3
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..7ed69e5
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,22 @@
+FROM rust:latest AS builder
+
+RUN apt-get update && apt-get install -y clang lld --no-install-recommends && rm -rf /var/lib/apt/lists/* \
+ && rustup target add wasm32-unknown-unknown \
+ && curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
+
+WORKDIR /app
+COPY . .
+
+RUN wasm-pack build crates/web --target web --out-dir pkg --release \
+ && wasm-pack build crates/web --target web --out-dir pkg-dbg --release -- --features debug
+
+RUN mkdir -p /site/dbg /site/pkg /site/pkg-dbg \
+ && cp crates/web/index.html /site/ \
+ && cp -r crates/web/pkg/* /site/pkg/ \
+ && cp crates/web/index.html /site/dbg/ \
+ && sed -i 's|./pkg/gecko_web.js|../pkg-dbg/gecko_web.js|' /site/dbg/index.html \
+ && cp -r crates/web/pkg-dbg/* /site/pkg-dbg/
+
+FROM nginx:alpine
+COPY --from=builder /site /usr/share/nginx/html
+EXPOSE 80
diff --git a/crates/scripting/Cargo.toml b/crates/scripting/Cargo.toml
index e78b412..249bb2f 100644
--- a/crates/scripting/Cargo.toml
+++ b/crates/scripting/Cargo.toml
@@ -8,5 +8,5 @@ hooks-mut-traps = ["gecko/hooks-mut-traps"]
[dependencies]
gecko = { path = "../gecko", features = ["hooks"] }
-mlua = { version = "0.10.5", features = ["lua54", "send"] }
+mlua = { version = "0.10.5", features = ["luau-jit", "send", "vendored"] }
tracing = "0.1.44"
diff --git a/crates/scripting/src/lib.rs b/crates/scripting/src/lib.rs
index df078f3..ab275ef 100644
--- a/crates/scripting/src/lib.rs
+++ b/crates/scripting/src/lib.rs
@@ -426,10 +426,8 @@ fn load_bus_dispatch(lua: &Lua, trap_root: Option<&Table>, trap_name: &str) -> L
fn parse_address_key(value: Value, context: &str) -> LuaResult<u32> {
match value {
- Value::Integer(address) if (0..=u32::MAX as i64).contains(&address) => Ok(address as u32),
- Value::Number(address)
- if address.is_finite() && address.fract() == 0.0 && (0.0..=u32::MAX as f64).contains(&address) =>
- {
+ Value::Integer(address) if address >= 0 => Ok(address as u32),
+ Value::Number(address) if address.fract() == 0.0 && (0.0..=u32::MAX as f64).contains(&address) => {
Ok(address as u32)
}
other => Err(mlua::Error::runtime(format!(