Skip to content

Commit

Permalink
Refactor cargo config, add license, remove unused code (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
veeenu committed Mar 7, 2024
1 parent d031dfc commit cef08cc
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 225 deletions.
8 changes: 5 additions & 3 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
rustflags = ["-C", "link-args=-Wl,--subsystem,windows"]

[alias]
brl = "build --release --lib"
xtask = "run --package xtask --"
r = "run --package xtask -- run"
xtask = "run --package xtask --release --"
t = "xwin test --target x86_64-pc-windows-msvc --"
c = "xwin clippy --target x86_64-pc-windows-msvc"
d = "xtask dist"
r = "xtask run"
6 changes: 0 additions & 6 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
set dotenv-load := true

check:
cargo +nightly xwin clippy --target x86_64-pc-windows-msvc --all

test *args:
cargo xwin test --target x86_64-pc-windows-msvc {{args}} -- --nocapture

install:
cargo xtask dist
cp jdsd_dsiii_practice_tool.toml \
Expand Down
22 changes: 12 additions & 10 deletions practice-tool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,23 @@ crate-type = ["cdylib", "rlib"]
name = "libjdsd_dsiii_practice_tool"

[dependencies]
libds3 = { path = "../lib/libds3" }
const_format = "0.2.26"
hex = "0.4.3"
log-panics = "2.0.0"
toml = "0.5.6"
open = "1.4.0"
parking_lot = "0.11.2"
pkg-version = "1.0.0"
regex = "1"
semver = "0.11.0"
serde = { version = "1.0.130", features = ["derive"] }
serde_json = "1.0.57"
pkg-version = "1.0.0"
toml = "0.5.6"
tracing-subscriber = "0.3.17"
ureq = { version = "2.8.0", features = ["json"] }
open = "1.4.0"
semver = "0.11.0"
regex = "1"
widestring = "0.5.1"
parking_lot = "0.11.2"
hex = "0.4.3"
const_format = "0.2.26"
tracing-subscriber = "0.3.17"

libds3 = { path = "../lib/libds3" }

hudhook.workspace = true
imgui.workspace = true
imgui-sys.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions practice-tool/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ enum CfgCommand {
CycleSpeed {
#[serde(rename = "cycle_speed")]
values: Vec<f32>,
hotkey: Key,
hotkey: Option<Key>,
},
CharacterStats {
#[serde(rename = "character_stats")]
Expand All @@ -82,7 +82,7 @@ enum CfgCommand {
Souls {
#[serde(rename = "souls")]
amount: u32,
hotkey: Key,
hotkey: Option<Key>,
},
OpenMenu {
#[serde(rename = "open_menu")]
Expand Down
16 changes: 16 additions & 0 deletions practice-tool/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
// johndisandonato's Dark Souls III Practice Tool
// Copyright (C) 2022-2024 johndisandonato <https://github.com/veeenu>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

mod config;
mod practice_tool;
mod util;
Expand Down
195 changes: 0 additions & 195 deletions practice-tool/src/util/vk.rs

This file was deleted.

8 changes: 6 additions & 2 deletions practice-tool/src/widgets/cycle_speed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ impl ReadWrite for CycleSpeed {
}
}

pub(crate) fn cycle_speed(values: &[f32], ptr: PointerChain<f32>, key: Key) -> Box<dyn Widget> {
Box::new(StoreValue::new(CycleSpeed::new(values, ptr), Some(key)))
pub(crate) fn cycle_speed(
values: &[f32],
ptr: PointerChain<f32>,
key: Option<Key>,
) -> Box<dyn Widget> {
Box::new(StoreValue::new(CycleSpeed::new(values, ptr), key))
}
4 changes: 2 additions & 2 deletions practice-tool/src/widgets/souls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ impl ReadWrite for Souls {
}
}

pub(crate) fn souls(amount: u32, ptr: PointerChain<u32>, key: Key) -> Box<dyn Widget> {
Box::new(StoreValue::new(Souls::new(amount, ptr), Some(key)))
pub(crate) fn souls(amount: u32, ptr: PointerChain<u32>, key: Option<Key>) -> Box<dyn Widget> {
Box::new(StoreValue::new(Souls::new(amount, ptr), key))
}
6 changes: 3 additions & 3 deletions xtask/src/dist.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::fs::File;
use std::fs::{self, File};
use std::io::{Read, Write};
use std::path::PathBuf;

Expand Down Expand Up @@ -28,8 +28,8 @@ pub(crate) fn dist() -> Result<()> {
return Err("cargo build failed".into());
}

std::fs::remove_dir_all(dist_dir()).ok();
std::fs::create_dir_all(dist_dir())?;
fs::remove_dir_all(dist_dir()).ok();
fs::create_dir_all(dist_dir())?;

let mut zip = ZipWriter::new(File::create(dist_dir().join("jdsd_dsiii_practice_tool.zip"))?);
let file_options = FileOptions::default().compression_method(CompressionMethod::Deflated);
Expand Down
3 changes: 1 addition & 2 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
mod codegen;
mod dist;

use std::ffi::OsStr;
use std::fs::File;
Expand All @@ -7,8 +8,6 @@ use std::path::{Path, PathBuf};
use std::process::Command;
use std::{env, iter};

mod dist;

type DynError = Box<dyn std::error::Error>;
type Result<T> = std::result::Result<T, DynError>;

Expand Down

0 comments on commit cef08cc

Please sign in to comment.