You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

255 lines
13 KiB

Change core system to improve performance and facilitate multi TV info sources. Change migrate core objects TVShow and TVEpisode and everywhere that these objects affect. Add message to logs and disable ui backlog buttons when no media provider has active and/or scheduled searching enabled. Change views for py3 compat. Change set default runtime of 5 mins if none is given for layout Day by Day. Add OpenSubtitles authentication support to config/Subtitles/Subtitles Plugin. Add "Enforce media hash match" to config/Subtitles Plugin/Opensubtitles for accurate subs if enabled, but if disabled, search failures will fallback to use less reliable subtitle results. Add Apprise 0.8.0 (6aa52c3). Add hachoir_py3 3.0a6 (5b9e05a). Add sgmllib3k 1.0.0 Update soupsieve 1.9.1 (24859cc) to soupsieve_py2 1.9.5 (6a38398) Add soupsieve_py3 2.0.0.dev (69194a2). Add Tornado_py3 Web Server 6.0.3 (ff985fe). Add xmlrpclib_to 0.1.1 (c37db9e). Remove ancient Growl lib 0.1 Remove xmltodict library. Change requirements.txt for Cheetah3 to minimum 3.2.4 Change update sabToSickBeard. Change update autoProcessTV. Change remove Twitter notifier. Update NZBGet Process Media extension, SickGear-NG 1.7 → 2.4 Update Kodi addon 1.0.3 → 1.0.4 Update ADBA for py3. Update Beautiful Soup 4.8.0 (r526) to 4.8.1 (r531). Update Send2Trash 1.3.0 (a568370) to 1.5.0 (66afce7). Update soupsieve 1.9.1 (24859cc) to 1.9.5 (6a38398). Change use GNTP (Growl Notification Transport Protocol) from Apprise. Change add multi host support to Growl notifier. Fix Growl notifier when using empty password. Change update links for Growl notifications. Change deprecate confg/Notifications/Growl password field as these are now stored with host setting. Fix prevent infinite memoryError from a particular jpg data structure. Change subliminal for py3. Change enzyme for py3. Change browser_ua for py3. Change feedparser for py3 (sgmlib is no longer available on py3 as standardlib so added ext lib) Fix Guessit. Fix parse_xml for py3. Fix name parser with multi eps for py3. Fix tvdb_api fixes for py3 (search show). Fix config/media process to only display "pattern is invalid" qtip on "Episode naming" tab if the associated field is actually visible. Also, if the field becomes hidden due to a setting change, hide any previously displayed qtip. Note for Javascript::getelementbyid (or $('tag[id="<name>"')) is required when an id is being searched in the dom due to ":" used in a shows id name. Change download anidb xml files to main cache folder and use adba lib folder as a last resort. Change create get anidb show groups as centralised helper func and consolidate dupe code. Change move anidb related functions to newly renamed anime.py (from blacklistandwhitelist.py). Change str encode hex no longer exits in py3, use codecs.encode(...) instead. Change fix b64decode on py3 returns bytestrings. Change use binary read when downloading log file via browser to prevent any encoding issues. Change add case insensitive ordering to anime black/whitelist. Fix anime groups list not excluding whitelisted stuff. Change add Windows utf8 fix ... see: ytdl-org/youtube-dl#820 Change if no qualities are wanted, exit manual search thread. Fix keepalive for py3 process media. Change add a once a month update of tvinfo show mappings to the daily updater. Change autocorrect ids of new shows by updating from -8 to 31 days of the airdate of episode one. Add next run time to Manage/Show Tasks/Daily show update. Change when fetching imdb data, if imdb id is an episode id then try to find and use real show id. Change delete diskcache db in imdbpie when value error (due to change in Python version). Change during startup, cleanup any _cleaner.pyc/o to prevent issues when switching python versions. Add .pyc cleaner if python version is switched. Change replace deprecated gettz_db_metadata() and gettz. Change rebrand "SickGear PostProcessing script" to "SickGear Process Media extension". Change improve setup guide to use the NZBGet version to minimise displayed text based on version. Change NZBGet versions prior to v17 now told to upgrade as those version are no longer supported - code has actually exit on start up for some time but docs were outdated. Change comment out code and unused option sg_base_path. Change supported Python version 2.7.9-2.7.18 inclusive expanded to 3.7.1-3.8.1 inclusive. Change pidfile creation under Linux 0o644. Make logger accept lists to output continuously using the log_lock instead of split up by other processes. Fix long path issues with Windows process media.
6 years ago
"""
ZSNES Save State Parser (v143 only currently)
Author: Jason Gorski
Creation date: 2006-09-15
"""
from hachoir_py3.parser import Parser
from hachoir_py3.field import (FieldSet, StaticFieldSet,
UInt8, UInt16, UInt32,
String, PaddingBytes, Bytes, RawBytes)
from hachoir_py3.core.endian import LITTLE_ENDIAN
class ZSTHeader(StaticFieldSet):
format = (
(String, "zs_mesg", 26, "File header", {"charset": "ASCII"}),
(UInt8, "zs_mesglen", "File header string len"),
(UInt8, "zs_version", "Version minor #"),
(UInt8, "curcyc", "cycles left in scanline"),
(UInt16, "curypos", "current y position"),
(UInt8, "cacheud", "update cache every ? frames"),
(UInt8, "ccud", "current cache increment"),
(UInt8, "intrset", "interrupt set"),
(UInt8, "cycpl", "cycles per scanline"),
(UInt8, "cycphb", "cycles per hblank"),
(UInt8, "spcon", "SPC Enable (1=enabled)"),
(UInt16, "stackand", "value to and stack to keep it from going to the wrong area"),
(UInt16, "stackor", "value to or stack to keep it from going to the wrong area"),
)
class ZSTcpu(StaticFieldSet):
format = (
(UInt16, "xat"),
(UInt8, "xdbt"),
(UInt8, "xpbt"),
(UInt16, "xst"),
(UInt16, "xdt"),
(UInt16, "xxt"),
(UInt16, "xyt"),
(UInt8, "xp"),
(UInt8, "xe"),
(UInt16, "xpc"),
(UInt8, "xirqb", "which bank the irqs start at"),
(UInt8, "debugger", "Start with debugger (1: yes, 0: no)"),
(UInt32, "Curtable" "Current table address"),
(UInt8, "curnmi", "if in NMI (1=yes)"),
(UInt32, "cycpbl", "percentage left of CPU/SPC to run (3.58 = 175)"),
(UInt32, "cycpblt", "percentage of CPU/SPC to run"),
)
class ZSTppu(FieldSet):
static_size = 3019 * 8
def createFields(self):
yield UInt8(self, "sndrot", "rotates to use A,X or Y for sound skip")
yield UInt8(self, "sndrot2", "rotates a random value for sound skip")
yield UInt8(self, "INTEnab", "enables NMI(7)/VIRQ(5)/HIRQ(4)/JOY(0)")
yield UInt8(self, "NMIEnab", "controlled in e65816 loop. Sets to 81h")
yield UInt16(self, "VIRQLoc", "VIRQ Y location")
yield UInt8(self, "vidbright", "screen brightness 0..15")
yield UInt8(self, "previdbr", "previous screen brightness")
yield UInt8(self, "forceblnk", "force blanking on/off ($80=on)")
yield UInt32(self, "objptr", "pointer to object data in VRAM")
yield UInt32(self, "objptrn", "pointer2 to object data in VRAM")
yield UInt8(self, "objsize1", "1=8dot, 4=16dot, 16=32dot, 64=64dot")
yield UInt8(self, "objsize2", "large object size")
yield UInt8(self, "objmovs1", "number of bytes to move/paragraph")
yield UInt16(self, "objadds1", "number of bytes to add/paragraph")
yield UInt8(self, "objmovs2", "number of bytes to move/paragraph")
yield UInt16(self, "objadds2", "number of bytes to add/paragraph")
yield UInt16(self, "oamaddrt", "oam address")
yield UInt16(self, "oamaddrs", "oam address at beginning of vblank")
yield UInt8(self, "objhipr", "highest priority object #")
yield UInt8(self, "bgmode", "graphics mode 0..7")
yield UInt8(self, "bg3highst", "is 1 if background 3 has the highest priority")
yield UInt8(self, "bgtilesz", "0=8x8, 1=16x16 bit0=bg1, bit1=bg2, etc.")
yield UInt8(self, "mosaicon", "mosaic on, bit 0=bg1, bit1=bg2, etc.")
yield UInt8(self, "mosaicsz", "mosaic size in pixels")
yield UInt16(self, "bg1ptr", "pointer to background1")
yield UInt16(self, "bg2ptr", "pointer to background2")
yield UInt16(self, "bg3ptr", "pointer to background3")
yield UInt16(self, "bg4ptr", "pointer to background4")
yield UInt16(self, "bg1ptrb", "pointer to background1")
yield UInt16(self, "bg2ptrb", "pointer to background2")
yield UInt16(self, "bg3ptrb", "pointer to background3")
yield UInt16(self, "bg4ptrb", "pointer to background4")
yield UInt16(self, "bg1ptrc", "pointer to background1")
yield UInt16(self, "bg2ptrc", "pointer to background2")
yield UInt16(self, "bg3ptrc", "pointer to background3")
yield UInt16(self, "bg4ptrc", "pointer to background4")
yield UInt16(self, "bg1ptrd", "pointer to background1")
yield UInt16(self, "bg2ptrd", "pointer to background2")
yield UInt16(self, "bg3ptrd", "pointer to background3")
yield UInt16(self, "bg4ptrd", "pointer to background4")
yield UInt8(self, "bg1scsize", "bg #1 screen size (0=1x1,1=1x2,2=2x1,3=2x2)")
yield UInt8(self, "bg2scsize", "bg #2 screen size (0=1x1,1=1x2,2=2x1,3=2x2)")
yield UInt8(self, "bg3scsize", "bg #3 screen size (0=1x1,1=1x2,2=2x1,3=2x2)")
yield UInt8(self, "bg4scsize", "bg #4 screen size (0=1x1,1=1x2,2=2x1,3=2x2)")
yield UInt16(self, "bg1objptr", "pointer to tiles in background1")
yield UInt16(self, "bg2objptr", "pointer to tiles in background2")
yield UInt16(self, "bg3objptr", "pointer to tiles in background3")
yield UInt16(self, "bg4objptr", "pointer to tiles in background4")
yield UInt16(self, "bg1scrolx", "background 1 x position")
yield UInt16(self, "bg2scrolx", "background 2 x position")
yield UInt16(self, "bg3scrolx", "background 3 x position")
yield UInt16(self, "bg4scrolx", "background 4 x position")
yield UInt16(self, "bg1sx", "Temporary Variable for Debugging purposes")
yield UInt16(self, "bg1scroly", "background 1 y position")
yield UInt16(self, "bg2scroly", "background 2 y position")
yield UInt16(self, "bg3scroly", "background 3 y position")
yield UInt16(self, "bg4scroly", "background 4 y position")
yield UInt16(self, "addrincr", "vram increment (2,64,128,256)")
yield UInt8(self, "vramincr", "0 = increment at 2118/2138, 1 = 2119,213A")
yield UInt8(self, "vramread", "0 = address set, 1 = already read once")
yield UInt32(self, "vramaddr", "vram address")
yield UInt16(self, "cgaddr", "cg (palette)")
yield UInt8(self, "cgmod", "if cgram is modified or not")
yield UInt16(self, "scrnon", "main & sub screen on")
yield UInt8(self, "scrndist", "which background is disabled")
yield UInt16(self, "resolutn", "screen resolution")
yield UInt8(self, "multa", "multiplier A")
yield UInt16(self, "diva", "divisor C")
yield UInt16(self, "divres", "quotent of divc/divb")
yield UInt16(self, "multres", "result of multa * multb/remainder of divc/divb")
yield UInt16(self, "latchx", "latched x value")
yield UInt16(self, "latchy", "latched y value")
yield UInt8(self, "latchxr", "low or high byte read for x value")
yield UInt8(self, "latchyr", "low or high byte read for y value")
yield UInt8(self, "frskipper", "used to control frame skipping")
yield UInt8(self, "winl1", "window 1 left position")
yield UInt8(self, "winr1", "window 1 right position")
yield UInt8(self, "winl2", "window 2 left position")
yield UInt8(self, "winr2", "window 2 right position")
yield UInt8(self, "winbg1en", "Win1 on (IN/OUT) or Win2 on (IN/OUT) on BG1")
yield UInt8(self, "winbg2en", "Win1 on (IN/OUT) or Win2 on (IN/OUT) on BG2")
yield UInt8(self, "winbg3en", "Win1 on (IN/OUT) or Win2 on (IN/OUT) on BG3")
yield UInt8(self, "winbg4en", "Win1 on (IN/OUT) or Win2 on (IN/OUT) on BG4")
yield UInt8(self, "winobjen", "Win1 on (IN/OUT) or Win2 on (IN/OUT) on sprites")
yield UInt8(self, "wincolen", "Win1 on (IN/OUT) or Win2 on (IN/OUT) on backarea")
yield UInt8(self, "winlogica", "Window logic type for BG1 to 4")
yield UInt8(self, "winlogicb", "Window logic type for Sprites and Backarea")
yield UInt8(self, "winenabm", "Window logic enable for main screen")
yield UInt8(self, "winenabs", "Window logic enable for sub sceen")
yield UInt8(self, "mode7set", "mode 7 settings")
yield UInt16(self, "mode7A", "A value for Mode 7")
yield UInt16(self, "mode7B", "B value for Mode 7")
yield UInt16(self, "mode7C", "C value for Mode 7")
yield UInt16(self, "mode7D", "D value for Mode 7")
yield UInt16(self, "mode7X0", "Center X for Mode 7")
yield UInt16(self, "mode7Y0", "Center Y for Mode 7")
yield UInt8(self, "JoyAPos", "Old-Style Joystick Read Position for Joy 1 & 3")
yield UInt8(self, "JoyBPos", "Old-Style Joystick Read Position for Joy 2 & 4")
yield UInt32(self, "compmult", "Complement Multiplication for Mode 7")
yield UInt8(self, "joyalt", "temporary joystick alternation")
yield UInt32(self, "wramrwadr", "continuous read/write to wram address")
yield RawBytes(self, "dmadata", 129, "dma data (written from ports 43xx)")
yield UInt8(self, "irqon", "if IRQ has been called (80h) or not (0)")
yield UInt8(self, "nexthdma", "HDMA data to execute once vblank ends")
yield UInt8(self, "curhdma", "Currently executed hdma")
yield RawBytes(self, "hdmadata", 152, "4 dword register addresses, # bytes to transfer/line, address increment (word)")
yield UInt8(self, "hdmatype", "if first time executing hdma or not")
yield UInt8(self, "coladdr", "red value of color to add")
yield UInt8(self, "coladdg", "green value of color to add")
yield UInt8(self, "coladdb", "blue value of color to add")
yield UInt8(self, "colnull", "keep this 0 (when accessing colors by dword)")
yield UInt8(self, "scaddset", "screen/fixed color addition settings")
yield UInt8(self, "scaddtype", "which screen to add/sub")
yield UInt8(self, "Voice0Disabl2", "Disable Voice 0")
yield UInt8(self, "Voice1Disabl2", "Disable Voice 1")
yield UInt8(self, "Voice2Disabl2", "Disable Voice 2")
yield UInt8(self, "Voice3Disabl2", "Disable Voice 3")
yield UInt8(self, "Voice4Disabl2", "Disable Voice 4")
yield UInt8(self, "Voice5Disabl2", "Disable Voice 5")
yield UInt8(self, "Voice6Disabl2", "Disable Voice 6")
yield UInt8(self, "Voice7Disabl2", "Disable Voice 7")
yield RawBytes(self, "oamram", 1024, "OAMRAM (544 bytes)")
yield RawBytes(self, "cgram", 512, "CGRAM")
yield RawBytes(self, "pcgram", 512, "Previous CGRAM")
yield UInt8(self, "vraminctype")
yield UInt8(self, "vramincby8on", "if increment by 8 is on")
yield UInt8(self, "vramincby8left", "how many left")
yield UInt8(self, "vramincby8totl", "how many in total (32,64,128)")
yield UInt8(self, "vramincby8rowl", "how many left in that row (start at 8)")
yield UInt16(self, "vramincby8ptri", "increment by how many when rowl = 0")
yield UInt8(self, "nexthprior")
yield UInt8(self, "doirqnext")
yield UInt16(self, "vramincby8var")
yield UInt8(self, "screstype")
yield UInt8(self, "extlatch")
yield UInt8(self, "cfield")
yield UInt8(self, "interlval")
yield UInt16(self, "HIRQLoc HIRQ X")
# NEWer ZST format
yield UInt8(self, "KeyOnStA")
yield UInt8(self, "KeyOnStB")
yield UInt8(self, "SDD1BankA")
yield UInt8(self, "SDD1BankB")
yield UInt8(self, "SDD1BankC")
yield UInt8(self, "SDD1BankD")
yield UInt8(self, "vramread2")
yield UInt8(self, "nosprincr")
yield UInt16(self, "poamaddrs")
yield UInt8(self, "ioportval")
yield UInt8(self, "iohvlatch")
yield UInt8(self, "ppustatus")
yield PaddingBytes(self, "tempdat", 477, "Reserved/Unused")
class ZSNESFile(Parser):
PARSER_TAGS = {
"id": "zsnes",
"category": "game",
"description": "ZSNES Save State File (only version 143)",
"min_size": 3091 * 8,
"file_ext": ("zst", "zs1", "zs2", "zs3", "zs4", "zs5", "zs6",
"zs7", "zs8", "zs9")
}
endian = LITTLE_ENDIAN
def validate(self):
temp = self.stream.readBytes(0, 28)
if temp[0:26] != b"ZSNES Save State File V143":
return "Wrong header"
if ord(temp[27:28]) != 143: # extra...
return "Wrong save version %d <> 143" % temp[27:1]
return True
def seek(self, offset):
padding = self.seekByte(offset, relative=False)
if padding is not None:
yield padding
def createFields(self):
yield ZSTHeader(self, "header", "ZST header") # Offset: 0
yield ZSTcpu(self, "cpu", "ZST cpu registers") # 41
yield ZSTppu(self, "ppu", "ZST CPU registers") # 72
yield RawBytes(self, "wram7E", 65536) # 3091
yield RawBytes(self, "wram7F", 65536) # 68627
yield RawBytes(self, "vram", 65536) # 134163
# TODO: Interpret extra on-cart chip data found at/beyond... 199699
# TODO: Interpret Thumbnail/Screenshot data found at 275291
# 64*56*2(16bit colors) = 7168
padding = self.seekByte(275291, relative=False)
if padding is not None:
yield padding
yield Bytes(self, "thumbnail", 7168, "Thumbnail of playing game in some sort of raw 64x56x16-bit RGB mode?")