Jessica James
9 years ago
4 changed files with 286 additions and 0 deletions
@ -0,0 +1,28 @@ |
|||
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00 |
|||
# Visual Studio 14 |
|||
VisualStudioVersion = 14.0.24720.0 |
|||
MinimumVisualStudioVersion = 10.0.40219.1 |
|||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Rx_SetStartupMovie", "Rx_SetStartupMovie\Rx_SetStartupMovie.vcxproj", "{1DEF81B5-47F8-4028-90CC-0915FF7FBA8D}" |
|||
EndProject |
|||
Global |
|||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|||
Debug|x64 = Debug|x64 |
|||
Debug|x86 = Debug|x86 |
|||
Release|x64 = Release|x64 |
|||
Release|x86 = Release|x86 |
|||
EndGlobalSection |
|||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
|||
{1DEF81B5-47F8-4028-90CC-0915FF7FBA8D}.Debug|x64.ActiveCfg = Debug|x64 |
|||
{1DEF81B5-47F8-4028-90CC-0915FF7FBA8D}.Debug|x64.Build.0 = Debug|x64 |
|||
{1DEF81B5-47F8-4028-90CC-0915FF7FBA8D}.Debug|x86.ActiveCfg = Debug|Win32 |
|||
{1DEF81B5-47F8-4028-90CC-0915FF7FBA8D}.Debug|x86.Build.0 = Debug|Win32 |
|||
{1DEF81B5-47F8-4028-90CC-0915FF7FBA8D}.Release|x64.ActiveCfg = Release|x64 |
|||
{1DEF81B5-47F8-4028-90CC-0915FF7FBA8D}.Release|x64.Build.0 = Release|x64 |
|||
{1DEF81B5-47F8-4028-90CC-0915FF7FBA8D}.Release|x86.ActiveCfg = Release|Win32 |
|||
{1DEF81B5-47F8-4028-90CC-0915FF7FBA8D}.Release|x86.Build.0 = Release|Win32 |
|||
EndGlobalSection |
|||
GlobalSection(SolutionProperties) = preSolution |
|||
HideSolutionNode = FALSE |
|||
EndGlobalSection |
|||
EndGlobal |
@ -0,0 +1,115 @@ |
|||
/**
|
|||
* Copyright (C) 2016 Jessica James. |
|||
* |
|||
* Permission to use, copy, modify, and/or distribute this software for any |
|||
* purpose with or without fee is hereby granted, provided that the above |
|||
* copyright notice and this permission notice appear in all copies. |
|||
* |
|||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
|||
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION |
|||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
|||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|||
* |
|||
* Written by Jessica James <jessica.aj@outlook.com> |
|||
*/ |
|||
|
|||
#define _CRT_SECURE_NO_WARNINGS |
|||
|
|||
#include <stdlib.h> // wcstombs |
|||
#include <wchar.h> // wchar_t, wcscmp |
|||
#include <stdio.h> // fopen, fclose, rename |
|||
#include <string.h> // strcpy |
|||
|
|||
/** Directory that movies are stored in */ |
|||
#define MOVIES_DIRECTORY "..\\..\\..\\UDKGame\\Movies\\" |
|||
|
|||
/** Movie file extension */ |
|||
#define MOVIE_FILE_EXTENSION ".bik" |
|||
const char movie_file_extension[] = MOVIE_FILE_EXTENSION; |
|||
|
|||
/** Name of the movie which is loaded by UDK */ |
|||
const char movie_filename[] = MOVIES_DIRECTORY "UDKFrontEnd.udk_loading" MOVIE_FILE_EXTENSION; |
|||
|
|||
/** Prefix of the loading screens which we are to use */ |
|||
const char movie_prefix[] = MOVIES_DIRECTORY "LoadingScreen_"; |
|||
|
|||
__declspec(dllexport) void SetStartupMovie(wchar_t *in_leaving_level, wchar_t *in_loading_level) |
|||
{ |
|||
FILE *file; |
|||
size_t leaving_level_length; |
|||
size_t loading_level_length; |
|||
char leaving_level[256]; |
|||
char loading_level[256]; |
|||
char loading_level_movie_filename[256]; |
|||
char leaving_level_movie_filename[256]; |
|||
|
|||
if (wcscmp(in_leaving_level, in_loading_level) == 0) |
|||
return; // Nothing to change.
|
|||
|
|||
// Copy inputs to character arrays (interactions with files require this)
|
|||
leaving_level_length = wcstombs(leaving_level, in_leaving_level, sizeof(leaving_level)); |
|||
loading_level_length = wcstombs(loading_level, in_loading_level, sizeof(loading_level)); |
|||
|
|||
// Ensure that our strings are null-terminated
|
|||
if (leaving_level_length == sizeof(leaving_level)) |
|||
--leaving_level_length; |
|||
leaving_level[leaving_level_length] = '\0'; |
|||
|
|||
if (loading_level_length == sizeof(loading_level)) |
|||
--loading_level_length; |
|||
loading_level[loading_level_length] = '\0'; |
|||
|
|||
// Ensure that our strings are null-terminated
|
|||
leaving_level[sizeof(leaving_level) / sizeof(char) - 1] = '\0'; |
|||
loading_level[sizeof(loading_level) / sizeof(char) - 1] = '\0'; |
|||
|
|||
strcpy(loading_level_movie_filename, movie_prefix); |
|||
strcpy(loading_level_movie_filename + sizeof(movie_prefix) / sizeof(char) - 1, loading_level); |
|||
strcpy(loading_level_movie_filename + sizeof(movie_prefix) / sizeof(char) - 1 + loading_level_length, movie_file_extension); |
|||
|
|||
file = fopen(loading_level_movie_filename, "rb"); |
|||
if (file != NULL) // level-specific movie exists; move it into place
|
|||
{ |
|||
fclose(file); |
|||
|
|||
// check if default movie is in position
|
|||
file = fopen(movie_prefix, "rb"); |
|||
if (file != NULL) |
|||
{ |
|||
fclose(file); |
|||
|
|||
// A level-specific movie is currently in position; move it
|
|||
strcpy(leaving_level_movie_filename, movie_prefix); |
|||
strcpy(leaving_level_movie_filename + sizeof(movie_prefix) / sizeof(char) - 1, leaving_level); |
|||
strcpy(leaving_level_movie_filename + sizeof(movie_prefix) / sizeof(char) - 1 + leaving_level_length, movie_file_extension); |
|||
rename(movie_filename, leaving_level_movie_filename); |
|||
} |
|||
else // The default movie is currently in position; move it.
|
|||
rename(movie_filename, movie_prefix); |
|||
|
|||
// Move level-specific movie into place
|
|||
rename(loading_level_movie_filename, movie_filename); |
|||
} |
|||
else // level-specific movie doesn't exist; ensure that current movie is default
|
|||
{ |
|||
// check if default movie is in position
|
|||
file = fopen(movie_prefix, "rb"); |
|||
if (file != NULL) |
|||
{ |
|||
fclose(file); |
|||
|
|||
// A level-specific movie is currently in position; move it
|
|||
strcpy(leaving_level_movie_filename, movie_prefix); |
|||
strcpy(leaving_level_movie_filename + sizeof(movie_prefix) / sizeof(char) - 1, leaving_level); |
|||
strcpy(leaving_level_movie_filename + sizeof(movie_prefix) / sizeof(char) - 1 + leaving_level_length, movie_file_extension); |
|||
rename(movie_filename, leaving_level_movie_filename); |
|||
|
|||
// Move the default movie into position
|
|||
rename(movie_prefix, movie_filename); |
|||
} |
|||
// else // Default movie is already in position; nothing to do
|
|||
} |
|||
} |
@ -0,0 +1,121 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup Label="ProjectConfigurations"> |
|||
<ProjectConfiguration Include="Debug|Win32"> |
|||
<Configuration>Debug</Configuration> |
|||
<Platform>Win32</Platform> |
|||
</ProjectConfiguration> |
|||
<ProjectConfiguration Include="Release|Win32"> |
|||
<Configuration>Release</Configuration> |
|||
<Platform>Win32</Platform> |
|||
</ProjectConfiguration> |
|||
<ProjectConfiguration Include="Debug|x64"> |
|||
<Configuration>Debug</Configuration> |
|||
<Platform>x64</Platform> |
|||
</ProjectConfiguration> |
|||
<ProjectConfiguration Include="Release|x64"> |
|||
<Configuration>Release</Configuration> |
|||
<Platform>x64</Platform> |
|||
</ProjectConfiguration> |
|||
</ItemGroup> |
|||
<PropertyGroup Label="Globals"> |
|||
<ProjectGuid>{1DEF81B5-47F8-4028-90CC-0915FF7FBA8D}</ProjectGuid> |
|||
<RootNamespace>Rx_SetStartupMovie</RootNamespace> |
|||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> |
|||
</PropertyGroup> |
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
|||
<ConfigurationType>DynamicLibrary</ConfigurationType> |
|||
<UseDebugLibraries>true</UseDebugLibraries> |
|||
<PlatformToolset>v140</PlatformToolset> |
|||
<CharacterSet>MultiByte</CharacterSet> |
|||
<WholeProgramOptimization>true</WholeProgramOptimization> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
|||
<ConfigurationType>DynamicLibrary</ConfigurationType> |
|||
<UseDebugLibraries>false</UseDebugLibraries> |
|||
<PlatformToolset>v140</PlatformToolset> |
|||
<WholeProgramOptimization>true</WholeProgramOptimization> |
|||
<CharacterSet>MultiByte</CharacterSet> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |
|||
<ConfigurationType>Application</ConfigurationType> |
|||
<UseDebugLibraries>true</UseDebugLibraries> |
|||
<PlatformToolset>v140</PlatformToolset> |
|||
<CharacterSet>MultiByte</CharacterSet> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |
|||
<ConfigurationType>Application</ConfigurationType> |
|||
<UseDebugLibraries>false</UseDebugLibraries> |
|||
<PlatformToolset>v140</PlatformToolset> |
|||
<WholeProgramOptimization>true</WholeProgramOptimization> |
|||
<CharacterSet>MultiByte</CharacterSet> |
|||
</PropertyGroup> |
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
|||
<ImportGroup Label="ExtensionSettings"> |
|||
</ImportGroup> |
|||
<ImportGroup Label="Shared"> |
|||
</ImportGroup> |
|||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
|||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
|||
</ImportGroup> |
|||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
|||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
|||
</ImportGroup> |
|||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
|||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
|||
</ImportGroup> |
|||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
|||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
|||
</ImportGroup> |
|||
<PropertyGroup Label="UserMacros" /> |
|||
<PropertyGroup /> |
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
|||
<ClCompile> |
|||
<WarningLevel>Level3</WarningLevel> |
|||
<Optimization>Full</Optimization> |
|||
<SDLCheck>true</SDLCheck> |
|||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
|||
</ClCompile> |
|||
</ItemDefinitionGroup> |
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
|||
<ClCompile> |
|||
<WarningLevel>Level3</WarningLevel> |
|||
<Optimization>Disabled</Optimization> |
|||
<SDLCheck>true</SDLCheck> |
|||
</ClCompile> |
|||
</ItemDefinitionGroup> |
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
|||
<ClCompile> |
|||
<WarningLevel>Level3</WarningLevel> |
|||
<Optimization>MaxSpeed</Optimization> |
|||
<FunctionLevelLinking>true</FunctionLevelLinking> |
|||
<IntrinsicFunctions>true</IntrinsicFunctions> |
|||
<SDLCheck>true</SDLCheck> |
|||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
|||
</ClCompile> |
|||
<Link> |
|||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
|||
<OptimizeReferences>true</OptimizeReferences> |
|||
</Link> |
|||
</ItemDefinitionGroup> |
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
|||
<ClCompile> |
|||
<WarningLevel>Level3</WarningLevel> |
|||
<Optimization>MaxSpeed</Optimization> |
|||
<FunctionLevelLinking>true</FunctionLevelLinking> |
|||
<IntrinsicFunctions>true</IntrinsicFunctions> |
|||
<SDLCheck>true</SDLCheck> |
|||
</ClCompile> |
|||
<Link> |
|||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
|||
<OptimizeReferences>true</OptimizeReferences> |
|||
</Link> |
|||
</ItemDefinitionGroup> |
|||
<ItemGroup> |
|||
<ClCompile Include="Rx_SetStartupMovie.c" /> |
|||
</ItemGroup> |
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
|||
<ImportGroup Label="ExtensionTargets"> |
|||
</ImportGroup> |
|||
</Project> |
@ -0,0 +1,22 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<Filter Include="Source Files"> |
|||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> |
|||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> |
|||
</Filter> |
|||
<Filter Include="Header Files"> |
|||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> |
|||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> |
|||
</Filter> |
|||
<Filter Include="Resource Files"> |
|||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> |
|||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> |
|||
</Filter> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<ClCompile Include="Rx_SetStartupMovie.c"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
</ItemGroup> |
|||
</Project> |
Loading…
Reference in new issue