diff --git a/desmume/src/frontend/modules/osd/agg/aggdraw.h b/desmume/src/frontend/modules/osd/agg/aggdraw.h index 891037354..16d4c91c9 100644 --- a/desmume/src/frontend/modules/osd/agg/aggdraw.h +++ b/desmume/src/frontend/modules/osd/agg/aggdraw.h @@ -1,7 +1,7 @@ /* The MIT License -Copyright (C) 2009-2010 DeSmuME team +Copyright (C) 2009-2017 DeSmuME team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -219,7 +219,12 @@ namespace agg typedef PixFormatSetDeclaration > T_AGG_PF_RGB555; +#if defined(WIN32) +typedef PixFormatSetDeclaration > T_AGG_PF_RGBA; +#else typedef PixFormatSetDeclaration > T_AGG_PF_RGBA; +#endif + class AggDrawTarget { public: diff --git a/desmume/src/frontend/windows/main.cpp b/desmume/src/frontend/windows/main.cpp index 346c943f9..e8e8acb00 100644 --- a/desmume/src/frontend/windows/main.cpp +++ b/desmume/src/frontend/windows/main.cpp @@ -1627,7 +1627,7 @@ static void OGL_DoDisplay() glGenTextures(1,&tex); glBindTexture(GL_TEXTURE_2D,tex); - glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA, video.width,video.height,0,GL_BGRA,GL_UNSIGNED_BYTE,video.finalBuffer()); + glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA, video.width,video.height,0,GL_RGBA,GL_UNSIGNED_BYTE,video.finalBuffer()); //the ds screen fills the texture entirely, so we dont have garbage at edge to worry about, //but we need to make sure this is clamped for when filtering is selected @@ -1789,6 +1789,12 @@ static void DD_DoDisplay() if (!ddraw.lock()) return; char* buffer = (char*)ddraw.surfDescBack.lpSurface; + //yuck, is it safe to edit this? we may need another temp buffer + //it seems to work OK... + //we have to do this because we couldn't ask the GPU for a swapped color format (it only uses the one 888 format internally) + //in openGL we can fix it at the last minute, but in DD we can't. + ColorspaceConvertBuffer888XTo8888Opaque((u32*)video.finalBuffer(),(u32*)video.finalBuffer(),video.size()); + if(ddraw.surfDescBack.dwWidth != video.rotatedwidth() || ddraw.surfDescBack.dwHeight != video.rotatedheight()) { ddraw.createBackSurface(video.rotatedwidth(),video.rotatedheight()); @@ -1912,7 +1918,7 @@ struct DisplayBuffer , size(0) { } - u16* buffer; + u32* buffer; int size; //[256*192*4]; } displayBuffers[3]; @@ -1952,10 +1958,8 @@ static void DoDisplay(bool firstTime) return; displayNoPostponeNext = false; - //convert pixel format to 32bpp for compositing - //why do we do this over and over? well, we are compositing to - //filteredbuffer32bpp, and it needs to get refreshed each frame. - ColorspaceConvertBuffer555To8888Opaque((u16 *)video.srcBuffer, video.buffer, video.srcBufferSize / sizeof(u16)); + //we have to do a copy here because we're about to draw the OSD onto it. bummer. + memcpy(video.buffer, video.srcBuffer, video.srcBufferSize); if(firstTime) { @@ -2059,7 +2063,7 @@ void Display() if(CommonSettings.single_core()) { video.srcBuffer = (u8*)dispInfo.masterCustomBuffer; - video.srcBufferSize = dispInfo.customWidth*dispInfo.customHeight*2*2; + video.srcBufferSize = dispInfo.customWidth*dispInfo.customHeight*2*4; DoDisplay(true); } else @@ -2077,11 +2081,11 @@ void Display() else newestDisplayBuffer = (currDisplayBuffer+2)%3; DisplayBuffer& db = displayBuffers[newestDisplayBuffer]; - int targetSize = 256*192*4*video.prescaleHD*video.prescaleHD; + int targetSize = 256*192*2*4*video.prescaleHD*video.prescaleHD; if(db.size != targetSize) { free_aligned(db.buffer); - db.buffer = (u16*)malloc_alignedCacheLine(targetSize); + db.buffer = (u32*)malloc_alignedCacheLine(targetSize); db.size = targetSize; } memcpy(db.buffer,dispInfo.masterCustomBuffer,targetSize); @@ -3234,7 +3238,7 @@ int _main() video.SetPrescale(CommonSettings.GFX3D_PrescaleHD, 1); GPU->SetCustomFramebufferSize(256*video.prescaleHD,192*video.prescaleHD); - //GPU->SetWillAutoBlitNativeToCustomBuffer(false); //we need to do this right now, because we depend on having one solitary framebuffer + GPU->SetColorFormat(NDSColorFormat_BGR888_Rev); GPU->ClearWithColor(0xFFFF); SetMinWindowSize();