Skip to content

Commit

Permalink
update some stuff & temp disable virtual fs icons because memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Vulae committed Aug 29, 2024
1 parent ea4b9f1 commit c2678d9
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 61 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,20 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cache-${{ matrix.os }}-release

- name: Setup Rust
run: rustup toolchain install stable --profile minimal --target ${{ matrix.target }} --no-self-update

- name: Cache Rust
uses: Swatinem/rust-cache@v2

# TODO: Cache linker installation.
- name: Install linker
if: matrix.linker_package != null
Expand Down
53 changes: 34 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ edition = "2021"
anyhow = "1.0.86"
bitflags = "2.6.0"
catppuccin-egui = { version = "5.2.0", default-features = false, features = ["egui28"] }
clap = { version = "4.5.11", features = ["derive"] }
clap = { version = "4.5.16", features = ["derive"] }
dark-light = "1.1.1"
eframe = "0.28.1"
egui = "0.28.1"
egui_dock = "0.13.0"
egui_extras = { version = "0.28.1", features = ["svg", "image"] }
env_logger = { version = "0.11.5", features = ["auto-color", "humantime"] }
flate2 = "1.0.31"
flate2 = "1.0.33"
glob-match = "0.2.1"
image = "0.25.2"
itertools = "0.13.0"
rayon = "1.10.0"
regex = "1.10.5"
regex = "1.10.6"
rfd = "0.14.1"
serde = { version = "1.0.204", features = ["derive"] }
serde_json = "1.0.122"
serde = { version = "1.0.209", features = ["derive"] }
serde_json = "1.0.127"
uuid = { version = "1.10.0", features = ["v7"] }

[build-dependencies]
Expand Down
4 changes: 4 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- [ ] Better icon
- [ ] Refactor explorer loading to allow for errorless handling on non-valid explorers
- [ ] Logs tab
- [ ] Move stuff to sub-modules to allow features & faster compiling for development.

# Formats

Expand All @@ -32,5 +33,8 @@
- [ ] `.rpyc` script file decompilation
- [ ] Unity engine
- [ ] Unreal engine
* (https://github.com/trumank/repak/tree/master)
* (https://github.com/bananaturtlesandwich/unpak/tree/master)
- [ ] GameMaker engine

[^godot-texture-partial-support]: Partial support. Some format edge cases & no mipmap support.
70 changes: 36 additions & 34 deletions src/app/explorers/virtual_fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,42 +68,44 @@ impl<F: Read + Seek + 'static, I: VirtualFsInner<F> + 'static> VirtualFsExplorer
}
}

#[allow(unused)]
fn get_icon(&mut self, entry: &VirtualFsEntry<F, I>) -> Option<egui::ImageSource> {
let hint = crate::util::image::SizeHint::Pixels((EntryDisplay::THUMBNAIL_SIZE.x * EntryDisplay::THUMBNAIL_SIZE.y * 1.5) as u64);
let path = entry.path().clone();

if let Some(cached_icon) = self.cached_icons.get(&path) {
return cached_icon.clone().or(Some(crate::app::assets::LUCIDE_FILE));
}

self.cached_icons.insert(path.clone(), None);

match entry {
VirtualFsEntry::Directory(_) => {
self.load_icons.lock().unwrap().push((path, crate::app::loader::LoadedThumbnail::ImageSource(crate::app::assets::LUCIDE_FOLDER)));
},
VirtualFsEntry::File(file) => {
let name = file.path().name().map(|s| s.to_owned());
let threaded_file = crate::util::file::ThreadedFile::new(Arc::new(Mutex::new(file.clone())));
let load_icons = Arc::clone(&self.load_icons);
std::thread::spawn(move || {
match crate::app::loader::thumbnail_file(
threaded_file,
name,
hint,
) {
Ok(thumbnail) => {
load_icons.lock().unwrap().push((path, thumbnail));
},
Err(err) => {
println!("Failed to load icon {}", err);
},
}
});
},
}

None
// let hint = crate::util::image::SizeHint::Pixels((EntryDisplay::THUMBNAIL_SIZE.x * EntryDisplay::THUMBNAIL_SIZE.y * 1.5) as u64);
// let path = entry.path().clone();

// if let Some(cached_icon) = self.cached_icons.get(&path) {
// return cached_icon.clone().or(Some(crate::app::assets::LUCIDE_FILE));
// }

// self.cached_icons.insert(path.clone(), None);

// match entry {
// VirtualFsEntry::Directory(_) => {
// self.load_icons.lock().unwrap().push((path, crate::app::loader::LoadedThumbnail::ImageSource(crate::app::assets::LUCIDE_FOLDER)));
// },
// VirtualFsEntry::File(file) => {
// let name = file.path().name().map(|s| s.to_owned());
// let threaded_file = crate::util::file::ThreadedFile::new(Arc::new(Mutex::new(file.clone())));
// let load_icons = Arc::clone(&self.load_icons);
// std::thread::spawn(move || {
// match crate::app::loader::thumbnail_file(
// threaded_file,
// name,
// hint,
// ) {
// Ok(thumbnail) => {
// load_icons.lock().unwrap().push((path, thumbnail));
// },
// Err(err) => {
// println!("Failed to load icon {}", err);
// },
// }
// });
// },
// }

// None
}

fn entry_display(&mut self, ui: &mut egui::Ui, entry: VirtualFsEntry<F, I>) {
Expand Down

0 comments on commit c2678d9

Please sign in to comment.