Skip to content

Commit

Permalink
Fix windows (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrueger committed Aug 2, 2023
2 parents 9c40d96 + 22c91d2 commit f37bb2a
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 18 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/linux_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,14 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: game_cheetah_linux
path: target/release/bundle/deb/game_cheetah_*.deb
path: target/release/bundle/deb/game_cheetah_*.deb
release-project:
name: Release project
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: game_cheetah_linux
- name: Test artifact download
run: ls -R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Windows Build
name: OSX Build

on:
push:
Expand All @@ -21,4 +21,14 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: game_cheetah_osx
path: target/release/game_cheetah
path: target/release/game_cheetah
release-project:
name: Release project
runs-on: macos-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: game_cheetah_osx
- name: Test artifact download
run: ls -R
12 changes: 11 additions & 1 deletion .github/workflows/windows_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,14 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: game_cheetah_windows
path: target/release/game_cheetah.exe
path: target/release/game_cheetah.exe
release-project:
name: Release project
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: game_cheetah_windows
- name: Test artifact download
run: ls -R
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ boyer-moore-magiclen = "0.2.16"
proc-maps = "0.3.1"

[target.'cfg(not(target_os = "windows"))'.dependencies]
proc-maps = "0.2.1"
proc-maps = "0.3.1"

# native:
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
Expand Down
3 changes: 1 addition & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use egui_extras::{Column, TableBuilder};
use i18n_embed_fl::fl;
use process_memory::*;
use std::{
cmp::max,
sync::{atomic::Ordering, Arc, Mutex},
time::Duration,
};
Expand Down Expand Up @@ -90,7 +89,7 @@ impl GameCheetahEngine {
.selectable_label(false, process.pid.to_string())
.clicked()
{
self.pid = process.pid as i32;
self.pid = process.pid;
self.freeze_sender
.send(Message::from_addr(
MessageCommand::Pid,
Expand Down
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ fn main() {
format!("{} {}", APP_NAME, VERSION).as_str(),
native_options,
Box::new(|cc| Box::new(game_cheetah::GameCheetahEngine::new(cc))),
);
)
.unwrap();
}
22 changes: 12 additions & 10 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ use sysinfo::*;
use threadpool::ThreadPool;

pub struct ProcessInfo {
pub pid: u32,
pub pid: process_memory::Pid,
pub name: String,
pub cmd: String,
pub memory: usize,
}

pub struct GameCheetahEngine {
pub pid: i32,
pub pid: process_memory::Pid,
pub process_name: String,
pub show_process_window: bool,

Expand Down Expand Up @@ -219,12 +219,13 @@ impl GameCheetahEngine {
pub fn show_process_window(&mut self) {
let sys = System::new_all();
self.processes.clear();
for (pid, process) in sys.processes() {
for (pid2, process) in sys.processes() {
if process.memory() == 0 {
continue;
}
let pid = pid2.as_u32();
self.processes.push(ProcessInfo {
pid: pid.as_u32(),
pid: pid.try_into().unwrap(),
name: process.name().to_string(),
cmd: process.cmd().join(" "),
memory: process.memory() as usize,
Expand Down Expand Up @@ -260,9 +261,7 @@ impl GameCheetahEngine {
return;
}
};
let handle: (i32, process_memory::Architecture) = (pid as process_memory::Pid)
.try_into_process_handle()
.unwrap();
let handle = pid.try_into_process_handle().unwrap();
let updated_results = update_results(&old_results, &value_text, &handle);
results.lock().unwrap().extend_from_slice(&updated_results);
current_bytes.fetch_add(to - from, Ordering::SeqCst);
Expand Down Expand Up @@ -328,11 +327,14 @@ impl GameCheetahEngine {
}
}

fn update_results(
fn update_results<T>(
old_results: &[SearchResult],
value_text: &str,
handle: &(i32, process_memory::Architecture),
) -> Vec<SearchResult> {
handle: &T,
) -> Vec<SearchResult>
where
T: process_memory::CopyAddress,
{
let mut results = Vec::new();
for result in old_results {
match result.search_type.from_string(value_text) {
Expand Down

0 comments on commit f37bb2a

Please sign in to comment.