aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock195
-rw-r--r--Cargo.toml8
-rw-r--r--client/Cargo.toml13
-rw-r--r--client/src/client.rs157
-rw-r--r--client/src/main.rs10
5 files changed, 272 insertions, 111 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 3740208..9c3d793 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -68,7 +68,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee91c0c2905bae44f84bfa4e044536541df26b7703fd0888deeb9060fcc44289"
dependencies = [
"android-properties",
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"cc",
"cesu8",
"jni",
@@ -89,7 +89,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef6978589202a00cd7e118380c448a08b6ed394c3a8df3a430d0898e3a42d046"
dependencies = [
"android-properties",
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"cc",
"cesu8",
"jni",
@@ -295,9 +295,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
-version = "2.6.0"
+version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
+checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be"
dependencies = [
"serde",
]
@@ -369,7 +369,7 @@ checksum = "3fa76293b4f7bb636ab88fd78228235b5248b4d05cc589aed610f954af5d7c7a"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.95",
+ "syn 2.0.96",
]
[[package]]
@@ -390,7 +390,7 @@ version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"log 0.4.22",
"polling",
"rustix",
@@ -404,7 +404,7 @@ version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"log 0.4.22",
"polling",
"rustix",
@@ -438,9 +438,9 @@ dependencies = [
[[package]]
name = "cc"
-version = "1.2.7"
+version = "1.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a012a0df96dd6d06ba9a1b29d6402d1a5d77c6befd2566afdc26e10603dc93d7"
+checksum = "c8293772165d9345bdaaa39b45b2109591e63fe5e6fbc23c6ff930a048aa310b"
dependencies = [
"jobserver",
"libc",
@@ -484,15 +484,19 @@ dependencies = [
"anyhow",
"arrayvec 0.5.2",
"env_logger 0.11.6",
+ "libtw2-demo",
"libtw2-event-loop",
+ "libtw2-gamenet-common",
"libtw2-gamenet-ddnet",
"libtw2-packer",
"libtw2-snapshot",
"log 0.4.22",
"twgame 0.9.3",
"twgpu",
+ "twsnap 0.7.3",
"warn",
"winit 0.30.8",
+ "xdg",
]
[[package]]
@@ -668,7 +672,7 @@ version = "22.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdbd1f579714e3c809ebd822c81ef148b1ceaeb3d535352afc73fd0c4c6a0017"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"libloading",
"winapi 0.3.9",
]
@@ -837,7 +841,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.95",
+ "syn 2.0.96",
]
[[package]]
@@ -920,9 +924,9 @@ dependencies = [
[[package]]
name = "glutin_wgl_sys"
-version = "0.6.0"
+version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0a4e1951bbd9434a81aa496fe59ccc2235af3820d27b85f9314e279609211e2c"
+checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e"
dependencies = [
"gl_generator",
]
@@ -933,7 +937,7 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"gpu-alloc-types",
]
@@ -943,7 +947,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
]
[[package]]
@@ -965,7 +969,7 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcf29e94d6d243368b7a56caa16bc213e4f9f8ed38c4d9557069527b5d5281ca"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"gpu-descriptor-types",
"hashbrown 0.15.2",
]
@@ -976,7 +980,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
]
[[package]]
@@ -1015,7 +1019,7 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"com",
"libc",
"libloading",
@@ -1235,7 +1239,7 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"libc",
"redox_syscall 0.5.8",
]
@@ -1249,6 +1253,22 @@ dependencies = [
]
[[package]]
+name = "libtw2-demo"
+version = "0.0.1"
+dependencies = [
+ "arrayvec 0.5.2",
+ "binrw",
+ "buffer",
+ "libtw2-common",
+ "libtw2-gamenet-common",
+ "libtw2-huffman",
+ "libtw2-packer",
+ "libtw2-snapshot",
+ "thiserror",
+ "warn",
+]
+
+[[package]]
name = "libtw2-event-loop"
version = "0.0.1"
dependencies = [
@@ -1488,7 +1508,7 @@ version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"block",
"core-graphics-types",
"foreign-types",
@@ -1552,7 +1572,7 @@ checksum = "8bd5a652b6faf21496f2cfd88fc49989c8db0825d1f6746b1a71a6ede24a63ad"
dependencies = [
"arrayvec 0.7.6",
"bit-set",
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"cfg_aliases 0.1.1",
"codespan-reporting",
"hexf-parse",
@@ -1584,7 +1604,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"jni-sys",
"log 0.4.22",
"ndk-sys 0.5.0+25.2.9519653",
@@ -1599,7 +1619,7 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"jni-sys",
"log 0.4.22",
"ndk-sys 0.6.0+11769913",
@@ -1698,7 +1718,7 @@ dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
- "syn 2.0.95",
+ "syn 2.0.96",
]
[[package]]
@@ -1742,7 +1762,7 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"block2 0.5.1",
"libc",
"objc2 0.5.2",
@@ -1758,7 +1778,7 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"block2 0.5.1",
"objc2 0.5.2",
"objc2-core-location",
@@ -1782,7 +1802,7 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"block2 0.5.1",
"objc2 0.5.2",
"objc2-foundation",
@@ -1830,7 +1850,7 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"block2 0.5.1",
"dispatch",
"libc",
@@ -1855,7 +1875,7 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"block2 0.5.1",
"objc2 0.5.2",
"objc2-foundation",
@@ -1867,7 +1887,7 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"block2 0.5.1",
"objc2 0.5.2",
"objc2-foundation",
@@ -1890,7 +1910,7 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"block2 0.5.1",
"objc2 0.5.2",
"objc2-cloud-kit",
@@ -1922,7 +1942,7 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"block2 0.5.1",
"objc2 0.5.2",
"objc2-core-location",
@@ -2023,7 +2043,7 @@ checksum = "d56a66c0c55993aa927429d0f8a0abfd74f084e4d9c192cffed01e418d83eefb"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.95",
+ "syn 2.0.96",
]
[[package]]
@@ -2222,9 +2242,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
-version = "1.0.92"
+version = "1.0.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
+checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
dependencies = [
"unicode-ident",
]
@@ -2363,7 +2383,7 @@ version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
]
[[package]]
@@ -2441,7 +2461,7 @@ version = "0.38.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"errno",
"libc",
"linux-raw-sys",
@@ -2534,7 +2554,7 @@ checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.95",
+ "syn 2.0.96",
]
[[package]]
@@ -2591,7 +2611,7 @@ version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "922fd3eeab3bd820d76537ce8f582b1cf951eceb5475c28500c7457d9d17f53a"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"calloop 0.12.4",
"calloop-wayland-source 0.2.0",
"cursor-icon",
@@ -2616,7 +2636,7 @@ version = "0.19.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"calloop 0.13.0",
"calloop-wayland-source 0.3.0",
"cursor-icon",
@@ -2650,7 +2670,7 @@ version = "0.3.0+sdk-1.3.268.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
]
[[package]]
@@ -2699,9 +2719,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.95"
+version = "2.0.96"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "46f71c0377baf4ef1cc3e3402ded576dccc315800fbc62dfc7fe04b009773b4a"
+checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80"
dependencies = [
"proc-macro2",
"quote",
@@ -2715,7 +2735,7 @@ dependencies = [
"arrayvec 0.7.6",
"nom",
"serde",
- "uuid 1.11.0",
+ "uuid 1.11.1",
]
[[package]]
@@ -2727,7 +2747,7 @@ dependencies = [
"arrayvec 0.7.6",
"nom",
"serde",
- "uuid 1.11.0",
+ "uuid 1.11.1",
]
[[package]]
@@ -2756,7 +2776,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.95",
+ "syn 2.0.96",
]
[[package]]
@@ -2858,7 +2878,7 @@ name = "twgame"
version = "0.9.3"
dependencies = [
"arrayvec 0.7.6",
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"hashbrown 0.14.5",
"indexmap",
"log 0.4.22",
@@ -2870,7 +2890,7 @@ dependencies = [
"slotmap",
"twgame-core 0.7.1",
"twmap",
- "uuid 1.11.0",
+ "uuid 1.11.1",
"vek",
]
@@ -2881,7 +2901,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2414e8c25df50e78cdeb486ef648599a22a68fbbd220ac2bd1ac10cdd74fc78d"
dependencies = [
"arrayvec 0.7.6",
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"hashbrown 0.14.5",
"indexmap",
"log 0.4.22",
@@ -2893,7 +2913,7 @@ dependencies = [
"slotmap",
"twgame-core 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"twmap",
- "uuid 1.11.0",
+ "uuid 1.11.1",
"vek",
]
@@ -2908,7 +2928,7 @@ dependencies = [
"pre-rfc3243-libtw2-packer",
"serde",
"teehistorian 0.12.0",
- "twsnap",
+ "twsnap 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
"vek",
"warn",
]
@@ -2926,7 +2946,7 @@ dependencies = [
"pre-rfc3243-libtw2-packer",
"serde",
"teehistorian 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "twsnap",
+ "twsnap 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
"vek",
"warn",
]
@@ -2943,7 +2963,7 @@ dependencies = [
"rand_pcg",
"twgame 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
"twmap",
- "twsnap",
+ "twsnap 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
"vek",
"wgpu",
"winit 0.29.15",
@@ -2956,7 +2976,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "420a7fab81c01d4a646f24834492d9ee8f606e491fa81610a192b5be0bbd7688"
dependencies = [
"az",
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"bytemuck",
"fixed",
"flate2",
@@ -2977,11 +2997,28 @@ dependencies = [
[[package]]
name = "twsnap"
version = "0.7.3"
+dependencies = [
+ "arrayvec 0.7.6",
+ "bitflags 2.7.0",
+ "fixed",
+ "hashbrown 0.14.5",
+ "libtw2-common",
+ "libtw2-demo",
+ "libtw2-gamenet-ddnet",
+ "num_enum",
+ "serde",
+ "vek",
+ "warn",
+]
+
+[[package]]
+name = "twsnap"
+version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ffb55636a9828dda08ad4f9d7e2a232007dc339b949d412709941646665cbbb"
dependencies = [
"arrayvec 0.7.6",
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"fixed",
"hashbrown 0.14.5",
"num_enum",
@@ -3055,9 +3092,9 @@ dependencies = [
[[package]]
name = "uuid"
-version = "1.11.0"
+version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a"
+checksum = "b913a3b5fe84142e269d63cc62b64319ccaf89b748fc31fe025177f767a756c4"
dependencies = [
"getrandom",
"serde",
@@ -3148,7 +3185,7 @@ dependencies = [
"log 0.4.22",
"proc-macro2",
"quote",
- "syn 2.0.95",
+ "syn 2.0.96",
"wasm-bindgen-shared",
]
@@ -3183,7 +3220,7 @@ checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.95",
+ "syn 2.0.96",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@@ -3214,7 +3251,7 @@ version = "0.31.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b66249d3fc69f76fd74c82cc319300faa554e9d865dab1f7cd66cc20db10b280"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"rustix",
"wayland-backend",
"wayland-scanner",
@@ -3226,7 +3263,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"cursor-icon",
"wayland-backend",
]
@@ -3248,7 +3285,7 @@ version = "0.31.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"wayland-backend",
"wayland-client",
"wayland-scanner",
@@ -3260,7 +3297,7 @@ version = "0.32.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cd0ade57c4e6e9a8952741325c30bf82f4246885dca8bf561898b86d0c1f58e"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"wayland-backend",
"wayland-client",
"wayland-scanner",
@@ -3272,7 +3309,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"wayland-backend",
"wayland-client",
"wayland-protocols 0.31.2",
@@ -3285,7 +3322,7 @@ version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b31cab548ee68c7eb155517f2212049dc151f7cd7910c2b66abfd31c3ee12bd"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"wayland-backend",
"wayland-client",
"wayland-protocols 0.32.5",
@@ -3298,7 +3335,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"wayland-backend",
"wayland-client",
"wayland-protocols 0.31.2",
@@ -3311,7 +3348,7 @@ version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "782e12f6cd923c3c316130d56205ebab53f55d6666b7faddfad36cecaeeb4022"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"wayland-backend",
"wayland-client",
"wayland-protocols 0.32.5",
@@ -3410,7 +3447,7 @@ checksum = "0348c840d1051b8e86c3bcd31206080c5e71e5933dabd79be1ce732b0b2f089a"
dependencies = [
"arrayvec 0.7.6",
"bit-vec",
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"cfg_aliases 0.1.1",
"document-features",
"indexmap",
@@ -3437,7 +3474,7 @@ dependencies = [
"arrayvec 0.7.6",
"ash",
"bit-set",
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"block",
"cfg_aliases 0.1.1",
"core-graphics-types",
@@ -3478,7 +3515,7 @@ version = "22.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc9d91f0e2c4b51434dfa6db77846f2793149d8e73f800fa2e41f52b8eac3c5d"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"js-sys",
"web-sys",
]
@@ -3774,7 +3811,7 @@ dependencies = [
"ahash",
"android-activity 0.5.2",
"atomic-waker",
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"bytemuck",
"calloop 0.12.4",
"cfg_aliases 0.1.1",
@@ -3822,7 +3859,7 @@ dependencies = [
"ahash",
"android-activity 0.6.0",
"atomic-waker",
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"block2 0.5.1",
"bytemuck",
"calloop 0.13.0",
@@ -3867,9 +3904,9 @@ dependencies = [
[[package]]
name = "winnow"
-version = "0.6.22"
+version = "0.6.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "39281189af81c07ec09db316b302a3e67bf9bd7cbf6c820b50e35fee9c2fa980"
+checksum = "c8d71a593cc5c42ad7876e2c1fda56f314f3754c084128833e64f1345ff8a03a"
dependencies = [
"memchr 2.7.4",
]
@@ -3933,12 +3970,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ef33da6b1660b4ddbfb3aef0ade110c8b8a781a3b6382fa5f2b5b040fd55f61"
[[package]]
+name = "xdg"
+version = "2.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546"
+
+[[package]]
name = "xkbcommon-dl"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"dlib",
"log 0.4.22",
"once_cell",
@@ -3975,7 +4018,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.95",
+ "syn 2.0.96",
]
[[package]]
diff --git a/Cargo.toml b/Cargo.toml
index 0e1d230..194e10c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,3 +1,11 @@
[workspace]
members = ["client"]
resolver = "3"
+
+# [patch.crates-io]
+# libtw2-gamenet-ddnet = { path = "../libtw2/gamenet/ddnet" }
+# libtw2-gamenet-common = { path = "../libtw2/gamenet/common" }
+# libtw2-event-loop = { path = "../libtw2/event-loop" }
+# libtw2-packer = { path = "../libtw2/packer" }
+# libtw2-demo = { path = "../libtw2/demo" }
+# libtw2-snapshot = { path = "../libtw2/snapshot" }
diff --git a/client/Cargo.toml b/client/Cargo.toml
index ab58a0f..471a905 100644
--- a/client/Cargo.toml
+++ b/client/Cargo.toml
@@ -9,12 +9,23 @@ env_logger = "0.11.6"
anyhow = "1.0.95"
arrayvec = "0.5.2"
warn = ">=0.1.1,<0.3.0"
+xdg = "2.5.2"
winit = "0.30.8"
twgame = { path = "../../twgame/twgame" }
twgpu = { path = "../../twgpu/twgpu" }
+twsnap = { path = "../../twsnap" }
libtw2-gamenet-ddnet = { path = "../../libtw2/gamenet/ddnet" }
+libtw2-gamenet-common = { path = "../../libtw2/gamenet/common" }
libtw2-event-loop = { path = "../../libtw2/event-loop" }
libtw2-packer = { path = "../../libtw2/packer" }
-libtw2-snapshot = { path = "../../libtw2/snapshot" } \ No newline at end of file
+libtw2-demo = { path = "../../libtw2/demo" }
+libtw2-snapshot = { path = "../../libtw2/snapshot" }
+
+# pre-rfc3243-libtw2-gamenet-ddnet = "*"
+# pre-rfc3243-libtw2-gamenet-common = "*"
+# pre-rfc3243-libtw2-event-loop = "*"
+# pre-rfc3243-libtw2-packer = "*"
+# pre-rfc3243-libtw2-snapshot = "*"
+# pre-rfc3243-libtw2-demo = "*"
diff --git a/client/src/client.rs b/client/src/client.rs
index 0db4389..9f23c41 100644
--- a/client/src/client.rs
+++ b/client/src/client.rs
@@ -8,15 +8,21 @@ use libtw2_gamenet_ddnet::{
msg::{
self, Game, System, SystemOrGame,
game::{ClSetTeam, ClStartInfo},
- system::{EnterGame, Info, Ready},
+ system::{EnterGame, Info, MapChange, Ready, RequestMapData},
},
+ snap_obj::obj_size,
};
-use libtw2_packer::{Unpacker, with_packer};
-use log::warn;
+use libtw2_packer::{IntUnpacker, Unpacker, with_packer};
+use libtw2_snapshot::Manager as SnapManager;
+use log::{debug, info, warn};
use std::{
- fmt::{self, Debug},
+ fmt::Debug,
+ fs::File,
+ io::Write,
net::{IpAddr, Ipv4Addr},
+ path::PathBuf,
};
+use twsnap::{Snap, SnapObj};
pub struct Client {}
impl Client {
@@ -26,19 +32,35 @@ impl Client {
ip: IpAddr::V4(Ipv4Addr::LOCALHOST),
port: 8303,
});
- sloop.run(ClientNetwork {});
+ sloop.run(ClientNetwork {
+ state: NetworkState::New,
+ });
Ok(Self {})
}
}
-pub struct ClientNetwork {}
+pub struct ClientNetwork {
+ state: NetworkState,
+}
+enum NetworkState {
+ New,
+ Downloading {
+ chunk: i32,
+ data: Vec<u8>,
+ path: PathBuf,
+ size: usize,
+ },
+ Ready,
+ Ingame {
+ snap_manager: SnapManager,
+ snap: twsnap::Snap,
+ },
+}
impl<L: Loop> Application<L> for ClientNetwork {
fn needs_tick(&mut self) -> Timeout {
Timeout::inactive()
}
-
- fn on_tick(&mut self, loop_: &mut L) {}
-
+ fn on_tick(&mut self, _loop_: &mut L) {}
fn on_packet(&mut self, loop_: &mut L, chunk: Chunk) {
let pid = chunk.pid;
let msg;
@@ -49,21 +71,84 @@ impl<L: Loop> Application<L> for ClientNetwork {
return;
}
}
- eprintln!("{msg:?}");
+ debug!("<- {msg:?}");
match msg {
- SystemOrGame::System(System::MapChange(map)) => {
- loop_.sends(pid, Ready);
+ SystemOrGame::System(System::MapChange(MapChange { name, crc, size })) => {
+ let path = map_cache_path(name, crc);
+ if path.exists() {
+ loop_.sends(pid, Ready);
+ self.state = NetworkState::Ready
+ } else {
+ loop_.sends(pid, RequestMapData { chunk: 0 });
+ self.state = NetworkState::Downloading {
+ chunk: 0,
+ data: Vec::new(),
+ path,
+ size: size as usize,
+ }
+ }
+ }
+ SystemOrGame::System(System::MapData(p)) => {
+ if let NetworkState::Downloading {
+ chunk,
+ data,
+ path,
+ size,
+ } = &mut self.state
+ {
+ data.extend(p.data);
+ info!("download {} / {}", data.len(), size);
+ assert_eq!(*chunk, p.chunk);
+ *chunk += 1;
+ if p.last != 0 {
+ File::create(path).unwrap().write_all(&data).unwrap();
+ self.state = NetworkState::Ready;
+ loop_.sends(pid, Ready);
+ } else {
+ loop_.sends(pid, RequestMapData { chunk: *chunk });
+ }
+ }
}
SystemOrGame::System(System::ConReady(..)) => {
- loop_.sendg(pid, ClStartInfo {
- name: b"testclient",
- clan: b"metamuffin",
- country: -1,
- skin: b"limekittygirl",
- use_custom_color: true,
- color_body: 0xFF00FF,
- color_feet: 0x550055,
- });
+ if let NetworkState::Ready = &mut self.state {
+ loop_.sendg(pid, ClStartInfo {
+ name: b"testclient",
+ clan: b"metamuffin",
+ country: -1,
+ skin: b"limekittygirl",
+ use_custom_color: true,
+ color_body: 0xFF00FF,
+ color_feet: 0x550055,
+ });
+ self.state = NetworkState::Ingame {
+ snap: Snap::default(),
+ snap_manager: SnapManager::new(),
+ }
+ }
+ }
+ SystemOrGame::System(System::SnapSingle(p)) => {
+ if let NetworkState::Ingame { snap, snap_manager } = &mut self.state {
+ if let Some(new_snap) = snap_manager
+ .snap_single(&mut Warn(&[]), obj_size, p)
+ .unwrap()
+ {
+ let objs = new_snap
+ .items()
+ .filter_map(|i| {
+ let mut ints = IntUnpacker::new(i.data);
+ match SnapObj::decode_obj(&mut Warn(&[]), i.type_id, &mut ints) {
+ Ok(ob) => Some((ob, i.id)),
+ Err(e) => {
+ warn!("snap object decode error: {e:?} {:?}", i.type_id);
+ None
+ }
+ }
+ })
+ .collect::<Vec<_>>();
+ snap.process_next(objs.iter());
+ debug!("{snap:#?}");
+ }
+ }
}
SystemOrGame::Game(Game::SvReadyToEnter(..)) => {
loop_.sends(pid, EnterGame);
@@ -73,9 +158,9 @@ impl<L: Loop> Application<L> for ClientNetwork {
}
}
- fn on_connless_packet(&mut self, loop_: &mut L, chunk: ConnlessChunk) {}
+ fn on_connless_packet(&mut self, _loop_: &mut L, _chunk: ConnlessChunk) {}
- fn on_connect(&mut self, loop_: &mut L, pid: PeerId) {
+ fn on_connect(&mut self, _loop_: &mut L, _pid: PeerId) {
todo!()
}
@@ -87,12 +172,13 @@ impl<L: Loop> Application<L> for ClientNetwork {
loop_.flush(pid);
}
- fn on_disconnect(&mut self, loop_: &mut L, pid: PeerId, remote: bool, reason: &[u8]) {}
+ fn on_disconnect(&mut self, _loop_: &mut L, _pid: PeerId, _remote: bool, _reason: &[u8]) {}
}
-// Copied straight from libtw2/downloader/src/main.rs by heinrich5991, MIT-or-Apache-2.0
+// Adapted from from libtw2/downloader/src/main.rs by heinrich5991, MIT-or-Apache-2.0
trait LoopExt: Loop {
- fn sends<'a, S: Into<System<'a>>>(&mut self, pid: PeerId, msg: S) {
+ fn sends<'a, S: Into<System<'a>> + Debug>(&mut self, pid: PeerId, msg: S) {
+ debug!("-> System({msg:?})");
fn inner<L: Loop + ?Sized>(msg: System, pid: PeerId, loop_: &mut L) {
let mut buf: ArrayVec<[u8; 2048]> = ArrayVec::new();
with_packer(&mut buf, |p| msg.encode(p).unwrap());
@@ -104,7 +190,8 @@ trait LoopExt: Loop {
}
inner(msg.into(), pid, self)
}
- fn sendg<'a, G: Into<Game<'a>>>(&mut self, pid: PeerId, msg: G) {
+ fn sendg<'a, G: Into<Game<'a>> + Debug>(&mut self, pid: PeerId, msg: G) {
+ debug!("-> System({msg:?})");
fn inner<L: Loop + ?Sized>(msg: Game, pid: PeerId, loop_: &mut L) {
let mut buf: ArrayVec<[u8; 2048]> = ArrayVec::new();
with_packer(&mut buf, |p| msg.encode(p).unwrap());
@@ -119,10 +206,24 @@ trait LoopExt: Loop {
}
impl<L: Loop> LoopExt for L {}
-struct Warn<'a>(&'a [u8]);
+struct Warn<'a>(#[allow(unused)] &'a [u8]);
impl<'a, W: Debug> warn::Warn<W> for Warn<'a> {
fn warn(&mut self, w: W) {
warn!("{:?}", w);
}
}
+
+fn map_cache_path(name: &[u8], crc: i32) -> PathBuf {
+ xdg::BaseDirectories::with_prefix("twclient")
+ .unwrap()
+ .create_cache_directory("maps")
+ .unwrap()
+ .join(format!(
+ "{}_{:08x}",
+ String::from_utf8_lossy(name)
+ .replace("/", "")
+ .replace(".", ""),
+ crc as u32
+ ))
+}
diff --git a/client/src/main.rs b/client/src/main.rs
index 02b9055..ab05178 100644
--- a/client/src/main.rs
+++ b/client/src/main.rs
@@ -3,18 +3,16 @@ use client::Client;
use window::WindowState;
use winit::event_loop::EventLoop;
-pub mod window;
pub mod client;
+pub mod window;
fn main() -> Result<()> {
env_logger::init_from_env("LOG");
- Client::new()?;
-
-
- // let evloop = EventLoop::new()?;
- // evloop.run_app(&mut WindowState::new())?;
+ Client::new()?;
+ let evloop = EventLoop::new()?;
+ evloop.run_app(&mut WindowState::new())?;
Ok(())
}