mirror of
https://github.com/libretro/beetle-psx-libretro.git
synced 2024-11-23 08:49:47 +00:00
(MSVC) Initial MSVC 2003 port
This commit is contained in:
parent
b5dfe6d2f5
commit
6c2fa7bf76
@ -19,7 +19,7 @@
|
||||
#include "mednafen.h"
|
||||
#include "FileWrapper.h"
|
||||
|
||||
#include <trio/trio.h>
|
||||
#include "include/trio/trio.h"
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "../mednafen.h"
|
||||
#include "../general.h"
|
||||
#include "../msvc_compat.h"
|
||||
#include "CDAccess_CCD.h"
|
||||
|
||||
#include <limits>
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "error.h"
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <trio/trio.h>
|
||||
#include "include/trio/trio.h"
|
||||
#include "../libretro.h"
|
||||
|
||||
extern retro_log_printf_t log_cb;
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <trio/trio.h>
|
||||
#include "include/trio/trio.h"
|
||||
#include <errno.h>
|
||||
#include <vector>
|
||||
|
||||
|
@ -560,16 +560,12 @@ struct XA_Subheader
|
||||
uint8 submode_dup;
|
||||
uint8 coding_dup;
|
||||
}
|
||||
#ifndef _MSC_VER
|
||||
__attribute__((__packed__))
|
||||
#endif
|
||||
;
|
||||
|
||||
struct XA_SoundGroup
|
||||
{
|
||||
uint8 params[16];
|
||||
uint8 samples[112];
|
||||
} __attribute__((__packed__));
|
||||
};
|
||||
|
||||
#define XA_SUBMODE_EOF 0x80
|
||||
#define XA_SUBMODE_REALTIME 0x40
|
||||
|
@ -1207,6 +1207,15 @@
|
||||
BEGIN_OPF(COP2, 0x12, 0);
|
||||
uint32_t sub_op = (instr >> 21) & 0x1F;
|
||||
|
||||
if (sub_op >= 16 && sub_op <= 31)
|
||||
{
|
||||
//printf("%08x\n", PC);
|
||||
if(timestamp < gte_ts_done)
|
||||
timestamp = gte_ts_done;
|
||||
gte_ts_done = timestamp + GTE_Instruction(instr);
|
||||
DO_LDS();
|
||||
}
|
||||
else
|
||||
switch(sub_op)
|
||||
{
|
||||
default:
|
||||
@ -1285,15 +1294,8 @@
|
||||
DO_LDS();
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x10 ... 0x1F:
|
||||
//printf("%08x\n", PC);
|
||||
if(timestamp < gte_ts_done)
|
||||
timestamp = gte_ts_done;
|
||||
gte_ts_done = timestamp + GTE_Instruction(instr);
|
||||
DO_LDS();
|
||||
break;
|
||||
}
|
||||
|
||||
END_OPF;
|
||||
}
|
||||
break;
|
||||
|
@ -17,7 +17,9 @@
|
||||
|
||||
#include "psx.h"
|
||||
#include "frontio.h"
|
||||
#include "../msvc_compat.h"
|
||||
|
||||
#include "../video/surface.h"
|
||||
#include "input/gamepad.h"
|
||||
#include "input/dualanalog.h"
|
||||
#include "input/dualshock.h"
|
||||
|
@ -269,7 +269,24 @@ bool InputDevice_Memcard::Clock(bool TxD, int32 &dsr_pulse_delay)
|
||||
transmit_count--;
|
||||
}
|
||||
|
||||
if (command_phase >= 1024 && command_phase <= 1151)
|
||||
{
|
||||
// Transmit actual 128 bytes data
|
||||
transmit_buffer = card_data[(addr << 7) + (command_phase - 1024)];
|
||||
calced_xor ^= transmit_buffer;
|
||||
transmit_count = 1;
|
||||
command_phase++;
|
||||
}
|
||||
else if (command_phase >= 2048 && command_phase <= 2175)
|
||||
{
|
||||
calced_xor ^= receive_buffer;
|
||||
rw_buffer[command_phase - 2048] = receive_buffer;
|
||||
|
||||
transmit_buffer = receive_buffer;
|
||||
transmit_count = 1;
|
||||
command_phase++;
|
||||
}
|
||||
else
|
||||
switch(command_phase)
|
||||
{
|
||||
case 0:
|
||||
@ -379,13 +396,7 @@ bool InputDevice_Memcard::Clock(bool TxD, int32 &dsr_pulse_delay)
|
||||
}
|
||||
break;
|
||||
|
||||
// Transmit actual 128 bytes data
|
||||
case (1024 + 0) ... (1024 + 128 - 1):
|
||||
transmit_buffer = card_data[(addr << 7) + (command_phase - 1024)];
|
||||
calced_xor ^= transmit_buffer;
|
||||
transmit_count = 1;
|
||||
command_phase++;
|
||||
break;
|
||||
|
||||
|
||||
// XOR
|
||||
case (1024 + 128):
|
||||
@ -420,16 +431,6 @@ bool InputDevice_Memcard::Clock(bool TxD, int32 &dsr_pulse_delay)
|
||||
transmit_count = 1;
|
||||
command_phase = 2048;
|
||||
break;
|
||||
|
||||
case (2048 + 0) ... (2048 + 128 - 1):
|
||||
calced_xor ^= receive_buffer;
|
||||
rw_buffer[command_phase - 2048] = receive_buffer;
|
||||
|
||||
transmit_buffer = receive_buffer;
|
||||
transmit_count = 1;
|
||||
command_phase++;
|
||||
break;
|
||||
|
||||
case (2048 + 128): // XOR
|
||||
write_xor = receive_buffer;
|
||||
transmit_buffer = '\\';
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef __MDFN_PSX_PSX_H
|
||||
#define __MDFN_PSX_PSX_H
|
||||
|
||||
#include <mednafen/mednafen.h>
|
||||
#include <mednafen/masmem.h>
|
||||
#include <trio/trio.h>
|
||||
#include "../mednafen.h"
|
||||
#include "../masmem.h"
|
||||
#include "../include/trio/trio.h"
|
||||
|
||||
#include "../cdrom/cdromif.h"
|
||||
#include "../general.h"
|
||||
|
@ -86,10 +86,6 @@ INLINE uint32 SF_FORCE_D(double *) { return(0); }
|
||||
#define SFARRAY64N(x, l, n) { (x), (uint32)((l) * sizeof(uint64)), MDFNSTATE_RLSB64 | SF_FORCE_A64(x), n }
|
||||
#define SFARRAY64(x, l) SFARRAY64N((x), (l), #x)
|
||||
|
||||
#if SIZEOF_DOUBLE != 8
|
||||
#error "sizeof(double) != 8"
|
||||
#endif
|
||||
|
||||
#define SFARRAYDN(x, l, n) { (x), (uint32)((l) * 8), MDFNSTATE_RLSB64 | SF_FORCE_D(x), n }
|
||||
#define SFARRAYD(x, l) SFARRAYDN((x), (l), #x)
|
||||
|
||||
|
@ -44,9 +44,9 @@
|
||||
/*************************************************************************
|
||||
* Trio include files
|
||||
*/
|
||||
#include <trio/triodef.h>
|
||||
#include <trio/trio.h>
|
||||
#include <trio/triop.h>
|
||||
#include "../include/trio/triodef.h"
|
||||
#include "../include/trio/trio.h"
|
||||
#include "../include/trio/triop.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
@ -64,7 +64,7 @@
|
||||
# define TRIO_FUNC_ISINF
|
||||
# endif
|
||||
#endif
|
||||
#include <trio/trionan.h>
|
||||
#include "../include/trio/trionan.h"
|
||||
|
||||
#if defined(TRIO_EMBED_STRING)
|
||||
# define TRIO_PUBLIC_STRING static
|
||||
@ -117,7 +117,7 @@
|
||||
# define TRIO_FUNC_XSTRING_APPEND_CHAR
|
||||
# endif
|
||||
#endif
|
||||
#include <trio/triostr.h>
|
||||
#include "../include/trio/triostr.h"
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
|
@ -26,8 +26,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <trio/triodef.h>
|
||||
#include <trio/triostr.h>
|
||||
#include "../include/trio/triodef.h"
|
||||
#include "../include/trio/triostr.h"
|
||||
#if defined(TRIO_FUNC_TO_LONG_DOUBLE)
|
||||
# define USE_MATH
|
||||
#endif
|
||||
|
21
msvc/msvc-2003.sln
Normal file
21
msvc/msvc-2003.sln
Normal file
@ -0,0 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msvc-2003", "msvc-2003/msvc-2003.vcproj", "{A9C675CC-DDF4-4BC5-A212-25AE2465D253}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{A9C675CC-DDF4-4BC5-A212-25AE2465D253}.Debug.ActiveCfg = Debug|Win32
|
||||
{A9C675CC-DDF4-4BC5-A212-25AE2465D253}.Debug.Build.0 = Debug|Win32
|
||||
{A9C675CC-DDF4-4BC5-A212-25AE2465D253}.Release.ActiveCfg = Release|Win32
|
||||
{A9C675CC-DDF4-4BC5-A212-25AE2465D253}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
338
msvc/msvc-2003/msvc-2003.vcproj
Normal file
338
msvc/msvc-2003/msvc-2003.vcproj
Normal file
@ -0,0 +1,338 @@
|
||||
<?xml version="1.0" encoding="windows-1250"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="libretro-psx"
|
||||
ProjectGUID="{A9C675CC-DDF4-4BC5-A212-25AE2465D253}"
|
||||
RootNamespace="libretro-psx"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\msvc-2003""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBRETROPSX_EXPORTS;LSB_FIRST"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/libretro-psx.dll"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/libretro-psx.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary="$(OutDir)/libretro-psx.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\msvc-2003""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBRETROPSX_EXPORTS;LSB_FIRST"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/libretro-psx.dll"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
ImportLibrary="$(OutDir)/libretro-psx.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\..\libretro.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\scrc32.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threads.c">
|
||||
</File>
|
||||
<Filter
|
||||
Name="mednafen"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath="..\..\mednafen\endian.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\error.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\file.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\FileStream.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\FileWrapper.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\general.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\math_ops.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\md5.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\MemoryStream.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\mempatcher.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\settings.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\state.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\Stream.cpp">
|
||||
</File>
|
||||
<Filter
|
||||
Name="psx"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\cdc.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\cpu.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\dma.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\frontio.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\gpu.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\gte.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\irq.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\mdec.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\sio.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\spu.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\timer.cpp">
|
||||
</File>
|
||||
<Filter
|
||||
Name="input"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\input\dualanalog.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\input\dualshock.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\input\gamepad.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\input\guncon.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\input\justifier.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\input\memcard.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\input\mouse.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\input\multitap.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\psx\input\negcon.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="video"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath="..\..\mednafen\video\Deinterlacer.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\video\surface.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="trio"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath="..\..\mednafen\trio\trio.c">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="2"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="2"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\trio\triostr.c">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="2"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="2"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="cdrom"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath="..\..\mednafen\cdrom\audioreader.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\cdrom\CDAccess.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\cdrom\CDAccess_CCD.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\cdrom\CDAccess_Image.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\cdrom\cdromif.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\cdrom\CDUtility.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\cdrom\crc32.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\cdrom\galois.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\cdrom\l-ec.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\cdrom\lec.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\cdrom\recover-raw.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\mednafen\cdrom\SimpleFIFO.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
249
msvc/msvc-2003/stdint.h
Normal file
249
msvc/msvc-2003/stdint.h
Normal file
@ -0,0 +1,249 @@
|
||||
// ISO C9x compliant stdint.h for Microsoft Visual Studio
|
||||
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
|
||||
//
|
||||
// Copyright (c) 2006-2008 Alexander Chemeris
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. The name of the author may be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef __RARCH_STDINT_H
|
||||
#define __RARCH_STDINT_H
|
||||
|
||||
#if _MSC_VER && (_MSC_VER < 1600)
|
||||
//pre-MSVC 2010 needs an implementation of stdint.h
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
|
||||
// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
|
||||
// or compiler give many errors like this:
|
||||
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# include <wchar.h>
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// Define _W64 macros to mark types changing their size, like intptr_t.
|
||||
#ifndef _W64
|
||||
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
|
||||
# define _W64 __w64
|
||||
# else
|
||||
# define _W64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
// 7.18.1 Integer types
|
||||
|
||||
// 7.18.1.1 Exact-width integer types
|
||||
|
||||
// Visual Studio 6 and Embedded Visual C++ 4 doesn't
|
||||
// realize that, e.g. char has the same size as __int8
|
||||
// so we give up on __intX for them.
|
||||
#if (_MSC_VER < 1300)
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
#else
|
||||
typedef signed __int8 int8_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
#endif
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
|
||||
// 7.18.1.2 Minimum-width integer types
|
||||
typedef int8_t int_least8_t;
|
||||
typedef int16_t int_least16_t;
|
||||
typedef int32_t int_least32_t;
|
||||
typedef int64_t int_least64_t;
|
||||
typedef uint8_t uint_least8_t;
|
||||
typedef uint16_t uint_least16_t;
|
||||
typedef uint32_t uint_least32_t;
|
||||
typedef uint64_t uint_least64_t;
|
||||
|
||||
// 7.18.1.3 Fastest minimum-width integer types
|
||||
typedef int8_t int_fast8_t;
|
||||
typedef int16_t int_fast16_t;
|
||||
typedef int32_t int_fast32_t;
|
||||
typedef int64_t int_fast64_t;
|
||||
typedef uint8_t uint_fast8_t;
|
||||
typedef uint16_t uint_fast16_t;
|
||||
typedef uint32_t uint_fast32_t;
|
||||
typedef uint64_t uint_fast64_t;
|
||||
|
||||
// 7.18.1.4 Integer types capable of holding object pointers
|
||||
#ifdef _WIN64 // [
|
||||
typedef signed __int64 intptr_t;
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
#else // _WIN64 ][
|
||||
typedef _W64 signed int intptr_t;
|
||||
typedef _W64 unsigned int uintptr_t;
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// 7.18.1.5 Greatest-width integer types
|
||||
typedef int64_t intmax_t;
|
||||
typedef uint64_t uintmax_t;
|
||||
|
||||
|
||||
// 7.18.2 Limits of specified-width integer types
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
|
||||
|
||||
// 7.18.2.1 Limits of exact-width integer types
|
||||
#define INT8_MIN ((int8_t)_I8_MIN)
|
||||
#define INT8_MAX _I8_MAX
|
||||
#define INT16_MIN ((int16_t)_I16_MIN)
|
||||
#define INT16_MAX _I16_MAX
|
||||
#define INT32_MIN ((int32_t)_I32_MIN)
|
||||
#define INT32_MAX _I32_MAX
|
||||
#define INT64_MIN ((int64_t)_I64_MIN)
|
||||
#define INT64_MAX _I64_MAX
|
||||
#define UINT8_MAX _UI8_MAX
|
||||
#define UINT16_MAX _UI16_MAX
|
||||
#define UINT32_MAX _UI32_MAX
|
||||
#define UINT64_MAX _UI64_MAX
|
||||
|
||||
// 7.18.2.2 Limits of minimum-width integer types
|
||||
#define INT_LEAST8_MIN INT8_MIN
|
||||
#define INT_LEAST8_MAX INT8_MAX
|
||||
#define INT_LEAST16_MIN INT16_MIN
|
||||
#define INT_LEAST16_MAX INT16_MAX
|
||||
#define INT_LEAST32_MIN INT32_MIN
|
||||
#define INT_LEAST32_MAX INT32_MAX
|
||||
#define INT_LEAST64_MIN INT64_MIN
|
||||
#define INT_LEAST64_MAX INT64_MAX
|
||||
#define UINT_LEAST8_MAX UINT8_MAX
|
||||
#define UINT_LEAST16_MAX UINT16_MAX
|
||||
#define UINT_LEAST32_MAX UINT32_MAX
|
||||
#define UINT_LEAST64_MAX UINT64_MAX
|
||||
|
||||
// 7.18.2.3 Limits of fastest minimum-width integer types
|
||||
#define INT_FAST8_MIN INT8_MIN
|
||||
#define INT_FAST8_MAX INT8_MAX
|
||||
#define INT_FAST16_MIN INT16_MIN
|
||||
#define INT_FAST16_MAX INT16_MAX
|
||||
#define INT_FAST32_MIN INT32_MIN
|
||||
#define INT_FAST32_MAX INT32_MAX
|
||||
#define INT_FAST64_MIN INT64_MIN
|
||||
#define INT_FAST64_MAX INT64_MAX
|
||||
#define UINT_FAST8_MAX UINT8_MAX
|
||||
#define UINT_FAST16_MAX UINT16_MAX
|
||||
#define UINT_FAST32_MAX UINT32_MAX
|
||||
#define UINT_FAST64_MAX UINT64_MAX
|
||||
|
||||
// 7.18.2.4 Limits of integer types capable of holding object pointers
|
||||
#ifdef _WIN64 // [
|
||||
# define INTPTR_MIN INT64_MIN
|
||||
# define INTPTR_MAX INT64_MAX
|
||||
# define UINTPTR_MAX UINT64_MAX
|
||||
#else // _WIN64 ][
|
||||
# define INTPTR_MIN INT32_MIN
|
||||
# define INTPTR_MAX INT32_MAX
|
||||
# define UINTPTR_MAX UINT32_MAX
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// 7.18.2.5 Limits of greatest-width integer types
|
||||
#define INTMAX_MIN INT64_MIN
|
||||
#define INTMAX_MAX INT64_MAX
|
||||
#define UINTMAX_MAX UINT64_MAX
|
||||
|
||||
// 7.18.3 Limits of other integer types
|
||||
|
||||
#ifdef _WIN64 // [
|
||||
# define PTRDIFF_MIN _I64_MIN
|
||||
# define PTRDIFF_MAX _I64_MAX
|
||||
#else // _WIN64 ][
|
||||
# define PTRDIFF_MIN _I32_MIN
|
||||
# define PTRDIFF_MAX _I32_MAX
|
||||
#endif // _WIN64 ]
|
||||
|
||||
#define SIG_ATOMIC_MIN INT_MIN
|
||||
#define SIG_ATOMIC_MAX INT_MAX
|
||||
|
||||
#ifndef SIZE_MAX // [
|
||||
# ifdef _WIN64 // [
|
||||
# define SIZE_MAX _UI64_MAX
|
||||
# else // _WIN64 ][
|
||||
# define SIZE_MAX _UI32_MAX
|
||||
# endif // _WIN64 ]
|
||||
#endif // SIZE_MAX ]
|
||||
|
||||
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
|
||||
#ifndef WCHAR_MIN // [
|
||||
# define WCHAR_MIN 0
|
||||
#endif // WCHAR_MIN ]
|
||||
#ifndef WCHAR_MAX // [
|
||||
# define WCHAR_MAX _UI16_MAX
|
||||
#endif // WCHAR_MAX ]
|
||||
|
||||
#define WINT_MIN 0
|
||||
#define WINT_MAX _UI16_MAX
|
||||
|
||||
#endif // __STDC_LIMIT_MACROS ]
|
||||
|
||||
|
||||
// 7.18.4 Limits of other integer types
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
|
||||
|
||||
// 7.18.4.1 Macros for minimum-width integer constants
|
||||
|
||||
#define INT8_C(val) val##i8
|
||||
#define INT16_C(val) val##i16
|
||||
#define INT32_C(val) val##i32
|
||||
#define INT64_C(val) val##i64
|
||||
|
||||
#define UINT8_C(val) val##ui8
|
||||
#define UINT16_C(val) val##ui16
|
||||
#define UINT32_C(val) val##ui32
|
||||
#define UINT64_C(val) val##ui64
|
||||
|
||||
// 7.18.4.2 Macros for greatest-width integer constants
|
||||
#define INTMAX_C INT64_C
|
||||
#define UINTMAX_C UINT64_C
|
||||
|
||||
#endif // __STDC_CONSTANT_MACROS ]
|
||||
|
||||
#else
|
||||
//sanity for everything else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user