Skip to content

Commit

Permalink
[CKPE]
Browse files Browse the repository at this point in the history
deprecated 1.5.3, 1.6.438
SF:
- Refuse load materials in qsplash, main window will be open, but not usable, for a while, this is the final #75
  • Loading branch information
Perchik71 committed Nov 23, 2024
1 parent b3e4cec commit cf83275
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 539 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ env:
BUILD_CONFIGURATION: Release
QT_BUILD_CONFIGURATION: Release-Qt
# Databases that are supported by CKPE last commit
SSE_DATABASES: "*1_5_3.database,*1_5_73.database,*1_6_438.database,*1_6_1130.database"
SSE_DATABASES: "*1_5_73.database,*1_6_1130.database,*1_6_1378_1.database"
FO4_DATABASES: "*1_10_162.database,*1_10_982_3.database"
SF_DATABASES: "*1_14_74_0.database"

Expand Down
67 changes: 38 additions & 29 deletions Creation Kit Platform Extended Core/Core/CoreCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ namespace CreationKitPlatformExtended
EDITOR_SKYRIM_SE_1_5_73,
EDITOR_SKYRIM_SE_1_6_438,
EDITOR_SKYRIM_SE_1_6_1130,
EDITOR_SKYRIM_SE_LAST = EDITOR_SKYRIM_SE_1_6_1130,
EDITOR_SKYRIM_SE_1_6_1378_1,
EDITOR_SKYRIM_SE_LAST = EDITOR_SKYRIM_SE_1_6_1378_1,
EDITOR_FALLOUT_C4_1_10_162_0,
EDITOR_FALLOUT_C4_1_10_943_1,
EDITOR_FALLOUT_C4_1_10_982_3,
Expand All @@ -37,40 +38,44 @@ namespace CreationKitPlatformExtended

// Список проверенных исполняемых файлов, допущенных к запуску
static std::unordered_map<uint32_t, EDITOR_EXECUTABLE_TYPE> allowedEditorVersion = {
{ 0xA9CD60C7ul, EDITOR_SKYRIM_SE_1_5_3 }, // Default
{ 0xED7DB054ul, EDITOR_SKYRIM_SE_1_5_3 }, // Redirect Steam
//{ 0xA9CD60C7ul, EDITOR_SKYRIM_SE_1_5_3 }, // Default
//{ 0xED7DB054ul, EDITOR_SKYRIM_SE_1_5_3 }, // Redirect Steam
{ 0x624E8C84ul, EDITOR_SKYRIM_SE_1_5_73 }, // Default
{ 0xF7E929A4ul, EDITOR_SKYRIM_SE_1_5_73 }, // Redirect Steam
{ 0x668F3CB3ul, EDITOR_SKYRIM_SE_1_5_73 }, // Unoffical patch 6.3
{ 0x748A3CC4ul, EDITOR_SKYRIM_SE_1_6_438 }, // No Steam
{ 0x3FDB3994ul, EDITOR_SKYRIM_SE_1_6_438 }, // With Steam
{ 0xFDCAEE10ul, EDITOR_SKYRIM_SE_1_6_438 }, // No Steam and Redirect Steam
//{ 0x748A3CC4ul, EDITOR_SKYRIM_SE_1_6_438 }, // No Steam
//{ 0x3FDB3994ul, EDITOR_SKYRIM_SE_1_6_438 }, // With Steam
//{ 0xFDCAEE10ul, EDITOR_SKYRIM_SE_1_6_438 }, // No Steam and Redirect Steam
{ 0x2EF668CEul, EDITOR_SKYRIM_SE_1_6_1130 }, // Redirect Steam
{ 0x0085AA4Cul, EDITOR_SKYRIM_SE_1_6_1130 }, // Default
{ 0x0085AA4Cul, EDITOR_SKYRIM_SE_1_6_1378_1 }, // Redirect Steam
{ 0xDF67F346ul, EDITOR_FALLOUT_C4_1_10_162_0 }, // Default
{ 0x4BA2E086ul, EDITOR_FALLOUT_C4_1_10_943_1 }, // Redirect Steam
{ 0xBAAF1B07ul, EDITOR_FALLOUT_C4_1_10_943_1 }, // No Steam and Redirect Steam
//{ 0x4BA2E086ul, EDITOR_FALLOUT_C4_1_10_943_1 }, // Redirect Steam
//{ 0xBAAF1B07ul, EDITOR_FALLOUT_C4_1_10_943_1 }, // No Steam and Redirect Steam
{ 0x481CCE95ul, EDITOR_FALLOUT_C4_1_10_982_3 }, // Redirect Steam
{ 0x55F7F580ul, EDITOR_FALLOUT_C4_1_10_982_3 }, // No Steam and Redirect Steam
{ 0x6CDE4424ul, EDITOR_STARFIELD_1_13_61_0 }, // Redirect Steam
{ 0x8777A522ul, EDITOR_STARFIELD_1_14_70_0 }, // Redirect Steam
//{ 0x6CDE4424ul, EDITOR_STARFIELD_1_13_61_0 }, // Redirect Steam
//{ 0x8777A522ul, EDITOR_STARFIELD_1_14_70_0 }, // Redirect Steam
{ 0x01BF6FB3ul, EDITOR_STARFIELD_1_14_74_0 }, // Redirect Steam
};

// Список устаревших версий редакторов
static std::vector<EDITOR_EXECUTABLE_TYPE> outdatedEditorVersion = {
EDITOR_SKYRIM_SE_1_5_3,
EDITOR_SKYRIM_SE_1_6_438,
EDITOR_FALLOUT_C4_1_10_943_1,
EDITOR_STARFIELD_1_13_61_0,
EDITOR_STARFIELD_1_14_70_0,
};

// Список ключевых смещений в исполняемых файлах, допущенных к запуску
// Список ключевых смещений в исполняемых файлах, допущенных к запуску (но не точно)
static std::unordered_map<uint32_t,
std::pair<std::string_view, EDITOR_EXECUTABLE_TYPE>> allowedEditorVersion2 = {
{ 0x3078988ul, { "1.5.3.0", EDITOR_SKYRIM_SE_1_5_3 } },
{ 0x3062CC8ul, { "1.5.73.0", EDITOR_SKYRIM_SE_1_5_73 } },
{ 0x2E835D8ul, { "1.6.438.0", EDITOR_SKYRIM_SE_1_6_438 } },
{ 0x2F3E698ul, { "1.6.1130.0", EDITOR_SKYRIM_SE_1_6_1130 } },
{ 0x2F7F018ul, { "1.6.1378.1", EDITOR_SKYRIM_SE_1_6_1378_1 } },
{ 0x3896168ul, { "1.10.162.0", EDITOR_FALLOUT_C4_1_10_162_0 } },
{ 0x2F8D1C8ul, { "1.10.943.1", EDITOR_FALLOUT_C4_1_10_943_1 } },
{ 0x2F8D298ul, { "1.10.982.3", EDITOR_FALLOUT_C4_1_10_982_3 } },
Expand All @@ -82,29 +87,31 @@ namespace CreationKitPlatformExtended
// Список названий редакторов
static std::vector<std::string_view> allowedEditorVersionStr = {
"Unknown version",
"Skyrim Special Edition [v1.5.3]",
//"Skyrim Special Edition [v1.5.3]",
"Skyrim Special Edition [v1.5.73]",
"Skyrim Special Edition [v1.6.438]",
//"Skyrim Special Edition [v1.6.438]",
"Skyrim Special Edition [v1.6.1130]",
"Skyrim Special Edition [v1.6.1378.1]",
"Fallout 4 [v1.10.162.0]",
"Fallout 4 [v1.10.943.1]",
//"Fallout 4 [v1.10.943.1]",
"Fallout 4 [v1.10.982.3]",
"Starfield [v1.13.61.0]",
"Starfield [v1.14.70.0]",
//"Starfield [v1.13.61.0]",
//"Starfield [v1.14.70.0]",
"Starfield [v1.14.74.0]",
};

// Список имён файлов базы данных
static std::unordered_map<EDITOR_EXECUTABLE_TYPE, std::string_view> allowedDatabaseVersion = {
{ EDITOR_SKYRIM_SE_1_5_3, "CreationKitPlatformExtended_SSE_1_5_3.database" },
//{ EDITOR_SKYRIM_SE_1_5_3, "CreationKitPlatformExtended_SSE_1_5_3.database" },
{ EDITOR_SKYRIM_SE_1_5_73, "CreationKitPlatformExtended_SSE_1_5_73.database" },
{ EDITOR_SKYRIM_SE_1_6_438, "CreationKitPlatformExtended_SSE_1_6_438.database" },
//{ EDITOR_SKYRIM_SE_1_6_438, "CreationKitPlatformExtended_SSE_1_6_438.database" },
{ EDITOR_SKYRIM_SE_1_6_1130, "CreationKitPlatformExtended_SSE_1_6_1130.database" },
{ EDITOR_SKYRIM_SE_1_6_1378_1, "CreationKitPlatformExtended_SSE_1_6_1378_1.database" },
{ EDITOR_FALLOUT_C4_1_10_162_0, "CreationKitPlatformExtended_FO4_1_10_162.database" },
{ EDITOR_FALLOUT_C4_1_10_943_1, "CreationKitPlatformExtended_FO4_1_10_943_1.database" },
//{ EDITOR_FALLOUT_C4_1_10_943_1, "CreationKitPlatformExtended_FO4_1_10_943_1.database" },
{ EDITOR_FALLOUT_C4_1_10_982_3, "CreationKitPlatformExtended_FO4_1_10_982_3.database" },
{ EDITOR_STARFIELD_1_13_61_0, "CreationKitPlatformExtended_SF_1_13_61_0.database" },
{ EDITOR_STARFIELD_1_14_70_0, "CreationKitPlatformExtended_SF_1_14_70_0.database" },
//{ EDITOR_STARFIELD_1_13_61_0, "CreationKitPlatformExtended_SF_1_13_61_0.database" },
//{ EDITOR_STARFIELD_1_14_70_0, "CreationKitPlatformExtended_SF_1_14_70_0.database" },
{ EDITOR_STARFIELD_1_14_74_0, "CreationKitPlatformExtended_SF_1_14_74_0.database" },
};

Expand All @@ -123,33 +130,35 @@ namespace CreationKitPlatformExtended

static std::vector<std::string_view> allowedEditorFileNameStr = {
"creationkit",
"creationkit_se_1_5_3",
//"creationkit_se_1_5_3",
"creationkit_se_1_5_73",
"creationkit_se_1_6_438",
//"creationkit_se_1_6_438",
"creationkit_se_1_6_1130",
"creationkit_se_1_6_1378_1",
"creationkit_f4_1_10_162",
//"creationkit_f4_1_10_943_1",
"creationkit_f4_1_10_982_3",
//"creationkit_sf_1_13_61_0",
"creationkit_sf_1_14_70_0",
//"creationkit_sf_1_14_70_0",
"creationkit_sf_1_14_74_0",
};

inline EDITOR_EXECUTABLE_SHORT_TYPE GetShortExecutableTypeFromFull(EDITOR_EXECUTABLE_TYPE editorVersion)
{
switch (editorVersion)
{
case EDITOR_SKYRIM_SE_1_5_3:
//case EDITOR_SKYRIM_SE_1_5_3:
case EDITOR_SKYRIM_SE_1_5_73:
case EDITOR_SKYRIM_SE_1_6_438:
//case EDITOR_SKYRIM_SE_1_6_438:
case EDITOR_SKYRIM_SE_1_6_1130:
case EDITOR_SKYRIM_SE_1_6_1378_1:
return EDITOR_SHORT_SKYRIM_SE;
case EDITOR_FALLOUT_C4_1_10_162_0:
case EDITOR_FALLOUT_C4_1_10_943_1:
//case EDITOR_FALLOUT_C4_1_10_943_1:
case EDITOR_FALLOUT_C4_1_10_982_3:
return EDITOR_SHORT_FALLOUT_C4;
case EDITOR_STARFIELD_1_13_61_0:
case EDITOR_STARFIELD_1_14_70_0:
//case EDITOR_STARFIELD_1_13_61_0:
//case EDITOR_STARFIELD_1_14_70_0:
case EDITOR_STARFIELD_1_14_74_0:
return EDITOR_SHORT_STARFIELD;
default:
Expand Down
15 changes: 12 additions & 3 deletions Creation Kit Platform Extended Core/Core/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,7 @@ namespace CreationKitPlatformExtended
// Получение начального адреса памяти главного процесса
uintptr_t moduleBase = (uintptr_t)GetModuleHandle(NULL);

bool Outdated = false;
// Пытаемся определить файл
EDITOR_EXECUTABLE_TYPE editorVersion = EDITOR_UNKNOWN;
auto editorVersionIterator = allowedEditorVersion.find(hash_crc32);
Expand All @@ -660,17 +661,25 @@ namespace CreationKitPlatformExtended
editorVersion = EDITOR_UNKNOWN;
#endif // !_CKPE_WITH_QT5

if (editorVersion != EDITOR_UNKNOWN)
// Проверка неустаревшая ли версия
Outdated = CheckOutdatedEditor(editorVersion);

if ((editorVersion != EDITOR_UNKNOWN) && !Outdated)
{
_MESSAGE("Current CK version: %s", allowedEditorVersionStr[(int)editorVersion].data());

new Engine(hModule, editorVersion, moduleBase);
}
else
{
_ERROR("The CK version has not been determined");
if (Outdated)
Result = RC_DEPRECATED_VERSION_CREATIONKIT;
else
{
_ERROR("The CK version has not been determined");

Result = RC_UNSUPPORTED_VERSION_CREATIONKIT;
Result = RC_UNSUPPORTED_VERSION_CREATIONKIT;
}
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ namespace CreationKitPlatformExtended
lpRelocator->DetourCall(_RELDATA_RAV(0), (uintptr_t)&hk_finish);
lpRelocator->PatchNop(_RELDATA_RAV(0) + 5, 0xA);

*(uintptr_t*)&pointer_LoadMaterialsQSplashPatch_sub0 =
voltek::detours_function_class_jump(_RELDATA_ADDR(1), (uintptr_t)&sub);
//*(uintptr_t*)&pointer_LoadMaterialsQSplashPatch_sub0 =
// voltek::detours_function_class_jump(_RELDATA_ADDR(1), (uintptr_t)&sub);

return true;
}
Expand All @@ -86,14 +86,14 @@ namespace CreationKitPlatformExtended
#ifdef _CKPE_WITH_QT5
void LoadMaterialsQSplashPatch::hk_finish(QSplashScreen* logoWin, QWidget* mainWin)
{
logoWin->showMessage(MESSAGE, 1, Qt::red);
//logoWin->showMessage(MESSAGE, 1, Qt::red);
// Instead of QtCore::ProcessMessage, since CKPE Qt is not initialized
Utils::ProcessMessage();
//Utils::ProcessMessage();
// Wait loading materials
g_LoadMaterialsQSplashPatch_wait = CreateEvent(NULL, TRUE, FALSE, NULL);
ResetEvent(g_LoadMaterialsQSplashPatch_wait);
WaitForSingleObject(g_LoadMaterialsQSplashPatch_wait, INFINITE);
CloseHandle(g_LoadMaterialsQSplashPatch_wait);
//g_LoadMaterialsQSplashPatch_wait = CreateEvent(NULL, TRUE, FALSE, NULL);
//ResetEvent(g_LoadMaterialsQSplashPatch_wait);
//WaitForSingleObject(g_LoadMaterialsQSplashPatch_wait, INFINITE);
//CloseHandle(g_LoadMaterialsQSplashPatch_wait);
// Show main window
mainWin->show();
logoWin->finish(mainWin);
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.
74 changes: 0 additions & 74 deletions Offsets Transfer/offset_transfer.lpi

This file was deleted.

Loading

0 comments on commit cf83275

Please sign in to comment.