MCPcopy Create free account
hub / github.com/C3RV1/UndertaleNDS / write_string

Method write_string

tools/binary.py:347–361  ·  view source on GitHub ↗
(self, string: AnyStr, size: Optional[int] = None,
                     encoding: Optional[str] = "shift_jis", pad: Optional[bytes] = b"\0")

Source from the content-addressed store, hash-verified

345 self.write_struct("d", x)
346
347 def write_string(self, string: AnyStr, size: Optional[int] = None,
348 encoding: Optional[str] = "shift_jis", pad: Optional[bytes] = b"\0"):
349 if encoding and isinstance(string, str):
350 string = string.encode(encoding)
351 if size:
352 self.write(string[:size])
353 if len(string) < size:
354 self.write(pad * (size - len(string)))
355 else:
356 if len(string) > 0:
357 if string[-1] != pad:
358 string += pad
359 else:
360 string += pad
361 self.write(string)
362
363 def write_int24(self, x: int):
364 self.write(struct.pack("i", x)[:3])

Callers 13

write_string_arrayMethod · 0.95
convertFunction · 0.95
debugMethod · 0.80
load_textureMethod · 0.80
set_animationMethod · 0.80
dialogue_centeredMethod · 0.80
dialogue_left_alignMethod · 0.80
start_battleMethod · 0.80
start_bgmMethod · 0.80
play_sfxMethod · 0.80
writeMethod · 0.80
writeMethod · 0.80

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected