Add -force flag, and decompile NameObjArchiveListCollector

This commit is contained in:
shibbo 2019-07-23 02:36:19 -04:00
parent 905c37032c
commit 1ec6d2ec96
5 changed files with 49 additions and 7 deletions

View File

@ -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.

View File

@ -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...")

View File

@ -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

View File

@ -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

View File

@ -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];
}