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
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue