Пример #1
0
def main(rom_path):
    rom = rominfo.get_info(rom_path)
    basename = rom.name.replace(" ", "").lower()

    header = f"""
name: {rom.name.title()} ({rom.get_country_name()})
sha1: {rom.sha1}
options:
  basename: {basename}
  target_path: {rom_path.with_suffix(".z64")}
  base_path: .
  compiler: {rom.compiler}
  find_file_boundaries: True
  header_encoding: {rom.header_encoding}
  # platform: n64
  # undefined_funcs_auto_path: undefined_funcs_auto.txt
  # undefined_syms_auto_path: undefined_syms_auto.txt
  # symbol_addrs_path: symbol_addrs.txt
  # undefined_syms_path: undefined_syms.txt
  # asm_path: asm
  # src_path: src
  # build_path: build
  # extensions_path: tools/splat_ext
  # auto_all_sections: True
""".lstrip()

    with open(rom_path, "rb") as f:
        fbytes = f.read()

    first_section_end = find_code_length.run(fbytes, 0x1000, rom.entry_point)

    segments = f"""
segments:
  - name: header
    type: header
    start: 0x0
  - name: boot
    type: bin
    start: 0x40
  - name: main
    type: code
    start: 0x1000
    vram: 0x{rom.entry_point:X}
    subsegments:
      - [0x1000, asm]
  - type: bin
    start: 0x{first_section_end:X}
  - [0x{rom.size:X}]
""".lstrip()

    out_file = f"{basename}.yaml"
    with open(out_file, "w", newline="\n") as f:
        print(f"Writing config to {out_file}")
        f.write(header + segments)
Пример #2
0
def main(rom_path):
    rom = rominfo.get_info(rom_path)
    basename = rom.name.replace(" ", "").lower()

    header = f"""
name: {rom.name.title()} ({rom.get_country_name()})
sha1: {rom.sha1}
options:
  basename: {basename}
  target_path: {rom_path}
  base_path: .
  compiler: {rom.compiler}
  find_file_boundaries: True
  # platform: n64
  # undefined_funcs_auto_path: undefined_funcs_auto.txt
  # undefined_syms_auto_path: undefined_syms_auto.txt
  # symbol_addrs_path: symbol_addrs.txt
  # undefined_syms_path: undefined_syms.txt
  # asm_path: asm
  # src_path: src
  # build_path: build
  # extensions_path: tools/splat_ext
  # section_order: [.text, .data, .rodata, .bss]
""".lstrip()

    with open(rom_path, "rb") as f:
        fbytes = f.read()

    first_section_end = find_code_length.run(fbytes, 0x1000, rom.entry_point)

    segments = f"""
segments:
  - name: header
    type: header
    start: 0x0
  - name: boot
    type: bin
    start: 0x40
  - name: main
    type: code
    start: 0x1000
    vram: 0x{rom.entry_point:X}
    subsegments:
      - [0x1000, asm]
  - type: bin
    start: 0x{first_section_end:X}
  - [0x{rom.size:X}]
""".lstrip()

    with open(basename + ".yaml", "w", newline="\n") as f:
        f.write(header + segments)
Пример #3
0
def main(rom_path):
    rom = rominfo.get_info(rom_path)
    basename = rom.name.replace(" ", "").lower()

    header = \
"""name: {0} ({1})
basename: {2}
options:
  find_file_boundaries: True
  compiler: IDO
  platform: n64
  base_path: .
  target_path: baserom.z64
""".format(rom.name.title(), rom.get_country_name(), basename)

    with open(rom_path, "rb") as f:
        fbytes = f.read()

    first_section_end = find_code_length.run(fbytes, 0x1000, rom.entry_point)

    segments = \
"""segments:
  - name: header
    type: header
    start: 0x0
  - name: boot
    type: bin
    start: 0x40
  - name: main
    type: code
    start: 0x1000
    vram: 0x{:X}
    subsegments:
      - [0x1000, asm]
  - type: bin
    start: 0x{:X}
  - [0x{:X}]
""".format(rom.entry_point, first_section_end, rom.size)

    outstr = header + segments

    outname = rom.name.replace(" ", "").lower()
    with open(outname + ".yaml", "w", newline="\n") as f:
        f.write(outstr)