Skip to content

Commit

Permalink
Merge pull request #38 from fraganator/dev
Browse files Browse the repository at this point in the history
v2.16
  • Loading branch information
fraganator authored Feb 10, 2023
2 parents a04231f + 912f7a3 commit 7d3ac88
Show file tree
Hide file tree
Showing 14 changed files with 230 additions and 150 deletions.
7 changes: 7 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Archive Cache Manager change history
## v2.16 (2023-02-10)
* New M3U name option - "Disc 1 Filename"
* Always use the filename of the first disc of a multi-disc game for the m3u file, regardless of which disc was launched
* Allows better support for The Bezel Project config files, which use config files based on the ROM name
* New batch caching option to pause on caching errors (default is to skip and continue)
* Minor config window tweaks

## v2.15 (2023-01-19)
* New _extract-xiso_ option for Xbox iso conversion
* Full iso files (redump) automatically converted and cached in xiso format
Expand Down
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@

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.15
* New _extract-xiso_ option for Xbox iso conversion
* Full iso files (redump) automatically converted and cached in xiso format
* Supports both zipped and unzipped iso files
* Requires _extract-xiso.exe_ to be added to the `ArchiveCacheManager\Extractors` folder
* Reduced archive cache path lengths, avoiding path too long errors
* Small performance improvement when checking many file priorities
* Smart Extract uses Priority to select file from archive in case where individual ROM file not previously selected
* Fix incorrect path for auto generated M3Us when Launch Path is not Default
* Fix background thread issue when Batch Cache Games window closed while still calculating archive sizes
* Interface tweaks
## New in v2.16
* New M3U name option - "Disc 1 Filename"
* Always use the filename of the first disc of a multi-disc game for the m3u file, regardless of which disc was launched
* Allows better support for The Bezel Project config files, which use config files based on the ROM name
* New batch caching option to pause on caching errors (default is to skip and continue)
* Minor config window tweaks

## 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.
Expand Down Expand Up @@ -79,7 +74,7 @@ A window will popup displaying the list of games, and begin checking the extract

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 there are any errors while caching, an error message is displayed with the option to continue or stop.
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!_

Expand Down Expand Up @@ -223,6 +218,7 @@ The name of the M3U file created when launching a multi-disc game, and _Multi-Di

* `Game ID` - The unique ID for a game, generated by LaunchBox. This is the same M3U naming convention used by LaunchBox (e.g. _2828d969-4362-49d5-b080-c2b7cc6f7d59.m3u_)
* `Title + Version` - The game's title and version combined, with _(Disc N)_ removed from the version (e.g. _Final Fantasy VII (Europe).m3u_)
* `Disc 1 Filename` - Use the filename of the first disc as the name of the M3U, regardless of which disc was launched (e.g. _Final Fantasy VII (Europe) (Disc 1).m3u_). Allows for The Bezel Project support, while maintaining a consistent name for emulators to manage save files across multiple discs.

Default: _`Game ID`_

Expand Down
Binary file modified images/batch-cache.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/ArchiveCacheManager/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.15.0.0")]
[assembly: AssemblyFileVersion("2.15.0.0")]
[assembly: AssemblyVersion("2.16.0.0")]
[assembly: AssemblyFileVersion("2.16.0.0")]
10 changes: 8 additions & 2 deletions src/Core/CacheManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,16 @@ public static void GenerateM3u()
if (LaunchInfo.Game.MultiDisc && LaunchInfo.MultiDiscSupport)
{
Dictionary<int, string> filePaths = new Dictionary<int, string>();

foreach (var discInfo in LaunchInfo.Game.Discs)
{
// Delete any previously generated m3u file, so it doesn't get included in the subsequent archive listing
DiskUtils.DeleteFile(LaunchInfo.GetM3uPath(LaunchInfo.GetArchiveCachePath(discInfo.Disc), discInfo.Disc));
foreach (var m3uPath in LaunchInfo.GetAllM3uPaths(LaunchInfo.GetArchiveCachePath(discInfo.Disc)))
{
// Delete all previously generated m3u files regardless of current m3u name configuration.
// Keeps the cache folders clean from multiple m3u files when launching different discs,
// and prevents m3u files from being included in the subsequent archive listing.
DiskUtils.DeleteFile(m3uPath);
}
filePaths.Add(discInfo.Disc, ListCacheArchive(LaunchInfo.GetArchiveCachePath(discInfo.Disc), discInfo.Disc).FirstOrDefault());
}

Expand Down
3 changes: 2 additions & 1 deletion src/Core/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public enum LaunchPath
public enum M3uName
{
GameId,
TitleVersion
TitleVersion,
DiscOneFilename
};

private static readonly string configSection = "Archive Cache Manager";
Expand Down
33 changes: 33 additions & 0 deletions src/Core/LaunchInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,20 @@ private static string GetM3uName(string archiveCachePath, int? disc = null)
case Config.M3uName.TitleVersion:
m3uName = PathUtils.GetArchiveCacheM3uGameTitlePath(archiveCachePath, mGame.GameId, mGame.Title, mGame.Version, disc);
break;
case Config.M3uName.DiscOneFilename:
string archivePath;
try
{
// Get the path of disc 1 (not index 1)
archivePath = mMultiDiscCacheData[1].ArchivePath;
}
catch (Exception e)
{
archivePath = mGameCacheData.ArchivePath;
Logger.Log($"Couldn't find disc 1 path when generating m3u filename, using ArchivePath instead. Exception info:\r\n{e.ToString()}");
}
m3uName = PathUtils.GetArchiveCacheM3uGameFilenamePath(archiveCachePath, archivePath);
break;
}

return m3uName;
Expand All @@ -486,6 +500,25 @@ public static string GetM3uPath(string archiveCachePath, int? disc = null)
return mGameCacheData.M3uName;
}

/// <summary>
/// Returns all possible M3U paths (game ID, title + version, rom filename per disc) for the given path.
/// </summary>
/// <param name="archiveCachePath"></param>
/// <returns></returns>
public static List<string> GetAllM3uPaths(string archiveCachePath)
{
List<string> m3uPaths = new List<string>();

m3uPaths.Add(PathUtils.GetArchiveCacheM3uGameIdPath(archiveCachePath, mGame.GameId));
m3uPaths.Add(PathUtils.GetArchiveCacheM3uGameTitlePath(archiveCachePath, mGame.GameId, mGame.Title, mGame.Version, 1));
foreach (var discInfo in mGame.Discs)
{
m3uPaths.Add(PathUtils.GetArchiveCacheM3uGameFilenamePath(archiveCachePath, discInfo.ArchivePath));
}

return m3uPaths;
}

/// <summary>
/// Check if the game is cached. Will check if all discs of a multi-disc game are cached.
/// </summary>
Expand Down
11 changes: 11 additions & 0 deletions src/Core/PathUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,17 @@ public static string GetArchiveCacheM3uGameTitlePath(string archiveCachePath, st
return GetArchiveCacheM3uPath(archiveCachePath, GetValidFilename(string.Format("{0} {1}", title, localVersion), gameId).Trim());
}

/// <summary>
/// Absolute path to the m3u file for the given archive cache path. Filename is the original archive's name with the extension set to m3u.
/// </summary>
/// <param name="archiveCachePath"></param>
/// <param name="archivePath"></param>
/// <returns></returns>
public static string GetArchiveCacheM3uGameFilenamePath(string archiveCachePath, string archivePath)
{
return GetArchiveCacheM3uPath(archiveCachePath, Path.GetFileNameWithoutExtension(archivePath));
}

/// <summary>
/// Absolute path to the m3u file for the given archive cache path.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.15.0.0")]
[assembly: AssemblyFileVersion("2.15.0.0")]
[assembly: AssemblyVersion("2.16.0.0")]
[assembly: AssemblyFileVersion("2.16.0.0")]
18 changes: 18 additions & 0 deletions src/Plugin/BatchCacheWindow.Designer.cs

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

25 changes: 14 additions & 11 deletions src/Plugin/BatchCacheWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -319,21 +319,24 @@ private async void CacheGames()
}
else if (exitCode != 0)
{
stopwatch.Stop();
errorCount++;
cacheStatusGridView.Rows[i].Cells["CacheStatus"].Value = "Caching error.";
bool multiDisc = PluginUtils.IsGameMultiDisc(mSelectedGames[Convert.ToInt32(cacheStatusGridView.Rows[i].Cells["Index"].Value)]);
var result = FlexibleMessageBox.Show(this, $"Error caching \"{cacheStatusGridView.Rows[i].Cells["Archive"].Value}\"" +
(multiDisc ? " or one of its associated discs." : "."), "Caching Error",
MessageBoxButtons.OKCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2,
null, "Continue Caching", "Stop");
if (result == DialogResult.Cancel)
if (pauseOnErrorCheckBox.Checked)
{
mStatus = StatusEnum.Stopped;
progressBar.Visible = false;
break;
stopwatch.Stop();
bool multiDisc = PluginUtils.IsGameMultiDisc(mSelectedGames[Convert.ToInt32(cacheStatusGridView.Rows[i].Cells["Index"].Value)]);
var result = FlexibleMessageBox.Show(this, $"Error caching \"{cacheStatusGridView.Rows[i].Cells["Archive"].Value}\"" +
(multiDisc ? " or one of its associated discs." : "."), "Caching Error",
MessageBoxButtons.OKCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2,
null, "Continue Caching", "Stop");
if (result == DialogResult.Cancel)
{
mStatus = StatusEnum.Stopped;
progressBar.Visible = false;
break;
}
stopwatch.Start();
}
stopwatch.Start();
}
else
{
Expand Down
3 changes: 3 additions & 0 deletions src/Plugin/BatchCacheWindow.resx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
<metadata name="ArchiveSize.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Expand Down
Loading

0 comments on commit 7d3ac88

Please sign in to comment.