Merge pull request #3825 from Ced2911/dx9windows

Dx9windows
This commit is contained in:
Henrik Rydgård 2013-09-18 07:30:10 -07:00
commit f3d7bc24f4
2 changed files with 18 additions and 12 deletions

View file

@ -736,7 +736,14 @@ static void decodeDXT5Block(u32 *dst, const DXT5Block *src, int pitch) {
}
static inline u32 ABGR2RGBA(u32 src) {
#ifndef _XBOX
return ((src & 0xFF000000)) |
((src & 0x00FF0000) >> 16) |
((src & 0x0000FF00)) |
((src & 0x000000FF) << 16);
#else
return (src >> 8) | (src << 24);
#endif
}
static void ClutConvertColors(void *dstBuf, const void *srcBuf, u32 dstFmt, int numPixels) {
@ -777,7 +784,7 @@ static void ClutConvertColors(void *dstBuf, const void *srcBuf, u32 dstFmt, int
{
const u32 *src = (const u32 *)srcBuf;
u32 *dst = (u32*)dstBuf;
for (int i = 0; i < numPixels; i++) {
for (int i = 0; i < numPixels; i++) {
dst[i] = ABGR2RGBA(src[i]);
}
}
@ -1592,13 +1599,6 @@ static inline void copyTexture(int xoffset, int yoffset, int w, int h, int pitch
for(int y = 0; y < h; y++) {
const u16 *src = (const u16 *)((u8*)pSrc + (w*2) * y);
u16 *dst = (u16*)((u8*)pDst + pitch * y);
/*
// todo use memcpy
for(int x = 0; x < w; x++) {
unsigned short rgb = src[x];
dst[x] = rgb;
}
*/
memcpy(dst, src, w * sizeof(u16));
}
break;

View file

@ -49,8 +49,11 @@ HWND DxCreateWindow()
};
RegisterClassEx(&wndClass);
RECT wr = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT}; // set the size, but not the position
AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE); // adjust the size
DWORD style = WS_OVERLAPPEDWINDOW | WS_VISIBLE;
return CreateWindowEx(0, _T("PPSSPPHeadless"), _T("PPSSPPHeadless"), style, CW_USEDEFAULT, CW_USEDEFAULT, WINDOW_WIDTH, WINDOW_HEIGHT, NULL, NULL, NULL, NULL);
return CreateWindowEx(0, _T("PPSSPPHeadless"), _T("PPSSPPHeadless"), style, CW_USEDEFAULT, CW_USEDEFAULT, wr.right - wr.left, wr.bottom - wr.top, NULL, NULL, NULL, NULL);
}
void WindowsHeadlessHostDx9::LoadNativeAssets()
@ -112,9 +115,12 @@ bool WindowsHeadlessHostDx9::ResizeGL()
}
void WindowsHeadlessHostDx9::SwapBuffers()
{
ShowWindow(hWnd, TRUE);
SetFocus(hWnd);
{
MSG msg;
PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
TranslateMessage(&msg);
DispatchMessage(&msg);
DX9::pD3Ddevice->EndScene();
DX9::pD3Ddevice->Present(0, 0, 0, 0);
DX9::pD3Ddevice->BeginScene();