mirror of
https://github.com/libsm64/libsm64.git
synced 2025-01-22 15:43:11 -05:00
Grabbing geo files over http instead of requiring submodule
This commit is contained in:
parent
b7d546099d
commit
f7e141bdf1
1 changed files with 25 additions and 29 deletions
|
@ -1,8 +1,10 @@
|
|||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
import shutil
|
||||
import requests
|
||||
|
||||
GEO_URL = "https://raw.githubusercontent.com/n64decomp/sm64/06ec56df7f951f88da05f468cdcacecba496145a/actors/mario/geo.inc.c"
|
||||
MODEL_URL = "https://raw.githubusercontent.com/n64decomp/sm64/06ec56df7f951f88da05f468cdcacecba496145a/actors/mario/model.inc.c"
|
||||
|
||||
geo_inc_c_header = """
|
||||
#include "../include/sm64.h"
|
||||
|
@ -44,42 +46,36 @@ geo_inc_h = """
|
|||
extern void *mario_geo_ptr;
|
||||
"""
|
||||
|
||||
anim_data_h = """
|
||||
model_inc_h = """
|
||||
#pragma once
|
||||
|
||||
extern void *mario_anims_ptr;
|
||||
"""
|
||||
|
||||
anim_data_c_footer = """
|
||||
void *mario_anims_ptr = &gMarioAnims;
|
||||
#include "../include/types.h"
|
||||
#include "../include/PR/gbi.h"
|
||||
"""
|
||||
|
||||
def main():
|
||||
os.chdir(os.path.dirname(sys.argv[0]))
|
||||
global model_inc_h
|
||||
|
||||
if os.path.exists("src/mario/geo.inc.c") and os.path.exists("src/mario/model.inc.c") \
|
||||
and os.path.exists("src/mario/geo.inc.h") and os.path.exists("src/mario/model.inc.h"):
|
||||
return;
|
||||
|
||||
shutil.rmtree("src/mario", ignore_errors=True)
|
||||
os.makedirs("src/mario", exist_ok=True)
|
||||
|
||||
geo_inc_c = ""
|
||||
model_inc_c = ""
|
||||
model_inc_h_lines = [
|
||||
"#pragma once",
|
||||
'#include "../include/types.h"',
|
||||
'#include "../include/PR/gbi.h"'
|
||||
]
|
||||
print("Downloading " + GEO_URL)
|
||||
geo_inc_c = requests.get(GEO_URL).text
|
||||
print("Downloading " + MODEL_URL)
|
||||
model_inc_c = requests.get(MODEL_URL).text
|
||||
|
||||
with open("sm64-port/actors/mario/geo.inc.c", "r") as file:
|
||||
geo_inc_c = file.read()
|
||||
lines = model_inc_c.splitlines()
|
||||
|
||||
with open("sm64-port/actors/mario/model.inc.c", "r") as file:
|
||||
lines = file.read().splitlines()
|
||||
for line in lines:
|
||||
if line.startswith("const "):
|
||||
model_inc_h += "\nextern " + line.replace(" = {", ";")
|
||||
|
||||
for line in lines:
|
||||
if line.startswith("const "):
|
||||
model_inc_h_lines.append("extern " + line.replace(" = {", ";"))
|
||||
|
||||
lines = [ x.replace("#include", "//#include") for x in lines ]
|
||||
lines.insert(0, "#include \"../model_hack.h\"")
|
||||
model_inc_c = "\n".join(lines)
|
||||
lines = [ x.replace("#include", "//#include") for x in lines ]
|
||||
lines.insert(0, "#include \"../model_hack.h\"")
|
||||
model_inc_c = "\n".join(lines)
|
||||
|
||||
with open("src/mario/geo.inc.c", "w") as file:
|
||||
file.write(geo_inc_c_header + geo_inc_c + geo_inc_c_footer)
|
||||
|
@ -88,7 +84,7 @@ def main():
|
|||
file.write(model_inc_c)
|
||||
|
||||
with open("src/mario/model.inc.h", "w") as file:
|
||||
file.write("\n".join(model_inc_h_lines))
|
||||
file.write(model_inc_h)
|
||||
|
||||
with open("src/mario/geo.inc.h", "w") as file:
|
||||
file.write(geo_inc_h)
|
||||
|
|
Loading…
Reference in a new issue