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 +4 -4
- data/README.md +7 -0
- data/Rakefile +8 -0
- data/lib/wolfrpg/database.rb +4 -8
- data/lib/wolfrpg/map.rb +1 -0
- data/lib/wolftrans/patch_data.rb +6 -2
- data/test/test_wolftrans.rb +34 -0
- data/wolftrans.gemspec +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc48e4d190cfaf39833cdf6018e8e81bda4db9cb
|
4
|
+
data.tar.gz: 145782eb683c76dfcf20a91ee31538afe0b8f128
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/Rakefile
ADDED
data/lib/wolfrpg/database.rb
CHANGED
@@ -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
|
-
|
161
|
-
|
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
|
-
|
168
|
-
|
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
|
data/lib/wolfrpg/map.rb
CHANGED
data/lib/wolftrans/patch_data.rb
CHANGED
@@ -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
|
-
|
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
|
data/wolftrans.gemspec
CHANGED
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.
|
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:
|