Added Windows subsystem entry point for release builds.

This commit is contained in:
Muzychenko Andrey 2021-10-09 12:33:33 +03:00
parent 69027eca53
commit d80074b9b6
5 changed files with 46 additions and 37 deletions

View File

@ -28,11 +28,10 @@
"configurationType": "Release",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"cmakeCommandArgs": "-DCMAKE_WIN32_EXECUTABLE:BOOL=1",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x86" ],
"variables": []
"inheritEnvironments": [ "msvc_x86" ]
},
{
"name": "x64-Release",
@ -40,11 +39,10 @@
"configurationType": "Release",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"cmakeCommandArgs": "-DCMAKE_WIN32_EXECUTABLE:BOOL=1",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": []
"inheritEnvironments": [ "msvc_x64_x64" ]
}
]
}

View File

@ -5,25 +5,37 @@
#include "winmain.h"
int MainActual(LPCSTR lpCmdLine)
{
// Todo: get rid of restart to change resolution.
int returnCode;
do
{
returnCode = winmain::WinMain(lpCmdLine);
}
while (winmain::RestartRequested());
return returnCode;
}
int main(int argc, char* argv[])
{
{
// Testing with UI
std::string cmdLine;
for (int i = 0; i < argc; i++)
cmdLine += argv[i];
std::string cmdLine;
for (int i = 1; i < argc; i++)
cmdLine += argv[i];
// Todo: get rid of restart to change resolution.
int returnCode;
do
{
returnCode = winmain::WinMain(cmdLine.c_str());
}
while (winmain::RestartRequested());
return returnCode;
}
return MainActual(cmdLine.c_str());
}
#if _WIN32
#include <windows.h>
// Windows subsystem main
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
return MainActual(lpCmdLine);
}
#endif
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

View File

@ -17,36 +17,36 @@ constexpr uint16_t SwapByteOrderShort(uint16_t val)
#pragma pack(1)
struct riff_block
{
DWORD TkStart;
DWORD CbBuffer;
uint32_t TkStart;
uint32_t CbBuffer;
char AData[4];
};
struct riff_data
{
DWORD Data;
DWORD DataSize;
DWORD BlocksPerChunk;
uint32_t Data;
uint32_t DataSize;
uint32_t BlocksPerChunk;
riff_block Blocks[1];
};
struct riff_header
{
DWORD Riff;
DWORD FileSize;
DWORD Mids;
DWORD Fmt;
DWORD FmtSize;
DWORD dwTimeFormat;
DWORD cbMaxBuffer;
DWORD dwFlags;
uint32_t Riff;
uint32_t FileSize;
uint32_t Mids;
uint32_t Fmt;
uint32_t FmtSize;
uint32_t dwTimeFormat;
uint32_t cbMaxBuffer;
uint32_t dwFlags;
riff_data Data;
};
struct midi_event
{
DWORD iTicks;
DWORD iEvent;
uint32_t iTicks;
uint32_t iEvent;
};
struct midi_header

View File

@ -41,7 +41,6 @@
//https://github.com/Tyyppi77/imgui_sdl 01deb04b102b6a1c15c7fdec1977a2c96a885e6f
#include "imgui_sdl.h"
typedef uint32_t DWORD;
typedef char* LPSTR;
typedef const char* LPCSTR;

View File

@ -152,7 +152,7 @@ int winmain::WinMain(LPCSTR lpCmdLine)
else
pb::replay_level(0);
DWORD dtHistoryCounter = 300u, updateCounter = 0, frameCounter = 0;
unsigned dtHistoryCounter = 300u, updateCounter = 0, frameCounter = 0;
auto frameStart = Clock::now();
double UpdateToFrameCounter = 0;