mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-26 10:31:03 +00:00
EnableDebugger1/2 and ProtectTag corrections
This commit is contained in:
@@ -73,8 +73,16 @@ public class EnableDebugger2Tag extends Tag implements PasswordTag {
|
||||
|
||||
@Override
|
||||
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
|
||||
reserved = sis.readUI16("reserved");
|
||||
passwordHash = sis.readString("passwordHash");
|
||||
if (sis.available() > 0) {
|
||||
reserved = sis.readUI16("reserved");
|
||||
} else {
|
||||
reserved = 0;
|
||||
}
|
||||
if (sis.available() > 0) {
|
||||
passwordHash = sis.readString("passwordHash");
|
||||
} else {
|
||||
passwordHash = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +94,9 @@ public class EnableDebugger2Tag extends Tag implements PasswordTag {
|
||||
@Override
|
||||
public void getData(SWFOutputStream sos) throws IOException {
|
||||
sos.writeUI16(reserved);
|
||||
sos.writeString(passwordHash);
|
||||
if (passwordHash != null) {
|
||||
sos.writeString(passwordHash);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,10 @@ import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.tags.base.PasswordTag;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Password;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.MD5Crypt;
|
||||
import java.io.IOException;
|
||||
@@ -36,6 +39,10 @@ public class EnableDebuggerTag extends Tag implements PasswordTag {
|
||||
|
||||
public static final String NAME = "EnableDebugger";
|
||||
|
||||
@Reserved
|
||||
@SWFType(BasicType.UI16)
|
||||
public int reserved;
|
||||
|
||||
/**
|
||||
* MD5 hash of password
|
||||
*/
|
||||
@@ -49,6 +56,7 @@ public class EnableDebuggerTag extends Tag implements PasswordTag {
|
||||
*/
|
||||
public EnableDebuggerTag(SWF swf) {
|
||||
super(swf, ID, NAME, null);
|
||||
reserved = 0;
|
||||
setPassword("");
|
||||
}
|
||||
|
||||
@@ -66,7 +74,16 @@ public class EnableDebuggerTag extends Tag implements PasswordTag {
|
||||
|
||||
@Override
|
||||
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
|
||||
passwordHash = sis.readString("passwordHash");
|
||||
if (sis.available() > 0) {
|
||||
reserved = sis.readUI16("reserved");
|
||||
} else {
|
||||
reserved = 0;
|
||||
}
|
||||
if (sis.available() > 0) {
|
||||
passwordHash = sis.readString("passwordHash");
|
||||
} else {
|
||||
passwordHash = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,6 +94,7 @@ public class EnableDebuggerTag extends Tag implements PasswordTag {
|
||||
*/
|
||||
@Override
|
||||
public void getData(SWFOutputStream sos) throws IOException {
|
||||
sos.writeUI16(reserved);
|
||||
if (passwordHash != null) {
|
||||
sos.writeString(passwordHash);
|
||||
}
|
||||
@@ -84,7 +102,6 @@ public class EnableDebuggerTag extends Tag implements PasswordTag {
|
||||
|
||||
@Override
|
||||
public void setPassword(String password) {
|
||||
//Assuming EnableDebugger tag has same hash type as EnableDebugger2
|
||||
this.passwordHash = MD5Crypt.crypt(password, 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,10 @@ import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.tags.base.PasswordTag;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Password;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.MD5Crypt;
|
||||
import java.io.IOException;
|
||||
@@ -36,6 +39,10 @@ public class ProtectTag extends Tag implements PasswordTag {
|
||||
|
||||
public static final String NAME = "Protect";
|
||||
|
||||
@Reserved
|
||||
@SWFType(BasicType.UI16)
|
||||
public int reserved;
|
||||
|
||||
/**
|
||||
* MD5 hash of password
|
||||
*/
|
||||
@@ -50,6 +57,7 @@ public class ProtectTag extends Tag implements PasswordTag {
|
||||
public ProtectTag(SWF swf) {
|
||||
super(swf, ID, NAME, null);
|
||||
passwordHash = "";
|
||||
reserved = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,6 +74,9 @@ public class ProtectTag extends Tag implements PasswordTag {
|
||||
|
||||
@Override
|
||||
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
|
||||
if (sis.available() > 0) {
|
||||
reserved = sis.readUI16("reserved");
|
||||
}
|
||||
if (sis.available() > 0) {
|
||||
passwordHash = sis.readString("passwordHash");
|
||||
} else {
|
||||
@@ -81,6 +92,7 @@ public class ProtectTag extends Tag implements PasswordTag {
|
||||
*/
|
||||
@Override
|
||||
public void getData(SWFOutputStream sos) throws IOException {
|
||||
sos.writeUI16(reserved);
|
||||
if (!"".equals(passwordHash)) {
|
||||
sos.writeString(passwordHash);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user