Fix merge conflict
This commit is contained in:
commit
877c744c26
|
@ -78,6 +78,10 @@ static void ExporterProgramEnd()
|
||||||
auto fileData = File::ReadAllBytes(item);
|
auto fileData = File::ReadAllBytes(item);
|
||||||
otrArchive->AddFile(StringHelper::Split(item, "Extract\\")[1], (uintptr_t)fileData.data(), fileData.size());
|
otrArchive->AddFile(StringHelper::Split(item, "Extract\\")[1], (uintptr_t)fileData.data(), fileData.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
otrArchive->AddFile("Audiobank", (uintptr_t)Globals::Instance->GetBaseromFile("Audiobank").data(), Globals::Instance->GetBaseromFile("Audiobank").size());
|
||||||
|
otrArchive->AddFile("Audioseq", (uintptr_t)Globals::Instance->GetBaseromFile("Audioseq").data(), Globals::Instance->GetBaseromFile("Audioseq").size());
|
||||||
|
otrArchive->AddFile("Audiotable", (uintptr_t)Globals::Instance->GetBaseromFile("Audiotable").data(), Globals::Instance->GetBaseromFile("Audiotable").size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,21 +4,11 @@ import argparse, json, os, signal, time, sys, shutil
|
||||||
from multiprocessing import Pool, cpu_count, Event, Manager, ProcessError
|
from multiprocessing import Pool, cpu_count, Event, Manager, ProcessError
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
def SignalHandler(sig, frame):
|
def BuildOTR(xmlPath):
|
||||||
print(f'Signal {sig} received. Aborting...')
|
|
||||||
mainAbort.set()
|
|
||||||
# Don't exit immediately to update the extracted assets file.
|
|
||||||
|
|
||||||
def BuildOTR():
|
|
||||||
shutil.copyfile("baserom/Audiobank", "Extract/Audiobank")
|
|
||||||
shutil.copyfile("baserom/Audioseq", "Extract/Audioseq")
|
|
||||||
shutil.copyfile("baserom/Audiotable", "Extract/Audiotable")
|
|
||||||
|
|
||||||
shutil.copytree("assets", "Extract/assets")
|
shutil.copytree("assets", "Extract/assets")
|
||||||
|
|
||||||
execStr = "x64\\Release\\ZAPD.exe" if sys.platform == "win32" else "../ZAPD/ZAPD.out"
|
execStr = "x64\\Release\\ZAPD.exe" if sys.platform == "win32" else "../ZAPD/ZAPD.out"
|
||||||
|
execStr += " ed -i %s -b baserom.z64 -fl CFG\\filelists -o placeholder -osf placeholder -gsf 1 -rconf CFG/Config.xml -se OTR" % (xmlPath)
|
||||||
execStr += " botr -se OTR"
|
|
||||||
|
|
||||||
print(execStr)
|
print(execStr)
|
||||||
exitValue = os.system(execStr)
|
exitValue = os.system(execStr)
|
||||||
|
@ -28,52 +18,12 @@ def BuildOTR():
|
||||||
print("Aborting...", file=os.sys.stderr)
|
print("Aborting...", file=os.sys.stderr)
|
||||||
print("\n")
|
print("\n")
|
||||||
|
|
||||||
def ExtractFile(xmlPath, outputPath, outputSourcePath):
|
|
||||||
execStr = "x64\\Release\\ZAPD.exe" if sys.platform == "win32" else "../ZAPD/ZAPD.out"
|
|
||||||
execStr += " e -eh -i %s -b baserom/ -o %s -osf %s -gsf 1 -rconf CFG/Config.xml -se OTR" % (xmlPath, outputPath, outputSourcePath)
|
|
||||||
|
|
||||||
if "overlays" in xmlPath:
|
|
||||||
execStr += " --static"
|
|
||||||
|
|
||||||
print(execStr)
|
|
||||||
exitValue = os.system(execStr)
|
|
||||||
#exitValue = 0
|
|
||||||
if exitValue != 0:
|
|
||||||
print("\n")
|
|
||||||
print("Error when extracting from file " + xmlPath, file=os.sys.stderr)
|
|
||||||
print("Aborting...", file=os.sys.stderr)
|
|
||||||
print("\n")
|
|
||||||
|
|
||||||
def ExtractFunc(fullPath):
|
|
||||||
*pathList, xmlName = fullPath.split(os.sep)
|
|
||||||
objectName = os.path.splitext(xmlName)[0]
|
|
||||||
|
|
||||||
outPath = os.path.join("..\\soh\\assets\\", *pathList[5:], objectName)
|
|
||||||
os.makedirs(outPath, exist_ok=True)
|
|
||||||
outSourcePath = outPath
|
|
||||||
|
|
||||||
ExtractFile(fullPath, outPath, outSourcePath)
|
|
||||||
|
|
||||||
def initializeWorker(abort, test):
|
|
||||||
global globalAbort
|
|
||||||
globalAbort = abort
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="baserom asset extractor")
|
parser = argparse.ArgumentParser(description="baserom asset extractor")
|
||||||
parser.add_argument("-s", "--single", help="asset path relative to assets/, e.g. objects/gameplay_keep")
|
|
||||||
parser.add_argument("-f", "--force", help="Force the extraction of every xml instead of checking the touched ones.", action="store_true")
|
|
||||||
parser.add_argument("-u", "--unaccounted", help="Enables ZAPD unaccounted detector warning system.", action="store_true")
|
|
||||||
parser.add_argument("-v", "--version", help="Sets game version.")
|
parser.add_argument("-v", "--version", help="Sets game version.")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
global mainAbort
|
# TODO: Read from makerom file to automatically determine game version
|
||||||
mainAbort = Event()
|
|
||||||
manager = Manager()
|
|
||||||
signal.signal(signal.SIGINT, SignalHandler)
|
|
||||||
|
|
||||||
extractedAssetsTracker = manager.dict()
|
|
||||||
|
|
||||||
xmlVer = "GC_NMQ_D"
|
xmlVer = "GC_NMQ_D"
|
||||||
|
|
||||||
if (args.version == "gc_pal_nmpq"):
|
if (args.version == "gc_pal_nmpq"):
|
||||||
|
@ -81,45 +31,10 @@ def main():
|
||||||
elif (args.version == "dbg_mq"):
|
elif (args.version == "dbg_mq"):
|
||||||
xmlVer = "GC_MQ_D"
|
xmlVer = "GC_MQ_D"
|
||||||
|
|
||||||
asset_path = args.single
|
if (os.path.exists("Extract")):
|
||||||
if asset_path is not None:
|
|
||||||
fullPath = os.path.join("..\\soh\\assets", "xml", asset_path + ".xml")
|
|
||||||
if not os.path.exists(fullPath):
|
|
||||||
print(f"Error. File {fullPath} doesn't exists.", file=os.sys.stderr)
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
ExtractFunc(fullPath)
|
|
||||||
else:
|
|
||||||
extract_text_path = "assets/text/message_data.h"
|
|
||||||
if os.path.isfile(extract_text_path):
|
|
||||||
extract_text_path = None
|
|
||||||
extract_staff_text_path = "assets/text/message_data_staff.h"
|
|
||||||
if os.path.isfile(extract_staff_text_path):
|
|
||||||
extract_staff_text_path = None
|
|
||||||
|
|
||||||
xmlFiles = []
|
|
||||||
for currentPath, _, files in os.walk(os.path.join("..\\soh\\assets\\xml\\", xmlVer)):
|
|
||||||
for file in files:
|
|
||||||
fullPath = os.path.join(currentPath, file)
|
|
||||||
if file.endswith(".xml"):
|
|
||||||
xmlFiles.append(fullPath)
|
|
||||||
|
|
||||||
try:
|
|
||||||
numCores = 2
|
|
||||||
print("Extracting assets with " + str(numCores) + " CPU cores.")
|
|
||||||
with Pool(numCores, initializer=initializeWorker, initargs=(mainAbort, 0)) as p:
|
|
||||||
p.map(ExtractFunc, xmlFiles)
|
|
||||||
except Exception as e:
|
|
||||||
print("Warning: Multiprocessing exception ocurred.", file=os.sys.stderr)
|
|
||||||
print("Disabling mutliprocessing.", file=os.sys.stderr)
|
|
||||||
|
|
||||||
initializeWorker(mainAbort, 0)
|
|
||||||
for singlePath in xmlFiles:
|
|
||||||
ExtractFunc(singlePath)
|
|
||||||
|
|
||||||
|
|
||||||
BuildOTR()
|
|
||||||
shutil.rmtree("Extract")
|
shutil.rmtree("Extract")
|
||||||
|
|
||||||
|
BuildOTR("..\\soh\\assets\\xml\\" + xmlVer + "\\")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
|
@ -0,0 +1,125 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import argparse, json, os, signal, time, sys, shutil
|
||||||
|
from multiprocessing import Pool, cpu_count, Event, Manager, ProcessError
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
def SignalHandler(sig, frame):
|
||||||
|
print(f'Signal {sig} received. Aborting...')
|
||||||
|
mainAbort.set()
|
||||||
|
# Don't exit immediately to update the extracted assets file.
|
||||||
|
|
||||||
|
def BuildOTR():
|
||||||
|
shutil.copyfile("baserom/Audiobank", "Extract/Audiobank")
|
||||||
|
shutil.copyfile("baserom/Audioseq", "Extract/Audioseq")
|
||||||
|
shutil.copyfile("baserom/Audiotable", "Extract/Audiotable")
|
||||||
|
|
||||||
|
shutil.copytree("assets", "Extract/assets")
|
||||||
|
|
||||||
|
execStr = "x64\\Release\\ZAPD.exe" if sys.platform == "win32" else "../ZAPD/ZAPD.out"
|
||||||
|
|
||||||
|
execStr += " botr -se OTR"
|
||||||
|
|
||||||
|
print(execStr)
|
||||||
|
exitValue = os.system(execStr)
|
||||||
|
if exitValue != 0:
|
||||||
|
print("\n")
|
||||||
|
print("Error when building the OTR file...", file=os.sys.stderr)
|
||||||
|
print("Aborting...", file=os.sys.stderr)
|
||||||
|
print("\n")
|
||||||
|
|
||||||
|
def ExtractFile(xmlPath, outputPath, outputSourcePath):
|
||||||
|
execStr = "x64\\Release\\ZAPD.exe" if sys.platform == "win32" else "../ZAPD/ZAPD.out"
|
||||||
|
execStr += " e -eh -i %s -b baserom/ -o %s -osf %s -gsf 1 -rconf CFG/Config.xml -se OTR" % (xmlPath, outputPath, outputSourcePath)
|
||||||
|
|
||||||
|
if "overlays" in xmlPath:
|
||||||
|
execStr += " --static"
|
||||||
|
|
||||||
|
print(execStr)
|
||||||
|
exitValue = os.system(execStr)
|
||||||
|
#exitValue = 0
|
||||||
|
if exitValue != 0:
|
||||||
|
print("\n")
|
||||||
|
print("Error when extracting from file " + xmlPath, file=os.sys.stderr)
|
||||||
|
print("Aborting...", file=os.sys.stderr)
|
||||||
|
print("\n")
|
||||||
|
|
||||||
|
def ExtractFunc(fullPath):
|
||||||
|
*pathList, xmlName = fullPath.split(os.sep)
|
||||||
|
objectName = os.path.splitext(xmlName)[0]
|
||||||
|
|
||||||
|
outPath = os.path.join("..\\soh\\assets\\", *pathList[5:], objectName)
|
||||||
|
os.makedirs(outPath, exist_ok=True)
|
||||||
|
outSourcePath = outPath
|
||||||
|
|
||||||
|
ExtractFile(fullPath, outPath, outSourcePath)
|
||||||
|
|
||||||
|
def initializeWorker(abort, test):
|
||||||
|
global globalAbort
|
||||||
|
globalAbort = abort
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description="baserom asset extractor")
|
||||||
|
parser.add_argument("-s", "--single", help="asset path relative to assets/, e.g. objects/gameplay_keep")
|
||||||
|
parser.add_argument("-f", "--force", help="Force the extraction of every xml instead of checking the touched ones.", action="store_true")
|
||||||
|
parser.add_argument("-u", "--unaccounted", help="Enables ZAPD unaccounted detector warning system.", action="store_true")
|
||||||
|
parser.add_argument("-v", "--version", help="Sets game version.")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
global mainAbort
|
||||||
|
mainAbort = Event()
|
||||||
|
manager = Manager()
|
||||||
|
signal.signal(signal.SIGINT, SignalHandler)
|
||||||
|
|
||||||
|
extractedAssetsTracker = manager.dict()
|
||||||
|
|
||||||
|
xmlVer = "GC_NMQ_D"
|
||||||
|
|
||||||
|
if (args.version == "gc_pal_nmpq"):
|
||||||
|
xmlVer = "GC_NMQ_PAL_F"
|
||||||
|
elif (args.version == "dbg_mq"):
|
||||||
|
xmlVer = "GC_MQ_D"
|
||||||
|
|
||||||
|
asset_path = args.single
|
||||||
|
if asset_path is not None:
|
||||||
|
fullPath = os.path.join("..\\soh\\assets", "xml", asset_path + ".xml")
|
||||||
|
if not os.path.exists(fullPath):
|
||||||
|
print(f"Error. File {fullPath} doesn't exists.", file=os.sys.stderr)
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
ExtractFunc(fullPath)
|
||||||
|
else:
|
||||||
|
extract_text_path = "assets/text/message_data.h"
|
||||||
|
if os.path.isfile(extract_text_path):
|
||||||
|
extract_text_path = None
|
||||||
|
extract_staff_text_path = "assets/text/message_data_staff.h"
|
||||||
|
if os.path.isfile(extract_staff_text_path):
|
||||||
|
extract_staff_text_path = None
|
||||||
|
|
||||||
|
xmlFiles = []
|
||||||
|
for currentPath, _, files in os.walk(os.path.join("..\\soh\\assets\\xml\\", xmlVer)):
|
||||||
|
for file in files:
|
||||||
|
fullPath = os.path.join(currentPath, file)
|
||||||
|
if file.endswith(".xml"):
|
||||||
|
xmlFiles.append(fullPath)
|
||||||
|
|
||||||
|
try:
|
||||||
|
numCores = 2
|
||||||
|
print("Extracting assets with " + str(numCores) + " CPU cores.")
|
||||||
|
with Pool(numCores, initializer=initializeWorker, initargs=(mainAbort, 0)) as p:
|
||||||
|
p.map(ExtractFunc, xmlFiles)
|
||||||
|
except Exception as e:
|
||||||
|
print("Warning: Multiprocessing exception ocurred.", file=os.sys.stderr)
|
||||||
|
print("Disabling mutliprocessing.", file=os.sys.stderr)
|
||||||
|
|
||||||
|
initializeWorker(mainAbort, 0)
|
||||||
|
for singlePath in xmlFiles:
|
||||||
|
ExtractFunc(singlePath)
|
||||||
|
|
||||||
|
|
||||||
|
BuildOTR()
|
||||||
|
shutil.rmtree("Extract")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
|
@ -87,10 +87,11 @@ void ExtractRom()
|
||||||
if (MoonUtils::exists("Extract")) MoonUtils::rm("Extract");
|
if (MoonUtils::exists("Extract")) MoonUtils::rm("Extract");
|
||||||
|
|
||||||
MoonUtils::mkdir("Extract");
|
MoonUtils::mkdir("Extract");
|
||||||
MoonUtils::copy("tmp/baserom/Audiobank", "Extract/Audiobank");
|
//MoonUtils::copy("tmp/baserom/Audiobank", "Extract/Audiobank");
|
||||||
MoonUtils::copy("tmp/baserom/Audioseq", "Extract/Audioseq");
|
//MoonUtils::copy("tmp/baserom/Audioseq", "Extract/Audioseq");
|
||||||
MoonUtils::copy("tmp/baserom/Audiotable", "Extract/Audiotable");
|
//MoonUtils::copy("tmp/baserom/Audiotable", "Extract/Audiotable");
|
||||||
MoonUtils::copy("tmp/baserom/version", "Extract/version");
|
//MoonUtils::copy("tmp/baserom/version", "Extract/version");
|
||||||
|
MoonUtils::write("Extract/version", (char*)&version.crc, sizeof(version.crc));
|
||||||
|
|
||||||
MoonUtils::copy("assets/game/", "Extract/assets/");
|
MoonUtils::copy("assets/game/", "Extract/assets/");
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,6 @@ void startWorker(RomVersion version) {
|
||||||
|
|
||||||
Util::write("tmp/baserom/version", (char*)&version.crc, sizeof(version.crc));
|
Util::write("tmp/baserom/version", (char*)&version.crc, sizeof(version.crc));
|
||||||
|
|
||||||
|
|
||||||
if (oldExtractMode)
|
if (oldExtractMode)
|
||||||
{
|
{
|
||||||
std::vector<std::string> files;
|
std::vector<std::string> files;
|
||||||
|
|
|
@ -387,18 +387,6 @@ int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
BuildAssetBlob(Globals::Instance->inputPath, Globals::Instance->outputPath);
|
BuildAssetBlob(Globals::Instance->inputPath, Globals::Instance->outputPath);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
else if (fileMode == ZFileMode::BuildOverlay)
|
|
||||||
{
|
|
||||||
ZOverlay* overlay =
|
|
||||||
ZOverlay::FromBuild(Path::GetDirectoryName(Globals::Instance->inputPath),
|
|
||||||
Path::GetDirectoryName(Globals::Instance->cfgPath));
|
|
||||||
|
|
||||||
if (overlay != nullptr)
|
|
||||||
File::WriteAllText(Globals::Instance->outputPath.string(),
|
|
||||||
overlay->GetSourceOutputCode(""));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (exporterSet != nullptr && exporterSet->endProgramFunc != nullptr)
|
if (exporterSet != nullptr && exporterSet->endProgramFunc != nullptr)
|
||||||
exporterSet->endProgramFunc();
|
exporterSet->endProgramFunc();
|
||||||
|
|
|
@ -823,6 +823,32 @@ void ZFile::GenerateSourceHeaderFiles()
|
||||||
|
|
||||||
if (Globals::Instance->fileMode != ZFileMode::ExtractDirectory)
|
if (Globals::Instance->fileMode != ZFileMode::ExtractDirectory)
|
||||||
File::WriteAllText(headerFilename, formatter.GetOutput());
|
File::WriteAllText(headerFilename, formatter.GetOutput());
|
||||||
|
else if (Globals::Instance->sourceOutputPath != "")
|
||||||
|
{
|
||||||
|
std::string xmlPath = xmlFilePath.string();
|
||||||
|
xmlPath = StringHelper::Replace(xmlPath, "\\", "/");
|
||||||
|
auto pathList = StringHelper::Split(xmlPath, "/");
|
||||||
|
std::string outPath = "";
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
outPath += pathList[i] + "/";
|
||||||
|
|
||||||
|
for (int i = 5; i < pathList.size(); i++)
|
||||||
|
{
|
||||||
|
if (i == pathList.size() - 1)
|
||||||
|
{
|
||||||
|
outPath += Path::GetFileNameWithoutExtension(pathList[i]) + "/";
|
||||||
|
outPath += outName.string() + ".h";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
outPath += pathList[i];
|
||||||
|
|
||||||
|
if (i < pathList.size() - 1)
|
||||||
|
outPath += "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
File::WriteAllText(outPath, formatter.GetOutput());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ZFile::GetHeaderInclude() const
|
std::string ZFile::GetHeaderInclude() const
|
||||||
|
|
|
@ -5,16 +5,16 @@
|
||||||
|
|
||||||
std::map<std::string, CVar*> cvars;
|
std::map<std::string, CVar*> cvars;
|
||||||
|
|
||||||
CVar* CVar_GetVar(char* name) {
|
CVar* CVar_GetVar(const char* name) {
|
||||||
std::string key(name);
|
std::string key(name);
|
||||||
return cvars.contains(key) ? cvars[key] : nullptr;
|
return cvars.contains(key) ? cvars[key] : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" CVar* CVar_Get(char* name) {
|
extern "C" CVar* CVar_Get(const char* name) {
|
||||||
return CVar_GetVar(name);
|
return CVar_GetVar(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" s32 CVar_GetS32(char* name, s32 defaultValue) {
|
extern "C" s32 CVar_GetS32(const char* name, s32 defaultValue) {
|
||||||
CVar* cvar = CVar_Get(name);
|
CVar* cvar = CVar_Get(name);
|
||||||
|
|
||||||
if (cvar != nullptr) {
|
if (cvar != nullptr) {
|
||||||
|
@ -25,7 +25,7 @@ extern "C" s32 CVar_GetS32(char* name, s32 defaultValue) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" float CVar_GetFloat(char* name, float defaultValue) {
|
extern "C" float CVar_GetFloat(const char* name, float defaultValue) {
|
||||||
CVar* cvar = CVar_Get(name);
|
CVar* cvar = CVar_Get(name);
|
||||||
|
|
||||||
if (cvar != nullptr) {
|
if (cvar != nullptr) {
|
||||||
|
@ -36,7 +36,7 @@ extern "C" float CVar_GetFloat(char* name, float defaultValue) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" char* CVar_GetString(char* name, char* defaultValue) {
|
extern "C" char* CVar_GetString(const char* name, char* defaultValue) {
|
||||||
CVar* cvar = CVar_Get(name);
|
CVar* cvar = CVar_Get(name);
|
||||||
|
|
||||||
if (cvar != nullptr) {
|
if (cvar != nullptr) {
|
||||||
|
@ -47,7 +47,7 @@ extern "C" char* CVar_GetString(char* name, char* defaultValue) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void CVar_SetS32(char* name, s32 value) {
|
extern "C" void CVar_SetS32(const char* name, s32 value) {
|
||||||
CVar* cvar = CVar_Get(name);
|
CVar* cvar = CVar_Get(name);
|
||||||
if (!cvar) {
|
if (!cvar) {
|
||||||
cvar = new CVar;
|
cvar = new CVar;
|
||||||
|
@ -57,7 +57,7 @@ extern "C" void CVar_SetS32(char* name, s32 value) {
|
||||||
cvar->value.valueS32 = value;
|
cvar->value.valueS32 = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVar_SetFloat(char* name, float value) {
|
void CVar_SetFloat(const char* name, float value) {
|
||||||
CVar* cvar = CVar_Get(name);
|
CVar* cvar = CVar_Get(name);
|
||||||
if (!cvar) {
|
if (!cvar) {
|
||||||
cvar = new CVar;
|
cvar = new CVar;
|
||||||
|
@ -67,7 +67,7 @@ void CVar_SetFloat(char* name, float value) {
|
||||||
cvar->value.valueFloat = value;
|
cvar->value.valueFloat = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVar_SetString(char* name, char* value) {
|
void CVar_SetString(const char* name, char* value) {
|
||||||
CVar* cvar = CVar_Get(name);
|
CVar* cvar = CVar_Get(name);
|
||||||
if (!cvar) {
|
if (!cvar) {
|
||||||
cvar = new CVar;
|
cvar = new CVar;
|
||||||
|
@ -78,23 +78,23 @@ void CVar_SetString(char* name, char* value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" void CVar_RegisterS32(char* name, s32 defaultValue) {
|
extern "C" void CVar_RegisterS32(const char* name, s32 defaultValue) {
|
||||||
CVar* cvar = CVar_Get(name);
|
CVar* cvar = CVar_Get(name);
|
||||||
|
|
||||||
if (cvar == nullptr)
|
if (cvar == nullptr)
|
||||||
CVar_SetS32(name, defaultValue);
|
CVar_SetS32(name, defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void CVar_RegisterFloat(char* name, float defaultValue) {
|
extern "C" void CVar_RegisterFloat(const char* name, float defaultValue) {
|
||||||
CVar* cvar = CVar_Get(name);
|
CVar* cvar = CVar_Get(name);
|
||||||
|
|
||||||
if (cvar == nullptr)
|
if (cvar == nullptr)
|
||||||
CVar_SetFloat(name, defaultValue);
|
CVar_SetFloat(name, defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void CVar_RegisterString(char* name, char* defaultValue) {
|
extern "C" void CVar_RegisterString(const char* name, char* defaultValue) {
|
||||||
CVar* cvar = CVar_Get(name);
|
CVar* cvar = CVar_Get(name);
|
||||||
|
|
||||||
if (cvar == nullptr)
|
if (cvar == nullptr)
|
||||||
CVar_SetString(name, defaultValue);
|
CVar_SetString(name, defaultValue);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,15 +23,15 @@ extern "C"
|
||||||
//#include <ultra64.h>
|
//#include <ultra64.h>
|
||||||
|
|
||||||
|
|
||||||
CVar* CVar_Get(char* name);
|
CVar* CVar_Get(const char* name);
|
||||||
s32 CVar_GetS32(char* name, s32 defaultValue);
|
s32 CVar_GetS32(const char* name, s32 defaultValue);
|
||||||
float CVar_GetFloat(char* name, float defaultValue);
|
float CVar_GetFloat(const char* name, float defaultValue);
|
||||||
char* CVar_GetString(char* name, char* defaultValue);
|
char* CVar_GetString(const char* name, char* defaultValue);
|
||||||
void CVar_SetS32(char* name, s32 value);
|
void CVar_SetS32(const char* name, s32 value);
|
||||||
|
|
||||||
void CVar_RegisterS32(char* name, s32 defaultValue);
|
void CVar_RegisterS32(const char* name, s32 defaultValue);
|
||||||
void CVar_RegisterFloat(char* name, float defaultValue);
|
void CVar_RegisterFloat(const char* name, float defaultValue);
|
||||||
void CVar_RegisterString(char* name, char* defaultValue);
|
void CVar_RegisterString(const char* name, char* defaultValue);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
};
|
};
|
||||||
|
@ -42,8 +42,8 @@ void CVar_RegisterString(char* name, char* defaultValue);
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
extern std::map<std::string, CVar*> cvars;
|
extern std::map<std::string, CVar*> cvars;
|
||||||
CVar* CVar_GetVar(char* name);
|
CVar* CVar_GetVar(const char* name);
|
||||||
void CVar_SetFloat(char* name, float value);
|
void CVar_SetFloat(const char* name, float value);
|
||||||
void CVar_SetString(char* name, char* value);
|
void CVar_SetString(const char* name, char* value);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
|
@ -50,76 +50,76 @@ namespace Game {
|
||||||
|
|
||||||
// Enhancements
|
// Enhancements
|
||||||
Settings.enhancements.fast_text = stob(Conf[EnhancementSection]["fast_text"]);
|
Settings.enhancements.fast_text = stob(Conf[EnhancementSection]["fast_text"]);
|
||||||
CVar_SetS32(const_cast<char*>("gFastText"), Settings.enhancements.fast_text);
|
CVar_SetS32("gFastText", Settings.enhancements.fast_text);
|
||||||
|
|
||||||
Settings.enhancements.disable_lod = stob(Conf[EnhancementSection]["disable_lod"]);
|
Settings.enhancements.disable_lod = stob(Conf[EnhancementSection]["disable_lod"]);
|
||||||
CVar_SetS32(const_cast<char*>("gDisableLOD"), Settings.enhancements.disable_lod);
|
CVar_SetS32("gDisableLOD", Settings.enhancements.disable_lod);
|
||||||
|
|
||||||
Settings.enhancements.animated_pause_menu = stob(Conf[EnhancementSection]["animated_pause_menu"]);
|
Settings.enhancements.animated_pause_menu = stob(Conf[EnhancementSection]["animated_pause_menu"]);
|
||||||
CVar_SetS32(const_cast<char*>("gPauseLiveLink"), Settings.enhancements.animated_pause_menu);
|
CVar_SetS32("gPauseLiveLink", Settings.enhancements.animated_pause_menu);
|
||||||
|
|
||||||
Settings.enhancements.minimal_ui = stob(Conf[EnhancementSection]["minimal_ui"]);
|
Settings.enhancements.minimal_ui = stob(Conf[EnhancementSection]["minimal_ui"]);
|
||||||
CVar_SetS32(const_cast<char*>("gMinimalUI"), Settings.enhancements.minimal_ui);
|
CVar_SetS32(const_cast<char*>("gMinimalUI"), Settings.enhancements.minimal_ui);
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
Settings.audio.master = Ship::stof(Conf[AudioSection]["master"]);
|
Settings.audio.master = Ship::stof(Conf[AudioSection]["master"]);
|
||||||
CVar_SetFloat(const_cast<char*>("gGameMasterVolume"), Settings.audio.master);
|
CVar_SetFloat("gGameMasterVolume", Settings.audio.master);
|
||||||
|
|
||||||
Settings.audio.music_main = Ship::stof(Conf[AudioSection]["music_main"]);
|
Settings.audio.music_main = Ship::stof(Conf[AudioSection]["music_main"]);
|
||||||
CVar_SetFloat(const_cast<char*>("gMainMusicVolume"), Settings.audio.music_main);
|
CVar_SetFloat("gMainMusicVolume", Settings.audio.music_main);
|
||||||
|
|
||||||
Settings.audio.music_sub = Ship::stof(Conf[AudioSection]["music_sub"]);
|
Settings.audio.music_sub = Ship::stof(Conf[AudioSection]["music_sub"]);
|
||||||
CVar_SetFloat(const_cast<char*>("gSubMusicVolume"), Settings.audio.music_sub);
|
CVar_SetFloat("gSubMusicVolume", Settings.audio.music_sub);
|
||||||
|
|
||||||
Settings.audio.sfx = Ship::stof(Conf[AudioSection]["sfx"]);
|
Settings.audio.sfx = Ship::stof(Conf[AudioSection]["sfx"]);
|
||||||
CVar_SetFloat(const_cast<char*>("gSFXMusicVolume"), Settings.audio.sfx);
|
CVar_SetFloat("gSFXMusicVolume", Settings.audio.sfx);
|
||||||
|
|
||||||
Settings.audio.fanfare = Ship::stof(Conf[AudioSection]["fanfare"]);
|
Settings.audio.fanfare = Ship::stof(Conf[AudioSection]["fanfare"]);
|
||||||
CVar_SetFloat(const_cast<char*>("gFanfareVolume"), Settings.audio.fanfare);
|
CVar_SetFloat("gFanfareVolume", Settings.audio.fanfare);
|
||||||
|
|
||||||
// Controllers
|
// Controllers
|
||||||
Settings.controller.gyro_sensitivity = Ship::stof(Conf[ControllerSection]["gyro_sensitivity"]);
|
Settings.controller.gyro_sensitivity = Ship::stof(Conf[ControllerSection]["gyro_sensitivity"]);
|
||||||
CVar_SetFloat(const_cast<char*>("gGyroSensitivity"), Settings.controller.gyro_sensitivity);
|
CVar_SetFloat("gGyroSensitivity", Settings.controller.gyro_sensitivity);
|
||||||
|
|
||||||
Settings.controller.rumble_strength = Ship::stof(Conf[ControllerSection]["rumble_strength"]);
|
Settings.controller.rumble_strength = Ship::stof(Conf[ControllerSection]["rumble_strength"]);
|
||||||
CVar_SetFloat(const_cast<char*>("gRumbleStrength"), Settings.controller.rumble_strength);
|
CVar_SetFloat("gRumbleStrength", Settings.controller.rumble_strength);
|
||||||
|
|
||||||
Settings.controller.input_scale = Ship::stof(Conf[ControllerSection]["input_scale"]);
|
Settings.controller.input_scale = Ship::stof(Conf[ControllerSection]["input_scale"]);
|
||||||
CVar_SetFloat(const_cast<char*>("gInputScale"), Settings.controller.input_scale);
|
CVar_SetFloat("gInputScale", Settings.controller.input_scale);
|
||||||
|
|
||||||
Settings.controller.input_enabled = stob(Conf[ControllerSection]["input_enabled"]);
|
Settings.controller.input_enabled = stob(Conf[ControllerSection]["input_enabled"]);
|
||||||
CVar_SetS32(const_cast<char*>("gInputEnabled"), Settings.controller.input_enabled);
|
CVar_SetS32("gInputEnabled", Settings.controller.input_enabled);
|
||||||
|
|
||||||
Settings.controller.dpad_shop = stob(Conf[ControllerSection]["dpad_shop"]);
|
Settings.controller.dpad_shop = stob(Conf[ControllerSection]["dpad_shop"]);
|
||||||
CVar_SetS32(const_cast<char*>("gDpadShop"), Settings.controller.dpad_shop);
|
CVar_SetS32("gDpadShop", Settings.controller.dpad_shop);
|
||||||
|
|
||||||
// Cheats
|
// Cheats
|
||||||
Settings.cheats.debug_mode = stob(Conf[CheatSection]["debug_mode"]);
|
Settings.cheats.debug_mode = stob(Conf[CheatSection]["debug_mode"]);
|
||||||
CVar_SetS32(const_cast<char*>("gDebugEnabled"), Settings.cheats.debug_mode);
|
CVar_SetS32("gDebugEnabled", Settings.cheats.debug_mode);
|
||||||
|
|
||||||
Settings.cheats.infinite_money = stob(Conf[CheatSection]["infinite_money"]);
|
Settings.cheats.infinite_money = stob(Conf[CheatSection]["infinite_money"]);
|
||||||
CVar_SetS32(const_cast<char*>("gInfiniteMoney"), Settings.cheats.infinite_money);
|
CVar_SetS32("gInfiniteMoney", Settings.cheats.infinite_money);
|
||||||
|
|
||||||
Settings.cheats.infinite_health = stob(Conf[CheatSection]["infinite_health"]);
|
Settings.cheats.infinite_health = stob(Conf[CheatSection]["infinite_health"]);
|
||||||
CVar_SetS32(const_cast<char*>("gInfiniteHealth"), Settings.cheats.infinite_health);
|
CVar_SetS32("gInfiniteHealth", Settings.cheats.infinite_health);
|
||||||
|
|
||||||
Settings.cheats.infinite_ammo = stob(Conf[CheatSection]["infinite_ammo"]);
|
Settings.cheats.infinite_ammo = stob(Conf[CheatSection]["infinite_ammo"]);
|
||||||
CVar_SetS32(const_cast<char*>("gInfiniteAmmo"), Settings.cheats.infinite_ammo);
|
CVar_SetS32("gInfiniteAmmo", Settings.cheats.infinite_ammo);
|
||||||
|
|
||||||
Settings.cheats.infinite_magic = stob(Conf[CheatSection]["infinite_magic"]);
|
Settings.cheats.infinite_magic = stob(Conf[CheatSection]["infinite_magic"]);
|
||||||
CVar_SetS32(const_cast<char*>("gInfiniteMagic"), Settings.cheats.infinite_magic);
|
CVar_SetS32("gInfiniteMagic", Settings.cheats.infinite_magic);
|
||||||
|
|
||||||
Settings.cheats.no_clip = stob(Conf[CheatSection]["no_clip"]);
|
Settings.cheats.no_clip = stob(Conf[CheatSection]["no_clip"]);
|
||||||
CVar_SetS32(const_cast<char*>("gNoClip"), Settings.cheats.no_clip);
|
CVar_SetS32("gNoClip", Settings.cheats.no_clip);
|
||||||
|
|
||||||
Settings.cheats.climb_everything = stob(Conf[CheatSection]["climb_everything"]);
|
Settings.cheats.climb_everything = stob(Conf[CheatSection]["climb_everything"]);
|
||||||
CVar_SetS32(const_cast<char*>("gClimbEverything"), Settings.cheats.climb_everything);
|
CVar_SetS32("gClimbEverything", Settings.cheats.climb_everything);
|
||||||
|
|
||||||
Settings.cheats.moon_jump_on_l = stob(Conf[CheatSection]["moon_jump_on_l"]);
|
Settings.cheats.moon_jump_on_l = stob(Conf[CheatSection]["moon_jump_on_l"]);
|
||||||
CVar_SetS32(const_cast<char*>("gMoonJumpOnL"), Settings.cheats.moon_jump_on_l);
|
CVar_SetS32("gMoonJumpOnL", Settings.cheats.moon_jump_on_l);
|
||||||
|
|
||||||
Settings.cheats.super_tunic = stob(Conf[CheatSection]["super_tunic"]);
|
Settings.cheats.super_tunic = stob(Conf[CheatSection]["super_tunic"]);
|
||||||
CVar_SetS32(const_cast<char*>("gSuperTunic"), Settings.cheats.super_tunic);
|
CVar_SetS32("gSuperTunic", Settings.cheats.super_tunic);
|
||||||
|
|
||||||
UpdateAudio();
|
UpdateAudio();
|
||||||
}
|
}
|
||||||
|
@ -177,4 +177,4 @@ namespace Game {
|
||||||
void SetSeqPlayerVolume(SeqPlayers playerId, float volume) {
|
void SetSeqPlayerVolume(SeqPlayers playerId, float volume) {
|
||||||
Audio_SetGameVolume(playerId, volume);
|
Audio_SetGameVolume(playerId, volume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ void Console::Update() {
|
||||||
}
|
}
|
||||||
for (auto [key, var] : BindingToggle) {
|
for (auto [key, var] : BindingToggle) {
|
||||||
if (ImGui::IsKeyPressed(key)) {
|
if (ImGui::IsKeyPressed(key)) {
|
||||||
CVar* cvar = CVar_GetVar(const_cast<char*>(var.c_str()));
|
CVar* cvar = CVar_GetVar(var.c_str());
|
||||||
Dispatch("set " + var + " " + std::to_string(cvar == nullptr ? 0 : !static_cast<bool>(cvar->value.valueS32)));
|
Dispatch("set " + var + " " + std::to_string(cvar == nullptr ? 0 : !static_cast<bool>(cvar->value.valueS32)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,7 +225,7 @@ namespace SohImGui {
|
||||||
ImGui::Text(name, static_cast<int>(100 * *(value)));
|
ImGui::Text(name, static_cast<int>(100 * *(value)));
|
||||||
if (ImGui::SliderFloat((std::string("##") + key).c_str(), value, 0.0f, 1.0f, "")) {
|
if (ImGui::SliderFloat((std::string("##") + key).c_str(), value, 0.0f, 1.0f, "")) {
|
||||||
const float volume = floorf(*(value) * 100) / 100;
|
const float volume = floorf(*(value) * 100) / 100;
|
||||||
CVar_SetFloat(const_cast<char*>(key), volume);
|
CVar_SetFloat(key, volume);
|
||||||
needs_save = true;
|
needs_save = true;
|
||||||
Game::SetSeqPlayerVolume(playerId, volume);
|
Game::SetSeqPlayerVolume(playerId, volume);
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ namespace SohImGui {
|
||||||
const float volume = Game::Settings.audio.master;
|
const float volume = Game::Settings.audio.master;
|
||||||
ImGui::Text("Master Volume: %d %%", static_cast<int>(100 * volume));
|
ImGui::Text("Master Volume: %d %%", static_cast<int>(100 * volume));
|
||||||
if (ImGui::SliderFloat("##Master_Vol", &Game::Settings.audio.master, 0.0f, 1.0f, "")) {
|
if (ImGui::SliderFloat("##Master_Vol", &Game::Settings.audio.master, 0.0f, 1.0f, "")) {
|
||||||
CVar_SetFloat(const_cast<char*>("gGameMasterVolume"), volume);
|
CVar_SetFloat("gGameMasterVolume", volume);
|
||||||
needs_save = true;
|
needs_save = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ namespace SohImGui {
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
if (ImGui::Checkbox("Fast Text", &Game::Settings.enhancements.fast_text)) {
|
if (ImGui::Checkbox("Fast Text", &Game::Settings.enhancements.fast_text)) {
|
||||||
CVar_SetS32(const_cast<char*>("gFastText"), Game::Settings.enhancements.fast_text);
|
CVar_SetS32("gFastText", Game::Settings.enhancements.fast_text);
|
||||||
needs_save = true;
|
needs_save = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,12 +359,12 @@ namespace SohImGui {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Checkbox("Animated Link in Pause Menu", &Game::Settings.enhancements.animated_pause_menu)) {
|
if (ImGui::Checkbox("Animated Link in Pause Menu", &Game::Settings.enhancements.animated_pause_menu)) {
|
||||||
CVar_SetS32(const_cast<char*>("gPauseLiveLink"), Game::Settings.enhancements.animated_pause_menu);
|
CVar_SetS32("gPauseLiveLink", Game::Settings.enhancements.animated_pause_menu);
|
||||||
needs_save = true;
|
needs_save = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Checkbox("Disable LOD", &Game::Settings.enhancements.disable_lod)) {
|
if (ImGui::Checkbox("Disable LOD", &Game::Settings.enhancements.disable_lod)) {
|
||||||
CVar_SetS32(const_cast<char*>("gDisableLOD"), Game::Settings.enhancements.disable_lod);
|
CVar_SetS32("gDisableLOD", Game::Settings.enhancements.disable_lod);
|
||||||
needs_save = true;
|
needs_save = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ namespace SohImGui {
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
if (ImGui::Checkbox("Debug Mode", &Game::Settings.cheats.debug_mode)) {
|
if (ImGui::Checkbox("Debug Mode", &Game::Settings.cheats.debug_mode)) {
|
||||||
CVar_SetS32(const_cast<char*>("gDebugEnabled"), Game::Settings.cheats.debug_mode);
|
CVar_SetS32("gDebugEnabled", Game::Settings.cheats.debug_mode);
|
||||||
needs_save = true;
|
needs_save = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,42 +388,42 @@ namespace SohImGui {
|
||||||
|
|
||||||
if (ImGui::BeginMenu("Cheats")) {
|
if (ImGui::BeginMenu("Cheats")) {
|
||||||
if (ImGui::Checkbox("Infinite Money", &Game::Settings.cheats.infinite_money)) {
|
if (ImGui::Checkbox("Infinite Money", &Game::Settings.cheats.infinite_money)) {
|
||||||
CVar_SetS32(const_cast<char*>("gInfiniteMoney"), Game::Settings.cheats.infinite_money);
|
CVar_SetS32("gInfiniteMoney", Game::Settings.cheats.infinite_money);
|
||||||
needs_save = true;
|
needs_save = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Checkbox("Infinite Health", &Game::Settings.cheats.infinite_health)) {
|
if (ImGui::Checkbox("Infinite Health", &Game::Settings.cheats.infinite_health)) {
|
||||||
CVar_SetS32(const_cast<char*>("gInfiniteHealth"), Game::Settings.cheats.infinite_health);
|
CVar_SetS32("gInfiniteHealth", Game::Settings.cheats.infinite_health);
|
||||||
needs_save = true;
|
needs_save = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Checkbox("Infinite Ammo", &Game::Settings.cheats.infinite_ammo)) {
|
if (ImGui::Checkbox("Infinite Ammo", &Game::Settings.cheats.infinite_ammo)) {
|
||||||
CVar_SetS32(const_cast<char*>("gInfiniteAmmo"), Game::Settings.cheats.infinite_ammo);
|
CVar_SetS32("gInfiniteAmmo", Game::Settings.cheats.infinite_ammo);
|
||||||
needs_save = true;
|
needs_save = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Checkbox("Infinite Magic", &Game::Settings.cheats.infinite_magic)) {
|
if (ImGui::Checkbox("Infinite Magic", &Game::Settings.cheats.infinite_magic)) {
|
||||||
CVar_SetS32(const_cast<char*>("gInfiniteMagic"), Game::Settings.cheats.infinite_magic);
|
CVar_SetS32("gInfiniteMagic", Game::Settings.cheats.infinite_magic);
|
||||||
needs_save = true;
|
needs_save = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Checkbox("No Clip", &Game::Settings.cheats.no_clip)) {
|
if (ImGui::Checkbox("No Clip", &Game::Settings.cheats.no_clip)) {
|
||||||
CVar_SetS32(const_cast<char*>("gNoClip"), Game::Settings.cheats.no_clip);
|
CVar_SetS32("gNoClip", Game::Settings.cheats.no_clip);
|
||||||
needs_save = true;
|
needs_save = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Checkbox("Climb Everything", &Game::Settings.cheats.climb_everything)) {
|
if (ImGui::Checkbox("Climb Everything", &Game::Settings.cheats.climb_everything)) {
|
||||||
CVar_SetS32(const_cast<char*>("gClimbEverything"), Game::Settings.cheats.climb_everything);
|
CVar_SetS32("gClimbEverything", Game::Settings.cheats.climb_everything);
|
||||||
needs_save = true;
|
needs_save = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Checkbox("Moon Jump on L", &Game::Settings.cheats.moon_jump_on_l)) {
|
if (ImGui::Checkbox("Moon Jump on L", &Game::Settings.cheats.moon_jump_on_l)) {
|
||||||
CVar_SetS32(const_cast<char*>("gMoonJumpOnL"), Game::Settings.cheats.moon_jump_on_l);
|
CVar_SetS32("gMoonJumpOnL", Game::Settings.cheats.moon_jump_on_l);
|
||||||
needs_save = true;
|
needs_save = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Checkbox("Super Tunic", &Game::Settings.cheats.super_tunic)) {
|
if (ImGui::Checkbox("Super Tunic", &Game::Settings.cheats.super_tunic)) {
|
||||||
CVar_SetS32(const_cast<char*>("gSuperTunic"), Game::Settings.cheats.super_tunic);
|
CVar_SetS32("gSuperTunic", Game::Settings.cheats.super_tunic);
|
||||||
needs_save = true;
|
needs_save = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,4 +543,4 @@ namespace SohImGui {
|
||||||
void BindCmd(const std::string& cmd, CommandEntry entry) {
|
void BindCmd(const std::string& cmd, CommandEntry entry) {
|
||||||
console->Commands[cmd] = std::move(entry);
|
console->Commands[cmd] = std::move(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,9 +183,9 @@ extern "C" char* ResourceMgr_LoadJPEG(char* data, int dataSize)
|
||||||
return (char*)finalBuffer;
|
return (char*)finalBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" char* ResourceMgr_LoadTexByName(char* texPath);
|
extern "C" char* ResourceMgr_LoadTexByName(const char* texPath);
|
||||||
|
|
||||||
extern "C" char* ResourceMgr_LoadTexOrDListByName(char* filePath) {
|
extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) {
|
||||||
auto res = OTRGlobals::Instance->context->GetResourceManager()->LoadResource(filePath);
|
auto res = OTRGlobals::Instance->context->GetResourceManager()->LoadResource(filePath);
|
||||||
|
|
||||||
if (res->resType == Ship::ResourceType::DisplayList)
|
if (res->resType == Ship::ResourceType::DisplayList)
|
||||||
|
@ -196,28 +196,28 @@ extern "C" char* ResourceMgr_LoadTexOrDListByName(char* filePath) {
|
||||||
return ResourceMgr_LoadTexByName(filePath);
|
return ResourceMgr_LoadTexByName(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" char* ResourceMgr_LoadPlayerAnimByName(char* animPath) {
|
extern "C" char* ResourceMgr_LoadPlayerAnimByName(const char* animPath) {
|
||||||
auto anim = std::static_pointer_cast<Ship::PlayerAnimation>(
|
auto anim = std::static_pointer_cast<Ship::PlayerAnimation>(
|
||||||
OTRGlobals::Instance->context->GetResourceManager()->LoadResource(animPath));
|
OTRGlobals::Instance->context->GetResourceManager()->LoadResource(animPath));
|
||||||
|
|
||||||
return (char*)&anim->limbRotData[0];
|
return (char*)&anim->limbRotData[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" Gfx* ResourceMgr_LoadGfxByName(char* path)
|
extern "C" Gfx* ResourceMgr_LoadGfxByName(const char* path)
|
||||||
{
|
{
|
||||||
auto res = std::static_pointer_cast<Ship::DisplayList>(
|
auto res = std::static_pointer_cast<Ship::DisplayList>(
|
||||||
OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
||||||
return (Gfx*)&res->instructions[0];
|
return (Gfx*)&res->instructions[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" char* ResourceMgr_LoadArrayByName(char* path)
|
extern "C" char* ResourceMgr_LoadArrayByName(const char* path)
|
||||||
{
|
{
|
||||||
auto res = std::static_pointer_cast<Ship::Array>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
auto res = std::static_pointer_cast<Ship::Array>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
||||||
|
|
||||||
return (char*)res->scalars.data();
|
return (char*)res->scalars.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" char* ResourceMgr_LoadArrayByNameAsVec3s(char* path) {
|
extern "C" char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path) {
|
||||||
auto res =
|
auto res =
|
||||||
std::static_pointer_cast<Ship::Array>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
std::static_pointer_cast<Ship::Array>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ extern "C" char* ResourceMgr_LoadArrayByNameAsVec3s(char* path) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" CollisionHeader* ResourceMgr_LoadColByName(char* path)
|
extern "C" CollisionHeader* ResourceMgr_LoadColByName(const char* path)
|
||||||
{
|
{
|
||||||
auto colRes = std::static_pointer_cast<Ship::CollisionHeader>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
auto colRes = std::static_pointer_cast<Ship::CollisionHeader>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ extern "C" CollisionHeader* ResourceMgr_LoadColByName(char* path)
|
||||||
return (CollisionHeader*)colHeader;
|
return (CollisionHeader*)colHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" Vtx * ResourceMgr_LoadVtxByName(char* path)
|
extern "C" Vtx * ResourceMgr_LoadVtxByName(const char* path)
|
||||||
{
|
{
|
||||||
auto res = std::static_pointer_cast<Ship::Array>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
auto res = std::static_pointer_cast<Ship::Array>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
||||||
return (Vtx*)res->vertices.data();
|
return (Vtx*)res->vertices.data();
|
||||||
|
@ -355,7 +355,7 @@ extern "C" int ResourceMgr_OTRSigCheck(char* imgData)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AnimationHeaderCommon* ResourceMgr_LoadAnimByName(char* path) {
|
extern "C" AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path) {
|
||||||
auto res = std::static_pointer_cast<Ship::Animation>(
|
auto res = std::static_pointer_cast<Ship::Animation>(
|
||||||
OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ extern "C" AnimationHeaderCommon* ResourceMgr_LoadAnimByName(char* path) {
|
||||||
return anim;
|
return anim;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(char* path) {
|
extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path) {
|
||||||
auto res = std::static_pointer_cast<Ship::Skeleton>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
auto res = std::static_pointer_cast<Ship::Skeleton>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
||||||
|
|
||||||
if (res->cachedGameAsset != nullptr)
|
if (res->cachedGameAsset != nullptr)
|
||||||
|
@ -470,14 +470,14 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(char* path) {
|
||||||
limbC->sibling = limb->siblingIndex;
|
limbC->sibling = limb->siblingIndex;
|
||||||
|
|
||||||
if (limb->dListPtr != "") {
|
if (limb->dListPtr != "") {
|
||||||
auto dList = ResourceMgr_LoadGfxByName((char*)limb->dListPtr.c_str());
|
auto dList = ResourceMgr_LoadGfxByName(limb->dListPtr.c_str());
|
||||||
limbC->dLists[0] = dList;
|
limbC->dLists[0] = dList;
|
||||||
} else {
|
} else {
|
||||||
limbC->dLists[0] = nullptr;
|
limbC->dLists[0] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (limb->dList2Ptr != "") {
|
if (limb->dList2Ptr != "") {
|
||||||
auto dList = ResourceMgr_LoadGfxByName((char*)limb->dList2Ptr.c_str());
|
auto dList = ResourceMgr_LoadGfxByName(limb->dList2Ptr.c_str());
|
||||||
limbC->dLists[1] = dList;
|
limbC->dLists[1] = dList;
|
||||||
} else {
|
} else {
|
||||||
limbC->dLists[1] = nullptr;
|
limbC->dLists[1] = nullptr;
|
||||||
|
@ -496,7 +496,7 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(char* path) {
|
||||||
limbC->dList = nullptr;
|
limbC->dList = nullptr;
|
||||||
|
|
||||||
if (!limb->dListPtr.empty()) {
|
if (!limb->dListPtr.empty()) {
|
||||||
const auto dList = ResourceMgr_LoadGfxByName(const_cast<char*>(limb->dListPtr.c_str()));
|
const auto dList = ResourceMgr_LoadGfxByName(limb->dListPtr.c_str());
|
||||||
limbC->dList = dList;
|
limbC->dList = dList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,12 +512,12 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(char* path) {
|
||||||
limbC->dList[1] = nullptr;
|
limbC->dList[1] = nullptr;
|
||||||
|
|
||||||
if (!limb->dListPtr.empty()) {
|
if (!limb->dListPtr.empty()) {
|
||||||
const auto dList = ResourceMgr_LoadGfxByName(const_cast<char*>(limb->dListPtr.c_str()));
|
const auto dList = ResourceMgr_LoadGfxByName(limb->dListPtr.c_str());
|
||||||
limbC->dList[0] = dList;
|
limbC->dList[0] = dList;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!limb->dList2Ptr.empty()) {
|
if (!limb->dList2Ptr.empty()) {
|
||||||
const auto dList = ResourceMgr_LoadGfxByName(const_cast<char*>(limb->dList2Ptr.c_str()));
|
const auto dList = ResourceMgr_LoadGfxByName(limb->dList2Ptr.c_str());
|
||||||
limbC->dList[1] = dList;
|
limbC->dList[1] = dList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,7 +543,7 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(char* path) {
|
||||||
limbC->segmentType = 0;
|
limbC->segmentType = 0;
|
||||||
|
|
||||||
if (limb->skinSegmentType == Ship::ZLimbSkinType::SkinType_DList)
|
if (limb->skinSegmentType == Ship::ZLimbSkinType::SkinType_DList)
|
||||||
limbC->segment = ResourceMgr_LoadGfxByName(const_cast<char*>(limb->skinDList.c_str()));
|
limbC->segment = ResourceMgr_LoadGfxByName(limb->skinDList.c_str());
|
||||||
else if (limb->skinSegmentType == Ship::ZLimbSkinType::SkinType_4) {
|
else if (limb->skinSegmentType == Ship::ZLimbSkinType::SkinType_4) {
|
||||||
const auto animData = new SkinAnimatedLimbData;
|
const auto animData = new SkinAnimatedLimbData;
|
||||||
const int skinDataSize = limb->skinData.size();
|
const int skinDataSize = limb->skinData.size();
|
||||||
|
@ -551,7 +551,7 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(char* path) {
|
||||||
animData->totalVtxCount = limb->skinVtxCnt;
|
animData->totalVtxCount = limb->skinVtxCnt;
|
||||||
animData->limbModifCount = skinDataSize;
|
animData->limbModifCount = skinDataSize;
|
||||||
animData->limbModifications = new SkinLimbModif[animData->limbModifCount];
|
animData->limbModifications = new SkinLimbModif[animData->limbModifCount];
|
||||||
animData->dlist = ResourceMgr_LoadGfxByName(const_cast<char*>(limb->skinDList2.c_str()));
|
animData->dlist = ResourceMgr_LoadGfxByName(limb->skinDList2.c_str());
|
||||||
|
|
||||||
for (int i = 0; i < skinDataSize; i++)
|
for (int i = 0; i < skinDataSize; i++)
|
||||||
{
|
{
|
||||||
|
@ -611,7 +611,7 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(char* path) {
|
||||||
return baseHeader;
|
return baseHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" s32* ResourceMgr_LoadCSByName(char* path)
|
extern "C" s32* ResourceMgr_LoadCSByName(const char* path)
|
||||||
{
|
{
|
||||||
auto res = std::static_pointer_cast<Ship::Cutscene>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
auto res = std::static_pointer_cast<Ship::Cutscene>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
||||||
return (s32*)res->commands.data();
|
return (s32*)res->commands.data();
|
||||||
|
|
|
@ -31,17 +31,17 @@ uint32_t ResourceMgr_GetGameVersion();
|
||||||
void ResourceMgr_CacheDirectory(const char* resName);
|
void ResourceMgr_CacheDirectory(const char* resName);
|
||||||
void ResourceMgr_LoadFile(const char* resName);
|
void ResourceMgr_LoadFile(const char* resName);
|
||||||
char* ResourceMgr_LoadFileFromDisk(const char* filePath);
|
char* ResourceMgr_LoadFileFromDisk(const char* filePath);
|
||||||
char* ResourceMgr_LoadTexByName(char* texPath);
|
char* ResourceMgr_LoadTexByName(const char* texPath);
|
||||||
char* ResourceMgr_LoadTexOrDListByName(char* filePath);
|
char* ResourceMgr_LoadTexOrDListByName(const char* filePath);
|
||||||
char* ResourceMgr_LoadPlayerAnimByName(char* animPath);
|
char* ResourceMgr_LoadPlayerAnimByName(const char* animPath);
|
||||||
char* ResourceMgr_GetNameByCRC(uint64_t crc, char* alloc);
|
char* ResourceMgr_GetNameByCRC(uint64_t crc, char* alloc);
|
||||||
Gfx* ResourceMgr_LoadGfxByCRC(uint64_t crc);
|
Gfx* ResourceMgr_LoadGfxByCRC(uint64_t crc);
|
||||||
Gfx* ResourceMgr_LoadGfxByName(char* path);
|
Gfx* ResourceMgr_LoadGfxByName(const char* path);
|
||||||
Vtx* ResourceMgr_LoadVtxByCRC(uint64_t crc);
|
Vtx* ResourceMgr_LoadVtxByCRC(uint64_t crc);
|
||||||
Vtx* ResourceMgr_LoadVtxByName(char* path);
|
Vtx* ResourceMgr_LoadVtxByName(const char* path);
|
||||||
CollisionHeader* ResourceMgr_LoadColByName(char* path);
|
CollisionHeader* ResourceMgr_LoadColByName(const char* path);
|
||||||
uint64_t GetPerfCounter();
|
uint64_t GetPerfCounter();
|
||||||
struct SkeletonHeader* ResourceMgr_LoadSkeletonByName(char* path);
|
struct SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path);
|
||||||
int ResourceMgr_OTRSigCheck(char* imgData);
|
int ResourceMgr_OTRSigCheck(char* imgData);
|
||||||
uint64_t osGetTime(void);
|
uint64_t osGetTime(void);
|
||||||
uint32_t osGetCount(void);
|
uint32_t osGetCount(void);
|
||||||
|
|
|
@ -766,9 +766,9 @@ void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCt
|
||||||
break;
|
break;
|
||||||
case SCENE_JYASINZOU:
|
case SCENE_JYASINZOU:
|
||||||
texture = gSpiritTempleTitleCardENGTex;
|
texture = gSpiritTempleTitleCardENGTex;
|
||||||
break;
|
break;
|
||||||
case SCENE_HAKADAN:
|
case SCENE_HAKADAN:
|
||||||
texture = gSpiritTempleTitleCardENGTex;
|
texture = gShadowTempleTitleCardENGTex;
|
||||||
break;
|
break;
|
||||||
case SCENE_HAKADANCH:
|
case SCENE_HAKADANCH:
|
||||||
texture = gBottomOfTheWellTitleCardENGTex;
|
texture = gBottomOfTheWellTitleCardENGTex;
|
||||||
|
|
|
@ -9434,7 +9434,7 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) {
|
||||||
|
|
||||||
if ((sp50 == 0) || (sp50 < -1)) {
|
if ((sp50 == 0) || (sp50 < -1)) {
|
||||||
titleFileSize = scene->titleFile.vromEnd - scene->titleFile.vromStart;
|
titleFileSize = scene->titleFile.vromEnd - scene->titleFile.vromStart;
|
||||||
if ((titleFileSize != 0) && gSaveContext.showTitleCard) {
|
if (gSaveContext.showTitleCard) {
|
||||||
if ((gSaveContext.sceneSetupIndex < 4) &&
|
if ((gSaveContext.sceneSetupIndex < 4) &&
|
||||||
(gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].field &
|
(gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].field &
|
||||||
0x4000) &&
|
0x4000) &&
|
||||||
|
|
Loading…
Reference in New Issue