mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-15 00:31:52 +00:00
Fixed #1757 Binary search - SWF files need to be sorted by file position
This commit is contained in:
@@ -22,6 +22,8 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -45,7 +47,7 @@ public class BinarySWFBundle implements SWFBundle {
|
||||
|
||||
@Override
|
||||
public Set<String> getKeys() {
|
||||
Set<String> ret = new HashSet<>();
|
||||
Set<String> ret = new LinkedHashSet<>();
|
||||
for (Long address : search.getAddresses()) {
|
||||
ret.add("[" + address + "]");
|
||||
}
|
||||
@@ -71,7 +73,7 @@ public class BinarySWFBundle implements SWFBundle {
|
||||
|
||||
@Override
|
||||
public Map<String, SeekableInputStream> getAll() {
|
||||
Map<String, SeekableInputStream> ret = new HashMap<>();
|
||||
Map<String, SeekableInputStream> ret = new LinkedHashMap<>();
|
||||
for (String key : getKeys()) {
|
||||
ret.put(key, getSWF(key));
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -44,7 +45,7 @@ public class SWFSearch {
|
||||
|
||||
private final Set<ProgressListener> listeners = new HashSet<>();
|
||||
|
||||
private final Map<Long, MemoryInputStream> swfStreams = new HashMap<>();
|
||||
private final Map<Long, MemoryInputStream> swfStreams = new LinkedHashMap<>();
|
||||
|
||||
public SWFSearch(Searchable s, boolean noCheck, SearchMode searchMode) {
|
||||
this.s = s;
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.helpers;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -42,7 +43,7 @@ public class StreamSearch implements Searchable {
|
||||
|
||||
@Override
|
||||
public Map<Long, InputStream> search(ProgressListener progListener, byte[]... data) {
|
||||
Map<Long, InputStream> ret = new HashMap<>();
|
||||
Map<Long, InputStream> ret = new LinkedHashMap<>();
|
||||
int maxFindLen = 0;
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
if (data[i].length > maxFindLen) {
|
||||
@@ -84,7 +85,7 @@ public class StreamSearch implements Searchable {
|
||||
}
|
||||
if (match) {
|
||||
// todo: support > 2GB files
|
||||
InputStream fis = new MemoryInputStream(is.getAllRead(), (int) pos + i);
|
||||
InputStream fis = new MemoryInputStream(is.getAllRead(), (int) pos + i);
|
||||
ret.put(pos + i, fis);
|
||||
continue loopdata;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.helpers;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -44,7 +45,7 @@ public class SwfHeaderStreamSearch implements Searchable {
|
||||
public Map<Long, InputStream> search(ProgressListener progListener, byte[]... data) {
|
||||
// Ignore data parameter, find only FWS, CWS, ZWS, GFX and CFX
|
||||
|
||||
Map<Long, InputStream> ret = new HashMap<>();
|
||||
Map<Long, InputStream> ret = new LinkedHashMap<>();
|
||||
byte[] buf = is.getAllRead();
|
||||
byte byte2 = buf[0], byte3 = buf[1];
|
||||
boolean match = false;
|
||||
|
||||
Reference in New Issue
Block a user