Class: Lignite::RbfObject

Inherits:
Object
  • Object
show all
Includes:
Bytes
Defined in:
lib/lignite/rbf_object.rb

Overview

Part of an assembled RBF file

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Bytes

#f32, #hexdump, #u16, #u32, #u8, #unpack_u16, #unpack_u32, #unpack_u8

Constructor Details

#initialize(owner:, triggers:, local_bytes:, body:) ⇒ RbfObject



17
18
19
20
21
22
# File 'lib/lignite/rbf_object.rb', line 17

def initialize(owner:, triggers:, local_bytes:, body:)
  @owner = owner
  @triggers = triggers
  @local_bytes = local_bytes
  @body = body
end

Class Method Details

.block(owner:, triggers:, body:) ⇒ Object



13
14
15
# File 'lib/lignite/rbf_object.rb', line 13

def self.block(owner:, triggers:, body:)
  new(owner: owner, triggers: triggers, local_bytes: 0, body: body)
end

.subcall(body:, local_bytes:) ⇒ Object



9
10
11
# File 'lib/lignite/rbf_object.rb', line 9

def self.subcall(body:, local_bytes:)
  new(owner: 0, triggers: 1, local_bytes: local_bytes, body: body)
end

.vmthread(body:, local_bytes:) ⇒ Object



5
6
7
# File 'lib/lignite/rbf_object.rb', line 5

def self.vmthread(body:, local_bytes:)
  new(owner: 0, triggers: 0, local_bytes: local_bytes, body: body)
end

Instance Method Details

#bodyObject



29
30
31
# File 'lib/lignite/rbf_object.rb', line 29

def body
  @body
end

#header(pos_before_header = 0) ⇒ Object



24
25
26
27
# File 'lib/lignite/rbf_object.rb', line 24

def header(pos_before_header = 0)
  u32(pos_before_header + 12) + # size of header
    u16(@owner) + u16(@triggers) + u32(@local_bytes)
end