Skip to content

Commit 851960e

Browse files
authored
Version 0.3.1 - Move Gameplay control settings to another Acc.
I've added a feature, where Users are now able to move the Profil control settings to a different Account of your choice. - New UI Element - NEW UX Workflow - UX; new Frontend async function, new modal - Instead of if, if else | I'm using now "switch" cases. >[!NOTE] > Choose a Profile with your Profile picker, after that Use the emoji Button on the right, after that there will be a Modal. Choose an Action "Copy controls", press Apply and there will be a new modal opening. Select your Target Profil -> Your Profile where you want to have the new Settings applied! New Pictures <img width="392" height="215" alt="Screenshot 2026-01-05 142220" src="https://github.com/user-attachments/assets/43073c61-b966-44e0-abea-0b208138dc7d" /> <img width="382" height="224" alt="Screenshot 2026-01-05 142224" src="https://github.com/user-attachments/assets/2d917084-ac55-45fa-be83-ae948c501b96" /> <img width="379" height="207" alt="Screenshot 2026-01-05 142228" src="https://github.com/user-attachments/assets/dcce0958-6eda-4555-9413-bb0e0194dc87" /> <img width="418" height="230" alt="Screenshot 2026-01-05 142232" src="https://github.com/user-attachments/assets/9f822029-842c-45d0-bf5e-6ce370401401" /> ****
2 parents afecea0 + 48ca0dc commit 851960e

9 files changed

Lines changed: 145 additions & 13 deletions

File tree

ets2-tool/src-tauri/Cargo.lock

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ets2-tool/src-tauri/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ets2-tool"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
description = "Save-Edit Tool for ETS2"
55
authors = ["xLieferant"]
66
edition = "2024"
@@ -41,3 +41,4 @@ log = "0.4.29"
4141
chrono = "0.4"
4242
uuid = "1.19.0"
4343
zip = "7.0.0"
44+
fs_extra = "1.3.0"

ets2-tool/src-tauri/src/features/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ pub mod vehicles;
55
pub mod profile_manager;
66
pub mod save_analysis;
77
pub mod save_editor;
8-
pub mod settings;
8+
pub mod settings;
9+
pub mod profile_controls;
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
use tauri::command;
2+
use std::path::Path;
3+
use std::fs;
4+
use fs_extra::dir::copy;
5+
use crate::dev_log;
6+
7+
8+
#[command]
9+
pub fn copy_profile_controls(
10+
source_profile_path: String,
11+
target_profile_path: String,
12+
) -> Result<String, String> {
13+
let source_path = Path::new(&source_profile_path);
14+
let target_path = Path::new(&target_profile_path);
15+
16+
if !source_path.exists() {
17+
return Err("Quell-Profilpfad existiert nicht".into());
18+
}
19+
20+
if !target_path.exists() {
21+
return Err("Ziel-Profilpfad existiert nicht".into());
22+
}
23+
24+
let source_controls = source_path.join("controls.sii");
25+
if !source_controls.exists() {
26+
return Err("controls.sii im Quellprofil nicht gefunden".into());
27+
}
28+
29+
let target_controls = target_path.join("controls.sii");
30+
let target_backup = target_path.join("controls_backup.sii");
31+
32+
dev_log!(
33+
"Kopiere controls.sii von {} nach {}",
34+
source_controls.display(),
35+
target_controls.display()
36+
);
37+
38+
// Backup im Ziel anlegen (falls vorhanden)
39+
if target_controls.exists() {
40+
fs::copy(&target_controls, &target_backup)
41+
.map_err(|e| format!("Backup fehlgeschlagen: {}", e))?;
42+
}
43+
44+
// Controls kopieren (1:1, kein Decrypt)
45+
fs::copy(&source_controls, &target_controls)
46+
.map_err(|e| format!("Kopieren von controls.sii fehlgeschlagen: {}", e))?;
47+
48+
// #TODO <- Muss ein Show toast noch anzeigen!
49+
50+
Ok("controls.sii erfolgreich kopiert".into())
51+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod commands;

ets2-tool/src-tauri/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ fn main() {
5555
// features::save_analysis::reader::read_money,
5656
// features::save_analysis::reader::read_xp,
5757
features::save_analysis::reader::read_traffic_value,
58-
5958
features::save_analysis::quicksave::quicksave_game_info,
60-
61-
6259
// Vehicles and trailers
6360
features::vehicles::trucks::get_all_trucks,
6461
features::vehicles::trucks::get_player_truck,
@@ -79,6 +76,9 @@ fn main() {
7976
features::profile_clone::commands::validate_clone_target,
8077
features::profile_rename::commands::profile_rename,
8178
features::profile_move_mods::commands::copy_mods_to_profile,
79+
80+
//Feature: Profile Controls move around
81+
features::profile_controls::commands::copy_profile_controls,
8282
])
8383
.run(tauri::generate_context!())
8484
.expect("error while running tauri application");

ets2-tool/src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://schema.tauri.app/config/2",
33

44
"productName": "Save-Edit Tool xLieferant",
5-
"version": "0.3.0",
5+
"version": "0.3.1",
66
"identifier": "com.xlieferant.saveedittool",
77

88
"build": {

ets2-tool/src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<button id="youtubeBtn" class="nav-action youtube">🔴 YouTube</button>
3030
<button id="patreonBtn" class="nav-action patreon">⚠️ Patreon</button>
3131
<button id="githubBtn" class="nav-action github">⚠️ GitHub</button>
32-
<button id="versionBtn" class="version-btn">0.3.0</button>
32+
<button id="versionBtn" class="version-btn">0.3.1</button>
3333
</div>
3434
</nav>
3535
</header>

ets2-tool/src/main.js

Lines changed: 76 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,16 +516,24 @@ document.addEventListener("DOMContentLoaded", () => {
516516
id: "action",
517517
label: "Action",
518518
value: "Duplicate",
519-
options: ["Duplicate", "Rename"],
519+
options: ["Duplicate", "Rename", "Copy controls"],
520520
},
521521
]);
522522

523523
if (!choice) return;
524524

525-
if (choice.action === "Duplicate") {
526-
openCloneProfileModal();
527-
} else if (choice.action === "Rename") {
528-
await handleProfileRename();
525+
switch (choice?.action) {
526+
case "Duplicate":
527+
openCloneProfileModal();
528+
break;
529+
530+
case "Rename":
531+
await handleProfileRename();
532+
break;
533+
534+
case "Copy controls":
535+
await handleCopyControls();
536+
break;
529537
}
530538
});
531539

@@ -549,6 +557,69 @@ document.addEventListener("DOMContentLoaded", () => {
549557
}
550558
}
551559

560+
async function handleCopyControls() {
561+
if (!window.selectedProfilePath) {
562+
showToast("No source profile selected!", "warning");
563+
return;
564+
}
565+
566+
try {
567+
const profiles = await invoke("find_ets2_profiles");
568+
569+
const sourcePath = window.selectedProfilePath;
570+
const targets = profiles.filter(
571+
(p) => p.success && p.path !== sourcePath
572+
);
573+
574+
if (targets.length === 0) {
575+
showToast("No other profiles available.", "warning");
576+
return;
577+
}
578+
579+
const options = targets.map(
580+
(p) => `${p.name} [${p.path}]`
581+
);
582+
583+
const res = await openModalMulti("Copy Controls", [
584+
{
585+
type: "dropdown",
586+
id: "target",
587+
label: "Target Profile",
588+
value: options[0],
589+
options,
590+
},
591+
]);
592+
593+
if (!res || !res.target) return;
594+
595+
const selectedProfile = targets.find(
596+
(p) => `${p.name} [${p.path}]` === res.target
597+
);
598+
599+
if (!selectedProfile) {
600+
showToast("Invalid profile selected.", "error");
601+
return;
602+
}
603+
604+
showToast("Copying controls…", "info");
605+
606+
const msg = await invoke("copy_profile_controls", {
607+
sourceProfilePath: sourcePath,
608+
targetProfilePath: selectedProfile.path,
609+
});
610+
611+
showToast(msg, "success");
612+
613+
} catch (err) {
614+
console.error("Copy controls failed:", err);
615+
showToast(
616+
typeof err === "string" ? err : "Failed to copy controls.",
617+
"error"
618+
);
619+
}
620+
}
621+
622+
552623
// -----------------------------
553624
// MOVE MODS LOGIC
554625
// -----------------------------

0 commit comments

Comments
 (0)