Merge with PMS loading code. Though the notes load now, the samples are in Microsoft ADPCM which can't be loaded correctly at this time.
This commit is contained in:
@@ -13,6 +13,10 @@ _____________________________________________________________________________
|
||||
sm-ssc v1.2.4 | 20110???
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
20110320
|
||||
--------
|
||||
* [PlayerOptions] Added SetNoteSkin(string) Lua binding. [AJ]
|
||||
|
||||
20110317
|
||||
--------
|
||||
* [ScreenEdit] Fix bug number 222, where Steps disappeared if they weren't
|
||||
|
||||
+6
-7
@@ -4,7 +4,7 @@ sm-ssc credits (in no particular order)
|
||||
* If you have any corrections to this list, let us know (via forums or IRC).
|
||||
|
||||
==the spinal shark collective==
|
||||
AJ Kelly
|
||||
AJ Kelly (freem)
|
||||
* Main programming
|
||||
* UserPreferences and some other Lua scripts
|
||||
* Some small theme edits here and there
|
||||
@@ -43,7 +43,10 @@ FSX
|
||||
Nicole Reid (okeeblow)
|
||||
* Tested building sm-ssc on FreeBSD, provided fixes.
|
||||
|
||||
Wolfman
|
||||
Thai Pangsakulyanont (theDtTvB)
|
||||
* Various changes to BMS support to make things work better.
|
||||
|
||||
Jason Felds (Wolfman2000)
|
||||
* [Player] PercentUntilColorCombo metric
|
||||
* Mac OS X maintainer
|
||||
* Various fixes/changes. (see Changelog_sm-ssc.txt for more details)
|
||||
@@ -76,10 +79,6 @@ v1toko
|
||||
Macgravel
|
||||
* Orbular noteskin (the default kb7 noteskin)
|
||||
|
||||
theDtTvB
|
||||
* Keysound patch (http://share11.appspot.com/20421)
|
||||
[This patch is currently causing crashes for us, sadly.]
|
||||
|
||||
sy567
|
||||
* Small beginner helper fix
|
||||
(http://www.stepmania.com/forums/showpost.php?p=158721&postcount=12)
|
||||
@@ -145,4 +144,4 @@ NitroX72
|
||||
Wanny
|
||||
Tio
|
||||
Cerbo
|
||||
Daisuke Master
|
||||
Daisuke Master
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ class XNode;
|
||||
class AutoActor
|
||||
{
|
||||
public:
|
||||
AutoActor() { m_pActor = NULL; }
|
||||
AutoActor(): m_pActor(NULL) {}
|
||||
~AutoActor() { Unload(); }
|
||||
AutoActor( const AutoActor &cpy );
|
||||
AutoActor &operator =( const AutoActor &cpy );
|
||||
|
||||
+20
-14
@@ -27,15 +27,26 @@ struct BackgroundDef
|
||||
RString m_sColor2; // "" == use default
|
||||
|
||||
XNode *CreateNode() const;
|
||||
|
||||
/** @brief Set up the BackgroundDef with default values. */
|
||||
BackgroundDef(): m_sEffect(""), m_sFile1(""), m_sFile2(""),
|
||||
m_sColor1(""), m_sColor2("") {}
|
||||
|
||||
/**
|
||||
* @brief Set up the BackgroundDef with some defined values.
|
||||
* @param effect the intended effect.
|
||||
* @param f1 the primary filename for the definition.
|
||||
* @param f2 the secondary filename (optional). */
|
||||
BackgroundDef(RString effect, RString f1, RString f2):
|
||||
m_sEffect(effect), m_sFile1(f1), m_sFile2(f2),
|
||||
m_sColor1(""), m_sColor2("") {}
|
||||
};
|
||||
|
||||
struct BackgroundChange
|
||||
{
|
||||
BackgroundChange()
|
||||
{
|
||||
m_fStartBeat=-1;
|
||||
m_fRate=1;
|
||||
}
|
||||
BackgroundChange(): m_def(), m_fStartBeat(-1), m_fRate(1),
|
||||
m_sTransition("") {}
|
||||
|
||||
BackgroundChange(
|
||||
float s,
|
||||
RString f1,
|
||||
@@ -43,15 +54,10 @@ struct BackgroundChange
|
||||
float r=1.f,
|
||||
RString e=SBE_Centered,
|
||||
RString t=RString()
|
||||
)
|
||||
{
|
||||
m_fStartBeat=s;
|
||||
m_def.m_sFile1=f1;
|
||||
m_def.m_sFile2=f2;
|
||||
m_fRate=r;
|
||||
m_def.m_sEffect=e;
|
||||
m_sTransition=t;
|
||||
}
|
||||
):
|
||||
m_def(e, f1, f2), m_fStartBeat(s),
|
||||
m_fRate(r), m_sTransition(t) {}
|
||||
|
||||
BackgroundDef m_def;
|
||||
float m_fStartBeat;
|
||||
float m_fRate;
|
||||
|
||||
+4
-8
@@ -230,17 +230,13 @@ struct BannerTexture: public RageTexture
|
||||
m_iTextureWidth = m_iImageWidth = m_pImage->w;
|
||||
m_iTextureHeight = m_iImageHeight = m_pImage->h;
|
||||
|
||||
/* Find a supported texture format. If it happens to match the stored
|
||||
* file, we won't have to do any conversion here, and that'll happen often
|
||||
* with paletted images. */
|
||||
#if !defined(XBOX)
|
||||
/* Find a supported texture format. If it happens to match the stored
|
||||
* file, we won't have to do any conversion here, and that'll happen
|
||||
* often with paletted images. */
|
||||
PixelFormat pf = m_pImage->format->BitsPerPixel == 8? PixelFormat_PAL: PixelFormat_RGB5A1;
|
||||
if( !DISPLAY->SupportsTextureFormat(pf) )
|
||||
pf = PixelFormat_RGBA4;
|
||||
#else
|
||||
// xbox display currently supports only rgba8
|
||||
PixelFormat pf = PixelFormat_RGBA8;
|
||||
#endif
|
||||
|
||||
ASSERT( DISPLAY->SupportsTextureFormat(pf) );
|
||||
|
||||
ASSERT(m_pImage);
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ public:
|
||||
|
||||
struct Attribute
|
||||
{
|
||||
Attribute() : length(-1) { }
|
||||
Attribute() : length(-1), glow() { }
|
||||
int length;
|
||||
RageColor diffuse[4];
|
||||
RageColor glow;
|
||||
|
||||
@@ -16,10 +16,13 @@ public:
|
||||
struct Arg
|
||||
{
|
||||
RString s;
|
||||
Arg(): s("") {}
|
||||
};
|
||||
Arg GetArg( unsigned index ) const;
|
||||
|
||||
vector<RString> m_vsArgs;
|
||||
|
||||
Command(): m_vsArgs() {}
|
||||
};
|
||||
|
||||
class Commands
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@
|
||||
class ThemeMetricDifficultiesToShow : public ThemeMetric<RString>
|
||||
{
|
||||
public:
|
||||
ThemeMetricDifficultiesToShow() { }
|
||||
ThemeMetricDifficultiesToShow(): m_v() { }
|
||||
ThemeMetricDifficultiesToShow( const RString& sGroup, const RString& sName );
|
||||
void Read();
|
||||
const vector<Difficulty> &GetValue() const;
|
||||
@@ -21,7 +21,7 @@ private:
|
||||
class ThemeMetricCourseDifficultiesToShow : public ThemeMetric<RString>
|
||||
{
|
||||
public:
|
||||
ThemeMetricCourseDifficultiesToShow() { }
|
||||
ThemeMetricCourseDifficultiesToShow(): m_v() { }
|
||||
ThemeMetricCourseDifficultiesToShow( const RString& sGroup, const RString& sName );
|
||||
void Read();
|
||||
const vector<CourseDifficulty> &GetValue() const;
|
||||
@@ -31,7 +31,7 @@ private:
|
||||
class ThemeMetricStepsTypesToShow : public ThemeMetric<RString>
|
||||
{
|
||||
public:
|
||||
ThemeMetricStepsTypesToShow() { }
|
||||
ThemeMetricStepsTypesToShow(): m_v() { }
|
||||
ThemeMetricStepsTypesToShow( const RString& sGroup, const RString& sName );
|
||||
void Read();
|
||||
const vector<StepsType> &GetValue() const;
|
||||
|
||||
+14
-2
@@ -88,9 +88,18 @@ int CourseEntry::GetNumModChanges() const
|
||||
|
||||
|
||||
|
||||
Course::Course()
|
||||
Course::Course(): m_bIsAutogen(false), m_sPath(""), m_sMainTitle(""),
|
||||
m_sMainTitleTranslit(""), m_sSubTitle(""), m_sSubTitleTranslit(""),
|
||||
m_sBannerPath(""), m_sBackgroundPath(""), m_sCDTitlePath(""),
|
||||
m_sGroupName(""), m_bRepeat(false), m_fGoalSeconds(0),
|
||||
m_bShuffle(false), m_iLives(-1), m_bSortByMeter(false),
|
||||
m_bIncomplete(false), m_vEntries(), m_SortOrder_TotalDifficulty(0),
|
||||
m_SortOrder_Ranking(0), m_LoadedFromProfile(ProfileSlot_Invalid),
|
||||
m_TrailCache(), m_iTrailCacheSeed(0), m_RadarCache(),
|
||||
m_setStyles(), m_CachedObject()
|
||||
{
|
||||
Init();
|
||||
FOREACH_ENUM( Difficulty,dc)
|
||||
m_iCustomMeter[dc] = -1;
|
||||
}
|
||||
|
||||
CourseType Course::GetCourseType() const
|
||||
@@ -239,6 +248,9 @@ struct SortTrailEntry
|
||||
{
|
||||
TrailEntry entry;
|
||||
int SortMeter;
|
||||
|
||||
SortTrailEntry(): entry(), SortMeter(0) {}
|
||||
|
||||
bool operator< ( const SortTrailEntry &rhs ) const { return SortMeter < rhs.SortMeter; }
|
||||
};
|
||||
|
||||
|
||||
+6
-2
@@ -55,9 +55,11 @@ public:
|
||||
float fGainSeconds; // time gained back at the beginning of the song. LifeMeterTime only.
|
||||
int iGainLives; // lives gained back at the beginning of the next song
|
||||
|
||||
CourseEntry(): bSecret(false), bNoDifficult(false),
|
||||
CourseEntry(): bSecret(false), songID(), songCriteria(),
|
||||
stepsCriteria(), bNoDifficult(false),
|
||||
songSort(SongSort_Randomize), iChooseIndex(0),
|
||||
sModifiers(RString("")), fGainSeconds(0), iGainLives(-1) {}
|
||||
sModifiers(RString("")), attacks(), fGainSeconds(0),
|
||||
iGainLives(-1) {}
|
||||
|
||||
bool IsFixedSong() const { return songID.IsValid(); }
|
||||
|
||||
@@ -187,6 +189,8 @@ public:
|
||||
{
|
||||
Trail trail;
|
||||
bool null;
|
||||
|
||||
CacheData(): trail(), null(false) {}
|
||||
};
|
||||
typedef map<CacheEntry, CacheData> TrailCache_t;
|
||||
mutable TrailCache_t m_TrailCache;
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ namespace EditCourseUtil
|
||||
class CourseID
|
||||
{
|
||||
public:
|
||||
CourseID() { Unset(); }
|
||||
CourseID(): sPath(""), sFullTitle(""), m_Cache() { Unset(); }
|
||||
void Unset() { FromCourse(NULL); }
|
||||
void FromCourse( const Course *p );
|
||||
Course *ToCourse() const;
|
||||
|
||||
@@ -43,10 +43,11 @@ const float MODEL_X_ONE_PLAYER = 0;
|
||||
const float MODEL_X_TWO_PLAYERS[NUM_PLAYERS] = { +8, -8 };
|
||||
const float MODEL_ROTATIONY_TWO_PLAYERS[NUM_PLAYERS] = { -90, 90 };
|
||||
|
||||
DancingCharacters::DancingCharacters()
|
||||
DancingCharacters::DancingCharacters(): m_bDrawDangerLight(false),
|
||||
m_CameraDistance(0), m_CameraPanYStart(0), m_CameraPanYEnd(0),
|
||||
m_fLookAtHeight(0), m_fCameraHeightStart(0), m_fCameraHeightEnd(0),
|
||||
m_fThisCameraStartBeat(0), m_fThisCameraEndBeat(0)
|
||||
{
|
||||
m_bDrawDangerLight = false;
|
||||
|
||||
FOREACH_PlayerNumber( p )
|
||||
{
|
||||
m_pCharacter[p] = new Model;
|
||||
|
||||
+3
-8
@@ -220,14 +220,9 @@ int Font::GetLineHeightInSourcePixels( const wstring &szLine ) const
|
||||
}
|
||||
|
||||
|
||||
Font::Font()
|
||||
{
|
||||
m_iRefCount = 1;
|
||||
m_pDefault = NULL;
|
||||
m_bRightToLeft = false;
|
||||
// [sm-ssc] don't show strokes by default
|
||||
m_DefaultStrokeColor = RageColor(0,0,0,0);
|
||||
}
|
||||
Font::Font(): m_iRefCount(1), path(""), m_apPages(), m_pDefault(NULL),
|
||||
m_bRightToLeft(false), m_DefaultStrokeColor(RageColor(0,0,0,0)),
|
||||
m_sChars("") {} // strokes aren't shown by default, hence the Color.
|
||||
|
||||
Font::~Font()
|
||||
{
|
||||
|
||||
+6
-6
@@ -23,11 +23,7 @@ struct FontPageTextures
|
||||
RageTexture *m_pTextureStroke;
|
||||
|
||||
/** @brief Set up the initial textures. */
|
||||
FontPageTextures()
|
||||
{
|
||||
m_pTextureMain = NULL;
|
||||
m_pTextureStroke = NULL;
|
||||
}
|
||||
FontPageTextures(): m_pTextureMain(NULL), m_pTextureStroke(NULL) {}
|
||||
};
|
||||
|
||||
/** @brief The components of a glyph (not technically a character). */
|
||||
@@ -52,6 +48,10 @@ struct glyph
|
||||
|
||||
/** @brief Texture coordinate rect. */
|
||||
RectF m_TexRect;
|
||||
|
||||
/** @brief Set up the glyph with default values. */
|
||||
glyph() : m_pPage(NULL), m_FontPageTextures(), m_iHadvance(0),
|
||||
m_fWidth(0), m_fHeight(0), m_fHshift(0), m_TexRect() {}
|
||||
};
|
||||
|
||||
/** @brief The settings used for the FontPage. */
|
||||
@@ -75,7 +75,7 @@ struct FontPageSettings
|
||||
map<int,int> m_mapGlyphWidths;
|
||||
|
||||
/** @brief The initial settings for the FontPage. */
|
||||
FontPageSettings():
|
||||
FontPageSettings(): m_sTexturePath(""),
|
||||
m_iDrawExtraPixelsLeft(0), m_iDrawExtraPixelsRight(0),
|
||||
m_iAddToAllWidths(0),
|
||||
m_iLineSpacing(-1),
|
||||
|
||||
+21
-1
@@ -22,7 +22,27 @@ struct lua_State;
|
||||
class GameCommand
|
||||
{
|
||||
public:
|
||||
GameCommand() { Init(); }
|
||||
GameCommand(): m_Commands(), m_sName(""), m_sText(""),
|
||||
m_bInvalid(true), m_sInvalidReason(""),
|
||||
m_iIndex(-1), m_MultiPlayer(MultiPlayer_Invalid),
|
||||
m_pStyle(NULL), m_pm(PlayMode_Invalid),
|
||||
m_dc(Difficulty_Invalid),
|
||||
m_CourseDifficulty(Difficulty_Invalid),
|
||||
m_sAnnouncer(""), m_sPreferredModifiers(""),
|
||||
m_sStageModifiers(""), m_sScreen(""), m_LuaFunction(),
|
||||
m_pSong(NULL), m_pSteps(NULL), m_pCourse(NULL),
|
||||
m_pTrail(NULL), m_pCharacter(NULL), m_SetEnv(),
|
||||
m_sSongGroup(""), m_SortOrder(SortOrder_Invalid),
|
||||
m_sSoundPath(""), m_vsScreensToPrepare(), m_iWeightPounds(-1),
|
||||
m_iGoalCalories(-1), m_GoalType(GoalType_Invalid),
|
||||
m_sProfileID(""), m_sUrl(""), m_bUrlExits(true),
|
||||
m_bInsertCredit(false), m_bClearCredits(false),
|
||||
m_bStopMusic(false), m_bApplyDefaultOptions(false),
|
||||
m_bFadeMusic(false), m_fMusicFadeOutVolume(-1),
|
||||
m_fMusicFadeOutSeconds(-1), m_bApplyCommitsScreens(true)
|
||||
{
|
||||
m_LuaFunction.Unset();
|
||||
}
|
||||
void Init();
|
||||
|
||||
void Load( int iIndex, const Commands& cmds );
|
||||
|
||||
+7
-4
@@ -100,10 +100,13 @@ private:
|
||||
struct HighScoreList
|
||||
{
|
||||
public:
|
||||
HighScoreList()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
/**
|
||||
* @brief Set up the HighScore List with default values.
|
||||
*
|
||||
* This used to call Init(), but it's better to be explicit here. */
|
||||
HighScoreList(): vHighScores(), HighGrade(Grade_NoData),
|
||||
iNumTimesPlayed(0), dtLastPlayed() {}
|
||||
|
||||
void Init();
|
||||
|
||||
int GetNumTimesPlayed() const
|
||||
|
||||
@@ -9,10 +9,11 @@ class InputEventPlus
|
||||
{
|
||||
public:
|
||||
InputEventPlus():
|
||||
DeviceI(), GameI(),
|
||||
type(IET_FIRST_PRESS),
|
||||
MenuI(GameButton_Invalid),
|
||||
pn(PLAYER_INVALID),
|
||||
mp(MultiPlayer_Invalid) { }
|
||||
mp(MultiPlayer_Invalid), InputList() { }
|
||||
DeviceInput DeviceI;
|
||||
GameInput GameI;
|
||||
InputEventType type;
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ struct AutoMappings
|
||||
AutoMappingEntry im37 = AutoMappingEntry(),
|
||||
AutoMappingEntry im38 = AutoMappingEntry(),
|
||||
AutoMappingEntry im39 = AutoMappingEntry() )
|
||||
: m_sGame(s1), m_sDriverRegex(s2), m_sControllerName(s3)
|
||||
: m_sGame(s1), m_sDriverRegex(s2), m_sControllerName(s3), m_vMaps()
|
||||
{
|
||||
#define PUSH( im ) if(!im.IsEmpty()) m_vMaps.push_back(im);
|
||||
PUSH(im0);PUSH(im1);PUSH(im2);PUSH(im3);PUSH(im4);PUSH(im5);PUSH(im6);PUSH(im7);PUSH(im8);PUSH(im9);PUSH(im10);PUSH(im11);PUSH(im12);PUSH(im13);PUSH(im14);PUSH(im15);PUSH(im16);PUSH(im17);PUSH(im18);PUSH(im19);
|
||||
|
||||
+9
-1
@@ -27,11 +27,19 @@ struct InputQueueCode
|
||||
public:
|
||||
bool Load( RString sButtonsNames );
|
||||
bool EnteredCode( GameController controller ) const;
|
||||
|
||||
InputQueueCode(): m_aPresses() {}
|
||||
|
||||
private:
|
||||
struct ButtonPress
|
||||
{
|
||||
ButtonPress() { m_bAllowIntermediatePresses = false; memset( m_InputTypes, 0, sizeof(m_InputTypes) ); m_InputTypes[IET_FIRST_PRESS] = true; }
|
||||
ButtonPress(): m_aButtonsToHold(), m_aButtonsToNotHold(),
|
||||
m_aButtonsToPress(),
|
||||
m_bAllowIntermediatePresses(false)
|
||||
{
|
||||
memset( m_InputTypes, 0, sizeof(m_InputTypes) );
|
||||
m_InputTypes[IET_FIRST_PRESS] = true;
|
||||
}
|
||||
vector<GameButton> m_aButtonsToHold;
|
||||
vector<GameButton> m_aButtonsToNotHold;
|
||||
vector<GameButton> m_aButtonsToPress;
|
||||
|
||||
+2
-4
@@ -27,7 +27,7 @@ struct Impl
|
||||
};
|
||||
static Impl *pImpl = NULL;
|
||||
|
||||
#if defined(_MSC_VER) || defined (_XBOX)
|
||||
#if defined(_MSC_VER)
|
||||
/* "interaction between '_setjmp' and C++ object destruction is non-portable"
|
||||
* We don't care; we'll throw a fatal exception immediately anyway. */
|
||||
#pragma warning (disable : 4611)
|
||||
@@ -973,9 +973,7 @@ LuaFunction( VersionTime, (RString) version_time );
|
||||
static RString GetOSName()
|
||||
{
|
||||
RString system;
|
||||
#if defined(XBOX)
|
||||
system = "Xbox";
|
||||
#elif defined(WIN32) && !defined(XBOX)
|
||||
#if defined(WIN32)
|
||||
system = "Windows";
|
||||
#elif defined(LINUX)
|
||||
system = "Linux";
|
||||
|
||||
@@ -156,7 +156,7 @@ private:
|
||||
class MessageSubscriber : public IMessageSubscriber
|
||||
{
|
||||
public:
|
||||
MessageSubscriber() {}
|
||||
MessageSubscriber(): m_vsSubscribedTo() {}
|
||||
MessageSubscriber( const MessageSubscriber &cpy );
|
||||
MessageSubscriber &operator=(const MessageSubscriber &cpy);
|
||||
|
||||
|
||||
@@ -83,6 +83,8 @@ private:
|
||||
float m_fCurAnimationRate;
|
||||
bool m_bLoop;
|
||||
bool m_bDrawCelShaded; // for Lua models
|
||||
|
||||
Model& operator=(const Model& rhs);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,6 +13,9 @@ public:
|
||||
{
|
||||
/** @brief The list of parameters. */
|
||||
vector<RString> params;
|
||||
/** @brief Set up the parameters with default values. */
|
||||
value_t(): params() {}
|
||||
|
||||
/**
|
||||
* @brief Access the proper parameter.
|
||||
* @param i the index.
|
||||
@@ -20,6 +23,8 @@ public:
|
||||
*/
|
||||
RString operator[]( unsigned i ) const { if( i >= params.size() ) return RString(); return params[i]; }
|
||||
};
|
||||
|
||||
MsdFile(): values(), error("") {}
|
||||
|
||||
/** @brief Remove the MSDFile. */
|
||||
virtual ~MsdFile() { }
|
||||
|
||||
+71
-71
@@ -52,18 +52,18 @@ void NoteData::ClearRangeForTrack( int rowBegin, int rowEnd, int iTrack )
|
||||
if( rowBegin == rowEnd )
|
||||
return;
|
||||
|
||||
NoteData::TrackMap::iterator begin, end;
|
||||
GetTapNoteRangeInclusive( iTrack, rowBegin, rowEnd, begin, end );
|
||||
NoteData::TrackMap::iterator lBegin, lEnd;
|
||||
GetTapNoteRangeInclusive( iTrack, rowBegin, rowEnd, lBegin, lEnd );
|
||||
|
||||
if( begin != end && begin->first < rowBegin && begin->first + begin->second.iDuration > rowEnd )
|
||||
if( lBegin != lEnd && lBegin->first < rowBegin && lBegin->first + lBegin->second.iDuration > rowEnd )
|
||||
{
|
||||
/* A hold note overlaps the whole range. Truncate it, and add the
|
||||
* remainder to the end. */
|
||||
TapNote tn1 = begin->second;
|
||||
TapNote tn1 = lBegin->second;
|
||||
TapNote tn2 = tn1;
|
||||
|
||||
int iEndRow = begin->first + tn1.iDuration;
|
||||
int iRow = begin->first;
|
||||
int iEndRow = lBegin->first + tn1.iDuration;
|
||||
int iRow = lBegin->first;
|
||||
|
||||
tn1.iDuration = rowBegin - iRow;
|
||||
tn2.iDuration = iEndRow - rowEnd;
|
||||
@@ -72,23 +72,23 @@ void NoteData::ClearRangeForTrack( int rowBegin, int rowEnd, int iTrack )
|
||||
SetTapNote( iTrack, rowEnd, tn2 );
|
||||
|
||||
// We may have invalidated our iterators.
|
||||
GetTapNoteRangeInclusive( iTrack, rowBegin, rowEnd, begin, end );
|
||||
GetTapNoteRangeInclusive( iTrack, rowBegin, rowEnd, lBegin, lEnd );
|
||||
}
|
||||
else if( begin != end && begin->first < rowBegin )
|
||||
else if( lBegin != lEnd && lBegin->first < rowBegin )
|
||||
{
|
||||
// A hold note overlaps the beginning of the range. Truncate it.
|
||||
TapNote &tn1 = begin->second;
|
||||
int iRow = begin->first;
|
||||
TapNote &tn1 = lBegin->second;
|
||||
int iRow = lBegin->first;
|
||||
tn1.iDuration = rowBegin - iRow;
|
||||
|
||||
++begin;
|
||||
++lBegin;
|
||||
}
|
||||
|
||||
if( begin != end )
|
||||
if( lBegin != lEnd )
|
||||
{
|
||||
NoteData::TrackMap::iterator prev = end;
|
||||
NoteData::TrackMap::iterator prev = lEnd;
|
||||
--prev;
|
||||
TapNote tn = begin->second;
|
||||
TapNote tn = lBegin->second;
|
||||
int iRow = prev->first;
|
||||
if( tn.type == TapNote::hold_head && iRow + tn.iDuration > rowEnd )
|
||||
{
|
||||
@@ -99,14 +99,14 @@ void NoteData::ClearRangeForTrack( int rowBegin, int rowEnd, int iTrack )
|
||||
tn.iDuration -= iAdd;
|
||||
iRow += iAdd;
|
||||
SetTapNote( iTrack, iRow, tn );
|
||||
end = prev;
|
||||
lEnd = prev;
|
||||
}
|
||||
|
||||
// We may have invalidated our iterators.
|
||||
GetTapNoteRangeInclusive( iTrack, rowBegin, rowEnd, begin, end );
|
||||
GetTapNoteRangeInclusive( iTrack, rowBegin, rowEnd, lBegin, lEnd );
|
||||
}
|
||||
|
||||
m_TapNotes[iTrack].erase( begin, end );
|
||||
m_TapNotes[iTrack].erase( lBegin, lEnd );
|
||||
}
|
||||
|
||||
void NoteData::ClearRange( int rowBegin, int rowEnd )
|
||||
@@ -138,17 +138,17 @@ void NoteData::CopyRange( const NoteData& from, int rowFromBegin, int rowFromEnd
|
||||
|
||||
for( int t=0; t<GetNumTracks(); t++ )
|
||||
{
|
||||
NoteData::TrackMap::const_iterator begin, end;
|
||||
from.GetTapNoteRangeInclusive( t, rowFromBegin, rowFromEnd, begin, end );
|
||||
for( ; begin != end; ++begin )
|
||||
NoteData::TrackMap::const_iterator lBegin, lEnd;
|
||||
from.GetTapNoteRangeInclusive( t, rowFromBegin, rowFromEnd, lBegin, lEnd );
|
||||
for( ; lBegin != lEnd; ++lBegin )
|
||||
{
|
||||
TapNote head = begin->second;
|
||||
TapNote head = lBegin->second;
|
||||
if( head.type == TapNote::empty )
|
||||
continue;
|
||||
|
||||
if( head.type == TapNote::hold_head )
|
||||
{
|
||||
int iStartRow = begin->first + iMoveBy;
|
||||
int iStartRow = lBegin->first + iMoveBy;
|
||||
int iEndRow = iStartRow + head.iDuration;
|
||||
|
||||
iStartRow = clamp( iStartRow, rowToBegin, rowToEnd );
|
||||
@@ -158,7 +158,7 @@ void NoteData::CopyRange( const NoteData& from, int rowFromBegin, int rowFromEnd
|
||||
}
|
||||
else
|
||||
{
|
||||
int iTo = begin->first + iMoveBy;
|
||||
int iTo = lBegin->first + iMoveBy;
|
||||
if( iTo >= rowToBegin && iTo <= rowToEnd )
|
||||
this->SetTapNote( t, iTo, head );
|
||||
}
|
||||
@@ -307,11 +307,11 @@ void NoteData::AddHoldNote( int iTrack, int iStartRow, int iEndRow, TapNote tn )
|
||||
ASSERT_M( iEndRow >= iStartRow, ssprintf("EndRow %d < StartRow %d",iEndRow,iStartRow) );
|
||||
|
||||
/* Include adjacent (non-overlapping) hold notes, since we need to merge with them. */
|
||||
NoteData::TrackMap::iterator begin, end;
|
||||
GetTapNoteRangeInclusive( iTrack, iStartRow, iEndRow, begin, end, true );
|
||||
NoteData::TrackMap::iterator lBegin, lEnd;
|
||||
GetTapNoteRangeInclusive( iTrack, iStartRow, iEndRow, lBegin, lEnd, true );
|
||||
|
||||
// Look for other hold notes that overlap and merge them into add.
|
||||
for( iterator it = begin; it != end; ++it )
|
||||
for( iterator it = lBegin; it != lEnd; ++it )
|
||||
{
|
||||
int iOtherRow = it->first;
|
||||
const TapNote &tnOther = it->second;
|
||||
@@ -325,14 +325,14 @@ void NoteData::AddHoldNote( int iTrack, int iStartRow, int iEndRow, TapNote tn )
|
||||
tn.iDuration = iEndRow - iStartRow;
|
||||
|
||||
// Remove everything in the range.
|
||||
while( begin != end )
|
||||
while( lBegin != lEnd )
|
||||
{
|
||||
iterator next = begin;
|
||||
iterator next = lBegin;
|
||||
++next;
|
||||
|
||||
RemoveTapNote( iTrack, begin );
|
||||
RemoveTapNote( iTrack, lBegin );
|
||||
|
||||
begin = next;
|
||||
lBegin = next;
|
||||
}
|
||||
|
||||
/* Additionally, if there's a tap note lying at the end of our range,
|
||||
@@ -590,12 +590,12 @@ int NoteData::GetNumHoldNotes( int iStartIndex, int iEndIndex ) const
|
||||
int iNumHolds = 0;
|
||||
for( int t=0; t<GetNumTracks(); ++t )
|
||||
{
|
||||
NoteData::TrackMap::const_iterator begin, end;
|
||||
GetTapNoteRangeExclusive( t, iStartIndex, iEndIndex, begin, end );
|
||||
for( ; begin != end; ++begin )
|
||||
NoteData::TrackMap::const_iterator lBegin, lEnd;
|
||||
GetTapNoteRangeExclusive( t, iStartIndex, iEndIndex, lBegin, lEnd );
|
||||
for( ; lBegin != lEnd; ++lBegin )
|
||||
{
|
||||
if( begin->second.type != TapNote::hold_head ||
|
||||
begin->second.subType != TapNote::hold_head_hold )
|
||||
if( lBegin->second.type != TapNote::hold_head ||
|
||||
lBegin->second.subType != TapNote::hold_head_hold )
|
||||
continue;
|
||||
iNumHolds++;
|
||||
}
|
||||
@@ -608,12 +608,12 @@ int NoteData::GetNumRolls( int iStartIndex, int iEndIndex ) const
|
||||
int iNumRolls = 0;
|
||||
for( int t=0; t<GetNumTracks(); ++t )
|
||||
{
|
||||
NoteData::TrackMap::const_iterator begin, end;
|
||||
GetTapNoteRangeExclusive( t, iStartIndex, iEndIndex, begin, end );
|
||||
for( ; begin != end; ++begin )
|
||||
NoteData::TrackMap::const_iterator lBegin, lEnd;
|
||||
GetTapNoteRangeExclusive( t, iStartIndex, iEndIndex, lBegin, lEnd );
|
||||
for( ; lBegin != lEnd; ++lBegin )
|
||||
{
|
||||
if( begin->second.type != TapNote::hold_head ||
|
||||
begin->second.subType != TapNote::hold_head_roll )
|
||||
if( lBegin->second.type != TapNote::hold_head ||
|
||||
lBegin->second.subType != TapNote::hold_head_roll )
|
||||
continue;
|
||||
iNumRolls++;
|
||||
}
|
||||
@@ -773,43 +773,43 @@ bool NoteData::GetPrevTapNoteRowForTrack( int track, int &rowInOut ) const
|
||||
return true;
|
||||
}
|
||||
|
||||
void NoteData::GetTapNoteRange( int iTrack, int iStartRow, int iEndRow, TrackMap::iterator &begin, TrackMap::iterator &end )
|
||||
void NoteData::GetTapNoteRange( int iTrack, int iStartRow, int iEndRow, TrackMap::iterator &lBegin, TrackMap::iterator &lEnd )
|
||||
{
|
||||
ASSERT_M( iTrack < GetNumTracks(), ssprintf("%i,%i", iTrack, GetNumTracks()) );
|
||||
TrackMap &mapTrack = m_TapNotes[iTrack];
|
||||
|
||||
if( iStartRow > iEndRow )
|
||||
{
|
||||
begin = end = mapTrack.end();
|
||||
lBegin = lEnd = mapTrack.end();
|
||||
return;
|
||||
}
|
||||
|
||||
if( iStartRow <= 0 )
|
||||
begin = mapTrack.begin(); // optimization
|
||||
lBegin = mapTrack.begin(); // optimization
|
||||
else if( iStartRow >= MAX_NOTE_ROW )
|
||||
begin = mapTrack.end(); // optimization
|
||||
lBegin = mapTrack.end(); // optimization
|
||||
else
|
||||
begin = mapTrack.lower_bound( iStartRow );
|
||||
lBegin = mapTrack.lower_bound( iStartRow );
|
||||
|
||||
if( iEndRow <= 0 )
|
||||
end = mapTrack.begin(); // optimization
|
||||
lEnd = mapTrack.begin(); // optimization
|
||||
else if( iEndRow >= MAX_NOTE_ROW )
|
||||
end = mapTrack.end(); // optimization
|
||||
lEnd = mapTrack.end(); // optimization
|
||||
else
|
||||
end = mapTrack.lower_bound( iEndRow );
|
||||
lEnd = mapTrack.lower_bound( iEndRow );
|
||||
}
|
||||
|
||||
|
||||
/* Include hold notes that overlap the edges. If a hold note completely surrounds the given
|
||||
* range, included it, too. If bIncludeAdjacent is true, also include hold notes adjacent to,
|
||||
* but not overlapping, the edge. */
|
||||
void NoteData::GetTapNoteRangeInclusive( int iTrack, int iStartRow, int iEndRow, TrackMap::iterator &begin, TrackMap::iterator &end, bool bIncludeAdjacent )
|
||||
void NoteData::GetTapNoteRangeInclusive( int iTrack, int iStartRow, int iEndRow, TrackMap::iterator &lBegin, TrackMap::iterator &lEnd, bool bIncludeAdjacent )
|
||||
{
|
||||
GetTapNoteRange( iTrack, iStartRow, iEndRow, begin, end );
|
||||
GetTapNoteRange( iTrack, iStartRow, iEndRow, lBegin, lEnd );
|
||||
|
||||
if( begin != this->begin(iTrack) )
|
||||
if( lBegin != this->begin(iTrack) )
|
||||
{
|
||||
iterator prev = Decrement(begin);
|
||||
iterator prev = Decrement(lBegin);
|
||||
|
||||
const TapNote &tn = prev->second;
|
||||
if( tn.type == TapNote::hold_head )
|
||||
@@ -821,62 +821,62 @@ void NoteData::GetTapNoteRangeInclusive( int iTrack, int iStartRow, int iEndRow,
|
||||
if( iHoldEndRow > iStartRow )
|
||||
{
|
||||
// The previous note is a hold.
|
||||
begin = prev;
|
||||
lBegin = prev;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( bIncludeAdjacent && end != this->end(iTrack) )
|
||||
if( bIncludeAdjacent && lEnd != this->end(iTrack) )
|
||||
{
|
||||
// Include the next note if it's a hold and starts on iEndRow.
|
||||
const TapNote &tn = end->second;
|
||||
int iHoldStartRow = end->first;
|
||||
const TapNote &tn = lEnd->second;
|
||||
int iHoldStartRow = lEnd->first;
|
||||
if( tn.type == TapNote::hold_head && iHoldStartRow == iEndRow )
|
||||
++end;
|
||||
++lEnd;
|
||||
}
|
||||
}
|
||||
|
||||
void NoteData::GetTapNoteRangeExclusive( int iTrack, int iStartRow, int iEndRow, TrackMap::iterator &begin, TrackMap::iterator &end )
|
||||
void NoteData::GetTapNoteRangeExclusive( int iTrack, int iStartRow, int iEndRow, TrackMap::iterator &lBegin, TrackMap::iterator &lEnd )
|
||||
{
|
||||
GetTapNoteRange( iTrack, iStartRow, iEndRow, begin, end );
|
||||
GetTapNoteRange( iTrack, iStartRow, iEndRow, lBegin, lEnd );
|
||||
|
||||
// If end-1 is a hold_head, and extends beyond iEndRow, exclude it.
|
||||
if( begin != end && end != this->begin(iTrack) )
|
||||
if( lBegin != lEnd && lEnd != this->begin(iTrack) )
|
||||
{
|
||||
iterator prev = end;
|
||||
iterator prev = lEnd;
|
||||
--prev;
|
||||
if( prev->second.type == TapNote::hold_head )
|
||||
{
|
||||
int localStartRow = prev->first;
|
||||
const TapNote &tn = prev->second;
|
||||
if( localStartRow + tn.iDuration >= iEndRow )
|
||||
end = prev;
|
||||
lEnd = prev;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NoteData::GetTapNoteRange( int iTrack, int iStartRow, int iEndRow, TrackMap::const_iterator &begin, TrackMap::const_iterator &end ) const
|
||||
void NoteData::GetTapNoteRange( int iTrack, int iStartRow, int iEndRow, TrackMap::const_iterator &lBegin, TrackMap::const_iterator &lEnd ) const
|
||||
{
|
||||
TrackMap::iterator const_begin, const_end;
|
||||
const_cast<NoteData *>(this)->GetTapNoteRange( iTrack, iStartRow, iEndRow, const_begin, const_end );
|
||||
begin = const_begin;
|
||||
end = const_end;
|
||||
lBegin = const_begin;
|
||||
lEnd = const_end;
|
||||
}
|
||||
|
||||
void NoteData::GetTapNoteRangeInclusive( int iTrack, int iStartRow, int iEndRow, TrackMap::const_iterator &begin, TrackMap::const_iterator &end, bool bIncludeAdjacent ) const
|
||||
void NoteData::GetTapNoteRangeInclusive( int iTrack, int iStartRow, int iEndRow, TrackMap::const_iterator &lBegin, TrackMap::const_iterator &lEnd, bool bIncludeAdjacent ) const
|
||||
{
|
||||
TrackMap::iterator const_begin, const_end;
|
||||
const_cast<NoteData *>(this)->GetTapNoteRangeInclusive( iTrack, iStartRow, iEndRow, const_begin, const_end, bIncludeAdjacent );
|
||||
begin = const_begin;
|
||||
end = const_end;
|
||||
lBegin = const_begin;
|
||||
lEnd = const_end;
|
||||
}
|
||||
|
||||
void NoteData::GetTapNoteRangeExclusive( int iTrack, int iStartRow, int iEndRow, TrackMap::const_iterator &begin, TrackMap::const_iterator &end ) const
|
||||
void NoteData::GetTapNoteRangeExclusive( int iTrack, int iStartRow, int iEndRow, TrackMap::const_iterator &lBegin, TrackMap::const_iterator &lEnd ) const
|
||||
{
|
||||
TrackMap::iterator const_begin, const_end;
|
||||
const_cast<NoteData *>(this)->GetTapNoteRange( iTrack, iStartRow, iEndRow, const_begin, const_end );
|
||||
begin = const_begin;
|
||||
end = const_end;
|
||||
lBegin = const_begin;
|
||||
lEnd = const_end;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@ public:
|
||||
typedef map<int,TapNote>::const_iterator const_iterator;
|
||||
typedef map<int,TapNote>::reverse_iterator reverse_iterator;
|
||||
typedef map<int,TapNote>::const_reverse_iterator const_reverse_iterator;
|
||||
|
||||
NoteData(): m_TapNotes() {}
|
||||
|
||||
iterator begin( int iTrack ) { return m_TapNotes[iTrack].begin(); }
|
||||
const_iterator begin( int iTrack ) const { return m_TapNotes[iTrack].begin(); }
|
||||
|
||||
+6
-5
@@ -134,9 +134,9 @@ struct TapNote
|
||||
void LoadFromNode( const XNode* pNode );
|
||||
|
||||
TapNote(): type(empty), subType(SubType_Invalid), source(original),
|
||||
pn(PLAYER_INVALID), bHopoPossible(false),
|
||||
result(), pn(PLAYER_INVALID), bHopoPossible(false),
|
||||
sAttackModifiers(""), fAttackDurationSeconds(0),
|
||||
iKeysoundIndex(-1), iDuration(0) {}
|
||||
iKeysoundIndex(-1), iDuration(0), HoldResult() {}
|
||||
void Init()
|
||||
{
|
||||
type = empty;
|
||||
@@ -155,10 +155,11 @@ struct TapNote
|
||||
RString sAttackModifiers_,
|
||||
float fAttackDurationSeconds_,
|
||||
int iKeysoundIndex_ ):
|
||||
type(type_), subType(subType_), source(source_),
|
||||
pn(PLAYER_INVALID), sAttackModifiers(sAttackModifiers_),
|
||||
type(type_), subType(subType_), source(source_), result(),
|
||||
pn(PLAYER_INVALID), bHopoPossible(false),
|
||||
sAttackModifiers(sAttackModifiers_),
|
||||
fAttackDurationSeconds(fAttackDurationSeconds_),
|
||||
iKeysoundIndex(iKeysoundIndex_), iDuration(0) {}
|
||||
iKeysoundIndex(iKeysoundIndex_), iDuration(0), HoldResult() {}
|
||||
|
||||
/**
|
||||
* @brief Determine if the two TapNotes are equal to each other.
|
||||
|
||||
+29
-10
@@ -77,15 +77,14 @@ struct OptionRowDefinition
|
||||
|
||||
OptionRowDefinition(): m_sName(""), m_sExplanationName(""),
|
||||
m_bOneChoiceForAllPlayers(false), m_selectType(SELECT_ONE),
|
||||
m_layoutType(LAYOUT_SHOW_ALL_IN_ROW), m_iDefault(-1),
|
||||
m_layoutType(LAYOUT_SHOW_ALL_IN_ROW), m_vsChoices(),
|
||||
m_vEnabledForPlayers(), m_iDefault(-1),
|
||||
m_bExportOnChange(false), m_bAllowThemeItems(true),
|
||||
m_bAllowThemeTitle(true), m_bAllowExplanation(true),
|
||||
m_bShowChoicesListOnSelect(false)
|
||||
{
|
||||
m_vsChoices.clear();
|
||||
m_vEnabledForPlayers.clear();
|
||||
FOREACH_PlayerNumber( pn )
|
||||
m_vEnabledForPlayers.insert( pn );
|
||||
m_vEnabledForPlayers.insert( pn );
|
||||
}
|
||||
void Init()
|
||||
{
|
||||
@@ -106,13 +105,33 @@ struct OptionRowDefinition
|
||||
m_bShowChoicesListOnSelect = false;
|
||||
}
|
||||
|
||||
OptionRowDefinition( const char *n, bool b, const char *c0=NULL, const char *c1=NULL, const char *c2=NULL, const char *c3=NULL, const char *c4=NULL, const char *c5=NULL, const char *c6=NULL, const char *c7=NULL, const char *c8=NULL, const char *c9=NULL, const char *c10=NULL, const char *c11=NULL, const char *c12=NULL, const char *c13=NULL, const char *c14=NULL, const char *c15=NULL, const char *c16=NULL, const char *c17=NULL, const char *c18=NULL, const char *c19=NULL )
|
||||
OptionRowDefinition( const char *n, bool b, const char *c0=NULL,
|
||||
const char *c1=NULL, const char *c2=NULL,
|
||||
const char *c3=NULL, const char *c4=NULL,
|
||||
const char *c5=NULL, const char *c6=NULL,
|
||||
const char *c7=NULL, const char *c8=NULL,
|
||||
const char *c9=NULL, const char *c10=NULL,
|
||||
const char *c11=NULL, const char *c12=NULL,
|
||||
const char *c13=NULL, const char *c14=NULL,
|
||||
const char *c15=NULL, const char *c16=NULL,
|
||||
const char *c17=NULL, const char *c18=NULL,
|
||||
const char *c19=NULL ): m_sName(n),
|
||||
m_sExplanationName(""), m_bOneChoiceForAllPlayers(b),
|
||||
m_selectType(SELECT_ONE),
|
||||
m_layoutType(LAYOUT_SHOW_ALL_IN_ROW), m_vsChoices(),
|
||||
m_vEnabledForPlayers(), m_iDefault(-1),
|
||||
m_bExportOnChange(false), m_bAllowThemeItems(true),
|
||||
m_bAllowThemeTitle(true), m_bAllowExplanation(true),
|
||||
m_bShowChoicesListOnSelect(false)
|
||||
{
|
||||
Init();
|
||||
m_sName=n;
|
||||
m_bOneChoiceForAllPlayers=b;
|
||||
FOREACH_PlayerNumber( pn )
|
||||
m_vEnabledForPlayers.insert( pn );
|
||||
|
||||
#define PUSH( c ) if(c) m_vsChoices.push_back(c);
|
||||
PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);PUSH(c12);PUSH(c13);PUSH(c14);PUSH(c15);PUSH(c16);PUSH(c17);PUSH(c18);PUSH(c19);
|
||||
PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);
|
||||
PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);
|
||||
PUSH(c12);PUSH(c13);PUSH(c14);PUSH(c15);PUSH(c16);PUSH(c17);
|
||||
PUSH(c18);PUSH(c19);
|
||||
#undef PUSH
|
||||
}
|
||||
};
|
||||
@@ -124,7 +143,7 @@ public:
|
||||
OptionRowDefinition m_Def;
|
||||
vector<RString> m_vsReloadRowMessages; // refresh this row on on these messages
|
||||
|
||||
OptionRowHandler() { Init(); }
|
||||
OptionRowHandler(): m_Def(), m_vsReloadRowMessages() { }
|
||||
virtual ~OptionRowHandler() { }
|
||||
virtual void Init()
|
||||
{
|
||||
|
||||
@@ -841,10 +841,17 @@ class LunaPlayerOptions: public Luna<PlayerOptions>
|
||||
{
|
||||
public:
|
||||
DEFINE_METHOD( GetNoteSkin, m_sNoteSkin )
|
||||
static int SetNoteSkin( T *p, lua_State *L )
|
||||
{
|
||||
if( NOTESKIN->DoesNoteSkinExist(SArg(1)) )
|
||||
p->m_sNoteSkin = SArg(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LunaPlayerOptions()
|
||||
{
|
||||
ADD_METHOD( GetNoteSkin );
|
||||
ADD_METHOD( SetNoteSkin );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+47
-3
@@ -67,9 +67,49 @@ class Game;
|
||||
class Profile
|
||||
{
|
||||
public:
|
||||
Profile()
|
||||
/**
|
||||
* @brief Set up the Profile with default values.
|
||||
*
|
||||
* Note: there are probably a lot of variables. */
|
||||
Profile(): m_sDisplayName(""), m_sCharacterID(""),
|
||||
m_sLastUsedHighScoreName(""), m_iWeightPounds(0),
|
||||
m_sGuid(MakeGuid()), m_sDefaultModifiers(),
|
||||
m_SortOrder(SortOrder_Invalid),
|
||||
m_LastDifficulty(Difficulty_Invalid),
|
||||
m_LastCourseDifficulty(Difficulty_Invalid),
|
||||
m_LastStepsType(StepsType_Invalid), m_lastSong(),
|
||||
m_lastCourse(), m_iTotalSessions(0),
|
||||
m_iTotalSessionSeconds(0), m_iTotalGameplaySeconds(0),
|
||||
m_fTotalCaloriesBurned(0), m_GoalType(GoalType_Calories),
|
||||
m_iGoalCalories(0), m_iGoalSeconds(0), m_iTotalDancePoints(0),
|
||||
m_iNumExtraStagesPassed(0), m_iNumExtraStagesFailed(0),
|
||||
m_iNumToasties(0), m_iTotalTapsAndHolds(0), m_iTotalJumps(0),
|
||||
m_iTotalHolds(0), m_iTotalRolls(0), m_iTotalMines(0),
|
||||
m_iTotalHands(0), m_iTotalLifts(0), m_UnlockedEntryIDs(),
|
||||
m_sLastPlayedMachineGuid(""), m_LastPlayedDate(),
|
||||
m_iNumSongsPlayedByStyle(), m_iNumTotalSongsPlayed(0),
|
||||
m_UserData(), m_SongHighScores(), m_CourseHighScores(),
|
||||
m_vScreenshots(), m_mapDayToCaloriesBurned()
|
||||
{
|
||||
InitAll();
|
||||
m_lastSong.Unset();
|
||||
m_lastCourse.Unset();
|
||||
|
||||
m_LastPlayedDate.Init();
|
||||
|
||||
FOREACH_ENUM( PlayMode, i )
|
||||
m_iNumSongsPlayedByPlayMode[i] = 0;
|
||||
FOREACH_ENUM( Difficulty, i )
|
||||
m_iNumSongsPlayedByDifficulty[i] = 0;
|
||||
for( int i=0; i<MAX_METER+1; i++ )
|
||||
m_iNumSongsPlayedByMeter[i] = 0;
|
||||
|
||||
ZERO( m_iNumStagesPassedByPlayMode );
|
||||
ZERO( m_iNumStagesPassedByGrade );
|
||||
m_UserData.Unset();
|
||||
|
||||
FOREACH_ENUM( StepsType,st )
|
||||
FOREACH_ENUM( RankingCategory,rc )
|
||||
m_CategoryHighScores[st][rc].Init();
|
||||
}
|
||||
|
||||
// smart accessors
|
||||
@@ -170,11 +210,13 @@ public:
|
||||
struct HighScoresForASteps
|
||||
{
|
||||
HighScoreList hsl;
|
||||
HighScoresForASteps(): hsl() {}
|
||||
};
|
||||
struct HighScoresForASong
|
||||
{
|
||||
std::map<StepsID,HighScoresForASteps> m_StepsHighScores;
|
||||
int GetNumTimesPlayed() const;
|
||||
HighScoresForASong(): m_StepsHighScores() {}
|
||||
};
|
||||
std::map<SongID,HighScoresForASong> m_SongHighScores;
|
||||
|
||||
@@ -196,11 +238,13 @@ public:
|
||||
struct HighScoresForATrail
|
||||
{
|
||||
HighScoreList hsl;
|
||||
HighScoresForATrail(): hsl() {}
|
||||
};
|
||||
struct HighScoresForACourse
|
||||
{
|
||||
std::map<TrailID,HighScoresForATrail> m_TrailHighScores;
|
||||
int GetNumTimesPlayed() const;
|
||||
HighScoresForACourse(): m_TrailHighScores() {}
|
||||
};
|
||||
std::map<CourseID,HighScoresForACourse> m_CourseHighScores;
|
||||
|
||||
@@ -240,7 +284,7 @@ public:
|
||||
* insert some garbage entries into the map. */
|
||||
struct Calories
|
||||
{
|
||||
Calories() { fCals = 0; }
|
||||
Calories(): fCals(0) {}
|
||||
float fCals;
|
||||
};
|
||||
map<DateTime,Calories> m_mapDayToCaloriesBurned;
|
||||
|
||||
@@ -31,7 +31,7 @@ static void GetResolutionFromFileName( RString sPath, int &iWidth, int &iHeight
|
||||
}
|
||||
|
||||
RageBitmapTexture::RageBitmapTexture( RageTextureID name ) :
|
||||
RageTexture( name )
|
||||
RageTexture( name ), m_uTexHandle(0)
|
||||
{
|
||||
Create();
|
||||
}
|
||||
|
||||
+1
-1
@@ -264,7 +264,7 @@ class MatrixStack
|
||||
vector<RageMatrix> stack;
|
||||
public:
|
||||
|
||||
MatrixStack()
|
||||
MatrixStack(): stack()
|
||||
{
|
||||
stack.resize(1);
|
||||
LoadIdentity();
|
||||
|
||||
+2
-116
@@ -17,16 +17,11 @@
|
||||
#include <D3dx8math.h>
|
||||
#include <D3DX8Core.h>
|
||||
|
||||
#if !defined(XBOX)
|
||||
#include "archutils/Win32/GraphicsWindow.h"
|
||||
#else
|
||||
#include "archutils/Xbox/GraphicsWindow.h"
|
||||
#include "archutils/Xbox/VirtualMemory.h"
|
||||
#endif
|
||||
|
||||
// Static libraries
|
||||
// load Windows D3D8 dynamically
|
||||
#if defined(_MSC_VER) && !defined(_XBOX)
|
||||
#if defined(_MSC_VER)
|
||||
#pragma comment(lib, "D3dx8.lib")
|
||||
#pragma comment(lib, "Dxerr8.lib")
|
||||
#endif
|
||||
@@ -42,9 +37,7 @@ RString GetErrorString( HRESULT hr )
|
||||
}
|
||||
|
||||
// Globals
|
||||
#if !defined(XBOX)
|
||||
HMODULE g_D3D8_Module = NULL;
|
||||
#endif
|
||||
LPDIRECT3D8 g_pd3d = NULL;
|
||||
LPDIRECT3DDEVICE8 g_pd3dDevice = NULL;
|
||||
D3DCAPS8 g_DeviceCaps;
|
||||
@@ -84,12 +77,8 @@ static void SetPalette( unsigned TexResource )
|
||||
}
|
||||
|
||||
// Load it.
|
||||
#if !defined(XBOX)
|
||||
TexturePalette& pal = g_TexResourceToTexturePalette[TexResource];
|
||||
g_pd3dDevice->SetPaletteEntries( iPalIndex, pal.p );
|
||||
#else
|
||||
ASSERT(0);
|
||||
#endif
|
||||
|
||||
g_TexResourceToPaletteIndex[TexResource] = iPalIndex;
|
||||
}
|
||||
@@ -106,11 +95,7 @@ static void SetPalette( unsigned TexResource )
|
||||
break;
|
||||
}
|
||||
|
||||
#if !defined(XBOX)
|
||||
g_pd3dDevice->SetCurrentTexturePalette( iPalIndex );
|
||||
#else
|
||||
ASSERT(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define D3DFVF_RageSpriteVertex (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_DIFFUSE|D3DFVF_TEX1)
|
||||
@@ -178,11 +163,7 @@ static D3DFORMAT D3DFORMATS[NUM_PixelFormat] =
|
||||
D3DFMT_A4R4G4B4,
|
||||
D3DFMT_A1R5G5B5,
|
||||
D3DFMT_X1R5G5B5,
|
||||
#if defined(XBOX)
|
||||
D3DFMT_UNKNOWN, // no RGB
|
||||
#else
|
||||
D3DFMT_R8G8B8,
|
||||
#endif
|
||||
D3DFMT_P8,
|
||||
D3DFMT_UNKNOWN, // no BGR
|
||||
D3DFMT_UNKNOWN, // no ABGR
|
||||
@@ -214,9 +195,7 @@ RString RageDisplay_D3D::Init( const VideoModeParams &p, bool bAllowUnaccelerate
|
||||
|
||||
typedef IDirect3D8 * (WINAPI * Direct3DCreate8_t) (UINT SDKVersion);
|
||||
Direct3DCreate8_t pDirect3DCreate8;
|
||||
#if defined(XBOX)
|
||||
pDirect3DCreate8 = Direct3DCreate8;
|
||||
#else
|
||||
|
||||
g_D3D8_Module = LoadLibrary("D3D8.dll");
|
||||
if(!g_D3D8_Module)
|
||||
return D3D_NOT_INSTALLED.GetValue() + "\n" + D3D_URL;
|
||||
@@ -227,7 +206,6 @@ RString RageDisplay_D3D::Init( const VideoModeParams &p, bool bAllowUnaccelerate
|
||||
LOG->Trace( "Direct3DCreate8 not found" );
|
||||
return D3D_NOT_INSTALLED.GetValue();
|
||||
}
|
||||
#endif
|
||||
|
||||
g_pd3d = pDirect3DCreate8( D3D_SDK_VERSION );
|
||||
if(!g_pd3d)
|
||||
@@ -294,13 +272,11 @@ RageDisplay_D3D::~RageDisplay_D3D()
|
||||
/* Even after we call Release(), D3D may still affect our window. It seems
|
||||
* to subclass the window, and never release it. Free the DLL after
|
||||
* destroying the window. */
|
||||
#if !defined(XBOX)
|
||||
if( g_D3D8_Module )
|
||||
{
|
||||
FreeLibrary( g_D3D8_Module );
|
||||
g_D3D8_Module = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RageDisplay_D3D::GetDisplayResolutions( DisplayResolutions &out ) const
|
||||
@@ -334,9 +310,7 @@ D3DFORMAT FindBackBufferType(bool bWindowed, int iBPP)
|
||||
}
|
||||
if( iBPP == 32 || bWindowed )
|
||||
{
|
||||
#if !defined(XBOX)
|
||||
vBackBufferFormats.push_back( D3DFMT_R8G8B8 );
|
||||
#endif
|
||||
vBackBufferFormats.push_back( D3DFMT_X8R8G8B8 );
|
||||
vBackBufferFormats.push_back( D3DFMT_A8R8G8B8 );
|
||||
}
|
||||
@@ -383,13 +357,8 @@ RString SetD3DParams( bool &bNewDeviceOut )
|
||||
HRESULT hr = g_pd3d->CreateDevice(
|
||||
D3DADAPTER_DEFAULT,
|
||||
D3DDEVTYPE_HAL,
|
||||
#if !defined(XBOX)
|
||||
GraphicsWindow::GetHwnd(),
|
||||
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED,
|
||||
#else
|
||||
NULL,
|
||||
D3DCREATE_HARDWARE_VERTEXPROCESSING,
|
||||
#endif
|
||||
&g_d3dpp,
|
||||
&g_pd3dDevice );
|
||||
if( FAILED(hr) )
|
||||
@@ -506,11 +475,7 @@ static void SetPresentParametersFromVideoModeParams( const VideoModeParams &p, D
|
||||
pD3Dpp->BackBufferCount = 1;
|
||||
pD3Dpp->MultiSampleType = D3DMULTISAMPLE_NONE;
|
||||
pD3Dpp->SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||
#if !defined(XBOX)
|
||||
pD3Dpp->hDeviceWindow = GraphicsWindow::GetHwnd();
|
||||
#else
|
||||
pD3Dpp->hDeviceWindow = NULL;
|
||||
#endif
|
||||
pD3Dpp->Windowed = p.windowed;
|
||||
pD3Dpp->EnableAutoDepthStencil = TRUE;
|
||||
pD3Dpp->AutoDepthStencilFormat = D3DFMT_D16;
|
||||
@@ -520,25 +485,9 @@ static void SetPresentParametersFromVideoModeParams( const VideoModeParams &p, D
|
||||
else
|
||||
pD3Dpp->FullScreen_PresentationInterval = p.vsync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
|
||||
#if !defined(XBOX)
|
||||
pD3Dpp->FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
|
||||
if( !p.windowed && p.rate != REFRESH_DEFAULT )
|
||||
pD3Dpp->FullScreen_RefreshRateInHz = p.rate;
|
||||
#else
|
||||
if( XGetVideoStandard() == XC_VIDEO_STANDARD_PAL_I )
|
||||
{
|
||||
// Get supported video flags.
|
||||
DWORD VideoFlags = XGetVideoFlags();
|
||||
|
||||
// Set pal60 if available.
|
||||
if( VideoFlags & XC_VIDEO_FLAGS_PAL_60Hz )
|
||||
pD3Dpp->FullScreen_RefreshRateInHz = 60;
|
||||
else
|
||||
pD3Dpp->FullScreen_RefreshRateInHz = 50;
|
||||
}
|
||||
else
|
||||
pD3Dpp->FullScreen_RefreshRateInHz = 60;
|
||||
#endif
|
||||
|
||||
pD3Dpp->Flags = 0;
|
||||
|
||||
@@ -556,9 +505,6 @@ static void SetPresentParametersFromVideoModeParams( const VideoModeParams &p, D
|
||||
RString RageDisplay_D3D::TryVideoMode( const VideoModeParams &_p, bool &bNewDeviceOut )
|
||||
{
|
||||
VideoModeParams p = _p;
|
||||
#if defined(XBOX)
|
||||
p.windowed = false;
|
||||
#endif
|
||||
LOG->Warn( "RageDisplay_D3D::TryVideoMode( %d, %d, %d, %d, %d, %d )", p.windowed, p.width, p.height, p.bpp, p.rate, p.vsync );
|
||||
|
||||
if( FindBackBufferType( p.windowed, p.bpp ) == D3DFMT_UNKNOWN ) // no possible back buffer formats
|
||||
@@ -571,11 +517,6 @@ RString RageDisplay_D3D::TryVideoMode( const VideoModeParams &_p, bool &bNewDevi
|
||||
|
||||
SetPresentParametersFromVideoModeParams( p, &g_d3dpp );
|
||||
|
||||
#if defined(XBOX)
|
||||
if( D3D__pDevice )
|
||||
g_pd3dDevice = D3D__pDevice;
|
||||
#endif
|
||||
|
||||
// Display the window immediately, so we don't display the desktop ...
|
||||
while( 1 )
|
||||
{
|
||||
@@ -612,14 +553,6 @@ void RageDisplay_D3D::ResolutionChanged()
|
||||
{
|
||||
//LOG->Warn( "RageDisplay_D3D::ResolutionChanged" );
|
||||
|
||||
#if defined(XBOX)
|
||||
VideoModeParams p = GetActualVideoModeParams();
|
||||
D3DVIEWPORT8 viewData = { 0, 0, p.width, p.height, 0.f, 1.f };
|
||||
g_pd3dDevice->SetViewport( &viewData );
|
||||
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
|
||||
D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 );
|
||||
#endif
|
||||
|
||||
RageDisplay::ResolutionChanged();
|
||||
}
|
||||
|
||||
@@ -632,7 +565,6 @@ bool RageDisplay_D3D::BeginFrame()
|
||||
{
|
||||
GraphicsWindow::Update();
|
||||
|
||||
#if !defined(XBOX)
|
||||
switch( g_pd3dDevice->TestCooperativeLevel() )
|
||||
{
|
||||
case D3DERR_DEVICELOST:
|
||||
@@ -647,7 +579,6 @@ bool RageDisplay_D3D::BeginFrame()
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
|
||||
D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 );
|
||||
@@ -670,16 +601,6 @@ void RageDisplay_D3D::EndFrame()
|
||||
|
||||
bool RageDisplay_D3D::SupportsTextureFormat( PixelFormat pixfmt, bool realtime )
|
||||
{
|
||||
#if defined(XBOX)
|
||||
/* Lazy... Xbox handles paletted textures completely differently than
|
||||
* regular D3D. It's not worth writing a bunch of code to handle it.
|
||||
* Paletted textures result in worse cache efficiency anyway (see "Xbox
|
||||
* Palettized Texture Performance" in XDK). So, just force 32bit ARGB textures.
|
||||
* -Chris
|
||||
* This is also needed for XGSwizzleRect(). */
|
||||
return pixfmt == PixelFormat_RGBA8;
|
||||
#endif
|
||||
|
||||
// Some cards (Savage) don't support alpha in palettes.
|
||||
// Don't allow paletted textures if this is the case.
|
||||
if( pixfmt == PixelFormat_PAL && !(g_DeviceCaps.TextureCaps & D3DPTEXTURECAPS_ALPHAPALETTE) )
|
||||
@@ -707,9 +628,6 @@ bool RageDisplay_D3D::SupportsThreadedRendering()
|
||||
|
||||
RageSurface* RageDisplay_D3D::CreateScreenshot()
|
||||
{
|
||||
#if defined(XBOX)
|
||||
return NULL;
|
||||
#else
|
||||
// Get the back buffer.
|
||||
IDirect3DSurface8* pSurface;
|
||||
g_pd3dDevice->GetBackBuffer( 0, D3DBACKBUFFER_TYPE_MONO, &pSurface );
|
||||
@@ -756,7 +674,6 @@ RageSurface* RageDisplay_D3D::CreateScreenshot()
|
||||
pCopy->Release();
|
||||
|
||||
return SurfaceCopy;
|
||||
#endif
|
||||
}
|
||||
|
||||
VideoModeParams RageDisplay_D3D::GetActualVideoModeParams() const
|
||||
@@ -1429,15 +1346,6 @@ unsigned RageDisplay_D3D::CreateTexture(
|
||||
IDirect3DTexture8* pTex;
|
||||
hr = g_pd3dDevice->CreateTexture( power_of_two(img->w), power_of_two(img->h), 1, 0, D3DFORMATS[pixfmt], D3DPOOL_MANAGED, &pTex );
|
||||
|
||||
#if defined(XBOX)
|
||||
while(hr == E_OUTOFMEMORY)
|
||||
{
|
||||
if(!vmem_Manager.DecommitLRU())
|
||||
break;
|
||||
hr = g_pd3dDevice->CreateTexture( power_of_two(img->w), power_of_two(img->h), 1, 0, D3DFORMATS[pixfmt], D3DPOOL_MANAGED, &pTex );
|
||||
}
|
||||
#endif
|
||||
|
||||
if( FAILED(hr) )
|
||||
RageException::Throw( "CreateTexture(%i,%i,%s) failed: %s",
|
||||
img->w, img->h, PixelFormatToString(pixfmt).c_str(), GetErrorString(hr).c_str() );
|
||||
@@ -1490,27 +1398,6 @@ void RageDisplay_D3D::UpdateTexture(
|
||||
ASSERT( yoffset+height <= int(desc.Height) );
|
||||
|
||||
// Copy bits
|
||||
#if defined(XBOX)
|
||||
RageSurface *Texture = CreateSurface( width, height, 32,
|
||||
Swap32BE( 0x0000FF00 ),
|
||||
Swap32BE( 0x00FF0000 ),
|
||||
Swap32BE( 0xFF000000 ),
|
||||
Swap32BE( 0x000000FF ) );
|
||||
|
||||
RageSurfaceUtils::Blit( img, Texture, width, height );
|
||||
|
||||
// Xbox textures need to be swizzled
|
||||
XGSwizzleRect(
|
||||
Texture->pixels, // pSource,
|
||||
Texture->pitch, // Pitch,
|
||||
NULL, // pRect,
|
||||
lr.pBits, // pDest,
|
||||
Texture->w, // Width,
|
||||
Texture->h, // Height,
|
||||
NULL, // pPoint,
|
||||
Texture->format->BytesPerPixel ); //BytesPerPixel
|
||||
delete Texture;
|
||||
#else
|
||||
int texpixfmt;
|
||||
for(texpixfmt = 0; texpixfmt < NUM_PixelFormat; ++texpixfmt)
|
||||
if(D3DFORMATS[texpixfmt] == desc.Format) break;
|
||||
@@ -1521,7 +1408,6 @@ void RageDisplay_D3D::UpdateTexture(
|
||||
RageSurfaceUtils::Blit( img, Texture, width, height );
|
||||
|
||||
delete Texture;
|
||||
#endif
|
||||
|
||||
pTex->UnlockRect( 0 );
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#include "RageUtil.h"
|
||||
#include <memory>
|
||||
|
||||
#if defined(_WINDOWS) || defined(_XBOX)
|
||||
#if defined(_WINDOWS)
|
||||
#include "zlib/zlib.h"
|
||||
#if defined(_MSC_VER) && !defined(_XBOX)
|
||||
#if defined(_MSC_VER)
|
||||
#pragma comment(lib, "zlib/zdll.lib")
|
||||
#endif
|
||||
#elif defined(MACOSX)
|
||||
|
||||
@@ -16,9 +16,7 @@
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#include "archutils/Win32/ErrorStrings.h"
|
||||
#if !defined(_XBOX)
|
||||
#include <windows.h>
|
||||
#endif // !defined(_XBOX)
|
||||
#include <io.h>
|
||||
#endif // !defined(WIN32)
|
||||
|
||||
@@ -66,6 +64,10 @@ private:
|
||||
*/
|
||||
bool m_bWriteFailed;
|
||||
bool WriteFailed() const { return !(m_iMode & RageFile::STREAMED) && m_bWriteFailed; }
|
||||
|
||||
// unused
|
||||
RageFileObjDirect& operator=(const RageFileObjDirect& rhs);
|
||||
RageFileObjDirect(const RageFileObjDirect& rhs);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -12,57 +12,13 @@
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#if !defined(_XBOX)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#if defined(_XBOX)
|
||||
/* Wrappers for low-level file functions, to work around Xbox issues: */
|
||||
int DoMkdir( const RString &sPath, int perm )
|
||||
{
|
||||
return mkdir( DoPathReplace(sPath), perm );
|
||||
}
|
||||
|
||||
int DoOpen( const RString &sPath, int flags, int perm )
|
||||
{
|
||||
return open( DoPathReplace(sPath), flags, perm );
|
||||
}
|
||||
|
||||
int DoStat( const RString &sPath, struct stat *st )
|
||||
{
|
||||
return stat( DoPathReplace(sPath), st );
|
||||
}
|
||||
|
||||
int DoRename( const RString &sOldPath, const RString &sNewPath )
|
||||
{
|
||||
return rename( DoPathReplace(sOldPath), DoPathReplace(sNewPath) );
|
||||
}
|
||||
|
||||
int DoRemove( const RString &sPath )
|
||||
{
|
||||
return remove( DoPathReplace(sPath) );
|
||||
}
|
||||
|
||||
int DoRmdir( const RString &sPath )
|
||||
{
|
||||
return rmdir( DoPathReplace(sPath) );
|
||||
}
|
||||
|
||||
HANDLE DoFindFirstFile( const RString &sPath, WIN32_FIND_DATA *fd )
|
||||
{
|
||||
return FindFirstFile( DoPathReplace(sPath), fd );
|
||||
}
|
||||
|
||||
#endif
|
||||
RString DoPathReplace(const RString &sPath)
|
||||
{
|
||||
RString TempPath = sPath;
|
||||
#if defined(XBOX)
|
||||
TempPath.Replace( "//", "\\" );
|
||||
TempPath.Replace( "/", "\\" );
|
||||
#endif
|
||||
return TempPath;
|
||||
}
|
||||
|
||||
@@ -72,9 +28,9 @@ static bool WinMoveFileInternal( const RString &sOldPath, const RString &sNewPat
|
||||
{
|
||||
static bool Win9x = false;
|
||||
|
||||
/* Windows botches rename: it returns error if the file exists. In NT,
|
||||
/* Windows botches rename: it returns error if the file exists. In NT,
|
||||
* we can use MoveFileEx( new, old, MOVEFILE_REPLACE_EXISTING ) (though I
|
||||
* don't know if it has similar atomicity guarantees to rename). In
|
||||
* don't know if it has similar atomicity guarantees to rename). In
|
||||
* 9x, we're screwed, so just delete any existing file (we aren't going
|
||||
* to be robust on 9x anyway). */
|
||||
if( !Win9x )
|
||||
@@ -92,7 +48,7 @@ static bool WinMoveFileInternal( const RString &sOldPath, const RString &sNewPat
|
||||
|
||||
if( MoveFile( sOldPath, sNewPath ) )
|
||||
return true;
|
||||
|
||||
|
||||
if( GetLastError() != ERROR_ALREADY_EXISTS )
|
||||
return false;
|
||||
|
||||
@@ -118,15 +74,15 @@ bool WinMoveFile( RString sOldPath, RString sNewPath )
|
||||
/* mkdir -p. Doesn't fail if Path already exists and is a directory. */
|
||||
bool CreateDirectories( RString Path )
|
||||
{
|
||||
/* XXX: handle "//foo/bar" paths in Windows */
|
||||
// XXX: handle "//foo/bar" paths in Windows
|
||||
vector<RString> parts;
|
||||
RString curpath;
|
||||
|
||||
/* If Path is absolute, add the initial slash ("ignore empty" will remove it). */
|
||||
// If Path is absolute, add the initial slash ("ignore empty" will remove it).
|
||||
if( Path.Left(1) == "/" )
|
||||
curpath = "/";
|
||||
|
||||
/* Ignore empty, so eg. "/foo/bar//baz" doesn't try to create "/foo/bar" twice. */
|
||||
// Ignore empty, so eg. "/foo/bar//baz" doesn't try to create "/foo/bar" twice.
|
||||
split( Path, "/", parts, true );
|
||||
|
||||
for(unsigned i = 0; i < parts.size(); ++i)
|
||||
@@ -174,7 +130,7 @@ bool CreateDirectories( RString Path )
|
||||
WARN( ssprintf("Couldn't create %s: %s", curpath.c_str(), strerror(errno)) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -189,10 +145,10 @@ void DirectFilenameDB::SetRoot( RString root_ )
|
||||
{
|
||||
root = root_;
|
||||
|
||||
/* "\abcd\" -> "/abcd/": */
|
||||
// "\abcd\" -> "/abcd/":
|
||||
root.Replace( "\\", "/" );
|
||||
|
||||
/* "/abcd/" -> "/abcd": */
|
||||
// "/abcd/" -> "/abcd":
|
||||
if( root.Right(1) == "/" )
|
||||
root.erase( root.size()-1, 1 );
|
||||
}
|
||||
@@ -210,7 +166,7 @@ void DirectFilenameDB::CacheFile( const RString &sPath )
|
||||
}
|
||||
while( !pFileSet->m_bFilled )
|
||||
m_Mutex.Wait();
|
||||
|
||||
|
||||
#if defined(WIN32)
|
||||
// There is almost surely a better way to do this
|
||||
WIN32_FIND_DATA fd;
|
||||
@@ -224,12 +180,12 @@ void DirectFilenameDB::CacheFile( const RString &sPath )
|
||||
f.dir = !!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
|
||||
f.size = fd.nFileSizeLow;
|
||||
f.hash = fd.ftLastWriteTime.dwLowDateTime;
|
||||
|
||||
|
||||
pFileSet->files.insert( f );
|
||||
FindClose( hFind );
|
||||
#else
|
||||
File f( Basename(sPath) );
|
||||
|
||||
|
||||
struct stat st;
|
||||
if( DoStat(root+sPath, &st) == -1 )
|
||||
{
|
||||
@@ -237,7 +193,7 @@ void DirectFilenameDB::CacheFile( const RString &sPath )
|
||||
// If it's a broken symlink, ignore it. Otherwise, warn.
|
||||
// Huh?
|
||||
WARN( ssprintf("File '%s' is gone! (%s)",
|
||||
sPath.c_str(), strerror(iError)) );
|
||||
sPath.c_str(), strerror(iError)) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -255,17 +211,10 @@ void DirectFilenameDB::PopulateFileSet( FileSet &fs, const RString &path )
|
||||
{
|
||||
RString sPath = path;
|
||||
|
||||
#if defined(XBOX)
|
||||
/* Xbox doesn't handle path names which end with ".", which are used when using an
|
||||
* alternative song directory */
|
||||
if( sPath.size() > 0 && sPath.Right(1) == "." )
|
||||
sPath.erase( sPath.size() - 1 );
|
||||
#endif
|
||||
|
||||
/* Resolve path cases (path/Path -> PATH/path). */
|
||||
// Resolve path cases (path/Path -> PATH/path).
|
||||
ResolvePath( sPath );
|
||||
|
||||
fs.age.GetDeltaTime(); /* reset */
|
||||
fs.age.GetDeltaTime(); // reset
|
||||
fs.files.clear();
|
||||
|
||||
#if defined(WIN32)
|
||||
|
||||
@@ -5,15 +5,6 @@
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
#if defined(_XBOX)
|
||||
int DoMkdir( const RString &sPath, int perm );
|
||||
int DoOpen( const RString &sPath, int flags, int perm );
|
||||
int DoStat( const RString &sPath, struct stat *st );
|
||||
int DoRename( const RString &sOldPath, const RString &sNewPath );
|
||||
int DoRemove( const RString &sPath );
|
||||
int DoRmdir( const RString &sPath );
|
||||
HANDLE DoFindFirstFile( const RString &sPath, WIN32_FIND_DATA *fd );
|
||||
#else
|
||||
#define DoOpen open
|
||||
#define DoStat stat
|
||||
#define DoMkdir mkdir
|
||||
@@ -21,7 +12,6 @@ HANDLE DoFindFirstFile( const RString &sPath, WIN32_FIND_DATA *fd );
|
||||
#define DoRename rename
|
||||
#define DoRemove remove
|
||||
#define DoRmdir rmdir
|
||||
#endif
|
||||
RString DoPathReplace( const RString &sPath );
|
||||
|
||||
#if defined(WIN32)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <cerrno>
|
||||
|
||||
#if defined(WIN32) && !defined(XBOX)
|
||||
#if defined(WIN32)
|
||||
#include <windows.h>
|
||||
#elif defined(UNIX) || defined(MACOSX)
|
||||
#include <paths.h>
|
||||
@@ -174,11 +174,7 @@ static RageFileDriverMountpoints *g_Mountpoints = NULL;
|
||||
|
||||
static RString GetDirOfExecutable( RString argv0 )
|
||||
{
|
||||
#ifdef _XBOX
|
||||
// ???: what if it's not running from D:\?
|
||||
return "D:\\";
|
||||
#else
|
||||
/* argv[0] can be wrong in most OS's; try to avoid using it. */
|
||||
// argv[0] can be wrong in most OS's; try to avoid using it.
|
||||
|
||||
RString sPath;
|
||||
#if defined(WIN32)
|
||||
@@ -241,7 +237,6 @@ static RString GetDirOfExecutable( RString argv0 )
|
||||
#endif
|
||||
}
|
||||
return sPath;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ChangeToDirOfExecutable( const RString &argv0 )
|
||||
|
||||
+1
-1
@@ -175,7 +175,7 @@ void RageLog::SetShowLogOutput( bool show )
|
||||
{
|
||||
m_bShowLogOutput = show;
|
||||
|
||||
#if defined(WIN32) && !defined(_XBOX)
|
||||
#if defined(WIN32)
|
||||
if( m_bShowLogOutput )
|
||||
{
|
||||
// create a new console window and attach standard handles
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@ RageMatrix RageMatrix::GetTranspose() const
|
||||
|
||||
void RageMatrixMultiply( RageMatrix* pOut, const RageMatrix* pA, const RageMatrix* pB )
|
||||
{
|
||||
//#if defined(_WINDOWS) || defined(_XBOX)
|
||||
//#if defined(_WINDOWS)
|
||||
// // <30 cycles for theirs versus >100 for ours.
|
||||
// D3DXMatrixMultiply( (D3DMATRIX*)pOut, (D3DMATRIX*)pA, (D3DMATRIX*)pB );
|
||||
//#else
|
||||
|
||||
+3
-2
@@ -48,9 +48,10 @@ RageSoundLoadParams::RageSoundLoadParams():
|
||||
m_bSupportRateChanging(false), m_bSupportPan(false) {}
|
||||
|
||||
RageSound::RageSound():
|
||||
m_Mutex( "RageSound" ), m_pSource(NULL), m_iStreamFrame(0),
|
||||
m_Mutex( "RageSound" ), m_pSource(NULL),
|
||||
m_sFilePath(""), m_Param(), m_iStreamFrame(0),
|
||||
m_iStoppedSourceFrame(0), m_bPlaying(false),
|
||||
m_bDeleteWhenFinished(false)
|
||||
m_sError(""), m_bDeleteWhenFinished(false)
|
||||
{
|
||||
ASSERT( SOUNDMAN );
|
||||
}
|
||||
|
||||
@@ -9,24 +9,16 @@
|
||||
#include <cerrno>
|
||||
#include <map>
|
||||
|
||||
#if defined(_WINDOWS) || defined(_XBOX) || defined(MACOSX)
|
||||
#if defined(_WINDOWS) || defined(MACOSX)
|
||||
#include "mad-0.15.1b/mad.h"
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _XBOX
|
||||
#ifdef DEBUG
|
||||
#pragma comment(lib, "mad-0.15.1b/xboxmad/debug/xboxmad.lib")
|
||||
#else
|
||||
#pragma comment(lib, "mad-0.15.1b/xboxmad/Release/xboxmad.lib")
|
||||
#endif // DEBUG
|
||||
#else
|
||||
#pragma comment(lib, "mad-0.15.1b/msvc++/Release/libmad.lib")
|
||||
#endif // _XBOX
|
||||
#endif //_MSC_VER
|
||||
#else
|
||||
#include <mad.h>
|
||||
#endif // _WINDOWS
|
||||
|
||||
/* ID3 code from libid3: */
|
||||
// ID3 code from libid3:
|
||||
enum tagtype {
|
||||
TAGTYPE_NONE = 0,
|
||||
TAGTYPE_ID3V1,
|
||||
|
||||
@@ -7,24 +7,15 @@
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
// Don't let jpeglib.h define the boolean type on Xbox.
|
||||
#if defined(_XBOX)
|
||||
# define HAVE_BOOLEAN
|
||||
#endif
|
||||
|
||||
#if defined(WIN32)
|
||||
/* work around namespace bugs in win32/libjpeg: */
|
||||
// work around namespace bugs in win32/libjpeg:
|
||||
#define XMD_H
|
||||
#undef FAR
|
||||
#include "libjpeg/jpeglib.h"
|
||||
#include "libjpeg/jerror.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if !defined(XBOX)
|
||||
#pragma comment(lib, "libjpeg/jpeg.lib")
|
||||
#else
|
||||
#pragma comment(lib, "libjpeg/xboxjpeg.lib")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#pragma warning(disable: 4611) /* interaction between '_setjmp' and C++ object destruction is non-portable */
|
||||
|
||||
@@ -6,25 +6,16 @@
|
||||
#include "RageSurface.h"
|
||||
|
||||
|
||||
#if defined(_WINDOWS) || defined(_XBOX)
|
||||
#if defined(_WINDOWS)
|
||||
# include "libpng/include/png.h"
|
||||
# if defined(_MSC_VER)
|
||||
# if defined(_XBOX)
|
||||
# pragma comment(lib, "libpng/lib/xboxlibpng.lib")
|
||||
# else
|
||||
# pragma comment(lib, "libpng/lib/libpng.lib")
|
||||
# endif
|
||||
# pragma comment(lib, "libpng/lib/libpng.lib")
|
||||
# pragma warning(disable: 4611) /* interaction between '_setjmp' and C++ object destruction is non-portable */
|
||||
# endif // _MSC_VER
|
||||
#else
|
||||
# include <png.h>
|
||||
#endif
|
||||
|
||||
#if defined(_XBOX)
|
||||
# include <malloc.h> // for alloca
|
||||
# include "archutils/Xbox/VirtualMemory.h"
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
void RageFile_png_read( png_struct *png, png_byte *p, png_size_t size )
|
||||
@@ -80,16 +71,6 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
|
||||
|
||||
png_struct *png = png_create_read_struct( PNG_LIBPNG_VER_STRING, &error, PNG_Error, PNG_Warning );
|
||||
|
||||
#if defined(XBOX)
|
||||
while(png == NULL)
|
||||
{
|
||||
if(!vmem_Manager.DecommitLRU())
|
||||
break;
|
||||
|
||||
png = png_create_read_struct( PNG_LIBPNG_VER_STRING, &error, PNG_Error, PNG_Warning );
|
||||
}
|
||||
#endif
|
||||
|
||||
if( png == NULL )
|
||||
{
|
||||
sprintf( errorbuf, "creating png_create_read_struct failed");
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageFile.h"
|
||||
|
||||
#undef FAR /* fix for VC */
|
||||
#undef FAR // fix for VC
|
||||
/** @brief A helper to get the jpeg lib. */
|
||||
namespace jpeg
|
||||
{
|
||||
@@ -16,16 +16,11 @@ namespace jpeg
|
||||
}
|
||||
}
|
||||
|
||||
/* Pull in JPEG library here. */
|
||||
#ifdef _XBOX
|
||||
#pragma comment(lib, "libjpeg/xboxjpeg.lib")
|
||||
#elif defined _MSC_VER
|
||||
// Pull in JPEG library here.
|
||||
#if defined _MSC_VER
|
||||
#pragma comment(lib, "libjpeg/jpeg.lib")
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#define OUTPUT_BUFFER_SIZE 4096
|
||||
typedef struct
|
||||
{
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
#include "RageLog.h"
|
||||
#include "RageUtil.h"
|
||||
|
||||
#if defined(WINDOWS) || defined(_XBOX)
|
||||
#if defined(WINDOWS)
|
||||
#include "libpng/include/png.h"
|
||||
#if defined(_MSC_VER)
|
||||
# if defined(_XBOX)
|
||||
# pragma comment(lib, "libpng/lib/xboxlibpng.lib")
|
||||
# else
|
||||
# pragma comment(lib, "libpng/lib/libpng.lib")
|
||||
# endif
|
||||
# pragma comment(lib, "libpng/lib/libpng.lib")
|
||||
#pragma warning(disable: 4611) /* interaction between '_setjmp' and C++ object destruction is non-portable */
|
||||
#endif
|
||||
#else
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
/* RageTexturePreloader - Load textures in advance, for use later. */
|
||||
|
||||
#ifndef RAGE_TEXTURE_PRELOADER_H
|
||||
#define RAGE_TEXTURE_PRELOADER_H
|
||||
|
||||
class RageTexture;
|
||||
struct RageTextureID;
|
||||
|
||||
/** @brief Load the textures in advance for using them later. */
|
||||
class RageTexturePreloader
|
||||
{
|
||||
public:
|
||||
RageTexturePreloader() { }
|
||||
RageTexturePreloader( const RageTexturePreloader &cpy ) { *this = cpy; }
|
||||
RageTexturePreloader(): m_apTextures() { }
|
||||
RageTexturePreloader( const RageTexturePreloader &cpy ):
|
||||
m_apTextures(cpy.m_apTextures) { }
|
||||
RageTexturePreloader &operator=( const RageTexturePreloader &rhs );
|
||||
~RageTexturePreloader();
|
||||
void Load( const RageTextureID &ID );
|
||||
|
||||
@@ -335,6 +335,7 @@ typedef StepMania::Rect<float> RectF;
|
||||
* have the same layout that D3D expects. */
|
||||
struct RageSpriteVertex // has color
|
||||
{
|
||||
RageSpriteVertex(): p(), n(), c(), t() {}
|
||||
RageVector3 p; // position
|
||||
RageVector3 n; // normal
|
||||
RageVColor c; // diffuse color
|
||||
|
||||
@@ -967,14 +967,10 @@ bool GetCommandlineArgument( const RString &option, RString *argument, int iInde
|
||||
|
||||
RString GetCwd()
|
||||
{
|
||||
#ifdef _XBOX
|
||||
return SYS_BASE_PATH;
|
||||
#else
|
||||
char buf[PATH_MAX];
|
||||
bool ret = getcwd(buf, PATH_MAX) != NULL;
|
||||
ASSERT(ret);
|
||||
return buf;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -18,17 +18,14 @@ template<typename T>
|
||||
class CachedObject
|
||||
{
|
||||
public:
|
||||
CachedObject()
|
||||
CachedObject(): m_pObject(NULL)
|
||||
{
|
||||
m_pObject = NULL;
|
||||
|
||||
/* A new object is being constructed, so invalidate negative caching. */
|
||||
ClearCacheNegative();
|
||||
}
|
||||
|
||||
CachedObject( const CachedObject &cpy )
|
||||
CachedObject( const CachedObject &cpy ): m_pObject(NULL)
|
||||
{
|
||||
m_pObject = NULL;
|
||||
ClearCacheNegative();
|
||||
}
|
||||
|
||||
@@ -117,11 +114,10 @@ public:
|
||||
Object::Register( this );
|
||||
}
|
||||
|
||||
CachedObjectPointer( const CachedObjectPointer &cpy )
|
||||
CachedObjectPointer( const CachedObjectPointer &cpy ):
|
||||
m_pCache(cpy.m_pCache), m_bCacheIsSet(cpy.m_bCacheIsSet)
|
||||
{
|
||||
CachedObjectHelpers::Lock();
|
||||
m_pCache = cpy.m_pCache;
|
||||
m_bCacheIsSet = cpy.m_bCacheIsSet;
|
||||
Object::Register( this );
|
||||
CachedObjectHelpers::Unlock();
|
||||
}
|
||||
|
||||
+5
-36
@@ -94,35 +94,6 @@ static const char *EditStateNames[] = {
|
||||
XToString( EditState );
|
||||
LuaXType( EditState );
|
||||
|
||||
#if defined(XBOX)
|
||||
void ScreenEdit::InitEditMappings()
|
||||
{
|
||||
/* XXX: fill this in */
|
||||
m_EditMappingsDeviceInput.Clear();
|
||||
|
||||
switch( EDIT_MODE.GetValue() )
|
||||
{
|
||||
case EditMode_Practice:
|
||||
m_EditMappingsDeviceInput.button[EDIT_BUTTON_SCROLL_PREV_MEASURE][0] = DeviceInput(DEVICE_JOY1, JOY_HAT_UP);
|
||||
m_EditMappingsMenuButton.button[EDIT_BUTTON_SCROLL_PREV_MEASURE][0] = GAME_BUTTON_UP;
|
||||
m_EditMappingsDeviceInput.button[EDIT_BUTTON_SCROLL_NEXT_MEASURE][0] = DeviceInput(DEVICE_JOY1, JOY_HAT_DOWN);
|
||||
m_EditMappingsMenuButton.button[EDIT_BUTTON_SCROLL_NEXT_MEASURE][0] = GAME_BUTTON_DOWN;
|
||||
break;
|
||||
default:
|
||||
m_EditMappingsDeviceInput.button[EDIT_BUTTON_SCROLL_UP_LINE][0] = DeviceInput(DEVICE_JOY1, JOY_HAT_UP);
|
||||
m_EditMappingsMenuButton.button[EDIT_BUTTON_SCROLL_UP_LINE][0] = GAME_BUTTON_UP;
|
||||
m_EditMappingsDeviceInput.button[EDIT_BUTTON_SCROLL_DOWN_LINE][0] = DeviceInput(DEVICE_JOY1, JOY_HAT_DOWN);
|
||||
m_EditMappingsMenuButton.button[EDIT_BUTTON_SCROLL_DOWN_LINE][0] = GAME_BUTTON_DOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
// Map these to the triggers: L goes up, R goes down.
|
||||
m_EditMappingsDeviceInput.button[EDIT_BUTTON_SCROLL_UP_PAGE][0] = DeviceInput(DEVICE_JOY1, JOY_BUTTON_7);
|
||||
//m_EditMappingsMenuButton.button[EDIT_BUTTON_SCROLL_UP_PAGE][0] = GAME_BUTTON_UPLEFT;
|
||||
m_EditMappingsDeviceInput.button[EDIT_BUTTON_SCROLL_DOWN_PAGE][0] = DeviceInput(DEVICE_JOY1, JOY_BUTTON_8);
|
||||
//m_EditMappingsMenuButton.button[EDIT_BUTTON_SCROLL_DOWN_PAGE][0] = GAME_BUTTON_UPRIGHT;
|
||||
}
|
||||
#else
|
||||
void ScreenEdit::InitEditMappings()
|
||||
{
|
||||
m_EditMappingsDeviceInput.Clear();
|
||||
@@ -268,7 +239,7 @@ void ScreenEdit::InitEditMappings()
|
||||
m_EditMappingsDeviceInput.button[EDIT_BUTTON_RIGHT_SIDE][1] = DeviceInput(DEVICE_KEYBOARD, KEY_RALT);
|
||||
m_EditMappingsDeviceInput.button[EDIT_BUTTON_LAY_ROLL][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT);
|
||||
// m_EditMappingsDeviceInput.button[EDIT_BUTTON_LAY_TAP_ATTACK][0] = DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT);
|
||||
|
||||
|
||||
m_EditMappingsDeviceInput.button[EDIT_BUTTON_CYCLE_TAP_LEFT][0] = DeviceInput(DEVICE_KEYBOARD, KEY_Cn);
|
||||
m_EditMappingsDeviceInput.button[EDIT_BUTTON_CYCLE_TAP_RIGHT][0] = DeviceInput(DEVICE_KEYBOARD, KEY_Cm);
|
||||
|
||||
@@ -291,7 +262,7 @@ void ScreenEdit::InitEditMappings()
|
||||
m_EditMappingsMenuButton.button[EDIT_BUTTON_OPEN_EDIT_MENU][1] = GAME_BUTTON_BACK;
|
||||
m_EditMappingsDeviceInput.button[EDIT_BUTTON_OPEN_AREA_MENU][0] = DeviceInput(DEVICE_KEYBOARD, KEY_ENTER);
|
||||
m_EditMappingsDeviceInput.button[EDIT_BUTTON_OPEN_INPUT_HELP][0] = DeviceInput(DEVICE_KEYBOARD, KEY_F1);
|
||||
|
||||
|
||||
m_EditMappingsDeviceInput.button[EDIT_BUTTON_BAKE_RANDOM_FROM_SONG_GROUP][0] = DeviceInput(DEVICE_KEYBOARD, KEY_Cb);
|
||||
m_EditMappingsDeviceInput.hold[EDIT_BUTTON_BAKE_RANDOM_FROM_SONG_GROUP][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LALT);
|
||||
m_EditMappingsDeviceInput.hold[EDIT_BUTTON_BAKE_RANDOM_FROM_SONG_GROUP][1] = DeviceInput(DEVICE_KEYBOARD, KEY_RALT);
|
||||
@@ -309,7 +280,7 @@ void ScreenEdit::InitEditMappings()
|
||||
|
||||
m_EditMappingsDeviceInput.button[EDIT_BUTTON_ADJUST_FINE][0] = DeviceInput(DEVICE_KEYBOARD, KEY_RALT);
|
||||
m_EditMappingsDeviceInput.button[EDIT_BUTTON_ADJUST_FINE][1] = DeviceInput(DEVICE_KEYBOARD, KEY_LALT);
|
||||
|
||||
|
||||
m_EditMappingsDeviceInput.button[EDIT_BUTTON_SAVE][1] = DeviceInput(DEVICE_KEYBOARD, KEY_Cs);
|
||||
#if defined(MACOSX)
|
||||
/* use cmd */
|
||||
@@ -322,10 +293,10 @@ void ScreenEdit::InitEditMappings()
|
||||
#endif
|
||||
|
||||
m_EditMappingsDeviceInput.button[EDIT_BUTTON_UNDO][1] = DeviceInput(DEVICE_KEYBOARD, KEY_Cu);
|
||||
|
||||
|
||||
// Switch players, if it makes sense to do so.
|
||||
m_EditMappingsDeviceInput.button[EDIT_BUTTON_SWITCH_PLAYERS][0] = DeviceInput(DEVICE_KEYBOARD, KEY_SLASH);
|
||||
|
||||
|
||||
m_PlayMappingsDeviceInput.button[EDIT_BUTTON_RETURN_TO_EDIT][0] = DeviceInput(DEVICE_KEYBOARD, KEY_ESC);
|
||||
m_PlayMappingsMenuButton.button[EDIT_BUTTON_RETURN_TO_EDIT][1] = GAME_BUTTON_BACK;
|
||||
|
||||
@@ -346,8 +317,6 @@ void ScreenEdit::InitEditMappings()
|
||||
m_RecordPausedMappingsDeviceInput.button[EDIT_BUTTON_UNDO][0] = DeviceInput(DEVICE_KEYBOARD, KEY_Cu);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Given a DeviceInput that was just depressed, return an active edit function. */
|
||||
EditButton ScreenEdit::DeviceToEdit( const DeviceInput &DeviceI ) const
|
||||
{
|
||||
|
||||
+8
-20
@@ -95,26 +95,14 @@ static Preference<float> g_fNetStartOffset( "NetworkStartOffset", -3.0 );
|
||||
static Preference<bool> g_bEasterEggs( "EasterEggs", true );
|
||||
|
||||
|
||||
PlayerInfo::PlayerInfo()
|
||||
{
|
||||
m_pn = PLAYER_INVALID;
|
||||
m_mp = MultiPlayer_Invalid;
|
||||
m_bIsDummy = false;
|
||||
m_iDummyIndex = 0;
|
||||
m_iAddToDifficulty = 0;
|
||||
m_pLifeMeter = NULL;
|
||||
m_ptextCourseSongNumber = NULL;
|
||||
m_ptextStepsDescription = NULL;
|
||||
m_pPrimaryScoreDisplay = NULL;
|
||||
m_pSecondaryScoreDisplay = NULL;
|
||||
m_pPrimaryScoreKeeper = NULL;
|
||||
m_pSecondaryScoreKeeper = NULL;
|
||||
m_ptextPlayerOptions = NULL;
|
||||
m_pActiveAttackList = NULL;
|
||||
m_pPlayer = NULL;
|
||||
m_pInventory = NULL;
|
||||
m_pStepsDisplay = NULL;
|
||||
}
|
||||
PlayerInfo::PlayerInfo(): m_pn(PLAYER_INVALID), m_mp(MultiPlayer_Invalid),
|
||||
m_bIsDummy(false), m_iDummyIndex(0), m_iAddToDifficulty(0),
|
||||
m_bPlayerEnabled(false), m_pLifeMeter(NULL),
|
||||
m_ptextCourseSongNumber(NULL), m_ptextStepsDescription(NULL),
|
||||
m_pPrimaryScoreDisplay(NULL), m_pSecondaryScoreDisplay(NULL),
|
||||
m_pPrimaryScoreKeeper(NULL), m_pSecondaryScoreKeeper(NULL),
|
||||
m_pActiveAttackList(NULL), m_pPlayer(NULL), m_pInventory(NULL),
|
||||
m_pStepsDisplay(NULL) {}
|
||||
|
||||
void PlayerInfo::Load( PlayerNumber pn, MultiPlayer mp, bool bShowNoteField, int iAddToDifficulty )
|
||||
{
|
||||
|
||||
@@ -240,28 +240,6 @@ void ScreenMapControllers::Input( const InputEventPlus &input )
|
||||
|
||||
int button = input.DeviceI.button;
|
||||
|
||||
#ifdef _XBOX
|
||||
if( m_WaitingForPress.IsZero() && input.DeviceI.device == DEVICE_JOY1 )
|
||||
{
|
||||
// map the xbox controller buttons to the keyboard equivalents
|
||||
if( input.DeviceI.button == JOY_HAT_LEFT )
|
||||
button = KEY_LEFT;
|
||||
else if( input.DeviceI.button == JOY_HAT_RIGHT )
|
||||
button = KEY_RIGHT;
|
||||
else if( input.DeviceI.button == JOY_HAT_UP )
|
||||
button = KEY_UP;
|
||||
else if( input.DeviceI.button == JOY_HAT_DOWN )
|
||||
button = KEY_DOWN;
|
||||
else if( input.DeviceI.button == JOY_AUX_1 )
|
||||
button = KEY_ENTER;
|
||||
else if( input.DeviceI.button == JOY_AUX_2 )
|
||||
button = KEY_ESC;
|
||||
else if( input.DeviceI.button == JOY_BUTTON_1 || input.DeviceI.button == JOY_BUTTON_2 ||
|
||||
input.DeviceI.button == JOY_BUTTON_3 || input.DeviceI.button == JOY_BUTTON_4 )
|
||||
button = KEY_DEL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* TRICKY: Some adapters map the PlayStation digital d-pad to both axes and
|
||||
* buttons. We want buttons to be used for any mappings where possible
|
||||
* because presses of buttons aren't mutually exclusive and presses of axes
|
||||
@@ -293,11 +271,7 @@ void ScreenMapControllers::Input( const InputEventPlus &input )
|
||||
m_DeviceIToMap = input.DeviceI;
|
||||
}
|
||||
}
|
||||
#ifdef _XBOX
|
||||
else if( input.DeviceI.device == DEVICE_JOY1 )
|
||||
#else
|
||||
else if( input.DeviceI.device == DEVICE_KEYBOARD )
|
||||
#endif
|
||||
{
|
||||
switch( button )
|
||||
{
|
||||
@@ -310,10 +284,8 @@ void ScreenMapControllers::Input( const InputEventPlus &input )
|
||||
* pressed up on the joypad. */
|
||||
|
||||
case KEY_DEL:
|
||||
#ifndef _XBOX
|
||||
case KEY_SPACE:
|
||||
case KEY_BACK: // Clear the selected input mapping.
|
||||
#endif
|
||||
if( m_iCurButton == (int) m_KeysToMap.size() )
|
||||
break; // on exit
|
||||
|
||||
|
||||
+74
-25
@@ -20,33 +20,60 @@ struct MenuRowDef
|
||||
bool bThemeTitle;
|
||||
bool bThemeItems;
|
||||
|
||||
MenuRowDef() {}
|
||||
MenuRowDef( int r, RString n, MenuRowUpdateEnabled pe, EditMode s, bool bTT, bool bTI, int d, const char *c0=NULL, const char *c1=NULL, const char *c2=NULL, const char *c3=NULL, const char *c4=NULL, const char *c5=NULL, const char *c6=NULL, const char *c7=NULL, const char *c8=NULL, const char *c9=NULL, const char *c10=NULL, const char *c11=NULL, const char *c12=NULL, const char *c13=NULL, const char *c14=NULL, const char *c15=NULL, const char *c16=NULL, const char *c17=NULL, const char *c18=NULL, const char *c19=NULL, const char *c20=NULL, const char *c21=NULL, const char *c22=NULL, const char *c23=NULL, const char *c24=NULL, const char *c25=NULL )
|
||||
MenuRowDef(): iRowCode(0), sName(""), bEnabled(false),
|
||||
pfnEnabled(), emShowIn(), iDefaultChoice(0),
|
||||
choices(), bThemeTitle(false), bThemeItems(false) {}
|
||||
MenuRowDef( int r, RString n, MenuRowUpdateEnabled pe, EditMode s,
|
||||
bool bTT, bool bTI, int d, const char *c0=NULL,
|
||||
const char *c1=NULL, const char *c2=NULL,
|
||||
const char *c3=NULL, const char *c4=NULL,
|
||||
const char *c5=NULL, const char *c6=NULL,
|
||||
const char *c7=NULL, const char *c8=NULL,
|
||||
const char *c9=NULL, const char *c10=NULL,
|
||||
const char *c11=NULL, const char *c12=NULL,
|
||||
const char *c13=NULL, const char *c14=NULL,
|
||||
const char *c15=NULL, const char *c16=NULL,
|
||||
const char *c17=NULL, const char *c18=NULL,
|
||||
const char *c19=NULL, const char *c20=NULL,
|
||||
const char *c21=NULL, const char *c22=NULL,
|
||||
const char *c23=NULL, const char *c24=NULL,
|
||||
const char *c25=NULL ): iRowCode(r), sName(n),
|
||||
bEnabled(true), pfnEnabled(pe), emShowIn(s),
|
||||
iDefaultChoice(d), choices(),
|
||||
bThemeTitle(bTT), bThemeItems(bTI)
|
||||
{
|
||||
iRowCode = r;
|
||||
sName = n;
|
||||
bEnabled = true;
|
||||
pfnEnabled = pe;
|
||||
emShowIn = s;
|
||||
bThemeTitle = bTT;
|
||||
bThemeItems = bTI;
|
||||
iDefaultChoice = d;
|
||||
#define PUSH( c ) if(c) choices.push_back(c);
|
||||
PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);PUSH(c12);PUSH(c13);PUSH(c14);PUSH(c15);PUSH(c16);PUSH(c17);PUSH(c18);PUSH(c19);PUSH(c20);PUSH(c21);PUSH(c22);PUSH(c22);PUSH(c23);PUSH(c23);PUSH(c24);PUSH(c25);
|
||||
PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);
|
||||
PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);
|
||||
PUSH(c12);PUSH(c13);PUSH(c14);PUSH(c15);PUSH(c16);PUSH(c17);
|
||||
PUSH(c18);PUSH(c19);PUSH(c20);PUSH(c21);PUSH(c22);PUSH(c22);
|
||||
PUSH(c23);PUSH(c23);PUSH(c24);PUSH(c25);
|
||||
#undef PUSH
|
||||
}
|
||||
MenuRowDef( int r, RString n, bool e, EditMode s, bool bTT, bool bTI, int d, const char *c0=NULL, const char *c1=NULL, const char *c2=NULL, const char *c3=NULL, const char *c4=NULL, const char *c5=NULL, const char *c6=NULL, const char *c7=NULL, const char *c8=NULL, const char *c9=NULL, const char *c10=NULL, const char *c11=NULL, const char *c12=NULL, const char *c13=NULL, const char *c14=NULL, const char *c15=NULL, const char *c16=NULL, const char *c17=NULL, const char *c18=NULL, const char *c19=NULL, const char *c20=NULL, const char *c21=NULL, const char *c22=NULL, const char *c23=NULL, const char *c24=NULL, const char *c25=NULL )
|
||||
MenuRowDef( int r, RString n, bool e, EditMode s, bool bTT, bool bTI,
|
||||
int d, const char *c0=NULL, const char *c1=NULL,
|
||||
const char *c2=NULL, const char *c3=NULL,
|
||||
const char *c4=NULL, const char *c5=NULL,
|
||||
const char *c6=NULL, const char *c7=NULL,
|
||||
const char *c8=NULL, const char *c9=NULL,
|
||||
const char *c10=NULL, const char *c11=NULL,
|
||||
const char *c12=NULL, const char *c13=NULL,
|
||||
const char *c14=NULL, const char *c15=NULL,
|
||||
const char *c16=NULL, const char *c17=NULL,
|
||||
const char *c18=NULL, const char *c19=NULL,
|
||||
const char *c20=NULL, const char *c21=NULL,
|
||||
const char *c22=NULL, const char *c23=NULL,
|
||||
const char *c24=NULL, const char *c25=NULL ):
|
||||
iRowCode(r), sName(n), bEnabled(e), pfnEnabled(NULL),
|
||||
emShowIn(s), iDefaultChoice(d), choices(),
|
||||
bThemeTitle(bTT), bThemeItems(bTI)
|
||||
{
|
||||
iRowCode = r;
|
||||
sName = n;
|
||||
bEnabled = e;
|
||||
pfnEnabled = NULL;
|
||||
emShowIn = s;
|
||||
bThemeTitle = bTT;
|
||||
bThemeItems = bTI;
|
||||
iDefaultChoice = d;
|
||||
#define PUSH( c ) if(c) choices.push_back(c);
|
||||
PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);PUSH(c12);PUSH(c13);PUSH(c14);PUSH(c15);PUSH(c16);PUSH(c17);PUSH(c18);PUSH(c19);PUSH(c20);PUSH(c21);PUSH(c22);PUSH(c22);PUSH(c23);PUSH(c23);PUSH(c24);PUSH(c25);
|
||||
PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);
|
||||
PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);
|
||||
PUSH(c12);PUSH(c13);PUSH(c14);PUSH(c15);PUSH(c16);PUSH(c17);
|
||||
PUSH(c18);PUSH(c19);PUSH(c20);PUSH(c21);PUSH(c22);PUSH(c22);
|
||||
PUSH(c23);PUSH(c23);PUSH(c24);PUSH(c25);
|
||||
#undef PUSH
|
||||
}
|
||||
|
||||
@@ -76,11 +103,29 @@ struct MenuDef
|
||||
RString sClassName;
|
||||
vector<MenuRowDef> rows;
|
||||
|
||||
MenuDef( RString c, MenuRowDef r0=MenuRowDef(), MenuRowDef r1=MenuRowDef(), MenuRowDef r2=MenuRowDef(), MenuRowDef r3=MenuRowDef(), MenuRowDef r4=MenuRowDef(), MenuRowDef r5=MenuRowDef(), MenuRowDef r6=MenuRowDef(), MenuRowDef r7=MenuRowDef(), MenuRowDef r8=MenuRowDef(), MenuRowDef r9=MenuRowDef(), MenuRowDef r10=MenuRowDef(), MenuRowDef r11=MenuRowDef(), MenuRowDef r12=MenuRowDef(), MenuRowDef r13=MenuRowDef(), MenuRowDef r14=MenuRowDef(), MenuRowDef r15=MenuRowDef(), MenuRowDef r16=MenuRowDef(), MenuRowDef r17=MenuRowDef(), MenuRowDef r18=MenuRowDef(), MenuRowDef r19=MenuRowDef(), MenuRowDef r20=MenuRowDef(), MenuRowDef r21=MenuRowDef(), MenuRowDef r22=MenuRowDef(), MenuRowDef r23=MenuRowDef(), MenuRowDef r24=MenuRowDef(), MenuRowDef r25=MenuRowDef(), MenuRowDef r26=MenuRowDef(), MenuRowDef r27=MenuRowDef(), MenuRowDef r28=MenuRowDef(), MenuRowDef r29=MenuRowDef() )
|
||||
MenuDef( RString c, MenuRowDef r0=MenuRowDef(),
|
||||
MenuRowDef r1=MenuRowDef(), MenuRowDef r2=MenuRowDef(),
|
||||
MenuRowDef r3=MenuRowDef(), MenuRowDef r4=MenuRowDef(),
|
||||
MenuRowDef r5=MenuRowDef(), MenuRowDef r6=MenuRowDef(),
|
||||
MenuRowDef r7=MenuRowDef(), MenuRowDef r8=MenuRowDef(),
|
||||
MenuRowDef r9=MenuRowDef(), MenuRowDef r10=MenuRowDef(),
|
||||
MenuRowDef r11=MenuRowDef(), MenuRowDef r12=MenuRowDef(),
|
||||
MenuRowDef r13=MenuRowDef(), MenuRowDef r14=MenuRowDef(),
|
||||
MenuRowDef r15=MenuRowDef(), MenuRowDef r16=MenuRowDef(),
|
||||
MenuRowDef r17=MenuRowDef(), MenuRowDef r18=MenuRowDef(),
|
||||
MenuRowDef r19=MenuRowDef(), MenuRowDef r20=MenuRowDef(),
|
||||
MenuRowDef r21=MenuRowDef(), MenuRowDef r22=MenuRowDef(),
|
||||
MenuRowDef r23=MenuRowDef(), MenuRowDef r24=MenuRowDef(),
|
||||
MenuRowDef r25=MenuRowDef(), MenuRowDef r26=MenuRowDef(),
|
||||
MenuRowDef r27=MenuRowDef(), MenuRowDef r28=MenuRowDef(),
|
||||
MenuRowDef r29=MenuRowDef() ): sClassName(c), rows()
|
||||
{
|
||||
sClassName = c;
|
||||
#define PUSH( r ) if(!r.sName.empty()) rows.push_back(r);
|
||||
PUSH(r0);PUSH(r1);PUSH(r2);PUSH(r3);PUSH(r4);PUSH(r5);PUSH(r6);PUSH(r7);PUSH(r8);PUSH(r9);PUSH(r10);PUSH(r11);PUSH(r12);PUSH(r13);PUSH(r14);PUSH(r15);PUSH(r16);PUSH(r17);PUSH(r18);PUSH(r19);PUSH(r20);PUSH(r21);PUSH(r22);PUSH(r23);PUSH(r24);PUSH(r25);PUSH(r26);PUSH(r27);PUSH(r28);PUSH(r29);
|
||||
PUSH(r0);PUSH(r1);PUSH(r2);PUSH(r3);PUSH(r4);PUSH(r5);PUSH(r6);
|
||||
PUSH(r7);PUSH(r8);PUSH(r9);PUSH(r10);PUSH(r11);PUSH(r12);
|
||||
PUSH(r13);PUSH(r14);PUSH(r15);PUSH(r16);PUSH(r17);PUSH(r18);
|
||||
PUSH(r19);PUSH(r20);PUSH(r21);PUSH(r22);PUSH(r23);PUSH(r24);
|
||||
PUSH(r25);PUSH(r26);PUSH(r27);PUSH(r28);PUSH(r29);
|
||||
#undef PUSH
|
||||
}
|
||||
};
|
||||
@@ -89,7 +134,9 @@ struct MenuDef
|
||||
class ScreenMiniMenu : public ScreenOptions
|
||||
{
|
||||
public:
|
||||
static void MiniMenu( const MenuDef* pDef, ScreenMessage smSendOnOK, ScreenMessage smSendOnCancel = SM_None, float fX = 0, float fY = 0 );
|
||||
static void MiniMenu( const MenuDef* pDef, ScreenMessage smSendOnOK,
|
||||
ScreenMessage smSendOnCancel = SM_None,
|
||||
float fX = 0, float fY = 0 );
|
||||
|
||||
void Init();
|
||||
void BeginScreen();
|
||||
@@ -110,6 +157,8 @@ protected:
|
||||
vector<MenuRowDef> m_vMenuRows;
|
||||
|
||||
public:
|
||||
ScreenMiniMenu(): m_SMSendOnOK(), m_SMSendOnCancel(), m_vMenuRows() {}
|
||||
|
||||
static bool s_bCancelled;
|
||||
static int s_iLastRowCode;
|
||||
static vector<int> s_viLastAnswers;
|
||||
|
||||
@@ -3,11 +3,6 @@
|
||||
#ifndef ScreenServiceAction_H
|
||||
#define ScreenServiceAction_H
|
||||
|
||||
//There's a FAILED macro somewhere in winerror.h, which gets included with Xbox.
|
||||
#if defined(_XBOX)
|
||||
#undef FAILED
|
||||
#endif
|
||||
|
||||
#include "ScreenPrompt.h"
|
||||
|
||||
class ScreenServiceAction : public ScreenPrompt
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
#ifndef SCREEN_TEST_FONTS_H
|
||||
#define SCREEN_TEST_FONTS_H
|
||||
|
||||
#if defined(_XBOX)
|
||||
#undef TEXT
|
||||
#endif
|
||||
|
||||
#include "Screen.h"
|
||||
#include "BitmapText.h"
|
||||
#include "Quad.h"
|
||||
|
||||
@@ -71,7 +71,10 @@ public:
|
||||
}
|
||||
|
||||
struct TextEntrySettings {
|
||||
TextEntrySettings() { }
|
||||
TextEntrySettings(): smSendOnPop(), sQuestion(""),
|
||||
sInitialAnswer(""), iMaxInputLength(0),
|
||||
bPassword(false), Validate(), OnOK(), OnCancel(),
|
||||
ValidateAppend(), FormatAnswerForDisplay() { }
|
||||
ScreenMessage smSendOnPop;
|
||||
RString sQuestion;
|
||||
RString sInitialAnswer;
|
||||
|
||||
@@ -50,12 +50,7 @@ RString SongCacheIndex::GetCacheFilePath( const RString &sGroup, const RString &
|
||||
for( size_t pos = s.find_first_of(invalid); pos != RString::npos; pos = s.find_first_of(invalid, pos) )
|
||||
s[pos] = '_';
|
||||
// CACHE_DIR ends with a /.
|
||||
#if defined(XBOX)
|
||||
// Use CRC32 to make fatx compatible filenames.
|
||||
return ssprintf( "%s%s/%X", SpecialFiles::CACHE_DIR.c_str(), sGroup.c_str(), GetHashForString(s));
|
||||
#else
|
||||
return ssprintf( "%s%s/%s", SpecialFiles::CACHE_DIR.c_str(), sGroup.c_str(), s.c_str() );
|
||||
#endif
|
||||
}
|
||||
|
||||
SongCacheIndex::SongCacheIndex()
|
||||
|
||||
+4
-3
@@ -47,8 +47,9 @@ public:
|
||||
} m_Locked;
|
||||
|
||||
/** @brief Set up some initial song criteria. */
|
||||
SongCriteria(): m_sGroupName(""), m_bUseSongGenreAllowedList(false),
|
||||
m_Selectable(Selectable_DontCare), m_bUseSongAllowedList(false),
|
||||
SongCriteria(): m_sGroupName(""), m_bUseSongGenreAllowedList(false),
|
||||
m_vsSongGenreAllowedList(), m_Selectable(Selectable_DontCare),
|
||||
m_bUseSongAllowedList(false), m_vpSongAllowedList(),
|
||||
m_iMaxStagesForSong(-1), m_Tutorial(Tutorial_DontCare),
|
||||
m_Locked(Locked_DontCare)
|
||||
{
|
||||
@@ -182,7 +183,7 @@ public:
|
||||
* @brief Set up the SongID with default values.
|
||||
*
|
||||
* This used to call Unset() to do the same thing. */
|
||||
SongID(): sDir("") { m_Cache.Unset(); }
|
||||
SongID(): sDir(""), m_Cache() { m_Cache.Unset(); }
|
||||
void Unset() { FromSong(NULL); }
|
||||
void FromSong( const Song *p );
|
||||
Song *ToSong() const;
|
||||
|
||||
@@ -79,6 +79,9 @@ public:
|
||||
|
||||
// Lua
|
||||
void PushSelf( lua_State *L );
|
||||
|
||||
private:
|
||||
// TODO: Implement the copy and assignment operators on our own.
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+1
-33
@@ -68,27 +68,12 @@
|
||||
#include "SpecialFiles.h"
|
||||
#include "Profile.h"
|
||||
|
||||
#if defined(XBOX)
|
||||
#include "Archutils/Xbox/VirtualMemory.h"
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) && !defined(XBOX)
|
||||
#if defined(WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
// since the XBOX SDK only works with VS.Net 2003, this doesn't exist yet.
|
||||
// see http://old.nabble.com/Linking-Error-with-MSVC%2B%2B-6.0-td21608559.html
|
||||
// for more information. -aj
|
||||
#if defined(XBOX)
|
||||
extern "C"
|
||||
{
|
||||
int _get_output_format( void ){ return 0; }
|
||||
}
|
||||
#endif
|
||||
|
||||
static Preference<bool> g_bAllowMultipleInstances( "AllowMultipleInstances", false );
|
||||
|
||||
|
||||
void StepMania::GetPreferredVideoModeParams( VideoModeParams ¶msOut )
|
||||
{
|
||||
/* We can't rely on there being full-screen video modes that give us square
|
||||
@@ -469,14 +454,6 @@ struct VideoCardDefaults
|
||||
}
|
||||
} const g_VideoCardDefaults[] =
|
||||
{
|
||||
VideoCardDefaults(
|
||||
"Xbox",
|
||||
"d3d",
|
||||
600,400,
|
||||
32,32,32,
|
||||
2048,
|
||||
true
|
||||
),
|
||||
VideoCardDefaults(
|
||||
"Voodoo *5",
|
||||
"d3d,opengl", // received 3 reports of opengl crashing. -Chris
|
||||
@@ -636,8 +613,6 @@ static RString GetVideoDriverName()
|
||||
{
|
||||
#if defined(_WINDOWS)
|
||||
return GetPrimaryVideoDriverName();
|
||||
#elif defined(_XBOX)
|
||||
return "Xbox";
|
||||
#else
|
||||
return "OpenGL";
|
||||
#endif
|
||||
@@ -879,11 +854,8 @@ static void MountTreeOfZips( const RString &dir )
|
||||
RString path = dirs.back();
|
||||
dirs.pop_back();
|
||||
|
||||
#if !defined(XBOX)
|
||||
// Xbox doesn't detect directories properly, so we'll ignore this
|
||||
if( !IsADirectory(path) )
|
||||
continue;
|
||||
#endif
|
||||
|
||||
vector<RString> zips;
|
||||
GetDirListing( path + "/*.zip", zips, false, true );
|
||||
@@ -997,10 +969,6 @@ int main(int argc, char* argv[])
|
||||
|
||||
ApplyLogPreferences();
|
||||
|
||||
#if defined(XBOX)
|
||||
vmem_Manager.Init();
|
||||
#endif
|
||||
|
||||
WriteLogHeader();
|
||||
|
||||
// Set up alternative filesystem trees.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -169,7 +169,7 @@ public:
|
||||
* This used to call Unset(), which set the variables to
|
||||
* the same thing. */
|
||||
StepsID(): st(StepsType_Invalid), dc(Difficulty_Invalid),
|
||||
sDescription(""), uHash(0) {}
|
||||
sDescription(""), uHash(0), m_Cache() {}
|
||||
void Unset() { FromSteps(NULL); }
|
||||
void FromSteps( const Steps *p );
|
||||
Steps *ToSteps( const Song *p, bool bAllowNull ) const;
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ class StyleID
|
||||
RString sStyle;
|
||||
|
||||
public:
|
||||
StyleID() { Unset(); }
|
||||
StyleID(): sGame(""), sStyle("") { }
|
||||
void Unset() { FromStyle(NULL); }
|
||||
void FromStyle( const Style *p );
|
||||
const Style *ToStyle() const;
|
||||
|
||||
@@ -100,22 +100,10 @@ void GetBounds( const Surface *pSurf, RECT *out )
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma include_alias( "zlib/zlib.h", "../zlib/zlib.h" )
|
||||
#include "../libpng/include/png.h"
|
||||
#if defined(_MSC_VER)
|
||||
# if defined(_XBOX)
|
||||
# pragma comment(lib, "../libpng/lib/xboxlibpng.lib")
|
||||
# else
|
||||
# pragma comment(lib, "../libpng/lib/libpng.lib")
|
||||
# endif
|
||||
# pragma comment(lib, "../libpng/lib/libpng.lib")
|
||||
#pragma warning(disable: 4611) /* interaction between '_setjmp' and C++ object destruction is non-portable */
|
||||
#endif
|
||||
|
||||
|
||||
+3
-2
@@ -53,9 +53,9 @@ public:
|
||||
* (everything except screens). */
|
||||
ThemeMetric( const RString& sGroup = "", const RString& sName = "" ):
|
||||
m_sGroup( sGroup ),
|
||||
m_sName( sName )
|
||||
m_sName( sName ),
|
||||
m_Value(), m_currentValue(T()), m_bCallEachTime(false)
|
||||
{
|
||||
m_currentValue = T();
|
||||
ThemeManager::Subscribe( this );
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ public:
|
||||
m_sGroup( cpy.m_sGroup ),
|
||||
m_sName( cpy.m_sName ),
|
||||
m_Value( cpy.m_Value )
|
||||
// do we transfer the current value or bCallEachTime?
|
||||
{
|
||||
ThemeManager::Subscribe( this );
|
||||
}
|
||||
|
||||
+4
-4
@@ -18,6 +18,7 @@ struct TrailEntry
|
||||
pSong(NULL),
|
||||
pSteps(NULL),
|
||||
Modifiers(""),
|
||||
Attacks(),
|
||||
bSecret(false),
|
||||
iLowMeter(-1),
|
||||
iHighMeter(-1),
|
||||
@@ -72,10 +73,9 @@ public:
|
||||
Trail(): m_StepsType(StepsType_Invalid),
|
||||
m_CourseType(CourseType_Invalid),
|
||||
m_CourseDifficulty(Difficulty_Invalid),
|
||||
m_iSpecifiedMeter(-1), m_bRadarValuesCached(false)
|
||||
{
|
||||
m_vEntries.clear();
|
||||
}
|
||||
m_vEntries(), m_iSpecifiedMeter(-1),
|
||||
m_bRadarValuesCached(false), m_CachedRadarValues(),
|
||||
m_CachedObject() {}
|
||||
void Init()
|
||||
{
|
||||
m_StepsType = StepsType_Invalid;
|
||||
|
||||
+2
-1
@@ -33,7 +33,8 @@ class TrailID
|
||||
mutable CachedObjectPointer<Trail> m_Cache;
|
||||
|
||||
public:
|
||||
TrailID() { Unset(); }
|
||||
TrailID(): st(StepsType_Invalid), cd(Difficulty_Invalid),
|
||||
m_Cache() { m_Cache.Unset(); }
|
||||
void Unset() { FromTrail(NULL); }
|
||||
void FromTrail( const Trail *p );
|
||||
Trail *ToTrail( const Course *p, bool bAllowNull ) const;
|
||||
|
||||
+4
-3
@@ -57,9 +57,10 @@ public:
|
||||
*
|
||||
* m_sEntryID starts as an empty string. It will be filled automatically
|
||||
* if not specified. */
|
||||
UnlockEntry(): m_Type(UnlockRewardType_Invalid),
|
||||
m_dc(Difficulty_Invalid), m_bRequirePassHardSteps(false),
|
||||
m_bRoulette(false), m_sEntryID(RString(""))
|
||||
UnlockEntry(): m_Type(UnlockRewardType_Invalid), m_cmd(),
|
||||
m_Song(), m_dc(Difficulty_Invalid), m_Course(),
|
||||
m_bRequirePassHardSteps(false), m_bRoulette(false),
|
||||
m_sEntryID(RString(""))
|
||||
{
|
||||
ZERO( m_fRequirement );
|
||||
}
|
||||
|
||||
@@ -1,227 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "ArchHooks_Xbox.h"
|
||||
#include "dsound.h" // for timeGetTime
|
||||
#include "archutils/Xbox/custom_launch_params.h" // for XGetCustomLaunchData
|
||||
#include "archutils/Xbox/VirtualMemory.h"
|
||||
|
||||
#include <xtl.h> // for XNetStartup
|
||||
#include <new.h> // for _set_new_handler and _set_new_mode
|
||||
|
||||
typedef struct _UNICODE_STRING {unsigned short Length; unsigned short MaximumLength; PSTR Buffer;} UNICODE_STRING,*PUNICODE_STRING;
|
||||
extern "C" XBOXAPI DWORD WINAPI IoCreateSymbolicLink(IN PUNICODE_STRING SymbolicLinkName,IN PUNICODE_STRING DeviceName);
|
||||
|
||||
static bool g_bTimerInitialized;
|
||||
static DWORD g_iStartTime;
|
||||
|
||||
static void InitTimer()
|
||||
{
|
||||
if( g_bTimerInitialized )
|
||||
return;
|
||||
g_bTimerInitialized = true;
|
||||
|
||||
g_iStartTime = timeGetTime();
|
||||
}
|
||||
|
||||
int64_t ArchHooks::GetMicrosecondsSinceStart( bool bAccurate )
|
||||
{
|
||||
if( !g_bTimerInitialized )
|
||||
InitTimer();
|
||||
|
||||
int64_t ret = (timeGetTime() - g_iStartTime) * int64_t(1000);
|
||||
if( bAccurate )
|
||||
{
|
||||
ret = FixupTimeIfLooped( ret );
|
||||
ret = FixupTimeIfBackwards( ret );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void MountDriveLetter(char drive, char* szDevice, char* szDir)
|
||||
{
|
||||
char szSourceDevice[256];
|
||||
char szDestinationDrive[16];
|
||||
sprintf(szDestinationDrive, "\\??\\%c:", drive);
|
||||
sprintf(szSourceDevice,"\\Device\\%s",szDevice);
|
||||
if (*szDir != 0x00 && *szDir != '\\')
|
||||
{
|
||||
strcat(szSourceDevice, "\\");
|
||||
strcat(szSourceDevice, szDir);
|
||||
}
|
||||
|
||||
UNICODE_STRING LinkName =
|
||||
{
|
||||
strlen(szDestinationDrive),
|
||||
strlen(szDestinationDrive) + 1,
|
||||
szDestinationDrive
|
||||
};
|
||||
UNICODE_STRING DeviceName =
|
||||
{
|
||||
strlen(szSourceDevice),
|
||||
strlen(szSourceDevice) + 1,
|
||||
szSourceDevice
|
||||
};
|
||||
|
||||
IoCreateSymbolicLink(&LinkName, &DeviceName);
|
||||
}
|
||||
|
||||
void MountDrives()
|
||||
{
|
||||
MountDriveLetter('A', "Cdrom0", "\\");
|
||||
MountDriveLetter('E', "Harddisk0\\Partition1", "\\");
|
||||
MountDriveLetter('C', "Harddisk0\\Partition2", "\\");
|
||||
MountDriveLetter('X', "Harddisk0\\Partition3", "\\");
|
||||
MountDriveLetter('Y', "Harddisk0\\Partition4", "\\");
|
||||
MountDriveLetter('F', "Harddisk0\\Partition6", "\\");
|
||||
MountDriveLetter('G', "Harddisk0\\Partition7", "\\");
|
||||
}
|
||||
|
||||
bool SetupNetwork()
|
||||
{
|
||||
#if !defined(WITHOUT_NETWORKING)
|
||||
XNetStartupParams xnsp;
|
||||
memset(&xnsp, 0, sizeof(xnsp));
|
||||
xnsp.cfgSizeOfStruct = sizeof(XNetStartupParams);
|
||||
xnsp.cfgFlags = XNET_STARTUP_BYPASS_SECURITY;
|
||||
|
||||
INT err = XNetStartup(&xnsp);
|
||||
|
||||
return err == 0;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
// if Xbox has 128 meg RAM make sure its used
|
||||
void EnableExtraRAM()
|
||||
{
|
||||
LARGE_INTEGER regVal;
|
||||
|
||||
// Verify that we have 128 megs available
|
||||
MEMORYSTATUS memStatus;
|
||||
GlobalMemoryStatus( &memStatus );
|
||||
if( memStatus.dwTotalPhys < (100 * 1024 * 1024) )
|
||||
return;
|
||||
|
||||
// Grab the existing default type (0x02FF)
|
||||
READMSRREG( 0x02FF, ®Val );
|
||||
|
||||
// Set the default to WriteBack (0x06)
|
||||
regVal.LowPart = (regVal.LowPart & ~0xFF) | 0x06;
|
||||
WRITEMSRREG( 0x02FF, regVal );
|
||||
}
|
||||
|
||||
void InitDevices()
|
||||
{
|
||||
XDEVICE_PREALLOC_TYPE xdpt[] = {{XDEVICE_TYPE_GAMEPAD, 4}, {XDEVICE_TYPE_MEMORY_UNIT, 2}};
|
||||
XInitDevices( sizeof(xdpt) / sizeof(XDEVICE_PREALLOC_TYPE), xdpt );
|
||||
}
|
||||
|
||||
ArchHooks_Xbox::ArchHooks_Xbox()
|
||||
{
|
||||
_set_new_handler(NoMemory);
|
||||
_set_new_mode(1);
|
||||
SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER) CheckPageFault);
|
||||
|
||||
XGetCustomLaunchData();
|
||||
|
||||
// mount A to DVD, C, E, F, G, X, and Y to the harddisk
|
||||
MountDrives();
|
||||
|
||||
SetupNetwork();
|
||||
|
||||
EnableExtraRAM();
|
||||
|
||||
InitDevices();
|
||||
}
|
||||
|
||||
static RString XLangID( DWORD Lang )
|
||||
{
|
||||
switch(Lang)
|
||||
{
|
||||
case XC_LANGUAGE_JAPANESE:return "JA";
|
||||
case XC_LANGUAGE_GERMAN:return "DE";
|
||||
case XC_LANGUAGE_FRENCH:return "FR";
|
||||
case XC_LANGUAGE_SPANISH:return "ES";
|
||||
case XC_LANGUAGE_ITALIAN:return "IT";
|
||||
case XC_LANGUAGE_KOREAN:return "KO";
|
||||
case XC_LANGUAGE_TCHINESE:return "ZH";
|
||||
case XC_LANGUAGE_PORTUGUESE:return "PT";
|
||||
default:
|
||||
case XC_LANGUAGE_ENGLISH: return "EN";
|
||||
}
|
||||
}
|
||||
|
||||
RString ArchHooks::GetPreferredLanguage()
|
||||
{
|
||||
return XLangID( XGetLanguage() );
|
||||
}
|
||||
|
||||
ArchHooks_Xbox::~ArchHooks_Xbox()
|
||||
{
|
||||
// We only want to reboot the Xbox in a software manner.
|
||||
XLaunchNewImage( NULL, NULL );
|
||||
}
|
||||
|
||||
void ArchHooks_Xbox::DumpDebugInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
float ArchHooks_Xbox::GetDisplayAspectRatio()
|
||||
{
|
||||
// xxx: does this take into account system settings? -aj
|
||||
float fDisplayAspectRatio = 4.0 / 3.0;
|
||||
IDirect3DSurface8 *pBackBuffer = NULL;
|
||||
if( D3D__pDevice->GetBackBuffer( -1, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer) == D3D_OK )
|
||||
{
|
||||
D3DSURFACE_DESC Desc;
|
||||
if( pBackBuffer->GetDesc(&Desc) == D3D_OK )
|
||||
{
|
||||
fDisplayAspectRatio = (float)Desc.Width / (float)Desc.Height;
|
||||
}
|
||||
pBackBuffer->Release();
|
||||
}
|
||||
return fDisplayAspectRatio;
|
||||
}
|
||||
|
||||
#include "RageFileManager.h"
|
||||
|
||||
void ArchHooks::MountInitialFilesystems( const RString &sDirOfExecutable )
|
||||
{
|
||||
FILEMAN->Mount( "dir", "D:\\", "/" );
|
||||
}
|
||||
|
||||
void ArchHooks::MountUserFilesystems( const RString &sDirOfExecutable )
|
||||
{
|
||||
// Mount everything game-writable (not counting the editor) to the game title persistent data region ( /E/TDATA/33342530/ )
|
||||
FILEMAN->Mount( "dir", "T:/Cache", "/Cache" );
|
||||
FILEMAN->Mount( "dir", "T:/Logs", "/Logs" );
|
||||
FILEMAN->Mount( "dir", "T:/Save", "/Save" );
|
||||
FILEMAN->Mount( "dir", "T:/Screenshots", "/Screenshots" );
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2003-2004 Glenn Maynard, Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,78 +0,0 @@
|
||||
#ifndef ARCH_HOOKS_XBOX_H
|
||||
#define ARCH_HOOKS_XBOX_H
|
||||
|
||||
#include "ArchHooks.h"
|
||||
class RageMutex;
|
||||
|
||||
class ArchHooks_Xbox: public ArchHooks
|
||||
{
|
||||
public:
|
||||
ArchHooks_Xbox();
|
||||
~ArchHooks_Xbox();
|
||||
RString GetArchName() { return "Xbox"; }
|
||||
void DumpDebugInfo();
|
||||
float GetDisplayAspectRatio();
|
||||
|
||||
//void MountInitialFilesystems( const RString &sDirOfExecutable );
|
||||
};
|
||||
|
||||
// XXX: This stuff doesn't belong here. Hide it in ArchHooks.
|
||||
|
||||
// Read a 64 bit MSR register
|
||||
inline void READMSRREG( UINT32 reg, LARGE_INTEGER *val )
|
||||
{
|
||||
UINT32 lowPart, highPart;
|
||||
__asm
|
||||
{
|
||||
mov ecx, reg
|
||||
rdmsr
|
||||
mov lowPart, eax
|
||||
mov highPart, edx
|
||||
};
|
||||
|
||||
val->LowPart = lowPart;
|
||||
val->HighPart = highPart;
|
||||
}
|
||||
|
||||
// Write a 64 bit MSR register
|
||||
inline void WRITEMSRREG( UINT32 reg, LARGE_INTEGER val )
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov ecx, reg
|
||||
mov eax, val.LowPart
|
||||
mov edx, val.HighPart
|
||||
wrmsr
|
||||
};
|
||||
}
|
||||
|
||||
#ifdef ARCH_HOOKS
|
||||
#error "More than one ArchHooks selected!"
|
||||
#endif
|
||||
#define ARCH_HOOKS ArchHooks_Xbox
|
||||
|
||||
#endif
|
||||
/*
|
||||
* (c) 2002-2004 Glenn Maynard, Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
static void Create( const RString &sDrivers, vector<InputHandler *> &apAdd );
|
||||
static DriverList m_pDriverList;
|
||||
|
||||
InputHandler(): m_iInputsSinceUpdate(0) {}
|
||||
InputHandler(): m_LastUpdate(), m_iInputsSinceUpdate(0) {}
|
||||
virtual ~InputHandler() { }
|
||||
virtual void Update() { }
|
||||
virtual bool DevicesChanged() { return false; }
|
||||
|
||||
@@ -1,232 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "InputHandler_Xbox.h"
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
#include "RageDisplay.h"
|
||||
|
||||
|
||||
#include <xtl.h>
|
||||
|
||||
struct DEVICE_STATE {
|
||||
XPP_DEVICE_TYPE *pxdt;
|
||||
DWORD dwState;
|
||||
};
|
||||
|
||||
byte buttonMasks[] = { XINPUT_GAMEPAD_DPAD_LEFT,
|
||||
XINPUT_GAMEPAD_DPAD_RIGHT,
|
||||
XINPUT_GAMEPAD_DPAD_UP,
|
||||
XINPUT_GAMEPAD_DPAD_DOWN,
|
||||
XINPUT_GAMEPAD_START,
|
||||
XINPUT_GAMEPAD_BACK,
|
||||
XINPUT_GAMEPAD_LEFT_THUMB,
|
||||
XINPUT_GAMEPAD_RIGHT_THUMB};
|
||||
|
||||
|
||||
/**
|
||||
* XBOX controller maps to the following RageInputDevice constants:
|
||||
* DPAD -> JOY_HAT_...
|
||||
* START -> JOY_AUX_1
|
||||
* BACK -> JOY_AUX_2
|
||||
* Left thumb button -> JOY_AUX_3
|
||||
* Right thumb button -> JOY_AUX_4
|
||||
* Following buttons are JOY_(index):
|
||||
* A, B, X, Y, BLACK, WHITE, Left trigger, right trigger
|
||||
*/
|
||||
|
||||
InputHandler_Xbox::InputHandler_Xbox()
|
||||
{
|
||||
//
|
||||
// Init joysticks
|
||||
//
|
||||
ZeroMemory( joysticks, sizeof(joysticks) );
|
||||
|
||||
getHandles();
|
||||
}
|
||||
|
||||
InputHandler_Xbox::~InputHandler_Xbox()
|
||||
{
|
||||
for(unsigned i = 0; i < NUM_JOYSTICKS; i++)
|
||||
{
|
||||
if(joysticks[i] != 0)
|
||||
XInputClose(joysticks[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void InputHandler_Xbox::Update()
|
||||
{
|
||||
// check insertions and removals
|
||||
DWORD dwInsert, dwRemove;
|
||||
DEVICE_STATE devices = {XDEVICE_TYPE_GAMEPAD, 0};
|
||||
|
||||
bool changes = false;
|
||||
// Check each device type to see if any changes have occurred.
|
||||
if( XGetDeviceChanges( devices.pxdt, &dwInsert, &dwRemove ) )
|
||||
{
|
||||
for(int j = 0; j < 4; j++)
|
||||
{
|
||||
if(1 << j & dwRemove)
|
||||
{
|
||||
changes = true;
|
||||
LOG->Trace("A joystick was removed");
|
||||
}
|
||||
if(1 << j & dwInsert)
|
||||
{
|
||||
changes = true;
|
||||
LOG->Trace("A joystick was inserted");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(changes)
|
||||
{
|
||||
getHandles();
|
||||
return;
|
||||
}
|
||||
|
||||
for(unsigned i = 0; i < NUM_JOYSTICKS; i++)
|
||||
{
|
||||
if(joysticks[i] == 0)
|
||||
continue;
|
||||
|
||||
InputDevice inputDevice = InputDevice(DEVICE_JOY1 + i);
|
||||
XINPUT_STATE xis;
|
||||
// Query latest state.
|
||||
XInputGetState( joysticks[i], &xis );
|
||||
|
||||
// check buttons
|
||||
for(int j = 0; j < ARRAYLEN(buttonMasks); j++)
|
||||
{
|
||||
DWORD nowPressed = xis.Gamepad.wButtons & buttonMasks[j];
|
||||
DWORD wasPressed = lastState[i].wButtons & buttonMasks[j];
|
||||
|
||||
if(nowPressed != wasPressed)
|
||||
{
|
||||
DeviceButton Button = DeviceButton(JOY_HAT_LEFT + j);
|
||||
if(Button >= JOY_BUTTON_32)
|
||||
{
|
||||
LOG->Warn("Ignored joystick event (button too high)");
|
||||
continue;
|
||||
}
|
||||
DeviceInput di(inputDevice, Button, nowPressed != 0);
|
||||
ButtonPressed(di);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// check analog buttons
|
||||
for(int j = 0; j < ARRAYLEN(xis.Gamepad.bAnalogButtons); j++)
|
||||
{
|
||||
bool nowPressed = xis.Gamepad.bAnalogButtons[j] > XINPUT_GAMEPAD_MAX_CROSSTALK;
|
||||
bool wasPressed = lastState[i].bAnalogButtons[j] > XINPUT_GAMEPAD_MAX_CROSSTALK;
|
||||
|
||||
if(nowPressed != wasPressed)
|
||||
{
|
||||
DeviceButton Button = DeviceButton(JOY_BUTTON_1 + j);
|
||||
if(Button >= JOY_BUTTON_32)
|
||||
{
|
||||
LOG->Warn("Ignored joystick event (button too high)");
|
||||
continue;
|
||||
}
|
||||
DeviceInput di(inputDevice, Button, nowPressed);
|
||||
ButtonPressed(di);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// check thumbsticks
|
||||
SHORT axes[] = { xis.Gamepad.sThumbLX, xis.Gamepad.sThumbLY, xis.Gamepad.sThumbRX, xis.Gamepad.sThumbRY};
|
||||
|
||||
for(int j = 0; j < ARRAYLEN(axes); j++)
|
||||
{
|
||||
if(axes[j] != 0)
|
||||
{
|
||||
// Reverse y axis (negative values are down, not up)
|
||||
if(j == 1 || j == 3)
|
||||
axes[j] = -axes[j];
|
||||
|
||||
DeviceButton neg = (DeviceButton)(JOY_LEFT + (2 * j));
|
||||
DeviceButton pos = (DeviceButton)(JOY_RIGHT + (2 * j));
|
||||
float l = SCALE( axes[j], 0.0f, 32768.0f, 0.0f, 1.0f );
|
||||
ButtonPressed(DeviceInput(inputDevice, neg,max(-l,0),RageZeroTimer));
|
||||
ButtonPressed(DeviceInput(inputDevice, pos,max(+l,0),RageZeroTimer));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(&lastState[i], &xis.Gamepad, sizeof(XINPUT_GAMEPAD));
|
||||
}
|
||||
|
||||
InputHandler::UpdateTimer();
|
||||
}
|
||||
|
||||
void InputHandler_Xbox::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
|
||||
{
|
||||
for( int i=0; i<NUM_JOYSTICKS; i++ )
|
||||
{
|
||||
if( joysticks[i] != 0 )
|
||||
{
|
||||
vDevicesOut.push_back( InputDeviceInfo(InputDevice(DEVICE_JOY1+i),"XboxGameHardware") );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InputHandler_Xbox::getHandles()
|
||||
{
|
||||
for(unsigned i = 0; i < NUM_JOYSTICKS; i++)
|
||||
{
|
||||
if(joysticks[i] != 0)
|
||||
XInputClose(joysticks[i]);
|
||||
}
|
||||
|
||||
ZeroMemory( joysticks, sizeof(joysticks) );
|
||||
ZeroMemory( lastState, sizeof(lastState) );
|
||||
|
||||
// Work out joystick handles
|
||||
DEVICE_STATE devices = {XDEVICE_TYPE_GAMEPAD, 0};
|
||||
devices.dwState = XGetDevices( devices.pxdt );
|
||||
|
||||
// Check the global gamepad state for a connected device.
|
||||
unsigned playersAllocated = 0;
|
||||
unsigned joysFound = 0;
|
||||
|
||||
for( unsigned i = 0; i < NUM_PORTS; i++ )
|
||||
{
|
||||
if( devices.dwState & 1 << i)
|
||||
{
|
||||
if(playersAllocated < NUM_JOYSTICKS)
|
||||
{
|
||||
XINPUT_POLLING_PARAMETERS pollingParameters = {TRUE, TRUE, 0, 8, 8, 0,};
|
||||
joysticks[playersAllocated] = XInputOpen(XDEVICE_TYPE_GAMEPAD, (DWORD)i, XDEVICE_NO_SLOT, &pollingParameters);
|
||||
playersAllocated++;
|
||||
}
|
||||
joysFound++;
|
||||
}
|
||||
}
|
||||
|
||||
LOG->Info( "Found %d connected joysticks for %d players", joysFound, playersAllocated );
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2004 Ryan Dortmans
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,52 +0,0 @@
|
||||
#ifndef INPUT_HANDLER_XBOX_H
|
||||
#define INPUT_HANDLER_XBOX_H
|
||||
|
||||
#include "InputHandler.h"
|
||||
|
||||
#include <xtl.h>
|
||||
|
||||
#define NUM_PORTS 4
|
||||
|
||||
class InputHandler_Xbox: public InputHandler
|
||||
{
|
||||
HANDLE joysticks[NUM_JOYSTICKS];
|
||||
XINPUT_GAMEPAD lastState[NUM_JOYSTICKS];
|
||||
|
||||
public:
|
||||
void Update();
|
||||
InputHandler_Xbox();
|
||||
~InputHandler_Xbox();
|
||||
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
|
||||
|
||||
private:
|
||||
void getHandles();
|
||||
};
|
||||
#define USE_INPUT_HANDLER_XBOX
|
||||
REGISTER_INPUT_HANDLER_CLASS( Xbox );
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2004 Ryan Dortmans
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -12,7 +12,7 @@ LoadingWindow *LoadingWindow::Create()
|
||||
return new LoadingWindow_Null;
|
||||
#endif
|
||||
// Don't load NULL by default.
|
||||
const RString drivers = "xbox,win32,macosx,gtk";
|
||||
const RString drivers = "win32,macosx,gtk";
|
||||
vector<RString> DriversToTry;
|
||||
split( drivers, ",", DriversToTry, true );
|
||||
|
||||
@@ -33,9 +33,6 @@ LoadingWindow *LoadingWindow::Create()
|
||||
#endif
|
||||
#ifdef USE_LOADING_WINDOW_WIN32
|
||||
if( !DriversToTry[i].CompareNoCase("Win32") ) ret = new LoadingWindow_Win32;
|
||||
#endif
|
||||
#ifdef USE_LOADING_WINDOW_XBOX
|
||||
if( !DriversToTry[i].CompareNoCase("Xbox") ) ret = new LoadingWindow_Xbox;
|
||||
#endif
|
||||
if( !DriversToTry[i].CompareNoCase("Null") ) ret = new LoadingWindow_Null;
|
||||
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "LoadingWindow_Xbox.h"
|
||||
#include "RageLog.h"
|
||||
|
||||
#include "ProductInfo.h"
|
||||
|
||||
LPDIRECT3D8 g_pD3D = NULL; // DirectX Object
|
||||
LPDIRECT3DDEVICE8 g_pD3DDevice = NULL; // Screen Object
|
||||
LPDIRECT3DTEXTURE8 splash = NULL; // splash texture
|
||||
LPD3DXSPRITE g_sprite = NULL; // sprite object
|
||||
|
||||
LoadingWindow_Xbox::LoadingWindow_Xbox()
|
||||
{
|
||||
// Initialise Direct3D
|
||||
g_pD3D = Direct3DCreate8(D3D_SDK_VERSION);
|
||||
|
||||
// Create a structure to hold the settings for our device
|
||||
D3DPRESENT_PARAMETERS d3dpp;
|
||||
ZeroMemory(&d3dpp, sizeof(d3dpp));
|
||||
|
||||
// Fill the structure.
|
||||
// Set fullscreen 640x480x32 mode
|
||||
d3dpp.BackBufferWidth = 640;
|
||||
d3dpp.BackBufferHeight = 480;
|
||||
d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
|
||||
|
||||
// Create one backbuffer and a zbuffer
|
||||
d3dpp.BackBufferCount = 1;
|
||||
|
||||
// Set up how the backbuffer is "presented" to the frontbuffer each time
|
||||
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||
|
||||
//Create a Direct3D device.
|
||||
g_pD3D->CreateDevice(0, D3DDEVTYPE_HAL, NULL,
|
||||
D3DCREATE_HARDWARE_VERTEXPROCESSING,
|
||||
&d3dpp, &g_pD3DDevice);
|
||||
g_pD3DDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
|
||||
|
||||
// Create the sprite object (for painting the image)
|
||||
D3DXCreateSprite(g_pD3DDevice, &g_sprite);
|
||||
|
||||
// Load the default font
|
||||
XFONT_OpenDefaultFont(&font);
|
||||
font->SetTextColor(D3DCOLOR_XRGB(255,255,255));
|
||||
font->SetTextAlignment(XFONT_CENTER);
|
||||
|
||||
// Load the splash.png
|
||||
|
||||
HRESULT result = D3DXCreateTextureFromFileA(g_pD3DDevice, "D:\\Data\\splash.png", &splash);
|
||||
useImage = (result == D3D_OK);
|
||||
|
||||
if(!useImage)
|
||||
LOG->Trace("Error loading splash.png - %i", result);
|
||||
|
||||
SetText(RString("Loading songs"));
|
||||
}
|
||||
|
||||
LoadingWindow_Xbox::~LoadingWindow_Xbox()
|
||||
{
|
||||
g_pD3DDevice->Release();
|
||||
g_pD3D->Release();
|
||||
font->Release();
|
||||
}
|
||||
|
||||
void LoadingWindow_Xbox::Paint()
|
||||
{
|
||||
LPDIRECT3DSURFACE8 g_pFrontBuffer;
|
||||
|
||||
if(text == "")
|
||||
return;
|
||||
|
||||
g_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
|
||||
|
||||
g_pD3DDevice->BeginScene();
|
||||
g_pD3DDevice->GetBackBuffer(0,D3DBACKBUFFER_TYPE_MONO,&g_pFrontBuffer);
|
||||
|
||||
if(useImage)
|
||||
{
|
||||
// Draw the splash image
|
||||
// Only draw if the splash texture is successfully loaded
|
||||
D3DXVECTOR2 pos;
|
||||
pos.x = 70.0f;
|
||||
pos.y = 30.0f;
|
||||
|
||||
g_sprite->Begin();
|
||||
g_sprite->Draw(splash, NULL, NULL, NULL, NULL, &pos, 0xFFFFFFFF);
|
||||
g_sprite->End();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Lo-fi version: print the product name and version at the top of the screen
|
||||
font->SetTextColor(D3DCOLOR_XRGB(255, 0, 0));
|
||||
RString title = "Version ";
|
||||
title = title + PRODUCT_VER;
|
||||
WCHAR wc_title[200] = {0};
|
||||
swprintf(wc_title, L"%S", title.c_str());
|
||||
|
||||
font->TextOut(g_pFrontBuffer, L"StepMania", -1, 320, 30);
|
||||
font->SetTextColor(D3DCOLOR_XRGB(255, 255, 0));
|
||||
font->TextOut(g_pFrontBuffer, wc_title, -1, 320, 40 + font->GetTextHeight());
|
||||
}
|
||||
|
||||
// Draw the text on the screen
|
||||
font->SetTextColor(D3DCOLOR_XRGB(255, 255, 255));
|
||||
basic_string <char>::size_type newLineIndex = text.find("\n", 0);
|
||||
int y = 240;
|
||||
|
||||
if(newLineIndex == RString.npos)
|
||||
{
|
||||
WCHAR wc_text[200] = {0};
|
||||
swprintf(wc_text, L"%S", text.c_str());
|
||||
|
||||
font->TextOut(g_pFrontBuffer, wc_text, wcslen(wc_text), 320, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
int start = 0;
|
||||
|
||||
while(start != RString.npos)
|
||||
{
|
||||
RString toPrint;
|
||||
if(newLineIndex != RString.npos)
|
||||
toPrint = text.substr(start, newLineIndex - start);
|
||||
else
|
||||
toPrint = text.substr(start);
|
||||
|
||||
if(toPrint != "")
|
||||
{
|
||||
WCHAR wc_text[200] = {0};
|
||||
swprintf(wc_text, L"%S", toPrint.c_str());
|
||||
|
||||
font->TextOut(g_pFrontBuffer, wc_text, wcslen(wc_text), 320, y);
|
||||
}
|
||||
y = y + font->GetTextHeight() + 10;
|
||||
|
||||
if(newLineIndex != RString.npos)
|
||||
start = newLineIndex + 1;
|
||||
else
|
||||
start = RString.npos;
|
||||
|
||||
newLineIndex = text.find("\n", start);
|
||||
}
|
||||
}
|
||||
|
||||
g_pFrontBuffer->Release();
|
||||
|
||||
g_pD3DDevice->EndScene();
|
||||
g_pD3DDevice->Present(NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void LoadingWindow_Xbox::SetText(RString str)
|
||||
{
|
||||
text = str ;
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2004 Ryan Dortmans
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,51 +0,0 @@
|
||||
#ifndef LOADING_WINDOW_XBOX_H
|
||||
#define LOADING_WINDOW_XBOX_H
|
||||
|
||||
#include "LoadingWindow.h"
|
||||
|
||||
#include <xtl.h>
|
||||
#include <xfont.h>
|
||||
#define XFONT_TRUETYPE
|
||||
|
||||
class LoadingWindow_Xbox: public LoadingWindow
|
||||
{
|
||||
public:
|
||||
LoadingWindow_Xbox();
|
||||
~LoadingWindow_Xbox();
|
||||
|
||||
void Paint();
|
||||
void SetText(RString str);
|
||||
|
||||
protected:
|
||||
RString text ;
|
||||
XFONT* font;
|
||||
bool useImage;
|
||||
};
|
||||
#define USE_LOADING_WINDOW_XBOX
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2004 Ryan Dortmans
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,150 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "MemoryCardDriverThreaded_Xbox.h"
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
|
||||
MemoryCardDriverThreaded_Xbox::MemoryCardDriverThreaded_Xbox()
|
||||
{
|
||||
}
|
||||
|
||||
MemoryCardDriverThreaded_Xbox::~MemoryCardDriverThreaded_Xbox()
|
||||
{
|
||||
}
|
||||
|
||||
static bool TestReady( const RString &sDrive, RString &sVolumeLabelOut )
|
||||
{
|
||||
TCHAR szVolumeNameBuffer[MAX_PATH];
|
||||
DWORD dwVolumeSerialNumber;
|
||||
DWORD dwMaximumComponentLength;
|
||||
DWORD lpFileSystemFlags;
|
||||
TCHAR szFileSystemNameBuffer[MAX_PATH];
|
||||
|
||||
if( !GetVolumeInformation(
|
||||
sDrive,
|
||||
szVolumeNameBuffer,
|
||||
sizeof(szVolumeNameBuffer),
|
||||
&dwVolumeSerialNumber,
|
||||
&dwMaximumComponentLength,
|
||||
&lpFileSystemFlags,
|
||||
szFileSystemNameBuffer,
|
||||
sizeof(szFileSystemNameBuffer)) ){
|
||||
LOG->Trace("GetVolumeInformation failed %u", GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
sVolumeLabelOut = szVolumeNameBuffer;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MemoryCardDriverThreaded_Xbox::TestWrite( UsbStorageDevice* pDevice )
|
||||
{
|
||||
/* Try to write a file, to check if the device is writable and that we have write permission.*/
|
||||
for( int i = 0; i < 10; ++i )
|
||||
{
|
||||
HANDLE hFile = CreateFile(
|
||||
ssprintf( "%s\\tmp%i", pDevice->sOsMountDir.c_str(), RandomInt(100000)),
|
||||
GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL,
|
||||
CREATE_NEW,
|
||||
FILE_FLAG_DELETE_ON_CLOSE,
|
||||
NULL );
|
||||
|
||||
if( hFile == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
DWORD iError = GetLastError();
|
||||
LOG->Warn( "Couldn't write to %s (%u)", pDevice->sOsMountDir.c_str(), iError);
|
||||
|
||||
if( iError == ERROR_FILE_EXISTS )
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
CloseHandle( hFile );
|
||||
return true;
|
||||
}
|
||||
|
||||
pDevice->SetError( "TestFailed" );
|
||||
return false;
|
||||
}
|
||||
|
||||
void MemoryCardDriverThreaded_Xbox::GetUSBStorageDevices( vector<UsbStorageDevice>& vDevicesOut )
|
||||
{
|
||||
DWORD devices=XGetDevices(XDEVICE_TYPE_MEMORY_UNIT);
|
||||
|
||||
for(int port=0;port<4;port++){
|
||||
//top slot
|
||||
if(devices&(1<<port)){
|
||||
vDevicesOut.push_back( UsbStorageDevice() );
|
||||
UsbStorageDevice &usbd = vDevicesOut.back();
|
||||
usbd.iPort=port;
|
||||
usbd.iLevel=0;
|
||||
usbd.sDevice=ssprintf("Memory card on port %u on slot 0", port);
|
||||
}
|
||||
//bottom slot
|
||||
if(devices&(1<<(port+16))){
|
||||
vDevicesOut.push_back( UsbStorageDevice() );
|
||||
UsbStorageDevice &usbd = vDevicesOut.back();
|
||||
usbd.iPort=port;
|
||||
usbd.iLevel=1;
|
||||
usbd.sDevice=ssprintf("Memory card on port %u on slot 1", port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool MemoryCardDriverThreaded_Xbox::USBStorageDevicesChanged()
|
||||
{
|
||||
DWORD ins, rem;
|
||||
return XGetDeviceChanges(XDEVICE_TYPE_MEMORY_UNIT, &ins, &rem)==TRUE;
|
||||
}
|
||||
|
||||
bool MemoryCardDriverThreaded_Xbox::Mount( UsbStorageDevice* pDevice )
|
||||
{
|
||||
LOG->Trace( "%s", __FUNCTION__);
|
||||
CHAR drive;
|
||||
DWORD MountRetval=XMountMU(pDevice->iPort, pDevice->iLevel, &drive);
|
||||
if(MountRetval==ERROR_SUCCESS){
|
||||
LOG->Trace("Mounted memory card from port %u slot %u to %c:", pDevice->iPort, pDevice->iLevel, drive);
|
||||
pDevice->SetOsMountDir(ssprintf("%c:", drive));
|
||||
RString sVolumeLabel;
|
||||
if( !TestReady(pDevice->sOsMountDir + "\\", sVolumeLabel) )
|
||||
{
|
||||
LOG->Trace( "not TestReady" );
|
||||
}
|
||||
pDevice->sVolumeLabel = sVolumeLabel;
|
||||
return true;
|
||||
}else{
|
||||
LOG->Trace("Could not mount memory card %u", MountRetval);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCardDriverThreaded_Xbox::Unmount( UsbStorageDevice* pDevice )
|
||||
{
|
||||
XUnmountMU(pDevice->iPort, pDevice->iLevel);
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2003-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,51 +0,0 @@
|
||||
#ifndef MemoryCardDriverThreaded_Xbox_H
|
||||
#define MemoryCardDriverThreaded_Xbox_H
|
||||
|
||||
#include "MemoryCardDriver.h"
|
||||
|
||||
class MemoryCardDriverThreaded_Xbox: public MemoryCardDriver
|
||||
{
|
||||
public:
|
||||
MemoryCardDriverThreaded_Xbox();
|
||||
virtual ~MemoryCardDriverThreaded_Xbox();
|
||||
|
||||
virtual bool Mount( UsbStorageDevice* pDevice );
|
||||
virtual void Unmount( UsbStorageDevice* pDevice );
|
||||
|
||||
private:
|
||||
void GetUSBStorageDevices( vector<UsbStorageDevice>& vDevicesOut );
|
||||
bool USBStorageDevicesChanged();
|
||||
bool TestWrite( UsbStorageDevice* pDevice );
|
||||
};
|
||||
|
||||
#ifdef ARCH_MEMORY_CARD_DRIVER
|
||||
#error "More than one MemoryCardDriver included!"
|
||||
#endif
|
||||
#define ARCH_MEMORY_CARD_DRIVER MemoryCardDriverThreaded_Xbox
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2003-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -29,34 +29,15 @@ namespace avcodec
|
||||
};
|
||||
|
||||
/*
|
||||
#if defined(_MSC_VER) && !defined(XBOX)
|
||||
#if defined(_MSC_VER)
|
||||
#pragma comment(lib, "ffmpeg/lib/avcodec.lib")
|
||||
#pragma comment(lib, "ffmpeg/lib/avformat.lib")
|
||||
#if defined(USE_MODERN_FFMPEG)
|
||||
#pragma comment(lib, "ffmpeg/lib/swscale.lib")
|
||||
#endif
|
||||
#endif // _MSC_VER && !XBOX
|
||||
#endif // _MSC_VER
|
||||
*/
|
||||
|
||||
#if defined(XBOX)
|
||||
/* NOTES: ffmpeg static libraries arent included in SVN. You have to build
|
||||
*them yourself or remove this file to produce the xbox build.
|
||||
*
|
||||
* build ffmpeg with mingw32 ( howto http://ffmpeg.arrozcru.org/wiki/index.php?title=Main_Page )
|
||||
* ./configure --enable-memalign-hack --enable-static --disable-mmx --target-os=mingw32 --arch=x86
|
||||
* you can use various switches to enable/disable codecs/muxers/etc.
|
||||
*
|
||||
* libgcc.a and libmingwex.a comes from mingw installation
|
||||
* msys\mingw\lib\gcc\mingw32\3.4.5\libgcc.a */
|
||||
#pragma comment(lib, "ffmpeg/lib/libavcodec.a")
|
||||
#pragma comment(lib, "ffmpeg/lib/libavformat.a")
|
||||
#pragma comment(lib, "ffmpeg/lib/libavutil.a")
|
||||
#pragma comment(lib, "ffmpeg/lib/libswscale.a")
|
||||
#pragma comment(lib, "ffmpeg/lib/libgcc.a")
|
||||
#pragma comment(lib, "ffmpeg/lib/libmingwex.a")
|
||||
#pragma comment(lib, "ffmpeg/lib/libcoldname.a")
|
||||
#endif
|
||||
|
||||
#if !defined(MACOSX)
|
||||
static const int sws_flags = SWS_BICUBIC; // XXX: Reasonable default?
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "RageUtil.h"
|
||||
#include "Sprite.h"
|
||||
|
||||
#if defined(WIN32) && !defined(XBOX)
|
||||
#if defined(WIN32)
|
||||
#include "archutils/Win32/ErrorStrings.h"
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
@@ -31,11 +31,9 @@ HANDLE Win32ThreadIdToHandle( uint64_t iID )
|
||||
|
||||
void ThreadImpl_Win32::Halt( bool Kill )
|
||||
{
|
||||
#ifndef _XBOX
|
||||
if( Kill )
|
||||
TerminateThread( ThreadHandle, 0 );
|
||||
else
|
||||
#endif
|
||||
SuspendThread( ThreadHandle );
|
||||
}
|
||||
|
||||
|
||||
+7
-14
@@ -52,9 +52,6 @@ void MakeInputHandlers( const RString &drivers, vector<InputHandler *> &Add )
|
||||
#ifdef USE_INPUT_HANDLER_X11
|
||||
if( !s->CompareNoCase("X11") ) ret = new InputHandler_X11;
|
||||
#endif
|
||||
#ifdef USE_INPUT_HANDLER_XBOX
|
||||
if( !s->CompareNoCase("Xbox") ) ret = new InputHandler_Xbox;
|
||||
#endif
|
||||
#ifdef USE_INPUT_HANDLER_MACOSX_HID
|
||||
if( !s->CompareNoCase("MacOSX") ) ret = new InputHandler_MacOSX_HID;
|
||||
#endif
|
||||
@@ -104,7 +101,7 @@ LoadingWindow *MakeLoadingWindow()
|
||||
return new LoadingWindow_Null;
|
||||
#endif
|
||||
// Don't load NULL by default.
|
||||
const RString drivers = "xbox,win32,cocoa,gtk";
|
||||
const RString drivers = "win32,cocoa,gtk";
|
||||
vector<RString> DriversToTry;
|
||||
split( drivers, ",", DriversToTry, true );
|
||||
|
||||
@@ -129,11 +126,7 @@ LoadingWindow *MakeLoadingWindow()
|
||||
#ifdef USE_LOADING_WINDOW_WIN32
|
||||
if( !DriversToTry[i].CompareNoCase("Win32") ) ret = new LoadingWindow_Win32;
|
||||
#endif
|
||||
#ifdef USE_LOADING_WINDOW_XBOX
|
||||
if( !DriversToTry[i].CompareNoCase("Xbox") ) ret = new LoadingWindow_Xbox;
|
||||
#endif
|
||||
|
||||
|
||||
if( ret == NULL )
|
||||
continue;
|
||||
|
||||
@@ -144,10 +137,10 @@ LoadingWindow *MakeLoadingWindow()
|
||||
SAFE_DELETE( ret );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(ret)
|
||||
LOG->Info( "Loading window: %s", Driver.c_str() );
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -191,7 +184,7 @@ RageMovieTexture *MakeRageMovieTexture( RageTextureID ID )
|
||||
|
||||
vector<RString> DriversToTry;
|
||||
split( sDrivers, ",", DriversToTry, true );
|
||||
|
||||
|
||||
if( DriversToTry.empty() )
|
||||
RageException::Throw( MOVIE_DRIVERS_EMPTY.GetValue() );
|
||||
|
||||
@@ -231,7 +224,7 @@ RageMovieTexture *MakeRageMovieTexture( RageTextureID ID )
|
||||
RageException::Throw( COULDNT_CREATE_MOVIE_DRIVER.GetValue() );
|
||||
|
||||
LOG->Trace( "Created movie texture \"%s\" with driver \"%s\"",
|
||||
ID.filename.c_str(), Driver.c_str() );
|
||||
ID.filename.c_str(), Driver.c_str() );
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -291,10 +284,10 @@ RageSoundDriver *MakeRageSoundDriver( const RString &drivers )
|
||||
SAFE_DELETE( ret );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( ret )
|
||||
LOG->Info( "Sound driver: %s", Driver.c_str() );
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#if defined(_WINDOWS)
|
||||
#define SUPPORT_OPENGL
|
||||
#define SUPPORT_D3D
|
||||
#elif defined(_XBOX)
|
||||
#define SUPPORT_D3D
|
||||
#else
|
||||
#define SUPPORT_OPENGL
|
||||
#endif
|
||||
|
||||
@@ -22,16 +22,6 @@
|
||||
#define DEFAULT_SOUND_DRIVER_LIST "AudioUnit,Null"
|
||||
|
||||
|
||||
#elif defined(_XBOX)
|
||||
#include "ArchHooks/ArchHooks_Xbox.h"
|
||||
#include "LoadingWindow/LoadingWindow_Xbox.h"
|
||||
#include "LowLevelWindow/LowLevelWindow_Win32.h"
|
||||
#include "MemoryCard/MemoryCardDriverThreaded_Xbox.h"
|
||||
#define DEFAULT_INPUT_DRIVER_LIST "Xbox"
|
||||
#define DEFAULT_MOVIE_DRIVER_LIST "Theora,FFMpeg,DShow,Null"
|
||||
#define DEFAULT_SOUND_DRIVER_LIST "DirectSound,DirectSound-sw,Null"
|
||||
|
||||
|
||||
#elif defined(UNIX)
|
||||
#include "ArchHooks/ArchHooks_Unix.h"
|
||||
#include "LowLevelWindow/LowLevelWindow_X11.h"
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#ifndef APP_INSTANCE_H
|
||||
#define APP_INSTANCE_H
|
||||
|
||||
#if !defined(_XBOX)
|
||||
# include "windows.h"
|
||||
#endif
|
||||
#include "windows.h"
|
||||
|
||||
/** @brief get an HINSTANCE for starting dialog boxes. */
|
||||
class AppInstance
|
||||
|
||||
@@ -2,14 +2,10 @@
|
||||
#include "DirectXHelpers.h"
|
||||
#include "RageUtil.h"
|
||||
|
||||
#ifdef _XBOX
|
||||
# include <D3DX8Core.h>
|
||||
#else
|
||||
# include <windows.h>
|
||||
# include <dxerr8.h>
|
||||
# if defined(_MSC_VER)
|
||||
# pragma comment(lib, "dxerr8.lib")
|
||||
# endif
|
||||
#include <windows.h>
|
||||
#include <dxerr8.h>
|
||||
#if defined(_MSC_VER)
|
||||
# pragma comment(lib, "dxerr8.lib")
|
||||
#endif
|
||||
|
||||
RString hr_ssprintf( int hr, const char *fmt, ... )
|
||||
@@ -19,13 +15,7 @@ RString hr_ssprintf( int hr, const char *fmt, ... )
|
||||
RString s = vssprintf( fmt, va );
|
||||
va_end(va);
|
||||
|
||||
#ifdef _XBOX
|
||||
char szError[1024] = "";
|
||||
D3DXGetErrorString( hr, szError, sizeof(szError) );
|
||||
#else
|
||||
const char *szError = DXGetErrorString8( hr );
|
||||
#endif
|
||||
|
||||
return s + ssprintf( " (%s)", szError );
|
||||
}
|
||||
|
||||
|
||||
@@ -2,17 +2,13 @@
|
||||
#include "ErrorStrings.h"
|
||||
#include "RageUtil.h"
|
||||
|
||||
#if !defined(XBOX)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
RString werr_ssprintf( int err, const char *fmt, ... )
|
||||
{
|
||||
char buf[1024] = "";
|
||||
#ifndef _XBOX
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
0, err, 0, buf, sizeof(buf), NULL);
|
||||
#endif
|
||||
|
||||
// Why is FormatMessage returning text ending with \r\n? (who? -aj)
|
||||
// Perhaps it's because you're on Windows, where newlines are \r\n. -aj
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
#ifndef ARCH_SETUP_WINDOWS_H
|
||||
#define ARCH_SETUP_WINDOWS_H
|
||||
|
||||
#if !defined(XBOX)
|
||||
#define HAVE_FFMPEG
|
||||
#define HAVE_THEORA
|
||||
#endif
|
||||
|
||||
#if !defined(XBOX)
|
||||
#define SUPPORT_OPENGL
|
||||
#endif
|
||||
#define SUPPORT_D3D
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
@@ -143,25 +139,13 @@ inline long int lrintf( float f )
|
||||
|
||||
/* We implement the crash handler interface (though that interface isn't
|
||||
* completely uniform across platforms yet). */
|
||||
#if !defined(_XBOX) && !defined(SMPACKAGE)
|
||||
#if !defined(SMPACKAGE)
|
||||
#define CRASH_HANDLER
|
||||
#endif
|
||||
|
||||
#define ENDIAN_LITTLE
|
||||
|
||||
#if defined(_XBOX)
|
||||
#if defined(_DEBUG)
|
||||
#define OGG_LIB_DIR "vorbis/xbox/debug/"
|
||||
#else
|
||||
#define OGG_LIB_DIR "vorbis/xbox/release/"
|
||||
#endif
|
||||
#else
|
||||
#define OGG_LIB_DIR "vorbis/win32/"
|
||||
#endif
|
||||
|
||||
#if defined(XBOX)
|
||||
#include "ArchUtils/Xbox/arch_setup.h"
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) // It might be MinGW or Cygwin(?)
|
||||
#include "archutils/Common/gcc_byte_swaps.h"
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "archutils/Xbox/GraphicsWindow.h"
|
||||
#include "ProductInfo.h"
|
||||
#include "RageLog.h"
|
||||
#include "RageUtil.h"
|
||||
#include "RageDisplay.h"
|
||||
|
||||
static const RString g_sClassName = RString(PRODUCT_ID) + " LowLevelWindow_Win32";
|
||||
|
||||
static VideoModeParams g_CurrentParams;
|
||||
static bool g_bResolutionChanged = false;
|
||||
static bool g_bHasFocus = true;
|
||||
static bool g_bLastHasFocus = true;
|
||||
static bool m_bWideWindowClass;
|
||||
bool isPALSystem();
|
||||
void setScreenResolutionValues();
|
||||
|
||||
void GraphicsWindow::SetVideoModeParams( const VideoModeParams ¶ms )
|
||||
{
|
||||
g_CurrentParams = params;
|
||||
}
|
||||
|
||||
const VideoModeParams &GraphicsWindow::GetParams()
|
||||
{
|
||||
return g_CurrentParams;
|
||||
}
|
||||
|
||||
void GraphicsWindow::Update()
|
||||
{
|
||||
if( g_bResolutionChanged )
|
||||
{
|
||||
/* Let DISPLAY know that our resolution has changed. */
|
||||
DISPLAY->ResolutionChanged();
|
||||
g_bResolutionChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
void GraphicsWindow::Initialize( bool bD3D )
|
||||
{
|
||||
/* We do the parameters initialisation here. No need to use the INI,
|
||||
because if we changed resolutions, it wouldn't keep up. */
|
||||
|
||||
g_CurrentParams.bpp = 32;
|
||||
g_CurrentParams.windowed=false;
|
||||
|
||||
isPALSystem();
|
||||
setScreenResolutionValues();
|
||||
}
|
||||
|
||||
bool isPALSystem()
|
||||
{
|
||||
if(XGetVideoStandard() == XC_VIDEO_STANDARD_PAL_I)
|
||||
{
|
||||
g_CurrentParams.interlaced=true;
|
||||
|
||||
/* Get supported video flags. */
|
||||
DWORD VideoFlags = XGetVideoFlags();
|
||||
|
||||
/* Set pal60 if available. */
|
||||
if( VideoFlags & XC_VIDEO_FLAGS_PAL_60Hz )
|
||||
g_CurrentParams.rate = 60;
|
||||
else
|
||||
g_CurrentParams.rate = 50;
|
||||
|
||||
g_CurrentParams.PAL = true;
|
||||
return true;
|
||||
}
|
||||
g_CurrentParams.rate = 60;
|
||||
g_CurrentParams.PAL = false;
|
||||
return false;
|
||||
}
|
||||
void setScreenResolutionValues()
|
||||
{
|
||||
DWORD CurrentVideoFlags = XGetVideoFlags();
|
||||
int heightStandards;
|
||||
|
||||
// Preventive definition. Changed only if needed.
|
||||
g_CurrentParams.interlaced=false;
|
||||
|
||||
switch(isPALSystem()){
|
||||
case true:
|
||||
heightStandards = 576;
|
||||
break;
|
||||
case false:
|
||||
heightStandards = 480;
|
||||
g_CurrentParams.interlaced=false;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (CurrentVideoFlags){
|
||||
|
||||
case XC_VIDEO_FLAGS_HDTV_480p:
|
||||
g_CurrentParams.width=720;
|
||||
g_CurrentParams.height=480;
|
||||
break;
|
||||
|
||||
case XC_VIDEO_FLAGS_HDTV_720p:
|
||||
g_CurrentParams.width=1280;
|
||||
g_CurrentParams.height=720;
|
||||
break;
|
||||
|
||||
case XC_VIDEO_FLAGS_HDTV_1080i:
|
||||
g_CurrentParams.width=1920;
|
||||
g_CurrentParams.height=1080;
|
||||
g_CurrentParams.interlaced=true;
|
||||
break;
|
||||
|
||||
case XC_VIDEO_FLAGS_WIDESCREEN:
|
||||
g_CurrentParams.width=720;
|
||||
g_CurrentParams.height=heightStandards;
|
||||
break;
|
||||
|
||||
case XC_VIDEO_FLAGS_LETTERBOX:
|
||||
default:
|
||||
g_CurrentParams.width=640;
|
||||
g_CurrentParams.height=heightStandards;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GraphicsWindow::Shutdown() { }
|
||||
RString GraphicsWindow::SetScreenMode( const VideoModeParams &p ) { return ""; }
|
||||
void GraphicsWindow::CreateGraphicsWindow( const VideoModeParams &p ) { }
|
||||
void GraphicsWindow::RecreateGraphicsWindow( const VideoModeParams &p ) { }
|
||||
void GraphicsWindow::DestroyGraphicsWindow() { }
|
||||
void GraphicsWindow::ConfigureGraphicsWindow( const VideoModeParams &p ) { }
|
||||
|
||||
/*
|
||||
* (c) 2004 Glenn Maynard, Renaud Lepage
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,47 +0,0 @@
|
||||
#if !defined(GRAPHICS_WINDOW_H)
|
||||
#define GRAPHICS_WINDOW_H
|
||||
|
||||
#pragma once
|
||||
|
||||
class VideoModeParams;
|
||||
|
||||
namespace GraphicsWindow
|
||||
{
|
||||
void Initialize( bool bD3D );
|
||||
void Shutdown();
|
||||
void SetVideoModeParams( const VideoModeParams &p );
|
||||
RString SetScreenMode( const VideoModeParams &p );
|
||||
void CreateGraphicsWindow( const VideoModeParams &p );
|
||||
void RecreateGraphicsWindow( const VideoModeParams &p );
|
||||
void DestroyGraphicsWindow();
|
||||
void ConfigureGraphicsWindow( const VideoModeParams &p );
|
||||
const VideoModeParams &GetParams();
|
||||
void Update();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2004 Glenn Maynard
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,644 +0,0 @@
|
||||
/* This handles manual paging. It's primarily intended for the Xbox, but works
|
||||
* in Windows as well; it can be enabled for debugging. */
|
||||
|
||||
#include "global.h"
|
||||
#include "VirtualMemory.h"
|
||||
#include "RageLog.h"
|
||||
#include "Preference.h"
|
||||
#include <new>
|
||||
|
||||
#if defined(WINDOWS)
|
||||
#define PAGE_FILE_PATH "StepMania pagefile.dat"
|
||||
#else
|
||||
#define PAGE_FILE_PATH "Z:\\xxpagefile.sys"
|
||||
#endif
|
||||
|
||||
VirtualMemoryManager vmem_Manager;
|
||||
|
||||
static Preference<bool> g_bEnableVirtualMemory( "EnableVirtualMemory", true );
|
||||
// page file size in megabytes
|
||||
static Preference<int> g_iPageFileSize( "PageFileSize", 384 );
|
||||
// page size in kilobytes
|
||||
static Preference<int> g_iPageSize( "PageSize", 16 );
|
||||
// threshold in kilobytes where virtual memory will be used
|
||||
static Preference<int> g_iPageThreshold( "PageThreshold", 8 );
|
||||
// (under debug) log the virtual memory allocation, etc.
|
||||
static Preference<bool> g_bLogVirtualMemory( "LogVirtualMemory", false );
|
||||
|
||||
struct vm_page
|
||||
{
|
||||
DWORD startAddress; // start address for this page
|
||||
unsigned long headPage; // 0 if not allocated. Otherwise, the index of the first page
|
||||
// of this segment.
|
||||
bool committed; // true if this page is committed to RAM (is otherwise in the page file)
|
||||
bool locked; // true if this page should not be decommitted
|
||||
int pageFaults; // number of times this page has been accessed when it wasn't committed
|
||||
unsigned long sizeInPages; // size of the data segment in pages.
|
||||
size_t sizeInBytes; // size of the data segment in bytes.
|
||||
};
|
||||
|
||||
VirtualMemoryManager::VirtualMemoryManager():
|
||||
vmemMutex("VirtualMemory")
|
||||
{
|
||||
pages = 0;
|
||||
pageLRU = -1;
|
||||
inited = false;
|
||||
}
|
||||
|
||||
VirtualMemoryManager::~VirtualMemoryManager()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
bool VirtualMemoryManager::Init()
|
||||
{
|
||||
if( !g_bEnableVirtualMemory )
|
||||
return true;
|
||||
unsigned long totalPageSize = 1024 * 1024 * g_iPageFileSize;
|
||||
unsigned long sizePerPage = 1024 * g_iPageSize;
|
||||
unsigned long thold = 1024 * g_iPageThreshold;
|
||||
|
||||
threshold = thold;
|
||||
|
||||
totalPages = totalPageSize / sizePerPage;
|
||||
pageSize = sizePerPage;
|
||||
|
||||
if(totalPageSize % sizePerPage != 0)
|
||||
totalPageSize = sizePerPage * totalPages;
|
||||
|
||||
// initialise the pages array
|
||||
// bypass the overridden new by using HeapAlloc
|
||||
pages = (vm_page*)HeapAlloc(GetProcessHeap(), 0, totalPages * sizeof(vm_page));
|
||||
|
||||
if(pages == NULL)
|
||||
return false;
|
||||
|
||||
// create the page file on Z drive
|
||||
vmemFile = CreateFile( PAGE_FILE_PATH, GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
|
||||
|
||||
if(vmemFile == INVALID_HANDLE_VALUE)
|
||||
return false;
|
||||
|
||||
// set the file size
|
||||
// find the current file size
|
||||
unsigned long fileSize = SetFilePointer(vmemFile, 0, 0, FILE_END);
|
||||
if(fileSize == INVALID_SET_FILE_POINTER)
|
||||
return false;
|
||||
|
||||
if(fileSize < totalPageSize)
|
||||
{
|
||||
fileSize = SetFilePointer(vmemFile, totalPageSize, 0, FILE_BEGIN);
|
||||
if(fileSize == INVALID_SET_FILE_POINTER)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Reserve the virtual memory and get the base address
|
||||
baseAddress = (DWORD)VirtualAlloc(NULL, totalPageSize, MEM_RESERVE, PAGE_NOACCESS);
|
||||
|
||||
if(baseAddress == NULL)
|
||||
return false;
|
||||
|
||||
// initialise the page array
|
||||
for(unsigned long i = 0; i < totalPages; i++)
|
||||
{
|
||||
pages[i].startAddress = baseAddress + (i * pageSize);
|
||||
pages[i].headPage = -1;
|
||||
pages[i].committed = false;
|
||||
pages[i].sizeInPages = 0;
|
||||
pages[i].sizeInBytes = 0;
|
||||
pages[i].pageFaults = 0;
|
||||
pages[i].locked = false;
|
||||
}
|
||||
|
||||
SetLogging( g_bLogVirtualMemory );
|
||||
|
||||
inited = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void VirtualMemoryManager::Destroy()
|
||||
{
|
||||
if(pages != 0)
|
||||
{
|
||||
VirtualFree((LPVOID)baseAddress, 0, MEM_RELEASE);
|
||||
HeapFree(GetProcessHeap(), 0, pages);
|
||||
CloseHandle(vmemFile);
|
||||
}
|
||||
}
|
||||
|
||||
void* VirtualMemoryManager::Allocate(size_t size)
|
||||
{
|
||||
if(!inited)
|
||||
return NULL;
|
||||
|
||||
LockMut(vmemMutex);
|
||||
|
||||
unsigned long startPage = -1;
|
||||
unsigned long freeSegments = 0;
|
||||
unsigned long sizeInPages = (size / pageSize) + 1;
|
||||
|
||||
if(size % pageSize == 0)
|
||||
sizeInPages--;
|
||||
|
||||
// find a contiguous group of pages that will fit the data
|
||||
for(unsigned long i = 0; i < totalPages; i++)
|
||||
{
|
||||
if(pages[i].sizeInPages != 0)
|
||||
{
|
||||
startPage = -1;
|
||||
freeSegments = 0;
|
||||
i += pages[i].sizeInPages - 1; // go to next page segment
|
||||
}
|
||||
else
|
||||
{
|
||||
if(startPage == -1)
|
||||
{
|
||||
startPage = i;
|
||||
freeSegments = 1;
|
||||
}
|
||||
else
|
||||
freeSegments++;
|
||||
|
||||
if(sizeInPages == freeSegments)
|
||||
{
|
||||
if(LOG && logging)
|
||||
LOG->Trace("Allocating pages %u to %u", startPage, startPage + freeSegments - 1);
|
||||
|
||||
// commit this to memory
|
||||
DWORD ret = (DWORD)VirtualAlloc((LPVOID)pages[startPage].startAddress, size, MEM_COMMIT, PAGE_READWRITE);
|
||||
while(ret == NULL)
|
||||
{
|
||||
bool swappedOut = DecommitLRU();
|
||||
|
||||
if(!swappedOut)
|
||||
{
|
||||
if(LOG)
|
||||
LOG->Trace("VMem error: out of memory with no pages to swap out left");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = (DWORD)VirtualAlloc((LPVOID)pages[startPage].startAddress, size, MEM_COMMIT, PAGE_READWRITE);
|
||||
}
|
||||
|
||||
pageLRU = (startPage + sizeInPages) % totalPages;
|
||||
for(unsigned long j = startPage; j < startPage + freeSegments; j++)
|
||||
{
|
||||
pages[j].headPage = startPage;
|
||||
pages[j].pageFaults = 0;
|
||||
pages[j].sizeInPages = freeSegments;
|
||||
pages[j].sizeInBytes = size;
|
||||
pages[j].committed = true;
|
||||
pages[i].locked = false;
|
||||
}
|
||||
|
||||
return (void*) ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(LOG)
|
||||
LOG->Trace("VMem error: Couldn't find contiguous group of pages to allocate");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool VirtualMemoryManager::Free(void *ptr)
|
||||
{
|
||||
if(!inited)
|
||||
return false;
|
||||
|
||||
LockMut(vmemMutex);
|
||||
|
||||
// check that the address is within the virtual address bounds
|
||||
if((DWORD)ptr < baseAddress || (DWORD)ptr >= baseAddress + (totalPages * pageSize))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// find the page(s) to free
|
||||
DWORD offset = (DWORD)ptr - baseAddress;
|
||||
unsigned long pageIndex = offset / pageSize;
|
||||
|
||||
if(pages[pageIndex].headPage == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pageIndex = pages[pageIndex].headPage;
|
||||
ptr = (void *)pages[pageIndex].startAddress;
|
||||
|
||||
unsigned long endPage = pageIndex + pages[pageIndex].sizeInPages;
|
||||
unsigned long size = pages[pageIndex].sizeInBytes;
|
||||
|
||||
if(size == 0)
|
||||
{
|
||||
return false; // trying to free unallocated memory
|
||||
}
|
||||
|
||||
if(LOG && logging)
|
||||
LOG->Trace("Freeing pages %u to %u", pageIndex, endPage - 1);
|
||||
|
||||
if(pages[pageIndex].committed)
|
||||
VirtualFree(ptr, size, MEM_DECOMMIT);
|
||||
|
||||
for(unsigned long i = pageIndex; i < endPage; i++)
|
||||
{
|
||||
pages[i].headPage = -1;
|
||||
pages[i].committed = false;
|
||||
pages[i].pageFaults = 0;
|
||||
pages[i].sizeInBytes = 0;
|
||||
pages[i].sizeInPages = 0;
|
||||
pages[i].locked = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VirtualMemoryManager::PageFault(void *ptr)
|
||||
{
|
||||
if(!inited)
|
||||
return false;
|
||||
|
||||
LockMut(vmemMutex);
|
||||
|
||||
// check that the address is within the virtual address bounds
|
||||
if((DWORD)ptr < baseAddress || (DWORD)ptr >= baseAddress + (totalPages * pageSize))
|
||||
{
|
||||
if(LOG)
|
||||
{
|
||||
LOG->Trace("Vmem error: Page fault outside virtual memory bounds");
|
||||
LOG->Trace("Address: %u, bounds: %u to %u", (DWORD)ptr, baseAddress, baseAddress + (totalPages * pageSize));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// find the page segment that the fault occurred
|
||||
unsigned long offset = (DWORD)ptr - baseAddress;
|
||||
unsigned long pageIndex = offset / pageSize;
|
||||
|
||||
|
||||
unsigned long startPage = pages[pageIndex].headPage;
|
||||
if(startPage == -1)
|
||||
{
|
||||
if(LOG)
|
||||
LOG->Trace("VMem error: Trying to access memory that wasn't allocated");
|
||||
// trying to access memory that wasn't allocated
|
||||
return false;
|
||||
}
|
||||
|
||||
if(pages[startPage].committed)
|
||||
{
|
||||
if(LOG && logging)
|
||||
LOG->Trace("Pages appear to be committed already. Doing nothing...");
|
||||
return true;
|
||||
}
|
||||
|
||||
pageLRU = (startPage + pages[startPage].sizeInPages) % totalPages;
|
||||
|
||||
if(LOG && logging)
|
||||
LOG->Trace("Reallocating pages %u to %u", startPage, startPage + pages[startPage].sizeInPages - 1);
|
||||
|
||||
DWORD ret = (DWORD)VirtualAlloc((LPVOID)pages[startPage].startAddress, pages[startPage].sizeInBytes, MEM_COMMIT, PAGE_READWRITE);
|
||||
|
||||
while(ret == NULL)
|
||||
{
|
||||
bool swappedOut = DecommitLRU();
|
||||
if(!swappedOut)
|
||||
{
|
||||
if(LOG)
|
||||
LOG->Trace("VMem error: no pages left to swap out while reallocating");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = (DWORD)VirtualAlloc((LPVOID)pages[startPage].startAddress, pages[startPage].sizeInBytes, MEM_COMMIT, PAGE_READWRITE);
|
||||
}
|
||||
|
||||
for(unsigned long i = startPage; i < startPage + pages[startPage].sizeInPages; i++)
|
||||
{
|
||||
pages[i].committed = true;
|
||||
pages[i].pageFaults++;
|
||||
}
|
||||
|
||||
DWORD numRead;
|
||||
|
||||
SetFilePointer(vmemFile, pages[startPage].startAddress - baseAddress, 0, FILE_BEGIN);
|
||||
ReadFile(vmemFile, (void *)pages[startPage].startAddress, pages[startPage].sizeInBytes, &numRead, NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VirtualMemoryManager::DecommitLRU()
|
||||
{
|
||||
if(!inited)
|
||||
return false;
|
||||
|
||||
LockMut(vmemMutex);
|
||||
|
||||
// choose random LRU
|
||||
pageLRU = rand() % totalPages;
|
||||
|
||||
for(unsigned long i = 0; i < totalPages; i++)
|
||||
{
|
||||
unsigned long index = (pageLRU + i) % totalPages;
|
||||
|
||||
if(index == 0)
|
||||
index++;
|
||||
|
||||
if(pages[index].headPage == index && pages[index].committed && !pages[index].locked) // this is a head page
|
||||
{
|
||||
DWORD addr = pages[index].startAddress;
|
||||
unsigned long size = pages[index].sizeInPages;
|
||||
|
||||
// decommit this page
|
||||
// write to the page file
|
||||
if(SetFilePointer(vmemFile, addr - baseAddress, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
|
||||
{
|
||||
if(LOG)
|
||||
LOG->Trace("Vmem error: could not write to page file");
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD written;
|
||||
|
||||
WriteFile(vmemFile, (LPCVOID)addr, pages[index].sizeInBytes, &written, NULL);
|
||||
|
||||
// reset the page data
|
||||
if(LOG && logging)
|
||||
LOG->Trace("Swapping out pages %i to %i", index, index + size - 1);
|
||||
|
||||
for(unsigned long j = index; j < index + size; j++)
|
||||
{
|
||||
pages[j].committed = false;
|
||||
}
|
||||
|
||||
if(VirtualFree((LPVOID)addr, pages[index].sizeInBytes, MEM_DECOMMIT) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pageLRU = (pageLRU + pages[index].sizeInPages) % totalPages;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool VirtualMemoryManager::EnsureFreeMemory(size_t size)
|
||||
{
|
||||
if(!inited)
|
||||
return false;
|
||||
|
||||
LockMut(vmemMutex);
|
||||
|
||||
MEMORYSTATUS ms;
|
||||
GlobalMemoryStatus(&ms);
|
||||
|
||||
while(ms.dwAvailPhys < size)
|
||||
{
|
||||
if(LOG && logging)
|
||||
LOG->Trace("Freeing memory: need %i, have %i", size, ms.dwAvailPhys);
|
||||
|
||||
if(!DecommitLRU())
|
||||
{
|
||||
if(LOG)
|
||||
LOG->Trace("VMem error: No pages left to free while reserving memory");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void VirtualMemoryManager::Lock(void *ptr)
|
||||
{
|
||||
if(!inited)
|
||||
return;
|
||||
|
||||
LockMut(vmemMutex);
|
||||
|
||||
// check that the address is within the virtual address bounds
|
||||
if((DWORD)ptr < baseAddress || (DWORD)ptr >= baseAddress + (totalPages * pageSize))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// find the page(s) to free
|
||||
DWORD offset = (DWORD)ptr - baseAddress;
|
||||
unsigned long pageIndex = offset / pageSize;
|
||||
|
||||
if(pages[pageIndex].headPage == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pageIndex = pages[pageIndex].headPage;
|
||||
|
||||
unsigned long endPage = pageIndex + pages[pageIndex].sizeInPages;
|
||||
|
||||
if(!pages[pageIndex].committed)
|
||||
{
|
||||
if(!PageFault(ptr))
|
||||
return;
|
||||
}
|
||||
|
||||
for(unsigned long i = pageIndex; i < endPage; i++)
|
||||
{
|
||||
pages[i].locked = true;
|
||||
}
|
||||
}
|
||||
void VirtualMemoryManager::Unlock(void *ptr)
|
||||
{
|
||||
if(!inited)
|
||||
return;
|
||||
|
||||
LockMut(vmemMutex);
|
||||
|
||||
// check that the address is within the virtual address bounds
|
||||
if((DWORD)ptr < baseAddress || (DWORD)ptr >= baseAddress + (totalPages * pageSize))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// find the page(s) to free
|
||||
DWORD offset = (DWORD)ptr - baseAddress;
|
||||
unsigned long pageIndex = offset / pageSize;
|
||||
|
||||
if(pages[pageIndex].headPage == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pageIndex = pages[pageIndex].headPage;
|
||||
|
||||
unsigned long endPage = pageIndex + pages[pageIndex].sizeInPages;
|
||||
|
||||
for(unsigned long i = pageIndex; i < endPage; i++)
|
||||
{
|
||||
pages[i].locked = false;
|
||||
}
|
||||
}
|
||||
|
||||
void* operator new (size_t size)
|
||||
{
|
||||
if(!vmem_Manager.IsValid())
|
||||
return HeapAlloc(GetProcessHeap(), 0, size);
|
||||
|
||||
if(size > vmem_Manager.GetThreshold())
|
||||
return vmem_Manager.Allocate(size);
|
||||
else
|
||||
{
|
||||
void *ret = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
while(ret == NULL)
|
||||
{
|
||||
if(!vmem_Manager.DecommitLRU())
|
||||
return NULL;
|
||||
|
||||
ret = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
void* operator new[] (size_t size)
|
||||
{
|
||||
if(!vmem_Manager.IsValid())
|
||||
return HeapAlloc(GetProcessHeap(), 0, size);
|
||||
|
||||
if(size > vmem_Manager.GetThreshold())
|
||||
return vmem_Manager.Allocate(size);
|
||||
else
|
||||
{
|
||||
void *ret = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
while(ret == NULL)
|
||||
{
|
||||
if(!vmem_Manager.DecommitLRU())
|
||||
return NULL;
|
||||
|
||||
ret = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
void operator delete (void *p)
|
||||
{
|
||||
if(vmem_Manager.IsValid())
|
||||
{
|
||||
if(vmem_Manager.Free(p))
|
||||
return;
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, p);
|
||||
}
|
||||
|
||||
void operator delete[] (void *p)
|
||||
{
|
||||
if(vmem_Manager.IsValid())
|
||||
{
|
||||
if(vmem_Manager.Free(p))
|
||||
return;
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, p);
|
||||
}
|
||||
|
||||
void *valloc(size_t size)
|
||||
{
|
||||
if(!vmem_Manager.IsValid())
|
||||
return HeapAlloc(GetProcessHeap(), 0, size);
|
||||
|
||||
if(size > vmem_Manager.GetThreshold())
|
||||
return vmem_Manager.Allocate(size);
|
||||
else
|
||||
{
|
||||
void *ret = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
while(ret == NULL)
|
||||
{
|
||||
if(!vmem_Manager.DecommitLRU())
|
||||
return NULL;
|
||||
|
||||
ret = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
void vfree(void *ptr)
|
||||
{
|
||||
if(vmem_Manager.IsValid())
|
||||
{
|
||||
if(vmem_Manager.Free(ptr))
|
||||
return;
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, ptr);
|
||||
}
|
||||
|
||||
LONG _stdcall CheckPageFault(LPEXCEPTION_POINTERS e)
|
||||
{
|
||||
if(LOG && e->ExceptionRecord->ExceptionCode != EXCEPTION_ACCESS_VIOLATION)
|
||||
LOG->Trace("Exception: %u", e->ExceptionRecord->ExceptionCode);
|
||||
|
||||
if (e->ExceptionRecord->ExceptionCode != EXCEPTION_ACCESS_VIOLATION)
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
|
||||
DWORD addr = (DWORD)e->ExceptionRecord->ExceptionInformation[1];
|
||||
|
||||
if(vmem_Manager.IsValid())
|
||||
{
|
||||
if(LOG && vmem_Manager.IsLogging())
|
||||
LOG->Trace("Page fault");
|
||||
|
||||
if(vmem_Manager.PageFault((void *)addr))
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
}
|
||||
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
int NoMemory(size_t size)
|
||||
{
|
||||
if(LOG && vmem_Manager.IsLogging())
|
||||
LOG->Trace("Out of memory, freeing up some...");
|
||||
|
||||
if(vmem_Manager.DecommitLRU())
|
||||
{
|
||||
if(LOG && vmem_Manager.IsLogging())
|
||||
LOG->Trace("Freed some memory, trying again");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(LOG)
|
||||
LOG->Trace("No memory left to free. Failed");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2004 Ryan Dortmans
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,87 +0,0 @@
|
||||
#ifndef VIRTUAL_MEMORY_H
|
||||
#define VIRTUAL_MEMORY_H
|
||||
|
||||
#if defined(XBOX)
|
||||
#include <xtl.h>
|
||||
#else
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "RageThreads.h"
|
||||
|
||||
struct vm_page;
|
||||
|
||||
class VirtualMemoryManager
|
||||
{
|
||||
public:
|
||||
VirtualMemoryManager();
|
||||
~VirtualMemoryManager();
|
||||
|
||||
bool Init();
|
||||
void Destroy();
|
||||
void* Allocate(size_t size);
|
||||
bool Free(void *ptr);
|
||||
bool PageFault(void *ptr);
|
||||
bool DecommitLRU();
|
||||
bool EnsureFreeMemory(size_t size);
|
||||
void Lock(void *ptr);
|
||||
void Unlock(void *ptr);
|
||||
void SetLogging(bool l) { logging = l; }
|
||||
|
||||
bool IsValid() { return inited; }
|
||||
bool IsLogging() { return logging; }
|
||||
unsigned long GetThreshold() { return threshold; }
|
||||
|
||||
protected:
|
||||
vm_page *pages;
|
||||
HANDLE vmemFile;
|
||||
DWORD baseAddress;
|
||||
unsigned long totalPages;
|
||||
unsigned long pageSize;
|
||||
unsigned long threshold;
|
||||
unsigned long pageLRU;
|
||||
|
||||
bool inited;
|
||||
bool logging;
|
||||
|
||||
// mutex to make sure pages aren't allocated/deallocated concurrently
|
||||
RageMutex vmemMutex;
|
||||
};
|
||||
|
||||
void *valloc(size_t size);
|
||||
void vfree(void *ptr);
|
||||
|
||||
//#define malloc(size) valloc(size)
|
||||
//#define free(memblock) vfree(memblock)
|
||||
|
||||
extern VirtualMemoryManager vmem_Manager;
|
||||
|
||||
LONG _stdcall CheckPageFault(LPEXCEPTION_POINTERS e);
|
||||
int NoMemory(size_t size);
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2004 Ryan Dortmans
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,58 +0,0 @@
|
||||
#include "global.h"
|
||||
|
||||
#undef main
|
||||
void __cdecl main()
|
||||
{
|
||||
int argc = 1;
|
||||
char def[] = "default.xbe";
|
||||
char *argv[] = { def };
|
||||
int ret=SM_main( argc, argv );
|
||||
}
|
||||
|
||||
#ifndef _DEBUG
|
||||
//release xbox libs doesnt have these functions
|
||||
FILE * __cdecl _popen(const char *, const char *)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int __cdecl _pclose(FILE *)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
char *getenv(const char *)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int __cdecl system(const char *)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2006 Chris
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,25 +0,0 @@
|
||||
#ifndef ARCH_SETUP_XBOX_H
|
||||
#define ARCH_SETUP_XBOX_H
|
||||
|
||||
#include <xtl.h>
|
||||
#include <xgraphics.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(_XDBG)
|
||||
#include <xbdm.h>
|
||||
#define IsDebuggerPresent() DmIsDebuggerPresent()
|
||||
#endif
|
||||
|
||||
// Xbox base path
|
||||
#define SYS_BASE_PATH "D:\\"
|
||||
|
||||
#define SUPPORT_D3D
|
||||
|
||||
/* Stubs: */
|
||||
inline HRESULT CoInitialize( LPVOID pvReserved ) { return S_OK; }
|
||||
inline void CoUninitialize() { }
|
||||
|
||||
extern "C" int SM_main( int argc, char *argv[] );
|
||||
#define main(x,y) SM_main(x,y)
|
||||
|
||||
#endif
|
||||
@@ -1,66 +0,0 @@
|
||||
#include <xtl.h>
|
||||
#include <stdio.h>
|
||||
#include "custom_launch_params.h"
|
||||
|
||||
CUSTOM_LAUNCH_DATA g_launchData ;
|
||||
int g_autoLaunchGame ;
|
||||
int g_launchReturnXBE ;
|
||||
|
||||
//XGetCustomLaunchData
|
||||
//
|
||||
//If there is a valid filename to load, then g_autoLaunchGame will be set to 1
|
||||
//If there is a valid return XBE, then g_launchReturnXBE will be set to 1
|
||||
int XGetCustomLaunchData()
|
||||
{
|
||||
DWORD launchType;
|
||||
|
||||
g_autoLaunchGame = 0 ;
|
||||
g_launchReturnXBE = 0 ;
|
||||
|
||||
memset( &g_launchData, 0, sizeof( CUSTOM_LAUNCH_DATA ) ) ;
|
||||
|
||||
|
||||
if ( ( XGetLaunchInfo( &launchType,(PLAUNCH_DATA)&g_launchData) == ERROR_SUCCESS ) )
|
||||
{
|
||||
if ( ( launchType == LDT_TITLE ) && ( g_launchData.magic == CUSTOM_LAUNCH_MAGIC ) )
|
||||
{
|
||||
if ( g_launchData.szFilename[0] )
|
||||
g_autoLaunchGame = 1 ;
|
||||
|
||||
if ( g_launchData.szLaunchXBEOnExit[0] )
|
||||
g_launchReturnXBE = 1 ;
|
||||
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
void XReturnToLaunchingXBE( )
|
||||
{
|
||||
if ( g_launchReturnXBE )
|
||||
{
|
||||
LD_LAUNCH_DASHBOARD LaunchData = { XLD_LAUNCH_DASHBOARD_MAIN_MENU };
|
||||
}
|
||||
else
|
||||
{
|
||||
LD_LAUNCH_DASHBOARD LaunchData = { XLD_LAUNCH_DASHBOARD_MAIN_MENU };
|
||||
|
||||
XLaunchNewImage( NULL, (LAUNCH_DATA*)&LaunchData );
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void doReturn()
|
||||
{
|
||||
XGetCustomLaunchData();
|
||||
XReturnToLaunchingXBE( );
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,36 +0,0 @@
|
||||
#ifndef CUSTOM_LAUNCH_PARAMS_H
|
||||
#define CUSTOM_LAUNCH_PARAMS_H
|
||||
|
||||
#include <xtl.h>
|
||||
|
||||
|
||||
#define CUSTOM_LAUNCH_MAGIC 0xEE456777
|
||||
|
||||
#define COUNTRY_TYPE_AUTODETECT 0
|
||||
#define COUNTRY_TYPE_USA 1
|
||||
#define COUNTRY_TYPE_JAPAN 2
|
||||
#define COUNTRY_TYPE_EUROPE 3
|
||||
#define COUNTRY_TYPE_OTHER 4
|
||||
|
||||
typedef struct _CUSTOM_LAUNCH_DATA
|
||||
{
|
||||
DWORD magic ; //populate this with CUSTOM_LAUNCH_MAGIC so we know we are using this special structure
|
||||
char szFilename[300] ; //this is the path to the game to load upon startup
|
||||
char szLaunchXBEOnExit[100] ; //this is the XBE name that should be launched when exiting the emu ( "FILE.XBE" )
|
||||
char szRemap_D_As[350] ; //this is what D drive should be mapped to in order to launch the XBE specified in szLaunchXBEOnExit ( "\\Device\\Harddisk0\\Partition1\\GAMES" )
|
||||
BYTE country ; //country code to use
|
||||
BYTE launchInsertedMedia ; //should we auto-run the inserted CD/DVD ?
|
||||
BYTE executionType ; //generic variable that determines how the emulator is run - for example, if you wish to run FMSXBOX as MSX1 or MSX2 or MSX2+
|
||||
char reserved[MAX_LAUNCH_DATA_SIZE-757] ; //MAX_LAUNCH_DATA_SIZE is 3KB
|
||||
|
||||
} CUSTOM_LAUNCH_DATA, *PCUSTOM_LAUNCH_DATA;
|
||||
|
||||
extern CUSTOM_LAUNCH_DATA g_launchData ;
|
||||
extern int g_autoLaunchGame ;
|
||||
extern int g_launchReturnXBE ;
|
||||
|
||||
|
||||
int XGetCustomLaunchData() ;
|
||||
void XReturnToLaunchingXBE( );
|
||||
|
||||
#endif
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,16 +5,7 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if defined(_XBOX)
|
||||
void noise_get_heavy(void (*func) (void *, int))
|
||||
{
|
||||
}
|
||||
|
||||
void noise_get_light(void (*func) (void *, int))
|
||||
{
|
||||
}
|
||||
|
||||
#elif defined(_WINDOWS)
|
||||
#if defined(_WINDOWS)
|
||||
#define _WIN32_WINNT 0x0400 // VC6 header needs this defined.
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user