Skip to content

Commit

Permalink
reflect N3710 being fast enough for bsnes
Browse files Browse the repository at this point in the history
- Change default emulator to bsnes, which a Pentium N3710 CPU can
  run at 60 fps.  Pentium N is the successor to Atom for compact
  laptop PCs.
- Remove executables from repository
- Switch to zipup.py to prevent zip bombing
  • Loading branch information
pinobatch committed Nov 18, 2018
1 parent 0422bbc commit 28ed91e
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -9,6 +9,9 @@
/zip.in
/map.txt
/spcmap.txt
/lorom-template.sfc
/lorom-template.spc
/lorom-template-*.zip
__pycache__/
*.pyc

Expand Down
Binary file removed lorom-template.sfc
Binary file not shown.
Binary file removed lorom-template.spc
Binary file not shown.
20 changes: 13 additions & 7 deletions makefile
Expand Up @@ -30,11 +30,13 @@ objdir := obj/snes
srcdir := src
imgdir := tilesets

# if it's not bsnes, it's just BS
#EMU := bsnes

# But being stuck on an Atom laptop is BS
EMU := xterm -e zsnes -d
# If it's not bsnes, it's just BS. But I acknowledge that being
# stuck on an old Atom laptop is BS. Atom N450 can't run bsnes at
# full speed, but the Atom-based Pentium N3710 can.
ifndef SNESEMU
#SNESEMU := xterm -e zsnes -d
SNESEMU := bsnes
endif

# game-music-emu by blargg et al.
# Using paplay-based wrapper from
Expand All @@ -51,6 +53,7 @@ endif
# yep, that's 8 backslashes. Apparently, there are 3 layers of escaping:
# one for the shell that executes sed, one for sed, and one for the shell
# that executes wine
# TODO: convert to use winepath -w
wincwd := $(shell pwd | sed -e "s'/'\\\\\\\\'g")

# .PHONY means these targets aren't actual filenames
Expand All @@ -60,7 +63,7 @@ wincwd := $(shell pwd | sed -e "s'/'\\\\\\\\'g")
# to build the first target. So unless you're trying to run
# NO$SNS in Wine, you should move run above nocash-run.
run: $(title).sfc
$(EMU) $<
$(SNESEMU) $<

# Per Martin Korth on 2014-09-16: NO$SNS requires absolute
# paths because he screwed up and made the filename processing
Expand All @@ -81,12 +84,15 @@ clean:
dist: zip
zip: $(title)-$(version).zip
$(title)-$(version).zip: zip.in all README.md $(objdir)/index.txt
zip -9 -u $@ -@ < $<
$(PY) tools/zipup.py $< $(title)-$(version) -o $@
-advzip -z3 $@

# Build zip.in from the list of files in the Git tree
zip.in:
git ls-files | grep -e "^[^.]" > $@
echo zip.in >> $@
echo $(title).sfc >> $@
echo $(title).spc >> $@

$(objdir)/index.txt: makefile
echo "Files produced by build tools go here. (This file's existence forces the unzip tool to create this folder.)" > $@
Expand Down
80 changes: 80 additions & 0 deletions tools/zipup.py
@@ -0,0 +1,80 @@
#!/usr/bin/env python3
import sys
import os
import argparse
import zipfile
import tarfile

def make_zipfile(outname, filenames, prefix):
with zipfile.ZipFile(outname, "w", zipfile.ZIP_DEFLATED) as z:
for filename in filenames:
z.write(filename, prefix+filename)

def make_tarfile(outname, filenames, prefix, mode="w"):
with tarfile.open(outname, "w", zipfile.ZIP_DEFLATED) as z:
for filename in filenames:
z.add(filename, prefix+filename)

def make_tarfile_gz(outname, filenames, prefix):
return make_tarfile(outname, filenames, prefix, mode="w:gz")

def make_tarfile_bz2(outname, filenames, foldername):
return make_tarfile(outname, filenames, prefix, mode="w:bz2")

def make_tarfile_xz(outname, filenames, foldername):
return make_tarfile(outname, filenames, prefix, mode="w:xz")

formathandlers = [
(".zip", make_zipfile),
(".tar", make_tarfile),
(".tgz", make_tarfile_gz),
(".tar.gz", make_tarfile_gz),
(".tbz", make_tarfile_bz2),
(".tar.bz2", make_tarfile_bz2),
(".txz", make_tarfile_xz),
(".tar.xz", make_tarfile_xz),
]

tophelptext = """
Make a zip or tar archive containing specified files without a tar bomb.
"""
bottomhelptext = """
Supported output formats: """+", ".join(x[0] for x in formathandlers)

def parse_argv(argv):
p = argparse.ArgumentParser(
description=tophelptext, epilog=bottomhelptext
)
p.add_argument("filelist",
help="name of file containing newline-separated relative "
"paths to files to include, or - for standard input")
p.add_argument("foldername",
help="name of folder in archive (e.g. hello-1.2.5)")
p.add_argument("-o", "--output",
help="path of archive (default: foldername + .zip)")
return p.parse_args(argv[1:])

def get_writerfunc(outname):
outbaselower = os.path.basename(outname).lower()
for ext, writerfunc in formathandlers:
if outbaselower.endswith(ext):
return writerfunc
raise KeyError(os.path.splitext(outbaselower)[1])

def main(argv=None):
args = parse_argv(argv or sys.argv)
if args.filelist == '-':
filenames = set(sys.stdin)
else:
with open(args.filelist, "r") as infp:
filenames = set(infp)
filenames = set(x.strip() for x in filenames)
filenames = sorted(x for x in filenames if x)

outname = args.output or args.foldername + ".zip"
writerfunc = get_writerfunc(outname)
writerfunc(outname, filenames, args.foldername+"/")

if __name__=='__main__':
main()

0 comments on commit 28ed91e

Please sign in to comment.