mirror of
https://github.com/zeldaret/st
synced 2026-05-23 06:54:21 -04:00
make it build (and get wibo update from ph)
This commit is contained in:
@@ -12,3 +12,4 @@ objdiff.json
|
||||
/dsd.pdb
|
||||
build.ninja
|
||||
.ninja_log
|
||||
/wibo
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef _C_STRLIB_H
|
||||
#define _C_STRLIB_H
|
||||
|
||||
int abs(int n);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef _C_STRING_H
|
||||
#define _C_STRING_H
|
||||
|
||||
typedef unsigned int size_t;
|
||||
|
||||
size_t strlen(const char *str);
|
||||
char *strcpy(char *dest, const char *src);
|
||||
char *strncpy(char *dest, const char *src, size_t num);
|
||||
char *strcat(char *dest, const char *src);
|
||||
int strcmp(char *str1, char *str2);
|
||||
int strncmp(char *str1, char *str2, size_t num);
|
||||
const char *strchr(const char *str, char ch);
|
||||
const char *strstr(const char *str1, const char *str2);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
typedef struct DestructorChain {
|
||||
/* 0 */ struct DestructorChain *next;
|
||||
/* 4 */ void *destructor;
|
||||
/* 8 */ void *object;
|
||||
/* c */
|
||||
} DestructorChain;
|
||||
|
||||
void *__register_global_object(void *object, void *destructor, DestructorChain *link);
|
||||
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
namespace std {
|
||||
template <class T> class vector {
|
||||
public:
|
||||
T *elements;
|
||||
int size;
|
||||
int capacity;
|
||||
};
|
||||
} // namespace std
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "global_destructor_chain.h"
|
||||
|
||||
#define CALL_DTOR(dtor, obj) (((void (*)(void *, int))(dtor))((obj), -1))
|
||||
|
||||
DestructorChain *__global_destructor_chain;
|
||||
|
||||
void *__register_global_object(void *object, void *destructor, DestructorChain *link) {
|
||||
link->next = __global_destructor_chain;
|
||||
link->destructor = destructor;
|
||||
link->object = object;
|
||||
|
||||
__global_destructor_chain = link;
|
||||
return object;
|
||||
}
|
||||
+20
-3
@@ -10,7 +10,7 @@ import ninja_syntax
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(description="Generates build.ninja")
|
||||
parser.add_argument('-w', type=str, default="wine", dest="wine", required=False, help="Path to Wine (linux only)")
|
||||
parser.add_argument('-w', type=str, default="./wibo", dest="wine", required=False, help="Path to Wine/Wibo (linux only)")
|
||||
parser.add_argument('version', help='Game version')
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -18,7 +18,7 @@ args = parser.parse_args()
|
||||
# Config
|
||||
GAME = "st"
|
||||
MWCC_VERSION = "2.0/sp1p5"
|
||||
DECOMP_ME_COMPILER = "mwcc_40_1051"
|
||||
DECOMP_ME_COMPILER = "mwcc_30_131"
|
||||
CC_FLAGS = " ".join([
|
||||
"-O4,p", # Optimize maximally for performance
|
||||
"-enum int", # Use int-sized enums
|
||||
@@ -27,11 +27,12 @@ CC_FLAGS = " ".join([
|
||||
"-proc arm946e", # Target processor
|
||||
"-gccext,on", # Enable GCC extensions
|
||||
"-fp soft", # Compute float operations in software
|
||||
"-inline on,noauto", # Inline only functions marked with 'inline'
|
||||
"-inline noauto", # Inline only functions marked with 'inline'
|
||||
"-lang=c++", # Set language to C++
|
||||
"-Cpp_exceptions off", # Disable C++ exceptions
|
||||
"-RTTI off", # Disable runtime type information
|
||||
"-interworking", # Enable ARM/Thumb interworking
|
||||
"-w off", # Disable warnings
|
||||
"-sym on", # Debug info, including line numbers
|
||||
"-gccinc", # Interpret #include "..." and #include <...> equally
|
||||
"-nolink", # Do not link
|
||||
@@ -179,6 +180,12 @@ def main():
|
||||
)
|
||||
n.newline()
|
||||
|
||||
n.rule(
|
||||
name="sha1",
|
||||
command=f"{PYTHON} tools/sha1.py $in -c $sha1_file"
|
||||
)
|
||||
n.newline()
|
||||
|
||||
game_build = build_path / game_version
|
||||
game_extract = extract_path / game_version
|
||||
|
||||
@@ -249,6 +256,16 @@ def add_mwld_and_rom_builds(n: ninja_syntax.Writer, game_build: Path, game_confi
|
||||
)
|
||||
n.newline()
|
||||
|
||||
n.build(
|
||||
inputs=rom_file,
|
||||
rule="sha1",
|
||||
variables={
|
||||
"sha1_file": str(Path(rom_file).with_suffix(".sha1"))
|
||||
},
|
||||
outputs="sha1",
|
||||
)
|
||||
n.newline()
|
||||
|
||||
|
||||
def add_mwcc_builds(n: ninja_syntax.Writer, game_version: str, game_build: Path, mwcc_implicit: list[Path]):
|
||||
for source_file in get_c_cpp_files([src_path, libs_path]):
|
||||
|
||||
+15
-3
@@ -3,9 +3,10 @@ import zipfile
|
||||
import io
|
||||
from pathlib import Path
|
||||
import platform
|
||||
import stat
|
||||
|
||||
|
||||
DSD_VERSION = 'v0.3.2'
|
||||
DSD_VERSION = 'v0.4.0'
|
||||
WIBO_VERSION = '0.6.16'
|
||||
|
||||
|
||||
tools_path = Path(__file__).parent
|
||||
@@ -31,11 +32,22 @@ match platform.machine().lower():
|
||||
|
||||
print('\nInstalling dsd...')
|
||||
response = requests.get(f'https://github.com/AetiasHax/ds-decomp/releases/download/{DSD_VERSION}/dsd-{system}-{machine}{EXE}')
|
||||
with open(root_path / f'dsd{EXE}', 'wb') as f:
|
||||
dsd_path = root_path / f'dsd{EXE}'
|
||||
with open(dsd_path, 'wb') as f:
|
||||
f.write(response.content)
|
||||
dsd_path.chmod(dsd_path.stat().st_mode | stat.S_IEXEC)
|
||||
|
||||
|
||||
print('\nInstalling toolchain...')
|
||||
response = requests.get('http://decomp.aetias.com/files/mwccarm.zip')
|
||||
zip_file = zipfile.ZipFile(io.BytesIO(response.content))
|
||||
zip_file.extractall(tools_path)
|
||||
|
||||
|
||||
if system == "linux":
|
||||
print('\nInstalling wibo...')
|
||||
response = requests.get(f'https://github.com/decompals/wibo/releases/download/{WIBO_VERSION}/wibo')
|
||||
wibo_path = root_path / 'wibo'
|
||||
with open(wibo_path, 'wb') as f:
|
||||
f.write(response.content)
|
||||
wibo_path.chmod(wibo_path.stat().st_mode | stat.S_IEXEC)
|
||||
|
||||
Reference in New Issue
Block a user