resedit 1.6 → 1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b4e01f23eab7befb55f58374b179252e580ba27
4
- data.tar.gz: c70bea5859d5fcdb2c62379956034d641336d320
3
+ metadata.gz: 778c2b706f9f0dc7daf38221fdd1b31c1bcb24e0
4
+ data.tar.gz: e55fc3fdbd514f958173df1d9f0f315df937e161
5
5
  SHA512:
6
- metadata.gz: bec413733f867fe85b74bfbb07f99bcb4be3b161f3a3539cf50ed5312e03365accff257b81a107308c1ad205e0c8eb7779f330bb62414e3c508af802ce64edab
7
- data.tar.gz: f6ef54cd8d085aaf2821f3b7821ccdbaa4c15ac26a4cf38b734091f0095b6626a7333f673a1ccaa72bc49075fbec2d57839dd9588391a46fc25ea7dc2744b9a0
6
+ metadata.gz: 50651c92183dd3bbdeb1305cb7e6ea03d482f23d2f21bbdc3dc9815b04f9c48e898243f32f21f7237f74ed5fb4028e2c9e08e8dba4c15def232509c61539ca93
7
+ data.tar.gz: 31a923d1fc346ee0aac0534670d21df368cb97a725a83cb4be6761d98000e86615d903cfe4cf13fbaa65beb58cdc97a518ce8698e4cef2d36e481b216308b86b
@@ -10,6 +10,7 @@ require 'resedit/app/font_convert'
10
10
  require 'resedit/app/text_convert'
11
11
  require 'resedit/convert/bitconv'
12
12
  require 'resedit/convert/codepatch'
13
+ require 'resedit/convert/colors'
13
14
  require 'resedit/mz/mz'
14
15
  require 'resedit/classes/colorizer'
15
16
  require 'resedit/classes/hexwriter'
@@ -17,5 +18,5 @@ require 'resedit/classes/changeable'
17
18
 
18
19
 
19
20
  module Resedit
20
- VERSION = "1.6"
21
+ VERSION = "1.7"
21
22
  end
@@ -76,17 +76,21 @@ module Resedit
76
76
  return ofs
77
77
  end
78
78
 
79
- def change(ofs, data)
80
- return @sz + @n.change(ofs - @sz, data) if ofs > @sz
79
+ def change(ofs, data, fix=false)
80
+ return @sz + @n.change(ofs - @sz, data, fix) if ofs > @sz
81
81
  nxt = data.length - @sz + ofs
82
82
  size = nxt>0 ? data.length-nxt : data.length
83
- @n.change(0, data[size..-1]) if nxt > 0
83
+ @n.change(0, data[size..-1], fix) if nxt > 0
84
84
  if @nbuf
85
85
  @nbuf = @nbuf[0,ofs] + data[0, size] + @nbuf[ofs+size..-1]
86
86
  mode()
87
87
  return ofs
88
88
  end
89
- split(ofs, data[0, size])
89
+ if fix
90
+ @obuf = @obuf[0, ofs] + data[0, size] + @obuf[ofs+size..-1]
91
+ else
92
+ split(ofs, data[0, size])
93
+ end
90
94
  mode()
91
95
  return ofs
92
96
  end
@@ -186,8 +190,10 @@ module Resedit
186
190
  @root = Change.new(data)
187
191
  end
188
192
 
193
+ def setData(data); @root = Change.new(data) end
189
194
 
190
195
  def mode(how)
196
+ return if @mode==how
191
197
  @root.mode(how)
192
198
  @mode = how
193
199
  end
@@ -209,6 +215,11 @@ module Resedit
209
215
  return ofs
210
216
  end
211
217
 
218
+ def fix(ofs, bytes)
219
+ @root.change(ofs, bytes, true)
220
+ return ofs
221
+ end
222
+
212
223
  def changed?(ofs, size=1); return @root.changed?(ofs, size) end
213
224
 
214
225
  def debug(); LOG.level = Logger::DEBUG end
@@ -264,6 +275,19 @@ module Resedit
264
275
  return @root.hex(writer, ofs, size, col)
265
276
  end
266
277
 
278
+ def print(what, how)
279
+ mode(parseHow(how))
280
+ if what=="changes"
281
+ getChanges().each{|ofs,bts|
282
+ printf("%08X: %s -> %s\n", ofs, bts[0].bytes.map { |b| sprintf("%02X",b) }.join,
283
+ colStr(bts[1].bytes.map { |b| sprintf("%02X",b) }.join))
284
+ }
285
+ puts
286
+ return true
287
+ end
288
+ return false
289
+ end
290
+
267
291
 
268
292
  def saveData(file)
269
293
  mode(HOW_CHANGED)
@@ -21,8 +21,9 @@ module Resedit
21
21
  end
22
22
 
23
23
  def addr(idx, adr)
24
- adr[0] += @ofs[idx]
25
- return adr
24
+ ret = [adr[0], adr[1]]
25
+ ret[0] += @ofs[idx]
26
+ return ret
26
27
  end
27
28
 
28
29
  def hexdata()
@@ -0,0 +1,75 @@
1
+
2
+ module Resedit
3
+
4
+ class Color
5
+ attr_accessor :a, :r, :g, :b, :amath
6
+
7
+ def initialize(valOrR, g=nil, b=nil, a=0xFF)
8
+ @amath = false
9
+ if g == nil
10
+ @r = (valOrR >> 16) & 0xFF
11
+ @g = (valOrR >> 8) & 0xFF
12
+ @b = valOrR & 0xFF
13
+ @a = (valOrR >> 24) & 0xFF
14
+ else
15
+ @r, @g, @b, @a = valOrR, g, b, a
16
+ end
17
+ end
18
+
19
+ def to_s()
20
+ return "[#{@a.to_s(16)} #{@r.to_s(16)} #{@g.to_s(16)} #{@b.to_s(16)}]"
21
+ end
22
+
23
+ def to_i()
24
+ return (@a<<24)|(@r<<16)|(@g<<8)|@b
25
+ end
26
+
27
+ def add(col)
28
+ @a = [0xFF, @a + col.a].min if @amath
29
+ @r = [0xFF, @r + col.r].min
30
+ @g = [0xFF, @g + col.g].min
31
+ @b = [0xFF, @b + col.b].min
32
+ return self
33
+ end
34
+
35
+ def mul(m)
36
+ @a = [0xFF, (@a * m).to_i()].min if @amath
37
+ @r = [0xFF, (@r * m).to_i()].min
38
+ @g = [0xFF, (@g * m).to_i()].min
39
+ @b = [0xFF, (@b * m).to_i()].min
40
+ return self
41
+ end
42
+
43
+ def *(m); Color.new(@r,@g,@b,@a).mul(m) end
44
+
45
+ def +(col); Color.new(@r,@g,@b,@a).add(col) end
46
+
47
+ end
48
+
49
+ class ColorMap
50
+
51
+ def initialize(from, to)
52
+ @from = Color.new(from)
53
+ @to = Color.new(to)
54
+ end
55
+
56
+ def gradient(steps)
57
+ map = [@from]
58
+ c = steps-1.0
59
+ for i in 1..steps-2
60
+ v = 1.0 * i / c
61
+ map += [ (@from*(1.0-v) + @to*v).to_i ]
62
+ end
63
+ map += [@to]
64
+ #puts map
65
+ return map
66
+ end
67
+
68
+ def mapBpp(bpp)
69
+ return gradient(1<<bpp)
70
+ end
71
+
72
+
73
+ end
74
+
75
+ end
@@ -1,26 +1,50 @@
1
1
  require 'resedit/font/font_char'
2
2
  require 'resedit/image/image_factory'
3
+ require 'resedit/convert/colors'
3
4
 
4
5
  module Resedit
5
6
 
6
7
  class Font
7
- attr_reader :count, :width, :height
8
+ attr_reader :count, :width, :height, :bpp
8
9
  attr_accessor :gridColor, :charColor, :userData, :widthColor, :bgColor
9
10
 
10
11
  # charWidth, charHeight, characters count
11
- def initialize(width, height, count=256)
12
+ def initialize(width, height, count: 256, bpp: 1)
12
13
  @width, @height, @count = width, height, count
13
14
  @gridColor = 0xFFEEEEEE
14
15
  @charColor = 0xFF000000
15
16
  @bgColor = 0xFFFFFFFF
16
17
  @widthColor = 0xFFFF0000
17
18
  @chars = {}
19
+ @bpp = bpp
18
20
  @userData = nil
21
+ @colmap = nil
22
+ @valmap = nil
23
+ end
24
+
25
+ def buildBppMap()
26
+ return [@bgColor, @charColor] if @bpp==1
27
+ return ColorMap.new(@bgColor, @charColor).mapBpp(@bpp)
28
+ end
29
+
30
+ def colorMap(val)
31
+ @colmap = buildBppMap() if !@colmap
32
+ #@puts "#{val} = #{@colmap[val].to_s(16)}"
33
+ return @colmap[val]
34
+ end
35
+
36
+ def valueMap(col)
37
+ if !@valmap
38
+ @valmap = Hash[buildBppMap().each_with_index.map {|x,i| [x, i]}] if !@valmap
39
+ end
40
+ val=@valmap[col]
41
+ raise "Wrong color in font #{col.to_s(16)}" if val==nil
42
+ return val
19
43
  end
20
44
 
21
45
  def setChar(id, data, width=nil, flags=nil)
22
46
  width=@width if !width
23
- @chars[id] = FontChar.new(@width, @height, id, data, width, flags)
47
+ @chars[id] = FontChar.new(self, @height, id, data, width, flags)
24
48
  end
25
49
 
26
50
  def getChar(id)
@@ -51,10 +75,10 @@ module Resedit
51
75
  img.fill(@bgColor)
52
76
  #draw grid
53
77
  for i in 0..16
54
- img.vline(i*(@width+1), gridColor)
78
+ img.vline(i*(@width+1), @gridColor)
55
79
  end
56
80
  for j in 0..rows
57
- img.hline(j*(@height+1), gridColor)
81
+ img.hline(j*(@height+1), @gridColor)
58
82
  end
59
83
  #draw letters
60
84
  @chars.each { |idx,c|
@@ -62,9 +86,10 @@ module Resedit
62
86
  y = idx/16
63
87
  x += 1+x*@width
64
88
  y += 1+y*@height
65
- c.draw(img, @charColor, x, y, @widthColor)
89
+ c.draw(img, x, y)
66
90
  }
67
91
  img.save(filename)
92
+ @colmap = nil
68
93
  end
69
94
 
70
95
  def load(filename)
@@ -76,10 +101,11 @@ module Resedit
76
101
  y = idx/16
77
102
  x += 1+x*@width
78
103
  y += 1+y*@height
79
- c = FontChar.new(width,height,idx)
80
- c.scan(img, @charColor, x, y, @widthColor, [@bgColor, @gridColor])
104
+ c = FontChar.new(self, height, idx)
105
+ c.scan(img, x, y)
81
106
  @chars[c.index] = c if c.data
82
107
  end
108
+ @valmap = nil
83
109
  end
84
110
 
85
111
  end
@@ -3,25 +3,27 @@ module Resedit
3
3
  class FontChar
4
4
  attr_accessor :index, :data, :realWidth, :flags
5
5
 
6
- def initialize(width, height, index, data=nil, realWidth=nil, flags=nil)
7
- @width, @height, @index = width, height, index
6
+ def initialize(font, height, index, data=nil, realWidth=nil, flags=nil)
7
+ @font = font
8
+ @width = font.width
9
+ @height, @index = height, index
8
10
  @realWidth=realWidth
9
11
  @flags = flags
10
- @data=data if (data && data.length==width*height)
12
+ @data=data if (data && data.length==@width*height)
11
13
  end
12
14
 
13
- def hasPixel(x, y)
14
- @data[y*@width+x] != 0
15
- end
15
+ def hasPixel(x, y); @data[y*@width+x] != 0 end
16
+
17
+ def valueAt(x,y); @data[y*@width+x] end
16
18
 
17
- def draw(image, color, x, y, wColor)
19
+ def draw(image, x, y)
18
20
  for j in 0..@height-1
19
21
  for i in 0..@width-1
20
- image.setPixel(x+i, y+j, color) if hasPixel(i,j)
22
+ image.setPixel(x+i, y+j, @font.colorMap(valueAt(i,j))) if hasPixel(i,j)
21
23
  end
22
24
  end
23
25
  if @realWidth
24
- image.setPixel(x+@realWidth, y, wColor)
26
+ image.setPixel(x+@realWidth, y, @font.widthColor)
25
27
  end
26
28
  if @flags && @flags.length>0
27
29
  for i in 0..@flags.length-1
@@ -30,13 +32,12 @@ module Resedit
30
32
  end
31
33
  end
32
34
 
33
- def readFlags(image, x, y, bgcolors)
35
+ def readFlags(image, x, y)
34
36
  empty = true
35
37
  flags = []
36
38
  for i in 0..@height-2
37
- flags += [bgcolors[0]]
38
39
  col = image.getPixel(x, y+i)
39
- if bgcolors.include?(col)
40
+ if col==@font.bgColor || col==@font.gridColor
40
41
  next
41
42
  end
42
43
  empty=false
@@ -47,24 +48,28 @@ module Resedit
47
48
  end
48
49
 
49
50
 
50
- def scan(image, color, x, y, wColor, bgcolors)
51
+ def scan(image, x, y)
52
+ wColor = @font.widthColor
53
+ bgColor = @font.bgColor
51
54
  @data=[0]*@width*@height
52
55
  @realWidth = nil
56
+ width = @width
53
57
  _hasData = false
54
58
  for j in 0..@height-1
55
- for i in 0..@width-1
59
+ for i in 0..width-1
56
60
  col=image.getPixel(x+i, y+j)
57
- if col==color
58
- @data[j*@width+i]= 1
59
- _hasData = true
60
- end
61
- if col ==wColor
61
+ if col == wColor
62
62
  @realWidth = i
63
+ width = @realWidth
64
+ break
65
+ elsif col != bgColor
66
+ @data[j*@width+i] = @font.valueMap(col)
67
+ _hasData = true
63
68
  end
64
69
  end
65
70
  end
66
71
  fx = x + (@realWidth ? @realWidth : @width)
67
- @flags = readFlags(image, fx, y+1, bgcolors)
72
+ @flags = readFlags(image, fx, y+1)
68
73
  @data=nil if !_hasData
69
74
  return @data!=nil
70
75
  end
@@ -153,6 +153,10 @@ module Resedit
153
153
  log("Reverted")
154
154
  end
155
155
 
156
+ def hexify(str)
157
+ str.each_byte.map { |b| sprintf("%02X",b) }.join
158
+ end
159
+
156
160
 
157
161
  def save(filename, final=nil)
158
162
  raise "Unknown final: " + final if final && final != "final"
@@ -27,7 +27,9 @@ module Resedit
27
27
  for i in 0..@mz.header.info[:NumberOfRelocations]-1
28
28
  r = @mz.header.getRelocation(i)
29
29
  @segments.add(r[1])
30
- val = segData(r, 2).unpack('v')[0]
30
+ sd = segData(r, 2)
31
+ next if !sd
32
+ val = sd.unpack('v')[0]
31
33
  @segments.add(val)
32
34
  end
33
35
  end
@@ -39,7 +41,7 @@ module Resedit
39
41
  @segments.add(r[1])
40
42
  ofs = seg2Linear(r[0], r[1])
41
43
  val = getData(ofs, 2).unpack('v')[0] + add
42
- change(ofs, [val].pack('v'))
44
+ fix(ofs, [val].pack('v'))
43
45
  @segments.add(val)
44
46
  end
45
47
  end
@@ -68,7 +70,7 @@ module Resedit
68
70
 
69
71
  def segData(reloc, size, isStr=false)
70
72
  ofs = seg2Linear(reloc[0], reloc[1])
71
- #return "None" if ofs > @root.size()
73
+ return nil if ofs > @root.size()
72
74
  return getData(ofs, size) if !isStr
73
75
  return colVal(ofs, size)
74
76
  end
@@ -87,6 +89,7 @@ module Resedit
87
89
 
88
90
  def append(bytes, where=nil)
89
91
  mode(HOW_CHANGED)
92
+ relfix = @mz.header.relocFix
90
93
  res = @addsz
91
94
  buf = @addsz>0 ? @root.nbuf[0, @addsz] : ''
92
95
  buf += bytes
@@ -96,7 +99,7 @@ module Resedit
96
99
  insert(0, bytes + "\x00"*(sz-@addsz))
97
100
  seg = linear2seg(res)
98
101
  res = [res, seg, sz/0x10]
99
- patchRelocs(sz/0x10)
102
+ patchRelocs(sz/0x10 - relfix)
100
103
  return res
101
104
  end
102
105
 
@@ -7,8 +7,10 @@ module Resedit
7
7
  BLK = 0x200
8
8
  PARA = 0x10
9
9
  HSIZE = 0x1C
10
+ HDRDESCR = [:Magic, :BytesInLastBlock, :BlocksInFile, :NumberOfRelocations, :HeaderParagraphs, :MinExtraParagraphs, :MaxExtraParagraphs,
11
+ :SS, :SP, :Checksum, :IP, :CS, :RelocTableOffset, :OverlayNumber]
10
12
 
11
- attr_reader :info, :mz
13
+ attr_reader :info, :mz, :relocFix
12
14
 
13
15
  def initialize(mz, file, size)
14
16
  raise "Not MZ file" if size < HSIZE
@@ -18,6 +20,7 @@ module Resedit
18
20
  @_infoOrig = loadInfo()
19
21
  @_info = nil
20
22
  @info = @_infoOrig
23
+ @relocFix = 0
21
24
  raise "Not MZ file" if MAGIC != @info[:Magic]
22
25
  addData(file, headerSize() - HSIZE)
23
26
  end
@@ -42,21 +45,24 @@ module Resedit
42
45
 
43
46
  def loadInfo()
44
47
  v = getData(0, HSIZE).unpack('v*')
45
- return {:Magic => v[0], :BytesInLastBlock => v[1], :BlocksInFile => v[2], :NumberOfRelocations => v[3],
46
- :HeaderParagraphs => v[4], :MinExtraParagraphs => v[5], :MaxExtraParagraphs => v[6],
47
- :SS => v[7], :SP => v[8], :Checksum => v[9], :IP => v[10], :CS => v[11],
48
- :RelocTableOffset => v[12], :OverlayNumber => v[13]
49
- }
48
+ return HDRDESCR.map.with_index { |x, i| [x, v[i]] }.to_h
50
49
  end
51
50
 
52
51
 
52
+ def setInfo(field, values)
53
+ raise "Unknown header field #{field}" if !HDRDESCR.include?(field)
54
+ values = [values] if !values.is_a?(Array)
55
+ change(HDRDESCR.index(field)*2, values.pack('v*'))
56
+ end
57
+
53
58
  def changeSize(size)
54
59
  mode(HOW_CHANGED)
55
60
  mod = size % BLK
56
- ch = [mod, size / BLK + (mod ? 1 : 0)]
57
- change(2, ch.pack('vv'))
61
+ setInfo(:BytesInLastBlock, [mod, size / BLK + (mod ? 1 : 0)])
58
62
  end
59
63
 
64
+ def setBodySize(size); changeSize(size + headerSize()) end
65
+
60
66
  def rebuildHeader(codesize)
61
67
  mode(HOW_ORIGINAL)
62
68
  ss = @info[:SS]
@@ -65,22 +71,35 @@ module Resedit
65
71
  codesize += PARA - codesize % PARA if codesize % PARA!=0
66
72
  changeSize(sz + codesize + headerSize())
67
73
  paras = codesize / PARA
68
- change(14, [ss+paras].pack('v'))
69
- change(22, [cs+paras].pack('v'))
74
+ setInfo(:SS, ss+paras)
75
+ setInfo(:CS, cs+paras)
70
76
  for i in 0..@mz.header.info[:NumberOfRelocations]-1
71
77
  rel = getRelocation(i)
72
- rel[1]+=paras
73
- setRelocation(i, rel)
78
+ rel[1] += paras-@relocFix
79
+ fix(@info[:RelocTableOffset] + i * 4, rel.pack('vv'))
74
80
  end
81
+ mode(HOW_CHANGED)
82
+ @relocFix = paras
83
+ MZEnv.instance().set(:relocFix, paras.to_s)
75
84
  return codesize
76
85
  end
77
86
 
78
87
  def addHeaderSize(size)
79
88
  mode(HOW_CHANGED)
80
89
  paras = size/16 + (size%16 == 0 ? 0 : 1)
81
- append("00" * (paras * PARA))
90
+ insert(headerSize(), "\x00" * (paras * PARA))
82
91
  changeSize(fileSize() + paras * PARA)
83
- change(8, [@info[:HeaderParagraphs] + paras].pack('v'))
92
+ setInfo(:HeaderParagraphs, @info[:HeaderParagraphs] + paras)
93
+ mode(HOW_CHANGED)
94
+ end
95
+
96
+ def loadChanges(file)
97
+ super(file)
98
+ mode(HOW_ORIGINAL)
99
+ ocs = @info[:CS]
100
+ mode(HOW_CHANGED)
101
+ ncs = @info[:CS]
102
+ @relocFix = ncs - ocs
84
103
  end
85
104
 
86
105
 
@@ -99,12 +118,12 @@ module Resedit
99
118
 
100
119
 
101
120
  def getRelocation(idx)
102
- raise "Wrong relocation index " if idx<0 || idx>@info[:NumberOfRelocations]
121
+ raise "Wrong relocation index " if idx<0 || idx >= @info[:NumberOfRelocations]
103
122
  return getData(@info[:RelocTableOffset] + idx * 4, 4).unpack('vv')
104
123
  end
105
124
 
106
125
  def setRelocation(idx, data)
107
- raise "Wrong relocation index " if idx<0 || idx>@info[:NumberOfRelocations]
126
+ raise "Wrong relocation index " if idx<0 || idx >= @info[:NumberOfRelocations]
108
127
  change(@info[:RelocTableOffset] + idx * 4, data.pack('vv'))
109
128
  end
110
129
 
@@ -114,6 +133,16 @@ module Resedit
114
133
  return headerSize() - HSIZE - @info[:NumberOfRelocations] * 4
115
134
  end
116
135
 
136
+ def setSpaceForRelocs(count)
137
+ add = count - @info[:NumberOfRelocations]
138
+ return if add<=0
139
+ add -= freeSpace()/4
140
+ return if add<=0
141
+ addHeaderSize(add*4)
142
+ setInfo(:NumberOfRelocations, count)
143
+ mode(HOW_CHANGED)
144
+ end
145
+
117
146
  def addReloc(ofs)
118
147
  mode(HOW_CHANGED)
119
148
  #check relocation exists
@@ -124,15 +153,9 @@ module Resedit
124
153
  end
125
154
  end
126
155
  #add relocation
127
- if freeSpace()<4
128
- addHeaderSize(4)
129
- mode(HOW_CHANGED)
130
- end
156
+ setSpaceForRelocs(@info[:NumberOfRelocations]+1)
131
157
  val = @mz.body.linear2seg(ofs)
132
- pos = @info[:RelocTableOffset]+@info[:NumberOfRelocations]*4
133
- cnt = @info[:NumberOfRelocations]
134
- change(pos, val.pack('vv'))
135
- change(6, [cnt+1].pack('v'))
158
+ setRelocation(@info[:NumberOfRelocations], val)
136
159
  return true
137
160
  end
138
161
 
@@ -153,6 +176,7 @@ module Resedit
153
176
  printf("code size: %s\n", colStr(fsz - hsz, @mz.body.changed?(0)))
154
177
  printf("reloc table size: %s\n", colStr(@info[:NumberOfRelocations] * 4, changed?(6, 2)))
155
178
  printf("free space in header: before relocs 0x%X, after relocs 0x%X\n", freeSpace(true), freeSpace())
179
+ printf("reloc fix: 0x%X\n", @relocFix)
156
180
  return true
157
181
  end
158
182
  @mz.body.mode(@mode)
@@ -167,6 +191,7 @@ module Resedit
167
191
  end
168
192
  return true
169
193
  end
194
+ return super(what, how)
170
195
  end
171
196
 
172
197
 
@@ -20,10 +20,15 @@ module Resedit
20
20
 
21
21
  def s2i(str)
22
22
  ss=str.split(':')
23
- if ss.length == 2
23
+ if ss.length == 2 || ss.length == 3
24
24
  ss[0] = '0x'+ss[0] if ss[0][0,2]!='0x'
25
25
  ss[1] = '0x'+ss[1] if ss[1][0,2]!='0x'
26
- return (s2i(ss[0]) << 4) + s2i(ss[1])
26
+ fix = 0
27
+ if ss.length == 3
28
+ raise "Dont known how to #{ss[2]} address" if ss[2]!="fix"
29
+ fix = relocFix
30
+ end
31
+ return ((s2i(ss[0])+fix) << 4) + s2i(ss[1])
27
32
  end
28
33
  return eval(str, binding())
29
34
  end
@@ -58,7 +58,7 @@ module Resedit
58
58
 
59
59
  def load(filename, count=nil)
60
60
  @lines = @formatter.loadLines(filename)
61
- raise "Wrong lines count: "+filename if count && count!=@lines.length
61
+ raise "Wrong lines count: #{filename} #{count} #{@lines.length}" if count && count!=@lines.length
62
62
  if @escaper
63
63
  nl=[]
64
64
  @lines.each {|l|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resedit
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.6'
4
+ version: '1.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - bjfn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-15 00:00:00.000000000 Z
11
+ date: 2017-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chunky_png
@@ -59,6 +59,7 @@ files:
59
59
  - lib/resedit/classes/hexwriter.rb
60
60
  - lib/resedit/convert/bitconv.rb
61
61
  - lib/resedit/convert/codepatch.rb
62
+ - lib/resedit/convert/colors.rb
62
63
  - lib/resedit/font/font.rb
63
64
  - lib/resedit/font/font_char.rb
64
65
  - lib/resedit/image/image.rb