예제 #1
0
파일: app.py 프로젝트: dustmop/makechr
 def create_output(self, mem, args, traversal, platform):
     config = ppu_memory.PpuMemoryConfig(
         chr_order=args.order,
         traversal=traversal,
         platform=platform,
         is_sprite=args.is_sprite,
         is_locked_tiles=args.is_locked_tiles,
         lock_sprite_flips=args.lock_sprite_flips,
         select_chr_plane=args.select_chr_plane)
     if args.vertical_pixel_display:
         mem.chr_set.vertical_pixel_display()
     if args.output == '/dev/null':
         # Ignore output.
         pass
     elif args.output and args.output.endswith('.o'):
         # Output as a valiant object file.
         mem.save_valiant(args.output, config)
     elif args.output and args.output.endswith('.png'):
         # Render an image.
         renderer = pixel_art_renderer.PixelArtRenderer()
         img = renderer.render(mem)
         img.save(args.output)
     else:
         # Output as multiple files using a template.
         out_tmpl = args.output or '%s.dat'
         if out_tmpl[-1] == '/' or os.path.isdir(out_tmpl):
             out_tmpl = os.path.join(out_tmpl, '%s.dat')
         if not '%s' in out_tmpl:
             raise errors.CommandLineArgError(
                 'output needs "%s" in its template')
         mem.save_template(out_tmpl, config)
     if args.compile:
         # Compile a runnable ROM.
         builder = rom_builder.RomBuilder()
         builder.build(mem, args.compile)
예제 #2
0
 def create_output(self, mem, args, traversal):
     config = ppu_memory.PpuMemoryConfig(
         chr_order=args.order,
         traversal=traversal,
         is_sprite=args.is_sprite,
         is_locked_tiles=args.is_locked_tiles,
         lock_sprite_flips=args.lock_sprite_flips)
     if args.output == '/dev/null':
         pass
     elif args.output and args.output.endswith('.o'):
         mem.save_valiant(args.output, config)
     elif args.output and args.output.endswith('.png'):
         renderer = pixel_art_renderer.PixelArtRenderer()
         img = renderer.render(mem)
         img.save(args.output)
     else:
         out_tmpl = args.output or '%s.dat'
         if out_tmpl[-1] == '/' or os.path.isdir(out_tmpl):
             out_tmpl = os.path.join(out_tmpl, '%s.dat')
         if not '%s' in out_tmpl:
             raise errors.CommandLineArgError(
                 'output needs "%s" in its template')
         mem.save_template(out_tmpl, config)
     if args.compile:
         builder = rom_builder.RomBuilder()
         builder.build(mem, args.compile)
예제 #3
0
파일: app.py 프로젝트: dustmop/makechr
 def read_memory(self, filename, kind, args):
     importer = memory_importer.MemoryImporter()
     mem = importer.read(filename, kind)
     img = None
     if args.grid_view:
         renderer = pixel_art_renderer.PixelArtRenderer()
         img = renderer.render(mem)
     self.create_views(mem, args, img)
     self.create_output(mem, args, self.get_traversal(None), None)
예제 #4
0
파일: gui.py 프로젝트: dustmop/makechr
 def LoadValiant(self):
     path = self.inputImagePath
     importer = memory_importer.MemoryImporter()
     mem = importer.read_valiant(path)
     renderer = pixel_art_renderer.PixelArtRenderer()
     img = renderer.render(mem)
     outfile = tempfile.mkstemp(suffix='.png')[1]
     img.save(outfile)
     self.inputImagePath = outfile
     self.processor._err = errors.ErrorCollector()
     self.processor._ppu_memory = mem
     self.ShowMessage('Opened "%s"' % path, 4.0)
예제 #5
0
파일: gui.py 프로젝트: dustmop/makechr
 def LoadImportedRam(self):
     path = self.inputImagePath
     importer = memory_importer.MemoryImporter()
     mem = importer.read_ram(path)
     renderer = pixel_art_renderer.PixelArtRenderer()
     img = renderer.render(mem)
     outfile = tempfile.mkstemp(suffix='.png')[1]
     img.save(outfile)
     self.inputImagePath = outfile
     self.processor._err = errors.ErrorCollector()
     self.processor._ppu_memory = mem
     self.ReassignImage()
     self.CreateViews()
     self.OnImageLoaded()
     self.ShowMessage('Imported RAM from "%s"' % path, 4.0)