diff --git a/stepmania/src/arch/ArchHooks/ArchHooks_Xbox.cpp b/stepmania/src/arch/ArchHooks/ArchHooks_Xbox.cpp index 1a2e209e4b..5695c3b7de 100644 --- a/stepmania/src/arch/ArchHooks/ArchHooks_Xbox.cpp +++ b/stepmania/src/arch/ArchHooks/ArchHooks_Xbox.cpp @@ -90,6 +90,25 @@ bool SetupNetwork() #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 ); +} + ArchHooks_Xbox::ArchHooks_Xbox() { XGetCustomLaunchData(); @@ -98,6 +117,8 @@ ArchHooks_Xbox::ArchHooks_Xbox() MountDrives(); SetupNetwork(); + + EnableExtraRAM(); } ArchHooks_Xbox::~ArchHooks_Xbox() diff --git a/stepmania/src/arch/ArchHooks/ArchHooks_Xbox.h b/stepmania/src/arch/ArchHooks/ArchHooks_Xbox.h index 9e138f28aa..d649cdbf52 100644 --- a/stepmania/src/arch/ArchHooks/ArchHooks_Xbox.h +++ b/stepmania/src/arch/ArchHooks/ArchHooks_Xbox.h @@ -11,6 +11,34 @@ public: ~ArchHooks_Xbox(); }; +// 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 + }; +} + #undef ARCH_HOOKS #define ARCH_HOOKS ArchHooks_Xbox