Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Common/IHLoader
Submodule IHLoader updated 2 files
+4 −0 IH.Initial.cpp
+10 −0 IH.Initial.h
47 changes: 43 additions & 4 deletions IHCore/ExtCD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <Helpers/Macro.h>
#include "CachedFile.h"
#include "ExtAudio.h"
#include "MixOverlay.h"

extern bool EnableCustomFile;

Expand Down Expand Up @@ -244,6 +245,8 @@ std::string GetBindingIHFile(const char* pFileName)
auto it = Local::IHFileBinder.find(pFileName);
if (it != Local::IHFileBinder.end())
return it->second;
if (MixOverlayManager::Instance().IsInternalName(pFileName))
return pVirtualMixFileClassName;
for (auto& p : Local::IHFileFilter)
if (p.second && ((bool(__cdecl*)(const char*))p.second)(pFileName))
return p.first;
Expand Down Expand Up @@ -347,6 +350,10 @@ const char* FileClassExt::CDFileClass_SetFileName(char* pOriginalFileName)
{ Debug::Log("IHCore : Adding Path \"%hs\"\n", Param.Path); CDExt_Instance.PushCustomPathToTail(Param.Path); });
Service_CustomPathListFirst.RefreshAndProcess([](const auto& Param)
{ Debug::Log("IHCore : Adding Path \"%hs\"\n", Param.Path); CDExt_Instance.PushCustomPathToFirst(Param.Path); });
MixOverlay_InitBeforeEverything();
Service_AddMixDirectory.RefreshAndProcess([](const auto& Param)
{ Debug::Log("IHCore : Adding MixDirectory \"%hs\" -> \"%hs\" (%s)\n", Param.Directory, Param.Mix, Param.First ? "First" : "Last");
MixOverlayManager::Instance().Add(Param.Directory, Param.Mix, Param.First); });
Service_RegisterIHFileTag.RefreshAndProcess([](const auto& Param)
{
auto Value = Internal_GetGlobalVarPtr(Param.TagType, Param.TagVar);
Expand Down Expand Up @@ -493,8 +500,26 @@ BOOL FileClassExt::CCFileClass_Open(FileAccessMode Mode)
This->Close();
if ( (Mode & FileAccessMode::Write) || This->BufferIOFileClass::Exists(false))
return This->CDFileClass::Open(Mode);

const uint8_t* overlayData = nullptr;
int overlaySize = 0;
if (MixOverlayManager::Instance().TryGetOverlayFile(Name.c_str(), true, overlayData, overlaySize))
{
new (&This->Buffer) MemoryBuffer((void*)overlayData, overlaySize);
This->Position = 0;
return TRUE;
}

if (!MixFileClass::Offset(Name.c_str(), &pBuffer, &mixfile, &Offset, &Size))
{
if (MixOverlayManager::Instance().TryGetOverlayFile(Name.c_str(), false, overlayData, overlaySize))
{
new (&This->Buffer) MemoryBuffer((void*)overlayData, overlaySize);
This->Position = 0;
return TRUE;
}
return This->CDFileClass::Open(Mode);
}
if (pBuffer || !mixfile)
{
if (This != (CCFileClass*)((DWORD)-88))
Expand Down Expand Up @@ -613,21 +638,35 @@ bool FileClassExt::CCFileClass_Exists(bool WriteShared)
else
{
auto Name = This->GetFileName();

const uint8_t* overlayData = nullptr;
int overlaySize = 0;
if (MixOverlayManager::Instance().TryGetOverlayFile(Name, true, overlayData, overlaySize))
{
This->Availablility = 1;
return true;
}

if (MixFileClass::Offset(Name, 0, 0, 0, 0))
{
This->Availablility = 1;
return true;
}
else if (This->BufferIOFileClass::Exists(false))

if (MixOverlayManager::Instance().TryGetOverlayFile(Name, false, overlayData, overlaySize))
{
This->Availablility = 1;
return true;
}
else

if (This->BufferIOFileClass::Exists(false))
{
This->Availablility = 2;
return false;
This->Availablility = 1;
return true;
}

This->Availablility = 2;
return false;
}
}

Expand Down
2 changes: 2 additions & 0 deletions IHCore/IHCore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
<ClInclude Include="ExtAudio.h" />
<ClInclude Include="ExtBink.h" />
<ClInclude Include="ExtCD.h" />
<ClInclude Include="MixOverlay.h" />
<ClInclude Include="stb_vorbis_wrapper.h" />
<ClInclude Include="ExtCsf.h" />
<ClInclude Include="ExtFile.h" />
Expand Down Expand Up @@ -579,6 +580,7 @@
<ClCompile Include="ExtLog.cpp" />
<ClCompile Include="ExtMessageList.cpp" />
<ClCompile Include="ExtMix.cpp" />
<ClCompile Include="MixOverlay.cpp" />
<ClCompile Include="ExtScenario.cpp" />
<ClCompile Include="Global.cpp" />
<ClCompile Include="ExtHotKey.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions IHCore/IHCore.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,9 @@
<ClInclude Include="ExtCD.h">
<Filter>File System</Filter>
</ClInclude>
<ClInclude Include="MixOverlay.h">
<Filter>File System</Filter>
</ClInclude>
<ClInclude Include="InfoStack.h">
<Filter>External</Filter>
</ClInclude>
Expand Down Expand Up @@ -1354,6 +1357,9 @@
<ClCompile Include="ExtMix.cpp">
<Filter>File System</Filter>
</ClCompile>
<ClCompile Include="MixOverlay.cpp">
<Filter>File System</Filter>
</ClCompile>
<ClCompile Include="ExtHotKey.cpp">
<Filter>Hot Key</Filter>
</ClCompile>
Expand Down
3 changes: 3 additions & 0 deletions IHCore/InitialLoad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ InitialLoad::Service<InitialLoadParam_CustomFile>
Service_StringTable("IHFile::AddStringTable"),//不分大小写
Service_MixFile("IHFile::AddMixFile");//不分大小写

InitialLoad::Service<InitialLoadParam_AddMixDirectory>
Service_AddMixDirectory("IHFile::AddMixDirectory");//不分大小写

InitialLoad::Service<InitialLoadParam_StringTablePair>
Service_StringTableAddPair("StringTable::AddPair");//Key不分大小写

Expand Down
3 changes: 3 additions & 0 deletions IHCore/InitialLoad.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ extern InitialLoad::Service<InitialLoadParam_CustomFile>
Service_StringTable,
Service_MixFile;

extern InitialLoad::Service<InitialLoadParam_AddMixDirectory>
Service_AddMixDirectory;

extern InitialLoad::Service<InitialLoadParam_StringTablePair>
Service_StringTableAddPair;

Expand Down
Loading