1
0
mirror of https://github.com/Halofreak1990/XFXFramework synced 2024-12-26 13:49:34 +01:00

Fixed function signature mismatch

Added missing TypeInfos
This commit is contained in:
Tom Lint 2014-04-20 13:19:50 +02:00
parent c1151a1a67
commit b49582f946
37 changed files with 295 additions and 111 deletions

View File

@ -7,8 +7,11 @@
#ifndef _XFX_GRAPHICS_IGRAPHICSDEVICESERVICE_
#define _XFX_GRAPHICS_IGRAPHICSDEVICESERVICE_
#include <System/Event.h>
#include <System/Types.h>
using namespace System;
namespace XFX
{
namespace Graphics
@ -28,8 +31,7 @@ namespace XFX
virtual GraphicsDevice* getGraphicsDevice() const =0;
//! TODO: return typecode
int GetType() const { }
static const Type& GetType();
};
}
}

View File

@ -8,6 +8,7 @@
#define _XFX_GRAPHICS_SPRITEBATCH_
#include "BlendState.h"
#include "DepthStencilState.h"
#include "Effect.h"
#include "Enums.h"
#include <Matrix.h>

View File

@ -9,6 +9,7 @@
#include "Enums.h"
#include <System/Object.h>
#include <System/Types.h>
using namespace System;
@ -32,7 +33,7 @@ namespace XFX
const ButtonState_t X;
const ButtonState_t Y;
GamePadButtons(const uint /* Buttons */ buttons);
GamePadButtons(const uint /* Buttons_t */ buttons);
GamePadButtons();
GamePadButtons(const GamePadButtons &obj);

View File

@ -46,6 +46,8 @@ namespace XFX
virtual void CreateDevice()=0;
virtual void EndDraw()=0;
static const Type& GetType();
virtual ~IGraphicsDeviceManager() {}
};

View File

@ -63,15 +63,15 @@ namespace System
class Enumerator : public IEnumerator<T>
{
private:
int index = -1;
int index;
List<T> * const parent;
const int version;
List<T> const * const parent;
public:
T Current() const { return (*parent)[index]; }
T& Current() const { return (*parent)[index]; }
Enumerator(List<T> const * const parent)
: parent(parent), version(parent->_version)
Enumerator(List<T> * const parent)
: index(-1), parent(parent), version(parent->_version)
{
}
@ -184,7 +184,7 @@ namespace System
while (enumerator->MoveNext())
{
Add(enumerator->Current();
Add(enumerator->Current());
}
}

View File

@ -7,6 +7,8 @@
#ifndef _XMEM_
#define _XMEM_
#include <sassert.h>
/**
*
*
@ -55,10 +57,10 @@ private:
{
private:
CountedPtr(U* pT) : Count(0), my_pT(pT) { ASSERT(pT != 0); }
~CountedPtr() { ASSERT(Count == 0); delete my_pT; }
~CountedPtr() { sassert(Count == 0, "ERROR: called ~CountedPtr() while still holding at least one reference."); delete my_pT; }
unsigned GetRef() { return ++Count; }
unsigned FreeRef() { ASSERT(Count != 0); return --Count; }
unsigned FreeRef() { sassert(Count != 0, "ERROR: called FreeRef() while not holding any reference."); return --Count; }
U* const my_pT;
unsigned Count;
@ -87,12 +89,13 @@ public:
void Null() { UnBind(); }
UnBind()
void UnBind()
{
if (!IsNull() && ptr->FreeRef() == 0)
{
delete ptr;
}
ptr = 0;
}

View File

@ -211,16 +211,22 @@ namespace XFX
graphicsManager = (IGraphicsDeviceManager*)((GraphicsDeviceManager*)services.GetService(IGraphicsDeviceManager::GetType()));
if (graphicsManager != null)
{
graphicsManager->CreateDevice();
}
#if DEBUG
else
{
debugPrint("graphicsManager is NULL.\n");
}
#endif
Initialize();
while(1)
{
Tick();
}
EndRun();
inRun = false;

View File

@ -33,21 +33,24 @@ namespace XFX
{
}
void GameServiceContainer::AddService(const String& serviceType, Object* provider)
void GameServiceContainer::AddService(const Type& serviceType, Object* provider)
{
_services.Add(serviceType, provider);
}
Object* GameServiceContainer::GetService(const String& serviceType)
Object* GameServiceContainer::GetService(const Type& serviceType)
{
Object* service = null;
if (_services.TryGetValue(serviceType, service))
{
return service;
}
return null;
}
void GameServiceContainer::RemoveService(const String& type)
void GameServiceContainer::RemoveService(const Type& type)
{
_services.Remove(type);
}

View File

@ -0,0 +1,42 @@
// Copyright (C) XFX Team
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * 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.
// * Neither the name of the copyright holder nor the names of any
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR CONTRIBUTORS 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.
#include <Interfaces.h>
#include <System/Type.h>
using namespace System;
namespace XFX
{
const Type IGraphicsDeviceManagerTypeInfo("IGraphicsDeviceManager", "XFX::IGraphicsDeviceManager", TypeCode::Object);
const Type& IGraphicsDeviceManager::GetType()
{
return IGraphicsDeviceManagerTypeInfo;
}
}

View File

@ -83,6 +83,7 @@
<ClCompile Include="GameTime.cpp" />
<ClCompile Include="GraphicsDeviceManager.cpp" />
<ClCompile Include="GamerServicesComponent.cpp" />
<ClCompile Include="Interfaces.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\Game.h" />

View File

@ -41,6 +41,9 @@
<ClCompile Include="GamerServicesComponent.cpp">
<Filter>Source Files\GamerServices</Filter>
</ClCompile>
<ClCompile Include="Interfaces.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\Game.h">

View File

@ -2,7 +2,7 @@
# update this variable to wherever you installed the OpenXDK libraries
#
#########################################################################
PREFIX = /openxdk
PREFIX = /usr/local/openxdk
CC = gcc
CCAS = gcc

View File

@ -27,6 +27,7 @@
#include <System/Math.h>
#include <System/String.h>
#include <System/Type.h>
#include <Graphics/Color.h>
#include <Vector3.h>
#include <Vector4.h>
@ -37,6 +38,8 @@ namespace XFX
{
namespace Graphics
{
const Type ColorTypeInfo("Color", "XFX::Graphics::Color", TypeCode::Object);
uint Color::RGBAtoARGB(uint value)
{
uint x = ((value >> 0) ^ (value >> 25)) & ((1U << 8) - 1); // XOR temporary
@ -258,9 +261,9 @@ namespace XFX
return (int)_packedValue;
}
int Color::GetType()
const Type& Color::GetType()
{
// TODO: implement
return ColorTypeInfo;
}
uint Color::PackedValue() const
@ -269,21 +272,21 @@ namespace XFX
}
uint Color::InitializeFromVector4(const Vector4 value)
{
byte r = (byte)(Math::Round(value.X * 255));
byte g = (byte)(Math::Round(value.Y * 255));
byte b = (byte)(Math::Round(value.Z * 255));
byte a = (byte)(Math::Round(value.W * 255));
return ((uint)a << 24) + ((uint)r << 16) + ((uint)g << 8) + b;
}
uint Color::InitializeFromVector3(const Vector3 value)
{
byte r = (byte)(Math::Round(value.X * 255));
byte g = (byte)(Math::Round(value.Y * 255));
byte b = (byte)(Math::Round(value.Z * 255));
return ((uint)255 << 24) + ((uint)r << 16) + ((uint)g << 8) + b;
}
{
byte r = (byte)(Math::Round(value.X * 255));
byte g = (byte)(Math::Round(value.Y * 255));
byte b = (byte)(Math::Round(value.Z * 255));
byte a = (byte)(Math::Round(value.W * 255));
return ((uint)a << 24) + ((uint)r << 16) + ((uint)g << 8) + b;
}
uint Color::InitializeFromVector3(const Vector3 value)
{
byte r = (byte)(Math::Round(value.X * 255));
byte g = (byte)(Math::Round(value.Y * 255));
byte b = (byte)(Math::Round(value.Z * 255));
return ((uint)255 << 24) + ((uint)r << 16) + ((uint)g << 8) + b;
}
const String Color::ToString() const
{
@ -291,14 +294,14 @@ namespace XFX
}
Vector4 Color::ToVector4() const
{
return Vector4((float)R() / 255, (float)G() / 255, (float)B() / 255, (float)A() / 255);
}
Vector3 Color::ToVector3() const
{
return Vector3((float)R() / 255, (float)G() / 255, (float)B() / 255);
}
{
return Vector4((float)R() / 255, (float)G() / 255, (float)B() / 255, (float)A() / 255);
}
Vector3 Color::ToVector3() const
{
return Vector3((float)R() / 255, (float)G() / 255, (float)B() / 255);
}
bool Color::operator!=(const Color& other) const
{
@ -306,9 +309,9 @@ namespace XFX
}
bool Color::operator==(const Color& other) const
{
return (_packedValue == other._packedValue);
}
{
return (_packedValue == other._packedValue);
}
Color Color::operator*(const float scale) const
{

View File

@ -99,7 +99,7 @@ namespace XFX
}
template <class T>
T ContentManager::Load(const String& assetName)
T* ContentManager::Load(const String& assetName)
{
T dummyVal;
Object* obj2;
@ -134,7 +134,6 @@ namespace XFX
return local;
*/
Object* obj2;
sassert(!String::IsNullOrEmpty(assetName), String::Format("assetName; %s", FrameworkResources::ArgumentNull_Generic));
/*if (this->loadedAssets.TryGetValue(assetName, obj2))
{
@ -182,7 +181,7 @@ namespace XFX
}
template <class T>
T ContentManager::ReadAsset(const String& assetName)
T* ContentManager::ReadAsset(const String& assetName)
{
sassert(!disposed, "");

View File

@ -26,41 +26,29 @@
// POSSIBILITY OF SUCH DAMAGE.
#include <Graphics/DisplayModeCollection.h>
#include <System/Type.h>
namespace XFX
{
namespace Graphics
{
const Type DisplayModeCollectionTypeInfo("DisplayModeCollection", "XFX::Graphics::DisplayModeCollection", TypeCode::Object);
DisplayModeCollection::DisplayModeCollection()
{
}
bool DisplayModeCollection::operator!=(const DisplayModeCollection& other) const
IEnumerator<DisplayMode>* DisplayModeCollection::GetEnumerator()
{
int num;
if ((adapterOrdinal == other.adapterOrdinal) && (currentFormat == other.currentFormat))
{
num = 1;
}
else
{
num = 0;
}
return (bool)((byte)(((byte) num) == 0));
}
bool DisplayModeCollection::operator==(const DisplayModeCollection& other) const
const Type& DisplayModeCollection::GetType()
{
return DisplayModeCollectionTypeInfo;
}
DisplayMode& DisplayModeCollection::operator[](const SurfaceFormat_t format) const
{
int num;
if ((adapterOrdinal == other.adapterOrdinal) && (currentFormat == other.currentFormat))
{
num = 1;
}
else
{
num = 0;
}
return (bool)((byte) num);
}
}
}

View File

@ -0,0 +1,45 @@
// Copyright (C) XFX Team
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * 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.
// * Neither the name of the copyright holder nor the names of any
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR CONTRIBUTORS 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.
#include <Graphics/IGraphicsDeviceService.h>
#include <System/Type.h>
using namespace System;
namespace XFX
{
namespace Graphics
{
const Type IGraphicsDeviceServiceTypeInfo("IGraphicsDeviceService", "XFX::Graphics::IGraphicsDeviceService", TypeCode::Object);
const Type& IGraphicsDeviceService::GetType()
{
return IGraphicsDeviceServiceTypeInfo;
}
}
}

View File

@ -26,11 +26,14 @@
// POSSIBILITY OF SUCH DAMAGE.
#include <Graphics/Sprite.h>
#include <System/Type.h>
namespace XFX
{
namespace Graphics
{
const Type SpriteTypeInfo("Sprite", "XFX::Graphics::Sprite", TypeCode::Object);
Sprite::Sprite()
{
}
@ -99,8 +102,9 @@ namespace XFX
return layerDepth;
}
int Sprite::GetType()
const Type& Sprite::GetType()
{
return SpriteTypeInfo;
}
bool Sprite::operator !=(const Sprite& right) const

View File

@ -44,10 +44,14 @@ extern "C"
#include <sassert.h>
#include <System/Type.h>
namespace XFX
{
namespace Graphics
{
const Type SpriteBatchTypeInfo("SpriteBatch", "XFX::Graphics::SpriteBatch", TypeCode::Object);
SpriteBatch::SpriteBatch(GraphicsDevice * const graphicsDevice)
: device(graphicsDevice)
{
@ -228,18 +232,18 @@ namespace XFX
inBeginEndPair = false;
}
int SpriteBatch::GetType()
const Type& SpriteBatch::GetType()
{
// TODO: implement
return SpriteBatchTypeInfo;
}
void SpriteBatch::restoreRenderState()
{
}
void SpriteBatch::applyGraphicsDeviceSettings()
{
void SpriteBatch::applyGraphicsDeviceSettings()
{
DWORD* p;
p = pb_begin();

View File

@ -26,11 +26,14 @@
// POSSIBILITY OF SUCH DAMAGE.
#include <Graphics/StateBlock.h>
#include <System/Type.h>
namespace XFX
{
namespace Graphics
{
const Type StateBlockTypeInfo("StateBlock", "XFX::Graphics::StateBlock", TypeCode::Object);
StateBlock::StateBlock(GraphicsDevice* graphicsDevice)
: device(graphicsDevice)
{
@ -68,8 +71,9 @@ namespace XFX
{
}
int StateBlock::GetType()
const Type& StateBlock::GetType()
{
return StateBlockTypeInfo;
}
const String StateBlock::ToString() const

View File

@ -34,6 +34,8 @@ extern "C"
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#undef __STRICT_ANSI__
#include <string.h>
#include <Storage/StorageContainer.h>
@ -46,7 +48,7 @@ namespace XFX
typedef struct
{
char cDriveLetter;
char* szDevice;
char const * const szDevice;
int iPartition;
}
stDriveMapping;
@ -77,11 +79,13 @@ namespace XFX
}
part_num = atoi(szPartition + 19);
if (part_num >= EXTEND_PARTITION_BEGIN)
{
*cDriveLetter = extendPartitionMapping[part_num - EXTEND_PARTITION_BEGIN];
return;
}
for (unsigned int i = 0; i < NUM_OF_DRIVES; i++)
{
if (strnicmp(driveMapping[i].szDevice, szPartition, strlen(driveMapping[i].szDevice)) == 0)
@ -90,6 +94,7 @@ namespace XFX
return;
}
}
*cDriveLetter = 0;
}
@ -144,7 +149,7 @@ namespace XFX
// copy the XeImageFileName to tmp, and strip the \default.xbe
//char *tmp = strncpy(tmp, XeImageFileName->Buffer, XeImageFileName->Length - 12);
auto_ptr<char> szTemp(new char[256]);
char* szTemp = new char[256];
char cDriveLetter = 0;
char* szDest;
@ -157,13 +162,15 @@ namespace XFX
sprintf(szDest, "%c:\\%s", cDriveLetter, szTemp);
delete szTemp;
return szDest;
}
const String StorageContainer::TitleName() const
{
FILE* file = fopen(XeImageFileName->Buffer, "rb");
auto_ptr<char> titleName(new char[0x50]);
char* titleName = new char[0x50];
uint32_t CertAddr = 0;
fseek(file, 0x118, SEEK_SET);
fread(&CertAddr, 4, 1, file);
@ -171,6 +178,8 @@ namespace XFX
fseek(file, CertAddr - 0x10000, SEEK_SET);
fread(titleName, 0x50, 1, file);
// TODO: free C-string somehow
fclose(file);
return titleName;

View File

@ -28,10 +28,14 @@
#include <Graphics/TextureCollection.h>
#include <Graphics/Texture.h>
#include <System/Type.h>
namespace XFX
{
namespace Graphics
{
const Type TextureCollectionTypeInfo("TextureCollection", "XFX::Graphics::TextureCollection", TypeCode::Object);
void TextureCollection::Dispose()
{
Dispose(true);
@ -52,8 +56,9 @@ namespace XFX
Dispose(false);
}
int TextureCollection::GetType()
const Type& TextureCollection::GetType()
{
return TextureCollectionTypeInfo;
}
//
// Operators

View File

@ -29,11 +29,14 @@
#include <Vector3.h>
#include <Graphics/VertexPositionNormalTexture.h>
#include <System/String.h>
#include <System/Type.h>
namespace XFX
{
namespace Graphics
{
const Type VertexPositionNormalTextureTypeInfo("VertexPositionNormalTexture", "XFX::Graphics::VertexPositionNormalTexture", TypeCode::Object);
const VertexElement VertexPositionNormalTexture::vertexArray[] =
{
VertexElement(0, VertexElementFormat::Vector3, VertexElementUsage::Position, 0),
@ -65,9 +68,9 @@ namespace XFX
return Normal.GetHashCode() ^ Position.GetHashCode() ^ TextureCoordinate.GetHashCode();
}
int VertexPositionNormalTexture::GetType()
const Type& VertexPositionNormalTexture::GetType()
{
// TODO: implement
return VertexPositionNormalTextureTypeInfo;
}
const String VertexPositionNormalTexture::ToString() const

View File

@ -54,7 +54,7 @@
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);$(SolutionDir)include</IncludePath>
<IncludePath>C:\cygwin\usr\include;C:\cygwin\usr\local\openxdk\i386-pc-xbox\include;C:\cygwin\usr\local\openxdk\include;C:\cygwin\usr\local\openxdk\include\SDL;$(SolutionDir)include</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<BuildLog>
@ -85,6 +85,7 @@
<ClCompile Include="DirectionalLight.cpp" />
<ClCompile Include="DynamicSoundEffectInstance.cpp" />
<ClCompile Include="Effect.cpp" />
<ClCompile Include="IGraphicsDeviceService.cpp" />
<ClCompile Include="MathHelper.cpp" />
<ClCompile Include="Matrix.cpp" />
<ClCompile Include="Model.cpp" />

View File

@ -257,6 +257,9 @@
<ClCompile Include="CurveKeyCollection.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="IGraphicsDeviceService.cpp">
<Filter>Source Files\Graphics</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\BoundingBox.h">

View File

@ -2,13 +2,13 @@
# update this variable to wherever you installed the OpenXDK libraries
#
#########################################################################
PREFIX = /openxdk
PREFIX = /usr/local/openxdk
CC = xbox-gcc
CCAS = xbox-gcc
CPP = xbox-g++
AR = xbox-ar rcu
RANLIB = xbox-ranlib
CC = gcc
CCAS = gcc
CPP = g++
AR = ar rcu
RANLIB = ranlib
CXBE = $(PREFIX)/bin/cxbe
SDLFLAGS = -DENABLE_XBOX -DDEBUG
@ -28,9 +28,9 @@ LD_LIBS = $(LD_DIRS) -lmscorlib -lm -lopenxdk -lhal -lc -lusb -lc -lxboxkrnl -l
OBJS = BoundingBox.o BoundingFrustum.o BoundingSphere.o MathHelper.o Matrix.o Plane.o Point.o Quaternion.o Ray.o Rectangle.o Vector2.o Vector3.o Vector4.o
AUDIO_OBJS = SoundEffect.o SoundEffectInstance.o
CONTENT_OBJS = ContentManager.o ContentReader.o
#CONTENT_OBJS = ContentManager.o ContentReader.o
GAMERSERVICES_OBJS = Guide.o StorageDeviceAsyncResult.o
GRAPHICS_OBJS = BasicEffect.o BlendState.o Color.o DisplayMode.o DisplayModeCollection.o Effect.o GraphicsAdapter.o GraphicsDevice.o GraphicsResource.o pbKit.o PresentationParameters.o Sprite.o SpriteBatch.o SpriteFont.o StateBlock.o Texture.o Texture2D.o TextureCollection.o VertexElement.o VertexPositionColor.o VertexPositionNormalTexture.o VertexPositionTexture.o Viewport.o
GRAPHICS_OBJS = BasicEffect.o BlendState.o Color.o DisplayMode.o DisplayModeCollection.o Effect.o GraphicsAdapter.o GraphicsDevice.o GraphicsResource.o IGraphicsDeviceService.o pbKit.o PresentationParameters.o Sprite.o SpriteBatch.o SpriteFont.o StateBlock.o Texture.o Texture2D.o TextureCollection.o VertexElement.o VertexPositionColor.o VertexPositionNormalTexture.o VertexPositionTexture.o Viewport.o
INPUT_OBJS = GamePad.o Keyboard.o Mouse.o
MEDIA_OBJS = VideoPlayer.o
NET_OBJS = PacketReader.o PacketWriter.o

View File

@ -29,6 +29,7 @@
#include <System/String.h>
#include <System/Type.h>
#undef __STRICT_ANSI__
#include <stdlib.h>
namespace System

View File

@ -27,10 +27,8 @@
#include <System/Math.h>
extern "C"
{
#undef __STRICT_ANSI__
#include <math.h>
}
namespace System
{

View File

@ -32,7 +32,7 @@
namespace System
{
const Type ObjectTypeInfo("Object", "System::Object");
const Type ObjectTypeInfo("Object", "System::Object", TypeCode::Object);
bool Object::Equals(Object const * const obj) const
{
@ -49,7 +49,7 @@ namespace System
return (int)this;
}
Type Object::GetType()
const Type& Object::GetType()
{
return ObjectTypeInfo;
}
@ -59,7 +59,7 @@ namespace System
return (&objA == &objB);
}
const String& Object::ToString() const
const String Object::ToString() const
{
return "Object";
}

View File

@ -27,9 +27,12 @@
#include <System/OperatingSystem.h>
#include <System/String.h>
#include <System/Type.h>
namespace System
{
const Type OperatingSystemTypeInfo("OperatingSystem", "System::OperatingSystem", TypeCode::Object);
OperatingSystem::OperatingSystem(const PlatformID_t platform, const System::Version version)
: Platform(platform), Version(version)
{
@ -55,13 +58,14 @@ namespace System
return (int)Platform + Version.GetHashCode();
}
int OperatingSystem::GetType()
const Type& OperatingSystem::GetType()
{
return OperatingSystemTypeInfo;
}
const String& OperatingSystem::ToString() const
const String OperatingSystem::ToString() const
{
return "";
// TODO: implement
}
bool OperatingSystem::operator !=(const OperatingSystem& right) const

View File

@ -30,6 +30,7 @@
#include <System/String.h>
#include <stdlib.h>
#undef __STRICT_ANSI__
#include <string.h>
#include <hal/fileio.h>
#include <xboxkrnl/xboxkrnl.h>
@ -98,17 +99,26 @@ namespace System
String Path::Combine(const String& path1, const String& path2)
{
if (path1.Length == 0)
{
return path2;
}
if (path2.Length == 0)
{
return path1;
}
if (IsPathRooted(path2))
{
return path2;
}
char p1end = path1[path1.Length - 1];
if (p1end != DirectorySeparatorChar && p1end != AltDirectorySeparatorChar && p1end != VolumeSeparatorChar)
{
return path1 + &DirectorySeparatorChar + path2;
}
return (path1 + path2);
}
@ -125,17 +135,22 @@ namespace System
}
part_num = atoi(szPartition + 19);
if (part_num >= 6)
{
*cDriveLetter = extendPartitionMapping[part_num-6];
return;
}
for (unsigned int i=0; i < NUM_OF_DRIVES; i++)
{
if (strnicmp(driveMapping[i].szDevice, szPartition, strlen(driveMapping[i].szDevice)) == 0)
{
*cDriveLetter = driveMapping[i].cDriveLetter;
return;
}
}
*cDriveLetter = 0;
}

View File

@ -30,7 +30,9 @@
#include <System/FrameworkResources.h>
#include <System/Single.h>
#include <System/String.h>
#include <System/Type.h>
#include <stdlib.h>
#undef __STRICT_ANSI__
#include <string.h>
namespace System
@ -46,6 +48,8 @@ namespace System
const float Single::PositiveInfinity = *(float*)&rawPosInfF;
const float Single::NegativeInfinity = *(float*)&rawNegInfF;
const Type SingleTypeInfo("Single", "System::Single", TypeCode::Single);
Single::Single()
: value(0.0f)
{
@ -64,9 +68,15 @@ namespace System
int Single::CompareTo(const Single other) const
{
if (value > other.value)
{
return 1;
}
if (value < other.value)
{
return -1;
}
return 0;
}
@ -85,9 +95,9 @@ namespace System
return (int)value;
}
int Single::GetType()
const Type& Single::GetType()
{
return 13;
return SingleTypeInfo;
}
bool Single::TryParse(const String& str, out float* result)
@ -119,12 +129,12 @@ namespace System
return true;
}
const String& Single::ToString() const
const String Single::ToString() const
{
return String::Format("%f", value);
}
const String& Single::ToString(const float value)
const String Single::ToString(const float value)
{
return String::Format("%f", value);
}

View File

@ -29,6 +29,7 @@
#include <System/IO/StreamAsyncResult.h>
#include <System/FrameworkResources.h>
#include <System/String.h>
#include <System/Type.h>
#include <xboxkrnl/xboxkrnl.h>
@ -39,6 +40,7 @@ namespace System
namespace IO
{
const Stream* Stream::Null = new Stream();
const Type StreamTypeInfo("Stream", "System::IO::Stream", TypeCode::Object);
Stream::Stream()
{
@ -76,9 +78,9 @@ namespace System
// TODO: implement
}
int Stream::GetType()
const Type& Stream::GetType()
{
// TODO: implement
return StreamTypeInfo;
}
int Stream::ReadByte()

View File

@ -30,6 +30,7 @@
#include <System/Type.h>
#include <ctype.h>
#include <stdarg.h>
#undef __STRICT_ANSI__
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@ -489,7 +490,9 @@ namespace System
return *this;
}
return String(right);
String result(right.internalString);
return result;
}
String String::operator +(const char *right) const

View File

@ -29,6 +29,7 @@
#include <System/String.h>
#include <System/Type.h>
#undef __STRICT_ANSI__
#include <stdlib.h>
namespace System

View File

@ -54,6 +54,9 @@
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>C:\cygwin\usr\include;C:\cygwin\usr\local\openxdk\i386-pc-xbox\include;C:\cygwin\usr\local\openxdk\include;C:\cygwin\usr\local\openxdk\include\SDL;$(SolutionDir)include</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<BuildLog>
<Path>BuildLog.htm</Path>

View File

@ -2,7 +2,7 @@
# update this variable to wherever you installed the OpenXDK libraries
#
#########################################################################
PREFIX = /openxdk
PREFIX = /usr/local/openxdk
CC = gcc
CCAS = gcc
@ -12,7 +12,7 @@ RANLIB = ranlib
CXBE = $(PREFIX)/bin/cxbe
SDLFLAGS = -DENABLE_XBOX -DDEBUG
CC_FLAGS = -c -g -O2 -std=C99 -ffreestanding -nostdlib -fno-builtin -fno-exceptions -march=i686 -mmmx -msse -mfpmath=sse $(SDLFLAGS)
CC_FLAGS = -c -g -O2 -std=gnu99 -ffreestanding -nostdlib -fno-builtin -fno-exceptions -march=i686 -mmmx -msse -mfpmath=sse $(SDLFLAGS)
CCAS_FLAGS = --32 -march=pentiumiii, mmx, sse -mtune=pentiumiii -msse-check=error
CPP_FLAGS = -c -O2 -std=c++03 -Wall -nostdlib -fno-builtin -fno-exceptions -fno-rtti -march=i686 -mmmx -msse -mfpmath=sse $(SDLFLAGS)
INCLUDE = -I$(PREFIX)/i386-pc-xbox/include -I$(PREFIX)/include -I$(PREFIX)/include/SDL -I../../include

View File

@ -152,3 +152,18 @@ int strcasecmp(const char * s1, const char * s2)
return (tolower(*us1) - tolower(*--us2));
}
int strncasecmp(const char * s1, const char * s2, size_t n)
{
while (n --> 0) // n goes to zero ;)
{
const unsigned char us1 = (const unsigned char)toupper(*s1);
const unsigned char us2 = (const unsigned char)toupper(*s2);
if (us1 < us2) return -1;
if (us1 > us2) return 1;
++s1; ++s2;
}
return 0;
}