Debug timing of the load sequence
This commit is contained in:
parent
29b1ca27c3
commit
93ba9e644b
|
@ -63,9 +63,11 @@ func load_snes_structs(buffer: StreamPeerBuffer) -> Dictionary:
|
|||
data.job_levels.append(ability_list)
|
||||
return data
|
||||
|
||||
var load_start_tick := 0
|
||||
func _on_loader_loading_stage_updated(stage: String, loader: String) -> void:
|
||||
var output := '%s: %s' % [loader, stage]
|
||||
print(output)
|
||||
#print(Time.get_time_string_from_system() + ' ' + output)
|
||||
print('@%dms - %s' % [Time.get_ticks_msec() - load_start_tick, output])
|
||||
emit_signal('loading_stage_updated', output)
|
||||
yield(get_tree(), 'idle_frame')
|
||||
|
||||
|
@ -74,6 +76,7 @@ func _load_snes_audio(data_and_buffer: Array):
|
|||
SoundLoader.parse_rom(data_and_buffer[0], data_and_buffer[1])
|
||||
|
||||
func load_snes_rom_from_bytes(bytes: PoolByteArray) -> void:
|
||||
load_start_tick = Time.get_ticks_msec()
|
||||
if (len(bytes) % 1024) == 512: # Naive header strip
|
||||
bytes = bytes.subarray(512, -1)
|
||||
self.snes_bytes = bytes
|
||||
|
@ -86,7 +89,7 @@ func load_snes_rom_from_bytes(bytes: PoolByteArray) -> void:
|
|||
# Give this its own buffer if threaded, avoid file pointer conflicts
|
||||
var _thread_error = thread.start(self, '_load_snes_audio', [self.snes_data, self.snes_buffer.duplicate()])
|
||||
else:
|
||||
self._load_snes_audio([self.snes_data, self.snes_buffer])
|
||||
yield(self._load_snes_audio([self.snes_data, self.snes_buffer]), 'completed')
|
||||
yield(_on_loader_loading_stage_updated('Loading strings', 'StringLoader'), 'completed')
|
||||
StringLoader.connect('loading_stage_updated', self, '_on_loader_loading_stage_updated', ['StringLoader'])
|
||||
yield(StringLoader.load_snes_rom(self.snes_buffer, true), 'completed')
|
||||
|
|
|
@ -99,6 +99,7 @@ func _load_block(block_name: String, buffer: StreamPeerBuffer, is_RPGe: bool = f
|
|||
self.tables[block_name] = strings
|
||||
|
||||
func load_snes_rom(buffer: StreamPeerBuffer, is_RPGe: bool = false) -> void:
|
||||
emit_signal('loading_stage_updated', 'load_snes_rom called')
|
||||
for block_name in SNES_block_addresses:
|
||||
emit_signal('loading_stage_updated', 'Loading string block "%s"'%block_name)
|
||||
yield(get_tree(), 'idle_frame')
|
||||
|
|
Loading…
Reference in New Issue