From 86cdf283231fd4485c4731f6cbbe08e5cb4ae731 Mon Sep 17 00:00:00 2001 From: StapleButter Date: Mon, 6 Feb 2017 00:07:22 +0100 Subject: [PATCH] change how redrawing is done. fixes memory leak and other fun shit. calling GetDC() over and over again isn't a good idea. --- main.cpp | 14 ++++++++++---- melonDS.depend | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index 31716bc8..909ac657 100644 --- a/main.cpp +++ b/main.cpp @@ -141,11 +141,16 @@ LRESULT CALLBACK derpo(HWND window, UINT msg, WPARAM wparam, LPARAM lparam) } return 0; - /*case WM_PAINT: + case WM_PAINT: { + PAINTSTRUCT partisocialiste; + HDC dc = BeginPaint(window, &partisocialiste); + SetDIBitsToDevice(dc, 0, 0, 256, 384, 0, 0, 0, 384, GPU::Framebuffer, (BITMAPINFO*)&bmp, DIB_RGB_COLORS); + + EndPaint(window, &partisocialiste); } - return 0;*/ + return 0; } return DefWindowProc(window, msg, wparam, lparam); @@ -230,8 +235,9 @@ int main() NDS::RunFrame(); - HDC dc = GetDC(melon); - SetDIBitsToDevice(dc, 0, 0, 256, 384, 0, 0, 0, 384, GPU::Framebuffer, (BITMAPINFO*)&bmp, DIB_RGB_COLORS); + //HDC dc = GetDC(melon); + //SetDIBitsToDevice(dc, 0, 0, 256, 384, 0, 0, 0, 384, GPU::Framebuffer, (BITMAPINFO*)&bmp, DIB_RGB_COLORS); + InvalidateRect(melon, NULL, false); UpdateWindow(melon); nframes++; diff --git a/melonDS.depend b/melonDS.depend index e9b21c4e..c6090ecd 100644 --- a/melonDS.depend +++ b/melonDS.depend @@ -10,7 +10,7 @@ 1481161027 c:\documents\sources\melonds\types.h -1486312246 source:c:\documents\sources\melonds\nds.cpp +1486333824 source:c:\documents\sources\melonds\nds.cpp "NDS.h"