(svn r17336) -Codechange: move some os specific files into src/os/

This commit is contained in:
rubidium
2009-08-31 22:38:37 +00:00
parent 54f67b8137
commit 19b83eb5aa
25 changed files with 64 additions and 64 deletions

266
src/os/windows/masm64.rules Normal file
View File

@@ -0,0 +1,266 @@
<?xml version="1.0" encoding="utf-8"?>
<VisualStudioToolFile
Name="Microsoft Macro Assembler 64"
Version="8.00"
>
<Rules>
<CustomBuildRule
Name="MASM AMD64"
DisplayName="Microsoft Macro Assembler for AMD64"
CommandLine="ml64.exe /c [AllOptions] [AdditionalOptions] /Ta[inputs]"
Outputs="[$ObjectFileName]"
FileExtensions="*.asm"
ExecutionDescription="Assembling..."
>
<Properties>
<BooleanProperty
Name="NoLogo"
DisplayName="Suppress Startup Banner"
Description="Suppress the display of the startup banner and information messages. (/nologo)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/nologo"
DefaultValue="true"
/>
<StringProperty
Name="ObjectFileName"
DisplayName="Object File Name"
PropertyPageName="Object File"
Description="Specifies the name of the output object file. (/Fo:[file])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Fo&quot;[value]&quot;"
DefaultValue="$(IntDir)\$(InputName).obj"
/>
<BooleanProperty
Name="PreserveIdentifierCase"
DisplayName="Preserve Identifier Case"
PropertyPageName="Identifiers"
Description="Preserves case of all user identifiers. (/Cp)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Cp"
/>
<BooleanProperty
Name="PreservePublicAndExternSymbolCase"
DisplayName="Preserve Public and Extern Symbol Case"
PropertyPageName="Identifiers"
Description="Preserves case in public and extern symbols. (/Cx)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Cx"
/>
<StringProperty
Name="PreprocessorDefinitions"
DisplayName="Preprocessor Definitions"
Description="Defines a text macro with the given name. (/D[symbol])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/D&quot;[value]&quot;"
Delimited="true"
Inheritable="true"
/>
<BooleanProperty
Name="GeneratePreprocessedSourceListing"
DisplayName="Generate Preprocessed Source Listing"
PropertyPageName="Listing File"
Description="Generates a preprocessed source listing to the Output Window. (/EP)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/EP"
/>
<StringProperty
Name="AssembledCodeListingFile"
DisplayName="Assembled Code Listing File"
PropertyPageName="Listing File"
Description="Generates an assembled code listing file. (/Fl[file])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Fl&quot;[value]&quot;"
/>
<StringProperty
Name="SourceBrowserFile"
DisplayName="Source Browser File"
PropertyPageName="Source Browser File"
Description="Generates a source browser .sbr file. (/Fr[file])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Fr&quot;[value]&quot;"
/>
<StringProperty
Name="ExtendedSourceBrowserFile"
DisplayName="Extended Source Browser File"
PropertyPageName="Source Browser File"
Description="Generates an extended form of a source browser .sbr file. (/FR[file])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/FR&quot;[value]&quot;"
/>
<StringProperty
Name="IncludePaths"
DisplayName="Include Paths"
Description="Sets path for include file. A maximum of 10 /I options is allowed. (/I [path])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/I &quot;[value]&quot;"
Delimited="true"
Inheritable="true"
/>
<BooleanProperty
Name="ListAllAvailableInformation"
DisplayName="List All Available Information"
PropertyPageName="Listing File"
Description="Turns on listing of all available information. (/Sa)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Sa"
/>
<BooleanProperty
Name="AddInstructionTimings"
DisplayName="Add Instruction Timings"
PropertyPageName="Listing File"
Description="Adds instruction timings to listing file. (/Sc)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Sc"
/>
<BooleanProperty
Name="AddFirstPassListing"
DisplayName="Add First Pass Listing"
PropertyPageName="Listing File"
Description="Adds first-pass listing to listing file. (/Sf)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Sf"
/>
<IntegerProperty
Name="SourceListingLineWidth"
DisplayName="Source Listing Line Width"
PropertyPageName="Listing File"
Description="Sets the line width of source listing in characters per line. Range is 60 to 255 or 0. Default is 0. Same as PAGE width. (/Sl [width])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Sl [value]"
/>
<BooleanProperty
Name="DisableSymbolTable"
DisplayName="Disable Symbol Table"
PropertyPageName="Listing File"
Description="Turns off symbol table when producing a listing. (/Sn)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Sn"
/>
<IntegerProperty
Name="SourceListingPageLength"
DisplayName="Source Listing Page Length"
PropertyPageName="Listing File"
Description="Sets the page length of source listing in lines per page. Range is 10 to 255 or 0. Default is 0. Same as PAGE length. (/Sp [length])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Sp [value]"
/>
<StringProperty
Name="SourceListingSubTitle"
DisplayName="Source Listing Subtitle"
PropertyPageName="Listing File"
Description="Specifies subtitle text for source listing. Same as SUBTITLE text. (/Ss [subtitle])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Ss [value]"
/>
<StringProperty
Name="SourceListingTitle"
DisplayName="Source Listing Title"
PropertyPageName="Listing File"
Description="Specifies title for source listing. Same as TITLE text. (/St [title])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/St [value]"
/>
<BooleanProperty
Name="EnableFalseConditionalsInListing"
DisplayName="Enable False Conditionals In Listing"
PropertyPageName="Listing File"
Description="Turns on false conditionals in listing. (/Sx)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Sx"
/>
<EnumProperty
Name="WarningLevel"
DisplayName="Warning Level"
Description="Sets the warning level, where level = 0, 1, 2, or 3. (/W0, /W1, /W2, /W3)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
>
<Values>
<EnumValue
Value="0"
Switch="/W0"
DisplayName="Warning Level 0 (/W0)"
/>
<EnumValue
Value="1"
Switch="/W1"
DisplayName="Warning Level 1 (/W1)"
/>
<EnumValue
Value="2"
Switch="/W2"
DisplayName="Warning Level 2 (/W2)"
/>
<EnumValue
Value="3"
Switch="/W3"
DisplayName="Warning Level 3 (/W3)"
/>
</Values>
</EnumProperty>
<BooleanProperty
Name="TreatWarningsAsErrors"
DisplayName="Treat Warnings As Errors"
Description="Returns an error code if warnings are generated. (/WX)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/WX"
/>
<BooleanProperty
Name="GenerateLineInformation"
DisplayName="Generate Line Information"
PropertyPageName="Object File"
Description="Generates line-number information in object file. (/Zd)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Zd"
/>
<BooleanProperty
Name="MakeAllSymbolsPublic"
DisplayName="Make All Symbols Public"
PropertyPageName="Object File"
Description="Makes all symbols public. (/Zf)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Zf"
/>
<BooleanProperty
Name="GenerateCodeViewInformation"
DisplayName="Generate CodeView Information"
PropertyPageName="Object File"
Description="Generates CodeView information in object file. (/Zi)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Zi"
/>
<EnumProperty
Name="PackAlignmentBoundary"
DisplayName="Pack Alignment Boundary"
PropertyPageName="Advanced"
Description="Packs structures on the specified byte boundary. The alignment can be 1, 2, or 4. (/Zp1, /Zp2, /Zp4)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
>
<Values>
<EnumValue
Value="0"
Switch="/Zp1"
DisplayName="One Byte Boundary (/Zp1)"
/>
<EnumValue
Value="1"
Switch="/Zp2"
DisplayName="Two Byte Boundary (/Zp2)"
/>
<EnumValue
Value="2"
Switch="/Zp4"
DisplayName="Four Byte Boundary (/Zp4)"
/>
</Values>
</EnumProperty>
<BooleanProperty
Name="PerformSyntaxCheckOnly"
DisplayName="Perform Syntax Check Only"
Description="Performs a syntax check only. (/Zs)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Zs"
/>
</Properties>
</CustomBuildRule>
</Rules>
</VisualStudioToolFile>

View File

@@ -0,0 +1,111 @@
//Microsoft Developer Studio generated resource script.
// $Id$
//
// This file is part of OpenTTD.
// OpenTTD 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, version 2.
// OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
//
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_READONLY_SYMBOLS
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
#ifdef MSVC
#include "winres.h"
#else
#define IDC_STATIC (-1) // all static controls
#endif
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Neutral (Default) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD)
#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
100 ICON DISCARDABLE "../media/openttd.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
100 DIALOG DISCARDABLE 0, 0, 305, 77
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Fatal Application Failure"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "&Close",12,7,58,50,14
// PUSHBUTTON "&Submit report",14,81,58,68,14,WS_DISABLED
PUSHBUTTON "&Emergency save",13,155,58,68,14
PUSHBUTTON "",15,243,58,55,14
EDITTEXT 11,7,79,291,118,ES_MULTILINE | ES_READONLY | WS_VSCROLL |
WS_HSCROLL | NOT WS_TABSTOP
LTEXT "",10,36,7,262,43
ICON 100,IDC_STATIC,9,9,20,20
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,8,0,!!REVISION!!
PRODUCTVERSION 0,8,0,!!REVISION!!
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "Comments", "This program is licensed under the GNU General Public License.\0"
VALUE "CompanyName", "OpenTTD Development Team\0"
VALUE "FileDescription", "OpenTTD\0"
VALUE "FileVersion", "Development !!VERSION!!\0"
VALUE "InternalName", "openttd\0"
VALUE "LegalCopyright", "Copyright \xA9 OpenTTD Developers 2002-2009. All Rights Reserved.\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "openttd.exe\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "OpenTTD\0"
VALUE "ProductVersion", "Development !!VERSION!!\0"
VALUE "SpecialBuild", "-\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 1200
END
END
#endif // !_MAC
#endif // Neutral (Default) resources
/////////////////////////////////////////////////////////////////////////////

1378
src/os/windows/win32.cpp Normal file

File diff suppressed because it is too large Load Diff

55
src/os/windows/win32.h Normal file
View File

@@ -0,0 +1,55 @@
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD 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, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file win32.h declarations of functions for MS windows systems */
#ifndef WIN32_H
#define WIN32_H
#include <windows.h>
bool MyShowCursor(bool show);
typedef void (*Function)(int);
bool LoadLibraryList(Function proc[], const char *dll);
char *convert_from_fs(const wchar_t *name, char *utf8_buf, size_t buflen);
wchar_t *convert_to_fs(const char *name, wchar_t *utf16_buf, size_t buflen);
/* Function shortcuts for UTF-8 <> UNICODE conversion. When unicode is not
* defined these macros return the string passed to them, with UNICODE
* they return a pointer to the converted string. The only difference between
* XX_TO_YY and XX_TO_YY_BUFFER is that with the buffer variant you can
* specify where to put the converted string (and how long it can be). Without
* the buffer and internal buffer is used, of max 512 characters */
#if defined(UNICODE)
# define MB_TO_WIDE(str) OTTD2FS(str)
# define MB_TO_WIDE_BUFFER(str, buffer, buflen) convert_to_fs(str, buffer, buflen)
# define WIDE_TO_MB(str) FS2OTTD(str)
# define WIDE_TO_MB_BUFFER(str, buffer, buflen) convert_from_fs(str, buffer, buflen)
#else
extern uint _codepage; // local code-page in the system @see win32_v.cpp:WM_INPUTLANGCHANGE
# define MB_TO_WIDE(str) (str)
# define MB_TO_WIDE_BUFFER(str, buffer, buflen) (str)
# define WIDE_TO_MB(str) (str)
# define WIDE_TO_MB_BUFFER(str, buffer, buflen) (str)
#endif
/* Override SHGetFolderPath with our custom implementation */
#if defined(SHGetFolderPath)
#undef SHGetFolderPath
#endif
#define SHGetFolderPath OTTDSHGetFolderPath
HRESULT OTTDSHGetFolderPath(HWND, int, HANDLE, DWORD, LPTSTR);
#if defined(__MINGW32__)
#define SHGFP_TYPE_CURRENT 0
#endif /* __MINGW32__ */
#endif /* WIN32_H */

8
src/os/windows/win64.asm Normal file
View File

@@ -0,0 +1,8 @@
.CODE
PUBLIC _get_safe_esp
_get_safe_esp:
MOV RAX,RSP
RET
END