Jump to the found text after pcode search fixed

This commit is contained in:
honfika@gmail.com
2016-12-25 14:22:01 +01:00
parent 9ecb2e4a81
commit bf59e9e5fb
5 changed files with 189 additions and 133 deletions

View File

@@ -2609,6 +2609,17 @@ public final class SWF implements SWFContainerItem, Timelined {
return false;
}
public static boolean isActionListCached(ASMSource src) {
if (src != null) {
SWF swf = src.getSwf();
if (swf != null) {
return swf.as2Cache.isPCodeCached(src);
}
}
return false;
}
public static boolean isCached(ScriptPack pack) {
if (pack != null) {
SWF swf = pack.getSwf();
@@ -2631,6 +2642,17 @@ public final class SWF implements SWFContainerItem, Timelined {
return null;
}
public static ActionList getActionListFromCache(ASMSource src) {
if (src != null) {
SWF swf = src.getSwf();
if (swf != null) {
return swf.as2Cache.getPCode(src);
}
}
return null;
}
public static HighlightedText getFromCache(ScriptPack pack) {
if (pack != null) {
SWF swf = pack.getSwf();
@@ -2646,8 +2668,8 @@ public final class SWF implements SWFContainerItem, Timelined {
synchronized (src) {
SWF swf = src.getSwf();
int deobfuscationMode = Configuration.autoDeobfuscate.get() ? 1 : 0;
if (swf != null && swf.as2Cache.isPcodeCached(src)) {
ActionList result = swf.as2Cache.getPcode(src);
if (swf != null && swf.as2Cache.isPCodeCached(src)) {
ActionList result = swf.as2Cache.getPCode(src);
if (result.deobfuscationMode == deobfuscationMode) {
return result;
}
@@ -2958,7 +2980,8 @@ public final class SWF implements SWFContainerItem, Timelined {
timelined.setModified(true);
timelined.resetTimeline();
} else // timeline should be always the swf here
if (removeDependencies) {
{
if (removeDependencies) {
removeTagWithDependenciesFromTimeline(tag, timelined.getTimeline());
timelined.setModified(true);
} else {
@@ -2967,6 +2990,7 @@ public final class SWF implements SWFContainerItem, Timelined {
timelined.setModified(true);
}
}
}
}
@Override

View File

@@ -106,7 +106,7 @@ import java.util.logging.Logger;
*/
public abstract class Action implements GraphSourceItem {
private static final int INFORM_LISTENER_RESOLUTION = 100;
private static final int INFORM_LISTENER_RESOLUTION = 1000;
private boolean ignored = false;
@@ -474,11 +474,9 @@ public abstract class Action implements GraphSourceItem {
}
private static void informListeners(List<DisassemblyListener> listeners, int pos, int count) {
if (pos % INFORM_LISTENER_RESOLUTION == 0) {
DisassemblyListener[] listenersArray = listeners.toArray(new DisassemblyListener[listeners.size()]);
for (DisassemblyListener listener : listenersArray) {
listener.progressToString(pos + 1, count);
}
DisassemblyListener[] listenersArray = listeners.toArray(new DisassemblyListener[listeners.size()]);
for (DisassemblyListener listener : listenersArray) {
listener.progressToString(pos + 1, count);
}
}
@@ -507,11 +505,14 @@ public abstract class Action implements GraphSourceItem {
HashMap<Long, List<GraphSourceItemContainer>> containers = new HashMap<>();
HashMap<GraphSourceItemContainer, Integer> containersPos = new HashMap<>();
offset = address;
int pos = 0;
boolean lastPush = false;
byte[] fileData = list.fileData;
for (Action a : list) {
informListeners(listeners, pos, list.size());
for (int pos = 0; pos < list.size(); pos++) {
Action a = list.get(pos);
if ((pos + 1) % INFORM_LISTENER_RESOLUTION == 0) {
informListeners(listeners, pos, list.size());
}
if (exportMode == ScriptExportMode.PCODE_HEX) {
if (lastPush) {
@@ -671,8 +672,8 @@ public abstract class Action implements GraphSourceItem {
}
offset += a.getTotalActionLength();
pos++;
}
if (lastPush) {
writer.newLine();
}

View File

@@ -40,7 +40,7 @@ public class AS2Cache {
return cache.contains(src);
}
public boolean isPcodeCached(ASMSource src) {
public boolean isPCodeCached(ASMSource src) {
return pcodeCache.contains(src);
}
@@ -48,7 +48,7 @@ public class AS2Cache {
return cache.get(src);
}
public ActionList getPcode(ASMSource src) {
public ActionList getPCode(ASMSource src) {
return pcodeCache.get(src);
}