winport: use 666 color

This commit is contained in:
zeromus 2017-04-26 15:00:47 -05:00
parent 06f0bb492b
commit a0d42e1536
2 changed files with 20 additions and 11 deletions

View File

@ -1,7 +1,7 @@
/* /*
The MIT License 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 Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@ -219,7 +219,12 @@ namespace agg
typedef PixFormatSetDeclaration<agg::my_pixfmt_rgb555,agg::my_pixfmt_rgb555_pre,agg::span_simple_blur_rgb24<agg::order_rgba> > T_AGG_PF_RGB555; typedef PixFormatSetDeclaration<agg::my_pixfmt_rgb555,agg::my_pixfmt_rgb555_pre,agg::span_simple_blur_rgb24<agg::order_rgba> > T_AGG_PF_RGB555;
#if defined(WIN32)
typedef PixFormatSetDeclaration<agg::pixfmt_rgba32,agg::pixfmt_rgba32_pre,agg::span_simple_blur_rgb24<agg::order_bgra> > T_AGG_PF_RGBA;
#else
typedef PixFormatSetDeclaration<agg::pixfmt_bgra32,agg::pixfmt_bgra32_pre,agg::span_simple_blur_rgb24<agg::order_rgba> > T_AGG_PF_RGBA; typedef PixFormatSetDeclaration<agg::pixfmt_bgra32,agg::pixfmt_bgra32_pre,agg::span_simple_blur_rgb24<agg::order_rgba> > T_AGG_PF_RGBA;
#endif
class AggDrawTarget class AggDrawTarget
{ {
public: public:

View File

@ -1627,7 +1627,7 @@ static void OGL_DoDisplay()
glGenTextures(1,&tex); glGenTextures(1,&tex);
glBindTexture(GL_TEXTURE_2D,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, //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 //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; if (!ddraw.lock()) return;
char* buffer = (char*)ddraw.surfDescBack.lpSurface; 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<true, false>((u32*)video.finalBuffer(),(u32*)video.finalBuffer(),video.size());
if(ddraw.surfDescBack.dwWidth != video.rotatedwidth() || ddraw.surfDescBack.dwHeight != video.rotatedheight()) if(ddraw.surfDescBack.dwWidth != video.rotatedwidth() || ddraw.surfDescBack.dwHeight != video.rotatedheight())
{ {
ddraw.createBackSurface(video.rotatedwidth(),video.rotatedheight()); ddraw.createBackSurface(video.rotatedwidth(),video.rotatedheight());
@ -1912,7 +1918,7 @@ struct DisplayBuffer
, size(0) , size(0)
{ {
} }
u16* buffer; u32* buffer;
int size; //[256*192*4]; int size; //[256*192*4];
} displayBuffers[3]; } displayBuffers[3];
@ -1952,10 +1958,8 @@ static void DoDisplay(bool firstTime)
return; return;
displayNoPostponeNext = false; displayNoPostponeNext = false;
//convert pixel format to 32bpp for compositing //we have to do a copy here because we're about to draw the OSD onto it. bummer.
//why do we do this over and over? well, we are compositing to memcpy(video.buffer, video.srcBuffer, video.srcBufferSize);
//filteredbuffer32bpp, and it needs to get refreshed each frame.
ColorspaceConvertBuffer555To8888Opaque<true, false>((u16 *)video.srcBuffer, video.buffer, video.srcBufferSize / sizeof(u16));
if(firstTime) if(firstTime)
{ {
@ -2059,7 +2063,7 @@ void Display()
if(CommonSettings.single_core()) if(CommonSettings.single_core())
{ {
video.srcBuffer = (u8*)dispInfo.masterCustomBuffer; video.srcBuffer = (u8*)dispInfo.masterCustomBuffer;
video.srcBufferSize = dispInfo.customWidth*dispInfo.customHeight*2*2; video.srcBufferSize = dispInfo.customWidth*dispInfo.customHeight*2*4;
DoDisplay(true); DoDisplay(true);
} }
else else
@ -2077,11 +2081,11 @@ void Display()
else newestDisplayBuffer = (currDisplayBuffer+2)%3; else newestDisplayBuffer = (currDisplayBuffer+2)%3;
DisplayBuffer& db = displayBuffers[newestDisplayBuffer]; 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) if(db.size != targetSize)
{ {
free_aligned(db.buffer); free_aligned(db.buffer);
db.buffer = (u16*)malloc_alignedCacheLine(targetSize); db.buffer = (u32*)malloc_alignedCacheLine(targetSize);
db.size = targetSize; db.size = targetSize;
} }
memcpy(db.buffer,dispInfo.masterCustomBuffer,targetSize); memcpy(db.buffer,dispInfo.masterCustomBuffer,targetSize);
@ -3234,7 +3238,7 @@ int _main()
video.SetPrescale(CommonSettings.GFX3D_PrescaleHD, 1); video.SetPrescale(CommonSettings.GFX3D_PrescaleHD, 1);
GPU->SetCustomFramebufferSize(256*video.prescaleHD,192*video.prescaleHD); 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); GPU->ClearWithColor(0xFFFF);
SetMinWindowSize(); SetMinWindowSize();