Skip to content

Fix some issues in check_cpy #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
require "./src/extract-polyglot"
require "./src/extract-zlib"
require 'digest/md5'
hash = {}
hashm = Hash.new
module VBiosFinder
class Main
@extractions = []
Expand Down Expand Up @@ -93,14 +93,17 @@ def self.run file



def check_cpy(new_filename,romdata)
define_method (:check_cpy) do |new_filename,romdata|
count = 0
Dir.glob('**/*',File::FNM_DOTMATCH).each do |f|
if File.directory?(f)
next
end
key = Digest::MD5.hexdigest(IO.read(f)).to_sym
if hash.has_key?(key) then hash[key].push(f) else hash[key] = [f] end
if hashm.has_key?(key) then hashm[key].push(f) else hashm[key] = [f] end
end

hash.each_value do |a|
hashm.each_value do |a|
next if a.length == 1
count+= 1
new_filename = "vbios_#{romdata['vendor']}_#{romdata['device']}_#{count}.rom"
Expand Down