Skip to content

Commit

Permalink
Version 4.7.1 (Auto Translator)
Browse files Browse the repository at this point in the history
 * BUG FIX - Development-time fix to the nuget package
 * BUG FIX - The 'Translators' directory must now be placed in the same directory that the XUnity.AutoTranslator.Plugin.Core.dll is placed in. This allows moving around the plugin as you see fit in BepInEx 5.0. For the ReiPatcher installer, the Translators are now found in the Managed directory of the game. For UnityInjector the Translators directory has been moved out of the Config directory
 * BUG FIX - Minor bug fix where in some cases the plugin could not create the initial translation files on startup

Version 1.1.1 (Resource Redirector)

 * BUG FIX - Development-time fix to the nuget package
 * BUG FIX - Fixed bug in method 'LoadFromFileWithRandomizedCabIfRequired' where offset was ignored if the initial load attempt failed
  • Loading branch information
randoman committed Dec 1, 2019
1 parent 8856468 commit ab5e82d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG - ResourceRedirector.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### 1.1.1
* BUG FIX - Development-time fix to the nuget package
* BUG FIX - Fixed bug in method 'LoadFromFileWithRandomizedCabIfRequired' where offset was ignored if the initial load attempt failed

### 1.1.0
* FEATURE - Added method to load an asset from a file, with fallback to loading it from an in-memory stream with randomized CAB
Expand Down
3 changes: 3 additions & 0 deletions src/XUnity.AutoTranslator.Plugin.Core/TranslationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ public void CreateEndpoints( GameObject go, InitializationContext context )
else
{
XuaLogger.AutoTranslator.Warn( "AutoTranslator has been configured to use same destination language as source language. All translators will be disabled!" );

//// add built-in endpoint
//AddEndpoint( go, context, typeof( PassthroughTranslateEndpoint ) );
}
}

Expand Down
12 changes: 11 additions & 1 deletion src/XUnity.ResourceRedirector/AssetBundleHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.IO;
using UnityEngine;
using XUnity.Common.Extensions;
using XUnity.Common.Logging;
using XUnity.Common.Utilities;

Expand Down Expand Up @@ -95,7 +96,16 @@ internal static AssetBundle LoadFromFileWithRandomizedCabIfRequired( string path
var bundle = AssetBundle.LoadFromFile( path, crc, offset );
if( bundle == null && ( !confirmFileExists || File.Exists( path ) ) )
{
var buffer = File.ReadAllBytes( path );
byte[] buffer;
using( var stream = new FileStream( path, FileMode.Open, FileAccess.Read ) )
{
var fullLength = stream.Length;
var longOffset = (long)offset;
var lengthToRead = fullLength - longOffset;
stream.Seek( longOffset, SeekOrigin.Begin );
buffer = stream.ReadFully( (int)lengthToRead );
}

CabHelper.RandomizeCabWithAnyLength( buffer );

XuaLogger.ResourceRedirector.Warn( $"Randomized CAB for '{path}' in order to load it because another asset bundle already uses its CAB-string. You can ignore the previous error message, but this is likely caused by two mods incorrectly using the same CAB-string." );
Expand Down

0 comments on commit ab5e82d

Please sign in to comment.