Skip to content

Commit

Permalink
[CKPE]
Browse files Browse the repository at this point in the history
  • Loading branch information
Perchik71 committed Feb 6, 2025
1 parent 65b54b9 commit b3fbe58
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 22 deletions.
30 changes: 9 additions & 21 deletions Creation Kit Platform Extended Core/Patches/SSE/LoadDDSFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,6 @@ namespace CreationKitPlatformExtended
return false;
}

void LoadDDSFilePatch::FailedMessage(HRESULT error, __int64 a2)
{
auto Resource = ((EditorAPI::SkyrimSpectialEdition::BSResourceNiBinaryStream*)a2);

__try
{
_CONSOLE("Error while trying to load texture \"%s\" due to an incompatible file format or something else."
" (0x%08X) \"%s\".", Resource->GetStream()->GetFileName().data, error, _com_error(error).ErrorMessage());
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
_CONSOLE("Error while trying to load texture, but from the bad .nif, unknown filename or your mod is broken.");
}
}

HRESULT LoadDDSFilePatch::sub(__int64 a1, __int64 a2, __int64 a3, __int64 a4, unsigned int a5, int a6)
{
// Modified DirectX::LoadFromDDSFile from DDSTextureLoader (DirectXTex)
Expand All @@ -105,17 +90,20 @@ namespace CreationKitPlatformExtended
if (FAILED(hr))
{
auto Resource = ((EditorAPI::SkyrimSpectialEdition::BSResourceNiBinaryStream*)a2);
if (!Resource->GetStream()->GetFileName().data[0])
// Skips
return E_FAIL;

FailedMessage(hr, a2);
if (!Resource || !Resource->GetStream()->GetFileName().data)
AssertMsg(false, "Fatal error while trying to load unknown texture.");

AssertMsgVa(false,
"Fatal error while trying to load texture \"%s\" due to an incompatible file format. This "
"indicates a problem with your mod or game files. Note that B5G6R5 and B5G5R5A1 texture "
"formats are not supported on Windows 7. HR = (0x%08X) %s.",
Resource->GetStream()->GetFileName().data, hr, _com_error(hr).ErrorMessage());
}

//_CONSOLE("DirectX::LoadFromDDSFile opened file \"%s\".", Resource->GetStream()->GetFileName().data);

// This return value is ignored. If it fails it returns a null pointer (a3) and crashes later on.
return S_OK;
return hr;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ namespace CreationKitPlatformExtended
virtual bool HasDependencies() const;
virtual Array<String> GetDependencies() const;

static void FailedMessage(HRESULT error, __int64 a2);
static HRESULT sub(__int64 a1, __int64 a2, __int64 a3, __int64 a4, unsigned int a5, int a6);
protected:
virtual bool QueryFromPlatform(EDITOR_EXECUTABLE_TYPE eEditorCurrentVersion,
Expand Down
Binary file modified Creation Kit Platform Extended Core/Version/build_version.txt
Binary file not shown.
Binary file modified Creation Kit Platform Extended Core/Version/resource_version2.h
Binary file not shown.

0 comments on commit b3fbe58

Please sign in to comment.