mirror of
https://github.com/Halofreak1990/XFXFramework
synced 2024-12-26 13:49:34 +01:00
Updated project setup
Tidied-up SpriteBatch header- and source file
This commit is contained in:
parent
04743ed9c5
commit
742b77c545
@ -11,6 +11,7 @@
|
||||
#include "DepthStencilState.h"
|
||||
#include "Effect.h"
|
||||
#include "Enums.h"
|
||||
#include "GraphicsResource.h"
|
||||
#include <Matrix.h>
|
||||
#include "RasterizerState.h"
|
||||
#include "SamplerState.h"
|
||||
@ -38,11 +39,9 @@ namespace XFX
|
||||
/**
|
||||
* Enables a group of sprites to be drawn using the same settings.
|
||||
*/
|
||||
class SpriteBatch : public IDisposable, public Object
|
||||
class SpriteBatch : public GraphicsResource, public Object
|
||||
{
|
||||
private:
|
||||
GraphicsDevice* device;
|
||||
bool isDisposed;
|
||||
bool inBeginEndPair;
|
||||
//SaveStateMode_t saveStateMode;
|
||||
StateBlock* saveState;
|
||||
@ -58,23 +57,17 @@ namespace XFX
|
||||
void restoreRenderState();
|
||||
|
||||
protected:
|
||||
virtual void Dispose(bool disposing);
|
||||
void Dispose(bool disposing);
|
||||
|
||||
public:
|
||||
GraphicsDevice* getGraphicsDevice() const;
|
||||
bool IsDisposed() const;
|
||||
|
||||
EventHandler Disposing;
|
||||
|
||||
SpriteBatch(GraphicsDevice * const graphicsDevice);
|
||||
virtual ~SpriteBatch();
|
||||
|
||||
void Begin();
|
||||
void Begin(SpriteSortMode_t sortMode, const BlendState& blendState);
|
||||
void Begin(SpriteSortMode_t sortMode, const BlendState& blendState, const SamplerState& samplerState, const DepthStencilState& depthStencilState, const RasterizerState& rasterizerState);
|
||||
void Begin(SpriteSortMode_t sortMode, const BlendState& blendState, const SamplerState& samplerState, const DepthStencilState& depthStencilState, const RasterizerState& rasterizerState, Effect* effect);
|
||||
void Begin(SpriteSortMode_t sortMode, const BlendState& blendState, const SamplerState& samplerState, const DepthStencilState& depthStencilState, const RasterizerState& rasterizerState, Effect* effect, Matrix transformMatrix);
|
||||
void Dispose();
|
||||
void Begin(SpriteSortMode_t sortMode, const BlendState& blendState, const SamplerState& samplerState, const DepthStencilState& depthStencilState, const RasterizerState& rasterizerState, Effect * const effect);
|
||||
void Begin(SpriteSortMode_t sortMode, const BlendState& blendState, const SamplerState& samplerState, const DepthStencilState& depthStencilState, const RasterizerState& rasterizerState, Effect * const effect, const Matrix transformMatrix);
|
||||
void Draw(Texture2D * const texture, const Rectangle destinationRectangle, Color color);
|
||||
void Draw(Texture2D * const texture, const Rectangle destinationRectangle, const Nullable<Rectangle> sourceRectangle, Color color);
|
||||
void Draw(Texture2D * const texture, const Vector2 position, const Color color);
|
||||
|
@ -21,6 +21,11 @@ namespace System
|
||||
{
|
||||
}
|
||||
|
||||
Nullable(T const * const newData)
|
||||
: data(const_cast<T*>(newData))
|
||||
{
|
||||
}
|
||||
|
||||
Nullable(const Nullable<T> &obj)
|
||||
: data(obj.data)
|
||||
{
|
||||
|
@ -25,7 +25,8 @@ namespace System
|
||||
HANDLE system_thread_handle;
|
||||
PKSTART_ROUTINE callback;
|
||||
int stack_size;
|
||||
static ULONG Id;
|
||||
static ULONG GlobalId;
|
||||
ULONG Id;
|
||||
PULONG suspendCount;
|
||||
|
||||
ThreadState_t state;
|
||||
@ -34,25 +35,25 @@ namespace System
|
||||
void Thread_init();
|
||||
|
||||
public:
|
||||
//Creates a new instance of the Thread class with the specified callback function, but doesn't start yet.
|
||||
// Initializes a new instance of the Thread class with the specified callback function, but doesn't start yet.
|
||||
Thread(PKSTART_ROUTINE callBack);
|
||||
//Creates a new instance of the Thread class with the specified callback function and stack size, but doesn't start yet.
|
||||
// Initializes a new instance of the Thread class with the specified callback function and stack size, but doesn't start yet.
|
||||
Thread(PKSTART_ROUTINE callBack, int stackSize);
|
||||
~Thread();
|
||||
|
||||
void Abort();
|
||||
void Interrupt();
|
||||
//Returns a value indicating whether the thread is running
|
||||
// Returns a value indicating whether the thread is running
|
||||
bool IsAlive();
|
||||
//Resumes a previously suspended thread.
|
||||
// Resumes a previously suspended thread.
|
||||
void Resume();
|
||||
//Set the thread priority, valid values are 0 (Low), 16 (Low_RealTime), 31 (High), 32 (Maximum)
|
||||
// Set the thread priority, valid values are 0 (Low), 16 (Low_RealTime), 31 (High), 32 (Maximum)
|
||||
void SetPriority(int priority);
|
||||
static void Sleep(int millisecondsTimeout);
|
||||
static void Sleep(TimeSpan timeout);
|
||||
//Start executing the thread.
|
||||
// Start executing the thread.
|
||||
void Start();
|
||||
//Suspend the thread execution, call Thread::Resume() to resume the thread.
|
||||
// Suspend the thread execution, call Thread::Resume() to resume the thread.
|
||||
void Suspend();
|
||||
};
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ namespace System
|
||||
void SetValue(DependencyProperty<T *> p, T * const value)
|
||||
{
|
||||
if (!dependencyProperties.ContainsKey(p.Name))
|
||||
dependencyProperties.Add(p.Name, value)
|
||||
dependencyProperties.Add(p.Name, value);
|
||||
else
|
||||
dependencyProperties[p.Name] = value;
|
||||
}
|
||||
|
1119
include/intrin.h
Normal file
1119
include/intrin.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,13 +2,13 @@
|
||||
# update this variable to wherever you installed the OpenXDK libraries
|
||||
#
|
||||
#########################################################################
|
||||
PREFIX = /openxdk
|
||||
PREFIX = /usr/local/openxdk
|
||||
|
||||
CC = xbox-gcc
|
||||
CCAS = xbox-gcc
|
||||
CPP = xbox-g++
|
||||
AR = xbox-ar rcu
|
||||
RANLIB = xbox-ranlib
|
||||
CC = gcc
|
||||
CCAS = gcc
|
||||
CPP = g++
|
||||
AR = ar rcu
|
||||
RANLIB = ranlib
|
||||
CXBE = $(PREFIX)/bin/cxbe
|
||||
|
||||
SDLFLAGS = -DENABLE_XBOX -DDEBUG
|
||||
|
@ -39,10 +39,10 @@
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||
<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\bin\make -f makefile all 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeBuildCommandLine>
|
||||
<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\bin\make -f makefile rebuild 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeReBuildCommandLine>
|
||||
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\bin\make -f makefile clean 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeCleanCommandLine>
|
||||
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile all 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeBuildCommandLine>
|
||||
<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile rebuild 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeReBuildCommandLine>
|
||||
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile clean 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeCleanCommandLine>
|
||||
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">libSystem.xml.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>
|
||||
|
@ -38,10 +38,10 @@
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||
<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\bin\make -f makefile all 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeBuildCommandLine>
|
||||
<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\bin\make -f makefile rebuild 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeReBuildCommandLine>
|
||||
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\bin\make -f makefile clean 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeCleanCommandLine>
|
||||
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile all 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeBuildCommandLine>
|
||||
<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile rebuild 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeReBuildCommandLine>
|
||||
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile clean 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeCleanCommandLine>
|
||||
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">libSystem.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>
|
||||
|
@ -215,10 +215,12 @@ namespace XFX
|
||||
{
|
||||
// clear the depth buffer
|
||||
}
|
||||
|
||||
if ((options & ClearOptions::Stencil) != 0)
|
||||
{
|
||||
// clear the stencil buffer
|
||||
}
|
||||
|
||||
if ((options & ClearOptions::Target) != 0)
|
||||
{
|
||||
// clear the current render target
|
||||
|
@ -62,7 +62,9 @@ namespace XFX
|
||||
void GraphicsResource::Dispose(bool disposing)
|
||||
{
|
||||
if(isDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
isDisposed = true;
|
||||
|
||||
|
@ -53,8 +53,8 @@ namespace XFX
|
||||
const Type SpriteBatchTypeInfo("SpriteBatch", "XFX::Graphics::SpriteBatch", TypeCode::Object);
|
||||
|
||||
SpriteBatch::SpriteBatch(GraphicsDevice * const graphicsDevice)
|
||||
: device(graphicsDevice)
|
||||
{
|
||||
this->graphicsDevice = graphicsDevice;
|
||||
}
|
||||
|
||||
SpriteBatch::~SpriteBatch()
|
||||
@ -62,16 +62,6 @@ namespace XFX
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
GraphicsDevice* SpriteBatch::getGraphicsDevice() const
|
||||
{
|
||||
return device;
|
||||
}
|
||||
|
||||
bool SpriteBatch::IsDisposed() const
|
||||
{
|
||||
return isDisposed;
|
||||
}
|
||||
|
||||
void SpriteBatch::Begin()
|
||||
{
|
||||
Begin(SpriteSortMode::Deferred, BlendState::AlphaBlend);
|
||||
@ -97,43 +87,41 @@ namespace XFX
|
||||
sassert(!inBeginEndPair, "Begin cannot be called again until End has been successfully called.");
|
||||
|
||||
spriteSortMode = sortMode;
|
||||
|
||||
if (sortMode == SpriteSortMode::Immediate)
|
||||
{
|
||||
applyGraphicsDeviceSettings();
|
||||
}
|
||||
|
||||
inBeginEndPair = true;
|
||||
}
|
||||
|
||||
|
||||
void SpriteBatch::Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && !isDisposed)
|
||||
if (disposing && !IsDisposed())
|
||||
{
|
||||
Disposing(this, EventArgs::Empty);
|
||||
// TODO: dispose of resources
|
||||
}
|
||||
isDisposed = true;
|
||||
|
||||
GraphicsResource::Dispose(disposing);
|
||||
}
|
||||
|
||||
void SpriteBatch::Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
|
||||
void SpriteBatch::Draw(Texture2D * const texture, const Rectangle destinationRectangle, const Color color)
|
||||
{
|
||||
Draw(texture, destinationRectangle, Rectangle::Empty, color, 0.0f, Vector2::Zero, SpriteEffects::None, 0.0f);
|
||||
Draw(texture, destinationRectangle, NULL, color, 0.0f, Vector2::Zero, SpriteEffects::None, 0.0f);
|
||||
}
|
||||
|
||||
void SpriteBatch::Draw(Texture2D * const texture, const Vector2 position, const Color color)
|
||||
{
|
||||
Rectangle destination = Rectangle((int)position.X, (int)position.Y, texture->Width, texture->Height);
|
||||
Draw(texture, destination, Rectangle::Empty, color, 0.0f, Vector2::Zero, SpriteEffects::None, 0.0f);
|
||||
Draw(texture, destination, NULL, color, 0.0f, Vector2::Zero, SpriteEffects::None, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
void SpriteBatch::Draw(Texture2D * const texture, const Rectangle destinationRectangle, const Nullable<Rectangle> sourceRectangle, const Color color)
|
||||
{
|
||||
Draw(texture, destinationRectangle, sourceRectangle, color, 0.0f, Vector2::Zero, SpriteEffects::None, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
void SpriteBatch::Draw(Texture2D * const texture, const Vector2 position, const Nullable<Rectangle> sourceRectangle, const Color color)
|
||||
{
|
||||
Rectangle destination = Rectangle((int)position.X, (int)position.Y, texture->Width, texture->Height);
|
||||
@ -154,13 +142,16 @@ namespace XFX
|
||||
SpriteList.Add(sprite);
|
||||
|
||||
if (spriteSortMode == SpriteSortMode::Immediate)
|
||||
{
|
||||
Flush();
|
||||
}
|
||||
}
|
||||
|
||||
void SpriteBatch::Draw(Texture2D * const texture, const Vector2 position, const Nullable<Rectangle> sourceRectangle, const Color color, const float rotation, const Vector2 origin, const Vector2 scale, const SpriteEffects_t effects, const float layerDepth)
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
|
||||
if (sourceRectangle.HasValue())
|
||||
{
|
||||
width = (int)(sourceRectangle.getValue().Width * scale.X);
|
||||
@ -171,14 +162,16 @@ namespace XFX
|
||||
width = (int)(texture->Width * scale.X);
|
||||
height = (int)(texture->Height * scale.Y);
|
||||
}
|
||||
|
||||
Rectangle destination = Rectangle((int)position.X, (int)position.Y, width, height);
|
||||
Draw(texture, destination, sourceRectangle, color, rotation, origin, effects, layerDepth);
|
||||
}
|
||||
|
||||
|
||||
void SpriteBatch::Draw(Texture2D * const texture, const Vector2 position, const Nullable<Rectangle> sourceRectangle, const Color color, const float rotation, const Vector2 origin, const float scale, const SpriteEffects_t effects, const float layerDepth)
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
|
||||
if (sourceRectangle.HasValue())
|
||||
{
|
||||
width = (int)(sourceRectangle.getValue().Width * scale);
|
||||
@ -189,12 +182,13 @@ namespace XFX
|
||||
width = (int)(texture->Width * scale);
|
||||
height = (int)(texture->Height * scale);
|
||||
}
|
||||
|
||||
Rectangle destination = Rectangle((int)position.X, (int)position.Y, width, height);
|
||||
Draw(texture, destination, sourceRectangle, color, rotation, origin, effects, layerDepth);
|
||||
}
|
||||
|
||||
|
||||
void SpriteBatch::DrawString(SpriteFont * const spriteFont, String& text, const Vector2 position, const Color color)
|
||||
{
|
||||
{
|
||||
spriteFont->Draw(text, this, position, color, 0.0f, Vector2::Zero, Vector2::One, SpriteEffects::None, 0.0f);
|
||||
}
|
||||
|
||||
@ -202,7 +196,7 @@ namespace XFX
|
||||
{
|
||||
spriteFont->Draw(text, this, position, color, rotation, origin, scale, effects, layerDepth);
|
||||
}
|
||||
|
||||
|
||||
void SpriteBatch::DrawString(SpriteFont * const spriteFont, String& text, const Vector2 position, const Color color, const float rotation, const Vector2 origin, const float scale, const SpriteEffects_t effects, const float layerDepth)
|
||||
{
|
||||
Vector2 vector = Vector2::Zero;
|
||||
@ -210,9 +204,9 @@ namespace XFX
|
||||
vector.Y = scale;
|
||||
spriteFont->Draw(text, this, position, color, rotation, origin, vector, effects, layerDepth);
|
||||
}
|
||||
|
||||
|
||||
void SpriteBatch::End()
|
||||
{
|
||||
{
|
||||
sassert(inBeginEndPair, "Begin must be called successfully before End can be called.");
|
||||
|
||||
if (spriteSortMode != SpriteSortMode::Immediate)
|
||||
@ -226,7 +220,7 @@ namespace XFX
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();*/
|
||||
|
||||
|
||||
restoreRenderState();
|
||||
|
||||
inBeginEndPair = false;
|
||||
|
@ -71,6 +71,7 @@ namespace System
|
||||
#if ENABLE_XBOX
|
||||
const char* Environment::NewLine = "\r\n";
|
||||
#else
|
||||
const char* Environment::NewLine = "\n";
|
||||
#endif
|
||||
|
||||
OperatingSystem Environment::OSVersion()
|
||||
|
@ -31,21 +31,21 @@ namespace System
|
||||
{
|
||||
namespace Threading
|
||||
{
|
||||
ULONG Thread::Id = 0;
|
||||
|
||||
ULONG Thread::GlobalId = 0;
|
||||
|
||||
void Thread::Thread_init()
|
||||
{
|
||||
PsCreateSystemThreadEx(&system_thread_handle, //Thread Handle
|
||||
0, //KernelStackSize
|
||||
stack_size, //Stack Size
|
||||
0, //TlsDataSize
|
||||
&Id, //Thread ID
|
||||
NULL, //StartContext1
|
||||
NULL, //StartContext2
|
||||
TRUE, //CreateSuspended
|
||||
FALSE, //DebugStack
|
||||
(PKSTART_ROUTINE)&callback); //StartRoutine
|
||||
|
||||
PsCreateSystemThreadEx(&system_thread_handle, // Thread Handle
|
||||
0, // KernelStackSize
|
||||
stack_size, // Stack Size
|
||||
0, // TlsDataSize
|
||||
&Id, // Thread ID
|
||||
NULL, // StartContext1
|
||||
NULL, // StartContext2
|
||||
TRUE, // CreateSuspended
|
||||
FALSE, // DebugStack
|
||||
(PKSTART_ROUTINE)&callback); // StartRoutine
|
||||
|
||||
ObReferenceObjectByHandle(system_thread_handle, (POBJECT_TYPE)PsThreadObjectType, &system_thread_handle);
|
||||
|
||||
//#define LOW_PRIORITY 0
|
||||
@ -54,10 +54,10 @@ namespace System
|
||||
//#define MAXIMUM_PRIORITY 32
|
||||
|
||||
KeSetBasePriorityThread((PKTHREAD)system_thread_handle, (PVOID)0); //Default the thread to low priority
|
||||
|
||||
|
||||
state = ThreadState::Unstarted;
|
||||
|
||||
Id++; //increment Id so every thread Id is unique
|
||||
|
||||
Id = GlobalId++; //increment Id so every thread Id is unique
|
||||
}
|
||||
|
||||
void Thread::Abort()
|
||||
@ -76,8 +76,10 @@ namespace System
|
||||
Thread::Thread(PKSTART_ROUTINE callBack, int stackSize)
|
||||
{
|
||||
if(stackSize < 131072)
|
||||
{
|
||||
stack_size = 65536; //Default stack size is 65536, which should be enough, unless there is need for a > 128k stack.
|
||||
|
||||
}
|
||||
|
||||
stack_size = stackSize;
|
||||
callback = callBack;
|
||||
Thread_init();
|
||||
@ -91,17 +93,21 @@ namespace System
|
||||
|
||||
void Thread::SetPriority(int priority)
|
||||
{
|
||||
if((priority != 0) && (priority != 16) && (priority != 31) && (priority != 32))
|
||||
if ((priority != 0) && (priority != 16) && (priority != 31) && (priority != 32))
|
||||
{
|
||||
return; //no valid values
|
||||
|
||||
}
|
||||
|
||||
ObReferenceObjectByHandle(system_thread_handle, (POBJECT_TYPE)PsThreadObjectType, &system_thread_handle);
|
||||
KeSetBasePriorityThread((PKTHREAD)system_thread_handle, (PVOID)priority);
|
||||
}
|
||||
|
||||
void Thread::Sleep(int millisecondsTimeout)
|
||||
{
|
||||
if(millisecondsTimeout <= 0)
|
||||
if (millisecondsTimeout <= 0)
|
||||
{
|
||||
return; //no reason to sleep. We could also throw an ArgumentOutOfRangeException, but what's the point in that?
|
||||
}
|
||||
|
||||
LARGE_INTEGER pli;
|
||||
|
||||
@ -113,7 +119,9 @@ namespace System
|
||||
void Thread::Sleep(TimeSpan timeout)
|
||||
{
|
||||
if(timeout == TimeSpan::Zero)
|
||||
{
|
||||
return; //! no reason to sleep
|
||||
}
|
||||
|
||||
LARGE_INTEGER pli;
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make clean 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeCleanCommandLine>
|
||||
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">libmscorlib.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>
|
||||
<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\devKitPro\msys\local\openxdk\include;C:\devKitPro\msys\local\openxdk\i386-pc-xbox\include;C:\devKitPro\msys\local\openxdk\include\SDL;$(SolutionDir)include;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
|
||||
<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
|
||||
<NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
|
||||
<NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
|
||||
@ -55,7 +55,7 @@
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>C:\cygwin\usr\include;C:\cygwin\usr\local\openxdk\i386-pc-xbox\include;C:\cygwin\usr\local\openxdk\include;C:\cygwin\usr\local\openxdk\include\SDL;$(SolutionDir)include</IncludePath>
|
||||
<IncludePath>C:\devKitPro\msys\include;C:\devKitPro\msys\local\openxdk\i386-pc-xbox\include;C:\devKitPro\msys\local\openxdk\include;C:\devKitPro\msys\local\openxdk\include\SDL;$(SolutionDir)include</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<BuildLog>
|
||||
|
@ -26,7 +26,7 @@ LD_FLAGS = $(CLINK) $(ALIGN) $(SHARED) $(ENTRYPOINT) $(STRIP)
|
||||
LD_DIRS = -L$(PREFIX)/i386-pc-xbox/lib -L$(PREFIX)/lib
|
||||
LD_LIBS = $(LD_DIRS) -lm -lopenxdk -lhal -lc -lusb -lc -lxboxkrnl -lc -lhal -lxboxkrnl -lhal -lopenxdk -lc -lgcc -lstdc++
|
||||
|
||||
OBJS = BinaryReader.o BinaryWriter.o BitConverter.o Boolean.o Byte.o Calendar.o Comparer.o Console.o DateTime.o DaylightTime.o Directory.o DirectoryInfo.o Double.o Environment.o EventArgs.o File.o FileStream.o FrameworkResources.o Int32.o Int64.o Math.o Object.o OperatingSystem.o Path.o sassert.o SByte.o Single.o Stream.o StreamAsyncResult.o StreamReader.o StreamWriter.o String.o StringBuilder.o Thread.o TimeSpan.o UInt16.o UInt32.o UInt64.o Version.o
|
||||
OBJS = BinaryReader.o BinaryWriter.o BitConverter.o Boolean.o Byte.o Calendar.o Comparer.o Console.o DateTime.o DaylightTime.o Directory.o DirectoryInfo.o Double.o Environment.o EventArgs.o File.o FileStream.o FrameworkResources.o Int32.o Int64.o Math.o Object.o OperatingSystem.o Path.o sassert.o SByte.o Single.o Stream.o StreamAsyncResult.o StreamReader.o StreamWriter.o String.o StringBuilder.o Thread.o TimeSpan.o Type.o UInt16.o UInt32.o UInt64.o Version.o
|
||||
|
||||
all: libmscorlib.a
|
||||
|
||||
|
@ -6,9 +6,9 @@
|
||||
void __sassert(const char *fileName, int lineNumber, const char* conditionString, const char* message)
|
||||
{
|
||||
debugClearScreen();
|
||||
debugPrint("\tAssertion!\n\tFile: \n%s\n\nLine: %d\n\nCondition:\n%s\n\n\t%s", fileName, lineNumber, conditionString, message);
|
||||
debugPrint("\tAssertion!\n\tFile: \n%s\n\nLine: %d\n\nCondition:\n%s\n\n\t%s", fileName, lineNumber, conditionString, message);
|
||||
|
||||
XSleep(100);
|
||||
|
||||
__asm__ ("cli\nhlt");
|
||||
__asm__ ("cli\nhlt");
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
#########################################################################
|
||||
PREFIX = /usr/local/openxdk
|
||||
XFX_PREFIX = /cygdrive/j/XFX
|
||||
XFX_PREFIX = /usr/local/XFX
|
||||
|
||||
CC = gcc
|
||||
CCAS = gcc
|
||||
|
Loading…
x
Reference in New Issue
Block a user