forked from Perchik71/Creation-Kit-Platform-Extended
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added show dialog tool Perchik71#93
- Loading branch information
Showing
22 changed files
with
563 additions
and
5 deletions.
There are no files selected for viewing
167 changes: 167 additions & 0 deletions
167
Creation Kit Platform Extended Tools/jdiashow/jdiashow.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
// jdiashow.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы. | ||
// | ||
|
||
#include "../../Dependencies/jDialogs/include/jdialogs.h" | ||
|
||
namespace jDialogs = perchik71::jDialogs; | ||
|
||
#include <iostream> | ||
#include <filesystem> | ||
#include <memory> | ||
|
||
static bool get_file_version(const char* a_filename, char* a_buffer, size_t a_buffersize) | ||
{ | ||
uint32_t dwSize = 0; | ||
VS_FIXEDFILEINFO* pFileInfo = nullptr; | ||
uint32_t puLenFileInfo = 0; | ||
|
||
dwSize = GetFileVersionInfoSizeA(a_filename, nullptr); | ||
if (dwSize == 0) | ||
return false; | ||
|
||
auto pbVersionInfo = std::make_unique<uint8_t[]>(dwSize); | ||
if (!pbVersionInfo) | ||
return false; | ||
|
||
if (!GetFileVersionInfoA(a_filename, 0, dwSize, pbVersionInfo.get())) | ||
return false; | ||
|
||
if (!VerQueryValueA(pbVersionInfo.get(), "\\", (LPVOID*)&pFileInfo, &puLenFileInfo)) | ||
return false; | ||
|
||
sprintf_s(a_buffer, a_buffersize, "n%u.%u-%u", (pFileInfo->dwFileVersionMS >> 16) & 0xFFFF, | ||
(pFileInfo->dwFileVersionMS) & 0xFFFF, pFileInfo->dwFileVersionLS); | ||
|
||
return true; | ||
} | ||
|
||
static void hello() | ||
{ | ||
char modulePath[MAX_PATH]; | ||
GetModuleFileNameA((HMODULE)GetModuleHandleA(nullptr), modulePath, MAX_PATH); | ||
|
||
char szBuffer[100]; | ||
if (get_file_version(modulePath, szBuffer, _ARRAYSIZE(szBuffer))) | ||
{ | ||
std::cout << "jdiashow version " << szBuffer << " copyright (c) 2024 the CKPE developers.\n"; | ||
std::cout << "Show dialog from .json files.\n\n\n"; | ||
} | ||
} | ||
|
||
static void example() | ||
{ | ||
std::cout << "usage: jdiashow [infile]...\n"; | ||
} | ||
|
||
static LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) | ||
{ | ||
switch (Msg) | ||
{ | ||
case WM_CREATE: | ||
break; | ||
case WM_DESTROY: | ||
PostQuitMessage(WM_QUIT); | ||
break; | ||
default: | ||
return DefWindowProc(hWnd, Msg, wParam, lParam); | ||
} | ||
return 0; | ||
} | ||
|
||
static INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) | ||
{ | ||
switch (uMsg) | ||
{ | ||
case WM_INITDIALOG: | ||
break; | ||
case WM_CLOSE: | ||
case WM_DESTROY: | ||
EndDialog(hWnd, 0); | ||
break; | ||
case WM_COMMAND: | ||
switch (LOWORD(wParam)) | ||
{ | ||
case IDOK: | ||
case IDCANCEL: | ||
EndDialog(hWnd, 0); | ||
break; | ||
} | ||
break; | ||
default: | ||
return FALSE; | ||
} | ||
|
||
return TRUE; | ||
} | ||
|
||
static void run_unsafe(int a_argc, char* a_argv[]) | ||
{ | ||
WNDCLASSA wc = { 0 }; | ||
wc.hInstance = GetModuleHandleA(0); | ||
wc.lpszClassName = "jWndTEST"; | ||
wc.style = CS_VREDRAW | CS_HREDRAW; | ||
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); | ||
wc.hCursor = LoadCursorA(NULL, IDC_ARROW); | ||
wc.hIcon = LoadIconA(NULL, IDI_APPLICATION); | ||
wc.lpfnWndProc = WndProc; | ||
if (!RegisterClassA(&wc)) | ||
return; | ||
|
||
auto wnd = CreateWindowA(wc.lpszClassName, "", WS_POPUP, | ||
0, 0, 10, 10, NULL, NULL, wc.hInstance, NULL); | ||
if (!wnd) | ||
return; | ||
|
||
for (int i = 1; i < a_argc; ++i) | ||
{ | ||
if (!std::filesystem::exists(a_argv[i])) | ||
{ | ||
std::cout << "File \"" << a_argv[i] <<"\" no found!\n"; | ||
continue; | ||
} | ||
|
||
auto dialog = new jDialogs::jDialogA(); | ||
if (!dialog) | ||
{ | ||
std::cout << "File \"" << a_argv[i] << "\" init failed!\n"; | ||
continue; | ||
} | ||
|
||
if (dialog->LoadFromFile(a_argv[i]) && !dialog->GenerateBinary()) | ||
{ | ||
delete dialog; | ||
std::cout << "File \"" << a_argv[i] << "\" no dialog!\n"; | ||
continue; | ||
} | ||
|
||
dialog->ShowModal(wnd, DlgProc, NULL); | ||
delete dialog; | ||
} | ||
|
||
DestroyWindow(wnd); | ||
} | ||
|
||
int main(int a_argc, char* a_argv[]) | ||
{ | ||
if (a_argc == 1) | ||
{ | ||
hello(); | ||
example(); | ||
|
||
return 0; | ||
} | ||
|
||
hello(); | ||
|
||
__try | ||
{ | ||
run_unsafe(a_argc, a_argv); | ||
|
||
return 0; | ||
} | ||
__except (1) | ||
{ | ||
std::cout << "FATAL ERROR!!!\n"; | ||
return -1; | ||
} | ||
} |
117 changes: 117 additions & 0 deletions
117
Creation Kit Platform Extended Tools/jdiashow/jdiashow.vcxproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<ProjectConfiguration Include="Release|Win32"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|x64"> | ||
<Configuration>Release</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<PropertyGroup Label="Globals"> | ||
<VCProjectVersion>17.0</VCProjectVersion> | ||
<Keyword>Win32Proj</Keyword> | ||
<ProjectGuid>{2ac659ea-3097-49d0-9b96-fceff4928559}</ProjectGuid> | ||
<RootNamespace>jdiashow</RootNamespace> | ||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>v143</PlatformToolset> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>v143</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)'=='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)'=='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 Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<IntDir>$(SolutionDir)$(Platform)\$(ProjectName)\$(Configuration)\</IntDir> | ||
<OutDir>$(SolutionDir)$(Platform)\</OutDir> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<SDLCheck>true</SDLCheck> | ||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<ConformanceMode>true</ConformanceMode> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Console</SubSystem> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<SDLCheck>true</SDLCheck> | ||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<ConformanceMode>true</ConformanceMode> | ||
<LanguageStandard>stdcpplatest</LanguageStandard> | ||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> | ||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> | ||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||
<FloatingPointModel>Fast</FloatingPointModel> | ||
<CallingConvention>StdCall</CallingConvention> | ||
<DisableSpecificWarnings>4996;4244</DisableSpecificWarnings> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Console</SubSystem> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
<GenerateDebugInformation>false</GenerateDebugInformation> | ||
<AdditionalDependencies>version.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
</Link> | ||
<PreBuildEvent> | ||
<Command>powershell -ExecutionPolicy Bypass -File "$(SolutionDir)Creation Kit Platform Extended Tools\$(ProjectName)\Version\scripts.ps1"</Command> | ||
</PreBuildEvent> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ClCompile Include="..\..\Dependencies\jDialogs\include\jdialogs.cpp" /> | ||
<ClCompile Include="jdiashow.cpp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="..\..\Dependencies\jDialogs\include\jdialogs.h" /> | ||
<ClInclude Include="version\resource_version.h" /> | ||
<ClInclude Include="version\resource_version2.h" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ResourceCompile Include="version\resource_version.rc" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="version\resource_version.aps" /> | ||
<None Include="version\resource_version2.tmp" /> | ||
<None Include="version\scripts.ps1" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Text Include="version\build_version.txt" /> | ||
</ItemGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets"> | ||
</ImportGroup> | ||
</Project> |
49 changes: 49 additions & 0 deletions
49
Creation Kit Platform Extended Tools/jdiashow/jdiashow.vcxproj.filters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<ClCompile Include="jdiashow.cpp" /> | ||
<ClCompile Include="..\..\Dependencies\jDialogs\include\jdialogs.cpp"> | ||
<Filter>jDialogs</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Filter Include="jDialogs"> | ||
<UniqueIdentifier>{92765b5b-348b-4226-854e-25e269d6bec1}</UniqueIdentifier> | ||
</Filter> | ||
<Filter Include="res"> | ||
<UniqueIdentifier>{c7402277-2103-4534-9b2d-6f0a75a304d7}</UniqueIdentifier> | ||
</Filter> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="version\resource_version2.h"> | ||
<Filter>res</Filter> | ||
</ClInclude> | ||
<ClInclude Include="version\resource_version.h"> | ||
<Filter>res</Filter> | ||
</ClInclude> | ||
<ClInclude Include="..\..\Dependencies\jDialogs\include\jdialogs.h"> | ||
<Filter>jDialogs</Filter> | ||
</ClInclude> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ResourceCompile Include="version\resource_version.rc"> | ||
<Filter>res</Filter> | ||
</ResourceCompile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="version\resource_version2.tmp"> | ||
<Filter>res</Filter> | ||
</None> | ||
<None Include="version\scripts.ps1"> | ||
<Filter>res</Filter> | ||
</None> | ||
<None Include="version\resource_version.aps"> | ||
<Filter>res</Filter> | ||
</None> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Text Include="version\build_version.txt"> | ||
<Filter>res</Filter> | ||
</Text> | ||
</ItemGroup> | ||
</Project> |
Binary file added
BIN
+10 Bytes
Creation Kit Platform Extended Tools/jdiashow/version/build_version.txt
Binary file not shown.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file renamed
BIN
+1.96 KB
rc2json/version/resource_version2.h → ...ools/jdiashow/version/resource_version2.h
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Binary file added
BIN
+12 Bytes
Creation Kit Platform Extended Tools/rc2json/version/build_version.txt
Binary file not shown.
Binary file added
BIN
+2.77 KB
Creation Kit Platform Extended Tools/rc2json/version/resource_version.aps
Binary file not shown.
18 changes: 18 additions & 0 deletions
18
Creation Kit Platform Extended Tools/rc2json/version/resource_version.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//{{NO_DEPENDENCIES}} | ||
// Microsoft Visual C++ generated include file. | ||
// Used by resource.rc | ||
|
||
// Copyright © 2023-2024 aka perchik71. All rights reserved. | ||
// Contacts: <email:[email protected]> | ||
// License: https://www.gnu.org/licenses/gpl-3.0.html | ||
|
||
// Следующие стандартные значения для новых объектов | ||
// | ||
#ifdef APSTUDIO_INVOKED | ||
#ifndef APSTUDIO_READONLY_SYMBOLS | ||
#define _APS_NEXT_RESOURCE_VALUE 1101 | ||
#define _APS_NEXT_COMMAND_VALUE 50001 | ||
#define _APS_NEXT_CONTROL_VALUE 11001 | ||
#define _APS_NEXT_SYMED_VALUE 1101 | ||
#endif | ||
#endif |
Oops, something went wrong.