static void OnPaint(HWND hwnd) { if(!nVidFullscreen) { // This was formerly an alternative for the fail in using the "Preview blitter" // option in Win9x plattaforms, now, this is used just to complement the option // if you don't like the preview enabled. if (!bDrvOkay) { PAINTSTRUCT ps; //hbitmap = (HBITMAP)LoadImage(hAppInst, _T("BMP_SPLASH"), IMAGE_BITMAP, 304, 224, 0); hbitmap = (HBITMAP)LoadImage(hAppInst, MAKEINTRESOURCE(BMP_SPLASH), IMAGE_BITMAP, 304, 224, 0); HDC hDC = BeginPaint(hwnd, &ps); StretchBmForClient(hDC, hwnd, hbitmap); return; } PAINTSTRUCT ps; HDC hdc = NULL; hdc = BeginPaint (hwnd, &ps); EndPaint (hwnd, &ps); VidPaint(1); } }
// With or without sound, run one frame. // If bDraw is true, it's the last frame before we are up to date, and so we should draw the screen static int RunFrame(int bDraw, int bPause) { static int bPrevPause = 0; static int bPrevDraw = 0; if (bPrevDraw && !bPause) { VidPaint(0); // paint the screen (no need to validate) } if (!bDrvOkay) { return 1; } if (bPause) { GetInput(false); // Update burner inputs, but not game inputs if (bPause != bPrevPause) { VidPaint(2); // Redraw the screen (to ensure mode indicators are updated) } } else { nFramesEmulated++; nCurrentFrame++; GetInput(true); // Update inputs } if (bDraw) { nFramesRendered++; if (VidFrame()) { // Do one frame AudBlankSound(); } } else { // frame skipping pBurnDraw = NULL; // Make sure no image is drawn BurnDrvFrame(); } bPrevPause = bPause; bPrevDraw = bDraw; return 0; }
static void onPaint(HWND hWnd) { if (hWnd == hScrnWnd) { // paint and validate client area VidPaint(1); // paint skin picture if (!bDrvOkay && !bVidUsePlaceholder) { paintSkin(hWnd); } } }
// With or without sound, run one frame. // If bDraw is true, it's the last frame before we are up to date, and so we should draw the screen static int RunFrame(int bDraw,int bPause) { static int bOldStretch=0; nCurrentFrame++; if (bDraw) { if (bOldStretch && bDtoStretch==0) // image may have shrunk { InvalidateRect(hScrnWnd,NULL,1); // blank scrn window UpdateWindow(hScrnWnd); } } bOldStretch=bDtoStretch; GetInput(); // Get input on all frames InputTick(); // Tick one frame of input (for sliders etc) if (!bPause) { if (bDraw) { VidFrame(); // Do one frame VidPaint(0); // paint the screen (no need to validate) } else { // frame skipping pBurnDraw=NULL; // Make sure no image is drawn if (bDrvOkay) { BurnDrvFrame(); } } } return 0; }
// With or without sound, run one frame. // If bDraw is true, it's the last frame before we are up to date, and so we should draw the screen static int RunFrame(int bDraw, int bPause) { static int bPrevPause = 0; static int bPrevDraw = 0; extern bool bDoPostInitialize; // Exit Jukebox properly if(bDoPostInitialize == true && bJukeboxInUse == true) { DrvExit(); bJukeboxDisplayed = false; bJukeboxInUse = false; bDoPostInitialize = false; POST_INITIALISE_MESSAGE; } if (bPrevDraw && !bPause) { VidPaint(0); // paint the screen (no need to validate) } if (!bDrvOkay) { return 1; } if (bPause && bJukeboxInUse == true) { GetInput(false); // Update burner inputs, but not game inputs if (bPause != bPrevPause) { VidPaint(2); // Redraw the screen (to ensure mode indicators are updated) } return 0; } if (!bPause && bJukeboxInUse == true) { //if (!bJukeboxDisplayed) JukeboxDialogCreate(); int TracklistDialog(); if (bJukeboxDisplayed == false) TracklistDialog(); nFramesEmulated++; nCurrentFrame++; BurnJukeboxFrame(); return 0; } if (bPause) { GetInput(false); // Update burner inputs, but not game inputs if (bPause != bPrevPause) { VidPaint(2); // Redraw the screen (to ensure mode indicators are updated) } } else { nFramesEmulated++; nCurrentFrame++; if (kNetGame) { GetInput(true); // Update inputs if (KailleraGetInput()) { // Synchronize input with Kaillera return 0; } } else { if (nReplayStatus == 2) { GetInput(false); // Update burner inputs, but not game inputs if (ReplayInput()) { // Read input from file bAltPause = 1; bRunPause = 1; MenuEnableItems(); InputSetCooperativeLevel(false, false); } } else { GetInput(true); // Update inputs } } if (nReplayStatus == 1) { RecordInput(); // Write input to file } if (bDraw) { nFramesRendered++; if (VidFrame()) { // Do one frame AudBlankSound(); } } else { // frame skipping pBurnDraw = NULL; // Make sure no image is drawn BurnDrvFrame(); } if (bShowFPS) { if (nDoFPS < nFramesRendered) { DisplayFPS(); nDoFPS = nFramesRendered + 30; } } } bPrevPause = bPause; bPrevDraw = bDraw; return 0; }
// define this function somewhere above RunMessageLoop() void ToggleLayer(unsigned char thisLayer) { nBurnLayer ^= thisLayer; // xor with thisLayer VidRedraw(); VidPaint(0); }
static INT_PTR CALLBACK SShotDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam) { (void)lParam; (void)wParam; (void)hDlg; if (Msg == WM_INITDIALOG) { hSFactdlg = hDlg; SFactdInit(); SetFocus(hDlg); // Enable Esc=close return 0; } if (Msg == WM_CLOSE) { DestroyWindow(hSFactdlg); dialogDelete(IDD_CAPTURE); return 0; } if (Msg == WM_DESTROY) { SFactdExit(); return 0; } if (Msg == WM_COMMAND) { int Id = LOWORD(wParam); int Notify = HIWORD(wParam); if (Id==IDOK && Notify==BN_CLICKED) { SendMessage(hDlg,WM_CLOSE,0,0); return 0; } // cancel=close if (Id==IDC_CAPTURE && Notify==BN_CLICKED) { if (bDrvOkay) { MakeScreenShot(); SFactdUpdate(); } } if (Id==IDC_CAPTURE_PREV && Notify==BN_CLICKED) { if (bDrvOkay) { MakeScreenShot(false); SFactdUpdate(); } } if (Id==IDC_CHECK1 && Notify==BN_CLICKED) { ToggleLayer(1); SFactdUpdate(); } if (Id==IDC_CHECK2 && Notify==BN_CLICKED) { ToggleLayer(2); SFactdUpdate(); } if (Id==IDC_CHECK3 && Notify==BN_CLICKED) { ToggleLayer(4); SFactdUpdate(); } if (Id==IDC_CHECK4 && Notify==BN_CLICKED) { ToggleLayer(8); SFactdUpdate(); } if (Id==IDC_SPRITE1 && Notify==BN_CLICKED) { ToggleSprite(0x01); SFactdUpdate(); } if (Id==IDC_SPRITE2 && Notify==BN_CLICKED) { ToggleSprite(0x02); SFactdUpdate(); } if (Id==IDC_SPRITE3 && Notify==BN_CLICKED) { ToggleSprite(0x04); SFactdUpdate(); } if (Id==IDC_SPRITE4 && Notify==BN_CLICKED) { ToggleSprite(0x08); SFactdUpdate(); } if (Id==IDC_SPRITE5 && Notify==BN_CLICKED) { ToggleSprite(0x10); SFactdUpdate(); } if (Id==IDC_SPRITE6 && Notify==BN_CLICKED) { ToggleSprite(0x20); SFactdUpdate(); } if (Id==IDC_SPRITE7 && Notify==BN_CLICKED) { ToggleSprite(0x40); SFactdUpdate(); } if (Id==IDC_SPRITE8 && Notify==BN_CLICKED) { ToggleSprite(0x80); SFactdUpdate(); } if (Id==IDC_ADVANCE && Notify==BN_CLICKED) { VidFrame(); VidPaint(0); } if (bRunPause) { AudWriteSlience(); } } return 0; }
void ToggleSprite(unsigned char PriNum) { nSpriteEnable ^= PriNum; // xor with thisLayer VidRedraw(); VidPaint(0); }
// With or without sound, run one frame. // If bDraw is true, it's the last frame before we are up to date, and so we should draw the screen static int RunFrame(int bDraw, int bPause) { static int bPrevPause = 0; static int bPrevDraw = 0; if (bPrevDraw && !bPause) { VidPaint(0); // paint the screen (no need to validate) } if (!bDrvOkay) { return 1; } if (bPause) { GetInput(false); // Update burner inputs, but not game inputs if (bPause != bPrevPause) { VidPaint(2); // Redraw the screen (to ensure mode indicators are updated) } } else { nFramesEmulated++; nCurrentFrame++; if (kNetGame) { GetInput(true); // Update inputs if (KailleraGetInput()) { // Synchronize input with Kaillera return 0; } } else { if (nReplayStatus == 2) { GetInput(false); // Update burner inputs, but not game inputs if (ReplayInput()) { // Read input from file bAltPause = 1; bRunPause = 1; MenuEnableItems(); InputSetCooperativeLevel(false, false); } } else { GetInput(true); // Update inputs } } if (nReplayStatus == 1) { RecordInput(); // Write input to file } if (bDraw) { nFramesRendered++; if (VidFrame()) { // Do one frame AudBlankSound(); } } else { // frame skipping pBurnDraw = NULL; // Make sure no image is drawn BurnDrvFrame(); } if (bShowFPS) { if (nDoFPS < nFramesRendered) { DisplayFPS(); nDoFPS = nFramesRendered + 30; } } } bPrevPause = bPause; bPrevDraw = bDraw; return 0; }
static INT_PTR CALLBACK CubicProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM) // LPARAM lParam { static double dPrevB, dPrevC; switch (Msg) { case WM_INITDIALOG: { TCHAR szText[16]; dPrevB = dVidCubicB; dPrevC = dVidCubicC; nExitStatus = 0; WndInMid(hDlg, hScrnWnd); // Initialise slider SendDlgItemMessage(hDlg, IDC_SCANLINE_SLIDER, TBM_SETRANGE, (WPARAM)0, (LPARAM)MAKELONG(0, 10000)); SendDlgItemMessage(hDlg, IDC_SCANLINE_SLIDER, TBM_SETLINESIZE, (WPARAM)0, (LPARAM)100); SendDlgItemMessage(hDlg, IDC_SCANLINE_SLIDER, TBM_SETPAGESIZE, (WPARAM)0, (LPARAM)500); SendDlgItemMessage(hDlg, IDC_SCANLINE_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)3333); SendDlgItemMessage(hDlg, IDC_SCANLINE_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)5000); SendDlgItemMessage(hDlg, IDC_SCANLINE_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)7500); // Set slider to current value SendDlgItemMessage(hDlg, IDC_SCANLINE_SLIDER, TBM_SETPOS, (WPARAM)true, (LPARAM)((1.0 - dVidCubicB) * 10000)); // Set the edit control to current value _stprintf(szText, _T("%.3lf"), 1.0 - dVidCubicB); SendDlgItemMessage(hDlg, IDC_SCANLINE_EDIT, WM_SETTEXT, (WPARAM)0, (LPARAM)szText); SetWindowText(hDlg, _T("Select desired filter sharpness")); // Update the screen if (bDrvOkay) { VidPaint(2); } return TRUE; } case WM_COMMAND: { switch (HIWORD(wParam)) { case BN_CLICKED: { if (LOWORD(wParam) == IDOK) { nExitStatus = 1; SendMessage(hDlg, WM_CLOSE, 0, 0); } if (LOWORD(wParam) == IDCANCEL) { nExitStatus = -1; SendMessage(hDlg, WM_CLOSE, 0, 0); } break; } case EN_UPDATE: { if (nExitStatus == 0) { TCHAR szText[16] = _T(""); bool bPoint = 0; bool bValid = 1; if (SendDlgItemMessage(hDlg, IDC_SCANLINE_EDIT, WM_GETTEXTLENGTH, (WPARAM)0, (LPARAM)0) < 16) { SendDlgItemMessage(hDlg, IDC_SCANLINE_EDIT, WM_GETTEXT, (WPARAM)16, (LPARAM)szText); } // Scan string in the edit control for illegal characters for (int i = 0; szText[i]; i++) { if (szText[i] == _T('.')) { if (bPoint) { bValid = 0; break; } } else { if (!_istdigit(szText[i])) { bValid = 0; break; } } } if (bValid) { dVidCubicB = 1.0 - _tcstod(szText, NULL); if (dVidCubicB < 0.0) { dVidCubicB = 0.0; } else { if (dVidCubicB > 1.0) { dVidCubicB = 1.0; } } // Set slider to current value SendDlgItemMessage(hDlg, IDC_SCANLINE_SLIDER, TBM_SETPOS, (WPARAM)true, (LPARAM)((1.0 - dVidCubicB) * 10000)); // Update the screen if (bVidOkay) { VidPaint(2); } } } break; } } break; } case WM_HSCROLL: { switch (LOWORD(wParam)) { case TB_BOTTOM: case TB_ENDTRACK: case TB_LINEDOWN: case TB_LINEUP: case TB_PAGEDOWN: case TB_PAGEUP: case TB_THUMBPOSITION: case TB_THUMBTRACK: case TB_TOP: { if (nExitStatus == 0) { TCHAR szText[16]; // Update the contents of the edit control dVidCubicB = 1.0 - (double)SendDlgItemMessage(hDlg, IDC_SCANLINE_SLIDER, TBM_GETPOS, (WPARAM)0, (LPARAM)0) / 10000; _stprintf(szText, _T("%.3lf"), 1.0 - dVidCubicB); SendDlgItemMessage(hDlg, IDC_SCANLINE_EDIT, WM_SETTEXT, (WPARAM)0, (LPARAM)szText); // Update the screen if (bVidOkay) { // VidRedraw(); VidPaint(2); } } break; } } break; } case WM_CLOSE: if (nExitStatus != 1) { dVidCubicB = dPrevB; dVidCubicC = dPrevC; } EndDialog(hDlg, 0); break; } return 0; }
static INT_PTR CALLBACK GammaProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM) // LPARAM lParam { static double nPrevGamma; switch (Msg) { case WM_INITDIALOG: { TCHAR szText[16]; int nPos; nPrevGamma = nGamma; nExitStatus = 0; WndInMid(hDlg, hScrnWnd); // Initialise gamma slider SendDlgItemMessage(hDlg, IDC_GAMMA_SLIDER, TBM_SETRANGE, (WPARAM)0, (LPARAM)MAKELONG(1, 20000)); SendDlgItemMessage(hDlg, IDC_GAMMA_SLIDER, TBM_SETLINESIZE, (WPARAM)0, (LPARAM)200); SendDlgItemMessage(hDlg, IDC_GAMMA_SLIDER, TBM_SETPAGESIZE, (WPARAM)0, (LPARAM)250); SendDlgItemMessage(hDlg, IDC_GAMMA_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)7500); SendDlgItemMessage(hDlg, IDC_GAMMA_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)10001); SendDlgItemMessage(hDlg, IDC_GAMMA_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)12500); // Set slider to value of nGamma if (nGamma > 1.0) { // Gamma > 1 nPos = int((nGamma - 1.0) * 10000.0 + 10001.0); } else { // Gamma < 1 nPos = int(10000.0f - ((1.0 / nGamma) * 10000.0 - 10000.0)); } SendDlgItemMessage(hDlg, IDC_GAMMA_SLIDER, TBM_SETPOS, (WPARAM)true, (LPARAM)nPos); // Set the edit control to the value of nGamma _stprintf(szText, _T("%0.2f"), nGamma); SendDlgItemMessage(hDlg, IDC_GAMMA_EDIT, WM_SETTEXT, (WPARAM)0, (LPARAM)szText); // Update the screen ComputeGammaLUT(); if (bVidOkay) { VidRedraw(); VidPaint(0); } return TRUE; } case WM_COMMAND: { switch (HIWORD(wParam)) { case BN_CLICKED: { if (LOWORD(wParam) == IDOK) { nExitStatus = 1; SendMessage(hDlg, WM_CLOSE, 0, 0); } if (LOWORD(wParam) == IDCANCEL) { nExitStatus = -1; SendMessage(hDlg, WM_CLOSE, 0, 0); } break; } case EN_UPDATE: { if (nExitStatus == 0) { TCHAR szText[16] = _T(""); bool bPoint = 0; bool bValid = 1; if (SendDlgItemMessage(hDlg, IDC_GAMMA_EDIT, WM_GETTEXTLENGTH, (WPARAM)0, (LPARAM)0) < 16) { SendDlgItemMessage(hDlg, IDC_GAMMA_EDIT, WM_GETTEXT, (WPARAM)16, (LPARAM)szText); } // Scan string in the edit control for illegal characters for (int i = 0; szText[i]; i++) { if (szText[i] == _T('.')) { if (bPoint) { bValid = 0; break; } } else { if (!_istdigit(szText[i])) { bValid = 0; break; } } } if (bValid) { int nPos; nGamma = _tcstod(szText, NULL); // Set slider to value of nGamma if (nGamma > 1.0) { // Gamma > 1 nPos = int((nGamma - 1.0) * 10000.0 + 10001.0); } else { // Gamma < 1 nPos = int(10000.0 - ((1.0 / nGamma) * 10000.0 - 10000.0)); } SendDlgItemMessage(hDlg, IDC_GAMMA_SLIDER, TBM_SETPOS, (WPARAM)true, (LPARAM)nPos); // Update the screen ComputeGammaLUT(); if (bVidOkay) { VidRedraw(); VidPaint(0); } } } break; } break; } } case WM_HSCROLL: { switch (LOWORD(wParam)) { case TB_BOTTOM: case TB_ENDTRACK: case TB_LINEDOWN: case TB_LINEUP: case TB_PAGEDOWN: case TB_PAGEUP: case TB_THUMBPOSITION: case TB_THUMBTRACK: case TB_TOP: { if (nExitStatus == 0) { TCHAR szText[16]; int nPos; // Update the contents of the edit control nPos = SendDlgItemMessage(hDlg, IDC_GAMMA_SLIDER, TBM_GETPOS, (WPARAM)0, (LPARAM)0); if (nPos > 10000) { // Gamma > 1 nGamma = 1.0 + (nPos - 10000.0) / 10000.0; } else { // Gamma < 1 nGamma = 1.0 / (1.0 + ((10001.0 - nPos) / 10000.0)); } _stprintf(szText, _T("%0.2f"), nGamma); SendDlgItemMessage(hDlg, IDC_GAMMA_EDIT, WM_SETTEXT, (WPARAM)0, (LPARAM)szText); // Update the screen ComputeGammaLUT(); if (bVidOkay) { VidRedraw(); VidPaint(0); } } break; } } break; } case WM_CLOSE: if (nExitStatus != 1) { nGamma = nPrevGamma; } EndDialog(hDlg, 0); } return 0; }
// ----------------------------------------------------------------------------- // Screen Angle dialog static INT_PTR CALLBACK ScreenAngleProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam) { static float fPrevScreenAngle, fPrevScreenCurvature; static HWND hScreenAngleSlider, hScreenAngleEdit; switch (Msg) { case WM_INITDIALOG: { TCHAR szText[16]; fPrevScreenAngle = fVidScreenAngle; fPrevScreenCurvature = fVidScreenCurvature; hScreenAngleSlider = GetDlgItem(hDlg, IDC_SCREENANGLE_SLIDER); hScreenAngleEdit = GetDlgItem(hDlg, IDC_SCREENANGLE_EDIT); nExitStatus = 0; WndInMid(hDlg, hScrnWnd); // Initialise sliders SendDlgItemMessage(hDlg, IDC_SCREENANGLE_SLIDER, TBM_SETRANGE, (WPARAM)0, (LPARAM)MAKELONG(0, 12000)); SendDlgItemMessage(hDlg, IDC_SCREENANGLE_SLIDER, TBM_SETLINESIZE, (WPARAM)0, (LPARAM)100); SendDlgItemMessage(hDlg, IDC_SCREENANGLE_SLIDER, TBM_SETPAGESIZE, (WPARAM)0, (LPARAM)250); SendDlgItemMessage(hDlg, IDC_SCREENANGLE_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)1000); SendDlgItemMessage(hDlg, IDC_SCREENANGLE_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)2250); SendDlgItemMessage(hDlg, IDC_SCREENANGLE_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)6000); SendDlgItemMessage(hDlg, IDC_SCREENCURVATURE_SLIDER, TBM_SETRANGE, (WPARAM)0, (LPARAM)MAKELONG(0, 12000)); SendDlgItemMessage(hDlg, IDC_SCREENCURVATURE_SLIDER, TBM_SETLINESIZE, (WPARAM)0, (LPARAM)150); SendDlgItemMessage(hDlg, IDC_SCREENCURVATURE_SLIDER, TBM_SETPAGESIZE, (WPARAM)0, (LPARAM)375); SendDlgItemMessage(hDlg, IDC_SCREENCURVATURE_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)3000); SendDlgItemMessage(hDlg, IDC_SCREENCURVATURE_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)4500); SendDlgItemMessage(hDlg, IDC_SCREENCURVATURE_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)6000); // Set sliders to current value SendDlgItemMessage(hDlg, IDC_SCREENANGLE_SLIDER, TBM_SETPOS, (WPARAM)true, (LPARAM)(fVidScreenAngle * RADTODEG * 100.0f)); SendDlgItemMessage(hDlg, IDC_SCREENCURVATURE_SLIDER, TBM_SETPOS, (WPARAM)true, (LPARAM)(fVidScreenCurvature * RADTODEG * 150.0f)); // Set the edit controls to current value _stprintf(szText, _T("%0.2f"), fVidScreenAngle * RADTODEG); SendDlgItemMessage(hDlg, IDC_SCREENANGLE_EDIT, WM_SETTEXT, (WPARAM)0, (LPARAM)szText); _stprintf(szText, _T("%0.2f"), fVidScreenCurvature * RADTODEG); SendDlgItemMessage(hDlg, IDC_SCREENCURVATURE_EDIT, WM_SETTEXT, (WPARAM)0, (LPARAM)szText); // Update the screen if (bVidOkay) { VidPaint(2); } return TRUE; } case WM_COMMAND: { switch (HIWORD(wParam)) { case BN_CLICKED: { if (LOWORD(wParam) == IDOK) { nExitStatus = 1; SendMessage(hDlg, WM_CLOSE, 0, 0); } if (LOWORD(wParam) == IDCANCEL) { nExitStatus = -1; SendMessage(hDlg, WM_CLOSE, 0, 0); } break; } case EN_UPDATE: { if (nExitStatus == 0) { TCHAR szText[16] = _T(""); bool bPoint = 0; bool bValid = 1; if ((HWND)lParam == hScreenAngleEdit) { if (SendDlgItemMessage(hDlg, IDC_SCREENANGLE_EDIT, WM_GETTEXTLENGTH, (WPARAM)0, (LPARAM)0) < 16) { SendDlgItemMessage(hDlg, IDC_SCREENANGLE_EDIT, WM_GETTEXT, (WPARAM)16, (LPARAM)szText); } } else { if (SendDlgItemMessage(hDlg, IDC_SCREENCURVATURE_EDIT, WM_GETTEXTLENGTH, (WPARAM)0, (LPARAM)0) < 16) { SendDlgItemMessage(hDlg, IDC_SCREENCURVATURE_EDIT, WM_GETTEXT, (WPARAM)16, (LPARAM)szText); } } // Scan string in the edit control for illegal characters for (int i = 0; szText[i]; i++) { if (szText[i] == '.') { if (bPoint) { bValid = 0; break; } } else { if (!_istdigit(szText[i])) { bValid = 0; break; } } } if (bValid) { if ((HWND)lParam == hScreenAngleEdit) { fVidScreenAngle = _tcstod(szText, NULL) * DEGTORAD; if (fVidScreenAngle < 0.0f) { fVidScreenAngle = 0.0f; } else { if (fVidScreenAngle > PI / 1.5f) { fVidScreenAngle = PI / 1.5f; } } // Set slider to current value SendDlgItemMessage(hDlg, IDC_SCREENANGLE_SLIDER, TBM_SETPOS, (WPARAM)true, (LPARAM)(fVidScreenAngle * RADTODEG * 100.0f)); } else { fVidScreenCurvature = _tcstod(szText, NULL) * DEGTORAD; if (fVidScreenCurvature < 0.0f) { fVidScreenCurvature = 0.0f; } else { if (fVidScreenCurvature > PI / 2.25f) { fVidScreenCurvature = PI / 2.25f; } } // Set slider to current value SendDlgItemMessage(hDlg, IDC_SCREENCURVATURE_SLIDER, TBM_SETPOS, (WPARAM)true, (LPARAM)(fVidScreenCurvature * RADTODEG * 150.0f)); } // Update the screen if (bVidOkay) { VidPaint(2); } } } break; } } break; } case WM_HSCROLL: { switch (LOWORD(wParam)) { case TB_BOTTOM: case TB_ENDTRACK: case TB_LINEDOWN: case TB_LINEUP: case TB_PAGEDOWN: case TB_PAGEUP: case TB_THUMBPOSITION: case TB_THUMBTRACK: case TB_TOP: { if (nExitStatus == 0) { TCHAR szText[16]; // Update the contents of the edit control if ((HWND)lParam == hScreenAngleSlider) { fVidScreenAngle = (float)SendDlgItemMessage(hDlg, IDC_SCREENANGLE_SLIDER, TBM_GETPOS, (WPARAM)0, (LPARAM)0) * DEGTORAD / 100.0f; _stprintf(szText, _T("%0.2f"), fVidScreenAngle * RADTODEG); SendDlgItemMessage(hDlg, IDC_SCREENANGLE_EDIT, WM_SETTEXT, (WPARAM)0, (LPARAM)szText); } else { fVidScreenCurvature = (float)SendDlgItemMessage(hDlg, IDC_SCREENCURVATURE_SLIDER, TBM_GETPOS, (WPARAM)0, (LPARAM)0) * DEGTORAD / 150.0f; _stprintf(szText, _T("%0.2f"), fVidScreenCurvature * RADTODEG); SendDlgItemMessage(hDlg, IDC_SCREENCURVATURE_EDIT, WM_SETTEXT, (WPARAM)0, (LPARAM)szText); } // Update the screen if (bVidOkay) { VidPaint(0); } } break; } } break; } case WM_CLOSE: if (nExitStatus != 1) { fVidScreenAngle = fPrevScreenAngle; fVidScreenCurvature = fPrevScreenCurvature; } EndDialog(hDlg, 0); break; } return 0; }
// ----------------------------------------------------------------------------- // Feedback intensity dialog static INT_PTR CALLBACK PhosphorProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam) // LPARAM lParam { static int nPrevIntensity; static int nPrevSaturation; switch (Msg) { case WM_INITDIALOG: { TCHAR szText[16]; nPrevIntensity = nVidFeedbackIntensity; nPrevSaturation = nVidFeedbackOverSaturation; nExitStatus = 0; WndInMid(hDlg, hScrnWnd); // Initialise sliders SendDlgItemMessage(hDlg, IDC_PHOSPHOR_1_SLIDER, TBM_SETRANGE, (WPARAM)0, (LPARAM)MAKELONG(0, 255)); SendDlgItemMessage(hDlg, IDC_PHOSPHOR_1_SLIDER, TBM_SETPAGESIZE, (WPARAM)0, (LPARAM)8); SendDlgItemMessage(hDlg, IDC_PHOSPHOR_1_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)127); SendDlgItemMessage(hDlg, IDC_PHOSPHOR_1_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)63); SendDlgItemMessage(hDlg, IDC_PHOSPHOR_1_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)31); SendDlgItemMessage(hDlg, IDC_PHOSPHOR_1_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)15); SendDlgItemMessage(hDlg, IDC_PHOSPHOR_2_SLIDER, TBM_SETRANGE, (WPARAM)0, (LPARAM)MAKELONG(0, 127)); SendDlgItemMessage(hDlg, IDC_PHOSPHOR_2_SLIDER, TBM_SETPAGESIZE, (WPARAM)0, (LPARAM)4); SendDlgItemMessage(hDlg, IDC_PHOSPHOR_2_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)63); SendDlgItemMessage(hDlg, IDC_PHOSPHOR_2_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)31); SendDlgItemMessage(hDlg, IDC_PHOSPHOR_2_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)15); // Set slider to current values SendDlgItemMessage(hDlg, IDC_PHOSPHOR_1_SLIDER, TBM_SETPOS, (WPARAM)true, (LPARAM)nVidFeedbackIntensity); SendDlgItemMessage(hDlg, IDC_PHOSPHOR_2_SLIDER, TBM_SETPOS, (WPARAM)true, (LPARAM)nVidFeedbackOverSaturation); // Set the edit control to current values _stprintf(szText, _T("%i"), nVidFeedbackIntensity); SendDlgItemMessage(hDlg, IDC_PHOSPHOR_1_EDIT, WM_SETTEXT, (WPARAM)0, (LPARAM)szText); _stprintf(szText, _T("%i"), nVidFeedbackOverSaturation); SendDlgItemMessage(hDlg, IDC_PHOSPHOR_2_EDIT, WM_SETTEXT, (WPARAM)0, (LPARAM)szText); return TRUE; } case WM_COMMAND: { switch (HIWORD(wParam)) { case BN_CLICKED: { if (LOWORD(wParam) == IDOK) { nExitStatus = 1; SendMessage(hDlg, WM_CLOSE, 0, 0); } if (LOWORD(wParam) == IDCANCEL) { nExitStatus = -1; SendMessage(hDlg, WM_CLOSE, 0, 0); } break; } case EN_UPDATE: { if (nExitStatus == 0) { TCHAR szText[16] = _T(""); bool bValid = 1; switch (LOWORD(wParam)) { case IDC_PHOSPHOR_1_EDIT: if (SendDlgItemMessage(hDlg, IDC_PHOSPHOR_1_EDIT, WM_GETTEXTLENGTH, (WPARAM)0, (LPARAM)0) < 16) { SendDlgItemMessage(hDlg, IDC_PHOSPHOR_1_EDIT, WM_GETTEXT, (WPARAM)16, (LPARAM)szText); } // Scan string in the edit control for illegal characters for (int i = 0; szText[i]; i++) { if (!_istdigit(szText[i])) { bValid = 0; break; } } if (bValid) { nVidFeedbackIntensity = _tcstol(szText, NULL, 0); if (nVidFeedbackIntensity < 0) { nVidFeedbackIntensity = 0; } else { if (nVidFeedbackIntensity > 255) { nVidFeedbackIntensity = 255; } } // Set slider to current value SendDlgItemMessage(hDlg, IDC_PHOSPHOR_1_SLIDER, TBM_SETPOS, (WPARAM)true, (LPARAM)nVidFeedbackIntensity); } break; case IDC_PHOSPHOR_2_EDIT: if (SendDlgItemMessage(hDlg, IDC_PHOSPHOR_2_EDIT, WM_GETTEXTLENGTH, (WPARAM)0, (LPARAM)0) < 16) { SendDlgItemMessage(hDlg, IDC_PHOSPHOR_2_EDIT, WM_GETTEXT, (WPARAM)16, (LPARAM)szText); } // Scan string in the edit control for illegal characters for (int i = 0; szText[i]; i++) { if (!_istdigit(szText[i])) { bValid = 0; break; } } if (bValid) { nVidFeedbackOverSaturation = _tcstol(szText, NULL, 0); if (nVidFeedbackOverSaturation < 0) { nVidFeedbackOverSaturation = 0; } else { if (nVidFeedbackOverSaturation > 255) { nVidFeedbackOverSaturation = 255; } } // Set slider to current value SendDlgItemMessage(hDlg, IDC_PHOSPHOR_2_SLIDER, TBM_SETPOS, (WPARAM)true, (LPARAM)nVidFeedbackOverSaturation); // Update the screen if (bVidOkay) { VidPaint(2); } } break; } } break; } } break; } case WM_HSCROLL: { switch (LOWORD(wParam)) { case TB_BOTTOM: case TB_ENDTRACK: case TB_LINEDOWN: case TB_LINEUP: case TB_PAGEDOWN: case TB_PAGEUP: case TB_THUMBPOSITION: case TB_THUMBTRACK: case TB_TOP: { if (nExitStatus == 0) { TCHAR szText[16]; // Update the contents of the edit control switch (GetDlgCtrlID((HWND)lParam)) { case IDC_PHOSPHOR_1_SLIDER: nVidFeedbackIntensity = SendDlgItemMessage(hDlg, IDC_PHOSPHOR_1_SLIDER, TBM_GETPOS, (WPARAM)0, (LPARAM)0); _stprintf(szText, _T("%i"), nVidFeedbackIntensity); SendDlgItemMessage(hDlg, IDC_PHOSPHOR_1_EDIT, WM_SETTEXT, (WPARAM)0, (LPARAM)szText); break; case IDC_PHOSPHOR_2_SLIDER: nVidFeedbackOverSaturation = SendDlgItemMessage(hDlg, IDC_PHOSPHOR_2_SLIDER, TBM_GETPOS, (WPARAM)0, (LPARAM)0); _stprintf(szText, _T("%i"), nVidFeedbackOverSaturation); SendDlgItemMessage(hDlg, IDC_PHOSPHOR_2_EDIT, WM_SETTEXT, (WPARAM)0, (LPARAM)szText); break; } } break; } } break; } case WM_CLOSE: if (nExitStatus != 1) { nVidFeedbackIntensity = nPrevIntensity; nVidFeedbackOverSaturation = nPrevSaturation; } EndDialog(hDlg, 0); break; } return 0; }
static BOOL CALLBACK ScanlineProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM) // LPARAM lParam { static int nPrevIntensity; switch (Msg) { case WM_INITDIALOG: { TCHAR szText[16]; nPrevIntensity = nVidScanIntensity; nExitStatus = 0; WndInMid(hDlg, hScrnWnd); // Initialise slider SendDlgItemMessage(hDlg, IDC_SCANLINE_SLIDER, TBM_SETRANGE, (WPARAM)0, (LPARAM)MAKELONG(0, 255)); SendDlgItemMessage(hDlg, IDC_SCANLINE_SLIDER, TBM_SETPAGESIZE, (WPARAM)0, (LPARAM)16); SendDlgItemMessage(hDlg, IDC_SCANLINE_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)191); SendDlgItemMessage(hDlg, IDC_SCANLINE_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)127); SendDlgItemMessage(hDlg, IDC_SCANLINE_SLIDER, TBM_SETTIC, (WPARAM)0, (LPARAM)63); // Set slider to current value SendDlgItemMessage(hDlg, IDC_SCANLINE_SLIDER, TBM_SETPOS, (WPARAM)true, (LPARAM)nVidScanIntensity & 0xFF); // Set the edit control to current value _stprintf(szText, _T("%i"), nVidScanIntensity & 0xFF); SendDlgItemMessage(hDlg, IDC_SCANLINE_EDIT, WM_SETTEXT, (WPARAM)0, (LPARAM)szText); // Update the screen if (bDrvOkay) { VidPaint(2); } return TRUE; } case WM_COMMAND: { switch (HIWORD(wParam)) { case BN_CLICKED: { if (LOWORD(wParam) == IDOK) { nExitStatus = 1; SendMessage(hDlg, WM_CLOSE, 0, 0); } if (LOWORD(wParam) == IDCANCEL) { nExitStatus = -1; SendMessage(hDlg, WM_CLOSE, 0, 0); } break; } case EN_UPDATE: { if (nExitStatus == 0) { TCHAR szText[16] = _T(""); bool bValid = 1; if (SendDlgItemMessage(hDlg, IDC_SCANLINE_EDIT, WM_GETTEXTLENGTH, (WPARAM)0, (LPARAM)0) < 16) { SendDlgItemMessage(hDlg, IDC_SCANLINE_EDIT, WM_GETTEXT, (WPARAM)16, (LPARAM)szText); } // Scan string in the edit control for illegal characters for (int i = 0; szText[i]; i++) { if (!_istdigit(szText[i])) { bValid = 0; break; } } if (bValid) { nVidScanIntensity = _tcstol(szText, NULL, 0); if (nVidScanIntensity < 0) { nVidScanIntensity = 0; } else { if (nVidScanIntensity > 255) { nVidScanIntensity = 255; } } // Set slider to current value SendDlgItemMessage(hDlg, IDC_SCANLINE_SLIDER, TBM_SETPOS, (WPARAM)true, (LPARAM)nVidScanIntensity); nVidScanIntensity |= (nVidScanIntensity << 8) | (nVidScanIntensity << 16); // Update the screen if (bVidOkay) { VidPaint(2); } } } break; } } break; } case WM_HSCROLL: { switch (LOWORD(wParam)) { case TB_BOTTOM: case TB_ENDTRACK: case TB_LINEDOWN: case TB_LINEUP: case TB_PAGEDOWN: case TB_PAGEUP: case TB_THUMBPOSITION: case TB_THUMBTRACK: case TB_TOP: { if (nExitStatus == 0) { TCHAR szText[16]; // Update the contents of the edit control nVidScanIntensity = SendDlgItemMessage(hDlg, IDC_SCANLINE_SLIDER, TBM_GETPOS, (WPARAM)0, (LPARAM)0); _stprintf(szText, _T("%i"), nVidScanIntensity); SendDlgItemMessage(hDlg, IDC_SCANLINE_EDIT, WM_SETTEXT, (WPARAM)0, (LPARAM)szText); nVidScanIntensity |= (nVidScanIntensity << 8) | (nVidScanIntensity << 16); // Update the screen if (bVidOkay) { // VidRedraw(); VidPaint(2); } } break; } } break; } case WM_CLOSE: if (nExitStatus != 1) { nVidScanIntensity = nPrevIntensity; } EndDialog(hDlg, 0); break; } return 0; }
static INT_PTR CALLBACK DialogProc(HWND hDlg,UINT Msg,WPARAM wParam,LPARAM lParam) { (void)lParam; (void)wParam; (void)hDlg; if (Msg==WM_INITDIALOG) { hSFactdlg=hDlg; SFactdInit(); SFactdUpdate(); WndInMid(hDlg, hScrnWnd); SetFocus(hDlg); // Enable Esc=close return 0; } if (Msg==WM_CLOSE) { //DestroyWindow(hSFactdlg); EndDialog(hDlg, 0); return 0; } if (Msg==WM_DESTROY) { SFactdExit(); return 0; } if (Msg==WM_COMMAND) { int Id=LOWORD(wParam); int Notify=HIWORD(wParam); if (Id==IDOK && Notify==BN_CLICKED) { SendMessage(hDlg,WM_CLOSE,0,0); return 0; } // cancel=close if (Id==IDCAPTURE && Notify==BN_CLICKED) { if (bDrvOkay) { MakeScreenShot(); SFactdUpdate(); } } if (Id==IDC_CHECK1 && Notify==BN_CLICKED) { ToggleLayer(1); SFactdUpdate(); } if (Id==IDC_CHECK2 && Notify==BN_CLICKED) { ToggleLayer(2); SFactdUpdate(); } if (Id==IDC_CHECK3 && Notify==BN_CLICKED) { ToggleLayer(4); SFactdUpdate(); } if (Id==IDC_CHECK4 && Notify==BN_CLICKED) { ToggleLayer(8); SFactdUpdate(); } if (Id==IDC_SPRITE1 && Notify==BN_CLICKED) { ToggleSprite(0x01); SFactdUpdate(); } if (Id==IDC_SPRITE2 && Notify==BN_CLICKED) { ToggleSprite(0x02); SFactdUpdate(); } if (Id==IDC_SPRITE3 && Notify==BN_CLICKED) { ToggleSprite(0x04); SFactdUpdate(); } if (Id==IDC_SPRITE4 && Notify==BN_CLICKED) { ToggleSprite(0x08); SFactdUpdate(); } if (Id==IDC_SPRITE5 && Notify==BN_CLICKED) { ToggleSprite(0x10); SFactdUpdate(); } if (Id==IDC_SPRITE6 && Notify==BN_CLICKED) { ToggleSprite(0x20); SFactdUpdate(); } if (Id==IDC_SPRITE7 && Notify==BN_CLICKED) { ToggleSprite(0x40); SFactdUpdate(); } if (Id==IDC_SPRITE8 && Notify==BN_CLICKED) { ToggleSprite(0x80); SFactdUpdate(); } if (Id==IDC_ADVANCE && Notify==BN_CLICKED) { VidFrame(); VidPaint(0); } if (bRunPause) { memset(nAudNextSound, 0, nAudSegLen << 2); // Write silence into the buffer } } return 0; }