diff --git a/build.py b/build.py index dedfeb43..6ac5502b 100644 --- a/build.py +++ b/build.py @@ -7,15 +7,15 @@ from ninja_syntax import Writer import pathlib import hashlib -INCLUDE_DIRS = [ "include", - "libs\\JSystem\\include", - "libs\\MetroTRK\\include", - "libs\\MSL_C\\include", - "libs\\MSL_C++\\include", - "libs\\nw4r\\include", - "libs\\Runtime\\include", - "libs\\RVL_SDK\\include", - "libs\\RVLFaceLib\\include" ] +INCLUDE_DIRS = [ "include", + "libs/JSystem/include", + "libs/MetroTRK/include", + "libs/MSL_C/include", + "libs/MSL_C++/include", + "libs/nw4r/include", + "libs/Runtime/include", + "libs/RVL_SDK/include", + "libs/RVLFaceLib/include" ] LIBRARIES = [ "Game", "JSystem", "MetroTRK", "MSL_C", "MSL_C++", "nw4r", "Runtime", "RVL_SDK", "RVLFaceLib" ] @@ -24,9 +24,9 @@ for dir in INCLUDE_DIRS: incdirs += f'-I- -i {dir} ' COMPILER_CMD = f"-c -Cpp_exceptions off -maxerrors 1 -nodefaults -proc gekko -fp hard -lang=c++ -ipa file -inline auto,level=2 -O4,s -rtti off -sdata 4 -sdata2 4 -align powerpc -enum int -msgstyle gcc {incdirs}" -COMPILER_PATH = pathlib.Path("Compilers\\GC\\3.0a3\\mwcceppc.exe") -HASHES_BASE_PATH = pathlib.Path("data\\hashes.txt") -CHANGED_PATH = pathlib.Path("data\\changed.txt") +COMPILER_PATH = pathlib.Path("Compilers/GC/3.0a3/mwcceppc.exe") +HASHES_BASE_PATH = pathlib.Path("data/hashes.txt") +CHANGED_PATH = pathlib.Path("data/changed.txt") # if we don't have this file, create it if not os.path.exists(CHANGED_PATH): @@ -66,7 +66,7 @@ LIBRARY_COMPILER = { "MSL_C++": COMPILER_PATH, "nw4r": COMPILER_PATH, "Runtime": COMPILER_PATH, - "RVL_SDK": pathlib.Path("Compilers\\GC\\3.0\\mwcceppc.exe"), + "RVL_SDK": pathlib.Path("Compilers/GC/3.0/mwcceppc.exe"), "RVLFaceLib": COMPILER_PATH } @@ -76,7 +76,7 @@ def cleanLibraryBuild(lib): if lib == "Game": build_path = "build" else: - build_path = f"libs\\{lib}\\build" + build_path = f"libs/{lib}/build" if os.path.exists(build_path): shutil.rmtree(build_path) @@ -89,7 +89,10 @@ def genNinja(tasks): ninja_writer = Writer(ninja_file) for lib in LIBRARIES: libName = fixLibName(lib) - ninja_writer.rule(f"compile_{libName}", command=f'{LIBRARY_COMPILER[lib]} {LIBRARY_COMPILER_ARGS[lib]} $in -o $out', description=f'Compiling $in') + cmd = f'{LIBRARY_COMPILER[lib]} {LIBRARY_COMPILER_ARGS[lib]} $in -o $out' + if os.name != "nt": + cmd = f"wine {cmd}" + ninja_writer.rule(f"compile_{libName}", command=cmd, description=f'Compiling $in') for task in tasks: lib, source_path, build_path = task @@ -125,7 +128,7 @@ if clean: all_tasks = [] for lib in LIBRARIES: - tasks = collectTasks(lib, f"libs\\{lib}\\source") + tasks = collectTasks(lib, f"libs/{lib}/source") all_tasks.extend(tasks) genNinja(all_tasks) @@ -138,9 +141,9 @@ for lib in LIBRARIES: objs = [] if lib == "Game": - objs = glob.glob(f"build\\Game\\*\\*.o", recursive=True) + objs = glob.glob(f"build/Game/*/*.o", recursive=True) else: - objs = glob.glob(f"libs\\{lib}\\build\\{lib}\\*\\*.o") + objs = glob.glob(f"libs/{lib}/build/{lib}/*/*.o") # generate our hashes for obj in objs: diff --git a/check.py b/check.py index 1fa23248..faefccd7 100644 --- a/check.py +++ b/check.py @@ -44,9 +44,9 @@ def check_symbol(function_library, mangled_symbols, printInstrs): # associate the symbols with their relative object files for key in objs: if function_library.parent == "Game": - obj_files[key] = glob.glob(f"build\\Game\\*\\{objs[key]}", recursive=True) + obj_files[key] = glob.glob(f"build/Game/*/{objs[key]}", recursive=True) else: - obj_files[key] = glob.glob(f"libs\\{function_library.parent}\\build\\{function_library.parent}\\*\\{objs[key]}") + obj_files[key] = glob.glob(f"libs/{function_library.parent}/build/{function_library.parent}/*/{objs[key]}") for key in obj_files: if printInstrs: @@ -244,7 +244,7 @@ if len(sys.argv) == 1: printInstrs = True obj_files = [] - with open("data\\changed.txt", "r") as f: + with open("data/changed.txt", "r") as f: lines = f.readlines() for line in lines: diff --git a/csv/Demo.csv b/csv/Demo.csv index 42b95338..f2406c4b 100644 --- a/csv/Demo.csv +++ b/csv/Demo.csv @@ -139,70 +139,70 @@ push_back__Q22MR51Vector>FRCP19D __cl__Q22MR51FunctorV0MCFv,DemoExecutor.o,Demo.a,false clone__Q22MR51FunctorV0MCFP7JKRHeap,DemoExecutor.o,Demo.a,false __dt__12DemoExecutorFv,DemoExecutor.o,Demo.a,false -registerDemoActionFunction__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActorRCQ22MR11FunctorBasePCc,DemoExecutorFunction.o,Demo.a,false -registerDemoActionNerve__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActorPC5NervePCc,DemoExecutorFunction.o,Demo.a,false -isExistDemoPart__20DemoExecutorFunctionFPC12DemoExecutorPCc,DemoExecutorFunction.o,Demo.a,false -isExistDemoPartMain__20DemoExecutorFunctionFPC12DemoExecutorPCc,DemoExecutorFunction.o,Demo.a,false -isExistDemoPartSub__20DemoExecutorFunctionFPC12DemoExecutorPCc,DemoExecutorFunction.o,Demo.a,false -isRegisteredDemoCast__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActor,DemoExecutorFunction.o,Demo.a,false -isRegisteredDemoActionAppear__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActor,DemoExecutorFunction.o,Demo.a,false -isRegisteredDemoActionFunctor__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActor,DemoExecutorFunction.o,Demo.a,false -isRegisteredDemoActionNerve__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActor,DemoExecutorFunction.o,Demo.a,false +registerDemoActionFunction__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActorRCQ22MR11FunctorBasePCc,DemoExecutorFunction.o,Demo.a,true +registerDemoActionNerve__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActorPC5NervePCc,DemoExecutorFunction.o,Demo.a,true +isExistDemoPart__20DemoExecutorFunctionFPC12DemoExecutorPCc,DemoExecutorFunction.o,Demo.a,true +isExistDemoPartMain__20DemoExecutorFunctionFPC12DemoExecutorPCc,DemoExecutorFunction.o,Demo.a,true +isExistDemoPartSub__20DemoExecutorFunctionFPC12DemoExecutorPCc,DemoExecutorFunction.o,Demo.a,true +isRegisteredDemoCast__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActor,DemoExecutorFunction.o,Demo.a,true +isRegisteredDemoActionAppear__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActor,DemoExecutorFunction.o,Demo.a,true +isRegisteredDemoActionFunctor__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActor,DemoExecutorFunction.o,Demo.a,true +isRegisteredDemoActionNerve__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActor,DemoExecutorFunction.o,Demo.a,true tryCreateDemoTalkAnimCtrlForActor__20DemoExecutorFunctionFP12DemoExecutorP9LiveActorPCcPCc,DemoExecutorFunction.o,Demo.a,false tryCreateDemoTalkAnimCtrlForScene__20DemoExecutorFunctionFP12DemoExecutorP9LiveActorRC12JMapInfoIterPCcPCcll,DemoExecutorFunction.o,Demo.a,false -registerDemoTalkMessageCtrl__20DemoExecutorFunctionFP12DemoExecutorP9LiveActorP15TalkMessageCtrl,DemoExecutorFunction.o,Demo.a,false -setDemoTalkMessageCtrl__20DemoExecutorFunctionFP12DemoExecutorPC9LiveActorP15TalkMessageCtrl,DemoExecutorFunction.o,Demo.a,false -pauseTimeKeepDemo__20DemoExecutorFunctionFP12DemoExecutor,DemoExecutorFunction.o,Demo.a,false -resumeTimeKeepDemo__20DemoExecutorFunctionFP12DemoExecutor,DemoExecutorFunction.o,Demo.a,false -isPauseTimeKeepDemo__20DemoExecutorFunctionFPC12DemoExecutor,DemoExecutorFunction.o,Demo.a,false -getDemoDirector__12DemoFunctionFv,DemoFunction.o,Demo.a,false -getDemoCastSubGroupHolder__12DemoFunctionFv,DemoFunction.o,Demo.a,false -registerDemoSimpleCastAllFunction__12DemoFunctionFP9LiveActor,DemoFunction.o,Demo.a,false -registerDemoSimpleCastAllFunction__12DemoFunctionFP11LayoutActor,DemoFunction.o,Demo.a,false -registerDemoSimpleCastAllFunction__12DemoFunctionFP7NameObj,DemoFunction.o,Demo.a,false -registerDemoActionFunctorFunction__12DemoFunctionFPC9LiveActorRCQ22MR11FunctorBasePCc,DemoFunction.o,Demo.a,false -registerDemoActionFunctorFunction__12DemoFunctionFPC9LiveActorRCQ22MR11FunctorBasePCcPCc,DemoFunction.o,Demo.a,false -registerDemoActionNerveFunction__12DemoFunctionFPC9LiveActorPC5NervePCc,DemoFunction.o,Demo.a,false -tryStartDemoRegistered__12DemoFunctionFP9LiveActorPCc,DemoFunction.o,Demo.a,false -tryStartDemoRegisteredMarioPuppetable__12DemoFunctionFP9LiveActorPCc,DemoFunction.o,Demo.a,false -registerDemoExecutor__12DemoFunctionFP12DemoExecutor,DemoFunction.o,Demo.a,false -findDemoExecutor__12DemoFunctionFPCc,DemoFunction.o,Demo.a,false -findDemoExecutor__12DemoFunctionFPC9LiveActor,DemoFunction.o,Demo.a,false -findDemoExecutorActive__12DemoFunctionFPC9LiveActor,DemoFunction.o,Demo.a,false -isDemoCast__12DemoFunctionFPC12DemoExecutorPC9LiveActor,DemoFunction.o,Demo.a,false -isExistDemoPart__12DemoFunctionFPC12DemoExecutorPCc,DemoFunction.o,Demo.a,false -getCurrentTimeKeeper__26@unnamed@DemoFunction_cpp@Fv,DemoFunction.o,Demo.a,false -getCurrentSubPartKeeper__26@unnamed@DemoFunction_cpp@Fv,DemoFunction.o,Demo.a,false -isCurrentMainPart__26@unnamed@DemoFunction_cpp@FPCc,DemoFunction.o,Demo.a,false -isDemoPartActiveFunction__12DemoFunctionFPCc,DemoFunction.o,Demo.a,false -getDemoPartStepFunction__12DemoFunctionFPCc,DemoFunction.o,Demo.a,false -getDemoPartTotalStepFunction__12DemoFunctionFPCc,DemoFunction.o,Demo.a,false -isDemoLastPartLastStep__12DemoFunctionFv,DemoFunction.o,Demo.a,false -isDemoSuspendOrLastPartLastStep__12DemoFunctionFv,DemoFunction.o,Demo.a,false -getCurrentDemoPartNameMain__12DemoFunctionFPCc,DemoFunction.o,Demo.a,false -isTargetDemoCast__12DemoFunctionFP9LiveActorRC12JMapInfoIterPCcl,DemoFunction.o,Demo.a,false -isRegisteredDemoActionAppear__12DemoFunctionFPC9LiveActor,DemoFunction.o,Demo.a,false -isRegisteredDemoActionFunctor__12DemoFunctionFPC9LiveActor,DemoFunction.o,Demo.a,false -isRegisteredDemoActionFunctor__12DemoFunctionFPC9LiveActorPCc,DemoFunction.o,Demo.a,false -isRegisteredDemoActionNerve__12DemoFunctionFPC9LiveActor,DemoFunction.o,Demo.a,false -requestDemoCastMovementOn__12DemoFunctionFP9LiveActor,DemoFunction.o,Demo.a,false -isRegisteredDemoCast__12DemoFunctionFPC9LiveActorPCc,DemoFunction.o,Demo.a,false -pauseTimeKeepDemo__12DemoFunctionFP9LiveActor,DemoFunction.o,Demo.a,false -resumeTimeKeepDemo__12DemoFunctionFP9LiveActor,DemoFunction.o,Demo.a,false -isPauseTimeKeepDemo__12DemoFunctionFP9LiveActor,DemoFunction.o,Demo.a,false -pauseTimeKeepDemo__12DemoFunctionFPCc,DemoFunction.o,Demo.a,false -resumeTimeKeepDemo__12DemoFunctionFPCc,DemoFunction.o,Demo.a,false -isPauseTimeKeepDemo__12DemoFunctionFPCc,DemoFunction.o,Demo.a,false -tryCreateDemoTalkAnimCtrlForActor__12DemoFunctionFP9LiveActorPCcPCc,DemoFunction.o,Demo.a,false -tryCreateDemoTalkAnimCtrlForActorDirect__12DemoFunctionFP9LiveActorPCcPCcPCc,DemoFunction.o,Demo.a,false -tryCreateDemoTalkAnimCtrlForScene__12DemoFunctionFP9LiveActorRC12JMapInfoIterPCcPCcll,DemoFunction.o,Demo.a,false -tryCreateDemoTalkAnimCtrlForSceneDirect__12DemoFunctionFP9LiveActorPCcRC12JMapInfoIterPCcPCcll,DemoFunction.o,Demo.a,false -registerDemoTalkMessageCtrl__12DemoFunctionFP9LiveActorP15TalkMessageCtrl,DemoFunction.o,Demo.a,false -registerDemoTalkMessageCtrlDirect__12DemoFunctionFP9LiveActorP15TalkMessageCtrlPCc,DemoFunction.o,Demo.a,false -setDemoTalkMessageCtrlDirect__12DemoFunctionFPC9LiveActorP15TalkMessageCtrlPCc,DemoFunction.o,Demo.a,false +registerDemoTalkMessageCtrl__20DemoExecutorFunctionFP12DemoExecutorP9LiveActorP15TalkMessageCtrl,DemoExecutorFunction.o,Demo.a,true +setDemoTalkMessageCtrl__20DemoExecutorFunctionFP12DemoExecutorPC9LiveActorP15TalkMessageCtrl,DemoExecutorFunction.o,Demo.a,true +pauseTimeKeepDemo__20DemoExecutorFunctionFP12DemoExecutor,DemoExecutorFunction.o,Demo.a,true +resumeTimeKeepDemo__20DemoExecutorFunctionFP12DemoExecutor,DemoExecutorFunction.o,Demo.a,true +isPauseTimeKeepDemo__20DemoExecutorFunctionFPC12DemoExecutor,DemoExecutorFunction.o,Demo.a,true +getDemoDirector__12DemoFunctionFv,DemoFunction.o,Demo.a,true +getDemoCastSubGroupHolder__12DemoFunctionFv,DemoFunction.o,Demo.a,true +registerDemoSimpleCastAllFunction__12DemoFunctionFP9LiveActor,DemoFunction.o,Demo.a,true +registerDemoSimpleCastAllFunction__12DemoFunctionFP11LayoutActor,DemoFunction.o,Demo.a,true +registerDemoSimpleCastAllFunction__12DemoFunctionFP7NameObj,DemoFunction.o,Demo.a,true +registerDemoActionFunctorFunction__12DemoFunctionFPC9LiveActorRCQ22MR11FunctorBasePCc,DemoFunction.o,Demo.a,true +registerDemoActionFunctorFunction__12DemoFunctionFPC9LiveActorRCQ22MR11FunctorBasePCcPCc,DemoFunction.o,Demo.a,true +registerDemoActionNerveFunction__12DemoFunctionFPC9LiveActorPC5NervePCc,DemoFunction.o,Demo.a,true +tryStartDemoRegistered__12DemoFunctionFP9LiveActorPCc,DemoFunction.o,Demo.a,true +tryStartDemoRegisteredMarioPuppetable__12DemoFunctionFP9LiveActorPCc,DemoFunction.o,Demo.a,true +registerDemoExecutor__12DemoFunctionFP12DemoExecutor,DemoFunction.o,Demo.a,true +findDemoExecutor__12DemoFunctionFPCc,DemoFunction.o,Demo.a,true +findDemoExecutor__12DemoFunctionFPC9LiveActor,DemoFunction.o,Demo.a,true +findDemoExecutorActive__12DemoFunctionFPC9LiveActor,DemoFunction.o,Demo.a,true +isDemoCast__12DemoFunctionFPC12DemoExecutorPC9LiveActor,DemoFunction.o,Demo.a,true +isExistDemoPart__12DemoFunctionFPC12DemoExecutorPCc,DemoFunction.o,Demo.a,true +getCurrentTimeKeeper__26@unnamed@DemoFunction_cpp@Fv,DemoFunction.o,Demo.a,true +getCurrentSubPartKeeper__26@unnamed@DemoFunction_cpp@Fv,DemoFunction.o,Demo.a,true +isCurrentMainPart__26@unnamed@DemoFunction_cpp@FPCc,DemoFunction.o,Demo.a,true +isDemoPartActiveFunction__12DemoFunctionFPCc,DemoFunction.o,Demo.a,true +getDemoPartStepFunction__12DemoFunctionFPCc,DemoFunction.o,Demo.a,true +getDemoPartTotalStepFunction__12DemoFunctionFPCc,DemoFunction.o,Demo.a,true +isDemoLastPartLastStep__12DemoFunctionFv,DemoFunction.o,Demo.a,true +isDemoSuspendOrLastPartLastStep__12DemoFunctionFv,DemoFunction.o,Demo.a,true +getCurrentDemoPartNameMain__12DemoFunctionFPCc,DemoFunction.o,Demo.a,true +isTargetDemoCast__12DemoFunctionFP9LiveActorRC12JMapInfoIterPCcl,DemoFunction.o,Demo.a,true +isRegisteredDemoActionAppear__12DemoFunctionFPC9LiveActor,DemoFunction.o,Demo.a,true +isRegisteredDemoActionFunctor__12DemoFunctionFPC9LiveActor,DemoFunction.o,Demo.a,true +isRegisteredDemoActionFunctor__12DemoFunctionFPC9LiveActorPCc,DemoFunction.o,Demo.a,true +isRegisteredDemoActionNerve__12DemoFunctionFPC9LiveActor,DemoFunction.o,Demo.a,true +requestDemoCastMovementOn__12DemoFunctionFP9LiveActor,DemoFunction.o,Demo.a,true +isRegisteredDemoCast__12DemoFunctionFPC9LiveActorPCc,DemoFunction.o,Demo.a,true +pauseTimeKeepDemo__12DemoFunctionFP9LiveActor,DemoFunction.o,Demo.a,true +resumeTimeKeepDemo__12DemoFunctionFP9LiveActor,DemoFunction.o,Demo.a,true +isPauseTimeKeepDemo__12DemoFunctionFP9LiveActor,DemoFunction.o,Demo.a,true +pauseTimeKeepDemo__12DemoFunctionFPCc,DemoFunction.o,Demo.a,true +resumeTimeKeepDemo__12DemoFunctionFPCc,DemoFunction.o,Demo.a,true +isPauseTimeKeepDemo__12DemoFunctionFPCc,DemoFunction.o,Demo.a,true +tryCreateDemoTalkAnimCtrlForActor__12DemoFunctionFP9LiveActorPCcPCc,DemoFunction.o,Demo.a,true +tryCreateDemoTalkAnimCtrlForActorDirect__12DemoFunctionFP9LiveActorPCcPCcPCc,DemoFunction.o,Demo.a,true +tryCreateDemoTalkAnimCtrlForScene__12DemoFunctionFP9LiveActorRC12JMapInfoIterPCcPCcll,DemoFunction.o,Demo.a,true +tryCreateDemoTalkAnimCtrlForSceneDirect__12DemoFunctionFP9LiveActorPCcRC12JMapInfoIterPCcPCcll,DemoFunction.o,Demo.a,true +registerDemoTalkMessageCtrl__12DemoFunctionFP9LiveActorP15TalkMessageCtrl,DemoFunction.o,Demo.a,true +registerDemoTalkMessageCtrlDirect__12DemoFunctionFP9LiveActorP15TalkMessageCtrlPCc,DemoFunction.o,Demo.a,true +setDemoTalkMessageCtrlDirect__12DemoFunctionFPC9LiveActorP15TalkMessageCtrlPCc,DemoFunction.o,Demo.a,true loadDemoArchive__12DemoFunctionFv,DemoFunction.o,Demo.a,true -createSheetParser__12DemoFunctionFPC12DemoExecutorPCcPP8JMapInfo,DemoFunction.o,Demo.a,false -isDemoPartTalk__12DemoFunctionFPCc,DemoFunction.o,Demo.a,false +createSheetParser__12DemoFunctionFPC12DemoExecutorPCcPP8JMapInfo,DemoFunction.o,Demo.a,true +isDemoPartTalk__12DemoFunctionFPCc,DemoFunction.o,Demo.a,true __ct__15DemoKoopaJrShipFPCc,DemoKoopaJrShip.o,Demo.a,false init__15DemoKoopaJrShipFRC12JMapInfoIter,DemoKoopaJrShip.o,Demo.a,false appear__15DemoKoopaJrShipFv,DemoKoopaJrShip.o,Demo.a,false diff --git a/data/Game.json b/data/Game.json index 0db6f10c..47dc879a 100644 --- a/data/Game.json +++ b/data/Game.json @@ -1,6 +1,6 @@ { "schemaVersion": 1, "label": "Game", - "message": "15.945%", + "message": "16.036%", "color": "blue" } \ No newline at end of file diff --git a/data/json/Demo.json b/data/json/Demo.json index 6066ee42..3adfe05f 100644 --- a/data/json/Demo.json +++ b/data/json/Demo.json @@ -1,6 +1,6 @@ { "schemaVersion": 1, "label": "Demo", - "message": "3.744%", + "message": "10.949%", "color": "yellow" } \ No newline at end of file diff --git a/decompme.py b/decompme.py index a657a4ab..d6378c2e 100644 --- a/decompme.py +++ b/decompme.py @@ -13,21 +13,21 @@ import helpers import glob import pathlib -INCLUDE_DIRS = [ "include", - "libs\\JSystem\\include", - "libs\\MetroTRK\\include", - "libs\\MSL_C\\include", - "libs\\MSL_C++\\include", - "libs\\nw4r\\include", - "libs\\Runtime\\include", - "libs\\RVL_SDK\\include", - "libs\\RVLFaceLib\\include" ] +INCLUDE_DIRS = [ "include", + "libs/JSystem/include", + "libs/MetroTRK/include", + "libs/MSL_C/include", + "libs/MSL_C++/include", + "libs/nw4r/include", + "libs/Runtime/include", + "libs/RVL_SDK/include", + "libs/RVLFaceLib/include" ] LIBRARIES = [ "Game", "JSystem", "MetroTRK", "MSL_C", "nw4r", "Runtime", "RVL_SDK", "RVLFaceLib" ] incdirs = " ".join([f'-I- -i {dir}' for dir in INCLUDE_DIRS]) PREPROC_CMD = f"-EP {incdirs}" -COMPILER_PATH = pathlib.Path("Compilers\\GC\\3.0a3\\mwcceppc.exe") +COMPILER_PATH = pathlib.Path("Compilers/GC/3.0a3/mwcceppc.exe") COMPILER_CMD = f"-c -Cpp_exceptions off -maxerrors 1 -nodefaults -proc gekko -fp hard -lang=c++ -ipa file -inline auto,level=2 -O4,s -rtti off -sdata 4 -sdata2 4 -align powerpc -enum int -msgstyle gcc" if len(sys.argv) < 2: @@ -67,9 +67,9 @@ if objName is None: filename = objName.replace(".o", ".cpp") if containedLib == "Game": - glob_path = f"source\\Game\\**\\{filename}" + glob_path = f"source/Game/**/{filename}" else: - glob_path = f"libs\\{containedLib}\\**\\{filename}" + glob_path = f"libs/{containedLib}/**/{filename}" for n in glob.glob(glob_path, recursive=True): path = n diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md index 1562a453..7ef350b3 100644 --- a/docs/PROGRESS.md +++ b/docs/PROGRESS.md @@ -6,7 +6,7 @@ | [AudioLib](https://github.com/shibbo/Petari/blob/master/docs/lib/Game/AudioLib.md) | 0.0% | | [Boss](https://github.com/shibbo/Petari/blob/master/docs/lib/Game/Boss.md) | 13.879584746291634% | | [Camera](https://github.com/shibbo/Petari/blob/master/docs/lib/Game/Camera.md) | 34.12644987572494% | -| [Demo](https://github.com/shibbo/Petari/blob/master/docs/lib/Game/Demo.md) | 3.7442572741194486% | +| [Demo](https://github.com/shibbo/Petari/blob/master/docs/lib/Game/Demo.md) | 10.949464012251148% | | [Effect](https://github.com/shibbo/Petari/blob/master/docs/lib/Game/Effect.md) | 2.2184743124026984% | | [Enemy](https://github.com/shibbo/Petari/blob/master/docs/lib/Game/Enemy.md) | 3.920409631175268% | | [GameAudio](https://github.com/shibbo/Petari/blob/master/docs/lib/Game/GameAudio.md) | 0.0% | diff --git a/docs/lib/Game/Demo.md b/docs/lib/Game/Demo.md index 3bdc4b30..2e0e3cc0 100644 --- a/docs/lib/Game/Demo.md +++ b/docs/lib/Game/Demo.md @@ -19,8 +19,8 @@ | [DemoCtrlBase.o](https://github.com/shibbo/Petari/blob/master/docs/lib/Game/Demo/DemoCtrlBase.md) | 0.0% | 0 / 7 | 0.0% | :x: | [DemoDirector.o](https://github.com/shibbo/Petari/blob/master/docs/lib/Game/Demo/DemoDirector.md) | 0.0% | 0 / 18 | 0.0% | :x: | [DemoExecutor.o](https://github.com/shibbo/Petari/blob/master/docs/lib/Game/Demo/DemoExecutor.md) | 0.0% | 0 / 28 | 0.0% | :x: -| [DemoExecutorFunction.o](https://github.com/shibbo/Petari/blob/master/docs/lib/Game/Demo/DemoExecutorFunction.md) | 0.0% | 0 / 16 | 0.0% | :x: -| [DemoFunction.o](https://github.com/shibbo/Petari/blob/master/docs/lib/Game/Demo/DemoFunction.md) | 1.8094089264173705% | 1 / 48 | 2.083333333333333% | :eight_pointed_black_star: +| [DemoExecutorFunction.o](https://github.com/shibbo/Petari/blob/master/docs/lib/Game/Demo/DemoExecutorFunction.md) | 64.14141414141415% | 14 / 16 | 87.5% | :eight_pointed_black_star: +| [DemoFunction.o](https://github.com/shibbo/Petari/blob/master/docs/lib/Game/Demo/DemoFunction.md) | 100.0% | 48 / 48 | 100.0% | :white_check_mark: | [DemoKoopaJrShip.o](https://github.com/shibbo/Petari/blob/master/docs/lib/Game/Demo/DemoKoopaJrShip.md) | 0.0% | 0 / 20 | 0.0% | :x: | [DemoPadRumbler.o](https://github.com/shibbo/Petari/blob/master/docs/lib/Game/Demo/DemoPadRumbler.md) | 0.0% | 0 / 2 | 0.0% | :x: | [DemoParamCommonDataTable.o](https://github.com/shibbo/Petari/blob/master/docs/lib/Game/Demo/DemoParamCommonDataTable.md) | 0.0% | 0 / 7 | 0.0% | :x: diff --git a/docs/lib/Game/Demo/DemoExecutorFunction.md b/docs/lib/Game/Demo/DemoExecutorFunction.md index cee2bc79..714ae145 100644 --- a/docs/lib/Game/Demo/DemoExecutorFunction.md +++ b/docs/lib/Game/Demo/DemoExecutorFunction.md @@ -5,23 +5,23 @@ | :white_check_mark: | Function is completed. -# 0 / 16 Completed -- (0.0%) +# 14 / 16 Completed -- (87.5%) # DemoExecutorFunction.o | Symbol | Decompiled? | | ------------- | ------------- | -| `registerDemoActionFunction__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActorRCQ22MR11FunctorBasePCc` | :x: | -| `registerDemoActionNerve__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActorPC5NervePCc` | :x: | -| `isExistDemoPart__20DemoExecutorFunctionFPC12DemoExecutorPCc` | :x: | -| `isExistDemoPartMain__20DemoExecutorFunctionFPC12DemoExecutorPCc` | :x: | -| `isExistDemoPartSub__20DemoExecutorFunctionFPC12DemoExecutorPCc` | :x: | -| `isRegisteredDemoCast__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActor` | :x: | -| `isRegisteredDemoActionAppear__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActor` | :x: | -| `isRegisteredDemoActionFunctor__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActor` | :x: | -| `isRegisteredDemoActionNerve__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActor` | :x: | +| `registerDemoActionFunction__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActorRCQ22MR11FunctorBasePCc` | :white_check_mark: | +| `registerDemoActionNerve__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActorPC5NervePCc` | :white_check_mark: | +| `isExistDemoPart__20DemoExecutorFunctionFPC12DemoExecutorPCc` | :white_check_mark: | +| `isExistDemoPartMain__20DemoExecutorFunctionFPC12DemoExecutorPCc` | :white_check_mark: | +| `isExistDemoPartSub__20DemoExecutorFunctionFPC12DemoExecutorPCc` | :white_check_mark: | +| `isRegisteredDemoCast__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActor` | :white_check_mark: | +| `isRegisteredDemoActionAppear__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActor` | :white_check_mark: | +| `isRegisteredDemoActionFunctor__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActor` | :white_check_mark: | +| `isRegisteredDemoActionNerve__20DemoExecutorFunctionFPC12DemoExecutorPC9LiveActor` | :white_check_mark: | | `tryCreateDemoTalkAnimCtrlForActor__20DemoExecutorFunctionFP12DemoExecutorP9LiveActorPCcPCc` | :x: | | `tryCreateDemoTalkAnimCtrlForScene__20DemoExecutorFunctionFP12DemoExecutorP9LiveActorRC12JMapInfoIterPCcPCcll` | :x: | -| `registerDemoTalkMessageCtrl__20DemoExecutorFunctionFP12DemoExecutorP9LiveActorP15TalkMessageCtrl` | :x: | -| `setDemoTalkMessageCtrl__20DemoExecutorFunctionFP12DemoExecutorPC9LiveActorP15TalkMessageCtrl` | :x: | -| `pauseTimeKeepDemo__20DemoExecutorFunctionFP12DemoExecutor` | :x: | -| `resumeTimeKeepDemo__20DemoExecutorFunctionFP12DemoExecutor` | :x: | -| `isPauseTimeKeepDemo__20DemoExecutorFunctionFPC12DemoExecutor` | :x: | +| `registerDemoTalkMessageCtrl__20DemoExecutorFunctionFP12DemoExecutorP9LiveActorP15TalkMessageCtrl` | :white_check_mark: | +| `setDemoTalkMessageCtrl__20DemoExecutorFunctionFP12DemoExecutorPC9LiveActorP15TalkMessageCtrl` | :white_check_mark: | +| `pauseTimeKeepDemo__20DemoExecutorFunctionFP12DemoExecutor` | :white_check_mark: | +| `resumeTimeKeepDemo__20DemoExecutorFunctionFP12DemoExecutor` | :white_check_mark: | +| `isPauseTimeKeepDemo__20DemoExecutorFunctionFPC12DemoExecutor` | :white_check_mark: | diff --git a/docs/lib/Game/Demo/DemoFunction.md b/docs/lib/Game/Demo/DemoFunction.md index 7eafcb07..b3ac480d 100644 --- a/docs/lib/Game/Demo/DemoFunction.md +++ b/docs/lib/Game/Demo/DemoFunction.md @@ -5,55 +5,55 @@ | :white_check_mark: | Function is completed. -# 1 / 48 Completed -- (2.083333333333333%) +# 48 / 48 Completed -- (100.0%) # DemoFunction.o | Symbol | Decompiled? | | ------------- | ------------- | -| `getDemoDirector__12DemoFunctionFv` | :x: | -| `getDemoCastSubGroupHolder__12DemoFunctionFv` | :x: | -| `registerDemoSimpleCastAllFunction__12DemoFunctionFP9LiveActor` | :x: | -| `registerDemoSimpleCastAllFunction__12DemoFunctionFP11LayoutActor` | :x: | -| `registerDemoSimpleCastAllFunction__12DemoFunctionFP7NameObj` | :x: | -| `registerDemoActionFunctorFunction__12DemoFunctionFPC9LiveActorRCQ22MR11FunctorBasePCc` | :x: | -| `registerDemoActionFunctorFunction__12DemoFunctionFPC9LiveActorRCQ22MR11FunctorBasePCcPCc` | :x: | -| `registerDemoActionNerveFunction__12DemoFunctionFPC9LiveActorPC5NervePCc` | :x: | -| `tryStartDemoRegistered__12DemoFunctionFP9LiveActorPCc` | :x: | -| `tryStartDemoRegisteredMarioPuppetable__12DemoFunctionFP9LiveActorPCc` | :x: | -| `registerDemoExecutor__12DemoFunctionFP12DemoExecutor` | :x: | -| `findDemoExecutor__12DemoFunctionFPCc` | :x: | -| `findDemoExecutor__12DemoFunctionFPC9LiveActor` | :x: | -| `findDemoExecutorActive__12DemoFunctionFPC9LiveActor` | :x: | -| `isDemoCast__12DemoFunctionFPC12DemoExecutorPC9LiveActor` | :x: | -| `isExistDemoPart__12DemoFunctionFPC12DemoExecutorPCc` | :x: | -| `getCurrentTimeKeeper__26@unnamed@DemoFunction_cpp@Fv` | :x: | -| `getCurrentSubPartKeeper__26@unnamed@DemoFunction_cpp@Fv` | :x: | -| `isCurrentMainPart__26@unnamed@DemoFunction_cpp@FPCc` | :x: | -| `isDemoPartActiveFunction__12DemoFunctionFPCc` | :x: | -| `getDemoPartStepFunction__12DemoFunctionFPCc` | :x: | -| `getDemoPartTotalStepFunction__12DemoFunctionFPCc` | :x: | -| `isDemoLastPartLastStep__12DemoFunctionFv` | :x: | -| `isDemoSuspendOrLastPartLastStep__12DemoFunctionFv` | :x: | -| `getCurrentDemoPartNameMain__12DemoFunctionFPCc` | :x: | -| `isTargetDemoCast__12DemoFunctionFP9LiveActorRC12JMapInfoIterPCcl` | :x: | -| `isRegisteredDemoActionAppear__12DemoFunctionFPC9LiveActor` | :x: | -| `isRegisteredDemoActionFunctor__12DemoFunctionFPC9LiveActor` | :x: | -| `isRegisteredDemoActionFunctor__12DemoFunctionFPC9LiveActorPCc` | :x: | -| `isRegisteredDemoActionNerve__12DemoFunctionFPC9LiveActor` | :x: | -| `requestDemoCastMovementOn__12DemoFunctionFP9LiveActor` | :x: | -| `isRegisteredDemoCast__12DemoFunctionFPC9LiveActorPCc` | :x: | -| `pauseTimeKeepDemo__12DemoFunctionFP9LiveActor` | :x: | -| `resumeTimeKeepDemo__12DemoFunctionFP9LiveActor` | :x: | -| `isPauseTimeKeepDemo__12DemoFunctionFP9LiveActor` | :x: | -| `pauseTimeKeepDemo__12DemoFunctionFPCc` | :x: | -| `resumeTimeKeepDemo__12DemoFunctionFPCc` | :x: | -| `isPauseTimeKeepDemo__12DemoFunctionFPCc` | :x: | -| `tryCreateDemoTalkAnimCtrlForActor__12DemoFunctionFP9LiveActorPCcPCc` | :x: | -| `tryCreateDemoTalkAnimCtrlForActorDirect__12DemoFunctionFP9LiveActorPCcPCcPCc` | :x: | -| `tryCreateDemoTalkAnimCtrlForScene__12DemoFunctionFP9LiveActorRC12JMapInfoIterPCcPCcll` | :x: | -| `tryCreateDemoTalkAnimCtrlForSceneDirect__12DemoFunctionFP9LiveActorPCcRC12JMapInfoIterPCcPCcll` | :x: | -| `registerDemoTalkMessageCtrl__12DemoFunctionFP9LiveActorP15TalkMessageCtrl` | :x: | -| `registerDemoTalkMessageCtrlDirect__12DemoFunctionFP9LiveActorP15TalkMessageCtrlPCc` | :x: | -| `setDemoTalkMessageCtrlDirect__12DemoFunctionFPC9LiveActorP15TalkMessageCtrlPCc` | :x: | +| `getDemoDirector__12DemoFunctionFv` | :white_check_mark: | +| `getDemoCastSubGroupHolder__12DemoFunctionFv` | :white_check_mark: | +| `registerDemoSimpleCastAllFunction__12DemoFunctionFP9LiveActor` | :white_check_mark: | +| `registerDemoSimpleCastAllFunction__12DemoFunctionFP11LayoutActor` | :white_check_mark: | +| `registerDemoSimpleCastAllFunction__12DemoFunctionFP7NameObj` | :white_check_mark: | +| `registerDemoActionFunctorFunction__12DemoFunctionFPC9LiveActorRCQ22MR11FunctorBasePCc` | :white_check_mark: | +| `registerDemoActionFunctorFunction__12DemoFunctionFPC9LiveActorRCQ22MR11FunctorBasePCcPCc` | :white_check_mark: | +| `registerDemoActionNerveFunction__12DemoFunctionFPC9LiveActorPC5NervePCc` | :white_check_mark: | +| `tryStartDemoRegistered__12DemoFunctionFP9LiveActorPCc` | :white_check_mark: | +| `tryStartDemoRegisteredMarioPuppetable__12DemoFunctionFP9LiveActorPCc` | :white_check_mark: | +| `registerDemoExecutor__12DemoFunctionFP12DemoExecutor` | :white_check_mark: | +| `findDemoExecutor__12DemoFunctionFPCc` | :white_check_mark: | +| `findDemoExecutor__12DemoFunctionFPC9LiveActor` | :white_check_mark: | +| `findDemoExecutorActive__12DemoFunctionFPC9LiveActor` | :white_check_mark: | +| `isDemoCast__12DemoFunctionFPC12DemoExecutorPC9LiveActor` | :white_check_mark: | +| `isExistDemoPart__12DemoFunctionFPC12DemoExecutorPCc` | :white_check_mark: | +| `getCurrentTimeKeeper__26@unnamed@DemoFunction_cpp@Fv` | :white_check_mark: | +| `getCurrentSubPartKeeper__26@unnamed@DemoFunction_cpp@Fv` | :white_check_mark: | +| `isCurrentMainPart__26@unnamed@DemoFunction_cpp@FPCc` | :white_check_mark: | +| `isDemoPartActiveFunction__12DemoFunctionFPCc` | :white_check_mark: | +| `getDemoPartStepFunction__12DemoFunctionFPCc` | :white_check_mark: | +| `getDemoPartTotalStepFunction__12DemoFunctionFPCc` | :white_check_mark: | +| `isDemoLastPartLastStep__12DemoFunctionFv` | :white_check_mark: | +| `isDemoSuspendOrLastPartLastStep__12DemoFunctionFv` | :white_check_mark: | +| `getCurrentDemoPartNameMain__12DemoFunctionFPCc` | :white_check_mark: | +| `isTargetDemoCast__12DemoFunctionFP9LiveActorRC12JMapInfoIterPCcl` | :white_check_mark: | +| `isRegisteredDemoActionAppear__12DemoFunctionFPC9LiveActor` | :white_check_mark: | +| `isRegisteredDemoActionFunctor__12DemoFunctionFPC9LiveActor` | :white_check_mark: | +| `isRegisteredDemoActionFunctor__12DemoFunctionFPC9LiveActorPCc` | :white_check_mark: | +| `isRegisteredDemoActionNerve__12DemoFunctionFPC9LiveActor` | :white_check_mark: | +| `requestDemoCastMovementOn__12DemoFunctionFP9LiveActor` | :white_check_mark: | +| `isRegisteredDemoCast__12DemoFunctionFPC9LiveActorPCc` | :white_check_mark: | +| `pauseTimeKeepDemo__12DemoFunctionFP9LiveActor` | :white_check_mark: | +| `resumeTimeKeepDemo__12DemoFunctionFP9LiveActor` | :white_check_mark: | +| `isPauseTimeKeepDemo__12DemoFunctionFP9LiveActor` | :white_check_mark: | +| `pauseTimeKeepDemo__12DemoFunctionFPCc` | :white_check_mark: | +| `resumeTimeKeepDemo__12DemoFunctionFPCc` | :white_check_mark: | +| `isPauseTimeKeepDemo__12DemoFunctionFPCc` | :white_check_mark: | +| `tryCreateDemoTalkAnimCtrlForActor__12DemoFunctionFP9LiveActorPCcPCc` | :white_check_mark: | +| `tryCreateDemoTalkAnimCtrlForActorDirect__12DemoFunctionFP9LiveActorPCcPCcPCc` | :white_check_mark: | +| `tryCreateDemoTalkAnimCtrlForScene__12DemoFunctionFP9LiveActorRC12JMapInfoIterPCcPCcll` | :white_check_mark: | +| `tryCreateDemoTalkAnimCtrlForSceneDirect__12DemoFunctionFP9LiveActorPCcRC12JMapInfoIterPCcPCcll` | :white_check_mark: | +| `registerDemoTalkMessageCtrl__12DemoFunctionFP9LiveActorP15TalkMessageCtrl` | :white_check_mark: | +| `registerDemoTalkMessageCtrlDirect__12DemoFunctionFP9LiveActorP15TalkMessageCtrlPCc` | :white_check_mark: | +| `setDemoTalkMessageCtrlDirect__12DemoFunctionFPC9LiveActorP15TalkMessageCtrlPCc` | :white_check_mark: | | `loadDemoArchive__12DemoFunctionFv` | :white_check_mark: | -| `createSheetParser__12DemoFunctionFPC12DemoExecutorPCcPP8JMapInfo` | :x: | -| `isDemoPartTalk__12DemoFunctionFPCc` | :x: | +| `createSheetParser__12DemoFunctionFPC12DemoExecutorPCcPP8JMapInfo` | :white_check_mark: | +| `isDemoPartTalk__12DemoFunctionFPCc` | :white_check_mark: | diff --git a/helpers.py b/helpers.py index e7b46e82..04613235 100644 --- a/helpers.py +++ b/helpers.py @@ -15,7 +15,7 @@ class FunctionLibrary: self.libraries.clear() self.functions.clear() - basePath = f"libs\\{self.parent}\\csv" + basePath = f"libs/{self.parent}/csv" if self.parent == "Game": basePath = "csv" @@ -61,13 +61,13 @@ class FunctionLibrary: self.functions[symbol] = (address, size) def save(self): - basePath = f"libs\\{self.parent}\\csv" + basePath = f"libs/{self.parent}/csv" if self.parent == "Game": basePath = "csv" for library, symbols in self.libraries.items(): - with open(f"{basePath}\\{library}.csv", "w") as output: + with open(f"{basePath}/{library}.csv", "w") as output: output.write("Symbol Name, Object File, Library Archive, Matching\n") for (symbol, obj_file), values in symbols.items(): diff --git a/include/Game/Demo/DemoActionKeeper.hpp b/include/Game/Demo/DemoActionKeeper.hpp index 2dde57f1..2337ad6c 100644 --- a/include/Game/Demo/DemoActionKeeper.hpp +++ b/include/Game/Demo/DemoActionKeeper.hpp @@ -1,6 +1,7 @@ #pragma once #include "Game/Util.hpp" +#include "Game/Demo/DemoExecutor.hpp" class LiveActor; class Nerve; @@ -19,3 +20,17 @@ public: MR::FunctorBase** mFunctors; // _24 const Nerve** mNerves; // _28 }; + +class DemoActionKeeper { +public: + void initCast(LiveActor *, const JMapInfoIter &); + void registerFunctor(const LiveActor *, const MR::FunctorBase &, const char *); + void registerNerve(const LiveActor *, const Nerve *, const char *); + void update(); + bool isRegisteredDemoActionAppear(const LiveActor *) const; + bool isRegisteredDemoActionFunctor(const LiveActor *) const; + bool isRegisteredDemoActionNerve(const LiveActor *) const; + bool isRegisteredDemoAction(const LiveActor *, long) const; + + DemoActionKeeper(const DemoExecutor *); +}; diff --git a/include/Game/Demo/DemoDirector.hpp b/include/Game/Demo/DemoDirector.hpp index 38c9aa91..a9c995b7 100644 --- a/include/Game/Demo/DemoDirector.hpp +++ b/include/Game/Demo/DemoDirector.hpp @@ -1,6 +1,10 @@ #pragma once #include "Game/NameObj/NameObj.hpp" +#include "Game/Demo/DemoExecutor.hpp" +#include "Game/Demo/DemoTimeKeeper.hpp" +#include "Game/Demo/DemoSubPartKeeper.hpp" +#include "Game/Util/ObjUtil.hpp" class DemoCastGroupHolder; class DemoSimpleCastHolder; @@ -13,13 +17,17 @@ public: virtual ~DemoDirector(); virtual void movement(); + void registerDemoSimpleCast(LiveActor *); + void registerDemoSimpleCast(LayoutActor *); + void registerDemoSimpleCast(NameObj *); + bool mIsActive; // _C - s32 _10; + DemoExecutor* mExecutor; // _10 u8 _14; DemoCastGroupHolder* _18; DemoCastGroupHolder* _1C; DemoSimpleCastHolder* _20; - s32 _24; + ResourceHolder* mResourceHolder; // _24 DemoStartRequestHolder* mStartReqHolder; // _28 NameObj* _2C; const char* _30; diff --git a/include/Game/Demo/DemoExecutor.hpp b/include/Game/Demo/DemoExecutor.hpp index 0ea72cc6..dbcb4cf9 100644 --- a/include/Game/Demo/DemoExecutor.hpp +++ b/include/Game/Demo/DemoExecutor.hpp @@ -1,8 +1,30 @@ #pragma once #include "Game/Demo/DemoCastGroup.hpp" +#include "Game/Demo/DemoTimeKeeper.hpp" +#include "Game/Demo/DemoSubPartKeeper.hpp" +#include "Game/Demo/DemoActionKeeper.hpp" + +class DemoActionKeeper; class DemoExecutor : public DemoCastGroup { public: DemoExecutor(const char *); -}; \ No newline at end of file + + bool tryStartProperDemoSystem(); + bool tryStartDemoSystemPart(const char *, s32); + bool tryStartProperDemoSystemPart(const char *); + + void pause(); + void resume(); + + void addTalkMessageCtrl(LiveActor *, TalkMessageCtrl *); + void setTalkMessageCtrl(const LiveActor *, TalkMessageCtrl *); + + const char *mSheetName; // _14 + DemoTimeKeeper *mTimeKeeper; // _18 + DemoSubPartKeeper *mSubPartKeeper; // _1C + void *_20; + void *_24; + DemoActionKeeper *mActionKeeper; // _28 +}; diff --git a/include/Game/Demo/DemoExecutorFunction.hpp b/include/Game/Demo/DemoExecutorFunction.hpp new file mode 100644 index 00000000..8fdbcdba --- /dev/null +++ b/include/Game/Demo/DemoExecutorFunction.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include "Game/Demo/DemoExecutor.hpp" + +namespace DemoExecutorFunction { + void registerDemoActionFunction(const DemoExecutor *, const LiveActor *, const MR::FunctorBase &, const char *); + void registerDemoActionNerve(const DemoExecutor *, const LiveActor *, const Nerve *, const char *); + + bool isExistDemoPart(const DemoExecutor *, const char *); + bool isExistDemoPartMain(const DemoExecutor *, const char *); + bool isExistDemoPartSub(const DemoExecutor *, const char *); + + bool isRegisteredDemoCast(const DemoExecutor *, const LiveActor *); + bool isRegisteredDemoActionAppear(const DemoExecutor *, const LiveActor *); + bool isRegisteredDemoActionFunctor(const DemoExecutor *, const LiveActor *); + bool isRegisteredDemoActionNerve(const DemoExecutor *, const LiveActor *); + + bool tryCreateDemoTalkAnimCtrlForActor(DemoExecutor *, LiveActor *, const char *, const char *); + bool tryCreateDemoTalkAnimCtrlForScene(DemoExecutor *, LiveActor *, const JMapInfoIter &, const char *, const char *, s32, s32); + + void registerDemoTalkMessageCtrl(DemoExecutor *, LiveActor *, TalkMessageCtrl *); + void setDemoTalkMessageCtrl(DemoExecutor *, const LiveActor *, TalkMessageCtrl *); + + void pauseTimeKeepDemo(DemoExecutor *); + void resumeTimeKeepDemo(DemoExecutor *); + bool isPauseTimeKeepDemo(const DemoExecutor *); +}; diff --git a/include/Game/Demo/DemoFunction.hpp b/include/Game/Demo/DemoFunction.hpp index f06fa3d4..5d352151 100644 --- a/include/Game/Demo/DemoFunction.hpp +++ b/include/Game/Demo/DemoFunction.hpp @@ -1,10 +1,65 @@ #pragma once #include "Game/Util.hpp" +#include "Game/LiveActor/LiveActor.hpp" +#include "Game/Demo/DemoExecutor.hpp" +#include "Game/Demo/DemoExecutorFunction.hpp" +#include "Game/Demo/DemoDirector.hpp" -class DemoFunction { -public: - static void* loadDemoArchive(); +namespace DemoFunction { + DemoDirector* getDemoDirector(); + DemoCastGroupHolder* getDemoCastSubGroupHolder(); - static bool isDemoPartTalk(const char *); -}; \ No newline at end of file + void registerDemoSimpleCastAllFunction(LiveActor *); + void registerDemoSimpleCastAllFunction(LayoutActor *); + void registerDemoSimpleCastAllFunction(NameObj *); + void registerDemoActionFunctorFunction(const LiveActor *, const MR::FunctorBase &, const char *); + void registerDemoActionFunctorFunction(const LiveActor *, const MR::FunctorBase &, const char *, const char *); + void registerDemoActionNerveFunction(const LiveActor *, const Nerve *, const char *); + + bool tryStartDemoRegistered(LiveActor *, const char *); + bool tryStartDemoRegisteredMarioPuppetable(LiveActor *, const char *); + + void registerDemoExecutor(DemoExecutor *); + DemoExecutor* findDemoExecutor(const char *); + DemoExecutor* findDemoExecutor(const LiveActor *); + DemoExecutor* findDemoExecutorActive(const LiveActor *); + + bool isDemoCast(const DemoExecutor *, const LiveActor *); + bool isExistDemoPart(const DemoExecutor *, const char *); + + bool isDemoPartActiveFunction(const char *); + s32 getDemoPartStepFunction(const char *); + s32 getDemoPartTotalStepFunction(const char *); + bool isDemoLastPartLastStep(); + bool isDemoSuspendOrLastPartLastStep(); + const char *getCurrentDemoPartNameMain(const char *); + + bool isTargetDemoCast(LiveActor *, const JMapInfoIter &, const char *, s32); + + bool isRegisteredDemoActionAppear(const LiveActor *); + bool isRegisteredDemoActionFunctor(const LiveActor *); + bool isRegisteredDemoActionFunctor(const LiveActor *, const char *); + bool isRegisteredDemoActionNerve(const LiveActor *); + + void requestDemoCastMovementOn(LiveActor *); + bool isRegisteredDemoCast(const LiveActor *, const char *); + + void pauseTimeKeepDemo(LiveActor *); + void resumeTimeKeepDemo(LiveActor *); + bool isPauseTimeKeepDemo(LiveActor *); + + void pauseTimeKeepDemo(const char *); + void resumeTimeKeepDemo(const char *); + bool isPauseTimeKeepDemo(const char *); + + void registerDemoTalkMessageCtrl(LiveActor *, TalkMessageCtrl *); + void registerDemoTalkMessageCtrlDirect(LiveActor *, TalkMessageCtrl *, const char *); + void setDemoTalkMessageCtrlDirect(const LiveActor *, TalkMessageCtrl *, const char *); + + ResourceHolder* loadDemoArchive(); + + s32 createSheetParser(const DemoExecutor *, const char *, JMapInfo **); + + bool isDemoPartTalk(const char *); +}; diff --git a/include/Game/Demo/DemoSubPartKeeper.hpp b/include/Game/Demo/DemoSubPartKeeper.hpp new file mode 100644 index 00000000..67ef0ee8 --- /dev/null +++ b/include/Game/Demo/DemoSubPartKeeper.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include + +class DemoSubPartKeeper { +public: + bool isDemoPartActive(const char *); + s32 getDemoPartStep(const char *); + s32 getDemoPartTotalStep(const char *); +}; diff --git a/include/Game/Demo/DemoTimeKeeper.hpp b/include/Game/Demo/DemoTimeKeeper.hpp new file mode 100644 index 00000000..badc02ab --- /dev/null +++ b/include/Game/Demo/DemoTimeKeeper.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include + +class DemoTimePartInfo { +public: + const char *mName; // _0 + s32 mTotalSteps; // _4 + u8 _8; +}; + +class DemoTimeKeeper { +public: + bool isExistSuspendFlagCurrentPart() const; + bool isPartLast() const; + void setCurrentPart(const char *); + bool isCurrentDemoPartLastStep() const; + + u32 _0; + DemoTimePartInfo *mMainPartInfos; // _4 + DemoTimePartInfo *mSubPartInfos; // _8 + s32 mNumPartInfos; + u32 _10; + s32 mCurrentStep; // _14 + s32 _18; + bool mIsPaused; // _1C +}; diff --git a/include/Game/Effect/EffectSystemUtil.hpp b/include/Game/Effect/EffectSystemUtil.hpp new file mode 100644 index 00000000..6861f935 --- /dev/null +++ b/include/Game/Effect/EffectSystemUtil.hpp @@ -0,0 +1,9 @@ +#pragma once + +#include "Game/LiveActor/EffectKeeper.hpp" + +namespace MR { + namespace Effect { + void requestMovementOn(EffectKeeper *); + } +} diff --git a/include/Game/Util/DemoUtil.hpp b/include/Game/Util/DemoUtil.hpp index b60dd7dd..ff89253b 100644 --- a/include/Game/Util/DemoUtil.hpp +++ b/include/Game/Util/DemoUtil.hpp @@ -26,6 +26,7 @@ namespace MR { void registerDemoSimpleCastAll(NameObj *); bool isDemoActive(); + bool isDemoActive(const char *); bool isDemoExist(const char *); @@ -45,6 +46,9 @@ namespace MR { bool tryStartDemoMarioPuppetable(LiveActor *, const char *); + bool tryStartTimeKeepDemoMarioPuppetable(LiveActor *, const char *, const char *); + bool tryStartTimeKeepDemoMarioPuppetable(NameObj *, const char *, const char *); + void requestStartTimeKeepDemoMarioPuppetable(LiveActor *, const char *, const Nerve *, const Nerve *, const char *); void requestStartTimeKeepDemo(LiveActor *, const char *, const Nerve *, const Nerve *, const char *); diff --git a/include/Game/Util/ObjUtil.hpp b/include/Game/Util/ObjUtil.hpp index 14f0227f..fe8b1dc1 100644 --- a/include/Game/Util/ObjUtil.hpp +++ b/include/Game/Util/ObjUtil.hpp @@ -90,9 +90,9 @@ namespace MR { void requestMovementOn(NameObj *); void requestMovementOff(NameObj *); - const JMapInfo* createCsvParser(const char *, const char *, ...); - const JMapInfo* tryCreateCsvParser(const ResourceHolder *, const char *, ...); - const JMapInfo* tryCreateCsvParser(const LiveActor *, const char *, ...); + JMapInfo* createCsvParser(const char *, const char *, ...); + JMapInfo* tryCreateCsvParser(const ResourceHolder *, const char *, ...); + JMapInfo* tryCreateCsvParser(const LiveActor *, const char *, ...); s32 getCsvDataElementNum(const JMapInfo *); void getCsvDataStr(const char **, const JMapInfo *, const char *, s32) NO_INLINE; diff --git a/progress.py b/progress.py index f8ab25fa..87866699 100644 --- a/progress.py +++ b/progress.py @@ -173,10 +173,10 @@ class Archive: json.append("}") if self.parent != "Game": - with open(f"libs\\{self.parent}\\data\\json\\{self.name}.json", "w") as w: + with open(f"libs/{self.parent}/data/json/{self.name}.json", "w") as w: w.writelines(json) else: - with open(f"data\\json\\{self.name}.json", "w") as w: + with open(f"data/json/{self.name}.json", "w") as w: w.writelines(json) def generateMarkdown(self): @@ -208,8 +208,8 @@ class Archive: page.append(f"| [{obj.name}](https://github.com/shibbo/Petari/blob/master/docs/lib/{self.parent}/{self.name}/{obj_page_name}.md) | {prog}% | {obj.totalCompletedFunctions} / {obj.totalFunctions} | {funcProg}% | {marker} \n") - if not os.path.exists(f"docs\\lib\\{self.parent}"): - os.makedirs(f"docs\\lib\\{self.parent}") + if not os.path.exists(f"docs/lib/{self.parent}"): + os.makedirs(f"docs/lib/{self.parent}") with open(f"docs/lib/{self.parent}/{self.name}.md", "w") as w: w.writelines(page) @@ -244,10 +244,10 @@ class Archive: obj_page_name = obj.name.replace(".o", "") - if not os.path.exists(f"docs\\lib\\{self.parent}\\{self.name}"): - os.makedirs(f"docs\\lib\\{self.parent}\\{self.name}") + if not os.path.exists(f"docs/lib/{self.parent}/{self.name}"): + os.makedirs(f"docs/lib/{self.parent}/{self.name}") - with open(f"docs\\lib\\{self.parent}\\{self.name}\\{obj_page_name}.md", "w") as w: + with open(f"docs/lib/{self.parent}/{self.name}/{obj_page_name}.md", "w") as w: w.writelines(obj_page) libraries = {} @@ -257,7 +257,7 @@ def doProgress(parent_lib): func_sizes = {} archives = [] - with open("data\\funcSizes.txt", "r") as file: + with open("data/funcSizes.txt", "r") as file: lines = file.readlines() for line in lines: @@ -266,9 +266,9 @@ def doProgress(parent_lib): func_sizes[sym] = spl[1].split(',', 1)[1] if parent_lib != "Game": - csv_files = glob.glob(f"libs\\{parent_lib}\\csv\\*.csv") + csv_files = glob.glob(f"libs/{parent_lib}/csv/*.csv") else: - csv_files = glob.glob("csv\\*.csv") + csv_files = glob.glob("csv/*.csv") for csv_file in sorted(csv_files, key=str.casefold): lib_name = Path(csv_file).stem diff --git a/source/Game/Demo/DemoExecutorFunction.cpp b/source/Game/Demo/DemoExecutorFunction.cpp new file mode 100644 index 00000000..5abd2af3 --- /dev/null +++ b/source/Game/Demo/DemoExecutorFunction.cpp @@ -0,0 +1,82 @@ +#include "Game/Demo/DemoExecutorFunction.hpp" + +namespace DemoExecutorFunction { + void registerDemoActionFunction(const DemoExecutor *pExecutor, const LiveActor *pActor, const MR::FunctorBase &rFunctor, const char *a4) { + pExecutor->mActionKeeper->registerFunctor(pActor, rFunctor, a4); + } + + void registerDemoActionNerve(const DemoExecutor *pExecutor, const LiveActor *pActor, const Nerve *pNerve, const char *a4) { + pExecutor->mActionKeeper->registerNerve(pActor, pNerve, a4); + } + + bool isExistDemoPart(const DemoExecutor *pExecutor, const char *pPartName) { + if (isExistDemoPartMain(pExecutor, pPartName)) return true; + if (isExistDemoPartSub(pExecutor, pPartName)) return true; + return false; + } + + bool isExistDemoPartMain(const DemoExecutor *pExecutor, const char *pPartName) { + DemoTimeKeeper *timekeeper = pExecutor->mTimeKeeper; + for (s32 i = 0; i < timekeeper->mNumPartInfos; i++) { + if (MR::isEqualString(timekeeper->mMainPartInfos[i].mName, pPartName)) { + return true; + } + } + return false; + } + + bool isExistDemoPartSub(const DemoExecutor *pExecutor, const char *pPartName) { + DemoTimeKeeper *timekeeper = pExecutor->mTimeKeeper; + for (s32 i = 0; i < timekeeper->mNumPartInfos; i++) { + if (MR::isEqualString(timekeeper->mSubPartInfos[i].mName, pPartName)) { + return true; + } + } + return false; + } + + bool isRegisteredDemoCast(const DemoExecutor *pExecutor, const LiveActor *pActor) { + LiveActorGroup *group = reinterpret_cast(pExecutor->mGroup); + for (s32 i = 0; i < group->mObjectCount; i++) { + if (MR::isSame(group->getActor(i), pActor)) { + return true; + } + } + return false; + } + + bool isRegisteredDemoActionAppear(const DemoExecutor *pExecutor, const LiveActor *pActor) { + return pExecutor->mActionKeeper->isRegisteredDemoActionAppear(pActor); + } + + bool isRegisteredDemoActionFunctor(const DemoExecutor *pExecutor, const LiveActor *pActor) { + return pExecutor->mActionKeeper->isRegisteredDemoActionFunctor(pActor); + } + + bool isRegisteredDemoActionNerve(const DemoExecutor *pExecutor, const LiveActor *pActor) { + return pExecutor->mActionKeeper->isRegisteredDemoActionNerve(pActor); + } + + // bool tryCreateDemoTalkAnimCtrlForActor(DemoExecutor *, LiveActor *, const char *, const char *); + // bool tryCreateDemoTalkAnimCtrlForScene(DemoExecutor *, LiveActor *, const JMapInfoIter &, const char *, const char *, s32, s32); + + void registerDemoTalkMessageCtrl(DemoExecutor *pExecutor, LiveActor *pActor, TalkMessageCtrl *pTalkCtrl) { + pExecutor->addTalkMessageCtrl(pActor, pTalkCtrl); + } + + void setDemoTalkMessageCtrl(DemoExecutor *pExecutor, const LiveActor *pActor, TalkMessageCtrl *pTalkCtrl) { + pExecutor->setTalkMessageCtrl(pActor, pTalkCtrl); + } + + void pauseTimeKeepDemo(DemoExecutor *pExecutor) { + return pExecutor->pause(); + } + + void resumeTimeKeepDemo(DemoExecutor *pExecutor) { + return pExecutor->resume(); + } + + bool isPauseTimeKeepDemo(const DemoExecutor *pExecutor) { + return pExecutor->mTimeKeeper->mIsPaused; + } +} diff --git a/source/Game/Demo/DemoFunction.cpp b/source/Game/Demo/DemoFunction.cpp index 7e060762..5e848a13 100644 --- a/source/Game/Demo/DemoFunction.cpp +++ b/source/Game/Demo/DemoFunction.cpp @@ -1,13 +1,320 @@ #include "Game/Demo/DemoFunction.hpp" +#include "Game/Demo/DemoCastGroup.hpp" +#include "Game/Demo/DemoExecutorFunction.hpp" +#include "Game/Demo/DemoCastGroupHolder.hpp" +#include "Game/Demo/DemoDirector.hpp" +#include "Game/Demo/DemoTimeKeeper.hpp" +#include "Game/Demo/DemoSubPartKeeper.hpp" +#include "Game/Effect/EffectSystemUtil.hpp" #include #include -void* DemoFunction::loadDemoArchive() { - char buf[0x100]; - snprintf(buf, 0x100, "DemoSheet.arc"); - return MR::createAndAddResourceHolder(buf); +namespace { + DemoTimeKeeper* getCurrentTimeKeeper() NO_INLINE { + return DemoFunction::getDemoDirector()->mExecutor->mTimeKeeper; + } + DemoSubPartKeeper* getCurrentSubPartKeeper() NO_INLINE { + return DemoFunction::getDemoDirector()->mExecutor->mSubPartKeeper; + } + bool isCurrentMainPart(const char *pPartName) NO_INLINE { + DemoTimeKeeper *timekeeper = getCurrentTimeKeeper(); + return MR::isEqualString(pPartName, timekeeper->mSubPartInfos[0].mName); + } } -bool DemoFunction::isDemoPartTalk(const char *pDemoName) { - return MR::isEqualSubString(pDemoName, "会話"); -} \ No newline at end of file +namespace DemoFunction { + DemoDirector* getDemoDirector() { + return reinterpret_cast(MR::getSceneObjHolder()->getObj(SceneObj_DemoDirector)); + } + + DemoCastGroupHolder* getDemoCastSubGroupHolder() { + return getDemoDirector()->_1C; + } + + void registerDemoSimpleCastAllFunction(LiveActor *pActor) { + return getDemoDirector()->registerDemoSimpleCast(pActor); + } + + void registerDemoSimpleCastAllFunction(LayoutActor *pActor) { + return getDemoDirector()->registerDemoSimpleCast(pActor); + } + + void registerDemoSimpleCastAllFunction(NameObj *pObj) { + return getDemoDirector()->registerDemoSimpleCast(pObj); + } + + void registerDemoActionFunctorFunction(const LiveActor *pActor, const MR::FunctorBase &rFunctor, const char *pName) { + DemoExecutorFunction::registerDemoActionFunction(findDemoExecutor(pActor), pActor, rFunctor, pName); + } + + void registerDemoActionFunctorFunction(const LiveActor *pActor, const MR::FunctorBase &rFunctor, const char *pDemoName, const char *pName) { + DemoExecutorFunction::registerDemoActionFunction(findDemoExecutor(pDemoName), pActor, rFunctor, pName); + } + + void registerDemoActionNerveFunction(const LiveActor *pActor, const Nerve *pNerve, const char *pName) { + DemoExecutorFunction::registerDemoActionNerve(findDemoExecutor(pActor), pActor, pNerve, pName); + } + + bool tryStartDemoRegistered(LiveActor *pActor, const char *pPartName) { + DemoExecutor *executor = findDemoExecutor(pActor); + if (executor == nullptr) { + return false; + } + if (pPartName != nullptr) { + return executor->tryStartProperDemoSystemPart(pPartName); + } + else { + return executor->tryStartProperDemoSystem(); + } + } + + bool tryStartDemoRegisteredMarioPuppetable(LiveActor *pActor, const char *pPartName) { + DemoExecutor *executor = findDemoExecutor(pActor); + if (executor == nullptr) { + return false; + } + if (pPartName != nullptr) { + return executor->tryStartDemoSystemPart(pPartName, 2); + } + else { + return MR::tryStartTimeKeepDemoMarioPuppetable(executor, executor->mName, nullptr); + } + } + + void registerDemoExecutor(DemoExecutor *pExecutor) { + getDemoDirector()->_18->registerObj(pExecutor); + } + + DemoExecutor* findDemoExecutor(const char *pDemoName) { + DemoCastGroup *group = getDemoDirector()->_18->findCastGroup(pDemoName); + if (group == nullptr) { + return nullptr; + } + return reinterpret_cast(group); + } + + DemoExecutor* findDemoExecutor(const LiveActor *pActor) { + DemoExecutor *executor; + for (s32 i = 0; i < getDemoDirector()->_18->mObjectCount; i++) { + executor = reinterpret_cast(getDemoDirector()->_18->getCastGroup(i)); + if (DemoExecutorFunction::isRegisteredDemoCast(executor, pActor)) { + return executor; + } + } + return NULL; + } + + DemoExecutor* findDemoExecutorActive(const LiveActor *pActor) { + DemoExecutor *executor; + for (s32 i = 0; i < getDemoDirector()->_18->mObjectCount; i++) { + executor = reinterpret_cast(getDemoDirector()->_18->getCastGroup(i)); + if (DemoExecutorFunction::isRegisteredDemoCast(executor, pActor) && MR::isDemoActive(executor->mName)) { + return executor; + } + } + return NULL; + } + + bool isDemoCast(const DemoExecutor *pExecutor, const LiveActor *pActor) { + return DemoExecutorFunction::isRegisteredDemoCast(pExecutor, pActor); + } + + bool isExistDemoPart(const DemoExecutor *pExecutor, const char *pPartName) { + return DemoExecutorFunction::isExistDemoPart(pExecutor, pPartName); + } + + bool isDemoPartActiveFunction(const char *pPartName) { + if (!MR::isTimeKeepDemoActive()) { + return false; + } + if (isCurrentMainPart(pPartName)) { + return true; + } + return getCurrentSubPartKeeper()->isDemoPartActive(pPartName); + } + + s32 getDemoPartStepFunction(const char *pPartName) { + if (isCurrentMainPart(pPartName)) { + return getCurrentTimeKeeper()->mCurrentStep; + } + else { + return getCurrentSubPartKeeper()->getDemoPartStep(pPartName); + } + } + + s32 getDemoPartTotalStepFunction(const char *pPartName) { + if (isCurrentMainPart(pPartName)) { + return getCurrentTimeKeeper()->mSubPartInfos[0].mTotalSteps; + } + else { + return getCurrentSubPartKeeper()->getDemoPartTotalStep(pPartName); + } + } + + bool isDemoLastPartLastStep() { + if (!MR::isTimeKeepDemoActive()) { + return false; + } + s32 total = getCurrentTimeKeeper()->mSubPartInfos[0].mTotalSteps; + s32 current = getCurrentTimeKeeper()->mCurrentStep; + if (current != total - 1) { + return false; + } else { + return getCurrentTimeKeeper()->isPartLast(); + } + } + + bool isDemoSuspendOrLastPartLastStep() { + if (!MR::isTimeKeepDemoActive()) { + return false; + } + DemoDirector *director = getDemoDirector(); + if (director->mExecutor == nullptr) { + return false; + } + DemoTimeKeeper *timekeeper = director->mExecutor->mTimeKeeper; + if (timekeeper->isExistSuspendFlagCurrentPart()) { + return timekeeper->isExistSuspendFlagCurrentPart(); + } + return isDemoLastPartLastStep(); + } + + const char *getCurrentDemoPartNameMain(const char *pDemoName) { + DemoExecutor *executor = findDemoExecutor(pDemoName); + if (executor == nullptr) { + return nullptr; + } + DemoTimePartInfo *part = &executor->mTimeKeeper->mSubPartInfos[0]; + if (part != nullptr) { + return part->mName; + } + return nullptr; + } + + bool isTargetDemoCast(LiveActor *pActor, const JMapInfoIter &rIter, const char *pActorName, s32 id) { + if (pActorName == nullptr) { + return false; + } + if (!MR::isName(pActor, pActorName)) { + return false; + } + if (id >= 0 && MR::getDemoCastID(rIter) != id) { + return false; + } + return true; + } + + bool isRegisteredDemoActionAppear(const LiveActor *pActor) { + return DemoExecutorFunction::isRegisteredDemoActionAppear(DemoFunction::findDemoExecutor(pActor), pActor); + } + + bool isRegisteredDemoActionFunctor(const LiveActor *pActor) { + return DemoExecutorFunction::isRegisteredDemoActionFunctor(DemoFunction::findDemoExecutor(pActor), pActor); + } + + bool isRegisteredDemoActionFunctor(const LiveActor *pActor, const char *pDemoName) { + return DemoExecutorFunction::isRegisteredDemoActionFunctor(DemoFunction::findDemoExecutor(pDemoName), pActor); + } + + bool isRegisteredDemoActionNerve(const LiveActor *pActor) { + return DemoExecutorFunction::isRegisteredDemoActionNerve(DemoFunction::findDemoExecutor(pActor), pActor); + } + + void requestDemoCastMovementOn(LiveActor *pActor) { + MR::requestMovementOn(pActor); + if (pActor->mEffectKeeper != nullptr) { + MR::Effect::requestMovementOn(pActor->mEffectKeeper); + } + } + + bool isRegisteredDemoCast(const LiveActor *pActor, const char *pDemoName) { + DemoExecutor *executor = findDemoExecutor(pDemoName); + if (executor != nullptr) { + return DemoExecutorFunction::isRegisteredDemoCast(executor, pActor); + } + return false; + } + + void pauseTimeKeepDemo(LiveActor *pActor) { + return DemoExecutorFunction::pauseTimeKeepDemo(DemoFunction::findDemoExecutorActive(pActor)); + } + + void resumeTimeKeepDemo(LiveActor *pActor) { + return DemoExecutorFunction::resumeTimeKeepDemo(DemoFunction::findDemoExecutorActive(pActor)); + } + + bool isPauseTimeKeepDemo(LiveActor *pActor) { + return DemoExecutorFunction::isPauseTimeKeepDemo(DemoFunction::findDemoExecutorActive(pActor)); + } + + void pauseTimeKeepDemo(const char *pDemoName) { + return DemoExecutorFunction::pauseTimeKeepDemo(DemoFunction::findDemoExecutor(pDemoName)); + } + + void resumeTimeKeepDemo(const char *pDemoName) { + return DemoExecutorFunction::resumeTimeKeepDemo(DemoFunction::findDemoExecutor(pDemoName)); + } + + bool isPauseTimeKeepDemo(const char *pDemoName) { + return DemoExecutorFunction::isPauseTimeKeepDemo(DemoFunction::findDemoExecutor(pDemoName)); + } + + bool tryCreateDemoTalkAnimCtrlForActor(LiveActor *pActor, const char *pFileBaseName, const char *a3) { + DemoExecutor *executor = findDemoExecutor(pActor); + return DemoExecutorFunction::tryCreateDemoTalkAnimCtrlForActor(executor, pActor, pFileBaseName, a3); + } + + bool tryCreateDemoTalkAnimCtrlForActorDirect(LiveActor *pActor, const char *pDemoName, const char *pFileBaseName, const char *a4) { + DemoExecutor *executor = findDemoExecutor(pDemoName); + return DemoExecutorFunction::tryCreateDemoTalkAnimCtrlForActor(executor, pActor, pFileBaseName, a4); + } + + bool tryCreateDemoTalkAnimCtrlForScene(LiveActor *pActor, const JMapInfoIter &rIter, const char *pFileBaseName, const char *a4, s32 a5, s32 a6) { + DemoExecutor *executor = findDemoExecutor(pActor); + return DemoExecutorFunction::tryCreateDemoTalkAnimCtrlForScene(executor, pActor, rIter, pFileBaseName, a4, a5, a6); + } + + bool tryCreateDemoTalkAnimCtrlForSceneDirect(LiveActor *pActor, const char *pDemoName, const JMapInfoIter &rIter, const char *pFileBaseName, const char *a5, s32 a6, s32 a7) { + DemoExecutor *executor = findDemoExecutor(pDemoName); + return DemoExecutorFunction::tryCreateDemoTalkAnimCtrlForScene(executor, pActor, rIter, pFileBaseName, a5, a6, a7); + } + + void registerDemoTalkMessageCtrl(LiveActor *pActor, TalkMessageCtrl *pTalkCtrl) { + DemoExecutor *executor = findDemoExecutor(pActor); + executor->addTalkMessageCtrl(pActor, pTalkCtrl); + } + + void registerDemoTalkMessageCtrlDirect(LiveActor *pActor, TalkMessageCtrl *pTalkCtrl, const char *pDemoName) { + DemoExecutor *executor = findDemoExecutor(pDemoName); + DemoExecutorFunction::registerDemoTalkMessageCtrl(executor, pActor, pTalkCtrl); + } + + void setDemoTalkMessageCtrlDirect(const LiveActor *pActor, TalkMessageCtrl *pTalkCtrl, const char *pDemoName) { + DemoExecutor *executor = findDemoExecutor(pDemoName); + DemoExecutorFunction::setDemoTalkMessageCtrl(executor, pActor, pTalkCtrl); + } + + ResourceHolder* loadDemoArchive() { + char buf[0x100]; + snprintf(buf, 0x100, "DemoSheet.arc"); + return MR::createAndAddResourceHolder(buf); + } + + s32 createSheetParser(const DemoExecutor *pExecutor, const char *pNameSuffix, JMapInfo **pMap) { + const char *sheet_name = pExecutor->mSheetName; + JMapInfo *map = MR::tryCreateCsvParser(getDemoDirector()->mResourceHolder, "Demo%s%s.bcsv", sheet_name, pNameSuffix); + *pMap = map; + if (map != nullptr) { + const JMapData *data = map->mData; + if (data != nullptr) { + return data->mNumEntries; + } + return 0; + } + return 0; + } + + bool isDemoPartTalk(const char *pDemoName) { + return MR::isEqualSubString(pDemoName, "会話"); + } +} diff --git a/source/Game/Util/ObjUtil.cpp b/source/Game/Util/ObjUtil.cpp index 8ada86aa..2d75cadf 100644 --- a/source/Game/Util/ObjUtil.cpp +++ b/source/Game/Util/ObjUtil.cpp @@ -9,7 +9,7 @@ class LiveActor; namespace { - const JMapInfo* tryCreateCsvParserLocal(const ResourceHolder* pHolder, const char* pArchive, va_list pFormat) NO_INLINE { + JMapInfo* tryCreateCsvParserLocal(const ResourceHolder* pHolder, const char* pArchive, va_list pFormat) NO_INLINE { char buf[0x100]; vsnprintf(buf, 0x100, pArchive, pFormat); @@ -254,13 +254,13 @@ namespace MR { return loadTexFromArc(arcBuf, texBuf); } - const JMapInfo* createCsvParser(const ResourceHolder* pHolder, const char* pFormat, ...) { + JMapInfo* createCsvParser(const ResourceHolder* pHolder, const char* pFormat, ...) { va_list list; va_start(list, pFormat); return ::tryCreateCsvParserLocal(pHolder, pFormat, list); } - const JMapInfo* createCsvParser(const char *pArchive, const char *pFormat, ...) { + JMapInfo* createCsvParser(const char *pArchive, const char *pFormat, ...) { ResourceHolder* holder = SingletonHolder::sInstance->createAndAdd(pArchive, nullptr); return MR::createCsvParser(holder, pFormat); }