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
* 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.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.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
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{888801DD-E68C-4BDE-8B21-890076EF7A59}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
include\xmem.h = include\xmem.h
EndProjectSection
EndProject
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/AudioEngine.h"
#include "Audio/AudioListener.h"
#include "Audio/DynamicSoundEffectInstance.h"
#include "Audio/SoundEffect.h"
#include "Audio/SoundEffectInstance.h"
//
// Structs

View File

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

View File

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

View File

@ -15,6 +15,7 @@ namespace XFX
{
class AudioListener;
class AudioEmitter;
class DynamicSoundEffectInstance;
class SoundEffect;
/**
@ -24,12 +25,14 @@ namespace XFX
{
private:
friend class SoundEffect;
friend class DynamicSoundEffectInstance;
float _pan;
SoundEffect* _parent;
float _volume;
SoundEffectInstance(SoundEffect * const parent);
SoundEffectInstance();
SoundEffectInstance(SoundEffect * const parent, bool fireAndForget);
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, AsyncCallback callback, Object* state);
static void DelayNotifications(const TimeSpan timespan);
static const char* EndShowKeyboardInput(IAsyncResult* result);
static String EndShowKeyboardInput(IAsyncResult* result);
static int EndShowMessageBox(IAsyncResult* result);
static StorageDevice EndShowStorageDeviceSelector(IAsyncResult* result);
};

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Color.h *
* Color.h *
* *
* XFX::Graphics::Color structure definition file *
* Copyright (c) XFX Team. All Rights Reserved *

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* DepthStencilState.h *
* DepthStencilState.h *
* *
* XFX::Graphics::DepthStencilState class definition file *
* Copyright (c) XFX Team. All Rights Reserved *

View File

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

View File

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

View File

@ -11,7 +11,9 @@ namespace System
{
namespace Generic
{
// Represents a first-in, first-out collection of objects.
/**
* Represents a first-in, first-out collection of objects.
*/
template <typename T>
class Queue : public ICollection<T>, public IEnumerable<T>, public Object
{
@ -27,7 +29,13 @@ namespace System
int _tail;
int _version;
void Add(const T& item) { }
bool Remove(const T& item) { return false; }
public:
int Count() const;
bool IsReadOnly() const;
Queue();
Queue(IEnumerable<T> * const collection);
Queue(const int capacity);
@ -37,7 +45,7 @@ namespace System
void CopyTo(T array[], const int index) const;
T& Dequeue();
void Enqueue(const T& item);
IEnumerator<T>* GetEnumerator() const;
IEnumerator<T>* GetEnumerator();
int GetType() const;
T& Peek();
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>
Queue<T>::Queue()
: _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 *
*****************************************************************************/
#ifndef _SYSTEM_EVENTARGS_
@ -17,7 +17,7 @@ namespace System
class EventArgs : public Object
{
public:
static const EventArgs* Empty;
static EventArgs * const Empty;
EventArgs();
virtual ~EventArgs() { }

View File

@ -1,8 +1,8 @@
/*****************************************************************************
* FrameworkElement.h *
* FrameworkElement.h *
* *
* System::Windows::FrameworkElement definition file *
* Copyright (c) XFX Team. All rights reserved *
* Copyright (c) XFX Team. All rights reserved *
*****************************************************************************/
#ifndef _SYSTEM_WINDOWS_FRAMEWORKELEMENT_
#define _SYSTEM_WINDOWS_FRAMEWORKELEMENT_
@ -30,7 +30,8 @@ namespace System
virtual Size MeasureOverride(const Size finalSize);
public:
int Height;
int getHeight() const;
void setHeight(const int value);
static const DependencyProperty<int> HeightProperty;
HorizontalAlignment_t HorizontalAlignment;
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);
int FrameworkElement::getHeight() const
{
return GetValue(HeightProperty);
}
void FrameworkElement::setHeight(const int value)
{
SetValue(HeightProperty, value);
}
Thickness FrameworkElement::getMargin() const
{
return GetValue(MarginProperty);
@ -65,11 +75,11 @@ namespace System
}
FrameworkElement::FrameworkElement()
: HorizontalAlignment(HorizontalAlignment::Stretch),
VerticalAlignment(VerticalAlignment::Stretch)
{
SetValue(HeightProperty, Int32::MinValue);
SetValue(HorizontalAlignmentProperty, HorizontalAlignment::Stretch);
SetValue(MarginProperty, Thickness(0));
SetValue(VerticalAlignmentProperty, VerticalAlignment::Stretch);
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/String.h>
#include <System/Type.h>
namespace System
{
@ -7,6 +35,8 @@ namespace System
{
const GridLength GridLength::Auto(0, GridUnitType::Auto);
const Type GridLengthTypeInfo("GridLength", "System::Windows::GridLength", TypeCode::Object);
GridUnitType_t GridLength::getGridUnitType() const
{
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
@ -67,11 +97,12 @@ namespace System
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)
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/String.h>
#include <System/Type.h>
namespace System
{
namespace Windows
{
const Type PointTypeInfo("Point", "System::Windows::Point", TypeCode::Object);
Point::Point()
: X(0), Y(0)
{
@ -22,7 +52,7 @@ namespace System
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
@ -35,9 +65,9 @@ namespace System
return X + Y;
}
int Point::GetType()
const Type& Point::GetType()
{
// TODO: implement
return PointTypeInfo;
}
const String Point::ToString() const

View File

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

View File

@ -29,7 +29,7 @@
extern "C"
{
#if DEBUG
#include <openxdk/debug.h>
#include <openxdk/debug.h>
#endif
#include <hal/input.h>
#include <hal/xbox.h>
@ -54,7 +54,7 @@ namespace XFX
{
return isActive;
}
Game::Game()
{
inRun = false;
@ -98,7 +98,7 @@ namespace XFX
bool Game::BeginDraw()
{
if (IsFixedTimeStep && gameTime.IsRunningSlowly())
return false;
return false;
return graphicsManager->BeginDraw();
}
@ -125,7 +125,7 @@ namespace XFX
disposed = true;
Disposed(this, const_cast<EventArgs * const>(EventArgs::Empty));
Disposed(this, EventArgs::Empty);
}
void Game::Draw(GameTime gameTime)
@ -156,7 +156,7 @@ namespace XFX
void Game::EndRun()
{
}
void Game::Exit()
{
XSleep(1000);
@ -170,7 +170,7 @@ namespace XFX
void Game::Initialize()
{
graphicsService = (IGraphicsDeviceService *)services.GetService("IGraphicsDeviceService");
graphicsService = (IGraphicsDeviceService *)services.GetService(IGraphicsDeviceService::GetType());
for (int i = 0; i < components.Count(); i++)
{
@ -208,7 +208,7 @@ namespace XFX
inRun = true;
BeginRun();
graphicsManager = (IGraphicsDeviceManager*)((GraphicsDeviceManager*)services.GetService("IGraphicsDeviceManager"));
graphicsManager = (IGraphicsDeviceManager*)((GraphicsDeviceManager*)services.GetService(IGraphicsDeviceManager::GetType()));
if (graphicsManager != null)
graphicsManager->CreateDevice();
@ -217,19 +217,19 @@ namespace XFX
debugPrint("graphicsManager is NULL.\n");
#endif
Initialize();
Initialize();
while(1)
Tick();
EndRun();
EndRun();
inRun = false;
}
void Game::Tick()
{
Update(gameTime);
if(BeginDraw())
{
Draw(gameTime);

View File

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

View File

@ -54,13 +54,13 @@ namespace XFX
SynchronizeWithVerticalRetrace = true;
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
debugPrint("Registering GraphicsDeviceManager\n");
#endif
game->getServices().AddService("IGraphicsDeviceManager", this);
game->getServices().AddService("IGraphicsDeviceService", this);
game->getServices().AddService(IGraphicsDeviceManager::GetType(), this);
game->getServices().AddService(IGraphicsDeviceService::GetType(), this);
}
GraphicsDeviceManager::GraphicsDeviceManager(const GraphicsDeviceManager &obj)
@ -96,10 +96,10 @@ namespace XFX
bool GraphicsDeviceManager::CanResetDevice(const GraphicsDeviceInformation newDeviceInfo)
{
/*if (graphicsDevice->getDeviceType() != newDeviceInfo.DeviceType_)
{
return false;
}*/
return true;
{
return false;
}*/
return true;
}
void GraphicsDeviceManager::CreateDevice()
@ -121,7 +121,7 @@ namespace XFX
graphicsDevice->DeviceResetting += new EventHandler::T<GraphicsDeviceManager>(this, &GraphicsDeviceManager::OnDeviceResetting);
graphicsDevice->DeviceReset += new EventHandler::T<GraphicsDeviceManager>(this, &GraphicsDeviceManager::OnDeviceReset);
OnDeviceCreated(this, const_cast<EventArgs*>(EventArgs::Empty));
OnDeviceCreated(this, EventArgs::Empty);
}
void GraphicsDeviceManager::Dispose()
@ -148,22 +148,22 @@ namespace XFX
return GraphicsDeviceManagerTypeInfo;
}
void GraphicsDeviceManager::OnDeviceCreated(Object* sender, EventArgs* args)
void GraphicsDeviceManager::OnDeviceCreated(Object * const sender, EventArgs * const args)
{
DeviceCreated(sender, args);
}
void GraphicsDeviceManager::OnDeviceDisposing(Object* sender, EventArgs* args)
void GraphicsDeviceManager::OnDeviceDisposing(Object * const sender, EventArgs * const args)
{
DeviceDisposing(sender, args);
}
void GraphicsDeviceManager::OnDeviceReset(Object* sender, EventArgs* args)
void GraphicsDeviceManager::OnDeviceReset(Object * const sender, EventArgs * const args)
{
DeviceReset(sender, args);
}
void GraphicsDeviceManager::OnDeviceResetting(Object* sender, EventArgs* args)
void GraphicsDeviceManager::OnDeviceResetting(Object * const sender, EventArgs * const 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>
<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>
<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>
<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>
@ -53,6 +53,9 @@
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
</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'">
<BuildLog>
<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,18 +27,21 @@
#include <Rectangle.h>
#include <Graphics/DisplayMode.h>
#include <System/Type.h>
namespace XFX
{
namespace Graphics
{
const Type DisplayModeTypeInfo("DisplayMode", "XFX::Graphics::DisplayMode", TypeCode::Object);
float DisplayMode::getAspectRatio() const
{
return Width / Height;
}
Rectangle DisplayMode::getTitleSafeArea() const
{
{
/*
Based on my own findings on a PAL SD TV set, this roughly equates to a resolution of 600 * 450
however, that's on a normal 4:3 TV, and not a Widescreen 0_o'
@ -48,32 +51,32 @@ namespace XFX
*/
return Rectangle(20, 0, Width - 20, Height - 30);
}
DisplayMode::DisplayMode()
: Height(0), Format(SurfaceFormat::Color), RefreshRate(60), Width(0)
{
}
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
{
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
{
return ((Width != other.Width) || (Height != other.Height) || (Format != other.Format) || (RefreshRate != other.RefreshRate));
}
bool DisplayMode::operator==(const DisplayMode& other) const
{
return ((Width == other.Width) && (Height == other.Height) && (Format == other.Format) && (RefreshRate == other.RefreshRate));

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
{
return is(this, obj) ? (*this == *(GraphicsAdapter*)obj) : false;
return is(this, obj) ? (*this == *(GraphicsAdapter *)obj) : false;
}
bool GraphicsAdapter::Equals(const GraphicsAdapter obj) const

View File

@ -29,6 +29,7 @@
#include <Graphics/GraphicsDevice.h>
#include <System/FrameworkResources.h>
#include <System/String.h>
#include <System/Type.h>
#include <Matrix.h>
#include <Quaternion.h>
#include <Rectangle.h>
@ -50,12 +51,14 @@ namespace XFX
{
namespace Graphics
{
const Type GraphicsDeviceTypeInfo("GraphicsDevice", "XFX:Graphics::GraphicsDevice", TypeCode::Object);
PresentationParameters* GraphicsDevice::getPresentationParameters() const
{
return p_cachedParameters;
}
void GraphicsDevice::setPresentationParameters(PresentationParameters* presentationParameters)
void GraphicsDevice::setPresentationParameters(PresentationParameters * const presentationParameters)
{
viewport.X = 0;
viewport.Y = 0;
@ -75,7 +78,7 @@ namespace XFX
// TODO: find command *ALPHA_SIZE
//pb_push1(p, 0, 0);
}
pb_end(p);
pb_set_viewport(viewport.X, viewport.Y, viewport.Width, viewport.Height, viewport.MinDepth, viewport.MaxDepth);
@ -100,7 +103,7 @@ namespace XFX
}
}
GraphicsDevice::GraphicsDevice(GraphicsAdapter * const adapter, PresentationParameters * const presentationParameters)
GraphicsDevice::GraphicsDevice(GraphicsAdapter * const adapter, PresentationParameters * const presentationParameters)
{
//sassert(adapter != null, String::Format("adapter; %s", FrameworkResources::ArgumentNull_Generic));
@ -112,14 +115,15 @@ namespace XFX
switch (err)
{
case 0: break; //no error
case -4:
case 0:
break; //no error
case -4:
debugPrint("IRQ3 already handled. Can't install GPU interrupt.\n");
debugPrint("You must apply the patch and compile OpenXDK again.\n");
debugPrint("Also be sure to call pb_init() before any other call.\n");
XSleep(2000);
return;
case -5:
case -5:
debugPrint("Unexpected PLL configuration. Report this issue please.\n");
XSleep(2000);
return;
@ -133,31 +137,31 @@ namespace XFX
pb_reset();
}
GraphicsDevice::~GraphicsDevice()
{
Dispose(false);
delete _adapter;
delete p_cachedParameters;
}
void GraphicsDevice::Clear(const Color color)
{
// start of frame-- reset push buffer
pb_reset();
DWORD *p;
DWORD format;
DWORD depth;
int x1,y1,x2,y2;
DWORD *p;
DWORD format;
DWORD depth;
int x1,y1,x2,y2;
//Set the coordinates for the rectangle to be cleared
x1 = 0;
y1 = 0;
x2 = x1 + this->p_cachedParameters->BackBufferWidth;
y2 = y1 + this->p_cachedParameters->BackBufferHeight;
switch(this->p_cachedParameters->DepthStencilFormat)
{
// TODO: verify
@ -172,7 +176,7 @@ namespace XFX
*(p++) = ((x2-1) << 16) | x1;
*(p++) = ((y2-1) << 16) | y1;
pb_push(p++, NV20_TCL_PRIMITIVE_3D_CLEAR_VALUE_DEPTH, 3); //sets data used to fill in rectangle
*(p++) = depth; //depth to clear
*(p++) = depth; //depth to clear
*(p++) = color.PackedValue(); //color
*(p++) = format; //triggers the HW rectangle fill (only on D&S)
pb_end(p);
@ -191,11 +195,11 @@ namespace XFX
// start of frame-- reset push buffer
pb_reset();
DWORD *p;
DWORD format;
int x1,y1,x2,y2;
DWORD *p;
DWORD format;
int x1, y1, x2, y2;
//Set the coordinates for the rectangle to be cleared
x1 = 0;
y1 = 0;
@ -251,31 +255,34 @@ namespace XFX
}
}
int GraphicsDevice::GetType()
const Type& GraphicsDevice::GetType()
{
return GraphicsDeviceTypeInfo;
}
void GraphicsDevice::Present()
{
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);
}
void GraphicsDevice::raise_DeviceReset(Object* sender, EventArgs* e)
void GraphicsDevice::raise_DeviceReset(Object * const sender, EventArgs * const 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);
}
void GraphicsDevice::raise_Disposing(Object* sender, EventArgs* e)
void GraphicsDevice::raise_Disposing(Object * const sender, EventArgs * const e)
{
Disposing(sender, e);
}
@ -287,9 +294,9 @@ namespace XFX
void GraphicsDevice::Reset(PresentationParameters* presentationParameters)
{
raise_DeviceResetting(this, const_cast<EventArgs*>(EventArgs::Empty));
raise_DeviceResetting(this, EventArgs::Empty);
setPresentationParameters(presentationParameters);
raise_DeviceReset(this, const_cast<EventArgs*>(EventArgs::Empty));
raise_DeviceReset(this, EventArgs::Empty);
}
void GraphicsDevice::SetRenderTarget(RenderTarget2D * const renderTarget)

View File

@ -66,7 +66,7 @@ namespace XFX
isDisposed = true;
Disposing(this, const_cast<EventArgs*>(EventArgs::Empty));
Disposing(this, EventArgs::Empty);
}
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/Texture2D.h>
#include <System/Type.h>
#include <sassert.h>
#include "pbkit.h"
@ -35,6 +37,8 @@ namespace XFX
{
namespace Graphics
{
const Type RenderTarget2DTypeInfo("RenderTarget2D", "XFX::Graphics::RenderTarget2D", TypeCode::Object);
int RenderTarget2D::bufferCount = 0;
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)
: Texture2D(graphicsDevice, width, height, mipmap, TextureUsage::None, preferredFormat)
: Texture2D(graphicsDevice, width, height, mipmap, preferredFormat)
{
//! 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)
: Texture2D(graphicsDevice, width, height, mipmap, TextureUsage::None, preferredFormat)
: Texture2D(graphicsDevice, width, height, mipmap, preferredFormat)
{
//! 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)

View File

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

View File

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

View File

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

View File

@ -30,6 +30,7 @@ extern "C"
#include <xboxkrnl/xboxkrnl.h>
}
#include <xmem.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@ -44,9 +45,9 @@ namespace XFX
{
typedef struct
{
char cDriveLetter;
char* szDevice;
int iPartition;
char cDriveLetter;
char* szDevice;
int iPartition;
}
stDriveMapping;
@ -71,15 +72,15 @@ namespace XFX
if (part_str_len < 19)
{
*cDriveLetter = 0;
return;
*cDriveLetter = 0;
return;
}
part_num = atoi(szPartition + 19);
if (part_num >= EXTEND_PARTITION_BEGIN)
{
*cDriveLetter = extendPartitionMapping[part_num-EXTEND_PARTITION_BEGIN];
return;
*cDriveLetter = extendPartitionMapping[part_num - EXTEND_PARTITION_BEGIN];
return;
}
for (unsigned int i = 0; i < NUM_OF_DRIVES; i++)
{
@ -97,7 +98,7 @@ namespace XFX
return device;
}
bool StorageContainer::IsDisposed()
bool StorageContainer::IsDisposed() const
{
return isDisposed;
}
@ -124,16 +125,16 @@ namespace XFX
isDisposed = true;
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
}
const char* StorageContainer::TitleLocation()
const String StorageContainer::TitleLocation()
{
// 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
@ -141,7 +142,7 @@ namespace XFX
// copy the XeImageFileName to tmp, and strip the \default.xbe
//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* szDest;
@ -153,18 +154,19 @@ namespace XFX
szTemp[XeImageFileName->Length - 29] = 0;
sprintf(szDest, "%c:\\%s", cDriveLetter, szTemp);
return szDest;
}
const char* StorageContainer::TitleName() const
const String StorageContainer::TitleName() const
{
FILE* file = fopen(XeImageFileName->Buffer, "rb");
fseek(file, 0x118, SEEK_SET);
auto_ptr<char> titleName(new char[0x50]);
uint32_t CertAddr = 0;
fseek(file, 0x118, SEEK_SET);
fread(&CertAddr, 4, 1, file);
fseek(file, CertAddr - 0x10000, SEEK_SET);
char* titleName = (char*)malloc(0x50);
fread(titleName, 0x50, 1, file);
fclose(file);

View File

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

View File

@ -60,37 +60,37 @@ namespace XFX
//Texture* Texture::FromFile(GraphicsDevice * const graphicsDevice, const String& filename, TextureCreationParameters creationParameters)
//{
// TextureInformation texinfo = GetTextureInformation(filename);
// if (creationParameters.Width == 0) creationParameters.Width = texinfo.Width;
// if (creationParameters.Height == 0) creationParameters.Height = texinfo.Height;
// if (creationParameters.Depth == 0) creationParameters.Depth = texinfo.Depth;
// if (texinfo.ResourceType == ResourceType::Texture2D)
// {
// int ImgID;
// //Il::ilGenImages(1, out ImgID);
// //Il::ilBindImage(ImgID);
// //Il::ilLoadImage(filename);
// //int width = Il::ilGetInteger(Il::IL_IMAGE_WIDTH);
// //int height = Il::ilGetInteger(Il::IL_IMAGE_HEIGHT);
// //int depth = Il::ilGetInteger(Il::IL_IMAGE_DEPTH);
// //int size = Il::ilGetInteger(Il::IL_IMAGE_SIZE_OF_DATA);
// Texture2D* tex = new Texture2D(graphicsDevice, creationParameters.Width, creationParameters.Height, creationParameters.Depth, TextureUsage::None, SurfaceFormat::Rgb32);
// int texture[1];
// //glGenTextures(1,texture);
// //tex.textureId = texture[0];
// //glBindTexture(GL_TEXTURE_2D, tex.textureId);
// //glTexImage2D(GL_TEXTURE_2D, 0, Il::ilGetInteger(Il::IL_IMAGE_BYTES_PER_PIXEL), creationParameters.Width, creationParameters.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, Il::ilGetData());
// //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
// //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// //Il::ilBindImage(0); */
// //Il::ilDeleteImage(0);
// return tex;
// }
// else if (texinfo.ResourceType == ResourceType::Texture3D) { }
// else if (texinfo.ResourceType == ResourceType::Texture3DVolume) { } //FIXME: Should we handle this here too?
// else if (texinfo.ResourceType == ResourceType::TextureCube) { }
// TextureInformation texinfo = GetTextureInformation(filename);
// if (creationParameters.Width == 0) creationParameters.Width = texinfo.Width;
// if (creationParameters.Height == 0) creationParameters.Height = texinfo.Height;
// if (creationParameters.Depth == 0) creationParameters.Depth = texinfo.Depth;
// if (texinfo.ResourceType == ResourceType::Texture2D)
// {
// int ImgID;
// //Il::ilGenImages(1, out ImgID);
// //Il::ilBindImage(ImgID);
// //Il::ilLoadImage(filename);
// //int width = Il::ilGetInteger(Il::IL_IMAGE_WIDTH);
// //int height = Il::ilGetInteger(Il::IL_IMAGE_HEIGHT);
// //int depth = Il::ilGetInteger(Il::IL_IMAGE_DEPTH);
// //int size = Il::ilGetInteger(Il::IL_IMAGE_SIZE_OF_DATA);
// Texture2D* tex = new Texture2D(graphicsDevice, creationParameters.Width, creationParameters.Height, creationParameters.Depth, TextureUsage::None, SurfaceFormat::Rgb32);
// int texture[1];
// //glGenTextures(1,texture);
// //tex.textureId = texture[0];
// //glBindTexture(GL_TEXTURE_2D, tex.textureId);
// //glTexImage2D(GL_TEXTURE_2D, 0, Il::ilGetInteger(Il::IL_IMAGE_BYTES_PER_PIXEL), creationParameters.Width, creationParameters.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, Il::ilGetData());
// //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
// //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// //Il::ilBindImage(0); */
// //Il::ilDeleteImage(0);
// return tex;
// }
// else if (texinfo.ResourceType == ResourceType::Texture3D) { }
// else if (texinfo.ResourceType == ResourceType::Texture3DVolume) { } //FIXME: Should we handle this here too?
// else if (texinfo.ResourceType == ResourceType::TextureCube) { }
//}
//
//TextureInformation Texture::GetTextureInformation(const String& filename)
//{
// BinaryReader* br;
@ -135,8 +135,9 @@ namespace XFX
// br->Close();
//}
int Texture::GetType()
const Type& Texture::GetType()
{
}
}
}

View File

@ -27,20 +27,23 @@
#include <Graphics/VertexElement.h>
#include <System/String.h>
#include <System/Type.h>
namespace XFX
{
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)
: Offset(offset), UsageIndex(usageIndex),
VertexElementFormat(elementFormat), VertexElementUsage(elementUsage)
VertexElementFormat(elementFormat), VertexElementUsage(elementUsage)
{
}
VertexElement::VertexElement(const VertexElement &obj)
: Offset(obj.Offset), UsageIndex(obj.UsageIndex),
VertexElementFormat(obj.VertexElementFormat), VertexElementUsage(obj.VertexElementUsage)
VertexElementFormat(obj.VertexElementFormat), VertexElementUsage(obj.VertexElementUsage)
{
}
@ -54,9 +57,9 @@ namespace XFX
return (Offset ^ UsageIndex);
}
int VertexElement::GetType()
const Type& VertexElement::GetType()
{
// TODO: implement
return VertexElementTypeInfo;
}
const String VertexElement::ToString() const

View File

@ -39,10 +39,12 @@ namespace XFX
TimeSpan VideoPlayer::getPlayPosition()
{
// TODO: implement remainder
}
MediaState_t VideoPlayer::getState()
{
// TODO: implement remainder
}
Video* VideoPlayer::getVideo()
@ -52,6 +54,7 @@ namespace XFX
VideoPlayer::VideoPlayer()
{
// TODO: implement remainder
}
void VideoPlayer::Dispose()
@ -61,6 +64,7 @@ namespace XFX
void VideoPlayer::Dispose(bool disposing)
{
// TODO: implement remainder
}
Texture2D* VideoPlayer::GetTexture()
@ -70,19 +74,24 @@ namespace XFX
void VideoPlayer::Pause()
{
// TODO: implement remainder
}
void VideoPlayer::Play(Video * const video)
{
sassert(video != null, String::Format("value; %s", FrameworkResources::ArgumentNull_Generic));
// TODO: implement remainder
}
void VideoPlayer::Resume()
{
// TODO: implement remainder
}
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>
<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>
<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>
<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>
@ -54,7 +54,7 @@
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(SolutionDir)include</IncludePath>
<IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);$(SolutionDir)include</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<BuildLog>
@ -79,6 +79,8 @@
<ClCompile Include="BoundingBox.cpp" />
<ClCompile Include="BoundingFrustum.cpp" />
<ClCompile Include="BoundingSphere.cpp" />
<ClCompile Include="DirectionalLight.cpp" />
<ClCompile Include="DynamicSoundEffectInstance.cpp" />
<ClCompile Include="Effect.cpp" />
<ClCompile Include="MathHelper.cpp" />
<ClCompile Include="Matrix.cpp" />
@ -87,6 +89,7 @@
<ClCompile Include="Plane.cpp" />
<ClCompile Include="Point.cpp" />
<ClCompile Include="Quaternion.cpp" />
<ClCompile Include="RasterizerState.cpp" />
<ClCompile Include="Ray.cpp" />
<ClCompile Include="Rectangle.cpp" />
<ClCompile Include="SoundEffectInstance.cpp" />

View File

@ -239,6 +239,15 @@
<ClCompile Include="StorageDeviceAsyncResult.cpp">
<Filter>Source Files\Storage</Filter>
</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>
<ClInclude Include="..\..\include\BoundingBox.h">

View File

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