Skip to content

Instantly share code, notes, and snippets.

Last active September 28, 2022 04:31
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Extract the items contained in a Marmoset Viewer's .mview archive file
import struct
import os
# Parameter
archive = "vivfox.mview"
def readCString(f):
"""This is the most naive implementation possible, don't use in prod"""
str = ""
c =
while c != '\0':
str += c
c =
return str
def getFileSize(f):
pos = f.tell(), 2)
end = f.tell(), 0)
return end
# Create the output directory
directory = os.path.splitext(archive)[0]
if not os.path.exists(directory):
with open(archive, 'rb') as f:
end = getFileSize(f)
while True:
name = readCString(f)
mime = readCString(f)
compressed, size, rawSize = struct.unpack("III",*4))
if compressed:
name += ".compressed"
name = os.path.join(directory, name)
with open(name, 'wb') as outf:
if f.tell() >= end:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment