Connor or router,whoever can create a little program that checks if a game is in AS2 or AS3.
Printable View
Connor or router,whoever can create a little program that checks if a game is in AS2 or AS3.
Could you give me an example of an as2 and as3 game so I can examine the two?
er, flash tells u automatically if its as2 or as3
They're quite big,sorry but I couldn't think of any smaller
And I know,but I don't want to go through all that process I want just with a few clicks :lol:
Good luck,router 8)
o.o fine fine ignore me.
sure.....
I'm not ignoring you. Not to mention I can't install Flash or use flasm here...
Done!
Please respond if you find a bug or have a suggestion.
WARNING: There may be bugs
No warranty is expressed or implied
USE AT YOUR OWN RISK!
See future post for new version
does not detect as3 for me.
It told me that the game was as2
Link To The Game > http://www.freeactionscript.com/downloa ... Engine.swf
It detects the flash version of the file. 10 = as3, <10 = as2
Router... 10 can be as2.
Isn't the minimum required version of flash for as3 10? That's the value that my app is reading.
nope.
as3 was around since even nine
as2 can run from like 7 to 10
you would need a new method.
totally true, I didnt say anything the at first but like killer said .. you can make an as2 flashplayer 10 game..
the player version has nothing to do with as2 or as3 really...
yeah, you could even trick the program by running flash player 7 because it would most likely get the result from YOUR computer?
I think it is not possible to get the AS version without parsing the file.
SWF File Header
There is just the version of Flash saved in which it was created. If the file is compressed you cannot find anything after the header because of the compression. Maybe there could be some more data retrieved if the file was not compressed but i am not sure. It just seems like there is no simple way of getting the AS version.Code:Field Type Comment
Signature UI8 Signature byte:
“F” indicates uncompressed
“C” indicates compressed (SWF 6 and later only)
Signature UI8 Signature byte always “W”
Signature UI8 Signature byte always “S”
Version UI8 Single byte file version (for example, 0x06 for SWF 6)
FileLength UI32 Length of entire file in bytes
FrameSize RECT Frame size in twips
FrameRate UI16 Frame delay in 8.8 fixed number of frames per second
FrameCount UI16 Total number of frames in file
I also looked today for some tools that could do this but i haven't found anything so you will have to check the version the old way. Unless someone else finds or programs such a tool of course.
Compressed flash files are compressed using zLib. I did find a way to determine the ActionScript version, but it might take me some time to implement it.
Done. Not guaranteed to work, but it does detect the right actionscript versions for me. And yes, I did have to parse the swf file.
works fine for now but i think it can be tricked. will look into it.Quote:
Originally Posted by router
I don't think it can be tricked.
Worked fine for me.
Tested on 5 games. Good work man!
it all depends on how u plan on doing it. regardless nice work.
If anyone wants, I'll release the source or dll api.
Give me the source please.. I want to have a looksy :)
Here is the code. Released under CC 3.0 It's in C#:
And the compiled dll:Code:using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using zlib;
namespace asVersion
{
public class Main
{
/// <summary>
/// Returns the actionscript version of a file in the stream
/// </summary>
/// <param name="file">The file stream</param>
/// <returns>The actionscript version</returns>
public static int Get(Stream file)
{
//new binaryreader for the stream
BinaryReader br = new BinaryReader(file);
string sig = GetSignature(ref br);
//zLib compressed starts here
br.BaseStream.Position = 8;
if (sig == "CWS")
{
//decompress file and set as new binarystream
Stream de = decompressFile(file);
br = new BinaryReader(de);
//change signature to uncompressed
sig = "FWS";
}
//set position back to after signature
br.BaseStream.Position = 3;
//flash version number
int version = GetVersion(ref br);
//size of flash file
UInt32 size = GetSize(ref br);
//rect
byte rect_byte = br.ReadByte();
byte rect_bits = (byte)((int)rect_byte >> 3);
byte total_bits = (byte)((int)(rect_bits * 4));
byte rect_bytes = (byte)Math.Ceiling((double)(((int)total_bits - 3) / 8));
//frame rate of swf
ushort frame_rate = br.ReadUInt16();
//number of frames in swf
ushort frame_count = br.ReadUInt16();
while (true)
{
ushort swf_tag_code_len = br.ReadUInt16();
//tage code of current tag
ushort tagcode = (ushort)((int)swf_tag_code_len >> 6);
uint taglen = (uint)(swf_tag_code_len & 0x3F);
if (taglen >= 63)
{
taglen = br.ReadUInt32();
}
//fileattributes tag is 69
if (tagcode == 69)
{
byte b = br.ReadByte();
//length must be specific for as3
if ((b & (1 << 3)) > 0)
{
//as3
return 3;
}
else
{
//as2
return 2;
}
}
if (swf_tag_code_len == 0 && tagcode == 0 && taglen == 0) //end of tags; go home!
break;
}
//major error!
return 0;
}
private static uint GetSize(ref BinaryReader br)
{
return br.ReadUInt32();
}
private static int GetVersion(ref BinaryReader br)
{
return (int)br.ReadByte();
}
private static string GetSignature(ref BinaryReader br)
{
return new string(br.ReadChars(3));
}
/// <summary>
/// Returns the actionscript version of a file from the path
/// </summary>
/// <param name="file">The path to the file</param>
/// <returns>The actionscript version</returns>
public static int Get(string file)
{
return File.Exists(file) ? Get(new StreamReader(file).BaseStream) : 0;
}
/// <summary>
/// Returns the actionscript version from the bytes of the file
/// </summary>
/// <param name="bytes">The bytes of the swf file</param>
/// <returns>The actionscript version</returns>
public static int Get(byte[] bytes)
{
return Get(new MemoryStream(bytes));
}
private static Stream decompressFile(Stream inFile)
{
MemoryStream outFileStream = new MemoryStream();
zlib.ZOutputStream outZStream = new zlib.ZOutputStream(outFileStream);
CopyStream(inFile, outZStream);
return outFileStream;
}
private static void CopyStream(System.IO.Stream input, System.IO.Stream output)
{
byte[] buffer = new byte[2000];
int len;
while ((len = input.Read(buffer, 0, 2000)) > 0)
{
output.Write(buffer, 0, len);
}
output.Flush();
}
}
}
Ah.. I use VB.NET :(
The dll can be used with vb.net. I'm pretty sure the call would be:
Code:asVersion.Get "path to file"
Icic gave me new hope to make my project but im still not sureQuote:
Originally Posted by router
What are you not sure about?
well when i make a program in visualbasics 2008 that loads a flash object or anything it crashes but that does not happen in vb2010 but most people dont have Netframework 4.0 beta 2 to make my program work.Quote:
Originally Posted by router
My dll doesn't load a flash object to work.
yes i know im planing on using it but im making a program that is basically a cheat engine for flashgames
And many things for 4.0 framework are not needed, so you could just switch to 2.0
yes but i would have to downgrade my visual basics to 06 ._.
No, you wouldn't have to. It could still be vb.net 8
nah its interop.dll's fk everything up
oh well ill just look into it
It's not an interop dll. You just add it to your references, and then you can reference it in your code.
ill look into it.
oh um router for your dll what would i have to put down to get the value from your .dll im gonna code it in visual basics since im most fluent in that would i just put asversion.get as you said and have that return me with the value?
Yes, it would
so basically if i wanted to it would be Msgbox(asversion.get "path to file") and when i hit run i get a value?Quote:
Originally Posted by router
It'll return an integer.
3 = AS3
2 = AS2/1
0 = Error
ok would i need to include zlib and ill be sure to credit you and add it tomorrow.