mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-20 13:23:45 -07:00
Linux/GCC Support (#28)
* Initial Linux/GCC support commit * Add instructins for linux in the README * apply suggestions by @Erotemic and @Emill * Fix python 3.10 symlink line * Fix func_80041E80 type mismatch (#3) Type mismatch functions.h:664 * Makefile: clean OTRExporter/libultraship/ZAPDTR with distclean and fix CXX_FILES * Makefile: find C/CXX_FILES automatically * Makefile: remove ugly conditions in find commands * cleanup _MSC_VER usage * fix Windows build * cleanup extraction scripts * fix Windows build * Fix Windows path separator issue * fix rumble support for linux * use glew-cmake in dockerfile * add pulseaudio backend * fix ZAPDTR linkage * Check for "soh.elf" in directory (#6) hide second button if `soh.exe` or `soh.elf` is present * Fix hardcoded segment addresses (#5) * fix condition * hack lus -> soh dep for ZAPDTR Co-authored-by: sholdee <102821812+sholdee@users.noreply.github.com> Co-authored-by: qurious-pixel <62252937+qurious-pixel@users.noreply.github.com> Co-authored-by: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com>
This commit is contained in:
parent
2e1a0b5144
commit
09432ee7f4
116 changed files with 1403 additions and 4054 deletions
53
OTRExporter/extract_baserom.py
Normal file
53
OTRExporter/extract_baserom.py
Normal file
|
@ -0,0 +1,53 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import struct
|
||||
from multiprocessing import Pool, cpu_count
|
||||
from rom_info import Z64Rom
|
||||
import rom_chooser
|
||||
|
||||
|
||||
rom = None
|
||||
|
||||
def initialize_worker(input_rom):
|
||||
global rom
|
||||
rom = input_rom
|
||||
|
||||
def ExtractFunc(i):
|
||||
|
||||
dma_file = rom.getDmaEntryByIndex(i)
|
||||
dma_data = rom.readDmaEntry(dma_file)
|
||||
|
||||
filename = '../soh/baserom/' + rom.version.file_table[i]
|
||||
print('extracting ' + filename + " (0x%08X, 0x%08X)" % (dma_file.virtStart, dma_file.virtEnd))
|
||||
|
||||
try:
|
||||
with open(filename, 'wb') as f:
|
||||
f.write(dma_data)
|
||||
except IOError:
|
||||
print('failed to write file ' + filename)
|
||||
|
||||
# TODO: handle this better
|
||||
if dma_file.compressed:
|
||||
os.system('tools/yaz0 -d ' + filename + ' ' + filename)
|
||||
|
||||
#####################################################################
|
||||
|
||||
def main():
|
||||
try:
|
||||
os.mkdir('../soh/baserom')
|
||||
except:
|
||||
pass
|
||||
|
||||
rom_path = rom_chooser.chooseROM()
|
||||
input_rom = Z64Rom(rom_path)
|
||||
|
||||
# extract files
|
||||
num_cores = cpu_count()
|
||||
print("Extracting baserom with " + str(num_cores) + " CPU cores.")
|
||||
with Pool(num_cores, initialize_worker, (input_rom,)) as p:
|
||||
p.map(ExtractFunc, range(len(input_rom.version.file_table)))
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue