1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Add new windows project

This commit is contained in:
Ted John
2017-01-04 22:10:16 +00:00
parent 06d1d2116f
commit 67c0ed8a2f
3 changed files with 209 additions and 0 deletions

View File

@@ -16,6 +16,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2202A816-377
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{480B577D-4E4A-4757-9A42-28A9AD33E6B0}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openrct2-win", "src\openrct2-win\openrct2-win.vcxproj", "{7A9A57D5-7006-4208-A290-5491BA3C8808}"
ProjectSection(ProjectDependencies) = postProject
{D24D94F6-2A74-480C-B512-629C306CE92F} = {D24D94F6-2A74-480C-B512-629C306CE92F}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -65,6 +70,22 @@ Global
{62B020FA-E4FB-4C6E-B32A-DC999470F155}.ReleaseTests|Win32.Build.0 = ReleaseTests|Win32
{62B020FA-E4FB-4C6E-B32A-DC999470F155}.ReleaseTests|x64.ActiveCfg = ReleaseTests|x64
{62B020FA-E4FB-4C6E-B32A-DC999470F155}.ReleaseTests|x64.Build.0 = ReleaseTests|x64
{7A9A57D5-7006-4208-A290-5491BA3C8808}.Debug|Win32.ActiveCfg = Debug|Win32
{7A9A57D5-7006-4208-A290-5491BA3C8808}.Debug|Win32.Build.0 = Debug|Win32
{7A9A57D5-7006-4208-A290-5491BA3C8808}.Debug|x64.ActiveCfg = Debug|x64
{7A9A57D5-7006-4208-A290-5491BA3C8808}.Debug|x64.Build.0 = Debug|x64
{7A9A57D5-7006-4208-A290-5491BA3C8808}.DebugTests|Win32.ActiveCfg = DebugTests|Win32
{7A9A57D5-7006-4208-A290-5491BA3C8808}.DebugTests|Win32.Build.0 = DebugTests|Win32
{7A9A57D5-7006-4208-A290-5491BA3C8808}.DebugTests|x64.ActiveCfg = DebugTests|x64
{7A9A57D5-7006-4208-A290-5491BA3C8808}.DebugTests|x64.Build.0 = DebugTests|x64
{7A9A57D5-7006-4208-A290-5491BA3C8808}.Release|Win32.ActiveCfg = Release|Win32
{7A9A57D5-7006-4208-A290-5491BA3C8808}.Release|Win32.Build.0 = Release|Win32
{7A9A57D5-7006-4208-A290-5491BA3C8808}.Release|x64.ActiveCfg = Release|x64
{7A9A57D5-7006-4208-A290-5491BA3C8808}.Release|x64.Build.0 = Release|x64
{7A9A57D5-7006-4208-A290-5491BA3C8808}.ReleaseTests|Win32.ActiveCfg = ReleaseTests|Win32
{7A9A57D5-7006-4208-A290-5491BA3C8808}.ReleaseTests|Win32.Build.0 = ReleaseTests|Win32
{7A9A57D5-7006-4208-A290-5491BA3C8808}.ReleaseTests|x64.ActiveCfg = ReleaseTests|x64
{7A9A57D5-7006-4208-A290-5491BA3C8808}.ReleaseTests|x64.Build.0 = ReleaseTests|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -73,5 +94,6 @@ Global
{D24D94F6-2A74-480C-B512-629C306CE92F} = {2202A816-377D-4FA0-A7AF-7D4105F8A4FB}
{57E60BA1-FB76-4316-909E-C1449C142327} = {480B577D-4E4A-4757-9A42-28A9AD33E6B0}
{62B020FA-E4FB-4C6E-B32A-DC999470F155} = {480B577D-4E4A-4757-9A42-28A9AD33E6B0}
{7A9A57D5-7006-4208-A290-5491BA3C8808} = {2202A816-377D-4FA0-A7AF-7D4105F8A4FB}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,112 @@
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#define WIN32_LEAN_AND_MEAN
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <shellapi.h>
// Enable visual styles
#pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
static bool GetCommandLineArgs(int * outargc, char * * * outargv);
static void FreeCommandLineArgs(int argc, char * * argv);
static char * ConvertUTF16toUTF8(const wchar_t * src);
/**
* Windows entry point to OpenRCT2 with a console window using a traditional C main function.
*/
int main(int argc, char * * argv)
{
if (!GetCommandLineArgs(&argc, &argv))
{
puts("Unable to fetch command line arguments.");
return -1;
}
int exitCode = 0; // RunOpenRCT2
FreeCommandLineArgs(argc, argv);
return exitCode;
}
/**
* Windows entry point to OpenRCT2 without a console window.
*/
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
int argc;
char * * argv;
if (!GetCommandLineArgs(&argc, &argv))
{
puts("Unable to fetch command line arguments.");
return -1;
}
int exitCode = 0; // RunOpenRCT2
FreeCommandLineArgs(argc, argv);
return exitCode;
}
static bool GetCommandLineArgs(int * outargc, char * * * outargv)
{
// Get UTF-16 command line arguments
int argc;
LPWSTR cmdLine = GetCommandLineW();
LPWSTR * argvW = CommandLineToArgvW(cmdLine, &argc);
// Allocate UTF-8 strings
char * * argv = (char * *)malloc(argc * sizeof(char *));
if (argv == nullptr)
{
return false;
}
// Convert to UTF-8
for (int i = 0; i < argc; i++)
{
argv[i] = ConvertUTF16toUTF8(argvW[i]);
}
// Free UTF-16 strings
LocalFree(argvW);
*outargc = argc;
*outargv = argv;
return true;
}
static void FreeCommandLineArgs(int argc, char * * argv)
{
// Free argv
for (int i = 0; i < argc; i++)
{
free(argv[i]);
}
free(argv);
}
static char * ConvertUTF16toUTF8(const wchar_t * src)
{
int srcLen = lstrlenW(src);
int sizeReq = WideCharToMultiByte(CP_UTF8, 0, src, srcLen, nullptr, 0, nullptr, nullptr);
char * result = (char *)calloc(1, sizeReq + 1);
WideCharToMultiByte(CP_UTF8, 0, src, srcLen, result, sizeReq, nullptr, nullptr);
return result;
}

View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="'$(SolutionDir)'==''">..\..\</SolutionDir>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="DebugTests|Win32">
<Configuration>DebugTests</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="DebugTests|x64">
<Configuration>DebugTests</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="ReleaseTests|Win32">
<Configuration>ReleaseTests</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="ReleaseTests|x64">
<Configuration>ReleaseTests</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7A9A57D5-7006-4208-A290-5491BA3C8808}</ProjectGuid>
<RootNamespace>openrct2-win</RootNamespace>
<ProjectName>openrct2-win</ProjectName>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<Import Project="..\..\openrct2.common.props" />
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions Condition="'$(Configuration)'=='DebugTests' OR '$(Configuration)'=='ReleaseTests'">__NOENTRYPOINT__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup>
<ClCompile>
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
<AdditionalOptions>$(OPENRCT2_CL_ADDITIONALOPTIONS) %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem Condition="'$(Configuration)'!='Release'">Console</SubSystem>
<SubSystem Condition="'$(Configuration)'=='Release'">Windows</SubSystem>
</Link>
<Lib>
<TargetMachine Condition="'$(Platform)'=='Win32'">MachineX86</TargetMachine>
<TargetMachine Condition="'$(Platform)'=='x64'">MachineX64</TargetMachine>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ResourceCompile Include="..\..\resources\OpenRCT2.rc" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="openrct2-win.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>