summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2018-01-05 17:35:27 -0500
committerFranklin Wei <git@fwei.tk>2018-01-05 18:04:46 -0500
commit7443b9fda5b30e615dbff538260faeb64947db51 (patch)
tree7e0510da590b34eccc0b4faf06607b7d04001a74 /apps/plugins
parent5719756c123343b3f98ea3cfeda4182d38063bb1 (diff)
downloadrockbox-7443b9fda5b30e615dbff538260faeb64947db51.zip
rockbox-7443b9fda5b30e615dbff538260faeb64947db51.tar.gz
rockbox-7443b9fda5b30e615dbff538260faeb64947db51.tar.bz2
rockbox-7443b9fda5b30e615dbff538260faeb64947db51.tar.xz
duke3d: misc stuff (DON'T PUSH)
Mostly debugging output to the FPS line. Also changes tools/configure to always cross-compile a 32-bit simulator to support duke's horrendous pointer casting. Please don't push this. Change-Id: I3df6c633b5af017f33055dc4f9257738aaf66cfb
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/sdl/progs/duke3d/Engine/src/draw.c547
-rw-r--r--apps/plugins/sdl/progs/duke3d/Game/src/game.c15
-rw-r--r--apps/plugins/sdl/src/thread/rockbox/SDL_systhread.c1
3 files changed, 295 insertions, 268 deletions
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/draw.c b/apps/plugins/sdl/progs/duke3d/Engine/src/draw.c
index bf0fc68..e83c5e4 100644
--- a/apps/plugins/sdl/progs/duke3d/Engine/src/draw.c
+++ b/apps/plugins/sdl/progs/duke3d/Engine/src/draw.c
@@ -43,6 +43,9 @@ extern int32_t asm4;
static uint8_t machxbits_al;
static uint8_t bitsSetup;
static uint8_t * textureSetup;
+
+int drawcalls[10] = {0,0,0,0,0,0,0,0,0,0};
+
void sethlinesizes(int32_t i1, int32_t _bits, uint8_t * textureAddress)
{
machxbits_al = i1;
@@ -52,10 +55,11 @@ void sethlinesizes(int32_t i1, int32_t _bits, uint8_t * textureAddress)
+/* called a lot */
//FCS: Draw ceiling/floors
//Draw a line from destination in the framebuffer to framebuffer-numPixels
void hlineasm4(int32_t numPixels, int32_t shade, uint32_t i4, uint32_t i5, uint8_t *dest){
-
+ ++drawcalls[0];
int32_t shifter = ((256-machxbits_al) & 0x1f);
uint32_t source;
@@ -65,24 +69,24 @@ void hlineasm4(int32_t numPixels, int32_t shade, uint32_t i4, uint32_t i5, uint8
shade = shade & 0xffffff00;
numPixels++;
- if (!RENDER_DRAW_CEILING_AND_FLOOR)
- return;
+ if (!RENDER_DRAW_CEILING_AND_FLOOR)
+ return;
while (numPixels) {
- source = i5 >> shifter;
- source = shld(source,i4,bits);
- source = texture[source];
+ source = i5 >> shifter;
+ source = shld(source,i4,bits);
+ source = texture[source];
- if (pixelsAllowed-- > 0)
- *dest = globalpalwritten[shade|source];
+ if (pixelsAllowed-- > 0)
+ *dest = globalpalwritten[shade|source];
- dest--;
+ dest--;
- i5 -= asm1;
- i4 -= asm2;
+ i5 -= asm1;
+ i4 -= asm2;
- numPixels--;
+ numPixels--;
}
}
@@ -104,6 +108,7 @@ void setuprhlineasm4(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t i5,
void rhlineasm4(int32_t i1, uint8_t* texture, int32_t i3, uint32_t i4, uint32_t i5, int32_t dest)
{
+ ++drawcalls[1];
uint32_t ebp = dest - i1;
uint32_t rmach6b = ebp-1;
int32_t numPixels;
@@ -115,24 +120,24 @@ void rhlineasm4(int32_t i1, uint8_t* texture, int32_t i3, uint32_t i4, uint32_t
- i3 = ((i3&0xffffff00)|(*texture));
- i4 -= rmach_eax;
- ebp = (((i4+rmach_eax) < i4) ? -1 : 0);
- i5 -= rmach_ebx;
+ i3 = ((i3&0xffffff00)|(*texture));
+ i4 -= rmach_eax;
+ ebp = (((i4+rmach_eax) < i4) ? -1 : 0);
+ i5 -= rmach_ebx;
- if ((i5 + rmach_ebx) < i5)
+ if ((i5 + rmach_ebx) < i5)
texture -= (rmach_ecx+1);
- else
+ else
texture -= rmach_ecx;
- ebp &= rmach_esi;
- i1 = ((i1&0xffffff00)|(((uint8_t *)i3)[rmach_edx]));
+ ebp &= rmach_esi;
+ i1 = ((i1&0xffffff00)|(((uint8_t *)i3)[rmach_edx]));
- if (pixelsAllowed-- > 0)
- ((uint8_t *)rmach6b)[numPixels] = (i1&0xff);
+ if (pixelsAllowed-- > 0)
+ ((uint8_t *)rmach6b)[numPixels] = (i1&0xff);
- texture -= ebp;
- numPixels--;
+ texture -= ebp;
+ numPixels--;
} while (numPixels);
}
@@ -154,6 +159,7 @@ void setuprmhlineasm4(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t ti
//FCS: ????
void rmhlineasm4(int32_t i1, intptr_t shade, int32_t colorIndex, int32_t i4, int32_t i5, int32_t dest)
{
+ ++drawcalls[2];
uint32_t ebp = dest - i1;
uint32_t rmach6b = ebp-1;
int32_t numPixels;
@@ -166,29 +172,29 @@ void rmhlineasm4(int32_t i1, intptr_t shade, int32_t colorIndex, int32_t i4, int
- colorIndex = ((colorIndex&0xffffff00)|(*((uint8_t *)shade)));
- i4 -= rmmach_eax;
- ebp = (((i4+rmmach_eax) < i4) ? -1 : 0);
- i5 -= rmmach_ebx;
+ colorIndex = ((colorIndex&0xffffff00)|(*((uint8_t *)shade)));
+ i4 -= rmmach_eax;
+ ebp = (((i4+rmmach_eax) < i4) ? -1 : 0);
+ i5 -= rmmach_ebx;
- if ((i5 + rmmach_ebx) < i5)
+ if ((i5 + rmmach_ebx) < i5)
shade -= (rmmach_ecx+1);
- else
+ else
shade -= rmmach_ecx;
- ebp &= setupTileHeight;
+ ebp &= setupTileHeight;
//Check if this colorIndex is the transparent color (255).
- if ((colorIndex&0xff) != 255) {
- if (pixelsAllowed-- > 0)
- {
- i1 = ((i1&0xffffff00)|(((uint8_t *)colorIndex)[rmmach_edx]));
- ((uint8_t *)rmach6b)[numPixels] = (i1&0xff);
- }
+ if ((colorIndex&0xff) != 255) {
+ if (pixelsAllowed-- > 0)
+ {
+ i1 = ((i1&0xffffff00)|(((uint8_t *)colorIndex)[rmmach_edx]));
+ ((uint8_t *)rmach6b)[numPixels] = (i1&0xff);
}
+ }
- shade -= ebp;
- numPixels--;
+ shade -= ebp;
+ numPixels--;
} while (numPixels);
}
@@ -206,53 +212,57 @@ void setBytesPerLine(int32_t _bytesperline)
static uint8_t mach3_al;
+/* called a lot */
//FCS: RENDER TOP AND BOTTOM COLUMN
int32_t prevlineasm1(int32_t i1, uint8_t* palette, int32_t i3, int32_t i4, uint8_t *source, uint8_t *dest)
{
+ ++drawcalls[3];
if (i3 == 0)
{
- if (!RENDER_DRAW_TOP_AND_BOTTOM_COLUMN)
+ if (!RENDER_DRAW_TOP_AND_BOTTOM_COLUMN)
return 0;
- i1 += i4;
+ i1 += i4;
i4 = ((uint32_t)i4) >> mach3_al;
- i4 = (i4&0xffffff00) | source[i4];
+ i4 = (i4&0xffffff00) | source[i4];
- if (pixelsAllowed-- > 0)
- *dest = palette[i4];
+ if (pixelsAllowed-- > 0)
+ *dest = palette[i4];
- return i1;
+ return i1;
} else {
- return vlineasm1(i1,palette,i3,i4,source,dest);
+ return vlineasm1(i1,palette,i3,i4,source,dest);
}
}
+/* called a lot */
//FCS: This is used to draw wall border vertical lines
int32_t vlineasm1(int32_t vince, uint8_t* palookupoffse, int32_t numPixels, int32_t vplce, uint8_t* texture, uint8_t* dest)
{
+ ++drawcalls[4];
uint32_t temp;
if (!RENDER_DRAW_WALL_BORDERS)
- return vplce;
+ return vplce;
numPixels++;
while (numPixels)
{
- temp = ((uint32_t)vplce) >> mach3_al;
+ temp = ((uint32_t)vplce) >> mach3_al;
- temp = texture[temp];
+ temp = texture[temp];
- if (pixelsAllowed-- > 0)
- *dest = palookupoffse[temp];
+ if (pixelsAllowed-- > 0)
+ *dest = palookupoffse[temp];
- vplce += vince;
- dest += bytesperline;
- numPixels--;
+ vplce += vince;
+ dest += bytesperline;
+ numPixels--;
}
return vplce;
}
@@ -260,37 +270,38 @@ int32_t vlineasm1(int32_t vince, uint8_t* palookupoffse, int32_t numPixels, int3
int32_t tvlineasm1(int32_t i1, uint8_t * texture, int32_t numPixels, int32_t i4, uint8_t *source, uint8_t *dest)
{
+ ++drawcalls[5];
uint8_t shiftValue = (globalshiftval & 0x1f);
- numPixels++;
- while (numPixels)
- {
- uint32_t temp = i4;
- temp >>= shiftValue;
- temp = source[temp];
+ numPixels++;
+ while (numPixels)
+ {
+ uint32_t temp = i4;
+ temp >>= shiftValue;
+ temp = source[temp];
- //255 is the index for transparent color index. Skip drawing this pixel.
- if (temp != 255)
- {
- uint16_t colorIndex;
+ //255 is the index for transparent color index. Skip drawing this pixel.
+ if (temp != 255)
+ {
+ uint16_t colorIndex;
- colorIndex = texture[temp];
- colorIndex |= ((*dest)<<8);
+ colorIndex = texture[temp];
+ colorIndex |= ((*dest)<<8);
- if (transrev)
- colorIndex = ((colorIndex>>8)|(colorIndex<<8));
+ if (transrev)
+ colorIndex = ((colorIndex>>8)|(colorIndex<<8));
- if (pixelsAllowed-- > 0)
- *dest = transluc[colorIndex];
- }
+ if (pixelsAllowed-- > 0)
+ *dest = transluc[colorIndex];
+ }
- i4 += i1;
+ i4 += i1;
//We are drawing a column ?!
- dest += bytesperline;
- numPixels--;
- }
- return i4;
+ dest += bytesperline;
+ numPixels--;
+ }
+ return i4;
} /* tvlineasm1 */
@@ -299,96 +310,99 @@ static uint32_t tran2pal_ebx;
static uint32_t tran2pal_ecx;
void setuptvlineasm2(int32_t i1, int32_t i2, int32_t i3)
{
- tran2shr = (i1&0x1f);
- tran2pal_ebx = i2;
- tran2pal_ecx = i3;
+ tran2shr = (i1&0x1f);
+ tran2pal_ebx = i2;
+ tran2pal_ecx = i3;
} /* */
void tvlineasm2(uint32_t i1, uint32_t i2, uintptr_t i3, uintptr_t i4, uint32_t i5, uintptr_t i6)
{
- uint32_t ebp = i1;
- uint32_t tran2inca = i2;
- uint32_t tran2incb = asm1;
- uintptr_t tran2bufa = i3;
- uintptr_t tran2bufb = i4;
- uintptr_t tran2edi = asm2;
- uintptr_t tran2edi1 = asm2 + 1;
-
- i6 -= asm2;
-
- do {
-
- i1 = i5 >> tran2shr;
- i2 = ebp >> tran2shr;
- i5 += tran2inca;
- ebp += tran2incb;
- i3 = ((uint8_t *)tran2bufa)[i1];
- i4 = ((uint8_t *)tran2bufb)[i2];
- if (i3 == 255) { // skipdraw1
- if (i4 != 255) { // skipdraw3
- uint16_t val;
- val = ((uint8_t *)tran2pal_ecx)[i4];
- val |= (((uint8_t *)i6)[tran2edi1]<<8);
-
- if (transrev)
- val = ((val>>8)|(val<<8));
-
- if (pixelsAllowed-- > 0)
- ((uint8_t *)i6)[tran2edi1] = transluc[val];
- }
- } else if (i4 == 255) { // skipdraw2
- uint16_t val;
- val = ((uint8_t *)tran2pal_ebx)[i3];
- val |= (((uint8_t *)i6)[tran2edi]<<8);
-
- if (transrev)
+ ++drawcalls[6];
+ uint32_t ebp = i1;
+ uint32_t tran2inca = i2;
+ uint32_t tran2incb = asm1;
+ uintptr_t tran2bufa = i3;
+ uintptr_t tran2bufb = i4;
+ uintptr_t tran2edi = asm2;
+ uintptr_t tran2edi1 = asm2 + 1;
+
+ i6 -= asm2;
+
+ do {
+
+ i1 = i5 >> tran2shr;
+ i2 = ebp >> tran2shr;
+ i5 += tran2inca;
+ ebp += tran2incb;
+ i3 = ((uint8_t *)tran2bufa)[i1];
+ i4 = ((uint8_t *)tran2bufb)[i2];
+ if (i3 == 255) { // skipdraw1
+ if (i4 != 255) { // skipdraw3
+ uint16_t val;
+ val = ((uint8_t *)tran2pal_ecx)[i4];
+ val |= (((uint8_t *)i6)[tran2edi1]<<8);
+
+ if (transrev)
+ val = ((val>>8)|(val<<8));
+
+ if (pixelsAllowed-- > 0)
+ ((uint8_t *)i6)[tran2edi1] = transluc[val];
+ }
+ } else if (i4 == 255) { // skipdraw2
+ uint16_t val;
+ val = ((uint8_t *)tran2pal_ebx)[i3];
+ val |= (((uint8_t *)i6)[tran2edi]<<8);
+
+ if (transrev)
val = ((val>>8)|(val<<8));
- if (pixelsAllowed-- > 0)
- ((uint8_t *)i6)[tran2edi] = transluc[val];
- } else {
- uint16_t l = ((uint8_t *)i6)[tran2edi]<<8;
- uint16_t r = ((uint8_t *)i6)[tran2edi1]<<8;
- l |= ((uint8_t *)tran2pal_ebx)[i3];
- r |= ((uint8_t *)tran2pal_ecx)[i4];
- if (transrev) {
- l = ((l>>8)|(l<<8));
- r = ((r>>8)|(r<<8));
- }
- if (pixelsAllowed-- > 0)
- {
- ((uint8_t *)i6)[tran2edi] = transluc[l];
- ((uint8_t *)i6)[tran2edi1] =transluc[r];
- pixelsAllowed--;
- }
- }
- i6 += bytesperline;
- } while (i6 > i6 - bytesperline);
- asm1 = i5;
- asm2 = ebp;
+ if (pixelsAllowed-- > 0)
+ ((uint8_t *)i6)[tran2edi] = transluc[val];
+ } else {
+ uint16_t l = ((uint8_t *)i6)[tran2edi]<<8;
+ uint16_t r = ((uint8_t *)i6)[tran2edi1]<<8;
+ l |= ((uint8_t *)tran2pal_ebx)[i3];
+ r |= ((uint8_t *)tran2pal_ecx)[i4];
+ if (transrev) {
+ l = ((l>>8)|(l<<8));
+ r = ((r>>8)|(r<<8));
+ }
+ if (pixelsAllowed-- > 0)
+ {
+ ((uint8_t *)i6)[tran2edi] = transluc[l];
+ ((uint8_t *)i6)[tran2edi1] =transluc[r];
+ pixelsAllowed--;
+ }
+ }
+ i6 += bytesperline;
+ } while (i6 > i6 - bytesperline);
+ asm1 = i5;
+ asm2 = ebp;
}
+/* called a lot */
static uint8_t machmv;
int32_t mvlineasm1(int32_t vince, uint8_t* palookupoffse, int32_t i3, int32_t vplce, uint8_t* texture, uint8_t *dest)
{
+ ++drawcalls[7];
uint32_t temp;
for(;i3>=0;i3--)
{
- temp = ((uint32_t)vplce) >> machmv;
- temp = texture[temp];
+ temp = ((uint32_t)vplce) >> machmv;
+ temp = texture[temp];
- if (temp != 255)
- {
- if (pixelsAllowed-- > 0)
- *dest = palookupoffse[temp];
- }
+ if (temp != 255)
+ {
+ if (pixelsAllowed-- > 0)
+ *dest = palookupoffse[temp];
+ }
- vplce += vince;
- dest += bytesperline;
+ vplce += vince;
+ dest += bytesperline;
}
return vplce;
}
@@ -399,10 +413,12 @@ void setupvlineasm(int32_t i1)
mach3_al = (i1&0x1f);
}
+/* called a lot */
//FCS This is used to fill the inside of a wall (so it draws VERTICAL column, always).
void vlineasm4(int32_t columnIndex, intptr_t framebuffer)
{
+ ++drawcalls[8];
if (!RENDER_DRAW_WALL_INSIDE)
return ;
@@ -435,9 +451,10 @@ void setupmvlineasm(int32_t i1)
machmv = (i1&0x1f);
}
-
+/* called a lot */
void mvlineasm4(int32_t column, intptr_t framebufferOffset)
{
+ ++drawcalls[9];
int i;
uint32_t temp;
uintptr_t index = (framebufferOffset + ylookup[column]);
@@ -445,20 +462,20 @@ void mvlineasm4(int32_t column, intptr_t framebufferOffset)
do {
- if (pixelsAllowed <= 0)
- return;
+ if (pixelsAllowed <= 0)
+ return;
for (i = 0; i < 4; i++)
{
- temp = ((uint32_t)vplce[i]) >> machmv;
- temp = (((uint8_t *)(bufplce[i]))[temp]);
- if (temp != 255)
- {
- if (pixelsAllowed-- > 0)
- dest[index+i] = palookupoffse[i][temp];
- }
- vplce[i] += vince[i];
+ temp = ((uint32_t)vplce[i]) >> machmv;
+ temp = (((uint8_t *)(bufplce[i]))[temp]);
+ if (temp != 255)
+ {
+ if (pixelsAllowed-- > 0)
+ dest[index+i] = palookupoffse[i][temp];
+ }
+ vplce[i] += vince[i];
}
dest += bytesperline;
@@ -519,9 +536,9 @@ setup:
i2 += smach_eax;
i1 = (i1&0xffffff00) | (*source&0xff);
if ((i2 - smach_eax) > i2)
- source += smach2_eax + 1;
+ source += smach2_eax + 1;
else
- source += smach2_eax;
+ source += smach2_eax;
while(1) {
@@ -580,7 +597,7 @@ setup:
else
source += smach2_eax;
- while(1){
+ while(1){
//Skip transparent pixels (index=255)
if ((colorIndex&0xff) != 255)
@@ -620,63 +637,63 @@ uint32_t tsmach_eax3;
uint32_t tsmach_ecx;
void tsetupspritevline(uint8_t * palette, int32_t i2, int32_t i3, int32_t i4, int32_t i5)
{
- tspal = palette;
- tsmach_eax1 = i5 << 16;
- adder = (i5 >> 16) + i2;
- tsmach_eax3 = adder + i4;
- tsmach_ecx = i3;
+ tspal = palette;
+ tsmach_eax1 = i5 << 16;
+ adder = (i5 >> 16) + i2;
+ tsmach_eax3 = adder + i4;
+ tsmach_ecx = i3;
}
/*
- FCS: Draw a sprite vertical line of pixels.
- */
+ FCS: Draw a sprite vertical line of pixels.
+*/
void DrawSpriteVerticalLine(int32_t i2, int32_t numPixels, uint32_t i4, uint8_t * texture, uint8_t * dest)
{
uint8_t colorIndex;
- while (numPixels)
- {
- numPixels--;
+ while (numPixels)
+ {
+ numPixels--;
- if (numPixels != 0)
- {
+ if (numPixels != 0)
+ {
- i4 += tsmach_ecx;
+ i4 += tsmach_ecx;
- if (i4 < (i4 - tsmach_ecx))
+ if (i4 < (i4 - tsmach_ecx))
adder = tsmach_eax3;
- colorIndex = *texture;
+ colorIndex = *texture;
- i2 += tsmach_eax1;
- if (i2 < (i2 - tsmach_eax1))
+ i2 += tsmach_eax1;
+ if (i2 < (i2 - tsmach_eax1))
texture++;
- texture += adder;
+ texture += adder;
//255 is the index of the transparent color: Do not draw it.
- if (colorIndex != 255)
- {
- uint16_t val;
- val = tspal[colorIndex];
- val |= (*dest)<<8;
+ if (colorIndex != 255)
+ {
+ uint16_t val;
+ val = tspal[colorIndex];
+ val |= (*dest)<<8;
- if (transrev)
- val = ((val>>8)|(val<<8));
+ if (transrev)
+ val = ((val>>8)|(val<<8));
- colorIndex = transluc[val];
+ colorIndex = transluc[val];
- if (pixelsAllowed-- > 0)
- *dest = colorIndex;
- }
+ if (pixelsAllowed-- > 0)
+ *dest = colorIndex;
+ }
//Move down one pixel on the framebuffer
- dest += bytesperline;
- }
+ dest += bytesperline;
+ }
- }
+ }
}
/* END--------------- SPRITE RENDERING METHOD (USED TO BE HIGHLY OPTIMIZED ASSEMBLY) ----------------------------*/
@@ -706,7 +723,7 @@ void DrawSpriteVerticalLine(int32_t i2, int32_t numPixels, uint32_t i4, uint8_t
/* --------------- FLOOR/CEILING RENDERING METHOD (USED TO BE HIGHLY OPTIMIZED ASSEMBLY) ----------------------------*/
void settrans(int32_t type){
- transrev = type;
+ transrev = type;
}
static uint8_t * textureData;
@@ -733,19 +750,19 @@ void mhlineskipmodify( uint32_t i2, int32_t numPixels, int32_t i5, uint8_t* dest
while (numPixels >= 0)
{
- ebx = i2 >> mshift_al;
- ebx = shld (ebx, (uint32_t)i5, mshift_bl);
- colorIndex = textureData[ebx];
+ ebx = i2 >> mshift_al;
+ ebx = shld (ebx, (uint32_t)i5, mshift_bl);
+ colorIndex = textureData[ebx];
//Skip transparent color.
- if ((colorIndex&0xff) != 0xff){
+ if ((colorIndex&0xff) != 0xff){
if (pixelsAllowed-- > 0)
- *dest = mmach_asm3[colorIndex];
+ *dest = mmach_asm3[colorIndex];
}
- i2 += mmach_asm1;
- i5 += mmach_asm2;
- dest++;
- numPixels--;
+ i2 += mmach_asm1;
+ i5 += mmach_asm2;
+ dest++;
+ numPixels--;
}
@@ -782,25 +799,25 @@ void thlineskipmodify(int32_t i1, uint32_t i2, uint32_t i3, int32_t i4, int32_t
int counter = (i3>>16);
while (counter >= 0)
{
- ebx = i2 >> tshift_al;
- ebx = shld (ebx, (uint32_t)i5, tshift_bl);
- i1 = tmach_eax[ebx];
- if ((i1&0xff) != 0xff)
- {
- uint16_t val = tmach_asm3[i1];
- val |= (*i6)<<8;
+ ebx = i2 >> tshift_al;
+ ebx = shld (ebx, (uint32_t)i5, tshift_bl);
+ i1 = tmach_eax[ebx];
+ if ((i1&0xff) != 0xff)
+ {
+ uint16_t val = tmach_asm3[i1];
+ val |= (*i6)<<8;
- if (transrev)
- val = ((val>>8)|(val<<8));
+ if (transrev)
+ val = ((val>>8)|(val<<8));
- if (pixelsAllowed-- > 0)
- *i6 = transluc[val];
- }
+ if (pixelsAllowed-- > 0)
+ *i6 = transluc[val];
+ }
- i2 += tmach_asm1;
- i5 += tmach_asm2;
- i6++;
- counter--;
+ i2 += tmach_asm1;
+ i5 += tmach_asm2;
+ i6++;
+ counter--;
}
@@ -855,60 +872,60 @@ void slopevlin(intptr_t i1, uint32_t i2, int32_t i3, int32_t i4, int32_t i5, int
edi = i6 + low32((__int64)globaly3 * (__int64)(i2<<3));
ebx = i4;
- if (!RENDER_SLOPPED_CEILING_AND_FLOOR)
- return;
+ if (!RENDER_SLOPPED_CEILING_AND_FLOOR)
+ return;
do {
- // -------------
- // All this is calculating a fixed point approx. of 1/a
- c.f = a;
- fpuasm = eax = c.i;
- edx = (((int32_t)eax) < 0) ? 0xffffffff : 0;
- eax = eax << 1;
- ecx = (eax>>24); // exponent
- eax = ((eax&0xffe000)>>11);
- ecx = ((ecx&0xffffff00)|((ecx-2)&0xff));
- eax = reciptable[eax/4];
- eax >>= (ecx&0x1f);
- eax ^= edx;
- // -------------
- edx = i2;
- i2 = eax;
- eax -= edx;
- ecx = low32((__int64)globalx3 * (__int64)eax);
- eax = low32((__int64)globaly3 * (__int64)eax);
- a += asm2_f;
-
- asm4 = ebx;
- ecx = ((ecx&0xffffff00)|(ebx&0xff));
- if (ebx >= 8) ecx = ((ecx&0xffffff00)|8);
-
+ // -------------
+ // All this is calculating a fixed point approx. of 1/a
+ c.f = a;
+ fpuasm = eax = c.i;
+ edx = (((int32_t)eax) < 0) ? 0xffffffff : 0;
+ eax = eax << 1;
+ ecx = (eax>>24); // exponent
+ eax = ((eax&0xffe000)>>11);
+ ecx = ((ecx&0xffffff00)|((ecx-2)&0xff));
+ eax = reciptable[eax/4];
+ eax >>= (ecx&0x1f);
+ eax ^= edx;
+ // -------------
+ edx = i2;
+ i2 = eax;
+ eax -= edx;
+ ecx = low32((__int64)globalx3 * (__int64)eax);
+ eax = low32((__int64)globaly3 * (__int64)eax);
+ a += asm2_f;
+
+ asm4 = ebx;
+ ecx = ((ecx&0xffffff00)|(ebx&0xff));
+ if (ebx >= 8) ecx = ((ecx&0xffffff00)|8);
+
+ ebx = esi;
+ edx = edi;
+ while ((ecx&0xff))
+ {
+ ebx >>= slopemach_ah2;
+ esi += ecx;
+ edx >>= slopemach_ah1;
+ ebx &= slopemach_edx;
+ edi += eax;
+ i1 += slopemach_ecx;
+ edx = ((edx&0xffffff00)|((((uint8_t *)(ebx+edx))[slopemach_ebx])));
+ ebx = *((uint32_t*)i3); // register trickery
+ i3 -= 4;
+ eax = ((eax&0xffffff00)|(*((uint8_t *)(ebx+edx))));
ebx = esi;
- edx = edi;
- while ((ecx&0xff))
- {
- ebx >>= slopemach_ah2;
- esi += ecx;
- edx >>= slopemach_ah1;
- ebx &= slopemach_edx;
- edi += eax;
- i1 += slopemach_ecx;
- edx = ((edx&0xffffff00)|((((uint8_t *)(ebx+edx))[slopemach_ebx])));
- ebx = *((uint32_t*)i3); // register trickery
- i3 -= 4;
- eax = ((eax&0xffffff00)|(*((uint8_t *)(ebx+edx))));
- ebx = esi;
- if (pixelsAllowed-- > 0)
- *((uint8_t *)i1) = (eax&0xff);
+ if (pixelsAllowed-- > 0)
+ *((uint8_t *)i1) = (eax&0xff);
- edx = edi;
- ecx = ((ecx&0xffffff00)|((ecx-1)&0xff));
+ edx = edi;
+ ecx = ((ecx&0xffffff00)|((ecx-1)&0xff));
- }
- ebx = asm4;
- ebx -= 8; // BITSOFPRECISIONPOW
+ }
+ ebx = asm4;
+ ebx -= 8; // BITSOFPRECISIONPOW
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/game.c b/apps/plugins/sdl/progs/duke3d/Game/src/game.c
index 0cb1d95..a7d8c55 100644
--- a/apps/plugins/sdl/progs/duke3d/Game/src/game.c
+++ b/apps/plugins/sdl/progs/duke3d/Game/src/game.c
@@ -2227,9 +2227,18 @@ void duke_tics(short offx, short offy, short color)
else
savedFps = fpsAvg;
- extern int rbaud_underruns, fp_calls[4];
- sprintf(fps," %d %d %d %d %d %d", savedFps, rbaud_underruns, fp_calls[0],
- fp_calls[1], fp_calls[2], fp_calls[3]);
+ extern int rbaud_underruns, fp_calls[4], drawcalls[10];
+ sprintf(fps," %d %d %d %d %d %d %d %d %d %d %d", savedFps,
+ drawcalls[0],
+ drawcalls[1],
+ drawcalls[2],
+ drawcalls[3],
+ drawcalls[4],
+ drawcalls[5],
+ drawcalls[6],
+ drawcalls[7],
+ drawcalls[8],
+ drawcalls[9]);
strcat(text, fps);
minitext(offx,offy,text,color,2+8+16+128);
diff --git a/apps/plugins/sdl/src/thread/rockbox/SDL_systhread.c b/apps/plugins/sdl/src/thread/rockbox/SDL_systhread.c
index 214cbe4..155d7a4 100644
--- a/apps/plugins/sdl/src/thread/rockbox/SDL_systhread.c
+++ b/apps/plugins/sdl/src/thread/rockbox/SDL_systhread.c
@@ -40,6 +40,7 @@ static void rbsdl_runthread(void)
void *args = global_args;
global_args = NULL;
SDL_RunThread(args);
+ rb->thread_exit();
}
#define MAX_THREAD 4