Compare commits

..

No commits in common. "main" and "Stable" have entirely different histories.
main ... Stable

3 changed files with 40 additions and 119 deletions

View File

@ -9,7 +9,4 @@ It checks for:
### Usage
On your terminal, run `python3 SWFChecker.py` to start.
Make sure that your SWF file is in the same folder as the checker.
If a SWF was made with ActionScript 2 (or 1) and Flash version 8 (or older), it will say it can work with the Wii. If the game's stage resolution (in pixels) is larger than 700x500 pixels, it will warn about possible overlapping/clipping on the Wii.
If a SWF was made with ActionScript 2 (or 1) and Flash version 8 (or older), it will say it can work with the Wii. If the 'game stage' is larger than 700x500 pixels, it will warn about possible overlapping/clipping on the Wii.

View File

@ -1,101 +1,46 @@
from __future__ import print_function
import os
import zlib
from sys import version, exit
import platform
platf = platform.system()
if platf == "Windows":
os.system("title SWF Checker v3.0")
os.system("cls")
else:
os.system("clear")
print(f"SWF Version Checker v3.0\nPython {version}")
print(f"made by idkwh")
import sys
print(f"SWF Version Checker v1.0\nPython {sys.version}")
os.system("title SWF Version Checker v1.0")
try:
swf = input("SWF Filename: ").strip()
except KeyboardInterrupt:
print("\nExiting...")
exit()
def parsetags(data):
pos = 8 # start after signature & header
rect_bits = (data[pos] >> 3) & 0x1F
pos += int((5 + rect_bits * 4 + 7) / 8) # skip RECT
pos += 4 # skip frame rate/count
def CheckSWF(swf):
try:
if not os.path.exists(swf):
print("Error: File not found. Please check the filename and try again.")
return None, None, None
with open(swf, "rb") as f:
obj = f.read()
tags = []
# decompress (CWS, zlib)
if obj[:3] == b"CWS":
print("SWF is compressed (zlib, CWS head), uncompressing...")
obj = b"FWS" + obj[3:8] + zlib.decompress(obj[8:])
while pos + 2 <= len(data):
tag_header = int.from_bytes(data[pos:pos + 2], 'little')
pos += 2
flashver = obj[3]
tag_code = tag_header >> 6
tag_length = tag_header & 0x3F
if tag_length == 0x3F:
if pos + 4 > len(data):
break
tag_length = int.from_bytes(data[pos:pos + 4], 'little')
pos += 4
if pos + tag_length > len(data):
break
tag_data = data[pos:pos + tag_length]
tags.append((tag_code, tag_data))
pos += tag_length
return tags
def CheckSWF(swf_path):
if not os.path.exists(swf_path):
print("File not found. Please check the filename and try again.")
if platf == "Windows":
os.system("pause")
exit()
file_attributes_index = obj.find(b'\x45')
if file_attributes_index != -1:
flag = obj[file_attributes_index + 2]
isas3 = bool(flag & 0x08)
asver = "3 (this game WILL NOT work on the Wii)" if isas3 else "1/2 (this version is compatible with the Wii!)"
else:
os.system("/bin/bash -c 'read -s -n 1 -p \"Press any key to exit.\"'")
exit()
return None, None, None
asver = "Unable to detect ActionScript version, please try again"
with open(swf_path, "rb") as f:
data = f.read()
if data[:3] == b"CWS":
print("SWF is compressed. Decompressing...")
data = b"FWS" + data[3:8] + zlib.decompress(data[8:])
flashver = data[3]
tags = parsetags(data)
has_as3 = False
has_doabc = False
has_doaction = False
for tag_code, tag_data in tags:
if tag_code == 69: # fileattributes
if len(tag_data) >= 1:
flags = tag_data[0]
if flags & 0x08:
has_as3 = True
elif tag_code == 82: # doabc (AS3.0 Only)
has_doabc = True
elif tag_code == 12: # doaction (AS1/2.0)
has_doaction = True
if has_as3 or has_doabc:
is_as3 = True
elif has_doaction:
is_as3 = False
else:
is_as3 = False
asver = "ActionScript 3.0 (incompatible)" if is_as3 else "ActionScript 1.0/2.0 (compatible)"
return flashver, asver, data
return flashver, asver, obj
except KeyboardInterrupt:
print("Exiting...")
exit()
except Exception as e:
print(f"Exception occurred!\n{e}")
exit()
def GetStageWH(obj):
rectS = 8
@ -113,31 +58,25 @@ def GetStageWH(obj):
YMin = ReadBit(bOffset + 2 * nbits, nbits)
YMax = ReadBit(bOffset + 3 * nbits, nbits)
w = round((XMax - XMin) / 20, 2)
w = round((XMax - XMin) / 20, 2)
h = round((YMax - YMin) / 20, 2)
return w, h # w=width, h=height, px
return w, h
flashver, asver, SWFDAT = CheckSWF(swf)
if flashver is not None:
w, h = GetStageWH(SWFDAT)
print(f"SWF Dimensions: {w}x{h} pixels")
if flashver <= 8: # compatible
print(f"Flash version: {flashver}, this SWF is compatible with the Wii.")
elif flashver == 9: # kirby tv notice
print(f"Flash version: {flashver}, this SWF may be compatible if injected inside the Kirby TV Channel")
else: # too new
print(f"Flash version: {flashver}, this SWF is not compatible with the Wii.")
if flashver > 8:
print(f"Flash version: {flashver}, this version may NOT be compatible with the Wii.")
else:
print(f"Flash version: {flashver}, this version is compatible with the Wii.")
print(f"ActionScript version: {asver}")
if w > 700 and h > 500:
print("WARNING: The given SWF might overlap/clip on the Wii.")
else:
print("The SWF shouldn't overlap and/or clip on the Wii.")
if platf == "Windows":
os.system("pause")
exit()
else:
os.system("/bin/bash -c 'read -s -n 1 -p \"Press any key to exit.\"'")
exit()
print("The SWF should NOT overlap and/or clip on the Wii.")

View File

@ -1,15 +0,0 @@
blinker==1.9.0
certifi==2025.8.3
charset-normalizer==3.4.3
click==8.2.1
colorama==0.4.6
dotenv==0.9.9
Flask==3.1.1
idna==3.10
itsdangerous==2.2.0
Jinja2==3.1.6
MarkupSafe==3.0.2
python-dotenv==1.1.1
requests==2.32.4
urllib3==2.5.0
Werkzeug==3.1.3