Qt: Switch to QtEntryPoint.lib instead of explicit main()

This commit is contained in:
Connor McLaughlin 2022-04-13 20:28:40 +10:00 committed by refractionpcsx2
parent 59d6113ee4
commit f86b3a32cd
3 changed files with 2 additions and 42 deletions

View File

@ -21,6 +21,7 @@
<QtDebugSuffix>d</QtDebugSuffix>
<QtLibSuffix Condition="$(Configuration.Contains(Debug))">$(QtDebugSuffix)</QtLibSuffix>
<QtPluginFolder>QtPlugins</QtPluginFolder>
<QtEntryPointLib>$(QtLibDir)Qt6EntryPoint$(QtLibSuffix).lib</QtEntryPointLib>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>

View File

@ -220,45 +220,3 @@ int main(int argc, char* argv[])
QtHost::Shutdown();
return result;
}
#ifdef _WIN32
// Apparently Qt6 got rid of this?
#include "common/RedtapeWindows.h"
#include <shellapi.h>
/*
WinMain() - Initializes Windows and calls user's startup function main().
NOTE: WinMain() won't be called if the application was linked as a "console"
application.
*/
// Convert a wchar_t to char string, equivalent to QString::toLocal8Bit()
// when passed CP_ACP.
static inline char* wideToMulti(unsigned int codePage, const wchar_t* aw)
{
const int required = WideCharToMultiByte(codePage, 0, aw, -1, nullptr, 0, nullptr, nullptr);
char* result = new char[required];
WideCharToMultiByte(codePage, 0, aw, -1, result, required, nullptr, nullptr);
return result;
}
extern "C" int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR /*cmdParamarg*/, int /* cmdShow */)
{
int argc = 0;
wchar_t** argvW = CommandLineToArgvW(GetCommandLineW(), &argc);
if (argvW == nullptr)
return -1;
char** argv = new char*[argc + 1];
for (int i = 0; i != argc; ++i)
argv[i] = wideToMulti(CP_ACP, argvW[i]);
argv[argc] = nullptr;
LocalFree(argvW);
const int exitCode = main(argc, argv);
for (int i = 0; (i != argc) && (argv[i] != nullptr); ++i)
delete[] argv[i];
delete[] argv;
return exitCode;
}
#endif

View File

@ -75,6 +75,7 @@
<LargeAddressAware>Yes</LargeAddressAware>
<AdditionalDependencies>comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;rpcrt4.lib;iphlpapi.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>dxguid.lib;dinput8.lib;hid.lib;PowrProf.lib;d3dcompiler.lib;d3d11.lib;dxgi.lib;strmiids.lib;opengl32.lib;comsuppw.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>$(QtEntryPointLib);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>