$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) require 'open-uri' class RipXplore VERSION="0.13.0" private def RipXplore.require_files_in_subdir(dirname) full_path=File.expand_path(dirname,File.dirname(__FILE__)) Dir.glob("#{full_path}/*.rb").sort.each {|f| require f} Dir.foreach(full_path) do |f| next if f=~/^\./ #skip anything that starts with a . full_subdir_path=File.expand_path(f,full_path) RipXplore.require_files_in_subdir(full_subdir_path) if File.directory?(full_subdir_path) end end #load all plugins require 'HostSystem' RipXplore.require_files_in_subdir("host_systems") require 'ImageFormat' RipXplore.require_files_in_subdir("image_formats") require 'FileSystem' RipXplore.require_files_in_subdir("file_systems") require 'NativeFileType' RipXplore.require_files_in_subdir("native_file_types") require 'FileSystemImage' RipXplore.require_files_in_subdir("disassemblers") def RipXplore.supported_file_system_images FileSystemImage.subclasses end def RipXplore.best_fit_from_file(file,filename=nil) filename=file.path if filename.nil? if !(filename=~/(.*)\.gz$/i).nil? then require 'zlib' file_bytes=Zlib::GzipReader.new(file).read # filename=$1 else file_bytes=file.read end FileSystemImage.best_fit(file_bytes,filename) end def RipXplore.best_fit_from_filename(filename) file=open(filename,"rb") RipXplore.best_fit_from_file(file,filename) end #create a new fimage initialised with specified filesystem def RipXplore.create_new(filesystem) blank_image_filename=case filesystem when :AppleCPM then File.dirname(__FILE__)+"/blank_images/applecpm_blank.dsk.gz" when :AppleDos then File.dirname(__FILE__)+"/blank_images/dos33_blank.dsk.gz" when :BeautifulBoot then File.dirname(__FILE__)+"/blank_images/beautiful_boot_blank.dsk.gz" when :CbmDos then File.dirname(__FILE__)+"/blank_images/blank.d64.gz" else raise "initialisation of #{filesystem} file system not currently supported" end RipXplore.best_fit_from_filename(blank_image_filename) end end # == Author # Jonno Downes (jonno@jamtronix.com) # # == Copyright # Copyright (c) 2008,2009 Jonno Downes (jonno@jamtronix.com) # #Permission is hereby granted, free of charge, to any person obtaining #a copy of this software and associated documentation files (the #"Software"), to deal in the Software without restriction, including #without limitation the rights to use, copy, modify, merge, publish, #distribute, sublicense, and/or sell copies of the Software, and to #permit persons to whom the Software is furnished to do so, subject to #the following conditions: # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.