diff --git a/README.md b/README.md index 0bb2d95f..d53d1b8b 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,11 @@ A decompilation of Super Mario Galaxy 1. The end goal is to be as close to 1:1 t Ensure you have CodeWarrior in your $PATH enviornment. After you have it, just run the python script: ``` -python build.py +python build.py [flags] ``` +Use the -force flag to force a compile without checking for hashes. Use this if you change a header but not any source file. + If you do not have CodeWarrior in $PATH, stick the executables into a folder on the root named "tools". If it successfully builds, all of the binaries are located in the "build" folder. \ No newline at end of file diff --git a/build.py b/build.py index 2fc42469..fee4bb00 100644 --- a/build.py +++ b/build.py @@ -6,6 +6,7 @@ import os from pathlib import Path numFilesCompiled = 0 +forceCompile = False def isCmdAvailable(cmd): test_cmd = "which" if platform.system() != "Windows" else "where" @@ -70,6 +71,9 @@ def checkAndPerformAppend(filename): return False +if "-force" in sys.argv: + forceCompile = True + flags = "-i . -I- -i include -nostdinc -Cpp_exceptions off -O2 -proc gekko -fp hard -enum int -sdata 0 -sdata2 0 -g" as_flags = "-i . -I- -nostdinc -proc gekko -d __MWERKS__" @@ -98,7 +102,7 @@ assembly_files = [f for f in glob.glob(path + "**/*.s", recursive=True)] for f in cpp_files: file_name = Path(f).stem - if checkAndPerformAppend(f): + if checkAndPerformAppend(f) and forceCompile == False: continue print(f"Compiling {file_name}.cpp...") @@ -111,7 +115,7 @@ for f in cpp_files: for f in c_files: file_name = Path(f).stem - if checkAndPerformAppend(f): + if checkAndPerformAppend(f) and forceCompile == False: continue print(f"Compiling {file_name}.c...") @@ -124,7 +128,7 @@ for f in c_files: for f in assembly_files: file_name = Path(f).stem - if checkAndPerformAppend(f): + if checkAndPerformAppend(f) and forceCompile == False: continue print(f"Assembling {file_name}.s...") diff --git a/include/Actor/NameObj/NameObjArchiveListCollector.h b/include/Actor/NameObj/NameObjArchiveListCollector.h new file mode 100644 index 00000000..80056fa8 --- /dev/null +++ b/include/Actor/NameObj/NameObjArchiveListCollector.h @@ -0,0 +1,18 @@ +#ifndef NAMEOBJARCHIVELISTCOLLECTOR_H +#define NAMEOBJARCHIVELISTCOLLECTOR_H + +#include "types.h" + +class NameObjArchiveListCollector +{ +public: + NameObjArchiveListCollector(); + + void addArchive(const char *); + const char* getArchive(u32) const; + + char mArchives[0x20][0x40]; // _0 + s32 mNumArchives; // _800 +}; + +#endif // NAMEOBJARCHIVELISTCOLLECTOR_H \ No newline at end of file diff --git a/include/MR/StringUtil.h b/include/MR/StringUtil.h index 1a9328fc..04176c76 100644 --- a/include/MR/StringUtil.h +++ b/include/MR/StringUtil.h @@ -6,11 +6,11 @@ namespace MR { void addNumberFontTag(wchar_t *, s32); - void removeExtensionString(char *, u64, const char *); + void removeExtensionString(char *, u32, const char *); void makeRaceBestTimeString(wchar_t *, s32); void makeRaceCurrentTimeString(wchar_t *); - void copyString(char *, const char *, u64); - void copyString(wchar_t *, const wchar_t *, u64); + void copyString(char *, const char *, u32); + void copyString(wchar_t *, const wchar_t *, u32); }; #endif // STRINGUTIL_H \ No newline at end of file diff --git a/source/Actor/NameObj/NameObjArchiveListCollector.cpp b/source/Actor/NameObj/NameObjArchiveListCollector.cpp new file mode 100644 index 00000000..7278ed6e --- /dev/null +++ b/source/Actor/NameObj/NameObjArchiveListCollector.cpp @@ -0,0 +1,18 @@ +#include "Actor/NameObj/NameObjArchiveListCollector.h" +#include "MR/StringUtil.h" + +NameObjArchiveListCollector::NameObjArchiveListCollector() +{ + this->mNumArchives = 0; +} + +void NameObjArchiveListCollector::addArchive(const char *archive) +{ + MR::copyString(this->mArchives[this->mNumArchives], archive, 0x40); + this->mNumArchives++; +} + +const char* NameObjArchiveListCollector::getArchive(u32 idx) const +{ + return this->mArchives[idx]; +} \ No newline at end of file