diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index e524a5f8c..a047addd3 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -89,12 +89,14 @@ jobs: shell: bash run: | mkdir artifact + mkdir artifact/Movies ls -p | grep -v / cp ./build/Vinifera.dll ./artifact/Vinifera.dll cp ./build/Vinifera.pdb ./artifact/Vinifera.pdb cp ./build/LaunchVinifera.exe ./artifact/LaunchVinifera.exe cp ./build/_deps/tspp-src/pdb/Game.pdb ./artifact/Game.pdb cp ./build/_deps/tspp-src/edb/Game.edb ./artifact/Game.edb + cp ./vinifera-files/files/VINIFERA.VQA ./artifact/Movies/VINIFERA.VQA - name: Upload Artifact uses: actions/upload-artifact@v2 @@ -180,15 +182,17 @@ jobs: shell: bash run: | mkdir artifact + mkdir artifact/Movies ls -p | grep -v / cp ./build/Vinifera.dll ./artifact/Vinifera.dll cp ./build/Vinifera.pdb ./artifact/Vinifera.pdb cp ./build/LaunchVinifera.exe ./artifact/LaunchVinifera.dat cp ./build/_deps/tspp-src/pdb/Game.pdb ./artifact/Game.pdb cp ./build/_deps/tspp-src/edb/Game.edb ./artifact/Game.edb + cp ./vinifera-files/files/VINIFERA.VQA ./artifact/Movies/VINIFERA.VQA - name: Upload Artifact uses: actions/upload-artifact@v2 with: name: vinifera-nightly-${{ steps.vars.outputs.sha_short }}-ts_client - path: artifact \ No newline at end of file + path: artifact diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index c8e4285b7..688558a09 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -52,11 +52,13 @@ jobs: shell: bash run: | mkdir artifact + mkdir artifact/Movies cp ./build/Vinifera.dll ./artifact/Vinifera.dll cp ./build/Vinifera.pdb ./artifact/Vinifera.pdb cp ./build/LaunchVinifera.exe ./artifact/LaunchVinifera.exe cp ./build/_deps/tspp-src/pdb/Game.pdb ./artifact/Game.pdb cp ./build/_deps/tspp-src/edb/Game.edb ./artifact/Game.edb + cp ./vinifera-files/files/VINIFERA.VQA ./artifact/Movies/VINIFERA.VQA - name: Upload Artifact uses: actions/upload-artifact@v2 @@ -108,11 +110,13 @@ jobs: shell: bash run: | mkdir artifact + mkdir artifact/Movies cp ./build/Vinifera.dll ./artifact/Vinifera.dll cp ./build/Vinifera.pdb ./artifact/Vinifera.pdb cp ./build/LaunchVinifera.exe ./artifact/LaunchVinifera.dat cp ./build/_deps/tspp-src/pdb/Game.pdb ./artifact/Game.pdb cp ./build/_deps/tspp-src/edb/Game.edb ./artifact/Game.edb + cp ./vinifera-files/files/VINIFERA.WMV ./artifact/Movies/VINIFERA.VQA - name: Upload Artifact uses: actions/upload-artifact@v2 diff --git a/src/extensions/init/initext_hooks.cpp b/src/extensions/init/initext_hooks.cpp index 749408ea6..6222a506d 100644 --- a/src/extensions/init/initext_hooks.cpp +++ b/src/extensions/init/initext_hooks.cpp @@ -146,34 +146,47 @@ static bool CCFile_Is_Available(const char *filename) return CCFileClass(filename).Is_Available(); } +static bool CCFile_Validate_Is_Available(const char *filename, int size) +{ + return CCFileClass(filename).Is_Available() && CCFileClass(filename).Size() == size; +} + /** * #issue-478 * - * + * Adds command line options to skip startup movies. * * @author: CCHyper */ -DECLARE_PATCH(_Init_Game_Skip_Startup_Movies_Patch) +static bool Vinifera_Play_Startup_Movies() { - if (Vinifera_SkipStartupMovies) { - DEBUG_INFO("Skipping startup movies.\n"); - goto skip_loading_screen; - } + static const int VINIFERA_VQA_SIZE = 704889; + static const int WWLOGO_VQA_SIZE = 2415362; if (Special.IsFromInstall) { - DEBUG_GAME("Playing first time intro sequence.\n"); - Play_Movie("EVA.VQA", THEME_NONE, true, true, true); + DEBUG_INFO("Playing first time intro sequence.\n"); + Play_Movie("EVA.VQA"); } - if (!Vinifera_SkipWWLogoMovie) { - DEBUG_GAME("Playing startup movies.\n"); - Play_Movie("WWLOGO.VQA", THEME_NONE, true, true, true); + if (!Vinifera_SkipLogoMovies) { + DEBUG_INFO("Playing logo movies.\n"); + if (!CCFile_Validate_Is_Available("VINIFERA.VQA", VINIFERA_VQA_SIZE)) { + DEBUG_ERROR("Failed to find VINIFERA.VQA!\n"); + return false; + } + Play_Movie("VINIFERA.VQA"); + if (!CCFile_Validate_Is_Available("WWLOGO.VQA", WWLOGO_VQA_SIZE)) { + DEBUG_ERROR("Failed to find WWLOGO.VQA!\n"); + return false; + } + Play_Movie("WWLOGO.VQA"); } else { - DEBUG_INFO("Skipping startup movie.\n"); + DEBUG_INFO("Skipping logo movies.\n"); } if (!NewMenuClass::Get()) { + DEBUG_INFO("Playing title movie.\n"); if (CCFile_Is_Available("FS_TITLE.VQA")) { Play_Movie("FS_TITLE.VQA", THEME_NONE, true, false, true); } else { @@ -181,12 +194,30 @@ DECLARE_PATCH(_Init_Game_Skip_Startup_Movies_Patch) } } + return true; +} + +DECLARE_PATCH(_Init_Game_Skip_Startup_Movies_Patch) +{ + if (Vinifera_SkipStartupMovies) { + DEBUG_INFO("Skipping startup movies.\n"); + goto skip_loading_screen; + } + + if (!Vinifera_Play_Startup_Movies()) { + goto failed; + } + loading_screen: _asm { or ebx, 0xFFFFFFFF } JMP(0x004E0848); skip_loading_screen: JMP(0x004E084D); + +failed: + _asm { mov ebx, 1 } + JMP(0x004E08B3); } diff --git a/src/vinifera/vinifera_functions.cpp b/src/vinifera/vinifera_functions.cpp index b665ae73e..1b55dbbfa 100644 --- a/src/vinifera/vinifera_functions.cpp +++ b/src/vinifera/vinifera_functions.cpp @@ -409,6 +409,18 @@ bool Vinifera_Parse_Command_Line(int argc, char *argv[]) */ bool Vinifera_Startup() { + DWORD rc; + DynamicVectorClass search_paths; + +#ifndef NDEBUG + /** + * Debug paths for CD contents (folders must contain .DSK files of the same name). + */ + search_paths.Add("TS1"); + search_paths.Add("TS2"); + search_paths.Add("TS3"); +#endif + /** * #issue-514: * @@ -417,9 +429,6 @@ bool Vinifera_Startup() * @author: CCHyper */ #if defined(TS_CLIENT) - DWORD rc; - DynamicVectorClass search_paths; - /** * If -CD has been defined, set the root directory as highest priority. */ @@ -432,12 +441,17 @@ bool Vinifera_Startup() */ search_paths.Add("INI"); search_paths.Add("MIX"); +#endif + search_paths.Add("MOVIES"); + +#if defined(TS_CLIENT) search_paths.Add("MUSIC"); search_paths.Add("SOUNDS"); search_paths.Add("MAPS"); search_paths.Add("MAPS\\MULTIPLAYER"); search_paths.Add("MAPS\\MISSION"); +#endif /** * Current path (perhaps set set with -CD) should go next. @@ -446,32 +460,33 @@ bool Vinifera_Startup() search_paths.Add(CCFileClass::RawPath); } - char *new_path = new char [_MAX_PATH * search_paths.Count()+1]; - new_path[0] = '\0'; + if (search_paths.Count() > 0) { + char *new_path = new char [_MAX_PATH * search_paths.Count()+1]; + new_path[0] = '\0'; - /** - * Build the search path string. - */ - for (int i = 0; i < search_paths.Count(); ++i) { - if (i != 0) std::strcat(new_path, ";"); - std::strcat(new_path, search_paths[i].Peek_Buffer()); - } + /** + * Build the search path string. + */ + for (int i = 0; i < search_paths.Count(); ++i) { + if (i != 0) std::strcat(new_path, ";"); + std::strcat(new_path, search_paths[i].Peek_Buffer()); + } - /** - * Clear the current path ready to be set. - */ - CCFileClass::Clear_Search_Drives(); - CCFileClass::Reset_Raw_Path(); + /** + * Clear the current path ready to be set. + */ + CCFileClass::Clear_Search_Drives(); + CCFileClass::Reset_Raw_Path(); - /** - * Set the new search drive path. - */ - CCFileClass::Set_Search_Drives(new_path); + /** + * Set the new search drive path. + */ + CCFileClass::Set_Search_Drives(new_path); - delete [] new_path; + delete [] new_path; - DEBUG_INFO("SearchPath: %s\n", CCFileClass::RawPath); -#endif + DEBUG_INFO("SearchPath: %s\n", CCFileClass::RawPath); + } /** * Load Vinifera settings and overrides. diff --git a/src/vinifera/vinifera_globals.cpp b/src/vinifera/vinifera_globals.cpp index 828d40021..2691df239 100644 --- a/src/vinifera/vinifera_globals.cpp +++ b/src/vinifera/vinifera_globals.cpp @@ -56,7 +56,7 @@ bool Vinifera_Developer_FrameStep = false; int Vinifera_Developer_FrameStepCount = 0; bool Vinifera_Developer_AIControl = false; -bool Vinifera_SkipWWLogoMovie = false; +bool Vinifera_SkipLogoMovies = false; bool Vinifera_SkipStartupMovies = false; bool Vinifera_ShowSuperWeaponTimers = true; diff --git a/src/vinifera/vinifera_globals.h b/src/vinifera/vinifera_globals.h index 13264c4c8..9c240227e 100644 --- a/src/vinifera/vinifera_globals.h +++ b/src/vinifera/vinifera_globals.h @@ -76,7 +76,7 @@ extern bool Vinifera_Developer_AIControl; /** * Various globals. */ -extern bool Vinifera_SkipWWLogoMovie; +extern bool Vinifera_SkipLogoMovies; extern bool Vinifera_SkipStartupMovies; extern bool Vinifera_ShowSuperWeaponTimers;