+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package lt.dkd.nellymoser;
+
+public class CodecImpl {
+
+ private static class BitStream {
+
+ private int byteOffset = 0;
+ private int bitOffset = 0;
+
+ public void push(int val, int len, byte[] buf) {
+
+ if (bitOffset == 0) {
+ buf[byteOffset] = (byte)val;
+ } else {
+ buf[byteOffset] |= (byte)(val << bitOffset);
+ }
+ bitOffset += len;
+ if (bitOffset >= 8) {
+ ++byteOffset;
+ bitOffset -= 8;
+ if (bitOffset > 0) {
+ buf[byteOffset] = (byte)(val >> (len - bitOffset));
+ }
+ }
+ }
+
+ public int pop(int len, byte[] buf) {
+
+ int val = ((int)buf[byteOffset] & 0xff) >> bitOffset;
+ final int bits_read = 8 - bitOffset;
+
+ if (len >= bits_read) {
+ ++byteOffset;
+ if (len > bits_read) {
+ val |= buf[byteOffset] << bits_read;
+ }
+ }
+
+ bitOffset = (bitOffset + len) & 7;
+ return val & ((1 << len) - 1);
+ }
+ }
+
+ private static class NormalizedInt32 {
+
+ public final int value;
+ public final int scale;
+
+ public NormalizedInt32(final int val) {
+ if (val == 0) {
+ value = val;
+ scale = 31;
+ return;
+ } else if (val >= (1 << 30)) {
+ value = 0;
+ scale = 0;
+ return;
+ }
+
+ int v = val;
+ int s = 0;
+
+ if (v > 0) {
+ do {
+ v <<= 1;
+ ++s;
+ } while (v < (1 << 30));
+ } else {
+ final int floor = 1 << 31; // lowest possible 32bit value
+ do {
+ v <<= 1;
+ ++s;
+ } while (v > floor + (1 << 30));
+ }
+
+ value = v;
+ scale = s;
+ }
+ }
+
+ private static class Factor {
+
+ public final int value;
+ public final int shift;
+
+ public Factor(final int val) {
+ if (val == 124) {
+ // Common case optimization.
+ value = 4228;
+ shift = 19;
+ return;
+ } else if (val == 0) {
+ value = 0;
+ shift = 0;
+ return;
+ }
+
+ final int sign = ((~val >>> 31) << 1) - 1;
+
+ int abs = val * sign;
+
+ int scale = -1;
+ while ((abs & (1 << 15)) == 0) {
+ abs <<= 1;
+ ++scale;
+ }
+ abs >>= 1;
+
+ shift = 27 - scale;
+
+ final int table_val = table9[(abs - 0x3e00) >> 10];
+ int tmp = abs * table_val;
+ tmp = (1 << 30) - tmp;
+ tmp += (1 << 14);
+ tmp >>= 15;
+ tmp *= table_val;
+ tmp += (1 << 14);
+ tmp >>= 15;
+ final int tmp2 = tmp;
+ tmp *= abs;
+ tmp = (1 << 29) - tmp;
+ tmp += (1 << 14);
+ tmp >>= 15;
+ tmp *= tmp2;
+ tmp += (1 << 13);
+ tmp >>= 14;
+ tmp *= sign;
+
+ if (tmp > 32767 && sign == 1) {
+ tmp = 32767;
+ } else if (tmp < -32768 && sign == -1) {
+ tmp = -32768;
+ }
+
+ value = tmp;
+ }
+ }
+
+ public static void encode(float[] state, float[] in, byte[] out) {
+
+ float var_8d8[] = new float[256];
+ float var_2e8[] = new float[23];
+ float var_268[] = new float[23];
+ float var_4d8[] = new float[124];
+ float var_208[] = new float[124];
+
+ final BitStream bs = new BitStream();
+
+ fTransfm(state, in, 0, 7, var_8d8, 0);
+ fTransfm(state, in, 128, 7, var_8d8, 128);
+
+ for (int i = 0; i < 23; ++i) {
+ int bound = bandBound[i];
+ final int next_bound = bandBound[i + 1];
+ double acc = 0.0;
+ for (; bound < next_bound; ++bound) {
+ final double a = var_8d8[bound];
+ final double b = var_8d8[bound + 128];
+ acc += a*a + b*b;
+ }
+ final double tmp = Math.max(1.0, acc / (table0[i] << 1));
+ var_2e8[i] = Math.round(Math.log(tmp) * (1.44269502 * 1024.0));
+ };
+
+ int idx = findClosest(var_2e8[0], table1, 0, 64);
+ var_268[0] = table1[idx];
+ bs.push(idx, gainBit[0], out);
+ for (int i = 1; i < 23; ++i) {
+ idx = findClosest(var_2e8[i] - var_268[i - 1], table2, 0, 32);
+ var_268[i] = var_268[i - 1] + table2[idx];
+ bs.push(idx, gainBit[i], out);
+ }
+
+ for (int i = 0; i < 23; ++i) {
+ var_2e8[i] = (float)(1.0 / Math.pow(2.0, var_268[i] * (0.5 * 0.0009765625)));
+ }
+
+ for (int i = 0; i < 23; ++i) {
+ int bound = bandBound[i];
+ final int next_bound = bandBound[i + 1];
+ for (; bound < next_bound; ++bound) {
+ var_4d8[bound] = var_268[i];
+ var_208[bound] = var_2e8[i];
+ }
+ }
+
+ int packed_byte_sizes[] = new int[124];
+ final int leftover = wc(var_4d8, 124, 198, packed_byte_sizes);
+ for (int off = 0; off < 256; off += 128) {
+ for (int i = 0; i < 124; ++i) {
+ final int packedSize = packed_byte_sizes[i];
+ if (packedSize > 0) {
+ final int pow2 = 1 << packedSize;
+ idx = findClosestOrdered(
+ var_208[i] * var_8d8[off + i],
+ table3, pow2 - 1, (pow2 << 1) - 1
+ );
+ bs.push(idx, packedSize, out);
+ }
+ }
+ for (int i = leftover; i > 0; i -= 8) {
+ if (i > 8) {
+ bs.push(0, 8, out);
+ } else {
+ bs.push(0, i, out);
+ break;
+ }
+ }
+ }
+ }
+
+ public static void decode(float[] state, byte[] in, float[] out) {
+
+ byte[] unpacked_input = new byte[124];
+ float[] var_808 = new float[128];
+ float[] var_608 = new float[124];
+ float[] var_418 = new float[124];
+
+ BitStream bs = new BitStream();
+
+ int unpacked_byte = bs.pop(gainBit[0], in);
+ unpacked_input[0] = (byte)unpacked_byte;
+ var_808[0] = table1[unpacked_byte];
+
+ for (int i = 1; i < 23; ++i) {
+ unpacked_byte = bs.pop(gainBit[i], in);
+ unpacked_input[i] = (byte)unpacked_byte;
+ var_808[i] = var_808[i - 1] + table2[unpacked_byte];
+ };
+
+ for (int i = 0; i < 23; ++i) {
+ final float pow = (float)Math.pow(
+ 2.0, var_808[i] * (0.5 * 0.0009765625)
+ );
+
+ int bound = bandBound[i];
+ final int next_bound = bandBound[i + 1];
+ for (; bound < next_bound; ++bound) {
+ var_418[bound] = var_808[i];
+ var_608[bound] = pow;
+ }
+ }
+
+ int packed_byte_sizes[] = new int[124];
+ final int leftover = wc(var_418, 124, 198, packed_byte_sizes);
+
+ for (int out_off = 0; out_off < 256; out_off += 128) {
+ for (int i = 0; i < 124; ++i) {
+ final int packed_size = packed_byte_sizes[i];
+ float val = var_608[i];
+ if (packed_size > 0) {
+ final int pow2 = 1 << packed_size;
+ unpacked_byte = bs.pop(packed_size, in);
+ unpacked_input[i] = (byte)unpacked_byte;
+ val *= table3[pow2 - 1 + unpacked_byte];
+ } else {
+ final double rnd_u32 = Math.random() * 4294967296.0;
+ if (rnd_u32 < (1<<30) + (1<<14)) {
+ val *= -0.707099974;
+ } else {
+ val *= 0.707099974;
+ }
+ }
+ var_808[i] = val;
+ }
+
+ for (int i = 124; i < 128; ++i) {
+ var_808[i] = 0;
+ }
+
+ for (int i = leftover; i > 0; i -= 8) {
+ if (i > 8) {
+ bs.pop(8, in);
+ } else {
+ bs.pop(i, in);
+ break;
+ }
+ }
+
+ iTransfm(state, var_808, 7, out, out_off);
+ }
+ }
+
+ private static void iTransfm(float[] state, float[] in,
+ int len_log2, float[] out, int out_off) {
+
+ final int len = 1 << len_log2;
+ final int quarter_len = len >> 2;
+ int y = len - 1;
+ int x = len >> 1;
+ int j = x - 1;
+ int i = 0;
+
+ /*
+ i--> <--j
+ ----------------------------
+ x--> <--y
+
+ i, j, x, y are indexes into table7.
+ table7 is defined as follows:
+ for (int i = 0; i < 128; ++i) {
+ table7[i] = Math.sin((i + 0.5) / 128 * (Math.PI / 2));
+ }
+ */
+
+ auxceps(in, 0, len_log2, out, out_off);
+
+ for (; i < quarter_len; ++i, --j, ++x, --y) {
+ final double state_i = state[i];
+ final double state_j = state[j];
+ final double out_x = out[out_off + x];
+ final double out_y = out[out_off + y];
+
+ state[i] = -out[out_off + j];
+ state[j] = -out[out_off + i];
+
+ out[out_off + i] = (float)(state_i * table7[y] + out_x * table7[i]);
+ out[out_off + j] = (float)(state_j * table7[x] + out_y * table7[j]);
+
+ out[out_off + x] = (float)(table7[x] * -out_y + table7[j] * state_j);
+ out[out_off + y] = (float)(table7[y] * -out_x + table7[i] * state_i);
+ }
+ }
+
+ private static void fTransfm(float[] state, float[] in, int in_off,
+ int len_log2, float[] out, int out_off) {
+
+ final int len = 1 << len_log2;
+ final int quarter_len = len >> 2;
+ int y = len - 1;
+ int x = len >> 1;
+ int j = x - 1;
+ int i = 0;
+
+ /*
+ i--> <--j
+ ----------------------------
+ x--> <--y
+
+ i, j, x, y are indexes into table7.
+ table7 is defined as follows:
+ for (int i = 0; i < 128; ++i) {
+ table7[i] = Math.sin((i + 0.5) / 128 * (Math.PI / 2));
+ }
+ */
+
+ for (; i < quarter_len; ++i, ++x, --y, --j) {
+ out[out_off + x] = state[i];
+ out[out_off + y] = state[j];
+
+ out[out_off + i] = -in[in_off + j] * table7[x] - in[in_off + x] * table7[j];
+ out[out_off + j] = -in[in_off + y] * table7[i] - in[in_off + i] * table7[y];
+
+ state[i] = in[in_off + i] * table7[i] - in[in_off + y] * table7[y];
+ state[j] = in[in_off + j] * table7[j] - in[in_off + x] * table7[x];
+ }
+
+ auxceps(out, out_off, len_log2, out, out_off);
+ }
+
+ private static void auxceps(
+ float[] in, final int in_off, int len_log2, float[] out, final int out_off) {
+
+ final int len = 1 << len_log2;
+ final int half_len_m1 = (len >> 1) - 1;
+ final int quarter_len = len >> 2;
+
+ for (int i = 0; i < quarter_len; ++i) {
+ final int i2 = i << 1;
+ final int j = len - 1 - i2;
+ final int k = j - 1;
+
+ final double in_i2 = in[in_off + i2];
+ final double in_i2_1 = in[in_off + i2 + 1];
+ final double in_j = in[in_off + j];
+ final double in_k = in[in_off + k];
+
+ out[out_off + i2] = (float)(table4[i] * in_i2 - table6[i] * in_j);
+ out[out_off + i2 + 1] = (float)(in_j * table4[i] + in_i2 * table6[i]);
+
+ out[out_off + k] = (float)(table4[half_len_m1 - i] * in_k - table6[half_len_m1 - i] * in_i2_1);
+ out[out_off + j] = (float)(in_i2_1 * table4[half_len_m1 - i] + in_k * table6[half_len_m1 - i]);
+ }
+
+ HarXfm(out, out_off, len_log2 - 1);
+
+ final float last_out = out[out_off + len - 1];
+ final float pre_last_out = out[out_off + len - 2];
+
+ out[out_off] = table5[0] * out[out_off];
+ out[out_off + len - 1] = out[out_off + 1] * -table5[0];
+
+ out[out_off + len - 2] = table5[half_len_m1] * out[out_off + len - 2] + table5[1] * last_out;
+ out[out_off + 1] = pre_last_out * table5[1] - last_out * table5[half_len_m1];
+
+ int i_out = len - 3;
+ int i_tbl = half_len_m1;
+ int j = 3;
+ for (int i = 1; i < quarter_len; ++i, --i_tbl, i_out -= 2, j += 2) {
+ final double old_out_a = out[out_off + i_out];
+ final double old_out_b = out[out_off + i_out - 1];
+ final double old_out_c = out[out_off + j];
+ final double old_out_d = out[out_off + j - 1];
+
+ out[out_off + j - 1] = (float)(table5[i_tbl] * old_out_c + table5[(j - 1) >> 1] * old_out_d);
+ out[out_off + j] = (float)(old_out_b * table5[(j + 1) >> 1] - old_out_a * table5[i_tbl - 1]);
+ out[out_off + i_out] = (float)(old_out_d * table5[i_tbl] - old_out_c * table5[(j - 1) >> 1]);
+ out[out_off + i_out - 1] = (float)(table5[(j + 1) >> 1] * old_out_a + table5[i_tbl - 1] * old_out_b);
+ }
+ }
+
+ private static void HarXfm(float[] data, int data_off, int half_len_log2) {
+
+ final int half_len = 1 << half_len_log2;
+
+ HarXfmHelper(data, data_off, half_len);
+
+ int j = 0;
+ for (int i = half_len >> 1; i > 0; --i, j += 4) {
+ final float j0 = data[data_off + j];
+ final float j1 = data[data_off + j + 1];
+ final float j2 = data[data_off + j + 2];
+ final float j3 = data[data_off + j + 3];
+ data[data_off + j] = j0 + j2;
+ data[data_off + j + 1] = j1 + j3;
+ data[data_off + j + 2] = j0 - j2;
+ data[data_off + j + 3] = j1 - j3;
+ }
+
+ j = 0;
+ for (int i = half_len >> 2; i > 0; --i, j += 8) {
+ final float j0 = data[data_off + j];
+ final float j1 = data[data_off + j + 1];
+ final float j2 = data[data_off + j + 2];
+ final float j3 = data[data_off + j + 3];
+ final float j4 = data[data_off + j + 4];
+ final float j5 = data[data_off + j + 5];
+ final float j6 = data[data_off + j + 6];
+ final float j7 = data[data_off + j + 7];
+ data[data_off + j] = j0 + j4;
+ data[data_off + j + 1] = j1 + j5;
+ data[data_off + j + 2] = j2 + j7;
+ data[data_off + j + 3] = j3 - j6;
+ data[data_off + j + 4] = j0 - j4;
+ data[data_off + j + 5] = j1 - j5;
+ data[data_off + j + 6] = j2 - j7;
+ data[data_off + j + 7] = j3 + j6;
+ }
+
+ int i = 0;
+ int x = half_len >> 3;
+ int y = 64;
+ int z = 4;
+ for (int idx1 = half_len_log2 - 2; idx1 > 0; --idx1, z <<= 1, y >>= 1, x >>= 1) {
+ j = 0;
+ for (int idx2 = x; idx2 != 0; --idx2, j += z << 1) {
+ for (int idx3 = z >> 1; idx3 > 0; --idx3, j += 2, i += y) {
+ final int k = j + (z << 1);
+
+ final double j0 = data[data_off + j];
+ final double j1 = data[data_off + j + 1];
+ final double k0 = data[data_off + k];
+ final double k1 = data[data_off + k + 1];
+
+ data[data_off + k] = (float)(j0 - (k0 * table10[128 - i] + k1 * table10[i]));
+ data[data_off + j] = (float)(j0 + (k0 * table10[128 - i] + k1 * table10[i]));
+ data[data_off + k + 1] = (float)(j1 + (k0 * table10[i] - k1 * table10[128 - i]));
+ data[data_off + j + 1] = (float)(j1 - (k0 * table10[i] - k1 * table10[128 - i]));
+ }
+ for (int idx4 = z >> 1; idx4 > 0; --idx4, j += 2, i -= y) {
+ final int k = j + (z << 1);
+
+ final double j0 = data[data_off + j];
+ final double j1 = data[data_off + j + 1];
+ final double k0 = data[data_off + k];
+ final double k1 = data[data_off + k + 1];
+
+ data[data_off + k] = (float)(j0 + (k0 * table10[128 - i] - k1 * table10[i]));
+ data[data_off + j] = (float)(j0 - (k0 * table10[128 - i] - k1 * table10[i]));
+ data[data_off + k + 1] = (float)(j1 + (k1 * table10[128 - i] + k0 * table10[i]));
+ data[data_off + j + 1] = (float)(j1 - (k1 * table10[128 - i] + k0 * table10[i]));
+ }
+ }
+ }
+ }
+
+ private static void HarXfmHelper(float[] data, int data_off, int half_len) {
+
+ final int len = half_len << 1;
+
+ int j = 1;
+ for (int i = 1; i < len; i += 2) {
+ if (i < j) {
+ final float tmp1 = data[data_off + i];
+ data[data_off + i] = data[data_off + j];
+ data[data_off + j] = tmp1;
+
+ final float tmp2 = data[data_off + i - 1];
+ data[data_off + i - 1] = data[data_off + j - 1];
+ data[data_off + j - 1] = tmp2;
+ }
+
+ int x = half_len;
+ while (x > 1 && x < j) {
+ j -= x;
+ x >>= 1;
+ }
+ j += x;
+ }
+ }
+
+ private static int findClosest(float target, float[] values, int from, int to) {
+
+ int min_idx = 0;
+ float min_distance = Math.abs(target - values[from]);
+
+ for (int i = from; i < to; ++i) {
+ final float distance = Math.abs(target - values[i]);
+ if (distance < min_distance) {
+ min_distance = distance;
+ min_idx = i - from;
+ }
+ }
+
+ return min_idx;
+ }
+
+ private static int findClosestOrdered(float target, float[] values, int from, int to) {
+
+ int begin = from;
+ int end = to;
+ do {
+ final int middle = (begin + end) >> 1;
+ if (target > values[middle]) {
+ begin = middle;
+ } else {
+ end = middle;
+ }
+ } while (end - begin > 1);
+
+ if (end != to) {
+ if (target - values[begin] > values[end] - target) {
+ begin = end;
+ }
+ }
+ return begin - from;
+ }
+
+ static int wc(float[] in, int len, int total_bits, int[] packed_sizes) {
+
+ float max_input = 0;
+ for (int i = 0; i < len; ++i) {
+ if (in[i] > max_input) {
+ max_input = in[i];
+ }
+ }
+
+ int max_input_scale = 0;
+ {
+ NormalizedInt32 normalized = new NormalizedInt32((int)max_input);
+ max_input_scale = normalized.scale - 16;
+ }
+
+ short scaled_input[] = new short[124];
+
+ if (max_input_scale < 0) {
+ for (int i = 0; i < len; ++i) {
+ scaled_input[i] = (short)((int)in[i] >> -max_input_scale);
+ }
+ } else {
+ for (int i = 0; i < len; ++i) {
+ scaled_input[i] = (short)((int)in[i] << max_input_scale);
+ }
+ }
+
+ final Factor factor = new Factor(len);
+
+ for (int i = 0; i < len; ++i) {
+ scaled_input[i] = (short)(((int)scaled_input[i] * 3) >> 2); // *= 0.75
+ }
+
+ int scaled_input_sum = 0;
+ for (int i = 0; i < len; ++i) {
+ scaled_input_sum += scaled_input[i];
+ }
+
+ max_input_scale += 11;
+ scaled_input_sum -= total_bits << max_input_scale;
+ int scaled_input_base = 0;
+ {
+ final int val = scaled_input_sum - (total_bits << max_input_scale);
+ final NormalizedInt32 normalized = new NormalizedInt32(val);
+ scaled_input_base = ((val >> 16) * factor.value) >> 15;
+
+ final int shift = 31 - factor.shift - normalized.scale;
+ if (shift >= 0) {
+ scaled_input_base <<= shift;
+ } else {
+ scaled_input_base >>= -shift;
+ }
+ }
+
+ int bits_used = getD(scaled_input, max_input_scale, len, 6, scaled_input_base);
+ if (bits_used != total_bits) {
+ int diff = bits_used - total_bits;
+ int diff_scale = 0;
+ if (diff <= 0) {
+ for (; diff >= -16384; diff <<= 1) {
+ ++diff_scale;
+ }
+ } else {
+ for (; diff < 16384; diff <<= 1) {
+ ++diff_scale;
+ }
+ }
+
+ int base_delta = (diff * factor.value) >> 15;
+ diff_scale = max_input_scale - (factor.shift + diff_scale - 15);
+ if (diff_scale >= 0) {
+ base_delta <<= diff_scale;
+ } else {
+ base_delta >>= -diff_scale;
+ }
+
+ int num_revisions = 1;
+ int last_bits_used;
+ int last_scaled_input_base;
+ for (;;) {
+ last_bits_used = bits_used;
+ last_scaled_input_base = scaled_input_base;
+ scaled_input_base += base_delta;
+ bits_used = getD(scaled_input, max_input_scale, len, 6, scaled_input_base);
+ if (++num_revisions > 19) {
+ break;
+ }
+ if ((bits_used - total_bits) * (last_bits_used - total_bits) <= 0) {
+ break;
+ }
+
+ }
+
+ if (bits_used != total_bits) {
+ int scaled_input_base_1;
+ int bits_used_1;
+ int bits_used_2;
+ if (bits_used > total_bits) {
+ scaled_input_base_1 = scaled_input_base;
+ scaled_input_base = last_scaled_input_base;
+ bits_used_1 = bits_used;
+ bits_used_2 = last_bits_used;
+ } else {
+ scaled_input_base_1 = last_scaled_input_base;
+ bits_used_1 = last_bits_used;
+ bits_used_2 = bits_used;
+ }
+
+ while (bits_used != total_bits && num_revisions < 20) {
+ final int avg = (scaled_input_base + scaled_input_base_1) >> 1;
+ bits_used = getD(scaled_input, max_input_scale, len, 6, avg);
+ ++num_revisions;
+ if (bits_used > total_bits) {
+ scaled_input_base_1 = avg;
+ bits_used_1 = bits_used;
+ } else {
+ scaled_input_base = avg;
+ bits_used_2 = bits_used;
+ }
+ }
+
+ final int dev_1 = Math.abs((int)bits_used_1 - total_bits);
+ final int dev_2 = Math.abs((int)bits_used_2 - total_bits);
+
+ if (dev_1 < dev_2) {
+ scaled_input_base = scaled_input_base_1;
+ bits_used = bits_used_1;
+ } else {
+ bits_used = bits_used_2;
+ }
+ }
+ }
+
+ for (int i = 0; i < len; ++i) {
+ int tmp = (int)scaled_input[i] - scaled_input_base;
+ if (tmp >= 0) {
+ tmp = (tmp + (1 << (max_input_scale - 1))) >> max_input_scale;
+ } else {
+ tmp = 0;
+ }
+ packed_sizes[i] = Math.min(tmp, 6);
+ }
+
+ if (bits_used > total_bits) {
+ int i = 0;
+ int bit_count = 0;
+ for (; bit_count < total_bits; ++i) {
+ bit_count += packed_sizes[i];
+ }
+
+ bit_count -= packed_sizes[i - 1];
+ packed_sizes[i - 1] = total_bits - bit_count;
+ bits_used = total_bits;
+ for (; i < len; ++i) {
+ packed_sizes[i] = 0;
+ }
+ }
+
+ return total_bits - bits_used;
+ }
+
+ private static int getD(short[] in, int scale, int len, int upper_bound, int base) {
+ int d = 0;
+ if (len <= 0) {
+ return d;
+ }
+
+ final int var_1 = 1 << (scale - 1);
+
+ for (int i = 0; i < len; ++i) {
+ int var_2 = (int)in[i] - base;
+ if (var_2 < 0) {
+ var_2 = 0;
+ } else {
+ var_2 = (var_2 + var_1) >> scale;
+ }
+ d += Math.min(var_2, upper_bound);
+ }
+
+ return d;
+ }
+
+ private static final int bandBound[] = {
+ 0, 2, 4, 6,
+ 8, 10, 12, 14,
+ 16, 18, 21, 24,
+ 28, 32, 37, 43,
+ 49, 56, 64, 73,
+ 83, 95, 109, 124
+ };
+
+ private static final short gainBit[] = {
+ 6, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0
+ };
+
+ private static final int table0[] = {
+ 2, 2, 2, 2,
+ 2, 2, 2, 2,
+ 2, 3, 3, 4,
+ 4, 5, 6, 6,
+ 7, 8, 9, 10,
+ 12, 14, 15, 0
+ };
+
+ private static final float table1[] = {
+ 3134, 5342, 6870, 7792,
+ 8569, 9185, 9744, 10191,
+ 10631, 11061, 11434, 11770,
+ 12116, 12513, 12925, 13300,
+ 13674, 14027, 14352, 14716,
+ 15117, 15477, 15824, 16157,
+ 16513, 16804, 17090, 17401,
+ 17679, 17948, 18238, 18520,
+ 18764, 19078, 19381, 19640,
+ 19921, 20205, 20500, 20813,
+ 21162, 21465, 21794, 22137,
+ 22453, 22756, 23067, 23350,
+ 23636, 23926, 24227, 24521,
+ 24819, 25107, 25414, 25730,
+ 26120, 26497, 26895, 27344,
+ 27877, 28463, 29426, 31355
+ };
+
+ private static final float table2[] = {
+ -11725, -9420, -7910, -6801,
+ -5948, -5233, -4599, -4039,
+ -3507, -3030, -2596, -2170,
+ -1774, -1383, -1016, -660,
+ -329, -1, 337, 696,
+ 1085, 1512, 1962, 2433,
+ 2968, 3569, 4314, 5279,
+ 6622, 8154, 10076, 12975
+ };
+
+ private static final float table3[] = {
+ 0.0f, -0.847256005f, 0.722470999f, -1.52474797f,
+ -0.453148007f, 0.375360996f, 1.47178996f, -1.98225796f,
+ -1.19293797f, -0.582937002f, -0.0693780035f, 0.390956998f,
+ 0.906920016f, 1.486274f, 2.22154093f, -2.38878703f,
+ -1.80675399f, -1.41054201f, -1.07736099f, -0.799501002f,
+ -0.555810988f, -0.333402008f, -0.132449001f, 0.0568020009f,
+ 0.254877001f, 0.477355003f, 0.738685012f, 1.04430604f,
+ 1.39544594f, 1.80987501f, 2.39187598f, -2.38938308f,
+ -1.98846805f, -1.75140405f, -1.56431198f, -1.39221299f,
+ -1.216465f, -1.04694998f, -0.890510023f, -0.764558017f,
+ -0.645457983f, -0.52592802f, -0.405954987f, -0.302971989f,
+ -0.209690005f, -0.123986997f, -0.0479229987f, 0.025773f,
+ 0.100134f, 0.173718005f, 0.258554012f, 0.352290004f,
+ 0.456988007f, 0.576775014f, 0.700316012f, 0.842552006f,
+ 1.00938797f, 1.18213499f, 1.35345602f, 1.53208196f,
+ 1.73326194f, 1.97223496f, 2.39781404f, -2.5756309f,
+ -2.05733204f, -1.89849198f, -1.77278101f, -1.66626f,
+ -1.57421803f, -1.49933195f, -1.43166399f, -1.36522806f,
+ -1.30009902f, -1.22809303f, -1.15885794f, -1.09212506f,
+ -1.013574f, -0.920284986f, -0.828705013f, -0.737488985f,
+ -0.644775987f, -0.559094012f, -0.485713989f, -0.411031991f,
+ -0.345970005f, -0.285115987f, -0.234162003f, -0.187058002f,
+ -0.144250005f, -0.110716999f, -0.0739680007f, -0.0365610011f,
+ -0.00732900016f, 0.0203610007f, 0.0479039997f, 0.0751969963f,
+ 0.0980999991f, 0.122038998f, 0.145899996f, 0.169434994f,
+ 0.197045997f, 0.225243002f, 0.255686998f, 0.287010014f,
+ 0.319709986f, 0.352582991f, 0.388906986f, 0.433492005f,
+ 0.476945996f, 0.520482004f, 0.564453006f, 0.612204015f,
+ 0.668592989f, 0.734165013f, 0.803215981f, 0.878404021f,
+ 0.956620991f, 1.03970695f, 1.12937701f, 1.22111595f,
+ 1.30802798f, 1.40248001f, 1.50568199f, 1.62277305f,
+ 1.77249599f, 1.94308805f, 2.29039311f, 0.0f
+ };
+
+ /**
+ * Lookup table.
+ *
+ * for (int i = 0; i < 64; ++i) {
+ * table4[i] = Math.cos((i + 0.25) / 64 * (Math.PI / 2));
+ * }
+ *
+ */
+ private static final float table4[] = {
+ 0.999981225f, 0.999529421f, 0.998475611f, 0.996820271f,
+ 0.994564593f, 0.991709828f, 0.988257587f, 0.984210074f,
+ 0.979569793f, 0.974339426f, 0.968522072f, 0.962121427f,
+ 0.955141187f, 0.947585583f, 0.939459205f, 0.930767f,
+ 0.921513975f, 0.911705971f, 0.901348829f, 0.890448689f,
+ 0.879012227f, 0.867046177f, 0.854557991f, 0.841554999f,
+ 0.828045011f, 0.81403631f, 0.799537301f, 0.784556627f,
+ 0.769103289f, 0.753186822f, 0.736816585f, 0.720002472f,
+ 0.702754676f, 0.685083687f, 0.666999876f, 0.64851439f,
+ 0.629638195f, 0.610382795f, 0.590759695f, 0.570780694f,
+ 0.550458014f, 0.529803574f, 0.50883007f, 0.487550199f,
+ 0.465976506f, 0.444122106f, 0.422000289f, 0.399624199f,
+ 0.377007395f, 0.354163498f, 0.331106305f, 0.307849586f,
+ 0.284407496f, 0.260794103f, 0.237023607f, 0.213110298f,
+ 0.189068705f, 0.164913103f, 0.1406582f, 0.116318598f,
+ 0.0919089988f, 0.0674438998f, 0.0429382995f, 0.0184067003f
+ };
+
+ /**
+ * Lookup table.
+ *
+ * for (int i = 0; i < 64; ++i) {
+ * table5[i] = Math.cos(i / 64.0 * (Math.PI / 2)) * Math.sqrt(2.0 / 128);
+ * }
+ *
+ */
+ private static final float table5[] = {
+ 0.125f, 0.124962397f, 0.124849401f, 0.124661297f,
+ 0.124398097f, 0.124059901f, 0.123647101f, 0.123159699f,
+ 0.122598201f, 0.121962801f, 0.1212539f, 0.120471999f,
+ 0.119617499f, 0.118690997f, 0.117693f, 0.116624102f,
+ 0.115484901f, 0.114276201f, 0.112998702f, 0.111653f,
+ 0.110240199f, 0.108760901f, 0.107216097f, 0.105606697f,
+ 0.103933699f, 0.102198102f, 0.100400902f, 0.0985433012f,
+ 0.0966262966f, 0.094651103f, 0.0926188976f, 0.0905309021f,
+ 0.0883883014f, 0.0861926004f, 0.0839449018f, 0.0816465989f,
+ 0.0792991966f, 0.076903902f, 0.0744623989f, 0.0719759986f,
+ 0.069446303f, 0.0668746978f, 0.0642627999f, 0.0616123006f,
+ 0.0589246005f, 0.0562013984f, 0.0534444004f, 0.0506552011f,
+ 0.0478353985f, 0.0449868999f, 0.0421111993f, 0.0392102003f,
+ 0.0362856016f, 0.0333391018f, 0.0303725004f, 0.0273876991f,
+ 0.0243862998f, 0.0213702004f, 0.0183412991f, 0.0153013002f,
+ 0.0122520998f, 0.0091955997f, 0.00613350002f, 0.00306769996f
+ };
+
+ /**
+ * Lookup table.
+ *
+ * for (int i = 0; i < 64; ++i) {
+ * table6[i] = -Math.sin((i + 0.25) / 64 * (Math.PI / 2));
+ * }
+ *
+ */
+ private static final float table6[] = {
+ -0.00613590004f,-0.0306748003f, -0.0551952012f, -0.0796824023f,
+ -0.104121603f, -0.128498107f, -0.152797207f, -0.177004203f,
+ -0.201104596f, -0.225083902f, -0.248927593f, -0.272621393f,
+ -0.296150893f, -0.319501996f, -0.342660695f, -0.365613014f,
+ -0.388345003f, -0.410843194f, -0.433093786f, -0.455083609f,
+ -0.47679919f, -0.498227686f, -0.519356012f, -0.540171504f,
+ -0.560661614f, -0.580814004f, -0.600616515f, -0.620057225f,
+ -0.639124393f, -0.657806695f, -0.676092684f, -0.693971515f,
+ -0.711432219f, -0.728464425f, -0.745057821f, -0.761202395f,
+ -0.77688849f, -0.792106628f, -0.806847572f, -0.8211025f,
+ -0.834862888f, -0.848120272f, -0.860866904f, -0.873094976f,
+ -0.884797096f, -0.895966172f, -0.906595707f, -0.916679084f,
+ -0.926210225f, -0.935183525f, -0.943593502f, -0.95143503f,
+ -0.958703518f, -0.965394378f, -0.971503913f, -0.977028072f,
+ -0.981963873f, -0.986308098f, -0.990058184f, -0.993211925f,
+ -0.995767415f, -0.997723103f, -0.999077678f, -0.999830604f
+ };
+
+ /**
+ * Lookup table.
+ *
+ * for (int i = 0; i < 128; ++i) {
+ * table7[i] = Math.sin((i + 0.5) / 128 * (Math.PI / 2));
+ * }
+ *
+ */
+ private static final float table7[] = {
+ 0.00613590004f, 0.0184067003f, 0.0306748003f, 0.0429382995f,
+ 0.0551952012f, 0.0674438998f, 0.0796824023f, 0.0919089988f,
+ 0.104121603f, 0.116318598f, 0.128498107f, 0.1406582f,
+ 0.152797207f, 0.164913103f, 0.177004203f, 0.189068705f,
+ 0.201104596f, 0.213110298f, 0.225083902f, 0.237023607f,
+ 0.248927593f, 0.260794103f, 0.272621393f, 0.284407496f,
+ 0.296150893f, 0.307849586f, 0.319501996f, 0.331106305f,
+ 0.342660695f, 0.354163498f, 0.365613014f, 0.377007395f,
+ 0.388345003f, 0.399624199f, 0.410843194f, 0.422000289f,
+ 0.433093786f, 0.444122106f, 0.455083609f, 0.465976506f,
+ 0.47679919f, 0.487550199f, 0.498227686f, 0.50883007f,
+ 0.519356012f, 0.529803574f, 0.540171504f, 0.550458014f,
+ 0.560661614f, 0.570780694f, 0.580814004f, 0.590759695f,
+ 0.600616515f, 0.610382795f, 0.620057225f, 0.629638195f,
+ 0.639124393f, 0.64851439f, 0.657806695f, 0.666999876f,
+ 0.676092684f, 0.685083687f, 0.693971515f, 0.702754676f,
+ 0.711432219f, 0.720002472f, 0.728464425f, 0.736816585f,
+ 0.745057821f, 0.753186822f, 0.761202395f, 0.769103289f,
+ 0.77688849f, 0.784556627f, 0.792106628f, 0.799537301f,
+ 0.806847572f, 0.81403631f, 0.8211025f, 0.828045011f,
+ 0.834862888f, 0.841554999f, 0.848120272f, 0.854557991f,
+ 0.860866904f, 0.867046177f, 0.873094976f, 0.879012227f,
+ 0.884797096f, 0.890448689f, 0.895966172f, 0.901348829f,
+ 0.906595707f, 0.911705971f, 0.916679084f, 0.921513975f,
+ 0.926210225f, 0.930767f, 0.935183525f, 0.939459205f,
+ 0.943593502f, 0.947585583f, 0.95143503f, 0.955141187f,
+ 0.958703518f, 0.962121427f, 0.965394378f, 0.968522072f,
+ 0.971503913f, 0.974339426f, 0.977028072f, 0.979569793f,
+ 0.981963873f, 0.984210074f, 0.986308098f, 0.988257587f,
+ 0.990058184f, 0.991709828f, 0.993211925f, 0.994564593f,
+ 0.995767415f, 0.996820271f, 0.997723103f, 0.998475611f,
+ 0.999077678f, 0.999529421f, 0.999830604f, 0.999981225f
+ };
+
+ private static final short table9[] = {
+ 32767, 30840, 29127, 27594, 26214, 24966, 23831, 22795,
+ 21845, 20972, 20165, 19418, 18725, 18079, 17476, 16913,
+ 16384, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0
+ };
+
+ /**
+ * Lookup table.
+ *
+ * for (int i = 0; i <= 128; ++i) {
+ * table10[i] = Math.sin((i / 128.0) * (Math.PI / 2));
+ * }
+ *
+ */
+ private static final float table10[] = {
+ 0.0f, 0.0122715384f, 0.024541229f, 0.0368072242f,
+ 0.0490676723f, 0.061320737f, 0.0735645667f, 0.0857973099f,
+ 0.0980171412f, 0.110222213f, 0.122410677f, 0.134580716f,
+ 0.146730468f, 0.158858135f, 0.170961887f, 0.183039889f,
+ 0.195090324f, 0.207111374f, 0.219101235f, 0.231058106f,
+ 0.242980182f, 0.254865646f, 0.266712755f, 0.27851969f,
+ 0.290284693f, 0.302005947f, 0.313681751f, 0.32531029f,
+ 0.336889863f, 0.348418683f, 0.359895051f, 0.371317178f,
+ 0.382683426f, 0.393992037f, 0.405241311f, 0.416429549f,
+ 0.427555084f, 0.438616246f, 0.449611336f, 0.460538715f,
+ 0.471396744f, 0.482183784f, 0.492898196f, 0.50353837f,
+ 0.514102757f, 0.524589658f, 0.534997642f, 0.545324981f,
+ 0.555570245f, 0.565731823f, 0.575808167f, 0.585797846f,
+ 0.59569931f, 0.605511069f, 0.615231574f, 0.624859512f,
+ 0.634393275f, 0.643831551f, 0.653172851f, 0.662415802f,
+ 0.671558976f, 0.680601001f, 0.689540565f, 0.698376238f,
+ 0.707106769f, 0.715730846f, 0.724247098f, 0.732654274f,
+ 0.740951121f, 0.749136388f, 0.757208824f, 0.765167296f,
+ 0.773010433f, 0.780737221f, 0.78834641f, 0.795836926f,
+ 0.803207517f, 0.81045723f, 0.817584813f, 0.824589312f,
+ 0.831469595f, 0.838224709f, 0.84485358f, 0.851355195f,
+ 0.857728601f, 0.863972843f, 0.870086968f, 0.876070082f,
+ 0.881921232f, 0.887639642f, 0.893224299f, 0.898674488f,
+ 0.903989315f, 0.909168005f, 0.914209783f, 0.919113874f,
+ 0.923879504f, 0.928506076f, 0.932992816f, 0.937339008f,
+ 0.941544056f, 0.945607305f, 0.949528158f, 0.953306019f,
+ 0.956940353f, 0.960430503f, 0.963776052f, 0.966976464f,
+ 0.970031261f, 0.972939968f, 0.975702107f, 0.97831738f,
+ 0.980785251f, 0.983105481f, 0.985277653f, 0.987301409f,
+ 0.989176512f, 0.990902662f, 0.992479503f, 0.993906975f,
+ 0.99518472f, 0.996312618f, 0.997290432f, 0.998118103f,
+ 0.99879545f, 0.999322355f, 0.999698818f, 0.999924719f,
+ 1.0f
+ };
+}
+
+
diff --git a/trunk/nbproject/project.xml b/trunk/nbproject/project.xml
index 21528e0a9..cec0ec384 100644
--- a/trunk/nbproject/project.xml
+++ b/trunk/nbproject/project.xml
@@ -156,7 +156,7 @@
src
- lib/LZMA.jar;lib/jna-3.5.1.jar;lib/jpproxy.jar;lib/jsyntaxpane-0.9.5.jar;lib/trident-6.2.jar;lib/substance-flamingo-6.2.jar;lib/flamingo-6.2.jar;lib/substance-6.2.jar;lib/jl1.0.1.jar
+ lib/LZMA.jar;lib/jna-3.5.1.jar;lib/jpproxy.jar;lib/jsyntaxpane-0.9.5.jar;lib/trident-6.2.jar;lib/substance-flamingo-6.2.jar;lib/flamingo-6.2.jar;lib/substance-6.2.jar;lib/jl1.0.1.jar;lib/nellymoser.jar
build
javadoc
reports
diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java
index 40500fa53..76b8f044b 100644
--- a/trunk/src/com/jpexs/decompiler/flash/SWF.java
+++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java
@@ -54,6 +54,13 @@ import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.ecma.Null;
import com.jpexs.decompiler.flash.exporters.ExportRectangle;
import com.jpexs.decompiler.flash.exporters.Matrix;
+import com.jpexs.decompiler.flash.exporters.modes.BinaryDataExportMode;
+import com.jpexs.decompiler.flash.exporters.modes.ImageExportMode;
+import com.jpexs.decompiler.flash.exporters.modes.MovieExportMode;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
+import com.jpexs.decompiler.flash.exporters.modes.ShapeExportMode;
+import com.jpexs.decompiler.flash.exporters.modes.SoundExportMode;
+import com.jpexs.decompiler.flash.exporters.modes.TextExportMode;
import com.jpexs.decompiler.flash.flv.AUDIODATA;
import com.jpexs.decompiler.flash.flv.FLVOutputStream;
import com.jpexs.decompiler.flash.flv.FLVTAG;
@@ -110,10 +117,9 @@ import com.jpexs.decompiler.flash.types.MATRIX;
import com.jpexs.decompiler.flash.types.RECT;
import com.jpexs.decompiler.flash.types.filters.BlendComposite;
import com.jpexs.decompiler.flash.types.filters.FILTER;
-import com.jpexs.decompiler.flash.types.sound.AdpcmDecoder;
+import com.jpexs.decompiler.flash.types.sound.SoundFormat;
import com.jpexs.decompiler.flash.xfl.FLAVersion;
import com.jpexs.decompiler.flash.xfl.XFLConverter;
-import com.jpexs.decompiler.graph.ExportMode;
import com.jpexs.decompiler.graph.Graph;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphSourceItemContainer;
@@ -773,7 +779,7 @@ public final class SWF implements TreeItem, Timelined {
return true;
}
- public boolean exportAS3Class(String className, String outdir, ExportMode exportMode, boolean parallel) throws Exception {
+ public boolean exportAS3Class(String className, String outdir, ScriptExportMode exportMode, boolean parallel) throws Exception {
List abcTags = new ArrayList<>();
for (Tag t : tags) {
@@ -840,7 +846,7 @@ public final class SWF implements TreeItem, Timelined {
ScriptPack pack;
String directory;
List abcList;
- ExportMode exportMode;
+ ScriptExportMode exportMode;
ClassPath path;
AtomicInteger index;
int count;
@@ -849,7 +855,7 @@ public final class SWF implements TreeItem, Timelined {
long startTime;
long stopTime;
- public ExportPackTask(AbortRetryIgnoreHandler handler, AtomicInteger index, int count, ClassPath path, ScriptPack pack, String directory, List abcList, ExportMode exportMode, boolean parallel) {
+ public ExportPackTask(AbortRetryIgnoreHandler handler, AtomicInteger index, int count, ClassPath path, ScriptPack pack, String directory, List abcList, ScriptExportMode exportMode, boolean parallel) {
this.pack = pack;
this.directory = directory;
this.abcList = abcList;
@@ -885,7 +891,7 @@ public final class SWF implements TreeItem, Timelined {
}
}
- public List exportActionScript2(AbortRetryIgnoreHandler handler, String outdir, ExportMode exportMode, boolean parallel, EventListener evl) throws IOException {
+ public List exportActionScript2(AbortRetryIgnoreHandler handler, String outdir, ScriptExportMode exportMode, boolean parallel, EventListener evl) throws IOException {
List ret = new ArrayList<>();
List list2 = new ArrayList<>();
list2.addAll(tags);
@@ -900,7 +906,7 @@ public final class SWF implements TreeItem, Timelined {
return ret;
}
- public List exportActionScript3(final AbortRetryIgnoreHandler handler, final String outdir, final ExportMode exportMode, final boolean parallel) {
+ public List exportActionScript3(final AbortRetryIgnoreHandler handler, final String outdir, final ScriptExportMode exportMode, final boolean parallel) {
final AtomicInteger cnt = new AtomicInteger(1);
final List abcTags = new ArrayList<>();
for (Tag t : tags) {
@@ -962,7 +968,7 @@ public final class SWF implements TreeItem, Timelined {
return ret;
}
- public List exportActionScript(AbortRetryIgnoreHandler handler, String outdir, ExportMode exportMode, boolean parallel) throws Exception {
+ public List exportActionScript(AbortRetryIgnoreHandler handler, String outdir, ScriptExportMode exportMode, boolean parallel) throws Exception {
boolean asV3Found = false;
List ret = new ArrayList<>();
final EventListener evl = new EventListener() {
@@ -1197,33 +1203,35 @@ public final class SWF implements TreeItem, Timelined {
}
}
- public void exportMovies(AbortRetryIgnoreHandler handler, String outdir) throws IOException {
- exportMovies(handler, outdir, tags);
+ public void exportMovies(AbortRetryIgnoreHandler handler, String outdir, MovieExportMode mode) throws IOException {
+ exportMovies(handler, outdir, tags, mode);
}
- public void exportSounds(AbortRetryIgnoreHandler handler, String outdir, boolean mp3, boolean wave) throws IOException {
- exportSounds(handler, outdir, tags, mp3, wave);
+ public void exportSounds(AbortRetryIgnoreHandler handler, String outdir, SoundExportMode mode) throws IOException {
+ exportSounds(handler, outdir, tags, mode);
}
- public byte[] exportSound(Tag t) throws IOException {
- boolean mp3 = true;
- boolean wave = true;
- try (ByteArrayOutputStream fos = new ByteArrayOutputStream()) {
- if (t instanceof SoundTag) {
- SoundTag st = (SoundTag) t;
- if ((st.getSoundFormat() == DefineSoundTag.FORMAT_UNCOMPRESSED_LITTLE_ENDIAN || st.getSoundFormat() == DefineSoundTag.FORMAT_UNCOMPRESSED_NATIVE_ENDIAN) && wave) {
- //Does endiannes matter here?
- createWavFromPcmData(fos, st.getSoundRate(), st.getSoundSize(), st.getSoundType(), st.getRawSoundData());
- } else if ((st.getSoundFormat() == DefineSoundTag.FORMAT_ADPCM) && wave) {
- createWavFromAdpcm(fos, st.getSoundRate(), st.getSoundSize(), st.getSoundType(), st.getRawSoundData());
- } else if ((st.getSoundFormat() == DefineSoundTag.FORMAT_MP3) && mp3) {
- fos.write(st.getRawSoundData());
- } else if(st instanceof DefineSoundTag) {
+ public byte[] exportSound(SoundTag t, SoundExportMode mode) throws IOException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ exportSound(baos, t, mode);
+ return baos.toByteArray();
+ }
+
+ public void exportSound(OutputStream fos, SoundTag t, SoundExportMode mode) throws IOException {
+ if (t instanceof SoundTag) {
+ SoundTag st = (SoundTag) t;
+ SoundFormat fmt = st.getSoundFormat();
+ int nativeFormat = fmt.getNativeExportFormat();
+
+ if (nativeFormat == SoundFormat.EXPORT_MP3 && mode.hasMP3()) {
+ fos.write(st.getRawSoundData());
+ } else if ((nativeFormat == SoundFormat.EXPORT_FLV && mode.hasFlv()) || mode == SoundExportMode.FLV) {
+ if (st instanceof DefineSoundTag) {
FLVOutputStream flv = new FLVOutputStream(fos);
flv.writeHeader(true, false);
- flv.writeTag(new FLVTAG(0, new AUDIODATA(st.getSoundFormat(), st.getSoundRate(), st.getSoundSize(), st.getSoundType(), st.getRawSoundData())));
+ flv.writeTag(new FLVTAG(0, new AUDIODATA(st.getSoundFormatId(), st.getSoundRate(), st.getSoundSize(), st.getSoundType(), st.getRawSoundData())));
} else if (st instanceof SoundStreamHeadTypeTag) {
- SoundStreamHeadTypeTag sh=(SoundStreamHeadTypeTag)st;
+ SoundStreamHeadTypeTag sh = (SoundStreamHeadTypeTag) st;
FLVOutputStream flv = new FLVOutputStream(fos);
flv.writeHeader(true, false);
List blocks = sh.getBlocks();
@@ -1231,14 +1239,15 @@ public final class SWF implements TreeItem, Timelined {
int ms = (int) (1000.0f / ((float) frameRate));
for (int b = 0; b < blocks.size(); b++) {
byte[] data = blocks.get(b).getData();
- if (st.getSoundFormat() == 2) { //MP3
+ if (st.getSoundFormatId() == 2) { //MP3
data = Arrays.copyOfRange(data, 4, data.length);
}
- flv.writeTag(new FLVTAG(ms * b, new AUDIODATA(st.getSoundFormat(), st.getSoundRate(), st.getSoundSize(), st.getSoundType(), data)));
+ flv.writeTag(new FLVTAG(ms * b, new AUDIODATA(st.getSoundFormatId(), st.getSoundRate(), st.getSoundSize(), st.getSoundType(), data)));
}
}
- }
- return fos.toByteArray();
+ } else {
+ fmt.createWav(new ByteArrayInputStream(st.getRawSoundData()), fos);
+ }
}
}
@@ -1249,14 +1258,14 @@ public final class SWF implements TreeItem, Timelined {
}
}
- private static void createWavFromPcmData(OutputStream fos, int soundRate, boolean soundSize, boolean soundType, byte[] data) throws IOException {
+ public static void createWavFromPcmData(OutputStream fos, int soundRateHz, boolean soundSize, boolean soundType, byte[] data) throws IOException {
ByteArrayOutputStream subChunk1Data = new ByteArrayOutputStream();
int audioFormat = 1; //PCM
writeLE(subChunk1Data, audioFormat, 2);
int numChannels = soundType ? 2 : 1;
writeLE(subChunk1Data, numChannels, 2);
int[] rateMap = {5512, 11025, 22050, 44100};
- int sampleRate = rateMap[soundRate];
+ int sampleRate = soundRateHz;//rateMap[soundRate];
writeLE(subChunk1Data, sampleRate, 4);
int bitsPerSample = soundSize ? 16 : 8;
int byteRate = sampleRate * numChannels * bitsPerSample / 8;
@@ -1282,11 +1291,14 @@ public final class SWF implements TreeItem, Timelined {
fos.write(chunkBytes);
}
- private static void createWavFromAdpcm(OutputStream fos, int soundRate, boolean soundSize, boolean soundType, byte[] data) throws IOException {
- createWavFromPcmData(fos, soundRate, soundSize, soundType, AdpcmDecoder.decode(data, soundType));
- }
-
- public List exportSounds(AbortRetryIgnoreHandler handler, String outdir, List tags, boolean mp3, boolean wave) throws IOException {
+ /*private static void createWavFromAdpcm(OutputStream fos, int soundRateHz, boolean soundSize, boolean soundType, byte[] data) throws IOException {
+ createWavFromPcmData(fos, soundRateHz, soundSize, soundType, AdpcmDecoder.decode(data, soundType));
+ }
+
+ private static void createWavFromNelly(OutputStream fos, int soundRateHz,byte[] data) throws IOException {
+ createWavFromPcmData(fos, soundRateHz, true, false, NellyMoserDecoder.decode(data));
+ }*/
+ public List exportSounds(AbortRetryIgnoreHandler handler, String outdir, List tags, final SoundExportMode mode) throws IOException {
List ret = new ArrayList<>();
if (tags.isEmpty()) {
return ret;
@@ -1305,90 +1317,48 @@ public final class SWF implements TreeItem, Timelined {
if (t instanceof DefineSoundTag) {
id = ((DefineSoundTag) t).soundId;
}
-
- if(t instanceof SoundTag){
- final SoundTag st=(SoundTag)t;
- if (st.getSoundFormat() == DefineSoundTag.FORMAT_UNCOMPRESSED_LITTLE_ENDIAN || st.getSoundFormat() == DefineSoundTag.FORMAT_UNCOMPRESSED_NATIVE_ENDIAN) {
- //Does endiannes matter here?
- final File file = new File(outdir + File.separator + st.getCharacterExportFileName() + ".wav");
- newfile = file;
- new RetryTask(new RunnableIOEx() {
- @Override
- public void run() throws IOException {
- try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
- createWavFromPcmData(os, st.getSoundRate(), st.getSoundSize(), st.getSoundType(), st.getRawSoundData());
- }
- }
- }, handler).run();
- }else if ((st.getSoundFormat() == DefineSoundTag.FORMAT_ADPCM) && wave) {
- final File file = new File(outdir + File.separator + st.getCharacterExportFileName() + ".wav");
- newfile = file;
- new RetryTask(new RunnableIOEx() {
- @Override
- public void run() throws IOException {
- try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
- createWavFromAdpcm(os, st.getSoundRate(), st.getSoundSize(), st.getSoundType(), st.getRawSoundData());
- }
- }
- }, handler).run();
- } else if ((st.getSoundFormat() == DefineSoundTag.FORMAT_MP3) && mp3) {
- final File file = new File(outdir + File.separator + st.getCharacterExportFileName() + ".mp3");
- newfile = file;
- new RetryTask(new RunnableIOEx() {
- @Override
- public void run() throws IOException {
- try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
- os.write(st.getRawSoundData());
- }
- }
- }, handler).run();
- } else if(st instanceof DefineSoundTag){
- final File file = new File(outdir + File.separator + st.getCharacterExportFileName() + ".flv");
- newfile = file;
- new RetryTask(new RunnableIOEx() {
- @Override
- public void run() throws IOException {
- FileOutputStream fos = new FileOutputStream(file);
- try (FLVOutputStream flv = new FLVOutputStream(fos)) {
- flv.writeHeader(true, false);
- flv.writeTag(new FLVTAG(0, new AUDIODATA(st.getSoundFormat(), st.getSoundRate(), st.getSoundSize(), st.getSoundType(), st.getRawSoundData())));
- }
- }
- }, handler).run();
- } else if(st instanceof SoundStreamHeadTypeTag){
- final File file = new File(outdir + File.separator + id + ".flv");
- newfile = file;
- SoundStreamHeadTypeTag sh=(SoundStreamHeadTypeTag)st;
- final List blocks=sh.getBlocks();
- new RetryTask(new RunnableIOEx() {
- @Override
- public void run() throws IOException {
- try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
- FLVOutputStream flv = new FLVOutputStream(os);
- flv.writeHeader(true, false);
- int ms = (int) (1000.0f / ((float) frameRate));
- for (int b = 0; b < blocks.size(); b++) {
- byte data[] = blocks.get(b).getData();
- if (st.getSoundFormat() == 2) { //MP3
- data = Arrays.copyOfRange(data, 4, data.length);
- }
- flv.writeTag(new FLVTAG(ms * b, new AUDIODATA(st.getSoundFormat(), st.getSoundRate(), st.getSoundSize(), st.getSoundType(), data)));
- }
- }
+ if (t instanceof SoundTag) {
+ final SoundTag st = (SoundTag) t;
+
+ String ext = "wav";
+ SoundFormat fmt = st.getSoundFormat();
+ switch (fmt.getNativeExportFormat()) {
+ case SoundFormat.EXPORT_MP3:
+ if (mode.hasMP3()) {
+ ext = "mp3";
}
- }, handler).run();
+ break;
+ case SoundFormat.EXPORT_FLV:
+ if (mode.hasFlv()) {
+ ext = "flv";
+ }
+ break;
}
- }
-
- if (newfile != null) {
+ if (mode == SoundExportMode.FLV) {
+ ext = "flv";
+ }
+
+ final File file = new File(outdir + File.separator + st.getCharacterExportFileName() + "." + ext);
+ newfile = file;
+ new RetryTask(new RunnableIOEx() {
+ @Override
+ public void run() throws IOException {
+ try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
+ exportSound(os, st, mode);
+ }
+ }
+ }, handler).run();
+
ret.add(newfile);
+
}
+
}
return ret;
}
- public byte[] exportMovie(DefineVideoStreamTag videoStream) throws IOException {
+ public byte[] exportMovie(DefineVideoStreamTag videoStream, MovieExportMode mode) throws IOException {
HashMap frames = new HashMap<>();
populateVideoFrames(videoStream.characterID, this.tags, frames);
if (frames.isEmpty()) {
@@ -1479,7 +1449,7 @@ public final class SWF implements TreeItem, Timelined {
return fos.toByteArray();
}
- public List exportMovies(AbortRetryIgnoreHandler handler, String outdir, List tags) throws IOException {
+ public List exportMovies(AbortRetryIgnoreHandler handler, String outdir, List tags, final MovieExportMode mode) throws IOException {
List ret = new ArrayList<>();
if (tags.isEmpty()) {
return ret;
@@ -1500,7 +1470,7 @@ public final class SWF implements TreeItem, Timelined {
@Override
public void run() throws IOException {
try (FileOutputStream fos = new FileOutputStream(file)) {
- fos.write(exportMovie(videoStream));
+ fos.write(exportMovie(videoStream, mode));
}
}
}, handler).run();
@@ -1510,7 +1480,7 @@ public final class SWF implements TreeItem, Timelined {
return ret;
}
- public List exportTexts(AbortRetryIgnoreHandler handler, String outdir, List tags, final boolean formatted) throws IOException {
+ public List exportTexts(AbortRetryIgnoreHandler handler, String outdir, List tags, final TextExportMode mode) throws IOException {
List ret = new ArrayList<>();
if (tags.isEmpty()) {
return ret;
@@ -1530,7 +1500,7 @@ public final class SWF implements TreeItem, Timelined {
@Override
public void run() throws IOException {
try (FileOutputStream fos = new FileOutputStream(file)) {
- if (formatted) {
+ if (mode == TextExportMode.FORMATTED) {
fos.write(Utf8Helper.getBytes(((TextTag) t).getFormattedText()));
} else {
fos.write(Utf8Helper.getBytes(((TextTag) t).getText()));
@@ -1544,11 +1514,11 @@ public final class SWF implements TreeItem, Timelined {
return ret;
}
- public void exportTexts(AbortRetryIgnoreHandler handler, String outdir, boolean formatted) throws IOException {
- exportTexts(handler, outdir, tags, formatted);
+ public void exportTexts(AbortRetryIgnoreHandler handler, String outdir, TextExportMode mode) throws IOException {
+ exportTexts(handler, outdir, tags, mode);
}
- public static List exportShapes(AbortRetryIgnoreHandler handler, String outdir, List tags) throws IOException {
+ public static List exportShapes(AbortRetryIgnoreHandler handler, String outdir, List tags, ShapeExportMode mode) throws IOException {
List ret = new ArrayList<>();
if (tags.isEmpty()) {
return ret;
@@ -1583,7 +1553,7 @@ public final class SWF implements TreeItem, Timelined {
return ret;
}
- public static List exportBinaryData(AbortRetryIgnoreHandler handler, String outdir, List tags) throws IOException {
+ public static List exportBinaryData(AbortRetryIgnoreHandler handler, String outdir, List tags, BinaryDataExportMode mode) throws IOException {
List ret = new ArrayList<>();
if (tags.isEmpty()) {
return ret;
@@ -1615,7 +1585,7 @@ public final class SWF implements TreeItem, Timelined {
return ret;
}
- public List exportImages(AbortRetryIgnoreHandler handler, String outdir, List tags) throws IOException {
+ public List exportImages(AbortRetryIgnoreHandler handler, String outdir, List tags, final ImageExportMode mode) throws IOException {
List ret = new ArrayList<>();
if (tags.isEmpty()) {
return ret;
@@ -1630,12 +1600,23 @@ public final class SWF implements TreeItem, Timelined {
}
for (final Tag t : tags) {
if (t instanceof ImageTag) {
- final File file = new File(outdir + File.separator + ((ImageTag) t).getCharacterId() + "." + ((ImageTag) t).getImageFormat());
+
+ String fileFormat = ((ImageTag) t).getImageFormat().toUpperCase(Locale.ENGLISH);
+ if (mode == ImageExportMode.PNG) {
+ fileFormat = "png";
+ }
+ if (mode == ImageExportMode.JPEG) {
+ fileFormat = "jpg";
+ }
+
+ final File file = new File(outdir + File.separator + ((ImageTag) t).getCharacterId() + "." + fileFormat);
final List ttags = this.tags;
+ final String ffileFormat = fileFormat;
new RetryTask(new RunnableIOEx() {
@Override
public void run() throws IOException {
- ImageIO.write(((ImageTag) t).getImage().getBufferedImage(), ((ImageTag) t).getImageFormat().toUpperCase(Locale.ENGLISH), file);
+
+ ImageIO.write(((ImageTag) t).getImage().getBufferedImage(), ffileFormat.toUpperCase(Locale.ENGLISH), file);
}
}, handler).run();
ret.add(file);
@@ -1644,16 +1625,16 @@ public final class SWF implements TreeItem, Timelined {
return ret;
}
- public void exportImages(AbortRetryIgnoreHandler handler, String outdir) throws IOException {
- exportImages(handler, outdir, tags);
+ public void exportImages(AbortRetryIgnoreHandler handler, String outdir, ImageExportMode mode) throws IOException {
+ exportImages(handler, outdir, tags, mode);
}
- public void exportShapes(AbortRetryIgnoreHandler handler, String outdir) throws IOException {
- exportShapes(handler, outdir, tags);
+ public void exportShapes(AbortRetryIgnoreHandler handler, String outdir, ShapeExportMode mode) throws IOException {
+ exportShapes(handler, outdir, tags, mode);
}
- public void exportBinaryData(AbortRetryIgnoreHandler handler, String outdir) throws IOException {
- exportBinaryData(handler, outdir, tags);
+ public void exportBinaryData(AbortRetryIgnoreHandler handler, String outdir, BinaryDataExportMode mode) throws IOException {
+ exportBinaryData(handler, outdir, tags, mode);
}
private final HashMap deobfuscated = new HashMap<>();
private List> allVariableNames = new ArrayList<>();
@@ -1671,7 +1652,7 @@ public final class SWF implements TreeItem, Timelined {
GraphSourceItem ins = code.get(ip);
if (debugMode) {
- System.err.println("Visit " + ip + ": ofs" + Helper.formatAddress(((Action) ins).getAddress()) + ":" + ((Action) ins).getASMSource(new ArrayList(), new ArrayList(), new ArrayList(), code.version, ExportMode.PCODE) + " stack:" + Helper.stackToString(stack, LocalData.create(new ConstantPool())));
+ System.err.println("Visit " + ip + ": ofs" + Helper.formatAddress(((Action) ins).getAddress()) + ":" + ((Action) ins).getASMSource(new ArrayList(), new ArrayList(), new ArrayList(), code.version, ScriptExportMode.PCODE) + " stack:" + Helper.stackToString(stack, LocalData.create(new ConstantPool())));
}
if (ins.isExit()) {
break;
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java b/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java
index e87801973..8b88543bb 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java
@@ -22,12 +22,12 @@ import com.jpexs.decompiler.flash.abc.types.Multiname;
import com.jpexs.decompiler.flash.abc.types.Namespace;
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
import com.jpexs.decompiler.flash.configuration.Configuration;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.FileTextWriter;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.NulWriter;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
import com.jpexs.decompiler.flash.treeitems.TreeElementItem;
-import com.jpexs.decompiler.graph.ExportMode;
import com.jpexs.helpers.CancellableWorker;
import com.jpexs.helpers.Helper;
import java.io.File;
@@ -122,7 +122,7 @@ public class ScriptPack implements TreeElementItem {
return Helper.joinStrings(pathParts, File.separator);
}
- public void convert(final NulWriter writer, final List abcList, final Trait[] traits, final ExportMode exportMode, final boolean parallel) throws InterruptedException {
+ public void convert(final NulWriter writer, final List abcList, final Trait[] traits, final ScriptExportMode exportMode, final boolean parallel) throws InterruptedException {
for (int t : traitIndices) {
Trait trait = traits[t];
Multiname name = trait.getName(abc);
@@ -135,7 +135,7 @@ public class ScriptPack implements TreeElementItem {
}
}
- public void appendTo(GraphTextWriter writer, List abcList, Trait[] traits, ExportMode exportMode, boolean parallel) throws InterruptedException {
+ public void appendTo(GraphTextWriter writer, List abcList, Trait[] traits, ScriptExportMode exportMode, boolean parallel) throws InterruptedException {
for (int t : traitIndices) {
Trait trait = traits[t];
Multiname name = trait.getName(abc);
@@ -148,7 +148,7 @@ public class ScriptPack implements TreeElementItem {
}
}
- public void toSource(GraphTextWriter writer, final List abcList, final Trait[] traits, final ExportMode exportMode, final boolean parallel) throws InterruptedException {
+ public void toSource(GraphTextWriter writer, final List abcList, final Trait[] traits, final ScriptExportMode exportMode, final boolean parallel) throws InterruptedException {
writer.suspendMeasure();
try {
CancellableWorker.call(new Callable() {
@@ -174,7 +174,7 @@ public class ScriptPack implements TreeElementItem {
appendTo(writer, abcList, traits, exportMode, parallel);
}
- public File export(String directory, List abcList, ExportMode exportMode, boolean parallel) throws IOException {
+ public File export(String directory, List abcList, ScriptExportMode exportMode, boolean parallel) throws IOException {
String scriptName = getPathScriptName();
String packageName = getPathPackage();
File outDir = new File(directory + File.separatorChar + makeDirPath(packageName));
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java
index ce4ccc644..5f1e9f9a8 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java
@@ -213,9 +213,9 @@ import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
import com.jpexs.decompiler.flash.abc.types.traits.Traits;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
-import com.jpexs.decompiler.graph.ExportMode;
import com.jpexs.decompiler.graph.Graph;
import com.jpexs.decompiler.graph.GraphPart;
import com.jpexs.decompiler.graph.GraphSourceItem;
@@ -875,11 +875,11 @@ public class AVM2Code implements Serializable {
return writer;
}
- public GraphTextWriter toASMSource(ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, ExportMode exportMode, GraphTextWriter writer) {
+ public GraphTextWriter toASMSource(ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, ScriptExportMode exportMode, GraphTextWriter writer) {
return toASMSource(constants, trait, info, body, new ArrayList(), exportMode, writer);
}
- public GraphTextWriter toASMSource(ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, List outputMap, ExportMode exportMode, GraphTextWriter writer) {
+ public GraphTextWriter toASMSource(ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, List outputMap, ScriptExportMode exportMode, GraphTextWriter writer) {
invalidateCache();
if (trait != null) {
if (trait instanceof TraitFunction) {
@@ -1056,11 +1056,11 @@ public class AVM2Code implements Serializable {
int largeLimit = 20000;
boolean markOffsets = code.size() <= largeLimit;
- if (exportMode == ExportMode.HEX) {
+ if (exportMode == ScriptExportMode.HEX) {
Helper.byteArrayToHexWithHeader(writer, getBytes());
} else {
for (AVM2Instruction ins : code) {
- if (exportMode == ExportMode.PCODEWITHHEX) {
+ if (exportMode == ScriptExportMode.PCODE_HEX) {
writer.appendNoHilight("; ");
writer.appendNoHilight(Helper.bytesToHexString(ins.getBytes()));
writer.newLine();
@@ -2248,7 +2248,7 @@ public class AVM2Code implements Serializable {
try {
List outputMap = new ArrayList<>();
HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
- toASMSource(constants, trait, info, body, outputMap, ExportMode.PCODE, writer);
+ toASMSource(constants, trait, info, body, outputMap, ScriptExportMode.PCODE, writer);
String src = writer.toString();
AVM2Code acode = ASM3Parser.parse(new StringReader(src), constants, null, body, info);
@@ -2290,7 +2290,7 @@ public class AVM2Code implements Serializable {
try {
List outputMap = new ArrayList<>();
HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
- toASMSource(constants, trait, info, body, outputMap, ExportMode.PCODE, writer);
+ toASMSource(constants, trait, info, body, outputMap, ScriptExportMode.PCODE, writer);
String src = writer.toString();
AVM2Code acode = ASM3Parser.parse(new StringReader(src), constants, trait, body, info);
for (int i = 0; i < acode.code.size(); i++) {
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java
index 132057498..54ee5d3c7 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java
@@ -21,9 +21,9 @@ import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.NulWriter;
-import com.jpexs.decompiler.graph.ExportMode;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.model.LocalData;
import java.util.List;
@@ -70,9 +70,9 @@ public class NewFunctionAVM2Item extends AVM2Item {
writer.append("{").newLine();
if (body != null) {
if (writer instanceof NulWriter) {
- body.convert(path + "/inner", ExportMode.SOURCE, isStatic, scriptIndex, classIndex, abc, null, constants, methodInfo, new Stack()/*scopeStack*/, false, writer, fullyQualifiedNames, null, false);
+ body.convert(path + "/inner", ScriptExportMode.AS, isStatic, scriptIndex, classIndex, abc, null, constants, methodInfo, new Stack()/*scopeStack*/, false, writer, fullyQualifiedNames, null, false);
} else {
- body.toString(path + "/inner", ExportMode.SOURCE, isStatic, scriptIndex, classIndex, abc, null, constants, methodInfo, new Stack()/*scopeStack*/, false, writer, fullyQualifiedNames, null);
+ body.toString(path + "/inner", ScriptExportMode.AS, isStatic, scriptIndex, classIndex, abc, null, constants, methodInfo, new Stack()/*scopeStack*/, false, writer, fullyQualifiedNames, null);
}
}
writer.append("}");
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java
index 888e42801..e3dde0dc1 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java
@@ -24,8 +24,8 @@ import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
import com.jpexs.decompiler.flash.abc.types.traits.Traits;
import com.jpexs.decompiler.flash.configuration.Configuration;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
-import com.jpexs.decompiler.graph.ExportMode;
import com.jpexs.decompiler.graph.Graph;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.model.LocalData;
@@ -114,11 +114,11 @@ public class MethodBody implements Cloneable, Serializable {
return ret;
}
- public void convert(final String path, ExportMode exportMode, final boolean isStatic, final int scriptIndex, final int classIndex, final ABC abc, final Trait trait, final ConstantPool constants, final MethodInfo[] method_info, final Stack scopeStack, final boolean isStaticInitializer, final GraphTextWriter writer, final List fullyQualifiedNames, final Traits initTraits, boolean firstLevel) throws InterruptedException {
+ public void convert(final String path, ScriptExportMode exportMode, final boolean isStatic, final int scriptIndex, final int classIndex, final ABC abc, final Trait trait, final ConstantPool constants, final MethodInfo[] method_info, final Stack scopeStack, final boolean isStaticInitializer, final GraphTextWriter writer, final List fullyQualifiedNames, final Traits initTraits, boolean firstLevel) throws InterruptedException {
if (debugMode) {
System.err.println("Decompiling " + path);
}
- if (exportMode != ExportMode.SOURCE) {
+ if (exportMode != ScriptExportMode.AS) {
code.toASMSource(constants, trait, method_info[this.method_info], this, exportMode, writer);
} else {
if (!Configuration.decompile.get()) {
@@ -154,8 +154,8 @@ public class MethodBody implements Cloneable, Serializable {
}
}
- public GraphTextWriter toString(final String path, ExportMode exportMode, final boolean isStatic, final int scriptIndex, final int classIndex, final ABC abc, final Trait trait, final ConstantPool constants, final MethodInfo[] method_info, final Stack scopeStack, final boolean isStaticInitializer, final GraphTextWriter writer, final List fullyQualifiedNames, final Traits initTraits) throws InterruptedException {
- if (exportMode != ExportMode.SOURCE) {
+ public GraphTextWriter toString(final String path, ScriptExportMode exportMode, final boolean isStatic, final int scriptIndex, final int classIndex, final ABC abc, final Trait trait, final ConstantPool constants, final MethodInfo[] method_info, final Stack scopeStack, final boolean isStaticInitializer, final GraphTextWriter writer, final List fullyQualifiedNames, final Traits initTraits) throws InterruptedException {
+ if (exportMode != ScriptExportMode.AS) {
writer.indent();
code.toASMSource(constants, trait, method_info[this.method_info], this, exportMode, writer);
writer.unindent();
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java
index 82451a15f..97dc9f3e8 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java
@@ -19,10 +19,10 @@ package com.jpexs.decompiler.flash.abc.types.traits;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.types.Multiname;
import com.jpexs.decompiler.flash.abc.types.Namespace;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.NulWriter;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
-import com.jpexs.decompiler.graph.ExportMode;
import com.jpexs.helpers.Helper;
import java.io.Serializable;
import java.util.ArrayList;
@@ -115,15 +115,15 @@ public abstract class Trait implements Serializable {
return abc.constants.getMultiname(name_index).toString(abc.constants, fullyQualifiedNames) + " kind=" + kindType + " metadata=" + Helper.intArrToString(metadata);
}
- public GraphTextWriter toString(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
+ public GraphTextWriter toString(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
writer.appendNoHilight(abc.constants.getMultiname(name_index).toString(abc.constants, fullyQualifiedNames) + " kind=" + kindType + " metadata=" + Helper.intArrToString(metadata));
return writer;
}
- public void convert(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
+ public void convert(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
}
- public GraphTextWriter toStringPackaged(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
+ public GraphTextWriter toStringPackaged(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
Namespace ns = abc.constants.getMultiname(name_index).getNamespace(abc.constants);
if ((ns.kind == Namespace.KIND_PACKAGE) || (ns.kind == Namespace.KIND_PACKAGE_INTERNAL)) {
String nsname = ns.getName(abc.constants);
@@ -138,7 +138,7 @@ public abstract class Trait implements Serializable {
return writer;
}
- public void convertPackaged(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
+ public void convertPackaged(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
Namespace ns = abc.constants.getMultiname(name_index).getNamespace(abc.constants);
if ((ns.kind == Namespace.KIND_PACKAGE) || (ns.kind == Namespace.KIND_PACKAGE_INTERNAL)) {
String nsname = ns.getName(abc.constants);
@@ -146,12 +146,12 @@ public abstract class Trait implements Serializable {
}
}
- public GraphTextWriter toStringHeader(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
+ public GraphTextWriter toStringHeader(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
toString(parent, path, abcTags, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel);
return writer;
}
- public void convertHeader(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
+ public void convertHeader(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
convert(parent, path, abcTags, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel);
}
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java
index fd00532d8..874396f7b 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java
@@ -31,10 +31,10 @@ import com.jpexs.decompiler.flash.abc.types.Multiname;
import com.jpexs.decompiler.flash.abc.types.Namespace;
import com.jpexs.decompiler.flash.abc.types.NamespaceSet;
import com.jpexs.decompiler.flash.abc.types.ScriptInfo;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.NulWriter;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
-import com.jpexs.decompiler.graph.ExportMode;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.helpers.Helper;
import java.util.ArrayList;
@@ -324,17 +324,17 @@ public class TraitClass extends Trait implements TraitWithSlot {
}
@Override
- public GraphTextWriter toStringHeader(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) {
+ public GraphTextWriter toStringHeader(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) {
String classHeader = abc.instance_info[class_info].getClassHeaderStr(abc, fullyQualifiedNames);
return writer.appendNoHilight(classHeader);
}
@Override
- public void convertHeader(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) {
+ public void convertHeader(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) {
}
@Override
- public GraphTextWriter toString(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
+ public GraphTextWriter toString(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
writer.startClass(class_info);
String packageName = abc.instance_info[class_info].getName(abc.constants).getNamespace(abc.constants).getName(abc.constants);
@@ -496,7 +496,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
}
@Override
- public void convert(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
+ public void convert(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
fullyQualifiedNames = new ArrayList<>();
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java
index 96eab2be9..87d426dce 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java
@@ -18,10 +18,10 @@ package com.jpexs.decompiler.flash.abc.types.traits;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.NulWriter;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
-import com.jpexs.decompiler.graph.ExportMode;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.helpers.Helper;
import java.util.List;
@@ -43,7 +43,7 @@ public class TraitFunction extends Trait implements TraitWithSlot {
}
@Override
- public GraphTextWriter toStringHeader(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) {
+ public GraphTextWriter toStringHeader(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) {
String modifier = getModifiers(abcTags, abc, isStatic) + " ";
MethodBody body = abc.findBody(method_info);
if (body == null) {
@@ -63,11 +63,11 @@ public class TraitFunction extends Trait implements TraitWithSlot {
}
@Override
- public void convertHeader(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) {
+ public void convertHeader(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) {
}
@Override
- public GraphTextWriter toString(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
+ public GraphTextWriter toString(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
toStringHeader(parent, path, abcTags, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel);
if (abc.instance_info[classIndex].isInterface()) {
writer.appendNoHilight(";");
@@ -85,7 +85,7 @@ public class TraitFunction extends Trait implements TraitWithSlot {
}
@Override
- public void convert(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
+ public void convert(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
convertHeader(parent, path, abcTags, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel);
if (!abc.instance_info[classIndex].isInterface()) {
int bodyIndex = abc.findBodyIndex(method_info);
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java
index 26e9e6b7e..200289549 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java
@@ -18,10 +18,10 @@ package com.jpexs.decompiler.flash.abc.types.traits;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.NulWriter;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
-import com.jpexs.decompiler.graph.ExportMode;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.helpers.Helper;
import java.util.List;
@@ -38,11 +38,11 @@ public class TraitMethodGetterSetter extends Trait {
}
@Override
- public void convertHeader(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) {
+ public void convertHeader(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) {
}
@Override
- public GraphTextWriter toStringHeader(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) {
+ public GraphTextWriter toStringHeader(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) {
String modifier = getModifiers(abcTags, abc, isStatic) + " ";
if (modifier.equals(" ")) {
modifier = "";
@@ -71,7 +71,7 @@ public class TraitMethodGetterSetter extends Trait {
}
@Override
- public void convert(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
+ public void convert(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
path = path + "." + getName(abc).getName(abc.constants, fullyQualifiedNames);
convertHeader(parent, path, abcTags, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel);
int bodyIndex = abc.findBodyIndex(method_info);
@@ -83,7 +83,7 @@ public class TraitMethodGetterSetter extends Trait {
}
@Override
- public GraphTextWriter toString(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
+ public GraphTextWriter toString(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
path = path + "." + getName(abc).getName(abc.constants, fullyQualifiedNames);
toStringHeader(parent, path, abcTags, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel);
int bodyIndex = abc.findBodyIndex(method_info);
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitSlotConst.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitSlotConst.java
index 19a1b7fb8..7f4f6e05f 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitSlotConst.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitSlotConst.java
@@ -21,10 +21,10 @@ import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.types.Multiname;
import com.jpexs.decompiler.flash.abc.types.Namespace;
import com.jpexs.decompiler.flash.abc.types.ValueKind;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.NulWriter;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
-import com.jpexs.decompiler.graph.ExportMode;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.model.LocalData;
import com.jpexs.helpers.Helper;
@@ -119,7 +119,7 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
}
@Override
- public GraphTextWriter toString(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
+ public GraphTextWriter toString(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
String modifier = getModifiers(abcTags, abc, isStatic) + " ";
if (modifier.equals(" ")) {
modifier = "";
@@ -149,7 +149,7 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
}
@Override
- public void convert(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
+ public void convert(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
getNameStr(writer, abc, fullyQualifiedNames);
if (assignedValue != null || value_kind != 0) {
getValueStr(parent, writer, abc, fullyQualifiedNames);
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java
index 31fe7bad7..d666c3bda 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java
@@ -18,10 +18,10 @@ package com.jpexs.decompiler.flash.abc.types.traits;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.configuration.Configuration;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.NulWriter;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
-import com.jpexs.decompiler.graph.ExportMode;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
@@ -83,7 +83,7 @@ public class Traits implements Serializable {
List abcTags;
ABC abc;
boolean isStatic;
- ExportMode exportMode;
+ ScriptExportMode exportMode;
int scriptIndex;
int classIndex;
NulWriter writer;
@@ -92,7 +92,7 @@ public class Traits implements Serializable {
boolean parallel;
Trait parent;
- public TraitConvertTask(Trait trait, Trait parent, boolean makePackages, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, int traitIndex, boolean parallel) {
+ public TraitConvertTask(Trait trait, Trait parent, boolean makePackages, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, int traitIndex, boolean parallel) {
this.trait = trait;
this.parent = parent;
this.makePackages = makePackages;
@@ -120,7 +120,7 @@ public class Traits implements Serializable {
}
}
- public GraphTextWriter toString(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, boolean makePackages, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
+ public GraphTextWriter toString(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, boolean makePackages, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
for (int t = 0; t < traits.length; t++) {
writer.newLine();
Trait trait = traits[t];
@@ -149,7 +149,7 @@ public class Traits implements Serializable {
return writer;
}
- public void convert(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ExportMode exportMode, boolean makePackages, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
+ public void convert(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, boolean makePackages, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
if (!parallel || traits.length < 2) {
for (int t = 0; t < traits.length; t++) {
TraitConvertTask task = new TraitConvertTask(traits[t], parent, makePackages, path, abcTags, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, t, parallel);
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/usages/ConstVarMultinameUsage.java b/trunk/src/com/jpexs/decompiler/flash/abc/usages/ConstVarMultinameUsage.java
index b81f6a825..de6ec534c 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/usages/ConstVarMultinameUsage.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/usages/ConstVarMultinameUsage.java
@@ -21,10 +21,10 @@ import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter;
import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
import com.jpexs.decompiler.flash.abc.types.traits.Traits;
import com.jpexs.decompiler.flash.configuration.Configuration;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
import com.jpexs.decompiler.flash.helpers.NulWriter;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
-import com.jpexs.decompiler.graph.ExportMode;
import java.util.ArrayList;
import java.util.List;
@@ -43,23 +43,23 @@ public abstract class ConstVarMultinameUsage extends TraitMultinameUsage {
NulWriter nulWriter = new NulWriter();
if (parentTraitIndex > -1) {
if (isStatic) {
- ((TraitMethodGetterSetter) abc.class_info[classIndex].static_traits.traits[parentTraitIndex]).convertHeader(null, "", abcTags, abc, isStatic, ExportMode.SOURCE, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false);
+ ((TraitMethodGetterSetter) abc.class_info[classIndex].static_traits.traits[parentTraitIndex]).convertHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false);
} else {
- ((TraitMethodGetterSetter) abc.instance_info[classIndex].instance_traits.traits[parentTraitIndex]).convertHeader(null, "", abcTags, abc, isStatic, ExportMode.SOURCE, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false);
+ ((TraitMethodGetterSetter) abc.instance_info[classIndex].instance_traits.traits[parentTraitIndex]).convertHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false);
}
}
- ((TraitSlotConst) traits.traits[traitIndex]).convertHeader(null, "", abcTags, abc, isStatic, ExportMode.SOURCE, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false);
+ ((TraitSlotConst) traits.traits[traitIndex]).convertHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false);
HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
writer.appendNoHilight(super.toString(abcTags, abc) + " ");
if (parentTraitIndex > -1) {
if (isStatic) {
- ((TraitMethodGetterSetter) abc.class_info[classIndex].static_traits.traits[parentTraitIndex]).toStringHeader(null, "", abcTags, abc, isStatic, ExportMode.SOURCE, -1/*FIXME*/, classIndex, writer, new ArrayList(), false);
+ ((TraitMethodGetterSetter) abc.class_info[classIndex].static_traits.traits[parentTraitIndex]).toStringHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList(), false);
} else {
- ((TraitMethodGetterSetter) abc.instance_info[classIndex].instance_traits.traits[parentTraitIndex]).toStringHeader(null, "", abcTags, abc, isStatic, ExportMode.SOURCE, -1/*FIXME*/, classIndex, writer, new ArrayList(), false);
+ ((TraitMethodGetterSetter) abc.instance_info[classIndex].instance_traits.traits[parentTraitIndex]).toStringHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList(), false);
}
}
- ((TraitSlotConst) traits.traits[traitIndex]).toStringHeader(null, "", abcTags, abc, isStatic, ExportMode.SOURCE, -1/*FIXME*/, classIndex, writer, new ArrayList(), false);
+ ((TraitSlotConst) traits.traits[traitIndex]).toStringHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList(), false);
return writer.toString();
}
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/usages/MethodMultinameUsage.java b/trunk/src/com/jpexs/decompiler/flash/abc/usages/MethodMultinameUsage.java
index 4b28ac4c9..ac1f2969b 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/usages/MethodMultinameUsage.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/usages/MethodMultinameUsage.java
@@ -20,10 +20,10 @@ import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter;
import com.jpexs.decompiler.flash.abc.types.traits.Traits;
import com.jpexs.decompiler.flash.configuration.Configuration;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
import com.jpexs.decompiler.flash.helpers.NulWriter;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
-import com.jpexs.decompiler.graph.ExportMode;
import java.util.ArrayList;
import java.util.List;
@@ -50,12 +50,12 @@ public abstract class MethodMultinameUsage extends TraitMultinameUsage {
if (!isInitializer) {
if (parentTraitIndex > -1) {
if (isStatic) {
- ((TraitMethodGetterSetter) abc.class_info[classIndex].static_traits.traits[parentTraitIndex]).convertHeader(null, "", abcTags, abc, isStatic, ExportMode.SOURCE, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false);
+ ((TraitMethodGetterSetter) abc.class_info[classIndex].static_traits.traits[parentTraitIndex]).convertHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false);
} else {
- ((TraitMethodGetterSetter) abc.instance_info[classIndex].instance_traits.traits[parentTraitIndex]).convertHeader(null, "", abcTags, abc, isStatic, ExportMode.SOURCE, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false);
+ ((TraitMethodGetterSetter) abc.instance_info[classIndex].instance_traits.traits[parentTraitIndex]).convertHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false);
}
}
- ((TraitMethodGetterSetter) traits.traits[traitIndex]).convertHeader(null, "", abcTags, abc, isStatic, ExportMode.SOURCE, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false);
+ ((TraitMethodGetterSetter) traits.traits[traitIndex]).convertHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false);
}
HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
@@ -70,13 +70,13 @@ public abstract class MethodMultinameUsage extends TraitMultinameUsage {
} else {
if (parentTraitIndex > -1) {
if (isStatic) {
- ((TraitMethodGetterSetter) abc.class_info[classIndex].static_traits.traits[parentTraitIndex]).toStringHeader(null, "", abcTags, abc, isStatic, ExportMode.SOURCE, -1/*FIXME*/, classIndex, writer, new ArrayList(), false);
+ ((TraitMethodGetterSetter) abc.class_info[classIndex].static_traits.traits[parentTraitIndex]).toStringHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList(), false);
} else {
- ((TraitMethodGetterSetter) abc.instance_info[classIndex].instance_traits.traits[parentTraitIndex]).toStringHeader(null, "", abcTags, abc, isStatic, ExportMode.SOURCE, -1/*FIXME*/, classIndex, writer, new ArrayList(), false);
+ ((TraitMethodGetterSetter) abc.instance_info[classIndex].instance_traits.traits[parentTraitIndex]).toStringHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList(), false);
}
writer.appendNoHilight(" ");
}
- ((TraitMethodGetterSetter) traits.traits[traitIndex]).toStringHeader(null, "", abcTags, abc, isStatic, ExportMode.SOURCE, -1/*FIXME*/, classIndex, writer, new ArrayList(), false);
+ ((TraitMethodGetterSetter) traits.traits[traitIndex]).toStringHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList(), false);
}
return writer.toString();
}
diff --git a/trunk/src/com/jpexs/decompiler/flash/action/Action.java b/trunk/src/com/jpexs/decompiler/flash/action/Action.java
index ffcf160bc..2e9d1b89d 100644
--- a/trunk/src/com/jpexs/decompiler/flash/action/Action.java
+++ b/trunk/src/com/jpexs/decompiler/flash/action/Action.java
@@ -58,12 +58,12 @@ import com.jpexs.decompiler.flash.action.swf5.ActionEquals2;
import com.jpexs.decompiler.flash.action.swf7.ActionDefineFunction2;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.ecma.Null;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
import com.jpexs.decompiler.flash.helpers.NulWriter;
import com.jpexs.decompiler.flash.helpers.collections.MyEntry;
import com.jpexs.decompiler.flash.tags.base.ASMSource;
-import com.jpexs.decompiler.graph.ExportMode;
import com.jpexs.decompiler.graph.Graph;
import com.jpexs.decompiler.graph.GraphSource;
import com.jpexs.decompiler.graph.GraphSourceItem;
@@ -429,7 +429,7 @@ public class Action implements GraphSourceItem {
* @param path
* @return HilightedTextWriter
*/
- public static GraphTextWriter actionsToString(List listeners, long address, List list, List importantOffsets, int version, ExportMode exportMode, GraphTextWriter writer, long swfPos, String path) {
+ public static GraphTextWriter actionsToString(List listeners, long address, List list, List importantOffsets, int version, ScriptExportMode exportMode, GraphTextWriter writer, long swfPos, String path) {
return actionsToString(listeners, address, list, importantOffsets, new ArrayList(), version, exportMode, writer, swfPos, path);
}
@@ -447,7 +447,7 @@ public class Action implements GraphSourceItem {
* @param path
* @return HilightedTextWriter
*/
- private static GraphTextWriter actionsToString(List listeners, long address, List list, List importantOffsets, List constantPool, int version, ExportMode exportMode, GraphTextWriter writer, long swfPos, String path) {
+ private static GraphTextWriter actionsToString(List listeners, long address, List list, List importantOffsets, List constantPool, int version, ScriptExportMode exportMode, GraphTextWriter writer, long swfPos, String path) {
long offset;
if (importantOffsets == null) {
//setActionsAddresses(list, 0, version);
@@ -471,7 +471,7 @@ public class Action implements GraphSourceItem {
a = (Action) s;
}
pos++;
- if (exportMode == ExportMode.PCODEWITHHEX) {
+ if (exportMode == ScriptExportMode.PCODE_HEX) {
if (lastPush) {
writer.newLine();
lastPush = false;
@@ -636,7 +636,7 @@ public class Action implements GraphSourceItem {
* @param exportMode PCode or hex?
* @return String of P-code source
*/
- public String getASMSource(List extends GraphSourceItem> container, List knownAddreses, List constantPool, int version, ExportMode exportMode) {
+ public String getASMSource(List extends GraphSourceItem> container, List knownAddreses, List constantPool, int version, ScriptExportMode exportMode) {
return toString();
}
@@ -1239,7 +1239,7 @@ public class Action implements GraphSourceItem {
String s = null;
try {
HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
- Action.actionsToString(new ArrayList(), address, ret, null, version, ExportMode.PCODE, writer, swfPos, path);
+ Action.actionsToString(new ArrayList(), address, ret, null, version, ScriptExportMode.PCODE, writer, swfPos, path);
s = writer.toString();
ret = ASMParser.parse(address, swfPos, true, s, SWF.DEFAULT_VERSION, false);
} catch (IOException | ParseException ex) {
@@ -1268,7 +1268,7 @@ public class Action implements GraphSourceItem {
}
}
- public GraphTextWriter getASMSourceReplaced(List extends GraphSourceItem> container, List knownAddreses, List constantPool, int version, ExportMode exportMode, GraphTextWriter writer) {
+ public GraphTextWriter getASMSourceReplaced(List extends GraphSourceItem> container, List knownAddreses, List constantPool, int version, ScriptExportMode exportMode, GraphTextWriter writer) {
writer.appendNoHilight(getASMSource(container, knownAddreses, constantPool, version, exportMode));
return writer;
}
diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java
index 093de040d..cd130f6d1 100644
--- a/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java
+++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java
@@ -36,7 +36,7 @@ import com.jpexs.decompiler.flash.action.swf7.ActionDefineFunction2;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.flash.ecma.Null;
-import com.jpexs.decompiler.graph.ExportMode;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.graph.Graph;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphSourceItemContainer;
@@ -746,7 +746,7 @@ public class ActionListReader {
}
if (debugMode) {
- String atos = a.getASMSource(new ArrayList(), new ArrayList(), cpool.constants, version, ExportMode.PCODE);
+ String atos = a.getASMSource(new ArrayList(), new ArrayList(), cpool.constants, version, ScriptExportMode.PCODE);
if (a instanceof GraphSourceItemContainer) {
atos = a.toString();
}
diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java
index c372004ea..8e27591b4 100644
--- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java
+++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java
@@ -27,7 +27,7 @@ import com.jpexs.decompiler.flash.action.model.clauses.IfFrameLoadedActionItem;
import com.jpexs.decompiler.flash.action.parser.ParseException;
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
import com.jpexs.decompiler.flash.action.special.ActionStore;
-import com.jpexs.decompiler.graph.ExportMode;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
import java.io.ByteArrayOutputStream;
@@ -56,7 +56,7 @@ public class ActionWaitForFrame extends Action implements ActionStore {
}
@Override
- public String getASMSource(List extends GraphSourceItem> container, List knownAddreses, List constantPool, int version, ExportMode exportMode) {
+ public String getASMSource(List extends GraphSourceItem> container, List knownAddreses, List constantPool, int version, ScriptExportMode exportMode) {
String ret = "WaitForFrame " + frame + " " + skipCount;
return ret;
}
diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionIf.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionIf.java
index d88ff8631..8c88a5020 100644
--- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionIf.java
+++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionIf.java
@@ -22,7 +22,7 @@ import com.jpexs.decompiler.flash.action.Action;
import com.jpexs.decompiler.flash.action.ActionGraphSource;
import com.jpexs.decompiler.flash.action.parser.ParseException;
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
-import com.jpexs.decompiler.graph.ExportMode;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.graph.GraphSource;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.helpers.Helper;
@@ -82,7 +82,7 @@ public class ActionIf extends Action {
}
@Override
- public String getASMSource(List extends GraphSourceItem> container, List knownAddreses, List constantPool, int version, ExportMode exportMode) {
+ public String getASMSource(List extends GraphSourceItem> container, List knownAddreses, List constantPool, int version, ScriptExportMode exportMode) {
String ofsStr = Helper.formatAddress(getAddress() + getBytes(version).length + offset);
return "If loc" + ofsStr + (!jumpUsed ? " ;compileTimeIgnore" : (!ignoreUsed ? " ;compileTimeJump" : ""));
}
diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionJump.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionJump.java
index 6d36e0ace..5685489e4 100644
--- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionJump.java
+++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionJump.java
@@ -22,7 +22,7 @@ import com.jpexs.decompiler.flash.action.Action;
import com.jpexs.decompiler.flash.action.ActionGraphSource;
import com.jpexs.decompiler.flash.action.parser.ParseException;
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
-import com.jpexs.decompiler.graph.ExportMode;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.graph.GraphSource;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.helpers.Helper;
@@ -82,7 +82,7 @@ public class ActionJump extends Action {
}
@Override
- public String getASMSource(List extends GraphSourceItem> container, List knownAddreses, List constantPool, int version, ExportMode exportMode) {
+ public String getASMSource(List extends GraphSourceItem> container, List knownAddreses, List constantPool, int version, ScriptExportMode exportMode) {
String ofsStr = Helper.formatAddress(getAddress() + getBytes(version).length + offset);
return "Jump loc" + ofsStr;
}
diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java
index 116a59b8b..e9ddec268 100644
--- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java
+++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java
@@ -28,9 +28,9 @@ import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.ecma.Null;
import com.jpexs.decompiler.flash.ecma.Undefined;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
-import com.jpexs.decompiler.graph.ExportMode;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.helpers.Helper;
@@ -229,7 +229,7 @@ public class ActionPush extends Action {
}
@Override
- public GraphTextWriter getASMSourceReplaced(List extends GraphSourceItem> container, List knownAddreses, List constantPool, int version, ExportMode exportMode, GraphTextWriter writer) {
+ public GraphTextWriter getASMSourceReplaced(List extends GraphSourceItem> container, List knownAddreses, List constantPool, int version, ScriptExportMode exportMode, GraphTextWriter writer) {
if (replacement == null || replacement.size() < values.size()) {
return toString(writer);
}
@@ -240,7 +240,7 @@ public class ActionPush extends Action {
return writer;
}
- public GraphTextWriter paramsToStringReplaced(List extends GraphSourceItem> container, List knownAddreses, List constantPool, int version, ExportMode exportMode, GraphTextWriter writer) {
+ public GraphTextWriter paramsToStringReplaced(List extends GraphSourceItem> container, List knownAddreses, List constantPool, int version, ScriptExportMode exportMode, GraphTextWriter writer) {
if (replacement == null || replacement.size() < values.size()) {
return paramsToString(writer);
}
diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionWaitForFrame2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionWaitForFrame2.java
index c1f4b7498..efa9f0ffe 100644
--- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionWaitForFrame2.java
+++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionWaitForFrame2.java
@@ -26,7 +26,7 @@ import com.jpexs.decompiler.flash.action.model.clauses.IfFrameLoadedActionItem;
import com.jpexs.decompiler.flash.action.parser.ParseException;
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
import com.jpexs.decompiler.flash.action.special.ActionStore;
-import com.jpexs.decompiler.graph.ExportMode;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
import java.io.ByteArrayOutputStream;
@@ -116,7 +116,7 @@ public class ActionWaitForFrame2 extends Action implements ActionStore {
}
@Override
- public String getASMSource(List extends GraphSourceItem> container, List knownAddreses, List constantPool, int version, ExportMode exportMode) {
+ public String getASMSource(List extends GraphSourceItem> container, List knownAddreses, List