gbtiles 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +22 -35
- data/bin/gbt +24 -0
- data/lib/gbtiles/gbm/cli/convert.rb +9 -1
- data/lib/gbtiles/gbm/export/asm/asm.h.erb +1 -1
- data/lib/gbtiles/gbm/export/asm/asm.rb +3 -0
- data/lib/gbtiles/gbm/export/asm/asm.s.erb +1 -1
- data/lib/gbtiles/gbm/import/gbm_file.rb +1 -1
- data/lib/gbtiles/gbm/map/objects/map_tile_data.rb +1 -3
- data/lib/gbtiles/gbr/cli/convert.rb +9 -1
- data/lib/gbtiles/gbr/export/asm/asm.h.erb +1 -1
- data/lib/gbtiles/gbr/export/asm/asm.rb +3 -0
- data/lib/gbtiles/gbr/export/asm/asm.s.erb +1 -1
- data/lib/gbtiles/gbr/import/gbr_file.rb +1 -1
- data/lib/gbtiles/gbr/tile_set/objects/tile_data.rb +1 -1
- data/lib/gbtiles/gbt/cli/convert.rb +58 -0
- data/lib/gbtiles/gbt/export/asm/asm.h.erb +11 -0
- data/lib/gbtiles/gbt/export/asm/asm.rb +63 -0
- data/lib/gbtiles/gbt/export/asm/asm.s.erb +20 -0
- data/lib/gbtiles/gbt/export/asm/channel.rb +156 -0
- data/lib/gbtiles/gbt/export/asm/channels/noise.rb +84 -0
- data/lib/gbtiles/gbt/export/asm/channels/pulse.rb +88 -0
- data/lib/gbtiles/gbt/export/asm/channels/wav.rb +105 -0
- data/lib/gbtiles/gbt/export/asm/converter.rb +37 -0
- data/lib/gbtiles/gbt/export/asm/effects/arpeggio.rb +16 -0
- data/lib/gbtiles/gbt/export/asm/effects/break_and_set_step.rb +16 -0
- data/lib/gbtiles/gbt/export/asm/effects/cut_note.rb +16 -0
- data/lib/gbtiles/gbt/export/asm/effects/jump.rb +16 -0
- data/lib/gbtiles/gbt/export/asm/effects/pan.rb +19 -0
- data/lib/gbtiles/gbt/export/asm/effects/speed.rb +22 -0
- data/lib/gbtiles/gbt/export/asm/effects/volume.rb +13 -0
- data/lib/gbtiles/gbt/import/mod_file.rb +65 -0
- data/lib/gbtiles/gbt/mod_data/mod_data.rb +21 -0
- data/lib/gbtiles/gbt/mod_data/pattern.rb +16 -0
- data/lib/gbtiles/gbt/mod_data/sample.rb +16 -0
- data/lib/gbtiles/helpers/data_type.rb +11 -0
- data/lib/gbtiles/version.rb +1 -1
- metadata +32 -38
@@ -0,0 +1,19 @@
|
|
1
|
+
module GBTiles
|
2
|
+
module GBT
|
3
|
+
module Export
|
4
|
+
module ASM
|
5
|
+
module Effects
|
6
|
+
def effect_pan
|
7
|
+
left = effect_param_2.between?(0, 11) ? 1 : 0
|
8
|
+
right = effect_param_2.between?(4, 15) ? 1 : 0
|
9
|
+
|
10
|
+
{
|
11
|
+
:number => 0,
|
12
|
+
:params => (left << (3 + channel_number)) | (right << (channel_number - 1))
|
13
|
+
}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module GBTiles
|
2
|
+
module GBT
|
3
|
+
module Export
|
4
|
+
module ASM
|
5
|
+
module Effects
|
6
|
+
def effect_speed
|
7
|
+
speed = effect_param
|
8
|
+
|
9
|
+
if speed > 0x1F then
|
10
|
+
throw "Unsupported BPM speed effect: #{speed}"
|
11
|
+
end
|
12
|
+
|
13
|
+
{
|
14
|
+
:number => 10,
|
15
|
+
:params => convert_speed(speed)
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require "gbtiles/helpers/fixnum"
|
2
|
+
|
3
|
+
require "gbtiles/gbt/mod_data/mod_data"
|
4
|
+
require "gbtiles/gbt/mod_data/sample"
|
5
|
+
require "gbtiles/gbt/mod_data/pattern"
|
6
|
+
|
7
|
+
module GBTiles
|
8
|
+
module GBT
|
9
|
+
module Import
|
10
|
+
class MODFile
|
11
|
+
|
12
|
+
attr_accessor :mod_data
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
@mod_data = GBTiles::GBT::MODData::MODData.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.open file
|
19
|
+
import = GBTiles::GBT::Import::MODFile.new
|
20
|
+
|
21
|
+
import.mod_data.name = GBTiles::DataType.string(file.read(20))
|
22
|
+
|
23
|
+
for i in 0..30
|
24
|
+
sample_data = file.read(30)
|
25
|
+
|
26
|
+
sample = GBTiles::GBT::MODData::Sample.new
|
27
|
+
sample.name = GBTiles::DataType.string!(sample_data, 22)
|
28
|
+
sample.length = GBTiles::DataType.bword!(sample_data)
|
29
|
+
sample.finetune = GBTiles::DataType.byte!(sample_data)
|
30
|
+
sample.volume = GBTiles::DataType.byte!(sample_data)
|
31
|
+
sample.repeat_point = GBTiles::DataType.bword!(sample_data)
|
32
|
+
sample.repeat_length = GBTiles::DataType.bword!(sample_data)
|
33
|
+
|
34
|
+
import.mod_data.samples << sample
|
35
|
+
end
|
36
|
+
|
37
|
+
import.mod_data.song_length = GBTiles::DataType.byte(file.read(1))
|
38
|
+
file.read(1) # unused
|
39
|
+
|
40
|
+
for i in 0..127
|
41
|
+
import.mod_data.pattern_table << GBTiles::DataType.byte(file.read(1))
|
42
|
+
end
|
43
|
+
|
44
|
+
import.mod_data.identifier = GBTiles::DataType.string(file.read(4))
|
45
|
+
|
46
|
+
for i in 0..63
|
47
|
+
pattern = GBTiles::GBT::MODData::Pattern.new
|
48
|
+
|
49
|
+
for j in 0..63
|
50
|
+
pattern.rows << file.read(16)
|
51
|
+
end
|
52
|
+
|
53
|
+
import.mod_data.patterns << pattern
|
54
|
+
end
|
55
|
+
|
56
|
+
if import.mod_data.identifier != "M.K." then
|
57
|
+
raise IOError, "Invalid identifier in .MOD: expected `M.K.` got `#{import.mod_data.identifier}`"
|
58
|
+
end
|
59
|
+
|
60
|
+
import
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module GBTiles
|
2
|
+
module GBT
|
3
|
+
module MODData
|
4
|
+
class MODData
|
5
|
+
|
6
|
+
attr_accessor :name
|
7
|
+
attr_accessor :samples
|
8
|
+
attr_accessor :song_length
|
9
|
+
attr_accessor :pattern_table
|
10
|
+
attr_accessor :identifier
|
11
|
+
attr_accessor :patterns
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
@samples = []
|
15
|
+
@pattern_table = []
|
16
|
+
@patterns = []
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module GBTiles
|
2
|
+
module GBT
|
3
|
+
module MODData
|
4
|
+
class Sample
|
5
|
+
|
6
|
+
attr_accessor :name
|
7
|
+
attr_accessor :length
|
8
|
+
attr_accessor :finetune
|
9
|
+
attr_accessor :volume
|
10
|
+
attr_accessor :repeat_point
|
11
|
+
attr_accessor :repeat_length
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -77,5 +77,16 @@ module GBTiles
|
|
77
77
|
def self.long! src
|
78
78
|
self.long(src.slice!(0, 4))
|
79
79
|
end
|
80
|
+
|
81
|
+
# BWORD
|
82
|
+
# BIG ENDIAN
|
83
|
+
# 2 BYTES
|
84
|
+
def self.bword src
|
85
|
+
src.slice(0, 2).unpack("n*")[0]
|
86
|
+
end
|
87
|
+
|
88
|
+
def self.bword! src
|
89
|
+
self.bword(src.slice!(0, 2))
|
90
|
+
end
|
80
91
|
end
|
81
92
|
end
|
data/lib/gbtiles/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gbtiles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bashkim Isai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: '2.13'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: '2.13'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,41 +38,14 @@ dependencies:
|
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 3.3.0
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
requirements:
|
45
|
-
- - '='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 0.10.0
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - '='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 0.10.0
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: codeclimate-test-reporter
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
description: 'Allows files created by Harry Mulder''s Game Boy Map Builder and Game
|
70
|
-
Boy Tile Designer to be converted in to different file formats for use in Game Boy
|
71
|
-
game development (e.g.: with GBDK)'
|
41
|
+
description: Allows files created with Harry Mulder's Game Boy Map Builder and Game
|
42
|
+
Boy Tile Designer to be converted for use in Game Boy game development. Also allows
|
43
|
+
.MOD tracker files to be converted for use with AntonioND's GBT Player.
|
72
44
|
email:
|
73
45
|
executables:
|
74
46
|
- gbr
|
75
47
|
- gbm
|
48
|
+
- gbt
|
76
49
|
extensions: []
|
77
50
|
extra_rdoc_files: []
|
78
51
|
files:
|
@@ -80,6 +53,7 @@ files:
|
|
80
53
|
- README.md
|
81
54
|
- bin/gbm
|
82
55
|
- bin/gbr
|
56
|
+
- bin/gbt
|
83
57
|
- lib/gbtiles/gbm/cli/convert.rb
|
84
58
|
- lib/gbtiles/gbm/export/asm/asm.h.erb
|
85
59
|
- lib/gbtiles/gbm/export/asm/asm.rb
|
@@ -116,6 +90,26 @@ files:
|
|
116
90
|
- lib/gbtiles/gbr/tile_set/sgb_palettes.rb
|
117
91
|
- lib/gbtiles/gbr/tile_set/split_order.rb
|
118
92
|
- lib/gbtiles/gbr/tile_set/tile_set.rb
|
93
|
+
- lib/gbtiles/gbt/cli/convert.rb
|
94
|
+
- lib/gbtiles/gbt/export/asm/asm.h.erb
|
95
|
+
- lib/gbtiles/gbt/export/asm/asm.rb
|
96
|
+
- lib/gbtiles/gbt/export/asm/asm.s.erb
|
97
|
+
- lib/gbtiles/gbt/export/asm/channel.rb
|
98
|
+
- lib/gbtiles/gbt/export/asm/channels/noise.rb
|
99
|
+
- lib/gbtiles/gbt/export/asm/channels/pulse.rb
|
100
|
+
- lib/gbtiles/gbt/export/asm/channels/wav.rb
|
101
|
+
- lib/gbtiles/gbt/export/asm/converter.rb
|
102
|
+
- lib/gbtiles/gbt/export/asm/effects/arpeggio.rb
|
103
|
+
- lib/gbtiles/gbt/export/asm/effects/break_and_set_step.rb
|
104
|
+
- lib/gbtiles/gbt/export/asm/effects/cut_note.rb
|
105
|
+
- lib/gbtiles/gbt/export/asm/effects/jump.rb
|
106
|
+
- lib/gbtiles/gbt/export/asm/effects/pan.rb
|
107
|
+
- lib/gbtiles/gbt/export/asm/effects/speed.rb
|
108
|
+
- lib/gbtiles/gbt/export/asm/effects/volume.rb
|
109
|
+
- lib/gbtiles/gbt/import/mod_file.rb
|
110
|
+
- lib/gbtiles/gbt/mod_data/mod_data.rb
|
111
|
+
- lib/gbtiles/gbt/mod_data/pattern.rb
|
112
|
+
- lib/gbtiles/gbt/mod_data/sample.rb
|
119
113
|
- lib/gbtiles/helpers/data_type.rb
|
120
114
|
- lib/gbtiles/helpers/fixnum.rb
|
121
115
|
- lib/gbtiles/version.rb
|
@@ -143,5 +137,5 @@ rubyforge_project:
|
|
143
137
|
rubygems_version: 2.4.6
|
144
138
|
signing_key:
|
145
139
|
specification_version: 4
|
146
|
-
summary: Converts .GBR and .
|
140
|
+
summary: Converts .GBR, .GBM and .MOD files to different Game Boy formats
|
147
141
|
test_files: []
|