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

Added file comments and TypeInfos

Added some implementations
Added auto_ptr and gc_ptr for easier memory management
This commit is contained in:
Tom Lint 2013-08-20 11:14:55 +02:00
parent 3a960b5829
commit b0dd58a08b
43 changed files with 609 additions and 183 deletions

View File

@ -14,7 +14,7 @@ As of this writing, XFX Contains the following libraries:
* libmscorlib - Provides the necessary classes found in mscorlib.dll to support the other libraries * libmscorlib - Provides the necessary classes found in mscorlib.dll to support the other libraries
* libSystem - Implements any types in the System.dll required by the other libs * libSystem - Implements any types in the System.dll required by the other libs
* libSystem.Windows - A re-implementation of the System.Windows.dll found on Windows Phone, to allow the creation of GUI-driven applications * libSystem.Windows - A re-implementation of the System.Windows.dll found on Windows Phone, to allow the creation of GUI-driven applications
* libSystem.Xml - Implements the functions found in System.Xml.dll * libSystem.Xml - Implements the functions found in System.Xml.dll and System.Xml.Serialization.dll
* libXFX - Implements the functions found in Microsoft.Xna.Framework.dll * libXFX - Implements the functions found in Microsoft.Xna.Framework.dll
* libXFX.Game - Implements the functions found in Microsoft.Xna.Framework.Game.dll * libXFX.Game - Implements the functions found in Microsoft.Xna.Framework.Game.dll

View File

@ -1,9 +1,10 @@
 
Microsoft Visual Studio Solution File, Format Version 11.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2010 # Visual Studio 2012
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{888801DD-E68C-4BDE-8B21-890076EF7A59}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{888801DD-E68C-4BDE-8B21-890076EF7A59}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
README.md = README.md README.md = README.md
include\xmem.h = include\xmem.h
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libXFX", "src\libXFX\libXFX.vcxproj", "{379FFCFD-88FA-46D6-A686-CAE8F58652FC}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libXFX", "src\libXFX\libXFX.vcxproj", "{379FFCFD-88FA-46D6-A686-CAE8F58652FC}"

View File

@ -19,6 +19,9 @@
#include "Audio/AudioEmitter.h" #include "Audio/AudioEmitter.h"
#include "Audio/AudioEngine.h" #include "Audio/AudioEngine.h"
#include "Audio/AudioListener.h" #include "Audio/AudioListener.h"
#include "Audio/DynamicSoundEffectInstance.h"
#include "Audio/SoundEffect.h"
#include "Audio/SoundEffectInstance.h"
// //
// Structs // Structs

View File

@ -4,11 +4,16 @@
* XFX::Audio::DynamicSoundEffectInstance definition file * * XFX::Audio::DynamicSoundEffectInstance definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
*****************************************************************************/ *****************************************************************************/
#ifndef _XFX_AUDIO_DYNAMICSOUNDEFFECTINSTANCE_
#define _XFX_AUDIO_DYNAMICSOUNDEFFECTINSTANCE_
#include <Audio/SoundEffectInstance.h> #include <Audio/SoundEffectInstance.h>
#include <System/Event.h> #include <System/Event.h>
#include <System/Collections/Generic/Queue.h>
#include <System/TimeSpan.h> #include <System/TimeSpan.h>
using namespace System; using namespace System;
using namespace System::Collections::Generic;
namespace XFX namespace XFX
{ {
@ -17,10 +22,12 @@ namespace XFX
/** /**
* Provides properties, methods, and events for play back of the audio buffer. * Provides properties, methods, and events for play back of the audio buffer.
*/ */
class DynamicSoundEffectInstance : SoundEffectInstance class DynamicSoundEffectInstance : public SoundEffectInstance
{ {
private: private:
Queue<byte[]> bufferQueue;
AudioChannels_t channels;
int sampleRate;
protected: protected:
void Dispose(bool disposing); void Dispose(bool disposing);
@ -40,7 +47,7 @@ namespace XFX
* @param channels * @param channels
* Number of channels in the audio data. * Number of channels in the audio data.
* *
* @throws System.ArgumentOutOfRangeException * @throws System::ArgumentOutOfRangeException
* *
*/ */
DynamicSoundEffectInstance(int sampleRate, AudioChannels_t channels); DynamicSoundEffectInstance(int sampleRate, AudioChannels_t channels);
@ -51,9 +58,9 @@ namespace XFX
* @param sizeInBytes * @param sizeInBytes
* Size, in bytes, of the audio data. * Size, in bytes, of the audio data.
* *
* @throws System.ObjectDisposedException * @throws System::ObjectDisposedException
* *
* @throws System.ArgumentException * @throws System::ArgumentException
* *
*/ */
TimeSpan GetSampleDuration(int sizeInBytes); TimeSpan GetSampleDuration(int sizeInBytes);
@ -63,16 +70,16 @@ namespace XFX
* @param duration * @param duration
* TimeSpan object that contains the duration of the audio sample. * TimeSpan object that contains the duration of the audio sample.
* *
* @throws System.ObjectDisposedException * @throws System::ObjectDisposedException
* *
* @throws System.ArgumentOutOfException * @throws System::ArgumentOutOfException
* *
*/ */
int GetSampleSizeInBytes(TimeSpan duration); int GetSampleSizeInBytes(TimeSpan duration);
/** /**
* Begins or resumes audio playback. * Begins or resumes audio playback.
* *
* @throws System.ObjectDisposedException * @throws System::ObjectDisposedException
*/ */
void Play(); void Play();
/** /**
@ -87,12 +94,14 @@ namespace XFX
* @param count * @param count
* Amount, in bytes, of data sent. * Amount, in bytes, of data sent.
* *
* @throws System.ObjectDisposedException * @throws System::ObjectDisposedException
* *
* @throws System.ArgumentException * @throws System::ArgumentException
* *
*/ */
void SubmitBuffer(byte buffer[], int offset, int count); void SubmitBuffer(byte buffer[], int offset, int count);
}; };
} }
} }
#endif // _XFX_AUDIO_DYNAMICSOUNDEFFECTINSTANCE_

View File

@ -1,9 +1,9 @@
/******************************************************** /*****************************************************************************
* Enums.h * * Enums.h *
* * * *
* XFX::Audio enumerations definition file * * XFX::Audio enumerations definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
********************************************************/ *****************************************************************************/
#ifndef _XFX_AUDIO_ENUMS_ #ifndef _XFX_AUDIO_ENUMS_
#define _XFX_AUDIO_ENUMS_ #define _XFX_AUDIO_ENUMS_

View File

@ -15,6 +15,7 @@ namespace XFX
{ {
class AudioListener; class AudioListener;
class AudioEmitter; class AudioEmitter;
class DynamicSoundEffectInstance;
class SoundEffect; class SoundEffect;
/** /**
@ -24,12 +25,14 @@ namespace XFX
{ {
private: private:
friend class SoundEffect; friend class SoundEffect;
friend class DynamicSoundEffectInstance;
float _pan; float _pan;
SoundEffect* _parent; SoundEffect* _parent;
float _volume; float _volume;
SoundEffectInstance(SoundEffect * const parent); SoundEffectInstance();
SoundEffectInstance(SoundEffect * const parent, bool fireAndForget);
virtual void Dispose(bool disposing); virtual void Dispose(bool disposing);

View File

@ -46,7 +46,7 @@ namespace XFX
static IAsyncResult* BeginShowStorageDeviceSelector(const PlayerIndex_t player, const int sizeInBytes, const int directoryCount, AsyncCallback callback, Object* state); static IAsyncResult* BeginShowStorageDeviceSelector(const PlayerIndex_t player, const int sizeInBytes, const int directoryCount, AsyncCallback callback, Object* state);
static IAsyncResult* BeginShowStorageDeviceSelector(const PlayerIndex_t player, AsyncCallback callback, Object* state); static IAsyncResult* BeginShowStorageDeviceSelector(const PlayerIndex_t player, AsyncCallback callback, Object* state);
static void DelayNotifications(const TimeSpan timespan); static void DelayNotifications(const TimeSpan timespan);
static const char* EndShowKeyboardInput(IAsyncResult* result); static String EndShowKeyboardInput(IAsyncResult* result);
static int EndShowMessageBox(IAsyncResult* result); static int EndShowMessageBox(IAsyncResult* result);
static StorageDevice EndShowStorageDeviceSelector(IAsyncResult* result); static StorageDevice EndShowStorageDeviceSelector(IAsyncResult* result);
}; };

View File

@ -49,7 +49,6 @@ namespace XFX
static const RasterizerState CullNone; static const RasterizerState CullNone;
RasterizerState(); RasterizerState();
~RasterizerState();
static const Type& GetType(); static const Type& GetType();

View File

@ -22,11 +22,11 @@ namespace XFX
class Video : public Object class Video : public Object
{ {
public: public:
TimeSpan getDuration(); TimeSpan getDuration() const;
float getFramesPerSecond(); float getFramesPerSecond() const;
int getHeight(); int getHeight() const;
VideoSoundtrackType_t getVideoSoundtrackType(); VideoSoundtrackType_t getVideoSoundtrackType() const;
int getWidth(); int getWidth() const;
static const Type& GetType(); static const Type& GetType();
}; };

View File

@ -11,7 +11,9 @@ namespace System
{ {
namespace Generic namespace Generic
{ {
// Represents a first-in, first-out collection of objects. /**
* Represents a first-in, first-out collection of objects.
*/
template <typename T> template <typename T>
class Queue : public ICollection<T>, public IEnumerable<T>, public Object class Queue : public ICollection<T>, public IEnumerable<T>, public Object
{ {
@ -27,7 +29,13 @@ namespace System
int _tail; int _tail;
int _version; int _version;
void Add(const T& item) { }
bool Remove(const T& item) { return false; }
public: public:
int Count() const;
bool IsReadOnly() const;
Queue(); Queue();
Queue(IEnumerable<T> * const collection); Queue(IEnumerable<T> * const collection);
Queue(const int capacity); Queue(const int capacity);
@ -37,7 +45,7 @@ namespace System
void CopyTo(T array[], const int index) const; void CopyTo(T array[], const int index) const;
T& Dequeue(); T& Dequeue();
void Enqueue(const T& item); void Enqueue(const T& item);
IEnumerator<T>* GetEnumerator() const; IEnumerator<T>* GetEnumerator();
int GetType() const; int GetType() const;
T& Peek(); T& Peek();
T* ToArray() const; T* ToArray() const;
@ -62,6 +70,18 @@ namespace System
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
template <typename T>
int Queue<T>::Count() const
{
return _size;
}
template <typename T>
bool Queue<T>::IsReadOnly() const
{
return false;
}
template <typename T> template <typename T>
Queue<T>::Queue() Queue<T>::Queue()
: _array(new T[_defaultCapacity]), _size(0), _version(0) : _array(new T[_defaultCapacity]), _size(0), _version(0)

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
* EventArgs.h * * EventArgs.h *
* * * *
* XFX EventArgs class definition file * * System::EventArgs class definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
*****************************************************************************/ *****************************************************************************/
#ifndef _SYSTEM_EVENTARGS_ #ifndef _SYSTEM_EVENTARGS_
@ -17,7 +17,7 @@ namespace System
class EventArgs : public Object class EventArgs : public Object
{ {
public: public:
static const EventArgs* Empty; static EventArgs * const Empty;
EventArgs(); EventArgs();
virtual ~EventArgs() { } virtual ~EventArgs() { }

View File

@ -30,7 +30,8 @@ namespace System
virtual Size MeasureOverride(const Size finalSize); virtual Size MeasureOverride(const Size finalSize);
public: public:
int Height; int getHeight() const;
void setHeight(const int value);
static const DependencyProperty<int> HeightProperty; static const DependencyProperty<int> HeightProperty;
HorizontalAlignment_t HorizontalAlignment; HorizontalAlignment_t HorizontalAlignment;
static const DependencyProperty<HorizontalAlignment_t> HorizontalAlignmentProperty; static const DependencyProperty<HorizontalAlignment_t> HorizontalAlignmentProperty;

119
include/xmem.h Normal file
View File

@ -0,0 +1,119 @@
/*****************************************************************************
* xmem.h *
* *
* Defines lightweight pointer wrapper classes for use on the XBOX. *
* Copyright (c) XFX Team. All rights reserved. *
*****************************************************************************/
#ifndef _XMEM_
#define _XMEM_
/**
*
*
* Differences from C++ auto_ptr: exception-less and supports array notation.
*/
template <typename T>
class auto_ptr
{
private:
T* ptr;
public:
auto_ptr(T * const p = 0) : ptr(p) { }
~auto_ptr() { delete ptr; }
T& operator *() { return *ptr; }
T* operator->() { return ptr; }
T& operator[](int index) { return ptr[index]; }
auto_ptr<T>& operator=(auto_ptr<T>& rhs)
{
if (this != &rhs)
{
delete ptr;
ptr = rhs.ptr;
rhs.ptr = NULL;
}
return *this;
}
};
/**
* Represents a garbage-collected, reference-counted pointer.
*
* @typeparam T
* The type of the underlying pointer.
*/
template <typename T>
class gc_ptr
{
private:
template <typename U>
class CountedPtr
{
private:
CountedPtr(U* pT) : Count(0), my_pT(pT) { ASSERT(pT != 0); }
~CountedPtr() { ASSERT(Count == 0); delete my_pT; }
unsigned GetRef() { return ++Count; }
unsigned FreeRef() { ASSERT(Count != 0); return --Count; }
U* const my_pT;
unsigned Count;
};
CountedPtr<T>* ptr;
public:
gc_ptr() : ptr(0) { }
gc_ptr(T * const p) : ptr(new CountedPtr<T>(p))
{
ptr->GetRef();
}
gc_ptr(const gc_ptr<T> &obj)
: ptr(obj.ptr)
{
if (!IsNull())
{
ptr->GetRef();
}
}
~gc_ptr() { UnBind(); }
bool IsNull() const { return ptr == 0; }
void Null() { UnBind(); }
UnBind()
{
if (!IsNull() && ptr->FreeRef() == 0)
{
delete ptr;
}
ptr = 0;
}
T& operator *() { return *ptr->my_pT; }
T* operator->() { return ptr->my_pT; }
T& operator[](int index) { return ptr->my_pT[index]; }
bool operator==(const gc_ptr<T>& rhs) const { return (ptr->my_pT == rhs->ptr->my_pT); }
bool operator!=(const gc_ptr<T>& rhs) const { return (ptr->my_pT != rhs->ptr->my_pT); }
gc_ptr<T>& operator=(gc_ptr<T>& rhs)
{
if (!rhs.IsNull())
{
rhs.ptr->GetRef();
}
UnBind();
ptr = rhs.ptr;
return *this;
}
};
#endif //_XMEM_

View File

@ -44,6 +44,16 @@ namespace System
const Type FrameworkElementTypeInfo("FrameworkElement", "System::Windows::FrameworkElement", TypeCode::Object); const Type FrameworkElementTypeInfo("FrameworkElement", "System::Windows::FrameworkElement", TypeCode::Object);
int FrameworkElement::getHeight() const
{
return GetValue(HeightProperty);
}
void FrameworkElement::setHeight(const int value)
{
SetValue(HeightProperty, value);
}
Thickness FrameworkElement::getMargin() const Thickness FrameworkElement::getMargin() const
{ {
return GetValue(MarginProperty); return GetValue(MarginProperty);
@ -65,11 +75,11 @@ namespace System
} }
FrameworkElement::FrameworkElement() FrameworkElement::FrameworkElement()
: HorizontalAlignment(HorizontalAlignment::Stretch),
VerticalAlignment(VerticalAlignment::Stretch)
{ {
SetValue(HeightProperty, Int32::MinValue); SetValue(HeightProperty, Int32::MinValue);
SetValue(HorizontalAlignmentProperty, HorizontalAlignment::Stretch);
SetValue(MarginProperty, Thickness(0)); SetValue(MarginProperty, Thickness(0));
SetValue(VerticalAlignmentProperty, VerticalAlignment::Stretch);
SetValue(WidthProperty, Int32::MinValue); SetValue(WidthProperty, Int32::MinValue);
} }

View File

@ -1,5 +1,33 @@
// 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 <System/Windows/GridLength.h> #include <System/Windows/GridLength.h>
#include <System/String.h> #include <System/String.h>
#include <System/Type.h>
namespace System namespace System
{ {
@ -7,6 +35,8 @@ namespace System
{ {
const GridLength GridLength::Auto(0, GridUnitType::Auto); const GridLength GridLength::Auto(0, GridUnitType::Auto);
const Type GridLengthTypeInfo("GridLength", "System::Windows::GridLength", TypeCode::Object);
GridUnitType_t GridLength::getGridUnitType() const GridUnitType_t GridLength::getGridUnitType() const
{ {
return gridUnitType; return gridUnitType;
@ -52,9 +82,9 @@ namespace System
{ {
} }
bool GridLength::Equals(const System::Object *obj) const bool GridLength::Equals(Object const * const obj) const
{ {
return is(obj, this) ? this->Equals(*(GridLength*)obj) : false; return is(obj, this) ? *this == *(GridLength *)obj : false;
} }
bool GridLength::Equals(const GridLength other) const bool GridLength::Equals(const GridLength other) const
@ -67,11 +97,12 @@ namespace System
return value + gridUnitType; return value + gridUnitType;
} }
int GridLength::GetType() const Type& GridLength::GetType()
{ {
return GridLengthTypeInfo;
} }
const char* GridLength::ToString() const const String GridLength::ToString() const
{ {
if (gridUnitType == GridUnitType::Auto) if (gridUnitType == GridUnitType::Auto)
return "Auto"; return "Auto";

View File

@ -1,10 +1,40 @@
// 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 <System/Windows/Point.h> #include <System/Windows/Point.h>
#include <System/String.h> #include <System/String.h>
#include <System/Type.h>
namespace System namespace System
{ {
namespace Windows namespace Windows
{ {
const Type PointTypeInfo("Point", "System::Windows::Point", TypeCode::Object);
Point::Point() Point::Point()
: X(0), Y(0) : X(0), Y(0)
{ {
@ -22,7 +52,7 @@ namespace System
bool Point::Equals(Object const * const obj) const bool Point::Equals(Object const * const obj) const
{ {
return is(obj, this) ? *this == *(Point*)obj : false; return is(obj, this) ? *this == *(Point *)obj : false;
} }
bool Point::Equals(const Point other) const bool Point::Equals(const Point other) const
@ -35,9 +65,9 @@ namespace System
return X + Y; return X + Y;
} }
int Point::GetType() const Type& Point::GetType()
{ {
// TODO: implement return PointTypeInfo;
} }
const String Point::ToString() const const String Point::ToString() const

View File

@ -60,7 +60,7 @@ namespace XFX
if (_drawOrder != value) if (_drawOrder != value)
{ {
_drawOrder = value; _drawOrder = value;
OnDrawOrderChanged(this, const_cast<EventArgs*>(EventArgs::Empty)); OnDrawOrderChanged(this, EventArgs::Empty);
} }
} }
@ -98,7 +98,7 @@ namespace XFX
if (_visible != value) if (_visible != value)
{ {
_visible = value; _visible = value;
OnVisibleChanged(this, const_cast<EventArgs*>(EventArgs::Empty)); OnVisibleChanged(this, EventArgs::Empty);
} }
} }
} }

View File

@ -29,7 +29,7 @@
extern "C" extern "C"
{ {
#if DEBUG #if DEBUG
#include <openxdk/debug.h> #include <openxdk/debug.h>
#endif #endif
#include <hal/input.h> #include <hal/input.h>
#include <hal/xbox.h> #include <hal/xbox.h>
@ -125,7 +125,7 @@ namespace XFX
disposed = true; disposed = true;
Disposed(this, const_cast<EventArgs * const>(EventArgs::Empty)); Disposed(this, EventArgs::Empty);
} }
void Game::Draw(GameTime gameTime) void Game::Draw(GameTime gameTime)
@ -170,7 +170,7 @@ namespace XFX
void Game::Initialize() void Game::Initialize()
{ {
graphicsService = (IGraphicsDeviceService *)services.GetService("IGraphicsDeviceService"); graphicsService = (IGraphicsDeviceService *)services.GetService(IGraphicsDeviceService::GetType());
for (int i = 0; i < components.Count(); i++) for (int i = 0; i < components.Count(); i++)
{ {
@ -208,7 +208,7 @@ namespace XFX
inRun = true; inRun = true;
BeginRun(); BeginRun();
graphicsManager = (IGraphicsDeviceManager*)((GraphicsDeviceManager*)services.GetService("IGraphicsDeviceManager")); graphicsManager = (IGraphicsDeviceManager*)((GraphicsDeviceManager*)services.GetService(IGraphicsDeviceManager::GetType()));
if (graphicsManager != null) if (graphicsManager != null)
graphicsManager->CreateDevice(); graphicsManager->CreateDevice();

View File

@ -41,7 +41,7 @@ namespace XFX
if(_enabled != value) if(_enabled != value)
{ {
_enabled = value; _enabled = value;
OnEnabledChanged(this, const_cast<EventArgs * const>(EventArgs::Empty)); OnEnabledChanged(this, EventArgs::Empty);
} }
} }
@ -60,7 +60,7 @@ namespace XFX
if(_updateOrder != value) if(_updateOrder != value)
{ {
_updateOrder = value; _updateOrder = value;
OnUpdateOrderChanged(this, const_cast<EventArgs * const>(EventArgs::Empty)); OnUpdateOrderChanged(this, EventArgs::Empty);
} }
} }
@ -74,7 +74,7 @@ namespace XFX
if (!_disposed) if (!_disposed)
{ {
_disposed = true; _disposed = true;
Disposed(this, const_cast<EventArgs*>(EventArgs::Empty)); Disposed(this, EventArgs::Empty);
} }
} }

View File

@ -54,13 +54,13 @@ namespace XFX
SynchronizeWithVerticalRetrace = true; SynchronizeWithVerticalRetrace = true;
preferredDepthStencilFormat = DepthFormat::Depth24; preferredDepthStencilFormat = DepthFormat::Depth24;
sassert(game->getServices().GetService("IGraphicsDeviceManager") == null, "A graphics device manager is already registered. The graphics device manager cannot be changed once it is set."); sassert(game->getServices().GetService(IGraphicsDeviceManager::GetType()) == null, "A graphics device manager is already registered. The graphics device manager cannot be changed once it is set.");
#if DEBUG #if DEBUG
debugPrint("Registering GraphicsDeviceManager\n"); debugPrint("Registering GraphicsDeviceManager\n");
#endif #endif
game->getServices().AddService("IGraphicsDeviceManager", this); game->getServices().AddService(IGraphicsDeviceManager::GetType(), this);
game->getServices().AddService("IGraphicsDeviceService", this); game->getServices().AddService(IGraphicsDeviceService::GetType(), this);
} }
GraphicsDeviceManager::GraphicsDeviceManager(const GraphicsDeviceManager &obj) GraphicsDeviceManager::GraphicsDeviceManager(const GraphicsDeviceManager &obj)
@ -121,7 +121,7 @@ namespace XFX
graphicsDevice->DeviceResetting += new EventHandler::T<GraphicsDeviceManager>(this, &GraphicsDeviceManager::OnDeviceResetting); graphicsDevice->DeviceResetting += new EventHandler::T<GraphicsDeviceManager>(this, &GraphicsDeviceManager::OnDeviceResetting);
graphicsDevice->DeviceReset += new EventHandler::T<GraphicsDeviceManager>(this, &GraphicsDeviceManager::OnDeviceReset); graphicsDevice->DeviceReset += new EventHandler::T<GraphicsDeviceManager>(this, &GraphicsDeviceManager::OnDeviceReset);
OnDeviceCreated(this, const_cast<EventArgs*>(EventArgs::Empty)); OnDeviceCreated(this, EventArgs::Empty);
} }
void GraphicsDeviceManager::Dispose() void GraphicsDeviceManager::Dispose()
@ -148,22 +148,22 @@ namespace XFX
return GraphicsDeviceManagerTypeInfo; return GraphicsDeviceManagerTypeInfo;
} }
void GraphicsDeviceManager::OnDeviceCreated(Object* sender, EventArgs* args) void GraphicsDeviceManager::OnDeviceCreated(Object * const sender, EventArgs * const args)
{ {
DeviceCreated(sender, args); DeviceCreated(sender, args);
} }
void GraphicsDeviceManager::OnDeviceDisposing(Object* sender, EventArgs* args) void GraphicsDeviceManager::OnDeviceDisposing(Object * const sender, EventArgs * const args)
{ {
DeviceDisposing(sender, args); DeviceDisposing(sender, args);
} }
void GraphicsDeviceManager::OnDeviceReset(Object* sender, EventArgs* args) void GraphicsDeviceManager::OnDeviceReset(Object * const sender, EventArgs * const args)
{ {
DeviceReset(sender, args); DeviceReset(sender, args);
} }
void GraphicsDeviceManager::OnDeviceResetting(Object* sender, EventArgs* args) void GraphicsDeviceManager::OnDeviceResetting(Object * const sender, EventArgs * const args)
{ {
DeviceResetting(sender, args); DeviceResetting(sender, args);
} }

View File

@ -41,7 +41,7 @@
<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile all 2&gt;&amp;1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeBuildCommandLine> <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile all 2&gt;&amp;1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeBuildCommandLine>
<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile rebuild 2&gt;&amp;1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeReBuildCommandLine> <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile rebuild 2&gt;&amp;1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeReBuildCommandLine>
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile clean 2&gt;&amp;1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeCleanCommandLine> <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile clean 2&gt;&amp;1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeCleanCommandLine>
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">libXFX.Game.a</NMakeOutput>
<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ENABLE_XBOX; DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions> <NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ENABLE_XBOX; DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\usr\local\openxdk\include;C:\cygwin\usr\local\openxdk\i386-pc-xbox\include;C:\cygwin\usr\local\openxdk\include\SDL;..\..\include;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath> <NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\usr\local\openxdk\include;C:\cygwin\usr\local\openxdk\i386-pc-xbox\include;C:\cygwin\usr\local\openxdk\include\SDL;..\..\include;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes> <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
@ -53,6 +53,9 @@
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);$(SolutionDir)include</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<BuildLog> <BuildLog>
<Path>BuildLog.htm</Path> <Path>BuildLog.htm</Path>

View File

@ -0,0 +1,46 @@
// 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/DirectionalLight.h>
#include <System/Type.h>
namespace XFX
{
namespace Graphics
{
const Type DirectionalLightTypeInfo("DirectionalLight", "XFX::Graphics::DirectionalLight", TypeCode::Object);
DirectionalLight::DirectionalLight(EffectParameter * const directionParameter, EffectParameter * const diffuseColorParameter, EffectParameter * const specularColorParameter, DirectionalLight const * const cloneSource)
{
}
const Type& DirectionalLight::GetType()
{
return DirectionalLightTypeInfo;
}
}
}

View File

@ -27,11 +27,14 @@
#include <Rectangle.h> #include <Rectangle.h>
#include <Graphics/DisplayMode.h> #include <Graphics/DisplayMode.h>
#include <System/Type.h>
namespace XFX namespace XFX
{ {
namespace Graphics namespace Graphics
{ {
const Type DisplayModeTypeInfo("DisplayMode", "XFX::Graphics::DisplayMode", TypeCode::Object);
float DisplayMode::getAspectRatio() const float DisplayMode::getAspectRatio() const
{ {
return Width / Height; return Width / Height;
@ -56,7 +59,7 @@ namespace XFX
bool DisplayMode::Equals(Object const * const obj) const bool DisplayMode::Equals(Object const * const obj) const
{ {
return is(this, obj) ? (*this == *(DisplayMode*)obj) : false; return is(this, obj) ? (*this == *(DisplayMode *)obj) : false;
} }
int DisplayMode::GetHashCode() const int DisplayMode::GetHashCode() const
@ -64,9 +67,9 @@ namespace XFX
return (int)getAspectRatio() ^ Width ^ Height ^ getTitleSafeArea().GetHashCode() ^ Format ^ RefreshRate; return (int)getAspectRatio() ^ Width ^ Height ^ getTitleSafeArea().GetHashCode() ^ Format ^ RefreshRate;
} }
int DisplayMode::GetType() const Type& DisplayMode::GetType()
{ {
// TODO: implement return DisplayModeTypeInfo;
} }
bool DisplayMode::operator!=(const DisplayMode& other) const bool DisplayMode::operator!=(const DisplayMode& other) const

View File

@ -0,0 +1,60 @@
// 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 <Audio/DynamicSoundEffectInstance.h>
namespace XFX
{
namespace Audio
{
DynamicSoundEffectInstance::DynamicSoundEffectInstance(int sampleRate, AudioChannels_t channels)
: channels(channels), sampleRate(sampleRate)
{
// TODO: implement remainder
}
void DynamicSoundEffectInstance::Dispose(bool disposing)
{
// TODO: implement remainder
}
void DynamicSoundEffectInstance::Play()
{
if (bufferQueue.Count() == 0)
{
BufferNeeded(this, EventArgs::Empty);
}
// TODO: implement remainder
}
void DynamicSoundEffectInstance::SubmitBuffer(byte buffer[], int offset, int count)
{
// TODO: implement remainder
}
}
}

View File

@ -123,7 +123,7 @@ namespace XFX
bool GraphicsAdapter::Equals(Object const * const obj) const bool GraphicsAdapter::Equals(Object const * const obj) const
{ {
return is(this, obj) ? (*this == *(GraphicsAdapter*)obj) : false; return is(this, obj) ? (*this == *(GraphicsAdapter *)obj) : false;
} }
bool GraphicsAdapter::Equals(const GraphicsAdapter obj) const bool GraphicsAdapter::Equals(const GraphicsAdapter obj) const

View File

@ -29,6 +29,7 @@
#include <Graphics/GraphicsDevice.h> #include <Graphics/GraphicsDevice.h>
#include <System/FrameworkResources.h> #include <System/FrameworkResources.h>
#include <System/String.h> #include <System/String.h>
#include <System/Type.h>
#include <Matrix.h> #include <Matrix.h>
#include <Quaternion.h> #include <Quaternion.h>
#include <Rectangle.h> #include <Rectangle.h>
@ -50,12 +51,14 @@ namespace XFX
{ {
namespace Graphics namespace Graphics
{ {
const Type GraphicsDeviceTypeInfo("GraphicsDevice", "XFX:Graphics::GraphicsDevice", TypeCode::Object);
PresentationParameters* GraphicsDevice::getPresentationParameters() const PresentationParameters* GraphicsDevice::getPresentationParameters() const
{ {
return p_cachedParameters; return p_cachedParameters;
} }
void GraphicsDevice::setPresentationParameters(PresentationParameters* presentationParameters) void GraphicsDevice::setPresentationParameters(PresentationParameters * const presentationParameters)
{ {
viewport.X = 0; viewport.X = 0;
viewport.Y = 0; viewport.Y = 0;
@ -112,7 +115,8 @@ namespace XFX
switch (err) switch (err)
{ {
case 0: break; //no error case 0:
break; //no error
case -4: case -4:
debugPrint("IRQ3 already handled. Can't install GPU interrupt.\n"); debugPrint("IRQ3 already handled. Can't install GPU interrupt.\n");
debugPrint("You must apply the patch and compile OpenXDK again.\n"); debugPrint("You must apply the patch and compile OpenXDK again.\n");
@ -194,7 +198,7 @@ namespace XFX
DWORD *p; DWORD *p;
DWORD format; DWORD format;
int x1,y1,x2,y2; int x1, y1, x2, y2;
//Set the coordinates for the rectangle to be cleared //Set the coordinates for the rectangle to be cleared
x1 = 0; x1 = 0;
@ -251,31 +255,34 @@ namespace XFX
} }
} }
int GraphicsDevice::GetType() const Type& GraphicsDevice::GetType()
{ {
return GraphicsDeviceTypeInfo;
} }
void GraphicsDevice::Present() void GraphicsDevice::Present()
{ {
while(pb_finished()); while(pb_finished());
pb_reset();
} }
void GraphicsDevice::raise_DeviceLost(Object* sender, EventArgs* e) void GraphicsDevice::raise_DeviceLost(Object * const sender, EventArgs * const e)
{ {
DeviceLost(sender, e); DeviceLost(sender, e);
} }
void GraphicsDevice::raise_DeviceReset(Object* sender, EventArgs* e) void GraphicsDevice::raise_DeviceReset(Object * const sender, EventArgs * const e)
{ {
DeviceReset(sender, e); DeviceReset(sender, e);
} }
void GraphicsDevice::raise_DeviceResetting(Object* sender, EventArgs* e) void GraphicsDevice::raise_DeviceResetting(Object * const sender, EventArgs * const e)
{ {
DeviceResetting(sender, e); DeviceResetting(sender, e);
} }
void GraphicsDevice::raise_Disposing(Object* sender, EventArgs* e) void GraphicsDevice::raise_Disposing(Object * const sender, EventArgs * const e)
{ {
Disposing(sender, e); Disposing(sender, e);
} }
@ -287,9 +294,9 @@ namespace XFX
void GraphicsDevice::Reset(PresentationParameters* presentationParameters) void GraphicsDevice::Reset(PresentationParameters* presentationParameters)
{ {
raise_DeviceResetting(this, const_cast<EventArgs*>(EventArgs::Empty)); raise_DeviceResetting(this, EventArgs::Empty);
setPresentationParameters(presentationParameters); setPresentationParameters(presentationParameters);
raise_DeviceReset(this, const_cast<EventArgs*>(EventArgs::Empty)); raise_DeviceReset(this, EventArgs::Empty);
} }
void GraphicsDevice::SetRenderTarget(RenderTarget2D * const renderTarget) void GraphicsDevice::SetRenderTarget(RenderTarget2D * const renderTarget)

View File

@ -66,7 +66,7 @@ namespace XFX
isDisposed = true; isDisposed = true;
Disposing(this, const_cast<EventArgs*>(EventArgs::Empty)); Disposing(this, EventArgs::Empty);
} }
const Type& GraphicsResource::GetType() const Type& GraphicsResource::GetType()

View File

@ -0,0 +1,46 @@
// 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/RasterizerState.h>
#include <System/Type.h>
namespace XFX
{
namespace Graphics
{
const Type RasterizerStateTypeInfo("RasterizerState", "XFX::Graphics::RasterizerState", TypeCode::Object);
RasterizerState::RasterizerState()
{
}
const Type& RasterizerState::GetType()
{
return RasterizerStateTypeInfo;
}
}
}

View File

@ -27,6 +27,8 @@
#include <Graphics/RenderTarget2D.h> #include <Graphics/RenderTarget2D.h>
#include <Graphics/Texture2D.h> #include <Graphics/Texture2D.h>
#include <System/Type.h>
#include <sassert.h> #include <sassert.h>
#include "pbkit.h" #include "pbkit.h"
@ -35,6 +37,8 @@ namespace XFX
{ {
namespace Graphics namespace Graphics
{ {
const Type RenderTarget2DTypeInfo("RenderTarget2D", "XFX::Graphics::RenderTarget2D", TypeCode::Object);
int RenderTarget2D::bufferCount = 0; int RenderTarget2D::bufferCount = 0;
RenderTarget2D::RenderTarget2D(GraphicsDevice * const graphicsDevice, const int width, const int height) RenderTarget2D::RenderTarget2D(GraphicsDevice * const graphicsDevice, const int width, const int height)
@ -44,18 +48,18 @@ namespace XFX
} }
RenderTarget2D::RenderTarget2D(GraphicsDevice * const graphicsDevice, const int width, const int height, const bool mipmap, const SurfaceFormat_t preferredFormat, const DepthFormat_t preferredDepthFormat) RenderTarget2D::RenderTarget2D(GraphicsDevice * const graphicsDevice, const int width, const int height, const bool mipmap, const SurfaceFormat_t preferredFormat, const DepthFormat_t preferredDepthFormat)
: Texture2D(graphicsDevice, width, height, mipmap, TextureUsage::None, preferredFormat) : Texture2D(graphicsDevice, width, height, mipmap, preferredFormat)
{ {
//! TODO: implement //! TODO: implement
} }
RenderTarget2D::RenderTarget2D(GraphicsDevice * const graphicsDevice, const int width, const int height, const bool mipmap, const SurfaceFormat_t preferredFormat, const DepthFormat_t preferredDepthFormat, const int multisampleCount, const RenderTargetUsage_t usage) RenderTarget2D::RenderTarget2D(GraphicsDevice * const graphicsDevice, const int width, const int height, const bool mipmap, const SurfaceFormat_t preferredFormat, const DepthFormat_t preferredDepthFormat, const int multisampleCount, const RenderTargetUsage_t usage)
: Texture2D(graphicsDevice, width, height, mipmap, TextureUsage::None, preferredFormat) : Texture2D(graphicsDevice, width, height, mipmap, preferredFormat)
{ {
//! TODO: implement //! TODO: implement
} }
RenderTarget2D::~RenderTarget() RenderTarget2D::~RenderTarget2D()
{ {
} }
@ -63,8 +67,9 @@ namespace XFX
{ {
} }
int RenderTarget2D::GetType() const Type& RenderTarget2D::GetType()
{ {
return RenderTarget2DTypeInfo;
} }
void RenderTarget2D::raise_ContentLost(Object * const sender, EventArgs * const e) void RenderTarget2D::raise_ContentLost(Object * const sender, EventArgs * const e)

View File

@ -107,7 +107,7 @@ namespace XFX
SoundEffectInstance* SoundEffect::CreateInstance() SoundEffectInstance* SoundEffect::CreateInstance()
{ {
return new SoundEffectInstance(this); return new SoundEffectInstance(this, false);
} }
void SoundEffect::Dispose() void SoundEffect::Dispose()
@ -137,12 +137,12 @@ namespace XFX
bool SoundEffect::Play() bool SoundEffect::Play()
{ {
SoundEffectInstance(this).Play(); SoundEffectInstance(this, true).Play();
} }
bool SoundEffect::Play(float volume, float pitch, float pan) bool SoundEffect::Play(float volume, float pitch, float pan)
{ {
SoundEffectInstance sei(this); SoundEffectInstance sei(this, true);
sei.setPan(pan); sei.setPan(pan);
sei.setPitch(pitch); sei.setPitch(pitch);
sei.setVolume(volume); sei.setVolume(volume);

View File

@ -77,7 +77,7 @@ namespace XFX
{ {
} }
SoundEffectInstance::SoundEffectInstance(SoundEffect * const parent) SoundEffectInstance::SoundEffectInstance(SoundEffect * const parent, bool fireAndForget)
: _parent(parent), _volume(parent->volume) : _parent(parent), _volume(parent->volume)
{ {
_parent->referenceCount++; _parent->referenceCount++;

View File

@ -104,7 +104,7 @@ namespace XFX
{ {
if (disposing && !isDisposed) if (disposing && !isDisposed)
{ {
Disposing(this, const_cast<EventArgs*>(EventArgs::Empty)); Disposing(this, EventArgs::Empty);
} }
isDisposed = true; isDisposed = true;
} }

View File

@ -51,7 +51,7 @@ namespace XFX
{ {
} }
Disposing(this, const_cast<EventArgs*>(EventArgs::Empty)); Disposing(this, EventArgs::Empty);
} }
void StateBlock::Dispose() void StateBlock::Dispose()

View File

@ -30,6 +30,7 @@ extern "C"
#include <xboxkrnl/xboxkrnl.h> #include <xboxkrnl/xboxkrnl.h>
} }
#include <xmem.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -78,7 +79,7 @@ namespace XFX
part_num = atoi(szPartition + 19); part_num = atoi(szPartition + 19);
if (part_num >= EXTEND_PARTITION_BEGIN) if (part_num >= EXTEND_PARTITION_BEGIN)
{ {
*cDriveLetter = extendPartitionMapping[part_num-EXTEND_PARTITION_BEGIN]; *cDriveLetter = extendPartitionMapping[part_num - EXTEND_PARTITION_BEGIN];
return; return;
} }
for (unsigned int i = 0; i < NUM_OF_DRIVES; i++) for (unsigned int i = 0; i < NUM_OF_DRIVES; i++)
@ -97,7 +98,7 @@ namespace XFX
return device; return device;
} }
bool StorageContainer::IsDisposed() bool StorageContainer::IsDisposed() const
{ {
return isDisposed; return isDisposed;
} }
@ -124,16 +125,16 @@ namespace XFX
isDisposed = true; isDisposed = true;
if (disposing) if (disposing)
Disposing(this, const_cast<EventArgs*>(EventArgs::Empty)); Disposing(this, EventArgs::Empty);
} }
} }
const char* StorageContainer::Path() const const String StorageContainer::Path() const
{ {
// Calculate the path to this storage location // Calculate the path to this storage location
} }
const char* StorageContainer::TitleLocation() const String StorageContainer::TitleLocation()
{ {
// XBOX returns the XeImageFileName like \device\harddisk0\partition2\apps\default.xbe // XBOX returns the XeImageFileName like \device\harddisk0\partition2\apps\default.xbe
// we need to map the partitions, and strip the \default.xbe from this string // we need to map the partitions, and strip the \default.xbe from this string
@ -141,7 +142,7 @@ namespace XFX
// copy the XeImageFileName to tmp, and strip the \default.xbe // copy the XeImageFileName to tmp, and strip the \default.xbe
//char *tmp = strncpy(tmp, XeImageFileName->Buffer, XeImageFileName->Length - 12); //char *tmp = strncpy(tmp, XeImageFileName->Buffer, XeImageFileName->Length - 12);
char* szTemp = (char *)malloc(256); auto_ptr<char> szTemp(new char[256]);
char cDriveLetter = 0; char cDriveLetter = 0;
char* szDest; char* szDest;
@ -153,18 +154,19 @@ namespace XFX
szTemp[XeImageFileName->Length - 29] = 0; szTemp[XeImageFileName->Length - 29] = 0;
sprintf(szDest, "%c:\\%s", cDriveLetter, szTemp); sprintf(szDest, "%c:\\%s", cDriveLetter, szTemp);
return szDest; return szDest;
} }
const char* StorageContainer::TitleName() const const String StorageContainer::TitleName() const
{ {
FILE* file = fopen(XeImageFileName->Buffer, "rb"); FILE* file = fopen(XeImageFileName->Buffer, "rb");
fseek(file, 0x118, SEEK_SET); auto_ptr<char> titleName(new char[0x50]);
uint32_t CertAddr = 0; uint32_t CertAddr = 0;
fseek(file, 0x118, SEEK_SET);
fread(&CertAddr, 4, 1, file); fread(&CertAddr, 4, 1, file);
fseek(file, CertAddr - 0x10000, SEEK_SET); fseek(file, CertAddr - 0x10000, SEEK_SET);
char* titleName = (char*)malloc(0x50);
fread(titleName, 0x50, 1, file); fread(titleName, 0x50, 1, file);
fclose(file); fclose(file);

View File

@ -54,7 +54,7 @@ namespace XFX
_deviceIndex = deviceIndex; _deviceIndex = deviceIndex;
} }
StorageContainer* StorageDevice::OpenContainer(const char* titleName) StorageContainer* StorageDevice::OpenContainer(const String& titleName)
{ {
sassert(!String::IsNullOrEmpty(titleName), "titleName cannot be null."); sassert(!String::IsNullOrEmpty(titleName), "titleName cannot be null.");

View File

@ -90,7 +90,7 @@ namespace XFX
// else if (texinfo.ResourceType == ResourceType::Texture3DVolume) { } //FIXME: Should we handle this here too? // else if (texinfo.ResourceType == ResourceType::Texture3DVolume) { } //FIXME: Should we handle this here too?
// else if (texinfo.ResourceType == ResourceType::TextureCube) { } // else if (texinfo.ResourceType == ResourceType::TextureCube) { }
//} //}
//
//TextureInformation Texture::GetTextureInformation(const String& filename) //TextureInformation Texture::GetTextureInformation(const String& filename)
//{ //{
// BinaryReader* br; // BinaryReader* br;
@ -135,8 +135,9 @@ namespace XFX
// br->Close(); // br->Close();
//} //}
int Texture::GetType() const Type& Texture::GetType()
{ {
} }
} }
} }

View File

@ -27,11 +27,14 @@
#include <Graphics/VertexElement.h> #include <Graphics/VertexElement.h>
#include <System/String.h> #include <System/String.h>
#include <System/Type.h>
namespace XFX namespace XFX
{ {
namespace Graphics namespace Graphics
{ {
const Type VertexElementTypeInfo("VertexElement", "XFX::Graphics::VertexElement", TypeCode::Object);
VertexElement::VertexElement(const int offset, const VertexElementFormat_t elementFormat, const VertexElementUsage_t elementUsage, const int usageIndex) VertexElement::VertexElement(const int offset, const VertexElementFormat_t elementFormat, const VertexElementUsage_t elementUsage, const int usageIndex)
: Offset(offset), UsageIndex(usageIndex), : Offset(offset), UsageIndex(usageIndex),
VertexElementFormat(elementFormat), VertexElementUsage(elementUsage) VertexElementFormat(elementFormat), VertexElementUsage(elementUsage)
@ -54,9 +57,9 @@ namespace XFX
return (Offset ^ UsageIndex); return (Offset ^ UsageIndex);
} }
int VertexElement::GetType() const Type& VertexElement::GetType()
{ {
// TODO: implement return VertexElementTypeInfo;
} }
const String VertexElement::ToString() const const String VertexElement::ToString() const

View File

@ -39,10 +39,12 @@ namespace XFX
TimeSpan VideoPlayer::getPlayPosition() TimeSpan VideoPlayer::getPlayPosition()
{ {
// TODO: implement remainder
} }
MediaState_t VideoPlayer::getState() MediaState_t VideoPlayer::getState()
{ {
// TODO: implement remainder
} }
Video* VideoPlayer::getVideo() Video* VideoPlayer::getVideo()
@ -52,6 +54,7 @@ namespace XFX
VideoPlayer::VideoPlayer() VideoPlayer::VideoPlayer()
{ {
// TODO: implement remainder
} }
void VideoPlayer::Dispose() void VideoPlayer::Dispose()
@ -61,6 +64,7 @@ namespace XFX
void VideoPlayer::Dispose(bool disposing) void VideoPlayer::Dispose(bool disposing)
{ {
// TODO: implement remainder
} }
Texture2D* VideoPlayer::GetTexture() Texture2D* VideoPlayer::GetTexture()
@ -70,19 +74,24 @@ namespace XFX
void VideoPlayer::Pause() void VideoPlayer::Pause()
{ {
// TODO: implement remainder
} }
void VideoPlayer::Play(Video * const video) void VideoPlayer::Play(Video * const video)
{ {
sassert(video != null, String::Format("value; %s", FrameworkResources::ArgumentNull_Generic)); sassert(video != null, String::Format("value; %s", FrameworkResources::ArgumentNull_Generic));
// TODO: implement remainder
} }
void VideoPlayer::Resume() void VideoPlayer::Resume()
{ {
// TODO: implement remainder
} }
void VideoPlayer::Stop() void VideoPlayer::Stop()
{ {
// TODO: implement remainder
} }
} }
} }

View File

@ -41,7 +41,7 @@
<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile all 2&gt;&amp;1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeBuildCommandLine> <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile all 2&gt;&amp;1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeBuildCommandLine>
<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile rebuild 2&gt;&amp;1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeReBuildCommandLine> <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile rebuild 2&gt;&amp;1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeReBuildCommandLine>
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile clean 2&gt;&amp;1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeCleanCommandLine> <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile clean 2&gt;&amp;1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeCleanCommandLine>
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">libXFX.a</NMakeOutput>
<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ENABLE_XBOX; DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions> <NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ENABLE_XBOX; DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\usr\local\openxdk\include;C:\cygwin\usr\local\openxdk\i386-pc-xbox\include;C:\cygwin\usr\local\openxdk\include\SDL;$(SolutionDir)include</NMakeIncludeSearchPath> <NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\usr\local\openxdk\include;C:\cygwin\usr\local\openxdk\i386-pc-xbox\include;C:\cygwin\usr\local\openxdk\include\SDL;$(SolutionDir)include</NMakeIncludeSearchPath>
<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes> <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
@ -54,7 +54,7 @@
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(SolutionDir)include</IncludePath> <IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);$(SolutionDir)include</IncludePath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<BuildLog> <BuildLog>
@ -79,6 +79,8 @@
<ClCompile Include="BoundingBox.cpp" /> <ClCompile Include="BoundingBox.cpp" />
<ClCompile Include="BoundingFrustum.cpp" /> <ClCompile Include="BoundingFrustum.cpp" />
<ClCompile Include="BoundingSphere.cpp" /> <ClCompile Include="BoundingSphere.cpp" />
<ClCompile Include="DirectionalLight.cpp" />
<ClCompile Include="DynamicSoundEffectInstance.cpp" />
<ClCompile Include="Effect.cpp" /> <ClCompile Include="Effect.cpp" />
<ClCompile Include="MathHelper.cpp" /> <ClCompile Include="MathHelper.cpp" />
<ClCompile Include="Matrix.cpp" /> <ClCompile Include="Matrix.cpp" />
@ -87,6 +89,7 @@
<ClCompile Include="Plane.cpp" /> <ClCompile Include="Plane.cpp" />
<ClCompile Include="Point.cpp" /> <ClCompile Include="Point.cpp" />
<ClCompile Include="Quaternion.cpp" /> <ClCompile Include="Quaternion.cpp" />
<ClCompile Include="RasterizerState.cpp" />
<ClCompile Include="Ray.cpp" /> <ClCompile Include="Ray.cpp" />
<ClCompile Include="Rectangle.cpp" /> <ClCompile Include="Rectangle.cpp" />
<ClCompile Include="SoundEffectInstance.cpp" /> <ClCompile Include="SoundEffectInstance.cpp" />

View File

@ -239,6 +239,15 @@
<ClCompile Include="StorageDeviceAsyncResult.cpp"> <ClCompile Include="StorageDeviceAsyncResult.cpp">
<Filter>Source Files\Storage</Filter> <Filter>Source Files\Storage</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="DynamicSoundEffectInstance.cpp">
<Filter>Source Files\Audio</Filter>
</ClCompile>
<ClCompile Include="RasterizerState.cpp">
<Filter>Source Files\Graphics</Filter>
</ClCompile>
<ClCompile Include="DirectionalLight.cpp">
<Filter>Source Files\Graphics</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\include\BoundingBox.h"> <ClInclude Include="..\..\include\BoundingBox.h">

View File

@ -26,17 +26,20 @@
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
#include <System/EventArgs.h> #include <System/EventArgs.h>
#include <System/Type.h>
namespace System namespace System
{ {
const EventArgs* EventArgs::Empty = new EventArgs(); EventArgs * const EventArgs::Empty = new EventArgs();
const Type EventArgsTypeInfo("EventArgs", "System::EventArgs", TypeCode::Object);
EventArgs::EventArgs() EventArgs::EventArgs()
{ {
} }
int EventArgs::GetType() const Type& EventArgs::GetType()
{ {
//! TODO: implement return EventArgsTypeInfo;
} }
} }