Fixed broken patching and endless Steam nags introduced in SMM 1.7
This commit is contained in:
parent
cefb4986c0
commit
a2bd02123e
7 changed files with 28 additions and 16 deletions
|
@ -1,5 +1,10 @@
|
|||
Changelog
|
||||
|
||||
1.8:
|
||||
- Fixed endless prompting about Steam on startup for standalone distros
|
||||
- Fixed mods not being added to FTL's resources
|
||||
- Fixed 'stream closed' error during patching
|
||||
|
||||
1.7:
|
||||
- Added support for FTL 1.6.1
|
||||
- Added a config option to launch FTL via Steam, if possible
|
||||
|
|
|
@ -31,7 +31,7 @@ public abstract class AbstractPack {
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds bytes read from srcFile to the pack, as innerPath.
|
||||
* Adds bytes read from an InputStream to the pack, as innerPath.
|
||||
*/
|
||||
public void add( String innerPath, InputStream is ) throws IOException {
|
||||
throw new UnsupportedOperationException();
|
||||
|
|
|
@ -88,7 +88,7 @@ public class PackContainer {
|
|||
public AbstractPack getPackFor( String innerPath ) {
|
||||
Matcher m = pathPtn.matcher( innerPath );
|
||||
if ( m.matches() ) {
|
||||
String root = m.group( 1 );
|
||||
String root = m.group( 2 );
|
||||
AbstractPack rootPack = rootMap.get( root );
|
||||
|
||||
if ( rootPack != null ) return rootPack;
|
||||
|
|
|
@ -566,6 +566,9 @@ public class PkgPack extends AbstractPack {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds bytes read from an InputStream to the pack, as innerPath.
|
||||
*/
|
||||
@Override
|
||||
public void add( String innerPath, InputStream is ) throws IOException {
|
||||
if ( innerPath.indexOf( "\\" ) != -1 ) {
|
||||
|
@ -608,19 +611,18 @@ public class PkgPack extends AbstractPack {
|
|||
}
|
||||
|
||||
// Write data.
|
||||
try {
|
||||
raf.seek( entry.dataOffset );
|
||||
byte[] buf = new byte[4096];
|
||||
int len;
|
||||
while ( (len = dataStream.read( buf )) >= 0 ) {
|
||||
raf.write( buf, 0, len );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
try {if ( dataStream != null ) dataStream.close();}
|
||||
catch ( IOException e ) {}
|
||||
raf.seek( entry.dataOffset );
|
||||
byte[] buf = new byte[4096];
|
||||
int len;
|
||||
while ( (len = dataStream.read( buf )) >= 0 ) {
|
||||
raf.write( buf, 0, len );
|
||||
}
|
||||
|
||||
// Attempting to close the wrapper streams would cause an exception if
|
||||
// the original stream was a ZipInputStream, which would need closeEntry().
|
||||
|
||||
// TODO: Test if compression works without closing the wrapper.
|
||||
|
||||
// Go back and fill in the dataSize.
|
||||
entry.dataSize = raf.getChannel().position() - entry.dataOffset;
|
||||
entry.unpackedSize = srcMeterStream.getCount();
|
||||
|
|
|
@ -260,8 +260,11 @@ public class ModPatchThread extends Thread {
|
|||
|
||||
AbstractPack pack = packContainer.getPackFor( innerPath );
|
||||
if ( pack == null ) {
|
||||
if ( !knownRoots.contains( root ) )
|
||||
if ( !knownRoots.contains( root ) ) {
|
||||
log.warn( String.format( "Unexpected innerPath: %s", innerPath ) );
|
||||
} else {
|
||||
log.debug( String.format( "Ignoring innerPath with known root: %s", innerPath ) );
|
||||
}
|
||||
zis.closeEntry();
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ public class SlipstreamConfig {
|
|||
|
||||
public static final String ALLOW_ZIP = "allow_zip";
|
||||
public static final String FTL_DATS_PATH = "ftl_dats_path";
|
||||
public static final String STEAM_DISTRO = "steam_distro";
|
||||
public static final String STEAM_EXE_PATH = "steam_exe_path";
|
||||
public static final String RUN_STEAM_FTL = "run_steam_ftl";
|
||||
public static final String NEVER_RUN_FTL = "never_run_ftl";
|
||||
|
@ -81,8 +82,9 @@ public class SlipstreamConfig {
|
|||
|
||||
userFieldsMap.put( ALLOW_ZIP, "Sets whether to treat .zip files as .ftl files. Default: false." );
|
||||
userFieldsMap.put( FTL_DATS_PATH, "The path to FTL's resources folder. If invalid, you'll be prompted." );
|
||||
userFieldsMap.put( STEAM_DISTRO, "If true, FTL was installed via Steam. Stops the GUI asking for a path." );
|
||||
userFieldsMap.put( STEAM_EXE_PATH, "The path to Steam's executable, if FTL was installed via Steam." );
|
||||
userFieldsMap.put( RUN_STEAM_FTL, "If true, SMM will use Steam to launch FTL, if possible. Default: false." );
|
||||
userFieldsMap.put( RUN_STEAM_FTL, "If true, SMM will use Steam to launch FTL, if possible." );
|
||||
userFieldsMap.put( NEVER_RUN_FTL, "If true, there will be no offer to run FTL after patching. Default: false." );
|
||||
userFieldsMap.put( UPDATE_CATALOG, "If a number greater than 0, check for new mod descriptions every N days." );
|
||||
userFieldsMap.put( UPDATE_APP, "If a number greater than 0, check for newer app versions every N days." );
|
||||
|
|
|
@ -54,7 +54,7 @@ public class JacksonAutoUpdateReader {
|
|||
JsonNode changelogNode = historyNode.get( "changelog" );
|
||||
|
||||
for ( JsonNode releaseNode : changelogNode ) {
|
||||
// Skip any versions with optional "hidden" field set to true.
|
||||
// Skip any versions with optional "hidden" field set to true (true without quotes!).
|
||||
if ( releaseNode.get( "hidden" ) != null && releaseNode.get( "hidden" ).booleanValue() ) {
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue