MCPcopy Create free account
hub / github.com/TASEmulators/fceux / PPUViewCallB

Function PPUViewCallB

src/drivers/win/ppuview.cpp:367–616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365}
366
367INT_PTR CALLBACK PPUViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
368{
369 RECT wrect;
370 char str[20];
371
372 switch(uMsg)
373 {
374 case WM_INITDIALOG:
375 {
376 if (PPUViewPosX==-32000) PPUViewPosX=0; //Just in case
377 if (PPUViewPosY==-32000) PPUViewPosY=0;
378 SetWindowPos(hwndDlg,0,PPUViewPosX,PPUViewPosY,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER);
379
380 CalculateBitmapPositions(hwndDlg);
381
382 //prepare the bitmap attributes
383 //pattern tables
384 memset(&bmInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER));
385 bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
386 bmInfo.bmiHeader.biWidth = PATTERNWIDTH;
387 bmInfo.bmiHeader.biHeight = PATTERNHEIGHT;
388 bmInfo.bmiHeader.biPlanes = 1;
389 bmInfo.bmiHeader.biBitCount = 24;
390
391 //palettes
392 memset(&bmInfo2.bmiHeader,0,sizeof(BITMAPINFOHEADER));
393 bmInfo2.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
394 bmInfo2.bmiHeader.biWidth = PALETTEWIDTH;
395 bmInfo2.bmiHeader.biHeight = PALETTEHEIGHT;
396 bmInfo2.bmiHeader.biPlanes = 1;
397 bmInfo2.bmiHeader.biBitCount = 24;
398
399 //create memory dcs
400 pDC = GetDC(hwndDlg); // GetDC(GetDlgItem(hwndDlg,GRP_PPUVIEW_TABLES));
401 TmpDC0 = CreateCompatibleDC(pDC); //pattern table 0
402 TmpDC1 = CreateCompatibleDC(pDC); //pattern table 1
403 TmpDC2 = CreateCompatibleDC(pDC); //palettes
404
405 //create bitmaps and select them into the memory dc's
406 TmpBmp0 = CreateDIBSection(pDC,&bmInfo,DIB_RGB_COLORS,(void**)&pattern0,0,0);
407 TmpObj0 = SelectObject(TmpDC0,TmpBmp0);
408 TmpBmp1 = CreateDIBSection(pDC,&bmInfo,DIB_RGB_COLORS,(void**)&pattern1,0,0);
409 TmpObj1 = SelectObject(TmpDC1,TmpBmp1);
410 TmpBmp2 = CreateDIBSection(pDC,&bmInfo2,DIB_RGB_COLORS,(void**)&ppuv_palette,0,0);
411 TmpObj2 = SelectObject(TmpDC2,TmpBmp2);
412
413 //Refresh Trackbar
414 SendDlgItemMessage(hwndDlg,CTL_PPUVIEW_TRACKBAR,TBM_SETRANGE,0,(LPARAM)MAKELONG(0,25));
415 SendDlgItemMessage(hwndDlg,CTL_PPUVIEW_TRACKBAR,TBM_SETPOS,1,PPUViewRefresh);
416
417 CheckDlgButton(hwndDlg, IDC_MASK_UNUSED_GRAPHICS, PPUView_maskUnusedGraphics ? BST_CHECKED : BST_UNCHECKED);
418 CheckDlgButton(hwndDlg, IDC_INVERT_THE_MASK, PPUView_invertTheMask ? BST_CHECKED : BST_UNCHECKED);
419
420 CheckDlgButton(hwndDlg, IDC_SPRITE16_MODE, PPUView_sprite16Mode ? BST_CHECKED : BST_UNCHECKED);
421
422 EnableWindow(GetDlgItem(hwndDlg, IDC_INVERT_THE_MASK), PPUView_maskUnusedGraphics ? true : false);
423
424 //Set Text Limit

Callers

nothing calls this directly

Calls 6

PPUViewDoBlitFunction · 0.85
KillPPUViewFunction · 0.85
GetDlgItemTextFunction · 0.85
CalculateBitmapPositionsFunction · 0.70
FCEUD_UpdatePPUViewFunction · 0.70

Tested by

no test coverage detected