diff --git a/desmume/src/NDSSystem.c b/desmume/src/NDSSystem.c index db905f9b1..c617ec29c 100644 --- a/desmume/src/NDSSystem.c +++ b/desmume/src/NDSSystem.c @@ -181,6 +181,7 @@ void NDS_DeInit(void) { SPU_DeInit(); Screen_DeInit(); MMU_DeInit(); + NDS_3D_Close(); } BOOL NDS_SetROM(u8 * rom, u32 mask) @@ -533,6 +534,7 @@ void NDS_Reset( void) GPU_Reset(MainScreen.gpu, 0); GPU_Reset(SubScreen.gpu, 1); + NDS_3D_Reset(); SPU_Reset(); execute = oldexecute; @@ -586,40 +588,6 @@ typedef struct } bmpfileheader_struct; #endif -int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char *filename) -{ - bmpfileheader_struct fileheader; - bmpimgheader_struct imageheader; - FILE *file; - int i,j,k; - u16 * bmp = (u16 *)GPU_screen; - - memset(&fileheader, 0, sizeof(fileheader)); - fileheader.size = sizeof(fileheader); - fileheader.id = 'B' | ('M' << 8); - fileheader.imgoffset = sizeof(fileheader)+sizeof(imageheader); - - memset(&imageheader, 0, sizeof(imageheader)); - imageheader.size = sizeof(imageheader); - imageheader.width = width; - imageheader.height = height; - imageheader.planes = 1; - imageheader.bpp = 32; - imageheader.cmptype = 0; // None - imageheader.imgsize = imageheader.width * imageheader.height * 4; - - if ((file = fopen(filename,"wb")) == NULL) - return 0; - - fwrite(&fileheader, 1, sizeof(fileheader), file); - fwrite(&imageheader, 1, sizeof(imageheader), file); - - fwrite(buf,1,imageheader.imgsize,file); - fclose(file); - - return 1; -} - int NDS_WriteBMP(const char *filename) { bmpfileheader_struct fileheader; diff --git a/desmume/src/windows/OGLRender.c b/desmume/src/windows/OGLRender.c index 9b42fb959..26c77eb2e 100644 --- a/desmume/src/windows/OGLRender.c +++ b/desmume/src/windows/OGLRender.c @@ -280,8 +280,6 @@ char NDS_glInit(void) MatrixInit (mtxCurrent[3]); MatrixInit (mtxTemporal); - NDS_3D_Reset(); - return 1; } @@ -1287,7 +1285,12 @@ __forceinline void NDS_glPolygonAttrib (unsigned long val) // Alpha value, actually not well handled, 0 should be wireframe colorAlpha = ((val>>16)&0x1F)<<26; - //printlog("PolygonID=%i;\n",val>>24); + + //zero - this is sort of a crazy idea but we need to cover the whole range of alpha values + //colorAlpha = ((val>>16)&0x1F)<<26; + //colorAlpha |= (((unsigned int)colorAlpha)>>5); + //colorAlpha |= (((unsigned int)colorAlpha)>>10); + //colorAlpha |= (((unsigned int)colorAlpha)>>20); // polyID polyID = (val>>24)&0x1F;