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 ### Usage
On your terminal, run `python3 SWFChecker.py` to start. 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.
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.

View File

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

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