wolftrans 0.0.1 → 0.0.2

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: dc87ca962d608023cacf946fac75ea7bf4a08bcb
4
- data.tar.gz: 95d94b2876140ff4449d6cff54e0130836e3763a
3
+ metadata.gz: cc48e4d190cfaf39833cdf6018e8e81bda4db9cb
4
+ data.tar.gz: 145782eb683c76dfcf20a91ee31538afe0b8f128
5
5
  SHA512:
6
- metadata.gz: 8b2202a5152b3a32cb2e8fbf8127fd00edbc4df7c654a7aec562ea77c7297bbcb2f27c292a80986c720b2778726b1b84ee34b248a21a8c1a95db273cdafdec2a
7
- data.tar.gz: 9fdb93b8c4388a12611d21de0387e8a7b81f3f0d8d7113a8623625d56db2cc99aa2cabeb8822709543681bcb6bc2392474076a3eb8f1c3408f7780e8acb886b9
6
+ metadata.gz: 569e7ce66fe6503d8d2c08a7bdadfb36a86687cdf23688ba8cd712c34383a763c56e27e8641812402dc1d9f956314d0e26c591058f7405740143a7f5e53e61fc
7
+ data.tar.gz: 6390d794310b3aa6fb0f23a4cf499e6bba638a5f84659e0eb5dd30ba2265371630ba4b5c61b7db4c3421a01c08cb48585fd9dde9a2c2b1619bda72dafac4bb24
data/README.md CHANGED
@@ -6,6 +6,13 @@
6
6
  Wolf Trans is a set of tools to aid in the translation of games made using
7
7
  [Wolf RPG Editor](http://www.silversecond.com/WolfRPGEditor/). The syntax and functionality is inspired primarily by the [RPG Maker Trans](http://rpgmakertrans.bitbucket.org/) project.
8
8
 
9
+ ## Installation
10
+ Installation is as easy as typing this command in your terminal:
11
+
12
+ gem install wolftrans
13
+
14
+ If you are using Windows, you will need to have Ruby installed first. You can download it from [here](http://rubyinstaller.org/downloads/).
15
+
9
16
  ## Example
10
17
  The source code for the translation patch file used in the sample image above is the following:
11
18
 
@@ -0,0 +1,8 @@
1
+ require 'rake/testtask'
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs << 'test'
5
+ end
6
+
7
+ desc 'Run tests'
8
+ task :default => :test
@@ -157,17 +157,13 @@ module WolfRpg
157
157
  def read_dat(file)
158
158
  IO.verify(file, DAT_TYPE_SEPARATOR)
159
159
  @unknown1 = IO.read_int(file)
160
- num_fields = IO.read_int(file)
161
- unless num_fields == @fields.size
162
- raise "database project and dat Field count mismatch (#{@fields.size} vs. #{num_fields})"
163
- end
160
+ fields_size = IO.read_int(file)
161
+ @fields = @fields[0, fields_size] if fields_size != @fields.size
164
162
  @fields.each do |field|
165
163
  field.read_dat(file)
166
164
  end
167
- num_data = IO.read_int(file)
168
- unless num_data == @data.size
169
- raise "database project and dat Field count mismatch (#{@data.size} vs. #{num_data})"
170
- end
165
+ data_size = IO.read_int(file)
166
+ @data = @data[0, data_size] if data_size != @data.size
171
167
  @data.each do |datum|
172
168
  datum.read_dat(file, @fields)
173
169
  end
@@ -51,6 +51,7 @@ module WolfRpg
51
51
  IO.write_int(file, @events.size)
52
52
  IO.write(file, @tiles)
53
53
  @events.each do |event|
54
+ next unless event
54
55
  IO.write_byte(file, 0x6F)
55
56
  event.dump(file)
56
57
  end
@@ -63,6 +63,7 @@ module WolfTrans
63
63
  FileUtils.mkdir_p("#{out_data_dir}/MapData")
64
64
  @maps.each do |map_name, map|
65
65
  map.events.each do |event|
66
+ next unless event
66
67
  event.pages.each do |page|
67
68
  page.commands.each_with_index do |command, cmd_index|
68
69
  context = Context::MapEvent.from_data(map_name, event, page, cmd_index, command)
@@ -110,6 +111,7 @@ module WolfTrans
110
111
  'BattleEffect',
111
112
  'CharaChip',
112
113
  'EnemyGraphic',
114
+ 'Fog',
113
115
  'Fog_BackGround',
114
116
  'MapChip',
115
117
  'Picture',
@@ -145,6 +147,7 @@ module WolfTrans
145
147
 
146
148
  map = WolfRpg::Map.new(filename)
147
149
  map.events.each do |event|
150
+ next unless event
148
151
  event.pages.each do |page|
149
152
  page.commands.each_with_index do |command, cmd_index|
150
153
  strings_of_command(command) do |string|
@@ -314,7 +317,6 @@ module WolfTrans
314
317
 
315
318
  def copy_data_files_from(src_data_dir, out_data_dir, dirname, extensions)
316
319
  out_dir = File.join(out_data_dir, dirname)
317
- FileUtils.mkdir_p(out_dir)
318
320
 
319
321
  Find.find(src_data_dir) do |path|
320
322
  if dirname.empty?
@@ -334,7 +336,9 @@ module WolfTrans
334
336
  next unless extensions.include? File.extname(basename)[1..-1]
335
337
  next if @file_blacklist.include? "data/#{dirname.downcase}/#{basename.downcase}"
336
338
  out_name = "#{out_dir}/#{basename}"
337
- FileUtils.cp(path, out_name) unless File.exist? out_name
339
+ next if File.exist? out_name
340
+ FileUtils.mkdir_p(out_dir)
341
+ FileUtils.cp(path, out_name)
338
342
  end
339
343
  end
340
344
  end
@@ -0,0 +1,34 @@
1
+ require 'wolftrans'
2
+ require 'tmpdir'
3
+ require 'open3'
4
+
5
+ # Attempt to generate patches from any games found in the test directory.
6
+
7
+ # https://stackoverflow.com/questions/11784109/detecting-operating-systems-in-ruby
8
+ def run_exe(filename)
9
+ if RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
10
+ cmd = [filename]
11
+ else
12
+ cmd = ['env', 'LC_CTYPE=ja_JP.UTF-8', 'wine', filename]
13
+ end
14
+ Open3.popen3(*cmd) do |stdin, stdout, stderr, thread|
15
+ thread.join
16
+ end
17
+ end
18
+
19
+ TEST_DIR = File.dirname(__FILE__)
20
+ Dir.entries(TEST_DIR).sort.each do |entry|
21
+ # Skip all non-directories
22
+ next if entry == '.' || entry == '..'
23
+ path = "#{TEST_DIR}/#{entry}"
24
+ next unless File.directory? path
25
+
26
+ # Attempt to generate a patch from this game
27
+ Dir.mktmpdir do |tmpdir|
28
+ patch_dir = "#{tmpdir}/patch"
29
+ out_dir = "#{tmpdir}/out"
30
+ puts "==Attempting '#{entry}'"
31
+ WolfTrans::Patch.new(path, patch_dir).apply(out_dir)
32
+ run_exe("#{out_dir}/Game.exe")
33
+ end
34
+ end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'wolftrans'
4
- s.version = '0.0.1'
4
+ s.version = '0.0.2'
5
5
  s.date = '2015-09-14'
6
6
  s.summary = 'A utility to translate Wolf RPG Editor games'
7
7
  s.description = s.summary
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wolftrans
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathew Velasquez
@@ -19,6 +19,7 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - LICENSE
21
21
  - README.md
22
+ - Rakefile
22
23
  - bin/wolftrans
23
24
  - lib/wolfrpg.rb
24
25
  - lib/wolfrpg/command.rb
@@ -32,6 +33,7 @@ files:
32
33
  - lib/wolftrans/context.rb
33
34
  - lib/wolftrans/patch_data.rb
34
35
  - lib/wolftrans/patch_text.rb
36
+ - test/test_wolftrans.rb
35
37
  - wolftrans.gemspec
36
38
  homepage: http://mathew.link/
37
39
  licenses: