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

Archive Cache Manager

Archive Cache Manager logo

A LaunchBox plugin which caches extracted ROM archives, letting you play games faster. Also allows launching individual files from archives, and loading preferred file types from an archive.

New in v2.16

Description

When a compressed ROM (zip, 7z, rar, gz, chd, rvz, etc.) is first extracted, it is stored in the archive cache. The next time it is played, the game is loaded directly from the cache, virtually eliminating wait time.

Launch time comparison video

As the cache size approaches the maximum size, the oldest played games are deleted from the cache, making room for new games.

Features

Example Use Cases

Why use Archive Cache Manager? Here's some example use cases.

Installation

Uninstallation

Usage

Extracting and Caching

Archive Cache Manager runs transparently to the user. All that is required is the emulator or emulator platform has the "Extract ROM archives before running" option checked. Extraction and cache management is carried out automatically when a game is launched.

Cache and extraction behaviour can be modified in plugin's configuration window.

Multi-Disc Games

To use the multi-disc cache feature, check the "Multi-disc Support" option in the Archive Cache Manager config window. The next time a multi-disc game is launched, all the discs from the game will be extracted to the cache and a corresponding M3U file generated.

If the emulator \ platform supports M3U files (as configured in LaunchBox), the generated M3U file will be used when launching the game. Otherwise a single disc will be launched, and swapping between cached discs can be done manually in the emulator.

Batch Caching Games

Multiple games can be cached at once using the Batch Cache Games window. Select one or more games in LaunchBox, then right-click a game and choose the "Batch Cache Games..." option.

A window will popup displaying the list of games, and begin checking the extracted ROM sizes. Once the checks are complete, click the Cache Games button to begin caching.

Batch caching window

Games are cached according to the plugin's emulator and platform settings. A game may be extracted, copied, or no action taken if it doesn't match a caching rule, or it's already cached.

Each game's caching progress will be displayed in the Status column, and a progress bar at the bottom of the game list shows the overall caching progress. If an error occurs during caching, it will be flagged in the Status column and caching will skip to the next game. If the "Pause Caching On Error" is checked, an error message is displayed with the option to continue or stop.

Tip: For games stored on a NAS or an external drive, use Batch Cache Games to cache a selection of them locally. Enable the plugin's Always Bypass LaunchBox Path Check option to allow the cached game to be launched directly, even if the network or external drive is disconnected!

Selecting and Playing Individual ROMs From an Archive

To play an individual ROM from an archive containing multiple ROMs (different regions, hacks, or discs), right-click it and choose "Select ROM In Archive...".

A window will popup with a full listing of the archive contents. Select the desired ROM file, then click Play. That ROM will now launch with the configured emulator.

The next time the game is launched via the normal Play option, the previous ROM selection will be automatically applied. To select another ROM, use the same "Select ROM In Archive..." menu.

ROM file selection window

The same menu is also available in BigBox, though currently only supports keyboard input.

ROM file selection window

Keeping Games Cached

Games can be marked 'Keep' so they stay cached and ready to play. To keep a game cached, open the plugin configuration window from the Tools->Archive Cache Manager menu. From there a list of games in the cache is shown. Check the Keep box next to the game, then click OK.

Badge

The plugin includes a badge to indicate if a game is currently in the cache. It is available under the Badges->Plugin Badges->Enable Archive Cached menu. There are additional Simple White and Neon style badges, which can be found in the LaunchBox\Plugins\ArchiveCacheManager\Badges folder. Copy your preferred icon to the LaunchBox\Images\Badges folder and rename it Archive Cached.png.

Badge icon to indicate if a game is cached

Configuration

Configuration can be accessed from the Tools->Archive Cache Manager menu. An overview of each of the configuration screens and options is below.

Cache Settings

This page shows a summary of the cache storage and currently cached items, and provides options for cache configuration.

Achive Cache Manager config screen

Configure Cache

Clicking the Configure Cache... button opens the cache configuration window.

Achive Cache Manager cache config screen

Configure Cache - Cache Path

This is the path of the cache on disk. The path can be absolute or relative, where relative paths are to the LaunchBox root folder.

Default: ArchiveCache

If the cache path is set to an invalid location (LaunchBox root for example), an error message will be displayed when clicking OK.

Cache path error

If the cache path is set to an existing path that already contains files or folders, a warning will be displayed when clicking OK. Click Yes to proceed, or No to go back and change the path.

Cache path warning

Configure Cache - Cache Size

This is the maximum cache size on disk in megabytes. The oldest played games will be deleted from the cache when it reaches this size.

Default: 20,000 MB (20 GB)

Configure Cache - Minimum Archive Size

This is the minimum size in megabytes of an uncompressed archive before it will be added to the cache. Archives smaller than this won't be added to the cache.

Default: 100 MB

Keep

A Keep flag can be applied to a cached item. When set, the item will be excluded from cache management and not be removed from the cache. This is useful for less frequently played games which need to load without waiting (very large games, party games, favourites, children's games, etc).

Default: Disabled

Open In Explorer

Clicking the Open In Explorer button will open the configured cache path in Windows Explorer. This button is disabled if the cache path does not exist.

Refresh

Refreshes the cache summary and list of cached items from disk.

Delete

Clicking on the Delete button will remove the selected items from the cache (including items with the Keep setting).

Delete All

Clicking on the Delete All button will delete everything from the cache (including items with the Keep setting).

Extraction Settings

This page provides settings for archive extraction and launch behviour. Each row in the table applies to the specified emulator \ platform pair. If a game is launched which doesn't match an emulator \ platform, the settings in All \ All will be used.

Achive Cache Manager config screen

Emulator \ Platform

The specific emulator and platform for the settings to be applied to. Add a new emulator and platform row using the Add... button. Remove an emulator \ platform row using the Delete button.

When a new row is added its settings will be copied from the All \ All entry, except for Priority which will be blank.

Priority

Files from an archive can be prioritized in the case where an emulator requires a certain filename or file type. This setting defines the filename or extension priority for the specified emulator and platform combination.

The priorities are a comma delimited list, where the highest priority is the first entry, the next highest priority is the second entry, and so on. If a match is not found in the archive when a game is loaded, the priority in All \ All is used.

A wildcard (*) can be used to perform partial filename matches. Examples include:

Note that the priority is applied to all archives, even if they are not cached.

The fallback All \ All priority is the basis for the contents of the multi-disc M3U file generation. Be careful removing entries such as cue, unless a specific emulator \ platform is used to handle cue and similar file types.

Default:

Action

The action to take when processing a ROM file.

Default: Extract

Launch Path

The path within the cache to launch the game from. Useful for managing common settings in RetroArch which are based on the game's folder.

Games will always be extracted \ copied to the \<Filename> - \<MD5 Hash> location. If the Launch Path is set to something other than Default, the corresponding folder will be created within the cache, and NTFS hardlinks will be created which point to the extracted \ copied files.

Default: Default

Multi-Disc

Check this option to enable multi-disc support. When enabled, the following actions occur when playing a multi-disc game:

Default: Enabled

M3U Name

The name of the M3U file created when launching a multi-disc game, and Multi-Disc is enabled. The M3U file name is used by some emulators to create a save file and match settings.

Default: Game ID

Smart Extract

Check this option to enable smart extraction, which will only extract a single file from an archive if a number of rules are met. See the Smart Extract Settings section for details.

Default: Enabled

chdman

Check this option to extract a chd file to cue+bin files using chdman. The executable chdman.exe must be copied to the folder LaunchBox\Plugins\ArchiveCacheManager\Extractors.

Default Disabled

DolphinTool

Check this option to extract rvz, wia, and gcz files to iso files using DolphinTool. The executable DolphinTool.exe must be copied to the folder LaunchBox\Plugins\ArchiveCacheManager\Extractors.

Default Disabled

extract-xiso

Check this option to extract and convert full iso files to Xbox iso files using extract-xiso. Supports both zipped and stand-alone iso files. The executable extract-xiso.exe must be copied to the folder LaunchBox\Plugins\ArchiveCacheManager\Extractors.

Default Disabled

Smart Extract Settings

When enabled, the Smart Extract option will check if it's possible to extract only a single file from an archive. For merged archives containing multiple ROM versions and hacks, this avoids the need to extract a potentially large number of files to play a single game.

Achive Cache Manager config screen

Smart Extract will extract and launch a single file from an archive if the following conditions are met:

The file to extract will be (in priority order):

  1. The individual file selected through the "Select ROM in Archive..." right-click menu.
  2. The first file which matches a configured Priority.
  3. The first file in the archive.

Stand-alone ROM Extensions

A comma delimited list of file extensions which can run stand-alone (no dependencies on other files).

Default: gb, gbc, gba, agb, nes, fds, smc, sfc, n64, z64, v64, ndd, md, smd, gen, iso, chd, gg, gcm, 32x, bin

Metadata Extensions

A comma delimited list of file extensions which indicate ROM metadata, and aren't required to play a ROM file.

Default: nfo, txt, dat, xml, json

Plugin Settings

Achive Cache Manager config screen

Always Bypass LaunchBox Path Check

When enabled, bypasses LaunchBox's check that a game's application path (ROM file) exists before launch. If a game is cached and the source ROM storage is slow or unavailable, the game will still launch immediately.

The bypass check happens automatically if the extract action is Copy, or the file is not zip, 7z, or rar.

Default: Disabled

Check For Updates On Startup

Enable this option to check for plugin updates when LaunchBox starts up. This is a simple version check of the latest release on github, and nothing is automatically downloaded or installed. If a new update is found a message box will appear shortly after LaunchBox is started, with the option to open the download page in a browser.

Default: On first run, a message box will appear asking the user if they'd like to enable the update check.

Archive Cache Manager update check prompt

Building

The project is built with Visual Studio Community 2019 and .NET Framework 4.7.2.

The plugin references version 12.8 of Unbroken.LaunchBox.Plugins assembly, to handle certain newer features (per emulator/platform ROM extraction). If building for an older version of LaunchBox (pre 12.8), you can define the LAUNCHBOX_PRE_12_8 conditional compilation symbol. The oldest minimum version of the Unbroken.LaunchBox.Plugins assembly supported is 1.0.0.0 included with LaunchBox 10.11, required for Badge support.

Dependencies

Dependencies are listed below, and can be installed using Visual Studio's Package Manager Console with the command shown.

Package Version PM Command
System.Drawing.Common 4.7.2 Install-Package System.Drawing.Common -Version 4.7.2 -ProjectName Plugin
ini-parser latest Install-Package ini-parser -ProjectName Core
ini-parser latest Install-Package ini-parser -ProjectName Plugin
Octokit latest Install-Package Octokit -ProjectName Plugin

Acknowledgements