use git hash for netplay sync (#234)

* use git hash for netplay sync

* more
This commit is contained in:
Logan McNaughton 2025-02-10 17:02:09 +01:00 committed by GitHub
parent 1c168c4bcd
commit 7f6de5119f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -166,4 +166,12 @@ fn main() {
println!("cargo:rustc-link-search=native=/usr/local/lib");
println!("cargo:rustc-link-lib=static=MoltenVK");
}
let git_output = std::process::Command::new("git")
.args(["rev-parse", "HEAD"])
.output()
.unwrap();
let git_hash = String::from_utf8(git_output.stdout).unwrap();
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
}

View File

@ -284,7 +284,7 @@ pub fn netplay_create(app: &mut GopherEguiApp, ctx: &egui::Context) {
let netplay_message = NetplayMessage {
message_type: "request_create_room".to_string(),
player_name: Some(app.netplay.player_name.clone()),
client_sha: Some(env!("CARGO_PKG_VERSION").to_string()),
client_sha: Some(env!("GIT_HASH").to_string()),
netplay_version: Some(NETPLAY_VERSION),
emulator: Some(EMU_NAME.to_string()),
accept: None,
@ -449,7 +449,7 @@ pub fn netplay_join(app: &mut GopherEguiApp, ctx: &egui::Context) {
let netplay_message = NetplayMessage {
message_type: "request_join_room".to_string(),
player_name: Some(app.netplay.player_name.clone()),
client_sha: Some(env!("CARGO_PKG_VERSION").to_string()),
client_sha: Some(env!("GIT_HASH").to_string()),
netplay_version: None,
emulator: None,
accept: None,