diff --git a/ReadMe.txt b/ReadMe.txt index 2330315..2390e90 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -54,7 +54,7 @@ NOT WORKING YET CHANGES -Version 1.7 (2019-11-27) +Version 1.7 (2019-11-29) - Updated source code from Eric Rechlin's Emu48 version 1.61+ that was merged from Christoph Gießelink's Emu48 version 1.62. - Allow to take a screenshot of the fullscreen including the skin. diff --git a/app/src/main/assets/ReadMe.txt b/app/src/main/assets/ReadMe.txt index 9fb3bcd..8a6dbb8 100644 --- a/app/src/main/assets/ReadMe.txt +++ b/app/src/main/assets/ReadMe.txt @@ -54,7 +54,7 @@ NOT WORKING YET CHANGES -Version 1.7 (2019-11-27) +Version 1.7 (2019-11-29) - Updated source code from Eric Rechlin's Emu48 version 1.61+ that was merged from Christoph Gießelink's Emu48 version 1.62. - Allow to take a screenshot of the fullscreen including the skin. diff --git a/app/src/main/cpp/win32-layer.c b/app/src/main/cpp/win32-layer.c index 1ebf309..0a6f1b6 100644 --- a/app/src/main/cpp/win32-layer.c +++ b/app/src/main/cpp/win32-layer.c @@ -1683,7 +1683,8 @@ int GetObject(HGDIOBJ h, int c, LPVOID pv) { } return 0; } HGDIOBJ GetCurrentObject(HDC hdc, UINT type) { - //TODO + if(hdc) + return hdc->selectedBitmap; return NULL; } BOOL DeleteObject(HGDIOBJ ho) { @@ -1768,9 +1769,13 @@ HDC CreateCompatibleDC(HDC hdc) { return handle; } HDC GetDC(HWND hWnd) { + if(!hWnd) + return NULL; return hWnd->windowDC; } int ReleaseDC(HWND hWnd, HDC hDC) { + if(!hWnd) + return NULL; hWnd->windowDC = NULL; //? return TRUE; } @@ -2291,7 +2296,23 @@ HBITMAP CreateCompatibleBitmap( HDC hdc, int cx, int cy) { return newHBITMAP; } int GetDIBits(HDC hdc, HBITMAP hbm, UINT start, UINT cLines, LPVOID lpvBits, LPBITMAPINFO lpbmi, UINT usage) { - //TODO + //TODO Not sure at all for this function + if(hbm && lpbmi) { + CONST BITMAPINFO *pbmi = hbm->bitmapInfo; + if(!lpvBits) { + size_t bitmapInfoSize = sizeof(BITMAPINFOHEADER); + memcpy(lpbmi, pbmi, bitmapInfoSize); + } else { + // We consider the source and destination dib with the same format + size_t stride = (size_t)(4 * ((pbmi->bmiHeader.biWidth * pbmi->bmiHeader.biBitCount + 31) / 32)); + VOID * sourceDibBits = (VOID *)hbm->bitmapBits; + VOID * destinationDibBits = lpvBits; + for(int y = 0; y < cLines; y++) { + size_t lineSize = (start + y) * stride; + memcpy(destinationDibBits + lineSize, sourceDibBits + lineSize, stride); + } + } + } return 0; } COLORREF GetPixel(HDC hdc, int x ,int y) {