mirror of
https://github.com/SupernaviX/vvb.git
synced 2024-11-23 05:49:57 +00:00
Update all dependencies
This commit is contained in:
parent
62b0190a8c
commit
54ea614d60
172
Cargo.lock
generated
172
Cargo.lock
generated
@ -4,9 +4,9 @@ version = 3
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aho-corasick"
|
name = "aho-corasick"
|
||||||
version = "0.7.19"
|
version = "0.7.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e"
|
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
@ -19,21 +19,21 @@ checksum = "85965b6739a430150bdd138e2374a98af0c3ee0d030b3bb7fc3bddff58d0102e"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "android_logger"
|
name = "android_logger"
|
||||||
version = "0.10.1"
|
version = "0.11.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d9ed09b18365ed295d722d0b5ed59c01b79a826ff2d2a8f73d5ecca8e6fb2f66"
|
checksum = "8619b80c242aa7bd638b5c7ddd952addeecb71f69c75e33f1d47b2804f8f883a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android_log-sys",
|
"android_log-sys",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"lazy_static",
|
|
||||||
"log",
|
"log",
|
||||||
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.65"
|
version = "1.0.70"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602"
|
checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "approx"
|
name = "approx"
|
||||||
@ -46,9 +46,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "array-init"
|
name = "array-init"
|
||||||
version = "2.0.1"
|
version = "2.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bfb6d71005dc22a708c7496eee5c8dc0300ee47355de6256c3b35b12b5fef596"
|
checksum = "3d62b7694a562cdf5a74227903507c56ab2cc8bdd1f781ed5cb4cf9c9f810bfc"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
@ -58,21 +58,15 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytes"
|
name = "bytes"
|
||||||
version = "1.2.1"
|
version = "1.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db"
|
checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cache-padded"
|
|
||||||
version = "1.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.73"
|
version = "1.0.79"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
|
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"jobserver",
|
"jobserver",
|
||||||
]
|
]
|
||||||
@ -101,14 +95,31 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ciborium"
|
name = "ciborium"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "de6836a1b6197d8acdaac74a01af077a26aa6953d2e9251eef061c646b0d432c"
|
checksum = "b0c137568cc60b904a7724001b35ce2630fd00d5d84805fbb608ab89509d788f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"half",
|
"ciborium-io",
|
||||||
|
"ciborium-ll",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ciborium-io"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "346de753af073cc87b52b2083a506b38ac176a44cfb05497b622e27be899b369"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ciborium-ll"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "213030a2b5a4e0c0892b6652260cf6ccac84827b83a85a534e178e3906c4cf1b"
|
||||||
|
dependencies = [
|
||||||
|
"ciborium-io",
|
||||||
|
"half",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "combine"
|
name = "combine"
|
||||||
version = "4.6.6"
|
version = "4.6.6"
|
||||||
@ -120,10 +131,19 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "env_logger"
|
name = "crossbeam-utils"
|
||||||
version = "0.8.4"
|
version = "0.8.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3"
|
checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "env_logger"
|
||||||
|
version = "0.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"regex",
|
"regex",
|
||||||
@ -148,9 +168,9 @@ checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jni"
|
name = "jni"
|
||||||
version = "0.19.0"
|
version = "0.20.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec"
|
checksum = "039022cdf4d7b1cf548d31f60ae783138e5fd42013f6271049d7df7afadef96c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cesu8",
|
"cesu8",
|
||||||
"combine",
|
"combine",
|
||||||
@ -168,9 +188,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jobserver"
|
name = "jobserver"
|
||||||
version = "0.1.25"
|
version = "0.1.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b"
|
checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
@ -181,17 +201,11 @@ version = "3.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
|
checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "lazy_static"
|
|
||||||
version = "1.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.135"
|
version = "0.2.140"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c"
|
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
@ -216,7 +230,7 @@ checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -249,34 +263,40 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "paste"
|
name = "once_cell"
|
||||||
version = "1.0.9"
|
version = "1.17.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1"
|
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "paste"
|
||||||
|
version = "1.0.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.47"
|
version = "1.0.53"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
|
checksum = "ba466839c78239c09faf015484e5cc04860f88242cff4d03eb038f04b4699b73"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.21"
|
version = "1.0.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
|
checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "1.6.0"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
|
checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"memchr",
|
"memchr",
|
||||||
@ -285,17 +305,17 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
version = "0.6.27"
|
version = "0.6.29"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
|
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ringbuf"
|
name = "ringbuf"
|
||||||
version = "0.2.8"
|
version = "0.3.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f65af18d50f789e74aaf23bbb3f65dcd22a3cb6e029b5bced149f6bd57c5c2a2"
|
checksum = "93ca10b9c9e53ac855a2d6953bce34cef6edbac32c4b13047a4d59d67299420a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cache-padded",
|
"crossbeam-utils",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -309,38 +329,49 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.145"
|
version = "1.0.158"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b"
|
checksum = "771d4d9c4163ee138805e12c710dd365e4f44be8be0503cb1bb9eb989425d9c9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_bytes"
|
name = "serde_bytes"
|
||||||
version = "0.11.7"
|
version = "0.11.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cfc50e8183eeeb6178dcb167ae34a8051d63535023ae38b5d8d12beae193d37b"
|
checksum = "416bda436f9aab92e02c8e10d49a15ddd339cea90b6e340fe51ed97abb548294"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.145"
|
version = "1.0.158"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c"
|
checksum = "e801c1712f48475582b7696ac71e0ca34ebb30e09338425384269d9717c62cad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.10",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.102"
|
version = "1.0.109"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1"
|
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "2.0.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5aad1363ed6d37b84299588d62d3a7d95b5a5c2d9aad5c85609fda12afaa1f40"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -349,29 +380,29 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "1.0.37"
|
version = "1.0.40"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e"
|
checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl",
|
"thiserror-impl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "1.0.37"
|
version = "1.0.40"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb"
|
checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.10",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.5"
|
version = "1.0.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
|
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vvb"
|
name = "vvb"
|
||||||
@ -397,12 +428,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "walkdir"
|
name = "walkdir"
|
||||||
version = "2.3.2"
|
version = "2.3.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
|
checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"same-file",
|
"same-file",
|
||||||
"winapi",
|
|
||||||
"winapi-util",
|
"winapi-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -6,16 +6,16 @@ edition = "2021"
|
|||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
android_logger = "0.10.1"
|
android_logger = "0.11.1"
|
||||||
anyhow = "1.0.43"
|
anyhow = "1.0.43"
|
||||||
array-init = "2.0.0"
|
array-init = "2.0.0"
|
||||||
ciborium = "0.1.0"
|
ciborium = "0.2.0"
|
||||||
cgmath = "0.18.0"
|
cgmath = "0.18.0"
|
||||||
jni = "0.19.0"
|
jni = "0.20.0"
|
||||||
log = { version = "0.4.14", features = ["max_level_info"] }
|
log = { version = "0.4.14", features = ["max_level_info"] }
|
||||||
num-traits = "0.2.14"
|
num-traits = "0.2.14"
|
||||||
paste = "1.0.5"
|
paste = "1.0.5"
|
||||||
ringbuf = "0.2.6"
|
ringbuf = "0.3.1"
|
||||||
serde = "1.0.130"
|
serde = "1.0.130"
|
||||||
serde_bytes = "0.11.5"
|
serde_bytes = "0.11.5"
|
||||||
serde_derive = "1.0.130"
|
serde_derive = "1.0.130"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application'
|
id 'com.android.application'
|
||||||
id 'kotlin-android'
|
id 'org.jetbrains.kotlin.android'
|
||||||
id 'org.jetbrains.kotlin.plugin.serialization' version "$kotlin_version"
|
id 'org.jetbrains.kotlin.plugin.serialization' version "$kotlin_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,9 +55,6 @@ android {
|
|||||||
jniLibs.srcDirs = ['./../distribution/leia_sdk/lib']
|
jniLibs.srcDirs = ['./../distribution/leia_sdk/lib']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
packagingOptions {
|
|
||||||
pickFirst "**/lib/**"
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.simongellis.vvb"
|
applicationId "com.simongellis.vvb"
|
||||||
@ -100,20 +97,23 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aaptOptions {
|
|
||||||
noCompress "vb"
|
|
||||||
}
|
|
||||||
|
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
pickFirst 'app'
|
|
||||||
jniLibs {
|
jniLibs {
|
||||||
// https://issuetracker.google.com/issues/147096055#comment3
|
// https://issuetracker.google.com/issues/147096055#comment3
|
||||||
useLegacyPackaging = true
|
useLegacyPackaging = true
|
||||||
|
pickFirsts += ['**/lib/**']
|
||||||
|
}
|
||||||
|
resources {
|
||||||
|
pickFirsts += ['**/lib/**', 'app']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ndkVersion = "22.1.7171670"
|
ndkVersion = "22.1.7171670"
|
||||||
namespace 'com.simongellis.vvb'
|
namespace 'com.simongellis.vvb'
|
||||||
|
androidResources {
|
||||||
|
noCompress 'vb'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'org.mozilla.rust-android-gradle.rust-android'
|
apply plugin: 'org.mozilla.rust-android-gradle.rust-android'
|
||||||
@ -170,16 +170,16 @@ dependencies {
|
|||||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||||
implementation project(':cardboard-sdk')
|
implementation project(':cardboard-sdk')
|
||||||
implementation 'androidx.core:core-ktx:1.9.0'
|
implementation 'androidx.core:core-ktx:1.9.0'
|
||||||
implementation 'androidx.appcompat:appcompat:1.5.1'
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
implementation "androidx.preference:preference-ktx:1.2.0"
|
implementation "androidx.preference:preference-ktx:1.2.0"
|
||||||
implementation "androidx.recyclerview:recyclerview:1.2.1"
|
implementation "androidx.recyclerview:recyclerview:1.3.0"
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||||
|
|
||||||
// lifecycle things
|
// lifecycle things
|
||||||
def lifecycleVersion = '2.5.1'
|
def lifecycleVersion = '2.6.1'
|
||||||
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion"
|
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion"
|
||||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"
|
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"
|
||||||
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion"
|
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = "1.7.10"
|
ext.kotlin_version = "1.8.0"
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@ -9,7 +9,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.2.2'
|
classpath 'com.android.tools.build:gradle:7.4.2'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
classpath "org.mozilla.rust-android-gradle:plugin:0.9.3"
|
classpath "org.mozilla.rust-android-gradle:plugin:0.9.3"
|
||||||
|
|
||||||
|
2
build.rs
2
build.rs
@ -5,7 +5,7 @@ use std::{env, fs::File, path::Path};
|
|||||||
fn main() {
|
fn main() {
|
||||||
let out_dir = env::var("OUT_DIR").unwrap();
|
let out_dir = env::var("OUT_DIR").unwrap();
|
||||||
let dest = Path::new(&out_dir);
|
let dest = Path::new(&out_dir);
|
||||||
let mut file = File::create(&dest.join("gl_bindings.rs")).unwrap();
|
let mut file = File::create(dest.join("gl_bindings.rs")).unwrap();
|
||||||
let reg = Registry::new(Api::Gles2, (2, 0), Profile::Core, Fallbacks::All, []);
|
let reg = Registry::new(Api::Gles2, (2, 0), Profile::Core, Fallbacks::All, []);
|
||||||
|
|
||||||
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
|
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
||||||
|
20
src/audio.rs
20
src/audio.rs
@ -31,14 +31,14 @@ pub mod jni {
|
|||||||
use crate::jni_helpers::EnvExtensions;
|
use crate::jni_helpers::EnvExtensions;
|
||||||
use crate::{jni_func, jni_helpers};
|
use crate::{jni_func, jni_helpers};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use jni::sys::jobject;
|
use jni::objects::JObject;
|
||||||
use jni::JNIEnv;
|
use jni::JNIEnv;
|
||||||
|
|
||||||
fn get_audio<'a>(env: &'a JNIEnv, this: jobject) -> jni_helpers::JavaGetResult<'a, Audio> {
|
fn get_audio<'a>(env: &'a JNIEnv, this: JObject<'a>) -> jni_helpers::JavaGetResult<'a, Audio> {
|
||||||
jni_helpers::java_get(env, this)
|
jni_helpers::java_get(env, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_settings(env: &JNIEnv, this: jobject) -> Result<Settings> {
|
fn get_settings(env: &JNIEnv, this: JObject) -> Result<Settings> {
|
||||||
let volume = env.get_percent(this, "volume")?;
|
let volume = env.get_percent(this, "volume")?;
|
||||||
let buffer_size = env.get_int(this, "bufferSize")?;
|
let buffer_size = env.get_int(this, "bufferSize")?;
|
||||||
|
|
||||||
@ -48,12 +48,12 @@ pub mod jni {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(Audio_nativeConstructor, constructor, jobject, jobject);
|
jni_func!(Audio_nativeConstructor, constructor, JObject, JObject);
|
||||||
fn constructor(
|
fn constructor(
|
||||||
env: &JNIEnv,
|
env: &JNIEnv,
|
||||||
this: jobject,
|
this: JObject,
|
||||||
emulator: jobject,
|
emulator: JObject,
|
||||||
settings: jobject,
|
settings: JObject,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let mut emulator = jni_helpers::java_get::<Emulator>(env, emulator)?;
|
let mut emulator = jni_helpers::java_get::<Emulator>(env, emulator)?;
|
||||||
let settings = get_settings(env, settings)?;
|
let settings = get_settings(env, settings)?;
|
||||||
@ -62,18 +62,18 @@ pub mod jni {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(Audio_nativeDestructor, destructor);
|
jni_func!(Audio_nativeDestructor, destructor);
|
||||||
fn destructor(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn destructor(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
jni_helpers::java_take::<Audio>(env, this)
|
jni_helpers::java_take::<Audio>(env, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(Audio_nativeStart, start);
|
jni_func!(Audio_nativeStart, start);
|
||||||
fn start(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn start(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
let mut this = get_audio(env, this)?;
|
let mut this = get_audio(env, this)?;
|
||||||
this.start()
|
this.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(Audio_nativeStop, stop);
|
jni_func!(Audio_nativeStop, stop);
|
||||||
fn stop(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn stop(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
let mut this = get_audio(env, this)?;
|
let mut this = get_audio(env, this)?;
|
||||||
this.stop()
|
this.stop()
|
||||||
}
|
}
|
||||||
|
@ -20,30 +20,31 @@ pub mod jni {
|
|||||||
use crate::emulator::Emulator;
|
use crate::emulator::Emulator;
|
||||||
use crate::{jni_func, jni_helpers};
|
use crate::{jni_func, jni_helpers};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use jni::sys::{jint, jobject};
|
use jni::objects::JObject;
|
||||||
|
use jni::sys::jint;
|
||||||
use jni::JNIEnv;
|
use jni::JNIEnv;
|
||||||
|
|
||||||
fn get_controller<'a>(
|
fn get_controller<'a>(
|
||||||
env: &'a JNIEnv,
|
env: &'a JNIEnv,
|
||||||
this: jobject,
|
this: JObject<'a>,
|
||||||
) -> jni_helpers::JavaGetResult<'a, Controller> {
|
) -> jni_helpers::JavaGetResult<'a, Controller> {
|
||||||
jni_helpers::java_get(env, this)
|
jni_helpers::java_get(env, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(Controller_nativeConstructor, constructor, jobject);
|
jni_func!(Controller_nativeConstructor, constructor, JObject);
|
||||||
fn constructor(env: &JNIEnv, this: jobject, emulator: jobject) -> Result<()> {
|
fn constructor(env: &JNIEnv, this: JObject, emulator: JObject) -> Result<()> {
|
||||||
let mut emulator = jni_helpers::java_get::<Emulator>(env, emulator)?;
|
let mut emulator = jni_helpers::java_get::<Emulator>(env, emulator)?;
|
||||||
let controller = Controller::new(emulator.claim_controller_state());
|
let controller = Controller::new(emulator.claim_controller_state());
|
||||||
jni_helpers::java_init(env, this, controller)
|
jni_helpers::java_init(env, this, controller)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(Controller_nativeDestructor, destructor);
|
jni_func!(Controller_nativeDestructor, destructor);
|
||||||
fn destructor(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn destructor(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
jni_helpers::java_take::<Controller>(env, this)
|
jni_helpers::java_take::<Controller>(env, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(Controller_nativeUpdate, update, jint);
|
jni_func!(Controller_nativeUpdate, update, jint);
|
||||||
fn update(env: &JNIEnv, this: jobject, state: jint) -> Result<()> {
|
fn update(env: &JNIEnv, this: JObject, state: jint) -> Result<()> {
|
||||||
let mut this = get_controller(env, this)?;
|
let mut this = get_controller(env, this)?;
|
||||||
this.update(state as u16);
|
this.update(state as u16);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
use crate::emulator::memory::Memory;
|
use crate::emulator::memory::Memory;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use ringbuf::{Consumer, Producer, RingBuffer};
|
use ringbuf::HeapRb;
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
type Producer<T> = ringbuf::Producer<T, Arc<HeapRb<T>>>;
|
||||||
|
type Consumer<T> = ringbuf::Consumer<T, Arc<HeapRb<T>>>;
|
||||||
|
|
||||||
const CPU_CYCLES_PER_FRAME: u64 = 480;
|
const CPU_CYCLES_PER_FRAME: u64 = 480;
|
||||||
const FRAMES_PER_SECOND: f32 = 20_000_000. / (CPU_CYCLES_PER_FRAME as f32);
|
const FRAMES_PER_SECOND: f32 = 20_000_000. / (CPU_CYCLES_PER_FRAME as f32);
|
||||||
@ -19,16 +23,12 @@ const ANALOG_FILTER_RC_CONSTANT: f32 = 0.022;
|
|||||||
const ANALOG_FILTER_DECAY_RATE: f32 =
|
const ANALOG_FILTER_DECAY_RATE: f32 =
|
||||||
ANALOG_FILTER_RC_CONSTANT / (ANALOG_FILTER_RC_CONSTANT + 1. / FRAMES_PER_SECOND);
|
ANALOG_FILTER_RC_CONSTANT / (ANALOG_FILTER_RC_CONSTANT + 1. / FRAMES_PER_SECOND);
|
||||||
|
|
||||||
#[derive(Copy, Clone, Serialize, Deserialize, Debug)]
|
#[derive(Copy, Clone, Serialize, Deserialize, Debug, Default)]
|
||||||
enum Direction {
|
enum Direction {
|
||||||
|
#[default]
|
||||||
Decay,
|
Decay,
|
||||||
Grow,
|
Grow,
|
||||||
}
|
}
|
||||||
impl Default for Direction {
|
|
||||||
fn default() -> Self {
|
|
||||||
Direction::Decay
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Serialize, Deserialize)]
|
||||||
enum ChannelType {
|
enum ChannelType {
|
||||||
@ -127,16 +127,12 @@ impl Envelope {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Serialize, Deserialize, Debug)]
|
#[derive(Copy, Clone, Serialize, Deserialize, Debug, Default)]
|
||||||
enum ModFunction {
|
enum ModFunction {
|
||||||
|
#[default]
|
||||||
Sweep,
|
Sweep,
|
||||||
Modulation,
|
Modulation,
|
||||||
}
|
}
|
||||||
impl Default for ModFunction {
|
|
||||||
fn default() -> Self {
|
|
||||||
ModFunction::Sweep
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Serialize, Deserialize, Default)]
|
#[derive(Copy, Clone, Serialize, Deserialize, Default)]
|
||||||
struct Modification {
|
struct Modification {
|
||||||
@ -500,7 +496,7 @@ impl AudioController {
|
|||||||
|
|
||||||
pub fn claim_player(&mut self, volume: f32, buffer_size: usize) -> AudioPlayer {
|
pub fn claim_player(&mut self, volume: f32, buffer_size: usize) -> AudioPlayer {
|
||||||
let capacity = buffer_size * 833;
|
let capacity = buffer_size * 833;
|
||||||
let buffer = RingBuffer::new(capacity);
|
let buffer = HeapRb::new(capacity);
|
||||||
let (producer, consumer) = buffer.split();
|
let (producer, consumer) = buffer.split();
|
||||||
self.buffer = Some(producer);
|
self.buffer = Some(producer);
|
||||||
AudioPlayer {
|
AudioPlayer {
|
||||||
|
@ -320,7 +320,7 @@ impl<'a> CpuProcess<'a> {
|
|||||||
{
|
{
|
||||||
let instr = self.read_pc();
|
let instr = self.read_pc();
|
||||||
let opcode = (instr >> 10) & 0x003F;
|
let opcode = (instr >> 10) & 0x003F;
|
||||||
if (instr as u16) & 0xe000 == 0x8000 {
|
if instr & 0xe000 == 0x8000 {
|
||||||
self.bcond(instr);
|
self.bcond(instr);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ impl Hardware {
|
|||||||
|
|
||||||
fn read_timer(&self) -> u16 {
|
fn read_timer(&self) -> u16 {
|
||||||
let memory = self.memory.borrow();
|
let memory = self.memory.borrow();
|
||||||
(memory.read_halfword(THR) as u16) << 8 | memory.read_halfword(TLR) as u16
|
memory.read_halfword(THR) << 8 | memory.read_halfword(TLR)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_timer(&self, value: u16) {
|
fn write_timer(&self, value: u16) {
|
||||||
|
@ -88,7 +88,7 @@ impl Emulator {
|
|||||||
info!("Resetting hardware module...");
|
info!("Resetting hardware module...");
|
||||||
self.hardware.borrow_mut().init();
|
self.hardware.borrow_mut().init();
|
||||||
let memory = self.memory.borrow();
|
let memory = self.memory.borrow();
|
||||||
log::debug!(
|
debug!(
|
||||||
"{:04x} {:04x} {:04x} {:04x} {:04x} {:04x} {:04x} {:04x}",
|
"{:04x} {:04x} {:04x} {:04x} {:04x} {:04x} {:04x} {:04x}",
|
||||||
memory.read_halfword(0xfffffff0),
|
memory.read_halfword(0xfffffff0),
|
||||||
memory.read_halfword(0xfffffff2),
|
memory.read_halfword(0xfffffff2),
|
||||||
@ -252,42 +252,42 @@ impl EventHandler for EmulatorEventHandler {
|
|||||||
#[rustfmt::skip::macros(jni_func)]
|
#[rustfmt::skip::macros(jni_func)]
|
||||||
pub mod jni {
|
pub mod jni {
|
||||||
use super::Emulator;
|
use super::Emulator;
|
||||||
use crate::{jni_func, jni_helpers};
|
use crate::{jni_func, jni_helpers, EnvExtensions};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use jni::objects::{JByteBuffer, JString};
|
use jni::objects::{JByteBuffer, JObject, JString};
|
||||||
use jni::sys::{jint, jobject};
|
use jni::sys::jint;
|
||||||
use jni::JNIEnv;
|
use jni::JNIEnv;
|
||||||
use log::info;
|
use log::info;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
|
||||||
fn get_emulator<'a>(
|
fn get_emulator<'a>(
|
||||||
env: &'a JNIEnv,
|
env: &'a JNIEnv,
|
||||||
this: jobject,
|
this: JObject<'a>,
|
||||||
) -> jni_helpers::JavaGetResult<'a, Emulator> {
|
) -> jni_helpers::JavaGetResult<'a, Emulator> {
|
||||||
jni_helpers::java_get(env, this)
|
jni_helpers::java_get(env, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(Emulator_nativeConstructor, constructor);
|
jni_func!(Emulator_nativeConstructor, constructor);
|
||||||
fn constructor(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn constructor(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
jni_helpers::java_init(env, this, Emulator::new())
|
jni_helpers::java_init(env, this, Emulator::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(Emulator_nativeDestructor, destructor);
|
jni_func!(Emulator_nativeDestructor, destructor);
|
||||||
fn destructor(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn destructor(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
jni_helpers::java_take::<Emulator>(env, this)
|
jni_helpers::java_take::<Emulator>(env, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(Emulator_nativeLoadGamePak, load_game_pak, JByteBuffer, JByteBuffer);
|
jni_func!(Emulator_nativeLoadGamePak, load_game_pak, JByteBuffer, JByteBuffer);
|
||||||
fn load_game_pak(
|
fn load_game_pak(
|
||||||
env: &JNIEnv,
|
env: &JNIEnv,
|
||||||
this: jobject,
|
this: JObject,
|
||||||
rom: JByteBuffer,
|
rom: JByteBuffer,
|
||||||
sram: JByteBuffer,
|
sram: JByteBuffer,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
info!("Loading game pak");
|
info!("Loading game pak");
|
||||||
let rom = env.get_direct_buffer_address(rom)?;
|
let rom = env.get_direct_buffer(rom)?;
|
||||||
info!("ROM length: {} byte(s)", rom.len());
|
info!("ROM length: {} byte(s)", rom.len());
|
||||||
let sram = env.get_direct_buffer_address(sram)?;
|
let sram = env.get_direct_buffer(sram)?;
|
||||||
info!("SRAM length: {} byte(s)", sram.len());
|
info!("SRAM length: {} byte(s)", sram.len());
|
||||||
let mut this = get_emulator(env, this)?;
|
let mut this = get_emulator(env, this)?;
|
||||||
info!("Beginning game pak load...");
|
info!("Beginning game pak load...");
|
||||||
@ -295,7 +295,7 @@ pub mod jni {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(Emulator_nativeUnloadGamePak, unload_game_pak);
|
jni_func!(Emulator_nativeUnloadGamePak, unload_game_pak);
|
||||||
fn unload_game_pak(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn unload_game_pak(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
info!("Unloading game pak");
|
info!("Unloading game pak");
|
||||||
let mut this = get_emulator(env, this)?;
|
let mut this = get_emulator(env, this)?;
|
||||||
this.unload_game_pak();
|
this.unload_game_pak();
|
||||||
@ -303,7 +303,7 @@ pub mod jni {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(Emulator_nativeReset, reset);
|
jni_func!(Emulator_nativeReset, reset);
|
||||||
fn reset(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn reset(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
info!("Resetting game");
|
info!("Resetting game");
|
||||||
let mut this = get_emulator(env, this)?;
|
let mut this = get_emulator(env, this)?;
|
||||||
this.reset();
|
this.reset();
|
||||||
@ -311,20 +311,20 @@ pub mod jni {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(Emulator_nativeTick, tick, jint);
|
jni_func!(Emulator_nativeTick, tick, jint);
|
||||||
fn tick(env: &JNIEnv, this: jobject, nanoseconds: jint) -> Result<()> {
|
fn tick(env: &JNIEnv, this: JObject, nanoseconds: jint) -> Result<()> {
|
||||||
let mut this = get_emulator(env, this)?;
|
let mut this = get_emulator(env, this)?;
|
||||||
this.tick(nanoseconds as u64)
|
this.tick(nanoseconds as u64)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(Emulator_nativeReadSRAM, read_sram, JByteBuffer);
|
jni_func!(Emulator_nativeReadSRAM, read_sram, JByteBuffer);
|
||||||
fn read_sram(env: &JNIEnv, this: jobject, buffer: JByteBuffer) -> Result<()> {
|
fn read_sram(env: &JNIEnv, this: JObject, buffer: JByteBuffer) -> Result<()> {
|
||||||
let this = get_emulator(env, this)?;
|
let this = get_emulator(env, this)?;
|
||||||
let buffer = env.get_direct_buffer_address(buffer)?;
|
let buffer = env.get_direct_buffer(buffer)?;
|
||||||
this.read_sram(buffer)
|
this.read_sram(buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(Emulator_nativeSaveState, save_state, JString);
|
jni_func!(Emulator_nativeSaveState, save_state, JString);
|
||||||
fn save_state(env: &JNIEnv, this: jobject, filename: JString) -> Result<()> {
|
fn save_state(env: &JNIEnv, this: JObject, filename: JString) -> Result<()> {
|
||||||
info!("Saving...");
|
info!("Saving...");
|
||||||
let filename: String = env.get_string(filename)?.try_into()?;
|
let filename: String = env.get_string(filename)?.try_into()?;
|
||||||
let this = get_emulator(env, this)?;
|
let this = get_emulator(env, this)?;
|
||||||
@ -334,7 +334,7 @@ pub mod jni {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(Emulator_nativeLoadState, load_state, JString);
|
jni_func!(Emulator_nativeLoadState, load_state, JString);
|
||||||
fn load_state(env: &JNIEnv, this: jobject, filename: JString) -> Result<()> {
|
fn load_state(env: &JNIEnv, this: JObject, filename: JString) -> Result<()> {
|
||||||
info!("Loading...");
|
info!("Loading...");
|
||||||
let filename: String = env.get_string(filename)?.try_into()?;
|
let filename: String = env.get_string(filename)?.try_into()?;
|
||||||
let mut this = get_emulator(env, this)?;
|
let mut this = get_emulator(env, this)?;
|
||||||
@ -346,12 +346,12 @@ pub mod jni {
|
|||||||
jni_func!(Emulator_nativeLoadImage, load_image, JByteBuffer, JByteBuffer);
|
jni_func!(Emulator_nativeLoadImage, load_image, JByteBuffer, JByteBuffer);
|
||||||
fn load_image(
|
fn load_image(
|
||||||
env: &JNIEnv,
|
env: &JNIEnv,
|
||||||
this: jobject,
|
this: JObject,
|
||||||
left_eye: JByteBuffer,
|
left_eye: JByteBuffer,
|
||||||
right_eye: JByteBuffer,
|
right_eye: JByteBuffer,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let left_eye = env.get_direct_buffer_address(left_eye)?;
|
let left_eye = env.get_direct_buffer(left_eye)?;
|
||||||
let right_eye = env.get_direct_buffer_address(right_eye)?;
|
let right_eye = env.get_direct_buffer(right_eye)?;
|
||||||
let this = get_emulator(env, this)?;
|
let this = get_emulator(env, this)?;
|
||||||
this.load_image(left_eye, right_eye)
|
this.load_image(left_eye, right_eye)
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use jni::sys::jobject;
|
use jni::objects::{JByteBuffer, JObject};
|
||||||
use jni::JNIEnv;
|
use jni::JNIEnv;
|
||||||
use log::error;
|
use log::error;
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
use std::slice;
|
||||||
use std::sync::MutexGuard;
|
use std::sync::MutexGuard;
|
||||||
|
|
||||||
pub fn to_java_exception<T, E>(env: &JNIEnv, res: Result<T, E>)
|
pub fn to_java_exception<T, E>(env: &JNIEnv, res: Result<T, E>)
|
||||||
@ -17,7 +18,7 @@ where
|
|||||||
match env.throw(str) {
|
match env.throw(str) {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Throwing an error itself caused an error! {}", e);
|
error!("Throwing an error itself caused an error! {:?}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -27,45 +28,55 @@ where
|
|||||||
const POINTER_FIELD: &str = "_pointer";
|
const POINTER_FIELD: &str = "_pointer";
|
||||||
pub type JavaGetResult<'a, T> = Result<MutexGuard<'a, T>>;
|
pub type JavaGetResult<'a, T> = Result<MutexGuard<'a, T>>;
|
||||||
|
|
||||||
pub fn java_init<T: 'static + Send>(env: &JNIEnv, this: jobject, value: T) -> Result<()> {
|
pub fn java_init<T: 'static + Send>(env: &JNIEnv, this: JObject, value: T) -> Result<()> {
|
||||||
|
unsafe {
|
||||||
env.set_rust_field(this, POINTER_FIELD, value)?;
|
env.set_rust_field(this, POINTER_FIELD, value)?;
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
pub fn java_get<'a, T: 'static + Send>(env: &'a JNIEnv, this: jobject) -> JavaGetResult<'a, T> {
|
pub fn java_get<'a, T: 'static + Send>(env: &'a JNIEnv, this: JObject<'a>) -> JavaGetResult<'a, T> {
|
||||||
let res: MutexGuard<T> = env.get_rust_field(this, POINTER_FIELD)?;
|
let res: MutexGuard<T> = unsafe { env.get_rust_field(this, POINTER_FIELD)? };
|
||||||
Ok(res)
|
Ok(res)
|
||||||
}
|
}
|
||||||
pub fn java_take<T: 'static + Send>(env: &JNIEnv, this: jobject) -> Result<()> {
|
pub fn java_take<T: 'static + Send>(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
|
unsafe {
|
||||||
env.take_rust_field(this, POINTER_FIELD)?;
|
env.take_rust_field(this, POINTER_FIELD)?;
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
pub trait EnvExtensions {
|
pub trait EnvExtensions {
|
||||||
fn get_integet_value(&self, integer: jobject) -> Result<Option<i32>>;
|
fn get_integer_value(&self, integer: JObject) -> Result<Option<i32>>;
|
||||||
fn get_int(&self, this: jobject, field: &str) -> Result<i32>;
|
fn get_int(&self, this: JObject, field: &str) -> Result<i32>;
|
||||||
fn get_percent(&self, this: jobject, field: &str) -> Result<f32>;
|
fn get_percent(&self, this: JObject, field: &str) -> Result<f32>;
|
||||||
fn get_color(&self, this: jobject, field: &str) -> Result<(u8, u8, u8)>;
|
fn get_color(&self, this: JObject, field: &str) -> Result<(u8, u8, u8)>;
|
||||||
|
fn get_direct_buffer(&self, buf: JByteBuffer) -> Result<&mut [u8]>;
|
||||||
}
|
}
|
||||||
impl<'a> EnvExtensions for JNIEnv<'a> {
|
impl<'a> EnvExtensions for JNIEnv<'a> {
|
||||||
fn get_integet_value(&self, integer: jobject) -> Result<Option<i32>> {
|
fn get_integer_value(&self, integer: JObject) -> Result<Option<i32>> {
|
||||||
if integer.is_null() {
|
if integer.is_null() {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
let value = self.call_method(integer, "intValue", "()I", &[])?.i()?;
|
let value = self.call_method(integer, "intValue", "()I", &[])?.i()?;
|
||||||
Ok(Some(value))
|
Ok(Some(value))
|
||||||
}
|
}
|
||||||
fn get_int(&self, this: jobject, field: &str) -> Result<i32> {
|
fn get_int(&self, this: JObject, field: &str) -> Result<i32> {
|
||||||
let res = self.get_field(this, field, "I")?.i()?;
|
let res = self.get_field(this, field, "I")?.i()?;
|
||||||
Ok(res)
|
Ok(res)
|
||||||
}
|
}
|
||||||
fn get_percent(&self, this: jobject, field: &str) -> Result<f32> {
|
fn get_percent(&self, this: JObject, field: &str) -> Result<f32> {
|
||||||
let res = self.get_field(this, field, "F")?.f()?;
|
let res = self.get_field(this, field, "F")?.f()?;
|
||||||
Ok(res)
|
Ok(res)
|
||||||
}
|
}
|
||||||
fn get_color(&self, this: jobject, field: &str) -> Result<(u8, u8, u8)> {
|
fn get_color(&self, this: JObject, field: &str) -> Result<(u8, u8, u8)> {
|
||||||
let color = self.get_int(this, field)?;
|
let color = self.get_int(this, field)?;
|
||||||
// android passes color as ARGB
|
// android passes color as ARGB
|
||||||
Ok(((color >> 16) as u8, (color >> 8) as u8, color as u8))
|
Ok(((color >> 16) as u8, (color >> 8) as u8, color as u8))
|
||||||
}
|
}
|
||||||
|
fn get_direct_buffer(&self, buf: JByteBuffer) -> Result<&mut [u8]> {
|
||||||
|
let ptr = self.get_direct_buffer_address(buf)?;
|
||||||
|
let len = self.get_direct_buffer_capacity(buf)?;
|
||||||
|
unsafe { Ok(slice::from_raw_parts_mut(ptr, len)) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
@ -85,7 +96,7 @@ macro_rules! jni_func {
|
|||||||
(name $name:ident func $func:ident params ($($pname:ident: $ptype:ty),*)) => {
|
(name $name:ident func $func:ident params ($($pname:ident: $ptype:ty),*)) => {
|
||||||
paste::paste! {
|
paste::paste! {
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn [<Java_com_simongellis_vvb_emulator_ $name>](env: JNIEnv, this: jobject $(, $pname: $ptype)*) {
|
pub unsafe extern "C" fn [<Java_com_simongellis_vvb_emulator_ $name>](env: JNIEnv, this: JObject $(, $pname: $ptype)*) {
|
||||||
let result = $func(&env, this $(, $pname)*);
|
let result = $func(&env, this $(, $pname)*);
|
||||||
$crate::jni_helpers::to_java_exception(&env, result);
|
$crate::jni_helpers::to_java_exception(&env, result);
|
||||||
}
|
}
|
||||||
|
18
src/lib.rs
18
src/lib.rs
@ -9,7 +9,7 @@ mod video;
|
|||||||
|
|
||||||
use android_logger::{self, Config};
|
use android_logger::{self, Config};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use jni::sys::jobject;
|
use jni::objects::JObject;
|
||||||
use jni::JNIEnv;
|
use jni::JNIEnv;
|
||||||
use log::{info, Level};
|
use log::{info, Level};
|
||||||
use video::{Cardboard, QrCode};
|
use video::{Cardboard, QrCode};
|
||||||
@ -20,13 +20,13 @@ pub use controller::jni::*;
|
|||||||
pub use emulator::jni::*;
|
pub use emulator::jni::*;
|
||||||
pub use video::jni::*;
|
pub use video::jni::*;
|
||||||
|
|
||||||
jni_func!(VvbLibrary_nativeInitialize, init, jobject, jobject, jobject);
|
jni_func!(VvbLibrary_nativeInitialize, init, JObject, JObject, JObject);
|
||||||
fn init(
|
fn init(
|
||||||
env: &JNIEnv,
|
env: &JNIEnv,
|
||||||
_this: jobject,
|
_this: JObject,
|
||||||
context: jobject,
|
context: JObject,
|
||||||
sample_rate: jobject,
|
sample_rate: JObject,
|
||||||
frames_per_burst: jobject,
|
frames_per_burst: JObject,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
android_logger::init_once(Config::default().with_min_level(Level::Info));
|
android_logger::init_once(Config::default().with_min_level(Level::Info));
|
||||||
info!("Hello from vvb");
|
info!("Hello from vvb");
|
||||||
@ -34,8 +34,8 @@ fn init(
|
|||||||
let vm = env.get_java_vm()?;
|
let vm = env.get_java_vm()?;
|
||||||
Cardboard::initialize(vm.get_java_vm_pointer(), context);
|
Cardboard::initialize(vm.get_java_vm_pointer(), context);
|
||||||
|
|
||||||
let sample_rate = env.get_integet_value(sample_rate)?;
|
let sample_rate = env.get_integer_value(sample_rate)?;
|
||||||
let frames_per_burst = env.get_integet_value(frames_per_burst)?;
|
let frames_per_burst = env.get_integer_value(frames_per_burst)?;
|
||||||
|
|
||||||
audio::init(sample_rate, frames_per_burst);
|
audio::init(sample_rate, frames_per_burst);
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ fn init(
|
|||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(VvbLibrary_nativeChangeDeviceParams, change_device_params);
|
jni_func!(VvbLibrary_nativeChangeDeviceParams, change_device_params);
|
||||||
fn change_device_params(_env: &JNIEnv, _this: jobject) -> Result<()> {
|
fn change_device_params(_env: &JNIEnv, _this: JObject) -> Result<()> {
|
||||||
QrCode::scan_qr_code_and_save_device_params();
|
QrCode::scan_qr_code_and_save_device_params();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
#![allow(non_camel_case_types)]
|
#![allow(non_camel_case_types)]
|
||||||
|
|
||||||
use jni::sys::{jobject, JavaVM};
|
use jni::objects::JObject;
|
||||||
|
use jni::sys::JavaVM;
|
||||||
use std::os::raw::*;
|
use std::os::raw::*;
|
||||||
|
|
||||||
mod sys {
|
mod sys {
|
||||||
@ -49,7 +50,7 @@ pub use sys::{CardboardEye, CardboardMesh};
|
|||||||
#[link(name = "GfxPluginCardboard")]
|
#[link(name = "GfxPluginCardboard")]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#[link_name = "Cardboard_initializeAndroid"]
|
#[link_name = "Cardboard_initializeAndroid"]
|
||||||
pub fn Cardboard_initializeAndroid(vm: *const JavaVM, context: jobject);
|
pub fn Cardboard_initializeAndroid(vm: *const JavaVM, context: JObject);
|
||||||
|
|
||||||
#[link_name = "CardboardLensDistortion_create"]
|
#[link_name = "CardboardLensDistortion_create"]
|
||||||
pub fn CardboardLensDistortion_create(
|
pub fn CardboardLensDistortion_create(
|
||||||
@ -102,7 +103,7 @@ extern "C" {
|
|||||||
|
|
||||||
pub struct Cardboard;
|
pub struct Cardboard;
|
||||||
impl Cardboard {
|
impl Cardboard {
|
||||||
pub fn initialize(vm: *const JavaVM, context: jobject) {
|
pub fn initialize(vm: *const JavaVM, context: JObject) {
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
unsafe {
|
unsafe {
|
||||||
Cardboard_initializeAndroid(vm, context);
|
Cardboard_initializeAndroid(vm, context);
|
||||||
|
@ -128,13 +128,14 @@ pub mod jni {
|
|||||||
use crate::video::renderers::common::Renderer;
|
use crate::video::renderers::common::Renderer;
|
||||||
use crate::{jni_func, jni_helpers};
|
use crate::{jni_func, jni_helpers};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use jni::sys::{jint, jobject};
|
use jni::objects::JObject;
|
||||||
|
use jni::sys::jint;
|
||||||
use jni::JNIEnv;
|
use jni::JNIEnv;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
|
||||||
type AnaglyphRenderer = Renderer<AnaglyphRenderLogic>;
|
type AnaglyphRenderer = Renderer<AnaglyphRenderLogic>;
|
||||||
|
|
||||||
fn get_settings(env: &JNIEnv, this: jobject) -> Result<Settings> {
|
fn get_settings(env: &JNIEnv, this: JObject) -> Result<Settings> {
|
||||||
let screen_zoom = env.get_percent(this, "screenZoom")?;
|
let screen_zoom = env.get_percent(this, "screenZoom")?;
|
||||||
let aspect_ratio = env.get_int(this, "aspectRatio")?.try_into()?;
|
let aspect_ratio = env.get_int(this, "aspectRatio")?.try_into()?;
|
||||||
let vertical_offset = env.get_percent(this, "verticalOffset")?;
|
let vertical_offset = env.get_percent(this, "verticalOffset")?;
|
||||||
@ -152,17 +153,17 @@ pub mod jni {
|
|||||||
|
|
||||||
fn get_renderer<'a>(
|
fn get_renderer<'a>(
|
||||||
env: &'a JNIEnv,
|
env: &'a JNIEnv,
|
||||||
this: jobject,
|
this: JObject<'a>,
|
||||||
) -> jni_helpers::JavaGetResult<'a, AnaglyphRenderer> {
|
) -> jni_helpers::JavaGetResult<'a, AnaglyphRenderer> {
|
||||||
jni_helpers::java_get(env, this)
|
jni_helpers::java_get(env, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(AnaglyphRenderer_nativeConstructor, constructor, jobject, jobject);
|
jni_func!(AnaglyphRenderer_nativeConstructor, constructor, JObject, JObject);
|
||||||
fn constructor(
|
fn constructor(
|
||||||
env: &JNIEnv,
|
env: &JNIEnv,
|
||||||
this: jobject,
|
this: JObject,
|
||||||
emulator: jobject,
|
emulator: JObject,
|
||||||
settings: jobject,
|
settings: JObject,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let mut emulator = jni_helpers::java_get::<Emulator>(env, emulator)?;
|
let mut emulator = jni_helpers::java_get::<Emulator>(env, emulator)?;
|
||||||
let settings = get_settings(env, settings)?;
|
let settings = get_settings(env, settings)?;
|
||||||
@ -174,24 +175,24 @@ pub mod jni {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(AnaglyphRenderer_nativeDestructor, destructor);
|
jni_func!(AnaglyphRenderer_nativeDestructor, destructor);
|
||||||
fn destructor(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn destructor(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
jni_helpers::java_take::<AnaglyphRenderer>(env, this)
|
jni_helpers::java_take::<AnaglyphRenderer>(env, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(AnaglyphRenderer_nativeOnSurfaceCreated, on_surface_created);
|
jni_func!(AnaglyphRenderer_nativeOnSurfaceCreated, on_surface_created);
|
||||||
fn on_surface_created(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn on_surface_created(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
let mut this = get_renderer(env, this)?;
|
let mut this = get_renderer(env, this)?;
|
||||||
this.on_surface_created()
|
this.on_surface_created()
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(AnaglyphRenderer_nativeOnSurfaceChanged, on_surface_changed, jint, jint);
|
jni_func!(AnaglyphRenderer_nativeOnSurfaceChanged, on_surface_changed, jint, jint);
|
||||||
fn on_surface_changed(env: &JNIEnv, this: jobject, width: jint, height: jint) -> Result<()> {
|
fn on_surface_changed(env: &JNIEnv, this: JObject, width: jint, height: jint) -> Result<()> {
|
||||||
let mut this = get_renderer(env, this)?;
|
let mut this = get_renderer(env, this)?;
|
||||||
this.on_surface_changed(width, height)
|
this.on_surface_changed(width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(AnaglyphRenderer_nativeOnDrawFrame, on_draw_frame);
|
jni_func!(AnaglyphRenderer_nativeOnDrawFrame, on_draw_frame);
|
||||||
fn on_draw_frame(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn on_draw_frame(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
let mut this = get_renderer(env, this)?;
|
let mut this = get_renderer(env, this)?;
|
||||||
this.on_draw_frame()
|
this.on_draw_frame()
|
||||||
}
|
}
|
||||||
|
@ -105,13 +105,14 @@ pub mod jni {
|
|||||||
use crate::video::renderers::common::Renderer;
|
use crate::video::renderers::common::Renderer;
|
||||||
use crate::{jni_func, jni_helpers};
|
use crate::{jni_func, jni_helpers};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use jni::sys::{jint, jobject};
|
use jni::objects::JObject;
|
||||||
|
use jni::sys::jint;
|
||||||
use jni::JNIEnv;
|
use jni::JNIEnv;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
|
||||||
type CardboardRenderer = Renderer<CardboardRenderLogic>;
|
type CardboardRenderer = Renderer<CardboardRenderLogic>;
|
||||||
|
|
||||||
pub fn get_settings(env: &JNIEnv, this: jobject) -> Result<Settings> {
|
pub fn get_settings(env: &JNIEnv, this: JObject) -> Result<Settings> {
|
||||||
let screen_zoom = env.get_percent(this, "screenZoom")?;
|
let screen_zoom = env.get_percent(this, "screenZoom")?;
|
||||||
let aspect_ratio = env.get_int(this, "aspectRatio")?.try_into()?;
|
let aspect_ratio = env.get_int(this, "aspectRatio")?.try_into()?;
|
||||||
let vertical_offset = env.get_percent(this, "verticalOffset")?;
|
let vertical_offset = env.get_percent(this, "verticalOffset")?;
|
||||||
@ -127,17 +128,17 @@ pub mod jni {
|
|||||||
|
|
||||||
fn get_renderer<'a>(
|
fn get_renderer<'a>(
|
||||||
env: &'a JNIEnv,
|
env: &'a JNIEnv,
|
||||||
this: jobject,
|
this: JObject<'a>,
|
||||||
) -> jni_helpers::JavaGetResult<'a, CardboardRenderer> {
|
) -> jni_helpers::JavaGetResult<'a, CardboardRenderer> {
|
||||||
jni_helpers::java_get(env, this)
|
jni_helpers::java_get(env, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(CardboardRenderer_nativeConstructor, constructor, jobject, jobject);
|
jni_func!(CardboardRenderer_nativeConstructor, constructor, JObject, JObject);
|
||||||
fn constructor(
|
fn constructor(
|
||||||
env: &JNIEnv,
|
env: &JNIEnv,
|
||||||
this: jobject,
|
this: JObject,
|
||||||
emulator: jobject,
|
emulator: JObject,
|
||||||
settings: jobject,
|
settings: JObject,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let mut emulator = jni_helpers::java_get::<Emulator>(env, emulator)?;
|
let mut emulator = jni_helpers::java_get::<Emulator>(env, emulator)?;
|
||||||
let settings = get_settings(env, settings)?;
|
let settings = get_settings(env, settings)?;
|
||||||
@ -149,30 +150,30 @@ pub mod jni {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(CardboardRenderer_nativeDestructor, destructor);
|
jni_func!(CardboardRenderer_nativeDestructor, destructor);
|
||||||
fn destructor(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn destructor(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
jni_helpers::java_take::<CardboardRenderer>(env, this)
|
jni_helpers::java_take::<CardboardRenderer>(env, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(CardboardRenderer_nativeOnSurfaceCreated, on_surface_created);
|
jni_func!(CardboardRenderer_nativeOnSurfaceCreated, on_surface_created);
|
||||||
fn on_surface_created(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn on_surface_created(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
let mut this = get_renderer(env, this)?;
|
let mut this = get_renderer(env, this)?;
|
||||||
this.on_surface_created()
|
this.on_surface_created()
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(CardboardRenderer_nativeOnSurfaceChanged, on_surface_changed, jint, jint);
|
jni_func!(CardboardRenderer_nativeOnSurfaceChanged, on_surface_changed, jint, jint);
|
||||||
fn on_surface_changed(env: &JNIEnv, this: jobject, width: jint, height: jint) -> Result<()> {
|
fn on_surface_changed(env: &JNIEnv, this: JObject, width: jint, height: jint) -> Result<()> {
|
||||||
let mut this = get_renderer(env, this)?;
|
let mut this = get_renderer(env, this)?;
|
||||||
this.on_surface_changed(width, height)
|
this.on_surface_changed(width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(CardboardRenderer_nativeOnDrawFrame, on_draw_frame);
|
jni_func!(CardboardRenderer_nativeOnDrawFrame, on_draw_frame);
|
||||||
fn on_draw_frame(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn on_draw_frame(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
let mut this = get_renderer(env, this)?;
|
let mut this = get_renderer(env, this)?;
|
||||||
this.on_draw_frame()
|
this.on_draw_frame()
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(CardboardRenderer_nativeEnsureDeviceParams, ensure_device_params);
|
jni_func!(CardboardRenderer_nativeEnsureDeviceParams, ensure_device_params);
|
||||||
fn ensure_device_params(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn ensure_device_params(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
let mut this = get_renderer(env, this)?;
|
let mut this = get_renderer(env, this)?;
|
||||||
this.logic.ensure_device_params();
|
this.logic.ensure_device_params();
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -152,12 +152,13 @@ pub mod jni {
|
|||||||
use crate::video::renderers::common::Renderer;
|
use crate::video::renderers::common::Renderer;
|
||||||
use crate::{jni_func, jni_helpers};
|
use crate::{jni_func, jni_helpers};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use jni::sys::{jboolean, jint, jobject};
|
use jni::objects::JObject;
|
||||||
|
use jni::sys::{jboolean, jint};
|
||||||
use jni::JNIEnv;
|
use jni::JNIEnv;
|
||||||
|
|
||||||
type LeiaRenderer = Renderer<LeiaRenderLogic>;
|
type LeiaRenderer = Renderer<LeiaRenderLogic>;
|
||||||
|
|
||||||
fn get_settings(env: &JNIEnv, this: jobject) -> Result<Settings> {
|
fn get_settings(env: &JNIEnv, this: JObject) -> Result<Settings> {
|
||||||
let screen_zoom = env.get_percent(this, "screenZoom")?;
|
let screen_zoom = env.get_percent(this, "screenZoom")?;
|
||||||
let aspect_ratio = env.get_int(this, "aspectRatio")?.try_into()?;
|
let aspect_ratio = env.get_int(this, "aspectRatio")?.try_into()?;
|
||||||
let vertical_offset = env.get_percent(this, "verticalOffset")?;
|
let vertical_offset = env.get_percent(this, "verticalOffset")?;
|
||||||
@ -175,17 +176,17 @@ pub mod jni {
|
|||||||
|
|
||||||
fn get_renderer<'a>(
|
fn get_renderer<'a>(
|
||||||
env: &'a JNIEnv,
|
env: &'a JNIEnv,
|
||||||
this: jobject,
|
this: JObject<'a>,
|
||||||
) -> jni_helpers::JavaGetResult<'a, LeiaRenderer> {
|
) -> jni_helpers::JavaGetResult<'a, LeiaRenderer> {
|
||||||
jni_helpers::java_get(env, this)
|
jni_helpers::java_get(env, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(LeiaRenderer_nativeConstructor, constructor, jobject, jobject);
|
jni_func!(LeiaRenderer_nativeConstructor, constructor, JObject, JObject);
|
||||||
fn constructor(
|
fn constructor(
|
||||||
env: &JNIEnv,
|
env: &JNIEnv,
|
||||||
this: jobject,
|
this: JObject,
|
||||||
emulator: jobject,
|
emulator: JObject,
|
||||||
settings: jobject,
|
settings: JObject,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let mut emulator = jni_helpers::java_get::<Emulator>(env, emulator)?;
|
let mut emulator = jni_helpers::java_get::<Emulator>(env, emulator)?;
|
||||||
let settings = get_settings(env, settings)?;
|
let settings = get_settings(env, settings)?;
|
||||||
@ -197,30 +198,30 @@ pub mod jni {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(LeiaRenderer_nativeDestructor, destructor);
|
jni_func!(LeiaRenderer_nativeDestructor, destructor);
|
||||||
fn destructor(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn destructor(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
jni_helpers::java_take::<LeiaRenderer>(env, this)
|
jni_helpers::java_take::<LeiaRenderer>(env, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(LeiaRenderer_nativeOnSurfaceCreated, on_surface_created);
|
jni_func!(LeiaRenderer_nativeOnSurfaceCreated, on_surface_created);
|
||||||
fn on_surface_created(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn on_surface_created(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
let mut this = get_renderer(env, this)?;
|
let mut this = get_renderer(env, this)?;
|
||||||
this.on_surface_created()
|
this.on_surface_created()
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(LeiaRenderer_nativeOnSurfaceChanged, on_surface_changed, jint, jint);
|
jni_func!(LeiaRenderer_nativeOnSurfaceChanged, on_surface_changed, jint, jint);
|
||||||
fn on_surface_changed(env: &JNIEnv, this: jobject, width: jint, height: jint) -> Result<()> {
|
fn on_surface_changed(env: &JNIEnv, this: JObject, width: jint, height: jint) -> Result<()> {
|
||||||
let mut this = get_renderer(env, this)?;
|
let mut this = get_renderer(env, this)?;
|
||||||
this.on_surface_changed(width, height)
|
this.on_surface_changed(width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(LeiaRenderer_nativeOnDrawFrame, on_draw_frame);
|
jni_func!(LeiaRenderer_nativeOnDrawFrame, on_draw_frame);
|
||||||
fn on_draw_frame(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn on_draw_frame(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
let mut this = get_renderer(env, this)?;
|
let mut this = get_renderer(env, this)?;
|
||||||
this.on_draw_frame()
|
this.on_draw_frame()
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(LeiaRenderer_nativeOnModeChanged, on_mode_changed, jboolean);
|
jni_func!(LeiaRenderer_nativeOnModeChanged, on_mode_changed, jboolean);
|
||||||
fn on_mode_changed(env: &JNIEnv, this: jobject, enable_3d: jboolean) -> Result<()> {
|
fn on_mode_changed(env: &JNIEnv, this: JObject, enable_3d: jboolean) -> Result<()> {
|
||||||
let mut this = get_renderer(env, this)?;
|
let mut this = get_renderer(env, this)?;
|
||||||
this.logic.enable_3d = enable_3d != 0;
|
this.logic.enable_3d = enable_3d != 0;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -129,13 +129,14 @@ pub mod jni {
|
|||||||
use crate::video::renderers::common::Renderer;
|
use crate::video::renderers::common::Renderer;
|
||||||
use crate::{jni_func, jni_helpers};
|
use crate::{jni_func, jni_helpers};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use jni::sys::{jint, jobject};
|
use jni::objects::JObject;
|
||||||
|
use jni::sys::jint;
|
||||||
use jni::JNIEnv;
|
use jni::JNIEnv;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
|
||||||
type MonoRenderer = Renderer<MonoRenderLogic>;
|
type MonoRenderer = Renderer<MonoRenderLogic>;
|
||||||
|
|
||||||
fn get_settings(env: &JNIEnv, this: jobject) -> Result<Settings> {
|
fn get_settings(env: &JNIEnv, this: JObject) -> Result<Settings> {
|
||||||
let eye = env.get_int(this, "eye")?.try_into()?;
|
let eye = env.get_int(this, "eye")?.try_into()?;
|
||||||
let screen_zoom = env.get_percent(this, "screenZoom")?;
|
let screen_zoom = env.get_percent(this, "screenZoom")?;
|
||||||
let aspect_ratio = env.get_int(this, "aspectRatio")?.try_into()?;
|
let aspect_ratio = env.get_int(this, "aspectRatio")?.try_into()?;
|
||||||
@ -152,17 +153,17 @@ pub mod jni {
|
|||||||
|
|
||||||
fn get_renderer<'a>(
|
fn get_renderer<'a>(
|
||||||
env: &'a JNIEnv,
|
env: &'a JNIEnv,
|
||||||
this: jobject,
|
this: JObject<'a>,
|
||||||
) -> jni_helpers::JavaGetResult<'a, MonoRenderer> {
|
) -> jni_helpers::JavaGetResult<'a, MonoRenderer> {
|
||||||
jni_helpers::java_get(env, this)
|
jni_helpers::java_get(env, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(MonoRenderer_nativeConstructor, constructor, jobject, jobject);
|
jni_func!(MonoRenderer_nativeConstructor, constructor, JObject, JObject);
|
||||||
fn constructor(
|
fn constructor(
|
||||||
env: &JNIEnv,
|
env: &JNIEnv,
|
||||||
this: jobject,
|
this: JObject,
|
||||||
emulator: jobject,
|
emulator: JObject,
|
||||||
settings: jobject,
|
settings: JObject,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let mut emulator = jni_helpers::java_get::<Emulator>(env, emulator)?;
|
let mut emulator = jni_helpers::java_get::<Emulator>(env, emulator)?;
|
||||||
let settings = get_settings(env, settings)?;
|
let settings = get_settings(env, settings)?;
|
||||||
@ -174,24 +175,24 @@ pub mod jni {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(MonoRenderer_nativeDestructor, destructor);
|
jni_func!(MonoRenderer_nativeDestructor, destructor);
|
||||||
fn destructor(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn destructor(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
jni_helpers::java_take::<MonoRenderer>(env, this)
|
jni_helpers::java_take::<MonoRenderer>(env, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(MonoRenderer_nativeOnSurfaceCreated, on_surface_created);
|
jni_func!(MonoRenderer_nativeOnSurfaceCreated, on_surface_created);
|
||||||
fn on_surface_created(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn on_surface_created(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
let mut this = get_renderer(env, this)?;
|
let mut this = get_renderer(env, this)?;
|
||||||
this.on_surface_created()
|
this.on_surface_created()
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(MonoRenderer_nativeOnSurfaceChanged, on_surface_changed, jint, jint);
|
jni_func!(MonoRenderer_nativeOnSurfaceChanged, on_surface_changed, jint, jint);
|
||||||
fn on_surface_changed(env: &JNIEnv, this: jobject, width: jint, height: jint) -> Result<()> {
|
fn on_surface_changed(env: &JNIEnv, this: JObject, width: jint, height: jint) -> Result<()> {
|
||||||
let mut this = get_renderer(env, this)?;
|
let mut this = get_renderer(env, this)?;
|
||||||
this.on_surface_changed(width, height)
|
this.on_surface_changed(width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(MonoRenderer_nativeOnDrawFrame, on_draw_frame);
|
jni_func!(MonoRenderer_nativeOnDrawFrame, on_draw_frame);
|
||||||
fn on_draw_frame(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn on_draw_frame(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
let mut this = get_renderer(env, this)?;
|
let mut this = get_renderer(env, this)?;
|
||||||
this.on_draw_frame()
|
this.on_draw_frame()
|
||||||
}
|
}
|
||||||
|
@ -140,13 +140,14 @@ pub mod jni {
|
|||||||
use crate::video::renderers::common::Renderer;
|
use crate::video::renderers::common::Renderer;
|
||||||
use crate::{jni_func, jni_helpers};
|
use crate::{jni_func, jni_helpers};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use jni::sys::{jint, jobject};
|
use jni::objects::JObject;
|
||||||
|
use jni::sys::jint;
|
||||||
use jni::JNIEnv;
|
use jni::JNIEnv;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
|
||||||
type StereoRenderer = Renderer<StereoRenderLogic>;
|
type StereoRenderer = Renderer<StereoRenderLogic>;
|
||||||
|
|
||||||
pub fn get_settings(env: &JNIEnv, this: jobject) -> Result<Settings> {
|
pub fn get_settings(env: &JNIEnv, this: JObject) -> Result<Settings> {
|
||||||
let screen_zoom = env.get_percent(this, "screenZoom")?;
|
let screen_zoom = env.get_percent(this, "screenZoom")?;
|
||||||
let aspect_ratio = env.get_int(this, "aspectRatio")?.try_into()?;
|
let aspect_ratio = env.get_int(this, "aspectRatio")?.try_into()?;
|
||||||
let vertical_offset = env.get_percent(this, "verticalOffset")?;
|
let vertical_offset = env.get_percent(this, "verticalOffset")?;
|
||||||
@ -162,17 +163,17 @@ pub mod jni {
|
|||||||
|
|
||||||
fn get_renderer<'a>(
|
fn get_renderer<'a>(
|
||||||
env: &'a JNIEnv,
|
env: &'a JNIEnv,
|
||||||
this: jobject,
|
this: JObject<'a>,
|
||||||
) -> jni_helpers::JavaGetResult<'a, StereoRenderer> {
|
) -> jni_helpers::JavaGetResult<'a, StereoRenderer> {
|
||||||
jni_helpers::java_get(env, this)
|
jni_helpers::java_get(env, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(StereoRenderer_nativeConstructor, constructor, jobject, jobject);
|
jni_func!(StereoRenderer_nativeConstructor, constructor, JObject, JObject);
|
||||||
fn constructor(
|
fn constructor(
|
||||||
env: &JNIEnv,
|
env: &JNIEnv,
|
||||||
this: jobject,
|
this: JObject,
|
||||||
emulator: jobject,
|
emulator: JObject,
|
||||||
settings: jobject,
|
settings: JObject,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let mut emulator = jni_helpers::java_get::<Emulator>(env, emulator)?;
|
let mut emulator = jni_helpers::java_get::<Emulator>(env, emulator)?;
|
||||||
let settings = get_settings(env, settings)?;
|
let settings = get_settings(env, settings)?;
|
||||||
@ -184,24 +185,24 @@ pub mod jni {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(StereoRenderer_nativeDestructor, destructor);
|
jni_func!(StereoRenderer_nativeDestructor, destructor);
|
||||||
fn destructor(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn destructor(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
jni_helpers::java_take::<StereoRenderer>(env, this)
|
jni_helpers::java_take::<StereoRenderer>(env, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(StereoRenderer_nativeOnSurfaceCreated, on_surface_created);
|
jni_func!(StereoRenderer_nativeOnSurfaceCreated, on_surface_created);
|
||||||
fn on_surface_created(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn on_surface_created(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
let mut this = get_renderer(env, this)?;
|
let mut this = get_renderer(env, this)?;
|
||||||
this.on_surface_created()
|
this.on_surface_created()
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(StereoRenderer_nativeOnSurfaceChanged, on_surface_changed, jint, jint);
|
jni_func!(StereoRenderer_nativeOnSurfaceChanged, on_surface_changed, jint, jint);
|
||||||
fn on_surface_changed(env: &JNIEnv, this: jobject, width: jint, height: jint) -> Result<()> {
|
fn on_surface_changed(env: &JNIEnv, this: JObject, width: jint, height: jint) -> Result<()> {
|
||||||
let mut this = get_renderer(env, this)?;
|
let mut this = get_renderer(env, this)?;
|
||||||
this.on_surface_changed(width, height)
|
this.on_surface_changed(width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_func!(StereoRenderer_nativeOnDrawFrame, on_draw_frame);
|
jni_func!(StereoRenderer_nativeOnDrawFrame, on_draw_frame);
|
||||||
fn on_draw_frame(env: &JNIEnv, this: jobject) -> Result<()> {
|
fn on_draw_frame(env: &JNIEnv, this: JObject) -> Result<()> {
|
||||||
let mut this = get_renderer(env, this)?;
|
let mut this = get_renderer(env, this)?;
|
||||||
this.on_draw_frame()
|
this.on_draw_frame()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user