more bugfixes and a very useful workaround for windows OGLRender.c

This commit is contained in:
zeromus 2008-08-26 02:35:58 +00:00
parent af89dc727f
commit 1210a9008e
2 changed files with 462 additions and 513 deletions

View File

@ -181,7 +181,6 @@ void NDS_DeInit(void) {
SPU_DeInit();
Screen_DeInit();
MMU_DeInit();
NDS_3D_Close();
}
BOOL NDS_SetROM(u8 * rom, u32 mask)
@ -534,7 +533,6 @@ void NDS_Reset( void)
GPU_Reset(MainScreen.gpu, 0);
GPU_Reset(SubScreen.gpu, 1);
NDS_3D_Reset();
SPU_Reset();
execute = oldexecute;
@ -588,6 +586,40 @@ 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;

File diff suppressed because it is too large Load Diff