diff --git a/CMakeLists.txt b/CMakeLists.txt index 129ecab4..0e06d38a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,7 @@ set(VCPKG_TARGET_TRIPLET x64-mingw-static) endif() vcpkg_bootstrap() -vcpkg_install_packages(fontconfig sdl2 zlib bzip2 libzip libpng getopt dirent libusb pthread glew glfw3) +vcpkg_install_packages(fontconfig sdl2 zlib bzip2 libzip libpng getopt dirent libusb pthread glew glfw3 nlohmann-json tinyxml2 spdlog) endif() if (MSVC) @@ -111,7 +111,7 @@ file(GLOB_RECURSE ALL_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} # Exclude specific files from the ALL_FILES list list(FILTER ALL_FILES EXCLUDE REGEX ".*.inc.c") -list(FILTER ALL_FILES EXCLUDE REGEX "src/engine/fox_A4290_colheaders.c") +list(FILTER ALL_FILES EXCLUDE REGEX "src/engine/fox_colheaders.c") list(FILTER ALL_FILES EXCLUDE REGEX "src/engine/fox_edata_info.c") list(FILTER ALL_FILES EXCLUDE REGEX "src/engine/fox_rcp_setup.c") list(FILTER ALL_FILES EXCLUDE REGEX "src/engine/fox_load_inits.c") diff --git a/include/gfx.h b/include/gfx.h index a9ab5623..6a85fc96 100644 --- a/include/gfx.h +++ b/include/gfx.h @@ -34,7 +34,7 @@ G_TX_RENDERTILE, 0, cmt, maskt, shiftt, cms, masks, shifts); \ gDPSetTileSize(pkt, G_TX_RENDERTILE, dw, dh, \ ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) \ + ((height)-1) << G_TEXTURE_IMAGE_FRAC); \ } #define gsDPSetupTile(fmt, siz, width, height, dw, dh, \ @@ -83,10 +83,6 @@ typedef enum WipeMode { WIPE_VERTICAL, } WipeMode; -typedef struct { - u8 r, g, b; -} Color_RGB8; // size = 0x3 - typedef struct Color_RGBA32 { u8 r, g, b, a; } Color_RGBA32; // size = 0x4 diff --git a/include/global.h b/include/global.h index e38d4ed1..19081586 100644 --- a/include/global.h +++ b/include/global.h @@ -23,6 +23,7 @@ typedef enum OverlayCalls { /* 110 */ OVLCALL_UNKMAP_DRAW, } OverlayCalls; +#include "sf64context.h" #include "sf64audio_external.h" #include "functions.h" #include "variables.h" diff --git a/include/mods.h b/include/mods.h index d354dd07..9f46cf7a 100644 --- a/include/mods.h +++ b/include/mods.h @@ -14,10 +14,10 @@ /** * Quick Boot: * Define this variable to a game state to boot into that - * state. Two presets (map and main menu) are provided. + * state. Two presets (map and main menu) are provided. * For the full list of game states, see sf64thread.h. */ -// #define MODS_BOOT_STATE 3 // main menu +#define MODS_BOOT_STATE 3 // main menu // #define MODS_BOOT_STATE 4 // map /** @@ -25,8 +25,8 @@ * Use the D-Pad to select a level. Press L to start in * an advanced level phase (warp zone or Andross fight). * Useful for debugging and speedrunning training. - */ -#define MODS_LEVEL_SELECT 0 +*/ +#define MODS_LEVEL_SELECT 1 /** * Sound Effects Jukebox: @@ -45,13 +45,13 @@ /** * FPS Counter: - * Hold Z + R and press L to toggle FPS Display - */ -#define MODS_FPS_COUNTER 0 + * Press L to toggle FPS Display +*/ +#define MODS_FPS_COUNTER 1 /** * RAM modifier: - * Hold Z + R and press C> to cycle modes + * Press C> while paused to cycle modes * * Cheats: * Use D-Pad up and down to select a cheat diff --git a/include/sf64audio_provisional.h b/include/sf64audio_provisional.h index d259396a..1169b2e8 100644 --- a/include/sf64audio_provisional.h +++ b/include/sf64audio_provisional.h @@ -93,8 +93,8 @@ typedef enum { } SampleMedium; typedef enum { - /* 0 */ CODEC_ADPCM, // 16 2-byte samples (32 bytes) compressed into 4-bit samples (8 bytes) + 1 header byte - /* 1 */ CODEC_S8, // 16 2-byte samples (32 bytes) compressed into 8-bit samples (16 bytes) + /* 0 */ CODEC_ADPCM, // 16 2-byte samples (32 bytes) compressed into 4-bit samples (8 bytes) + 1 header byte + /* 1 */ CODEC_S8, // 16 2-byte samples (32 bytes) compressed into 8-bit samples (16 bytes) /* 2 */ CODEC_S16_INMEMORY, /* 3 */ CODEC_SMALL_ADPCM, // 16 2-byte samples (32 bytes) compressed into 2-bit samples (4 bytes) + 1 header byte /* 4 */ CODEC_REVERB, @@ -229,8 +229,8 @@ typedef struct { } AdpcmBook; // size >= 8, 0x8 aligned typedef struct { - /* 0x00 */ u32 codec : 4; // The state of compression or decompression - /* 0x00 */ u32 medium : 2; // Medium where sample is currently stored + /* 0x00 */ u32 codec : 4; // The state of compression or decompression + /* 0x00 */ u32 medium : 2; // Medium where sample is currently stored /* 0x00 */ u32 unk_bit26 : 1; /* 0x00 */ u32 isRelocated : 1; // Has the sample header been relocated (offsets to pointers) /* 0x01 */ u32 size : 24; // Size of the sample @@ -261,7 +261,7 @@ typedef struct { typedef struct { /* 0x00 */ u8 adsrDecayIndex; // index used to obtain adsr decay rate from adsrDecayTable /* 0x01 */ u8 pan; - /* 0x02 */ u8 isRelocated; // have tunedSample.sample and envelope been relocated (offsets to pointers) + /* 0x02 */ u8 isRelocated; // have tunedSample.sample and envelope been relocated (offsets to pointers) /* 0x04 */ TunedSample tunedSample; /* 0x0C */ EnvelopePoint* envelope; } Drum; // size = 0x10 @@ -318,7 +318,7 @@ typedef struct { } SynthesisReverb; // size = 0x1D4 typedef struct { - /* 0x00 */ u8* pc; // program counter + /* 0x00 */ u8* pc; // program counter /* 0x04 */ u8* stack[4]; /* 0x14 */ u8 remLoopIters[4]; // remaining loop iterations /* 0x18 */ u8 depth; @@ -485,7 +485,7 @@ typedef struct SequenceLayer { /* 0x00 */ u8 continuousNotes : 1; // keep the same note for consecutive notes with the same sound /* 0x00 */ u8 bit3 : 1; // "loaded"? /* 0x00 */ u8 ignoreDrumPan : 1; - /* 0x00 */ u8 bit1 : 1; // "has initialized continuous notes"? + /* 0x00 */ u8 bit1 : 1; // "has initialized continuous notes"? /* 0x00 */ u8 notePropertiesNeedInit : 1; /* 0x01 */ Stereo stereo; /* 0x02 */ u8 instOrWave; @@ -643,15 +643,15 @@ typedef struct { /* 0x10 */ u32 persistentSeqCacheSize; // size of cache on audio pool to store sequences persistently /* 0x14 */ u32 persistentFontCacheSize; // size of cache on audio pool to store soundFonts persistently /* 0x18 */ u32 - persistentSampleBankCacheSize; // size of cache on audio pool to store entire sample banks persistently - /* 0x1C */ u32 temporarySeqCacheSize; // size of cache on audio pool to store sequences temporarily - /* 0x20 */ u32 temporaryFontCacheSize; // size of cache on audio pool to store soundFonts temporarily + persistentSampleBankCacheSize; // size of cache on audio pool to store entire sample banks persistently + /* 0x1C */ u32 temporarySeqCacheSize; // size of cache on audio pool to store sequences temporarily + /* 0x20 */ u32 temporaryFontCacheSize; // size of cache on audio pool to store soundFonts temporarily /* 0x24 */ u32 temporarySampleBankCacheSize; // size of cache on audio pool to store entire sample banks temporarily /* 0x28 */ s32 persistentSampleCacheSize; // size of cache in the audio misc pool to store individual samples persistently /* 0x2C */ s32 - temporarySampleCacheSize; // size of cache in the audio misc pool to store individual samples temporarily -} AudioSpec; // size = 0x30 + temporarySampleCacheSize; // size of cache in the audio misc pool to store individual samples temporarily +} AudioSpec; // size = 0x30 /** * The audio buffer stores the fully processed digital audio before it is sent to the audio interface (AI), then to the @@ -703,7 +703,7 @@ typedef struct { /* 0x02 */ s8 sampleBankId; /* 0x03 */ char unk_03[0x5]; /* 0x08 */ u8* allocatedAddr; - /* 0x0C */ uintptr_t sampleAddr; + /* 0x0C */ void* sampleAddr; /* 0x10 */ u32 size; } SampleCacheEntry; // size = 0x14 @@ -844,7 +844,7 @@ typedef struct { typedef struct SampleDma { /* 0x00 */ u8* ramAddr; - /* 0x04 */ uintptr_t devAddr; + /* 0x04 */ u32 devAddr; /* 0x08 */ u16 sizeUnused; /* 0x0A */ u16 size; /* 0x0C */ u8 unused; @@ -868,14 +868,14 @@ typedef struct { typedef struct { /* 0x0 */ s16 unk_00; // set to 0x1C00, unused /* 0x2 */ s16 seqTicksPerBeat; -} TempoData; // size = 0x4 +} TempoData; // size = 0x4 typedef struct { /* 0x00 */ u32 heapSize; // total number of bytes allocated to the audio heap. Must be <= the size of `gAudioHeap` // (ideally about the same size) /* 0x04 */ u32 initPoolSize; // The entire audio heap is split into two pools. /* 0x08 */ u32 permanentPoolSize; -} AudioHeapInitSizes; // size = 0xC +} AudioHeapInitSizes; // size = 0xC typedef struct { AudioAllocPool pool; @@ -1040,8 +1040,8 @@ uintptr_t AudioHeap_SearchCaches(s32 tableType, s32 cache, s32 id); s32 AudioHeap_ResetStep(void); void* AudioHeap_SearchPermanentCache(s32 tableType, s32 id); u8* AudioHeap_AllocPermanent(s32 tableType, s32 id, u32 size); -void* AudioHeap_AllocTemporarySampleCache(s32 size, s32 fontId, uintptr_t sampleAddr, s8 medium); -void* AudioHeap_AllocPersistentSampleCache(s32 size, s32 fontId, uintptr_t sampleAddr, s8 medium); +void* AudioHeap_AllocTemporarySampleCache(s32 size, s32 fontId, s32 sampleAddr, s8 medium); +void* AudioHeap_AllocPersistentSampleCache(s32 size, s32 fontId, s32 sampleAddr, s8 medium); // audio_load void AudioLoad_DecreaseSampleDmaTtls(void); diff --git a/src/audio/audio_load.c b/src/audio/audio_load.c index 3d0b9804..8ef78f01 100644 --- a/src/audio/audio_load.c +++ b/src/audio/audio_load.c @@ -724,7 +724,7 @@ s32 AudioLoad_Dma(OSIoMesg* mesg, u32 priority, s32 direction, u32 devAddr, void handle = osCartRomInit(); break; case MEDIUM_DISK_DRIVE: - handle = osDriveRomInit(); + // handle = osDriveRomInit(); break; default: return 0; diff --git a/src/engine/fox_message.c b/src/engine/fox_message.c index d2a8b1db..2cfd3b62 100644 --- a/src/engine/fox_message.c +++ b/src/engine/fox_message.c @@ -44,7 +44,7 @@ s32 Message_GetCharCount(u16* msgPtr) { s32 count = 0; u16* msgChar = LOAD_ASSET(msgPtr); - if (CVarGetInteger("gLevelSelector", 0) && gCurrentPlanet == 6) { + if (CVarGetInteger("gLevelSelector", 0) && gCurrentLevel == 6) { return 0; } diff --git a/src/engine/fox_wheels.c b/src/engine/fox_wheels.c index bdd10f0e..7f4537f6 100644 --- a/src/engine/fox_wheels.c +++ b/src/engine/fox_wheels.c @@ -8,7 +8,7 @@ Vtx D_Vtx_800DAC80[] = { Gfx D_Gfx_800DACA0[] = { // unused gsSPVertex(D_Vtx_800DAC80, 2, 0), - gsSPLine3D(0, 1, 0), + // gsSPLine3D(0, 1, 0), gsSPEndDisplayList(), }; diff --git a/src/mods/fpscounter.c b/src/mods/fpscounter.c index 2f9a135e..8a734937 100644 --- a/src/mods/fpscounter.c +++ b/src/mods/fpscounter.c @@ -14,7 +14,7 @@ static OSTime gLastOSTime = 0; static float gFrameTime = 0.0f; static u16 gFrames = 0; -static u16 gFPS = 0; +u16 gFPS = 0; static u8 gRenderFPS = false; static void CalculateFrameTimeFromOSTime(OSTime diff) { @@ -29,20 +29,20 @@ static void Play_RenderFps(void) { gRenderFPS ^= 1; } if (gRenderFPS) { - OSTime newTime = osGetTime(); - CalculateFrameTimeFromOSTime(newTime - gLastOSTime); - // If frame time is longer or equal to a second, update FPS counter. - if (gFrameTime >= 1.0f) { - gFPS = gFrames; - gFrames = 0; - gFrameTime -= 1.0f; - } + // OSTime newTime = osGetTime(); + // CalculateFrameTimeFromOSTime(newTime - gLastOSTime); + // // If frame time is longer or equal to a second, update FPS counter. + // if (gFrameTime >= 1.0f) { + // gFPS = gFrames; + // gFrames = 0; + // gFrameTime -= 1.0f; + // } /* Draw */ RCP_SetupDL(&gMasterDisp, SETUPDL_83); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255); Graphics_DisplaySmallText(FPS_COUNTER_X_POS, FPS_COUNTER_Y_POS, 1.0f, 1.0f, "FPS:"); Graphics_DisplaySmallNumber(FPS_COUNTER_X_POS + 35, FPS_COUNTER_Y_POS, gFPS); - gLastOSTime = newTime; + // gLastOSTime = newTime; } } diff --git a/src/overlays/ovl_menu/fox_title.c b/src/overlays/ovl_menu/fox_title.c index 06c9ff68..67b03898 100644 --- a/src/overlays/ovl_menu/fox_title.c +++ b/src/overlays/ovl_menu/fox_title.c @@ -2838,7 +2838,11 @@ void Title_StarfoxLogo_Draw(void) { gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); // LTodo: Validate this +<<<<<<< HEAD Lib_TextureRect_RGBA16(&gMasterDisp, aTitleStarfoxLogoTex, 236, 60, sTitleStarfoxLogoXpos, sTitleStarfoxLogoYpos, 1.0f, 1.0f); +======= + TextureRect_RGBA16(&gMasterDisp, gTitleStarfoxLogo, 236, 60, D_menu_801B9054, D_menu_801B9058, 1.0f, 1.0f); +>>>>>>> edd7dba2 (Fixed all remaining compilation issues) } void Title_64Logo_Draw(void) { @@ -2884,21 +2888,36 @@ void Title_PressStart_Draw(void) { RCP_SetupDL(&gMasterDisp, SETUPDL_85); gDPSetPrimColor(gMasterDisp++, 0, 0, 60, 60, 255, 200); +<<<<<<< HEAD Lib_TextureRect_CI8(&gMasterDisp, aNoControllerBgTex, aNoControllerBgTLUT, 32, 32, sNoControllerBgXpos, sNoControllerBgYpos, sNoControllerBgXscale, sNoControllerBgYscale); // No Controller +======= + TextureRect_CI8(&gMasterDisp, D_TITLE_601D750, D_TITLE_601DB50, 32, 32, D_menu_801AE464, D_menu_801AE468, + D_menu_801AE46C, D_menu_801AE470); +>>>>>>> edd7dba2 (Fixed all remaining compilation issues) RCP_SetupDL(&gMasterDisp, SETUPDL_83); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, (s32) sTitleTextPrimCol, (s32) sTitleTextPrimCol, 255); +<<<<<<< HEAD Lib_TextureRect_IA8(&gMasterDisp, aTitleNoControllerTex, 176, 24, D_menu_801AE474, D_menu_801AE478, 1.0f, 1.0f); +======= + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, (s32) D_menu_801B7BC8, (s32) D_menu_801B7BC8, 255); + + TextureRect_IA8(&gMasterDisp, gTitleNoController, 176, 24, D_menu_801AE474, D_menu_801AE478, 1.0f, 1.0f); +>>>>>>> edd7dba2 (Fixed all remaining compilation issues) } else { // Press Start RCP_SetupDL(&gMasterDisp, SETUPDL_83); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, (s32) sTitleTextPrimCol, (s32) sTitleTextPrimCol, 255); +<<<<<<< HEAD Lib_TextureRect_IA8(&gMasterDisp, aTitlePressStartTex, 120, 13, 101.0f, yPos, 1.0f, 1.0f); +======= + TextureRect_IA8(&gMasterDisp, gTitlePressStart, 120, 13, 101.0f, temp2, 1.0f, 1.0f); +>>>>>>> edd7dba2 (Fixed all remaining compilation issues) } } } @@ -2909,7 +2928,11 @@ void Title_Copyright_Draw(void) { RCP_SetupDL(&gMasterDisp, SETUPDL_83); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); +<<<<<<< HEAD Lib_TextureRect_IA8(&gMasterDisp, a1997NintendoTex, 120, 12, 102.0f, 209.0f, 1.0f, 1.0f); +======= + TextureRect_IA8(&gMasterDisp, gTitleNintendoCopyright, 120, 12, 102.0f, 209.0f, 1.0f, 1.0f); +>>>>>>> edd7dba2 (Fixed all remaining compilation issues) } void Title_TeamName_Draw(void) { @@ -2938,11 +2961,19 @@ void Title_TeamName_Draw(void) { break; case 2: +<<<<<<< HEAD Lib_TextureRect_IA8(&gMasterDisp, gTitleFalcoCard, 176, 13, temp_fs2, temp, 1.0f, 1.0f); break; case 3: Lib_TextureRect_IA8(&gMasterDisp, gTitleFoxCard, 176, 13, temp_fs2, temp, 1.0f, 1.0f); +======= + TextureRect_IA8(&gMasterDisp, gTitleFalcoCard, 176, 13, temp_fs2, temp, 1.0f, 1.0f); + break; + + case 3: + TextureRect_IA8(&gMasterDisp, gTitleFoxCard, 176, 13, temp_fs2, temp, 1.0f, 1.0f); +>>>>>>> edd7dba2 (Fixed all remaining compilation issues) break; } } @@ -2984,7 +3015,11 @@ void Title_SunGlare_Draw(void) { gDPSetColorDither(gMasterDisp++, G_CD_NOISE); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, D_menu_801B7BD0); +<<<<<<< HEAD Lib_TextureRect_RGBA16(&gMasterDisp, aTitleSunGlareTex, 32, 32, D_menu_801B9080, D_menu_801B9084, D_menu_801B7BB0, +======= + TextureRect_RGBA16(&gMasterDisp, gTitleSunBeam, 32, 32, D_menu_801B9080, D_menu_801B9084, D_menu_801B7BB0, +>>>>>>> edd7dba2 (Fixed all remaining compilation issues) D_menu_801B7BB4); D_menu_801B9080 += 1.66f; } @@ -3107,11 +3142,19 @@ void Title_Logos_Draw(void) { Lib_TextureRect_CI4(&gMasterDisp, aIntroInTex, aIntroInTLUT, 32, 13, 150.0f, 110.0f, 1.0f, 1.0f); break; +<<<<<<< HEAD case TITLE_LOGO_NINTENDO_64: RCP_SetupDL(&gMasterDisp, 0x53); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, (s32) sStarfoxLogoAlpha); TextureRect_16bRGBA(&gMasterDisp, aTitleN64LogoTex, 128, 88, D_menu_801B9070, D_menu_801B9074, D_menu_801B9078, D_menu_801B907C); +======= + case 1: + RCP_SetupDL(&gMasterDisp, SETUPDL_83); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, (s32) D_menu_801B7BDC); + TextureRect_RGBA16(&gMasterDisp, gTitleNintendo64Logo, 128, 88, D_menu_801B9070, D_menu_801B9074, + D_menu_801B9078, D_menu_801B907C); +>>>>>>> edd7dba2 (Fixed all remaining compilation issues) case TITLE_LOGO_NONE: break; @@ -3181,8 +3224,12 @@ void Title_TitleCard_Draw(void) { RCP_SetupDL(&gMasterDisp, SETUPDL_83); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); +<<<<<<< HEAD Lib_TextureRect_IA8(&gMasterDisp, aTitleArwingCardTex, 112, 26, sTitleArwingCardXpos, sTitleArwingCardYpos, 1.0f, 1.0f); +======= + TextureRect_IA8(&gMasterDisp, gTitleArwingCard, 112, 26, D_menu_801AE564, D_menu_801AE568, 1.0f, 1.0f); +>>>>>>> edd7dba2 (Fixed all remaining compilation issues) } } diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp index deaf9adf..603ba3d7 100644 --- a/src/port/Engine.cpp +++ b/src/port/Engine.cpp @@ -1,6 +1,6 @@ #include "Engine.h" #include "ui/ImguiUI.h" -#include "ZAPDUtils/Utils/StringHelper.h" +#include "StringHelper.h" #include "libultraship/src/Context.h" #include "resource/type/ResourceType.h" #include "resource/importers/AnimFactory.h" @@ -17,6 +17,13 @@ #include "resource/importers/SkeletonFactory.h" #include "resource/importers/Vec3fFactory.h" #include "resource/importers/Vec3sFactory.h" +#include +#include +#include +#include +#include +#include +#include #include #include @@ -25,6 +32,7 @@ #include extern "C" { +extern uint16_t gFPS; float gInterpolationStep = 0.0f; #include #include @@ -34,13 +42,13 @@ GameEngine* GameEngine::Instance; GameEngine::GameEngine() { std::vector OTRFiles; - if (const std::string cube_path = LUS::Context::GetPathRelativeToAppDirectory("sp.otr"); std::filesystem::exists(cube_path)) { + if (const std::string cube_path = Ship::Context::GetPathRelativeToAppDirectory("starship.otr"); std::filesystem::exists(cube_path)) { OTRFiles.push_back(cube_path); } - if (const std::string sm64_otr_path = LUS::Context::GetPathRelativeToAppBundle("sm64.otr"); std::filesystem::exists(sm64_otr_path)) { + if (const std::string sm64_otr_path = Ship::Context::GetPathRelativeToAppBundle("sm64.otr"); std::filesystem::exists(sm64_otr_path)) { OTRFiles.push_back(sm64_otr_path); } - if (const std::string patches_path = LUS::Context::GetPathRelativeToAppDirectory("mods"); !patches_path.empty() && std::filesystem::exists(patches_path)) { + if (const std::string patches_path = Ship::Context::GetPathRelativeToAppDirectory("mods"); !patches_path.empty() && std::filesystem::exists(patches_path)) { if (std::filesystem::is_directory(patches_path)) { for (const auto&p: std::filesystem::recursive_directory_iterator(patches_path)) { if (StringHelper::IEquals(p.path().extension().string(), ".otr")) { @@ -50,7 +58,7 @@ GameEngine::GameEngine() { } } - this->context = LUS::Context::CreateInstance("Starship", "ship", "starship.cfg.json", OTRFiles, {}, 3); + this->context = Ship::Context::CreateInstance("Starship", "ship", "starship.cfg.json", OTRFiles, {}, 3); auto loader = context->GetResourceManager()->GetResourceLoader(); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Animation", static_cast(SF64::ResourceType::AnimData), 0); @@ -58,7 +66,7 @@ GameEngine::GameEngine() { loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Limb", static_cast(SF64::ResourceType::Limb), 0); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Message", static_cast(SF64::ResourceType::Message), 0); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "MessageTable", static_cast(SF64::ResourceType::MessageTable), 0); - loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "EnvSettings", static_cast(SF64::ResourceType::EnvSettings), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "EnvSettings", static_cast(SF64::ResourceType::Environment), 0); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "ObjectInit", static_cast(SF64::ResourceType::ObjectInit), 0); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Hitbox", static_cast(SF64::ResourceType::Hitbox), 0); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Script", static_cast(SF64::ResourceType::Script), 0); @@ -67,6 +75,13 @@ GameEngine::GameEngine() { loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Vec3f", static_cast(SF64::ResourceType::Vec3f), 0); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Vec3s", static_cast(SF64::ResourceType::Vec3s), 0); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "GenericArray", static_cast(SF64::ResourceType::GenericArray), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Texture", static_cast(LUS::ResourceType::Texture), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Texture", static_cast(LUS::ResourceType::Texture), 1); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Vertex", static_cast(LUS::ResourceType::Vertex), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "DisplayList", static_cast(LUS::ResourceType::DisplayList), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Matrix", static_cast(LUS::ResourceType::Matrix), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Array", static_cast(LUS::ResourceType::Array), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Blob", static_cast(LUS::ResourceType::Blob), 0); } void GameEngine::Create(){ @@ -84,7 +99,7 @@ void GameEngine::Destroy(){ bool ShouldClearTextureCacheAtEndOfFrame = false; void GameEngine::StartFrame() const{ - using LUS::KbScancode; + using Ship::KbScancode; const int32_t dwScancode = this->context->GetWindow()->GetLastScancode(); this->context->GetWindow()->SetLastScancode(-1); @@ -100,10 +115,6 @@ void GameEngine::StartFrame() const{ this->context->GetWindow()->StartFrame(); } -void GameEngine::ProcessFrame(void (*run_one_game_iter)()) const { - this->context->GetWindow()->MainLoop(run_one_game_iter); -} - void GameEngine::RunCommands(Gfx* Commands) { gfx_run(Commands, {}); gfx_end_frame(); @@ -115,13 +126,22 @@ void GameEngine::RunCommands(Gfx* Commands) { } void GameEngine::ProcessGfxCommands(Gfx* commands) { + auto wnd = std::dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()); + + if (wnd == nullptr) { + return; + } + + gFPS = 30; + wnd->SetRendererUCode(UcodeHandlers::ucode_f3dex); + wnd->SetTargetFps(30); + wnd->SetMaximumFrameLatency(1); + RunCommands(commands); - Instance->context->GetWindow()->SetTargetFps(30); - Instance->context->GetWindow()->SetMaximumFrameLatency(1); } extern "C" uint32_t GameEngine_GetSampleRate() { - auto player = LUS::Context::GetInstance()->GetAudio()->GetAudioPlayer(); + auto player = Ship::Context::GetInstance()->GetAudio()->GetAudioPlayer(); if (player == nullptr) { return 0; } diff --git a/src/port/Engine.h b/src/port/Engine.h index 79c29533..8e714710 100644 --- a/src/port/Engine.h +++ b/src/port/Engine.h @@ -18,7 +18,7 @@ class GameEngine { public: static GameEngine* Instance; - std::shared_ptr context; + std::shared_ptr context; GameEngine(); static void Create(); diff --git a/src/port/GBIMiddleware.cpp b/src/port/GBIMiddleware.cpp index 37b86004..da0809dc 100644 --- a/src/port/GBIMiddleware.cpp +++ b/src/port/GBIMiddleware.cpp @@ -10,12 +10,12 @@ extern "C" void gSPDisplayList(Gfx* pkt, Gfx* dl) { char* imgData = (char*)dl; if (GameEngine_OTRSigCheck(imgData) == 1) { - auto resource = LUS::Context::GetInstance()->GetResourceManager()->LoadResource(imgData); + auto resource = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(imgData); auto res = std::static_pointer_cast(resource); dl = &res->Instructions[0]; - dl->words.trace.file = imgData; - dl->words.trace.idx = 0; - dl->words.trace.valid = true; + // dl->words.trace.file = imgData; + // dl->words.trace.idx = 0; + // dl->words.trace.valid = true; } __gSPDisplayList(pkt, dl); @@ -34,7 +34,7 @@ extern "C" void gSPInvalidateTexCache(Gfx* pkt, uintptr_t texAddr) { auto data = reinterpret_cast(texAddr); if (texAddr != 0 && GameEngine_OTRSigCheck(data)) { - const auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResource(data); + const auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(data); const auto type = static_cast(res->GetInitData()->Type); switch(type) { diff --git a/src/port/Game.cpp b/src/port/Game.cpp index 27d1cc64..f0e6a226 100644 --- a/src/port/Game.cpp +++ b/src/port/Game.cpp @@ -41,7 +41,9 @@ int main(int argc, char *argv[]) { Lib_FillScreen(1); Main_Initialize(); Main_ThreadEntry(NULL); - GameEngine::Instance->ProcessFrame(push_frame); + while (WindowIsRunning()) { + push_frame(); + } GameEngine::Instance->Destroy(); return 0; } \ No newline at end of file diff --git a/src/port/resource/importers/AnimFactory.cpp b/src/port/resource/importers/AnimFactory.cpp index 0f4eecdc..c532401d 100644 --- a/src/port/resource/importers/AnimFactory.cpp +++ b/src/port/resource/importers/AnimFactory.cpp @@ -3,13 +3,13 @@ #include "spdlog/spdlog.h" namespace SF64 { -std::shared_ptr ResourceFactoryBinaryAnimV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryAnimV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto anim = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); int16_t frameCount = reader->ReadInt16(); int16_t limbCount = reader->ReadInt16(); diff --git a/src/port/resource/importers/AnimFactory.h b/src/port/resource/importers/AnimFactory.h index c94d8f53..80f07932 100644 --- a/src/port/resource/importers/AnimFactory.h +++ b/src/port/resource/importers/AnimFactory.h @@ -4,8 +4,8 @@ #include "ResourceFactoryBinary.h" namespace SF64 { -class ResourceFactoryBinaryAnimV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryAnimV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; }; // namespace LUS diff --git a/src/port/resource/importers/ColPolyFactory.cpp b/src/port/resource/importers/ColPolyFactory.cpp index 98ed4cba..91ec4602 100644 --- a/src/port/resource/importers/ColPolyFactory.cpp +++ b/src/port/resource/importers/ColPolyFactory.cpp @@ -3,13 +3,13 @@ #include "spdlog/spdlog.h" namespace SF64 { -std::shared_ptr ResourceFactoryBinaryColPolyV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryColPolyV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto colPoly = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); auto colPolysCount = reader->ReadUInt32(); diff --git a/src/port/resource/importers/ColPolyFactory.h b/src/port/resource/importers/ColPolyFactory.h index 087392db..817be9c5 100644 --- a/src/port/resource/importers/ColPolyFactory.h +++ b/src/port/resource/importers/ColPolyFactory.h @@ -4,8 +4,8 @@ #include "ResourceFactoryBinary.h" namespace SF64 { -class ResourceFactoryBinaryColPolyV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryColPolyV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; }; // namespace LUS diff --git a/src/port/resource/importers/EnvSettingsFactory.cpp b/src/port/resource/importers/EnvSettingsFactory.cpp index 2822786b..9959aec0 100644 --- a/src/port/resource/importers/EnvSettingsFactory.cpp +++ b/src/port/resource/importers/EnvSettingsFactory.cpp @@ -6,13 +6,13 @@ namespace SF64 { -std::shared_ptr ResourceFactoryBinaryEnvSettingsV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryEnvSettingsV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto env = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); env->mSettings.type = reader->ReadInt32(); env->mSettings.unk_04 = reader->ReadInt32(); diff --git a/src/port/resource/importers/EnvSettingsFactory.h b/src/port/resource/importers/EnvSettingsFactory.h index 0ab76ff9..cd269558 100644 --- a/src/port/resource/importers/EnvSettingsFactory.h +++ b/src/port/resource/importers/EnvSettingsFactory.h @@ -4,8 +4,8 @@ #include "ResourceFactoryBinary.h" namespace SF64 { -class ResourceFactoryBinaryEnvSettingsV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryEnvSettingsV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; }; // namespace LUS diff --git a/src/port/resource/importers/GenericArrayFactory.cpp b/src/port/resource/importers/GenericArrayFactory.cpp index 64608f44..27abc55f 100644 --- a/src/port/resource/importers/GenericArrayFactory.cpp +++ b/src/port/resource/importers/GenericArrayFactory.cpp @@ -3,13 +3,13 @@ #include "spdlog/spdlog.h" namespace SF64 { -std::shared_ptr ResourceFactoryBinaryGenericArrayV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryGenericArrayV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto arr = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); auto type = reader->ReadUInt32(); diff --git a/src/port/resource/importers/GenericArrayFactory.h b/src/port/resource/importers/GenericArrayFactory.h index ce0d2262..78f9087f 100644 --- a/src/port/resource/importers/GenericArrayFactory.h +++ b/src/port/resource/importers/GenericArrayFactory.h @@ -4,8 +4,8 @@ #include "ResourceFactoryBinary.h" namespace SF64 { -class ResourceFactoryBinaryGenericArrayV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryGenericArrayV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; }; // namespace LUS diff --git a/src/port/resource/importers/HitboxFactory.cpp b/src/port/resource/importers/HitboxFactory.cpp index 258c4049..40d4e3b4 100644 --- a/src/port/resource/importers/HitboxFactory.cpp +++ b/src/port/resource/importers/HitboxFactory.cpp @@ -3,13 +3,13 @@ #include "spdlog/spdlog.h" namespace SF64 { -std::shared_ptr ResourceFactoryBinaryHitboxV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryHitboxV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto hitbox = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); auto count = reader->ReadUInt32(); diff --git a/src/port/resource/importers/HitboxFactory.h b/src/port/resource/importers/HitboxFactory.h index 3b5fd64e..5be626ca 100644 --- a/src/port/resource/importers/HitboxFactory.h +++ b/src/port/resource/importers/HitboxFactory.h @@ -4,8 +4,8 @@ #include "ResourceFactoryBinary.h" namespace SF64 { -class ResourceFactoryBinaryHitboxV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryHitboxV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; }; // namespace LUS diff --git a/src/port/resource/importers/LimbFactory.cpp b/src/port/resource/importers/LimbFactory.cpp index 72e698ae..e1ffc191 100644 --- a/src/port/resource/importers/LimbFactory.cpp +++ b/src/port/resource/importers/LimbFactory.cpp @@ -7,15 +7,16 @@ namespace SF64 { -std::shared_ptr ResourceFactoryBinaryLimbV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryLimbV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto limb = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); - - limb->mData.dList = LoadChild(reader->ReadUInt64()); + auto reader = std::get>(file->Reader); + + uint64_t dlist = reader->ReadUInt64(); + limb->mData.dList = LoadChild(dlist); limb->mData.trans.x = reader->ReadFloat(); limb->mData.trans.y = reader->ReadFloat(); limb->mData.trans.z = reader->ReadFloat(); diff --git a/src/port/resource/importers/LimbFactory.h b/src/port/resource/importers/LimbFactory.h index 6b2593dc..f229733e 100644 --- a/src/port/resource/importers/LimbFactory.h +++ b/src/port/resource/importers/LimbFactory.h @@ -4,8 +4,8 @@ #include "ResourceFactoryBinary.h" namespace SF64 { -class ResourceFactoryBinaryLimbV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryLimbV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; }; // namespace LUS diff --git a/src/port/resource/importers/MessageFactory.cpp b/src/port/resource/importers/MessageFactory.cpp index 64716da8..fcd4e943 100644 --- a/src/port/resource/importers/MessageFactory.cpp +++ b/src/port/resource/importers/MessageFactory.cpp @@ -3,13 +3,13 @@ #include "spdlog/spdlog.h" namespace SF64 { -std::shared_ptr ResourceFactoryBinaryMessageV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryMessageV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto msg = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); auto size = reader->ReadUInt32(); diff --git a/src/port/resource/importers/MessageFactory.h b/src/port/resource/importers/MessageFactory.h index 38c6e42c..74e37136 100644 --- a/src/port/resource/importers/MessageFactory.h +++ b/src/port/resource/importers/MessageFactory.h @@ -4,8 +4,8 @@ #include "ResourceFactoryBinary.h" namespace SF64 { -class ResourceFactoryBinaryMessageV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryMessageV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; }; // namespace LUS diff --git a/src/port/resource/importers/MessageLookupFactory.cpp b/src/port/resource/importers/MessageLookupFactory.cpp index 8eec7ffb..88366e78 100644 --- a/src/port/resource/importers/MessageLookupFactory.cpp +++ b/src/port/resource/importers/MessageLookupFactory.cpp @@ -5,13 +5,13 @@ #include "ResourceUtil.h" namespace SF64 { -std::shared_ptr ResourceFactoryBinaryMessageLookupV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryMessageLookupV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto table = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); auto count = reader->ReadUInt32(); for (uint32_t i = 0; i < count - 1; i++) { diff --git a/src/port/resource/importers/MessageLookupFactory.h b/src/port/resource/importers/MessageLookupFactory.h index b93953f8..ab94e3a5 100644 --- a/src/port/resource/importers/MessageLookupFactory.h +++ b/src/port/resource/importers/MessageLookupFactory.h @@ -4,8 +4,8 @@ #include "ResourceFactoryBinary.h" namespace SF64 { -class ResourceFactoryBinaryMessageLookupV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryMessageLookupV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; }; // namespace LUS diff --git a/src/port/resource/importers/ObjectInitFactory.cpp b/src/port/resource/importers/ObjectInitFactory.cpp index 9a7a3116..04822034 100644 --- a/src/port/resource/importers/ObjectInitFactory.cpp +++ b/src/port/resource/importers/ObjectInitFactory.cpp @@ -6,13 +6,13 @@ namespace SF64 { -std::shared_ptr ResourceFactoryBinaryObjectInitV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryObjectInitV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto obj = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); auto count = reader->ReadUInt32(); for(size_t i = 0; i < count; i++) { diff --git a/src/port/resource/importers/ObjectInitFactory.h b/src/port/resource/importers/ObjectInitFactory.h index 99297edd..9e8ab64b 100644 --- a/src/port/resource/importers/ObjectInitFactory.h +++ b/src/port/resource/importers/ObjectInitFactory.h @@ -4,8 +4,8 @@ #include "ResourceFactoryBinary.h" namespace SF64 { -class ResourceFactoryBinaryObjectInitV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryObjectInitV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; }; // namespace LUS diff --git a/src/port/resource/importers/ResourceUtil.h b/src/port/resource/importers/ResourceUtil.h index 4872ad64..2d8b560a 100644 --- a/src/port/resource/importers/ResourceUtil.h +++ b/src/port/resource/importers/ResourceUtil.h @@ -5,11 +5,14 @@ namespace SF64 { template T LoadChild(uint64_t crc) { + if (crc == 0) { + return nullptr; + } auto path = ResourceGetNameByCrc(crc); if (path == nullptr) { return nullptr; } - auto asset = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(path); + auto asset = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(path); return asset ? static_cast(asset->GetRawPointer()) : nullptr; } } \ No newline at end of file diff --git a/src/port/resource/importers/ScriptCommandFactory.cpp b/src/port/resource/importers/ScriptCommandFactory.cpp index 3fcef793..e5489c92 100644 --- a/src/port/resource/importers/ScriptCommandFactory.cpp +++ b/src/port/resource/importers/ScriptCommandFactory.cpp @@ -4,13 +4,13 @@ #include "ResourceUtil.h" namespace SF64 { -std::shared_ptr ResourceFactoryBinaryScriptCMDV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryScriptCMDV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto cmds = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); auto size = reader->ReadUInt32(); diff --git a/src/port/resource/importers/ScriptCommandFactory.h b/src/port/resource/importers/ScriptCommandFactory.h index 6f119f73..a2e8432c 100644 --- a/src/port/resource/importers/ScriptCommandFactory.h +++ b/src/port/resource/importers/ScriptCommandFactory.h @@ -4,8 +4,8 @@ #include "ResourceFactoryBinary.h" namespace SF64 { -class ResourceFactoryBinaryScriptCMDV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryScriptCMDV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; }; // namespace LUS diff --git a/src/port/resource/importers/ScriptFactory.cpp b/src/port/resource/importers/ScriptFactory.cpp index 67503fcc..12f837fe 100644 --- a/src/port/resource/importers/ScriptFactory.cpp +++ b/src/port/resource/importers/ScriptFactory.cpp @@ -4,13 +4,13 @@ #include "ResourceUtil.h" namespace SF64 { -std::shared_ptr ResourceFactoryBinaryScriptV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryScriptV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto script = std::make_shared