From b6af6f893b48aa5d084334becd94fc1f52200933 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Tue, 7 Nov 2023 18:48:36 -0500 Subject: [PATCH 01/11] pin to rrplug version to 3 --- Cargo.lock | 345 +++++++++++++++++++++++++++++------------------- Cargo.toml | 2 +- src/discord.rs | 2 +- src/lib.rs | 20 ++- src/presence.rs | 19 ++- 5 files changed, 233 insertions(+), 155 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8b4282d..4a24582 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,11 +2,26 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "app_dirs2" @@ -22,9 +37,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.68" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", @@ -38,10 +53,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] -name = "base64" -version = "0.21.2" +name = "backtrace" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] [[package]] name = "bitflags" @@ -51,15 +75,24 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.2" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbe3c979c178231552ecba20214a8272df4e09f232a87aef4320cf06539aded" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cesu8" @@ -108,18 +141,33 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "data-encoding" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" + +[[package]] +name = "deranged" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +dependencies = [ + "powerfmt", +] + [[package]] name = "discord-sdk" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e7338aceb4639869595d31c764d43d20e60a4c2d21e7cac95ea767ec2ec7343" +checksum = "b00ca50adbf896a56145729b1800f5db27ce31f2513dbb9b44e27b23aa716a57" dependencies = [ "anyhow", "app_dirs2", "async-trait", - "base64", - "bitflags 2.3.2", + "bitflags 2.4.1", "crossbeam-channel", + "data-encoding", "num-traits", "parking_lot", "serde", @@ -130,7 +178,7 @@ dependencies = [ "tokio", "tracing", "url", - "winreg 0.11.0", + "winreg 0.51.0", ] [[package]] @@ -154,22 +202,16 @@ dependencies = [ ] [[package]] -name = "hermit-abi" -version = "0.2.6" +name = "gimli" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] -name = "home" -version = "0.5.5" +name = "hermit-abi" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" -dependencies = [ - "windows-sys 0.48.0", -] +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "idna" @@ -183,9 +225,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jni" @@ -211,15 +253,15 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "libc" -version = "0.2.146" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -227,21 +269,30 @@ dependencies = [ [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] [[package]] name = "mio" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "wasi", @@ -267,23 +318,32 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ "hermit-abi", "libc", ] +[[package]] +name = "object" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.18.0" @@ -302,15 +362,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.0", + "windows-targets 0.48.5", ] [[package]] @@ -321,41 +381,48 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "proc-macro2" -version = "1.0.60" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.28" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] [[package]] name = "rrplug" -version = "2.1.1" -source = "git+https://github.com/R2NorthstarTools/rrplug#242b965603c8be60d82c80722564c65b049b8333" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5a67ff1c1d55e85436570c3c6b2f2305933c5d05bd580e42d415c8f6e2d9394" dependencies = [ "log", "once_cell", @@ -366,18 +433,26 @@ dependencies = [ [[package]] name = "rrplug_proc" -version = "2.1.1" -source = "git+https://github.com/R2NorthstarTools/rrplug#242b965603c8be60d82c80722564c65b049b8333" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "930d71becdab7212381db722301476c0a057d16ed1c13ece20c44e7049134ca4" dependencies = [ + "proc-macro2", "quote", "syn", ] +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "same-file" @@ -390,24 +465,24 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.164" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.164" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", @@ -416,9 +491,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.97" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -427,9 +502,9 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.12" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab" +checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" dependencies = [ "proc-macro2", "quote", @@ -438,25 +513,25 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "socket2" -version = "0.4.9" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", - "winapi", + "windows-sys 0.48.0", ] [[package]] name = "syn" -version = "2.0.18" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -465,18 +540,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", @@ -485,19 +560,21 @@ dependencies = [ [[package]] name = "time" -version = "0.3.22" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" dependencies = [ + "deranged", + "powerfmt", "serde", "time-core", ] [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "tinyvec" @@ -516,11 +593,11 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.28.2" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" dependencies = [ - "autocfg", + "backtrace", "libc", "mio", "num_cpus", @@ -531,11 +608,10 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -543,9 +619,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", @@ -554,9 +630,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", ] @@ -569,9 +645,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.9" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -584,9 +660,9 @@ dependencies = [ [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -595,9 +671,9 @@ dependencies = [ [[package]] name = "walkdir" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", @@ -627,9 +703,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -655,7 +731,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.5", ] [[package]] @@ -675,17 +751,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -696,9 +772,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" @@ -708,9 +784,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" @@ -720,9 +796,9 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" @@ -732,9 +808,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" @@ -744,9 +820,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" @@ -756,9 +832,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" @@ -768,9 +844,9 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windres" @@ -794,19 +870,16 @@ dependencies = [ [[package]] name = "winreg" -version = "0.11.0" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a1a57ff50e9b408431e8f97d5456f2807f8eb2a2cd79b06068fc87f8ecf189" +checksum = "937f3df7948156640f46aacef17a70db0de5917bda9c92b0f751f3a955b588fc" dependencies = [ "cfg-if", - "winapi", + "windows-sys 0.48.0", ] [[package]] name = "xdg" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688597db5a750e9cad4511cb94729a078e274308099a0382b5b8203bbc767fee" -dependencies = [ - "home", -] +checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546" diff --git a/Cargo.toml b/Cargo.toml index f81fd4d..fc2cd6b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rrplug = { git = "https://github.com/R2NorthstarTools/rrplug" } +rrplug = "=3.0.0" discord-sdk = "0.3.2" tokio = "1.26.0" parking_lot = "0.12.1" diff --git a/src/discord.rs b/src/discord.rs index 6c7ae73..94a2d2d 100644 --- a/src/discord.rs +++ b/src/discord.rs @@ -24,7 +24,7 @@ pub struct Client { } /// discord rpc update function -/// +/// /// doesn't run on the titanfall 2 thread since it needs async pub async fn async_main() { let activity = &PLUGIN.wait().activity; diff --git a/src/lib.rs b/src/lib.rs index 8f08b7a..b0ac54f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,8 +6,8 @@ use tokio::runtime::Runtime; use crate::{ discord::async_main, - presense_bindings::{GameStateStruct, UIPresenceStruct,GameState}, presence::run_presence_updates, + presense_bindings::{GameState, GameStateStruct, UIPresenceStruct}, }; pub(crate) mod discord; @@ -46,21 +46,19 @@ impl Plugin for DiscordRpcPlugin { state: "Loading...".to_string(), ..Default::default() }); - Self { - activity, - presence_data: Mutex::new((GameStateStruct::default(), UIPresenceStruct::default())), - } - } - fn main(&self) { - let runtime = match Runtime::new() { - Ok(rt) => rt, + std::thread::spawn(|| match Runtime::new() { + Ok(rt) => rt.block_on(async_main()), Err(err) => { log::error!("failed to create a runtime; {:?}", err); return; } - }; - runtime.block_on(async_main()); + }); + + Self { + activity, + presence_data: Mutex::new((GameStateStruct::default(), UIPresenceStruct::default())), + } } fn on_sqvm_created(&self, sqvm_handle: &CSquirrelVMHandle) { diff --git a/src/presence.rs b/src/presence.rs index e68e513..7cc7ece 100644 --- a/src/presence.rs +++ b/src/presence.rs @@ -4,7 +4,7 @@ use rrplug::prelude::*; use rrplug::{ bindings::squirrelclasstypes::ScriptContext, call_sq_function, - high::{squirrel::compile_string, Handle}, + high::{squirrel::compile_string, UnsafeHandle}, }; use std::{ ops::DerefMut, @@ -14,7 +14,7 @@ use std::{ use crate::presense_bindings::{GameState, GameStateStruct, UIPresenceStruct}; // heartbeat for pulling presence -pub fn run_presence_updates(sqvm: Handle<*mut HSquirrelVM>) { +pub fn run_presence_updates(sqvm: UnsafeHandle<*mut HSquirrelVM>) { let sqvm = *sqvm.get(); let sq_functions = SQFUNCTIONS.client.wait(); @@ -38,7 +38,7 @@ pub fn run_presence_updates(sqvm: Handle<*mut HSquirrelVM>) { /// function to pull presence from the sqvm since in runframe it's impossibke to get the output of a function back #[rrplug::sqfunction(VM = "UiClient", ExportName = "FetchPresence")] -pub fn fetch_presence() { +pub fn fetch_presence() -> Result<(), String> { let plugin = crate::PLUGIN.wait(); let mut presence_lock = plugin.presence_data.lock(); let (cl_presence, ui_presence) = presence_lock.deref_mut(); @@ -68,7 +68,11 @@ pub fn fetch_presence() { #[cfg(not(debug_assertions))] drop(err); } else { - *cl_presence = GameStateStruct::get_from_sqvm(sqvm, sq_functions, sqvm._stackbase); + *cl_presence = GameStateStruct::get_from_sqvm( + sqvm, + SQFUNCTIONS.client.wait(), + sqvm._stackbase, + ); } } ScriptContext::UI => { @@ -85,8 +89,11 @@ pub fn fetch_presence() { drop(err); } Ok(_) => { - *ui_presence = - UIPresenceStruct::get_from_sqvm(sqvm, sq_functions, sqvm._stackbase); + *ui_presence = UIPresenceStruct::get_from_sqvm( + sqvm, + SQFUNCTIONS.client.wait(), + sqvm._stackbase, + ); } } } From 6fcd114c72e08901fa687647bacef7c9f941ac2c Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Fri, 19 Jan 2024 22:05:55 -0500 Subject: [PATCH 02/11] update to v4 --- Cargo.lock | 275 ++++++++++++++++++++++++----------------- Cargo.toml | 6 +- build.rs | 8 -- manifest/Resource.rc | 95 -------------- manifest/manifest.json | 10 -- manifest/resource.h | 11 -- src/discord.rs | 6 +- src/lib.rs | 49 +++++++- src/presence.rs | 4 +- 9 files changed, 217 insertions(+), 247 deletions(-) delete mode 100644 build.rs delete mode 100644 manifest/Resource.rc delete mode 100644 manifest/manifest.json delete mode 100644 manifest/resource.h diff --git a/Cargo.lock b/Cargo.lock index 4a24582..04ed413 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "app_dirs2" @@ -37,9 +37,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", @@ -75,9 +75,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "bytes" @@ -116,42 +116,32 @@ dependencies = [ "memchr", ] -[[package]] -name = "concat-string" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7439becb5fafc780b6f4de382b1a7a3e70234afe783854a4702ee8adbb838609" - [[package]] name = "crossbeam-channel" -version = "0.5.8" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "data-encoding" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" +checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" [[package]] name = "deranged" -version = "0.3.9" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", ] @@ -165,7 +155,7 @@ dependencies = [ "anyhow", "app_dirs2", "async-trait", - "bitflags 2.4.1", + "bitflags 2.4.2", "crossbeam-channel", "data-encoding", "num-traits", @@ -178,46 +168,46 @@ dependencies = [ "tokio", "tracing", "url", - "winreg 0.51.0", + "winreg", ] [[package]] -name = "find-winsdk" -version = "0.2.0" +name = "form_urlencoded" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8cbf17b871570c1f8612b763bac3e86290602bcf5dc3c5ce657e0e1e9071d9e" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ - "serde", - "serde_derive", - "winreg 0.5.1", + "percent-encoding", ] [[package]] -name = "form_urlencoded" -version = "1.2.0" +name = "getrandom" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ - "percent-encoding", + "cfg-if", + "libc", + "wasi", ] [[package]] name = "gimli" -version = "0.28.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -225,9 +215,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "jni" @@ -253,9 +243,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "libc" -version = "0.2.150" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "lock_api" @@ -275,9 +265,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "miniz_oxide" @@ -290,9 +280,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.9" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "wasi", @@ -313,7 +303,7 @@ dependencies = [ "parking_lot", "rrplug", "tokio", - "windres", + "uuid", ] [[package]] @@ -337,18 +327,18 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "parking_lot" @@ -375,9 +365,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project-lite" @@ -393,18 +383,18 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -420,22 +410,22 @@ dependencies = [ [[package]] name = "rrplug" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5a67ff1c1d55e85436570c3c6b2f2305933c5d05bd580e42d415c8f6e2d9394" +version = "4.0.0" +source = "git+https://github.com/R2NorthstarTools/rrplug.git?rev=3a31f4a9173d2e82f8d4b2a30bafa3faf57a5158#3a31f4a9173d2e82f8d4b2a30bafa3faf57a5158" dependencies = [ + "bitflags 2.4.2", "log", "once_cell", "parking_lot", "rrplug_proc", "thiserror", + "windows", ] [[package]] name = "rrplug_proc" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "930d71becdab7212381db722301476c0a057d16ed1c13ece20c44e7049134ca4" +version = "4.0.0" +source = "git+https://github.com/R2NorthstarTools/rrplug.git?rev=3a31f4a9173d2e82f8d4b2a30bafa3faf57a5158#3a31f4a9173d2e82f8d4b2a30bafa3faf57a5158" dependencies = [ "proc-macro2", "quote", @@ -450,9 +440,9 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "same-file" @@ -471,18 +461,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.192" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.192" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ "proc-macro2", "quote", @@ -491,9 +481,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" dependencies = [ "itoa", "ryu", @@ -502,9 +492,9 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" +checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", @@ -513,9 +503,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "socket2" @@ -529,9 +519,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -540,18 +530,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", @@ -560,9 +550,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" dependencies = [ "deranged", "powerfmt", @@ -593,9 +583,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.33.0" +version = "1.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" dependencies = [ "backtrace", "libc", @@ -639,9 +629,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -660,15 +650,24 @@ dependencies = [ [[package]] name = "url" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] +[[package]] +name = "uuid" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +dependencies = [ + "getrandom", +] + [[package]] name = "walkdir" version = "2.4.0" @@ -716,6 +715,25 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +dependencies = [ + "windows-core", + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.0", +] + [[package]] name = "windows-sys" version = "0.45.0" @@ -764,6 +782,21 @@ dependencies = [ "windows_x86_64_msvc 0.48.5", ] +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -776,6 +809,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -788,6 +827,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -800,6 +845,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -812,6 +863,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -824,6 +881,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -836,6 +899,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -849,24 +918,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] -name = "windres" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82115619221b2b66001a39088b8059d171b1f9005a00d6a10c6e8a71a30a4cdc" -dependencies = [ - "concat-string", - "find-winsdk", -] - -[[package]] -name = "winreg" -version = "0.5.1" +name = "windows_x86_64_msvc" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27a759395c1195c4cc5cda607ef6f8f6498f64e78f7900f5de0a127a424704a" -dependencies = [ - "serde", - "winapi", -] +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winreg" diff --git a/Cargo.toml b/Cargo.toml index fc2cd6b..ada3db7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,13 +6,11 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rrplug = "=3.0.0" +rrplug = { git = "https://github.com/R2NorthstarTools/rrplug.git", rev = "3a31f4a9173d2e82f8d4b2a30bafa3faf57a5158" } discord-sdk = "0.3.2" tokio = "1.26.0" parking_lot = "0.12.1" - -[build-dependencies] -windres = "0.2.2" +uuid = { version = "1.7.0", features = ["v4"] } [lib] name = "DiscordRPC" diff --git a/build.rs b/build.rs deleted file mode 100644 index b46a888..0000000 --- a/build.rs +++ /dev/null @@ -1,8 +0,0 @@ -extern crate windres; -use windres::Build; - -fn main() { - Build::new() - .compile("manifest/Resource.rc") - .expect("failed to include ressouces in the dll"); -} diff --git a/manifest/Resource.rc b/manifest/Resource.rc deleted file mode 100644 index 38b1119..0000000 --- a/manifest/Resource.rc +++ /dev/null @@ -1,95 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" -///////////////////////////////////////////////////////////////////////////// -// English (United States) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) - -///////////////////////////////////////////////////////////////////////////// -// -// RCDATA -// - -IDR_RCDATA1 RCDATA "manifest.json" - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,0 - PRODUCTVERSION 1,0,0,0 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "Northstar" - VALUE "FileDescription", "Northstar" - VALUE "FileVersion", "1.0.0.0" - VALUE "InternalName", "DiscordRPC.dll" - VALUE "LegalCopyright", "Copyright (C) 2022" - VALUE "OriginalFilename", "DiscordRPC.dll" - VALUE "ProductName", "Northstar Discord Rich Presence" - VALUE "ProductVersion", "1.0.0.0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (United States) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED diff --git a/manifest/manifest.json b/manifest/manifest.json deleted file mode 100644 index f852a90..0000000 --- a/manifest/manifest.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "Northstar.DiscordRPC", - "displayname": "DPRESENCE", - "dependencyName": "DISCORDRPC", - "description": "Discord Rich Presence for Northstar", - "api_version": "3", - "version": "3.0", - "run_on_server": false, - "run_on_client": true -} \ No newline at end of file diff --git a/manifest/resource.h b/manifest/resource.h deleted file mode 100644 index bf40714..0000000 --- a/manifest/resource.h +++ /dev/null @@ -1,11 +0,0 @@ -#define SUBLANG_ENGLISH_US 0x01 -#define LANG_ENGLISH 0x09 -#define IDR_RCDATA1 101 -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/src/discord.rs b/src/discord.rs index 94a2d2d..1af945c 100644 --- a/src/discord.rs +++ b/src/discord.rs @@ -14,7 +14,8 @@ use rrplug::prelude::*; use crate::exports::PLUGIN; /// the discord app's id, taken from older v1 discord rpc -const APP_ID: i64 = 941428101429231617; +// const APP_ID: i64 = 941428101429231617; +const APP_ID: i64 = 1198009103516180500; /// struct to hold everything required to run discord rpc pub struct Client { @@ -59,7 +60,8 @@ pub async fn async_main() { large_text: data.large_text, small_image: data.small_image, small_text: data.small_text, - }); + }) + .secrets(data.secrets); if let Some(start) = data.start { activity_builder = activity_builder.start_timestamp(if start == 0 { 1 } else { start }); diff --git a/src/lib.rs b/src/lib.rs index b0ac54f..9f5d936 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,10 @@ #![allow(non_snake_case)] +use discord_sdk::activity::Secrets; use parking_lot::Mutex; -use rrplug::prelude::*; +use rrplug::{bindings::cvar::convar::FCVAR_CLIENTDLL, prelude::*}; use tokio::runtime::Runtime; +use uuid::Uuid; use crate::{ discord::async_main, @@ -28,6 +30,7 @@ pub struct ActivityData { end: Option, start: Option, last_state: GameState, + secrets: Secrets, } #[deny(non_snake_case)] @@ -38,8 +41,15 @@ pub struct DiscordRpcPlugin { #[deny(non_snake_case)] impl Plugin for DiscordRpcPlugin { - fn new(plugin_data: &PluginData) -> Self { - plugin_data.register_sq_functions(presence::fetch_presence); + const PLUGIN_INFO: PluginInfo = PluginInfo::new( + "DISCORDRPC\0", + "DISCORDXD\0", + "DISCORDRPC\0", + PluginContext::CLIENT, + ); + + fn new(_: bool) -> Self { + register_sq_functions(presence::fetch_presence); let activity = Mutex::new(ActivityData { large_image: Some("northstar".to_string()), @@ -61,14 +71,43 @@ impl Plugin for DiscordRpcPlugin { } } - fn on_sqvm_created(&self, sqvm_handle: &CSquirrelVMHandle) { + fn on_sqvm_created(&self, sqvm_handle: &CSquirrelVMHandle, _: EngineToken) { match sqvm_handle.get_context() { - ScriptVmType::Client | ScriptVmType::Ui => { + ScriptContext::CLIENT | ScriptContext::UI => { run_presence_updates(unsafe { sqvm_handle.get_sqvm() }) } _ => {} } } + + fn on_dll_load( + &self, + engine_data: Option<&EngineData>, + _dll_ptr: &DLLPointer, + _engine_token: EngineToken, + ) { + let Some(engine_data) = engine_data else { + return; + }; + + engine_data + .register_concommand( + "discord_rpc_reload_secrets", + reload_secrets, + "reloads the secrets for joining games", + FCVAR_CLIENTDLL as i32, + ) + .expect("couldn't register reload secrets"); + } +} + +#[rrplug::concommand] +fn reload_secrets() { + PLUGIN.wait().activity.lock().secrets = Secrets { + r#match: Uuid::new_v4().to_string().into(), + join: Uuid::new_v4().to_string().into(), + spectate: None, + }; } entry!(DiscordRpcPlugin); diff --git a/src/presence.rs b/src/presence.rs index 7cc7ece..de77d0f 100644 --- a/src/presence.rs +++ b/src/presence.rs @@ -33,11 +33,11 @@ pub fn run_presence_updates(sqvm: UnsafeHandle<*mut HSquirrelVM>) { "#, ) { err.log() - } + }; } /// function to pull presence from the sqvm since in runframe it's impossibke to get the output of a function back -#[rrplug::sqfunction(VM = "UiClient", ExportName = "FetchPresence")] +#[rrplug::sqfunction(VM = "UI | CLIENT", ExportName = "FetchPresence")] pub fn fetch_presence() -> Result<(), String> { let plugin = crate::PLUGIN.wait(); let mut presence_lock = plugin.presence_data.lock(); From b81dbec4d250129b50915bcd5c0436b5199168cc Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Sat, 20 Jan 2024 18:37:58 -0500 Subject: [PATCH 03/11] update rrplug commit pin --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- src/lib.rs | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 04ed413..db65f5c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -411,7 +411,7 @@ dependencies = [ [[package]] name = "rrplug" version = "4.0.0" -source = "git+https://github.com/R2NorthstarTools/rrplug.git?rev=3a31f4a9173d2e82f8d4b2a30bafa3faf57a5158#3a31f4a9173d2e82f8d4b2a30bafa3faf57a5158" +source = "git+https://github.com/R2NorthstarTools/rrplug.git?rev=209a8b4b478ab095e3186dd32a3ed29dc9dbffee#209a8b4b478ab095e3186dd32a3ed29dc9dbffee" dependencies = [ "bitflags 2.4.2", "log", @@ -425,7 +425,7 @@ dependencies = [ [[package]] name = "rrplug_proc" version = "4.0.0" -source = "git+https://github.com/R2NorthstarTools/rrplug.git?rev=3a31f4a9173d2e82f8d4b2a30bafa3faf57a5158#3a31f4a9173d2e82f8d4b2a30bafa3faf57a5158" +source = "git+https://github.com/R2NorthstarTools/rrplug.git?rev=209a8b4b478ab095e3186dd32a3ed29dc9dbffee#209a8b4b478ab095e3186dd32a3ed29dc9dbffee" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index ada3db7..9936bb4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rrplug = { git = "https://github.com/R2NorthstarTools/rrplug.git", rev = "3a31f4a9173d2e82f8d4b2a30bafa3faf57a5158" } +rrplug = { git = "https://github.com/R2NorthstarTools/rrplug.git", rev = "209a8b4b478ab095e3186dd32a3ed29dc9dbffee" } discord-sdk = "0.3.2" tokio = "1.26.0" parking_lot = "0.12.1" diff --git a/src/lib.rs b/src/lib.rs index 9f5d936..4b795e9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,7 @@ use discord_sdk::activity::Secrets; use parking_lot::Mutex; -use rrplug::{bindings::cvar::convar::FCVAR_CLIENTDLL, prelude::*}; +use rrplug::prelude::*; use tokio::runtime::Runtime; use uuid::Uuid; @@ -61,7 +61,6 @@ impl Plugin for DiscordRpcPlugin { Ok(rt) => rt.block_on(async_main()), Err(err) => { log::error!("failed to create a runtime; {:?}", err); - return; } }); @@ -92,10 +91,10 @@ impl Plugin for DiscordRpcPlugin { engine_data .register_concommand( - "discord_rpc_reload_secrets", + "discord_reload_secrets", reload_secrets, "reloads the secrets for joining games", - FCVAR_CLIENTDLL as i32, + 0, ) .expect("couldn't register reload secrets"); } @@ -103,6 +102,8 @@ impl Plugin for DiscordRpcPlugin { #[rrplug::concommand] fn reload_secrets() { + log::info!("secrets reloaded"); + PLUGIN.wait().activity.lock().secrets = Secrets { r#match: Uuid::new_v4().to_string().into(), join: Uuid::new_v4().to_string().into(), From 25ac7b7768fb8dc78656e6f15639956b3508c2bc Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Sat, 20 Jan 2024 22:35:44 -0500 Subject: [PATCH 04/11] add a basic interface for game invites --- src/discord.rs | 28 ++++++++++++++++++++++++++-- src/lib.rs | 5 +++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/discord.rs b/src/discord.rs index 1af945c..c83b872 100644 --- a/src/discord.rs +++ b/src/discord.rs @@ -3,15 +3,16 @@ use std::num::NonZeroU32; use discord_sdk::{ - activity::{ActivityBuilder, Assets, PartyPrivacy}, + activity::{events::ActivityEvent, ActivityBuilder, Assets, JoinRequestReply, PartyPrivacy}, user::User, wheel::UserState, wheel::Wheel, Discord, DiscordApp, Subscriptions, }; use rrplug::prelude::*; +use tokio::sync::broadcast::Receiver; -use crate::exports::PLUGIN; +use crate::{exports::PLUGIN, invite_handler::JOIN_HANDLER_FUNCTION}; /// the discord app's id, taken from older v1 discord rpc // const APP_ID: i64 = 941428101429231617; @@ -43,6 +44,8 @@ pub async fn async_main() { Err(err) => log::error!("coudln't clear activity because of {:?}", err), } + let mut events = client.wheel.activity().0; + loop { let data = activity.lock().clone(); @@ -85,10 +88,31 @@ pub async fn async_main() { return; } + handle_activity_events(&mut events, &client.discord).await; + wait(1000); } } +async fn handle_activity_events( + events: &mut Receiver, + discord: &Discord, +) -> Option<()> { + match events.try_recv().ok()? { + ActivityEvent::Join(join) => JOIN_HANDLER_FUNCTION.lock()(join.secret), + ActivityEvent::Spectate(_) => log::warn!("spectating cannot be supported!"), + ActivityEvent::JoinRequest(request) => { + log::info!("{} joined the party", request.user.username); + _ = discord + .send_join_request_reply(request.user.id, JoinRequestReply::Yes) + .await; + } + _ => {} + } + + None +} + /// discord connection init sourced from https://github.com/EmbarkStudios/discord-sdk/blob/d311db749b7e11cc55cb1a9d7bfd9a95cfe61fd1/examples-shared/src/lib.rs#L16 pub async fn make_client(subs: Subscriptions) -> Result { let (wheel, handler) = Wheel::new(Box::new(|err| { diff --git a/src/lib.rs b/src/lib.rs index 4b795e9..16017bd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,17 +2,20 @@ use discord_sdk::activity::Secrets; use parking_lot::Mutex; +use rrplug::interfaces::manager::register_interface; use rrplug::prelude::*; use tokio::runtime::Runtime; use uuid::Uuid; use crate::{ discord::async_main, + invite_handler::InviteHandler, presence::run_presence_updates, presense_bindings::{GameState, GameStateStruct, UIPresenceStruct}, }; pub(crate) mod discord; +pub(crate) mod invite_handler; pub(crate) mod presence; pub(crate) mod presense_bindings; @@ -51,6 +54,8 @@ impl Plugin for DiscordRpcPlugin { fn new(_: bool) -> Self { register_sq_functions(presence::fetch_presence); + unsafe { register_interface("InviteHandler001", InviteHandler::new()) }; + let activity = Mutex::new(ActivityData { large_image: Some("northstar".to_string()), state: "Loading...".to_string(), From 7f0fe7237f64391a40187c367d0f6de2e03c5ab1 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Sun, 21 Jan 2024 14:37:53 -0500 Subject: [PATCH 05/11] remove non required stuff --- Cargo.lock | 21 --------------------- Cargo.toml | 1 - src/discord.rs | 3 +-- src/lib.rs | 32 -------------------------------- 4 files changed, 1 insertion(+), 56 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index db65f5c..403d86e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -180,17 +180,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "getrandom" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - [[package]] name = "gimli" version = "0.28.1" @@ -303,7 +292,6 @@ dependencies = [ "parking_lot", "rrplug", "tokio", - "uuid", ] [[package]] @@ -659,15 +647,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "uuid" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" -dependencies = [ - "getrandom", -] - [[package]] name = "walkdir" version = "2.4.0" diff --git a/Cargo.toml b/Cargo.toml index 9936bb4..0dd859f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,6 @@ rrplug = { git = "https://github.com/R2NorthstarTools/rrplug.git", rev = "209a8b discord-sdk = "0.3.2" tokio = "1.26.0" parking_lot = "0.12.1" -uuid = { version = "1.7.0", features = ["v4"] } [lib] name = "DiscordRPC" diff --git a/src/discord.rs b/src/discord.rs index 1af945c..53e52fd 100644 --- a/src/discord.rs +++ b/src/discord.rs @@ -14,8 +14,7 @@ use rrplug::prelude::*; use crate::exports::PLUGIN; /// the discord app's id, taken from older v1 discord rpc -// const APP_ID: i64 = 941428101429231617; -const APP_ID: i64 = 1198009103516180500; +const APP_ID: i64 = 941428101429231617; /// struct to hold everything required to run discord rpc pub struct Client { diff --git a/src/lib.rs b/src/lib.rs index 4b795e9..2a09573 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,6 @@ use discord_sdk::activity::Secrets; use parking_lot::Mutex; use rrplug::prelude::*; use tokio::runtime::Runtime; -use uuid::Uuid; use crate::{ discord::async_main, @@ -78,37 +77,6 @@ impl Plugin for DiscordRpcPlugin { _ => {} } } - - fn on_dll_load( - &self, - engine_data: Option<&EngineData>, - _dll_ptr: &DLLPointer, - _engine_token: EngineToken, - ) { - let Some(engine_data) = engine_data else { - return; - }; - - engine_data - .register_concommand( - "discord_reload_secrets", - reload_secrets, - "reloads the secrets for joining games", - 0, - ) - .expect("couldn't register reload secrets"); - } -} - -#[rrplug::concommand] -fn reload_secrets() { - log::info!("secrets reloaded"); - - PLUGIN.wait().activity.lock().secrets = Secrets { - r#match: Uuid::new_v4().to_string().into(), - join: Uuid::new_v4().to_string().into(), - spectate: None, - }; } entry!(DiscordRpcPlugin); From 5575053922ca797f8e88265b6900491136d6b42d Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Sat, 3 Feb 2024 19:45:23 -0500 Subject: [PATCH 06/11] bump version in cargo.toml --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 403d86e..d43c8c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -286,7 +286,7 @@ checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" [[package]] name = "northstar-discord-rpc" -version = "0.1.0" +version = "0.4.0" dependencies = [ "discord-sdk", "parking_lot", diff --git a/Cargo.toml b/Cargo.toml index 0dd859f..1c60c48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "northstar-discord-rpc" -version = "0.1.0" +version = "0.4.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html From 0af10ebaa5b000722b9b2feb5f10cc143561a85a Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Sat, 3 Feb 2024 20:27:44 -0500 Subject: [PATCH 07/11] use a better log name --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 2a09573..fce812f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -42,7 +42,7 @@ pub struct DiscordRpcPlugin { impl Plugin for DiscordRpcPlugin { const PLUGIN_INFO: PluginInfo = PluginInfo::new( "DISCORDRPC\0", - "DISCORDXD\0", + "DSCRD-RPC\0", "DISCORDRPC\0", PluginContext::CLIENT, ); From 0c658d1c145c17d78f91340018c6336625a7263a Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Sun, 4 Feb 2024 18:28:37 -0500 Subject: [PATCH 08/11] add invite_handler --- Cargo.lock | 39 +++++++++++++++++++------------- src/discord.rs | 7 ++++-- src/invite_handler.rs | 52 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+), 18 deletions(-) create mode 100644 src/invite_handler.rs diff --git a/Cargo.lock b/Cargo.lock index db65f5c..7fef3a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -243,9 +243,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "libc" -version = "0.2.152" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "lock_api" @@ -271,9 +271,9 @@ checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] @@ -306,6 +306,12 @@ dependencies = [ "uuid", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-traits" version = "0.2.17" @@ -383,9 +389,9 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "proc-macro2" -version = "1.0.76" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -461,18 +467,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", @@ -481,9 +487,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.111" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", @@ -550,11 +556,12 @@ dependencies = [ [[package]] name = "time" -version = "0.3.31" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", + "num-conv", "powerfmt", "serde", "time-core", @@ -583,9 +590,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "libc", diff --git a/src/discord.rs b/src/discord.rs index c83b872..3c95cc5 100644 --- a/src/discord.rs +++ b/src/discord.rs @@ -9,7 +9,7 @@ use discord_sdk::{ wheel::Wheel, Discord, DiscordApp, Subscriptions, }; -use rrplug::prelude::*; +use rrplug::{mid::utils::try_cstring, prelude::*}; use tokio::sync::broadcast::Receiver; use crate::{exports::PLUGIN, invite_handler::JOIN_HANDLER_FUNCTION}; @@ -99,7 +99,10 @@ async fn handle_activity_events( discord: &Discord, ) -> Option<()> { match events.try_recv().ok()? { - ActivityEvent::Join(join) => JOIN_HANDLER_FUNCTION.lock()(join.secret), + ActivityEvent::Join(join) => { + let secret = try_cstring(&join.secret).expect("I like null bytes in my strings cool"); + JOIN_HANDLER_FUNCTION.lock()(secret.as_ptr()) + } ActivityEvent::Spectate(_) => log::warn!("spectating cannot be supported!"), ActivityEvent::JoinRequest(request) => { log::info!("{} joined the party", request.user.username); diff --git a/src/invite_handler.rs b/src/invite_handler.rs new file mode 100644 index 0000000..f239b6d --- /dev/null +++ b/src/invite_handler.rs @@ -0,0 +1,52 @@ +use parking_lot::Mutex; +use std::ffi::{c_char, CStr}; + +use crate::PLUGIN; + +pub static JOIN_HANDLER_FUNCTION: Mutex = Mutex::new(default_join_handler); + +type JoinHandler = extern "C" fn(*const c_char); + +#[repr(C)] +#[must_use] +pub enum IniviteHandlerResult { + Sucess, + Failure, +} + +#[repr(C)] +pub(crate) struct InviteHandler; + +#[rrplug::as_interface] +impl InviteHandler { + pub fn new() -> Self { + Self + } + + pub fn set_join_handler(&self, handler: JoinHandler) { + *JOIN_HANDLER_FUNCTION.lock() = handler; + } + + pub fn set_secret(&self, secret: *const c_char) -> IniviteHandlerResult { + if secret.is_null() { + return IniviteHandlerResult::Failure; + } + + let Some(secret) = unsafe { CStr::from_ptr(secret) }.to_str().ok() else { + return IniviteHandlerResult::Failure; + }; + + PLUGIN.wait().activity.lock().secrets.join = Some(secret.to_string()); + IniviteHandlerResult::Sucess + } + + pub fn clear_secret(&self) { + let secrets = &mut PLUGIN.wait().activity.lock().secrets; + + secrets.r#match = None; + secrets.join = None; + secrets.spectate = None; + } +} + +extern "C" fn default_join_handler(_secret: *const c_char) {} From 98f091348c3c5f93b0435a7bbeab289505e87560 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Thu, 8 Feb 2024 17:06:39 -0500 Subject: [PATCH 09/11] document the interface --- src/invite_handler.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/invite_handler.rs b/src/invite_handler.rs index f239b6d..3aacf9a 100644 --- a/src/invite_handler.rs +++ b/src/invite_handler.rs @@ -7,6 +7,9 @@ pub static JOIN_HANDLER_FUNCTION: Mutex = Mutex::new(default_join_h type JoinHandler = extern "C" fn(*const c_char); +/// Success/Failure +/// +/// fails if the string is non utf-8 or the pointer is null #[repr(C)] #[must_use] pub enum IniviteHandlerResult { @@ -14,6 +17,7 @@ pub enum IniviteHandlerResult { Failure, } +/// registered as "InviteHandler001" #[repr(C)] pub(crate) struct InviteHandler; @@ -23,10 +27,16 @@ impl InviteHandler { Self } + /// Will always provide a valid null terminated string to the join handler. + /// + /// The join handler is called when the discord rpc client joins a party. Has to handled immediately. + /// + /// Discord doesn't track who is in the party. Discord only sends the secrets. pub fn set_join_handler(&self, handler: JoinHandler) { *JOIN_HANDLER_FUNCTION.lock() = handler; } + /// sets a secret for party which will be provided to everyone that joins the party pub fn set_secret(&self, secret: *const c_char) -> IniviteHandlerResult { if secret.is_null() { return IniviteHandlerResult::Failure; @@ -40,6 +50,7 @@ impl InviteHandler { IniviteHandlerResult::Sucess } + /// removes the secret which destroys the party invite pub fn clear_secret(&self) { let secrets = &mut PLUGIN.wait().activity.lock().secrets; From b2d8c8114e0e9183126d6ca91977eb1cc2a6042e Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Thu, 14 Mar 2024 18:23:04 -0400 Subject: [PATCH 10/11] more logging and better errors --- src/discord.rs | 1 + src/invite_handler.rs | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/discord.rs b/src/discord.rs index 235425b..f31db58 100644 --- a/src/discord.rs +++ b/src/discord.rs @@ -99,6 +99,7 @@ async fn handle_activity_events( ) -> Option<()> { match events.try_recv().ok()? { ActivityEvent::Join(join) => { + log::info!("invite proccessing"); let secret = try_cstring(&join.secret).expect("I like null bytes in my strings cool"); JOIN_HANDLER_FUNCTION.lock()(secret.as_ptr()) } diff --git a/src/invite_handler.rs b/src/invite_handler.rs index 3aacf9a..05a525f 100644 --- a/src/invite_handler.rs +++ b/src/invite_handler.rs @@ -7,14 +7,15 @@ pub static JOIN_HANDLER_FUNCTION: Mutex = Mutex::new(default_join_h type JoinHandler = extern "C" fn(*const c_char); -/// Success/Failure +/// C Compatible Result Enum /// /// fails if the string is non utf-8 or the pointer is null #[repr(C)] #[must_use] pub enum IniviteHandlerResult { - Sucess, - Failure, + Ok, + NullSecret, + NonUtf8Secret, } /// registered as "InviteHandler001" @@ -39,15 +40,15 @@ impl InviteHandler { /// sets a secret for party which will be provided to everyone that joins the party pub fn set_secret(&self, secret: *const c_char) -> IniviteHandlerResult { if secret.is_null() { - return IniviteHandlerResult::Failure; + return IniviteHandlerResult::NullSecret; } let Some(secret) = unsafe { CStr::from_ptr(secret) }.to_str().ok() else { - return IniviteHandlerResult::Failure; + return IniviteHandlerResult::NonUtf8Secret; }; PLUGIN.wait().activity.lock().secrets.join = Some(secret.to_string()); - IniviteHandlerResult::Sucess + IniviteHandlerResult::Ok } /// removes the secret which destroys the party invite From 1f4112433d9fdcd02d329527492bf17c39850824 Mon Sep 17 00:00:00 2001 From: catornot <41955154+catornot@users.noreply.github.com> Date: Fri, 5 Jul 2024 20:38:34 +0700 Subject: [PATCH 11/11] rrplug 4 and update deps --- Cargo.lock | 289 +++++++++++++++++++++++++----------------------- Cargo.toml | 2 +- src/discord.rs | 1 + src/lib.rs | 8 +- src/presence.rs | 48 +++----- 5 files changed, 173 insertions(+), 175 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 20aabca..3f6466f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ "gimli", ] @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "app_dirs2" @@ -37,9 +37,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.77" +version = "0.1.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", @@ -48,15 +48,15 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", "cc", @@ -69,30 +69,21 @@ dependencies = [ [[package]] name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.2" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "74b6a57f98764a267ff415d50a25e6e166f3831a5071af4995296ea97d210490" [[package]] name = "cesu8" @@ -108,9 +99,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "combine" -version = "4.6.6" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" dependencies = [ "bytes", "memchr", @@ -118,24 +109,24 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.11" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "data-encoding" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[package]] name = "deranged" @@ -148,14 +139,14 @@ dependencies = [ [[package]] name = "discord-sdk" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b00ca50adbf896a56145729b1800f5db27ce31f2513dbb9b44e27b23aa716a57" +checksum = "dc3d7a4f9bc39006b732a01d63b34ff1518313313d707cb18cf6187d2124f7f4" dependencies = [ "anyhow", "app_dirs2", "async-trait", - "bitflags 2.4.2", + "bitflags", "crossbeam-channel", "data-encoding", "num-traits", @@ -182,15 +173,15 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "hermit-abi" -version = "0.3.4" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "idna" @@ -204,9 +195,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jni" @@ -232,15 +223,15 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -248,30 +239,30 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "wasi", @@ -302,9 +293,9 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -321,9 +312,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.2" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" dependencies = [ "memchr", ] @@ -336,9 +327,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -346,15 +337,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -365,9 +356,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "powerfmt" @@ -377,37 +368,38 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] name = "rrplug" version = "4.0.0" -source = "git+https://github.com/R2NorthstarTools/rrplug.git?rev=209a8b4b478ab095e3186dd32a3ed29dc9dbffee#209a8b4b478ab095e3186dd32a3ed29dc9dbffee" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4beccc264275850d6526bc531934bbcb254b2350bb4a5723964ad6d95b4abd" dependencies = [ - "bitflags 2.4.2", + "bitflags", "log", "once_cell", "parking_lot", @@ -419,7 +411,8 @@ dependencies = [ [[package]] name = "rrplug_proc" version = "4.0.0" -source = "git+https://github.com/R2NorthstarTools/rrplug.git?rev=209a8b4b478ab095e3186dd32a3ed29dc9dbffee#209a8b4b478ab095e3186dd32a3ed29dc9dbffee" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb023a15963bb3d031369610b680dc23c1bac985a3a352cacdd4cb9df9e038d0" dependencies = [ "proc-macro2", "quote", @@ -428,15 +421,15 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "same-file" @@ -455,18 +448,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", @@ -475,9 +468,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.113" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" dependencies = [ "itoa", "ryu", @@ -486,9 +479,9 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", @@ -497,25 +490,25 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "syn" -version = "2.0.48" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", @@ -524,18 +517,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", @@ -544,9 +537,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "num-conv", @@ -563,9 +556,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "c55115c6fbe2d2bef26eb09ad74bde02d8255476fc0c7b515ef09fbb35742d82" dependencies = [ "tinyvec_macros", ] @@ -578,9 +571,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.36.0" +version = "1.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ "backtrace", "libc", @@ -636,18 +629,18 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", @@ -656,9 +649,9 @@ dependencies = [ [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -688,11 +681,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "winapi", + "windows-sys 0.52.0", ] [[package]] @@ -708,7 +701,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ "windows-core", - "windows-targets 0.52.0", + "windows-targets 0.52.6", ] [[package]] @@ -717,7 +710,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.6", ] [[package]] @@ -738,6 +731,15 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-targets" version = "0.42.2" @@ -770,17 +772,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -797,9 +800,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -815,9 +818,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -833,9 +836,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -851,9 +860,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -869,9 +878,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -887,9 +896,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -905,15 +914,15 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winreg" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "937f3df7948156640f46aacef17a70db0de5917bda9c92b0f751f3a955b588fc" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" dependencies = [ "cfg-if", "windows-sys 0.48.0", diff --git a/Cargo.toml b/Cargo.toml index 1c60c48..07afdde 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rrplug = { git = "https://github.com/R2NorthstarTools/rrplug.git", rev = "209a8b4b478ab095e3186dd32a3ed29dc9dbffee" } +rrplug = "4.0.0" discord-sdk = "0.3.2" tokio = "1.26.0" parking_lot = "0.12.1" diff --git a/src/discord.rs b/src/discord.rs index f31db58..69d227a 100644 --- a/src/discord.rs +++ b/src/discord.rs @@ -18,6 +18,7 @@ use crate::{exports::PLUGIN, invite_handler::JOIN_HANDLER_FUNCTION}; const APP_ID: i64 = 941428101429231617; /// struct to hold everything required to run discord rpc +#[allow(dead_code)] pub struct Client { pub discord: Discord, pub user: User, diff --git a/src/lib.rs b/src/lib.rs index e244d2c..b0821e2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -44,9 +44,9 @@ pub struct DiscordRpcPlugin { #[deny(non_snake_case)] impl Plugin for DiscordRpcPlugin { const PLUGIN_INFO: PluginInfo = PluginInfo::new( - "DISCORDRPC\0", - "DSCRD-RPC\0", - "DISCORDRPC\0", + c"DISCORDRPC", + c"DSCRD-RPC", + c"DISCORDRPC", PluginContext::CLIENT, ); @@ -77,7 +77,7 @@ impl Plugin for DiscordRpcPlugin { fn on_sqvm_created(&self, sqvm_handle: &CSquirrelVMHandle, _: EngineToken) { match sqvm_handle.get_context() { ScriptContext::CLIENT | ScriptContext::UI => { - run_presence_updates(unsafe { sqvm_handle.get_sqvm() }) + run_presence_updates(unsafe { sqvm_handle.get_sqvm().take() }) } _ => {} } diff --git a/src/presence.rs b/src/presence.rs index de77d0f..dda5473 100644 --- a/src/presence.rs +++ b/src/presence.rs @@ -1,11 +1,11 @@ #![deny(non_snake_case)] +use rrplug::mid::squirrel::sqvm_to_context; use rrplug::prelude::*; use rrplug::{ - bindings::squirrelclasstypes::ScriptContext, - call_sq_function, - high::{squirrel::compile_string, UnsafeHandle}, + bindings::squirrelclasstypes::ScriptContext, call_sq_function, high::squirrel::compile_string, }; +use std::ptr::NonNull; use std::{ ops::DerefMut, time::{SystemTime, UNIX_EPOCH}, @@ -14,8 +14,7 @@ use std::{ use crate::presense_bindings::{GameState, GameStateStruct, UIPresenceStruct}; // heartbeat for pulling presence -pub fn run_presence_updates(sqvm: UnsafeHandle<*mut HSquirrelVM>) { - let sqvm = *sqvm.get(); +pub fn run_presence_updates(sqvm: NonNull) { let sq_functions = SQFUNCTIONS.client.wait(); if let Err(err) = compile_string( @@ -42,18 +41,7 @@ pub fn fetch_presence() -> Result<(), String> { let plugin = crate::PLUGIN.wait(); let mut presence_lock = plugin.presence_data.lock(); let (cl_presence, ui_presence) = presence_lock.deref_mut(); - let sqvm = unsafe { sqvm.as_mut().ok_or_else(|| "None sqvm".to_string())? }; - let context = unsafe { - std::mem::transmute::<_, ScriptContext>( - sqvm.sharedState - .as_ref() - .ok_or_else(|| "None shared state".to_string())? - .cSquirrelVM - .as_ref() - .ok_or_else(|| "None csqvm".to_string())? - .vmContext, - ) - }; + let context = unsafe { sqvm_to_context(sqvm) }; match context { ScriptContext::CLIENT => { @@ -68,11 +56,10 @@ pub fn fetch_presence() -> Result<(), String> { #[cfg(not(debug_assertions))] drop(err); } else { - *cl_presence = GameStateStruct::get_from_sqvm( - sqvm, - SQFUNCTIONS.client.wait(), - sqvm._stackbase, - ); + *cl_presence = + GameStateStruct::get_from_sqvm(sqvm, SQFUNCTIONS.client.wait(), unsafe { + sqvm.as_ref()._stackbase + }); } } ScriptContext::UI => { @@ -89,11 +76,10 @@ pub fn fetch_presence() -> Result<(), String> { drop(err); } Ok(_) => { - *ui_presence = UIPresenceStruct::get_from_sqvm( - sqvm, - SQFUNCTIONS.client.wait(), - sqvm._stackbase, - ); + *ui_presence = + UIPresenceStruct::get_from_sqvm(sqvm, SQFUNCTIONS.client.wait(), unsafe { + sqvm.as_ref()._stackbase + }); } } } @@ -155,8 +141,8 @@ fn on_presence_updated( cl_presence.current_players.try_into().unwrap_or_default(), cl_presence.max_players.try_into().unwrap_or_default(), )); - activity.details = map_displayname.clone(); - activity.state = map_displayname.clone(); + map_displayname.clone_into(&mut activity.details); + map_displayname.clone_into(&mut activity.state); activity.large_image = Some(cl_presence.map.clone()); activity.large_text = Some(map_displayname); activity.small_image = Some("northstar".to_string()); @@ -165,7 +151,9 @@ fn on_presence_updated( activity.party = None; activity.end = None; } else { - activity.state = cl_presence.playlist_displayname.clone(); + cl_presence + .playlist_displayname + .clone_into(&mut activity.state); activity.details = format!( "Score: {} - {} (First to {})", cl_presence.own_score, cl_presence.other_highest_score, cl_presence.max_score,