fraganator / archive-cache-manager

A LaunchBox plugin which extracts and caches large ROM archives, letting you play games faster.
GNU Lesser General Public License v2.1
11 stars 5 forks source link

Feature request : Register Alternative Application Paths per plateform. #32

Open nixxou opened 2 years ago

nixxou commented 2 years ago

Use case : Let's say you have your roms locally on C:/roms, but you also have them duplicate on your NAS and mount as drive in N:/roms and you got your Gdrive mount at G:/roms. All your launchbox is setup to use R:/roms.

The feature i would like to request is the ability to register alternative path per platform (so for example for SNES platform : N:/roms/SNES and G:/roms/SNES in my exemple) and then, if i launch a SNES game with an Application Path that's ArchiveCacheManager don't find on Drive, he will try to check if the file is available on N:/roms/SNES (and if not, in G:/roms/SNES).

That would be great, if you transfer your launchbox to an other PC on the same network, even if C:/roms is empty, launchbox will be then able to grep game from your nas, or even your google drive if you are not at home. If you want to claim space, you can empty your local R:/roms/PS2 folder from your PS2 roms and launchbox will still able to robocopy & launch them from gdrive.

fraganator commented 2 years ago

Thanks for another great suggestion, @nixxou. The proposed file checks should be simple to add. The checks will apply when caching, and also on the ROM selection and batch caching screens. There'll also be a new config page to configure each Platform and the alternate paths.

BTW I've implemented #24, and am working on #27 now. I'll push those changes to the dev branch in the next day or two.

nixxou commented 2 years ago

Ok, if that can be usefull in any way, you can check my last fork ( https://github.com/nixxou/archive-cache-manager/commits/dev ) where i patched for #27 (not sure it's clean, like i said, i'm not a C# coder, but that's seems to work) https://github.com/nixxou/archive-cache-manager/commit/217db0b54cee70c9ac9cc9a9fa05676a4b6a75a2

Also i tried to fix an issue with single extract and cache, when you do a smartExtract and an other smartExtract of a single cache was already done, the previously cached rom is deleted. https://github.com/nixxou/archive-cache-manager/commit/bc4370b4b0bd6481164392b9bfbf6dde5397574c So the way i fixed it is far from perfect, on smartExtract i take the list of file/size and don't delete those who match, a better way could be to store a hash of the archive on extract (or maybe something like md5 of only the first 1mb of data to be quicker + filesize ) -and i my patch raised an issue when i compute the cache size so i did a dirty workaround in this scenario where i recalculate the size from the actual cache dir-

An other feature i added was favorite and some options in the Batch Extract Menu, if you have 5 min, it will be easier to explain if you run it : https://github.com/nixxou/archive-cache-manager/releases/tag/v2.14-infohack image Basically, the goals is on batchextract to have to option to only extract the first file that match the priority wildcard string (and or those mark as favorite) I also added an option Export Cache button in the options, that basically export (using hardlink) the cache in an other folder, ordered by plateform, without the md5 in the folder name (and even without the ext if i can avoid it) and without ini or other metadata files. (Usefull for me if i want to just move some roms to my android device)

nixxou commented 2 years ago

As for this feature request #32 this is my take on it : https://github.com/nixxou/archive-cache-manager/commit/d93ba7780c0d03279e0f97664a28830e08e447a8

As always, code is messy, and i probably call my function way more than necessary, but you can maybe find some interesting ideas. I will highlight some of them. In the AltPath config window, near the folder txtbox, you can see a checkbox "Search in subfolder". image The label is misleading, it's not really a full recursive search since i want to avoid call as much as possible (especially if i try to use network or cloud mount). Without the checkbox, i only search for the archive in the folder, with the option on, if the original archive is C:/roms/snes/supermario/supermario.7z and the Altpath is set as R:/cloud/ it will search in order in : R:/cloud/supermario.7z R:/cloud/supermario/supermario.7z R:/cloud/snes/supermario/supermario.7z R:/cloud/roms/snes/supermario/supermario.7z

Also, i use a DllImport of mpr.dll for WNetGetConnection to be able to resolve Network mount drive to their full path with \ first. The idea behind that is that before probind network mount, i just ping the host first and skip if not online instead of wasting time on timeout if not.

I had a rought time with Cache since i want to use the original path to calculate the md5 used in the cache folder, so i used an additional game ini entry with the original archivepath.