This commit is contained in:
ptitSeb 2016-09-09 14:07:32 +02:00
commit 6c2966e250
5 changed files with 41 additions and 7 deletions

View File

@ -318,8 +318,16 @@ static void sdl_event_handler(const SDL_Event *event)
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
if (event->button.button <= 5) if (event->button.button <= 5) {
_abKeysPressed[KID_MOUSE1 + (event->button.button-1)] = (event->button.state == SDL_PRESSED) ? TRUE : FALSE; int button = KID_MOUSE1;
switch(event->button.button) {
case SDL_BUTTON_RIGHT: button = KID_MOUSE2; break;
case SDL_BUTTON_MIDDLE: button = KID_MOUSE3; break;
case 4: button = KID_MOUSE4; break;
case 5: button = KID_MOUSE5; break;
}
_abKeysPressed[button] = (event->button.state == SDL_PRESSED) ? TRUE : FALSE;
}
break; break;
case SDL_MOUSEWHEEL: case SDL_MOUSEWHEEL:
@ -716,6 +724,7 @@ void CInput::GetInput(BOOL bPreScan)
// clear button's buffer // clear button's buffer
memset( inp_ubButtonsBuffer, 0, sizeof( inp_ubButtonsBuffer)); memset( inp_ubButtonsBuffer, 0, sizeof( inp_ubButtonsBuffer));
Uint8 *keystate = SDL_GetKeyboardState(NULL);
// for each Key // for each Key
for (INDEX iKey=0; iKey<ARRAYCOUNT(_akcKeys); iKey++) { for (INDEX iKey=0; iKey<ARRAYCOUNT(_akcKeys); iKey++) {
const KeyConversion &kc = _akcKeys[iKey]; const KeyConversion &kc = _akcKeys[iKey];
@ -724,11 +733,11 @@ void CInput::GetInput(BOOL bPreScan)
//INDEX iScan = kc.kc_iScanCode; //INDEX iScan = kc.kc_iScanCode;
INDEX iVirt = kc.kc_iVirtKey; INDEX iVirt = kc.kc_iVirtKey;
// if reading async keystate // if reading async keystate
if (inp_iKeyboardReadingMethod==0) { if (0/*inp_iKeyboardReadingMethod==0*/) {
// if there is a valid virtkey // if there is a valid virtkey
if (iVirt>=0) { if (iVirt>=0) {
// is state is pressed // is state is pressed
if (SDL_GetKeyboardState(NULL)[SDL_GetScancodeFromKey((SDL_Keycode)iVirt)]) { if (keystate[SDL_GetScancodeFromKey((SDL_Keycode)iVirt)]) {
// mark it as pressed // mark it as pressed
inp_ubButtonsBuffer[iKID] = 0xFF; inp_ubButtonsBuffer[iKID] = 0xFF;
} }

19
Sources/Engine/Engine.cpp Normal file → Executable file
View File

@ -128,6 +128,13 @@ BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReser
static void DetectCPU(void) static void DetectCPU(void)
{ {
char strVendor[12+1] = { 0 }; char strVendor[12+1] = { 0 };
#if (defined USE_PORTABLE_C) // rcg10072001
CPrintF(TRANSV(" (No CPU detection in this binary.)\n"));
#ifdef PLATFORM_PANDORA
sys_iCPUMHz = 400; // conservative, ARM -> x86 cpu translation is not 1 to 1.
#endif
#else
strVendor[12] = 0; strVendor[12] = 0;
ULONG ulTFMS = 0; ULONG ulTFMS = 0;
ULONG ulFeatures = 0; ULONG ulFeatures = 0;
@ -398,7 +405,19 @@ static void SetupMemoryManager(void)
sys_iRAMSwap = ms.dwTotalPageFile/MB; sys_iRAMSwap = ms.dwTotalPageFile/MB;
#elif (defined PLATFORM_UNIX) #elif (defined PLATFORM_UNIX)
#ifdef PLATFORM_PANDORA
sys_iRAMPhys = 256; // conservative here, there is 256MB models and 512MB...
FILE* esrev = fopen("/etc/powervr-esrev", "r");
if (esrev) {
int rev = 0;
fscanf(esrev,"%d", &rev);
if (rev==3 || rev==5)
sys_iRAMPhys = 512;
fclose(esrev);
};
#else
sys_iRAMPhys = 1; // !!! FIXME: This is bad. Bad. BAD. sys_iRAMPhys = 1; // !!! FIXME: This is bad. Bad. BAD.
#endif
sys_iRAMSwap = 1; sys_iRAMSwap = 1;
#else #else

View File

@ -370,7 +370,11 @@ void Quaternion<Type>::FromEuler(const Vector<Type, 3> &a)
template<class Type> template<class Type>
Type Quaternion<Type>::EPS(Type orig) const Type Quaternion<Type>::EPS(Type orig) const
{ {
#ifdef PLATFORM_PANDORA
if ((orig <= 1e-4f) && (orig >= -1e-4f))
#else
if ((orig <= 10e-6f) && (orig >= -10e-6f)) if ((orig <= 10e-6f) && (orig >= -10e-6f))
#endif
return(0.0f); return(0.0f);
return(orig); return(orig);

5
Sources/Engine/Rendering/RendASER.cpp Normal file → Executable file
View File

@ -34,7 +34,6 @@ void CRenderer::AddAddListToActiveList(INDEX iScanLine)
// allocate space in destination for sum of source and add // allocate space in destination for sum of source and add
INDEX ctActiveEdges = re_aaceActiveEdges.Count(); INDEX ctActiveEdges = re_aaceActiveEdges.Count();
re_aaceActiveEdgesTmp.Push(ctAddEdges+ctActiveEdges); re_aaceActiveEdgesTmp.Push(ctAddEdges+ctActiveEdges);
// check that the add list is sorted right // check that the add list is sorted right
#if ASER_EXTREME_CHECKING #if ASER_EXTREME_CHECKING
{ {
@ -66,18 +65,18 @@ void CRenderer::AddAddListToActiveList(INDEX iScanLine)
// start at begining of add list, source active list and destination active list // start at begining of add list, source active list and destination active list
LISTITER(CAddEdge, ade_lnInAdd) itadeAdd(lhAdd); LISTITER(CAddEdge, ade_lnInAdd) itadeAdd(lhAdd);
CActiveEdge *paceSrc = &re_aaceActiveEdges[0]; CActiveEdge *paceSrc = &re_aaceActiveEdges[0];
CActiveEdge *paceEnd = &re_aaceActiveEdges[re_aaceActiveEdges.Count()-1];
CActiveEdge *paceDst = &re_aaceActiveEdgesTmp[0]; CActiveEdge *paceDst = &re_aaceActiveEdgesTmp[0];
IFDEBUG(INDEX ctNewActive=0); IFDEBUG(INDEX ctNewActive=0);
IFDEBUG(INDEX ctOldActive1=0); IFDEBUG(INDEX ctOldActive1=0);
IFDEBUG(INDEX ctOldActive2=0); IFDEBUG(INDEX ctOldActive2=0);
// for each edge in add list // for each edge in add list
while(!itadeAdd.IsPastEnd()) { while(!itadeAdd.IsPastEnd()) {
CAddEdge &ade = *itadeAdd; CAddEdge &ade = *itadeAdd;
// while the edge in active list is left of the edge in add list // while the edge in active list is left of the edge in add list
while (paceSrc->ace_xI.slHolder < itadeAdd->ade_xI.slHolder) { while ((paceSrc->ace_xI.slHolder < ade.ade_xI.slHolder) && (paceSrc!=paceEnd)) {
// copy the active edge // copy the active edge
ASSERT(paceSrc<=&re_aaceActiveEdges[ctActiveEdges-1]); ASSERT(paceSrc<=&re_aaceActiveEdges[ctActiveEdges-1]);
*paceDst++=*paceSrc++; *paceDst++=*paceSrc++;

3
Sources/SeriousSam/SeriousSam.cpp Normal file → Executable file
View File

@ -281,6 +281,8 @@ static void UpdatePauseState(void)
// limit current frame rate if neeeded // limit current frame rate if neeeded
void LimitFrameRate(void) void LimitFrameRate(void)
{ {
// do not limit FPS on the Pandora, it's not powerfull enough and doesn't "iconise" games either
#ifndef PLATFORM_PANDORA
// measure passed time for each loop // measure passed time for each loop
static CTimerValue tvLast(-1.0f); static CTimerValue tvLast(-1.0f);
CTimerValue tvNow = _pTimer->GetHighPrecisionTimer(); CTimerValue tvNow = _pTimer->GetHighPrecisionTimer();
@ -299,6 +301,7 @@ void LimitFrameRate(void)
// remember new time // remember new time
tvLast = _pTimer->GetHighPrecisionTimer(); tvLast = _pTimer->GetHighPrecisionTimer();
#endif
} }
// load first demo // load first demo