No commit activity in last 3 years
No release in over 3 years
Builder interface for the HSDArc file format used in Fire Emblem Heroes.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.16
~> 5.0
~> 10.0
 Project Readme

feh-hsdarcwriter

Feh::HSDArcWriter is an interface for generating files in the HSDArc file format used by Fire Emblem Heroes.

Installation

$ gem install feh-hsdarcwriter

Example

The following script generates an HSDArc file equivalent to assets/Common/SRPG/Move.bin as of FEH version 2.9.1:

#!/usr/bin/env ruby

require 'feh/hsdarc_writer'

MVMTS = [
  {id_tag: 'MVID_歩行', range: 2, costs: [
     1,  1,  1,  2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  1,
     1,  2,  1, -1, -1, -1,  1,  1,  1,  1, -1,  1,  1,  1,  1,  1,
     1, -1, -1]},
  {id_tag: 'MVID_重装', range: 1, costs: [
     1,  1,  1,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  1,
     1,  1,  1, -1, -1, -1,  1,  1,  1,  1, -1,  1,  1,  1,  1,  1,
     1, -1, -1]},
  {id_tag: 'MVID_騎馬', range: 3, costs: [
     1,  1,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  1,
     1, -1,  1, -1, -1, -1,  3,  3,  3,  3, -1,  1,  1,  1,  1,  1,
     1, -1, -1]},
  {id_tag: 'MVID_飛行', range: 2, costs: [
     1,  1,  1,  1,  1,  1,  1,  1, -1, -1, -1, -1, -1, -1, -1,  1,
     1,  1,  1, -1, -1, -1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
     1, -1, -1]},
]

writer = Feh::HSDArcWriter.new
writer.ptr do |blk|
  MVMTS.each_with_index do |mvmt, index|
    blk.string(mvmt[:id_tag], Feh::HSDArcWriter::XORKeys::ID_XORKEY)
    blk.ptr {|costs| costs.i8(mvmt[:costs], 0xB8)}
    blk.i32(index, 0xD5025852)
    blk.i8(mvmt[:range], 0x80)
  end
end
writer.i64(MVMTS.size, 0x20A10C408924170E)

IO.binwrite('Move.bin', writer.hsdarc.pack('c*'))

# if Feh::Bin is available:
# require 'feh/bin'
# IO.binwrite('Move.bin.lz', Feh::Bin.compress(writer.hsdarc).pack('c*'))

Changelog

V0.1.2

  • Fixed an issue where the relocatable pointer list uses 32-bit integers on Windows installations

V0.1.1

  • Feh::HSDArcWriter#string now accepts a nil string and writes a null pointer

V0.1.0

  • Initial release

License

The gem is available as open source under the terms of the MIT License.