Skip to content

Commit

Permalink
Fix some issues in check_cpy
Browse files Browse the repository at this point in the history
  • Loading branch information
kronthto authored and coderobe committed Feb 14, 2021
1 parent b48da3e commit 88aea3a
Showing 1 changed file with 7 additions and 4 deletions.
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

0 comments on commit 88aea3a

Please sign in to comment.