| version 1.8, 2005/02/07 15:39:27 | version 1.14, 2007/10/26 14:38:34 | 
| Line 4 | Line 4 | 
 | #include        "strres.h" | #include        "strres.h" | 
 | #include        "resource.h" | #include        "resource.h" | 
 | #include        "np2.h" | #include        "np2.h" | 
 |  | #include        "oemtext.h" | 
 | #include        "scrnmng.h" | #include        "scrnmng.h" | 
 | #include        "sysmng.h" | #include        "sysmng.h" | 
 | #include        "np2class.h" | #include        "np2class.h" | 
| Line 15 | Line 16 | 
 | #include        "palettes.h" | #include        "palettes.h" | 
 |  |  | 
 |  |  | 
| static const char str_scropt[] = "Screen option"; | static const TCHAR str_scropt[] = _T("Screen option"); | 
 |  |  | 
 |  |  | 
 | static LRESULT CALLBACK Scropt1DlgProc(HWND hWnd, UINT msg, | static LRESULT CALLBACK Scropt1DlgProc(HWND hWnd, UINT msg, | 
 | WPARAM wp, LPARAM lp) { | WPARAM wp, LPARAM lp) { | 
| char    work[32]; | TCHAR   work[32]; | 
 | UINT16  ret; | UINT16  ret; | 
 | UINT8   b; | UINT8   b; | 
 | int             renewal; | int             renewal; | 
| Line 36  static LRESULT CALLBACK Scropt1DlgProc(H | Line 37  static LRESULT CALLBACK Scropt1DlgProc(H | 
 | MAKELONG(0, 255)); | MAKELONG(0, 255)); | 
 | SendDlgItemMessage(hWnd, IDC_SKIPLIGHT, TBM_SETPOS, TRUE, | SendDlgItemMessage(hWnd, IDC_SKIPLIGHT, TBM_SETPOS, TRUE, | 
 | np2cfg.skiplight); | np2cfg.skiplight); | 
| wsprintf(work, str_d, np2cfg.skiplight); | wsprintf(work, tchar_u, np2cfg.skiplight); | 
 | SetDlgItemText(hWnd, IDC_LIGHTSTR, work); | SetDlgItemText(hWnd, IDC_LIGHTSTR, work); | 
 | return(TRUE); | return(TRUE); | 
 |  |  | 
| Line 54  static LRESULT CALLBACK Scropt1DlgProc(H | Line 55  static LRESULT CALLBACK Scropt1DlgProc(H | 
 | case IDC_SKIPLIGHT: | case IDC_SKIPLIGHT: | 
 | ret = (UINT16)SendDlgItemMessage(hWnd, IDC_SKIPLIGHT, | ret = (UINT16)SendDlgItemMessage(hWnd, IDC_SKIPLIGHT, | 
 | TBM_GETPOS, 0, 0); | TBM_GETPOS, 0, 0); | 
| wsprintf(work, str_d, ret); | wsprintf(work, tchar_u, ret); | 
 | SetDlgItemText(hWnd, IDC_LIGHTSTR, work); | SetDlgItemText(hWnd, IDC_LIGHTSTR, work); | 
 | break; | break; | 
 | } | } | 
| Line 63  static LRESULT CALLBACK Scropt1DlgProc(H | Line 64  static LRESULT CALLBACK Scropt1DlgProc(H | 
 | case WM_NOTIFY: | case WM_NOTIFY: | 
 | if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) { | if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) { | 
 | renewal = 0; | renewal = 0; | 
| b = GetDlgItemCheck(hWnd, IDC_SKIPLINE); | b = (UINT8)GetDlgItemCheck(hWnd, IDC_SKIPLINE); | 
 | if (np2cfg.skipline != b) { | if (np2cfg.skipline != b) { | 
 | np2cfg.skipline = b; | np2cfg.skipline = b; | 
 | renewal = 1; | renewal = 1; | 
 | } | } | 
| if ((ret = (UINT16)SendDlgItemMessage(hWnd, IDC_SKIPLIGHT, | ret = (UINT16)SendDlgItemMessage(hWnd, IDC_SKIPLIGHT, | 
| TBM_GETPOS, 0, 0)) > 255) { | TBM_GETPOS, 0, 0); | 
|  | if (ret > 255) { | 
 | ret = 255; | ret = 255; | 
 | } | } | 
 | if (np2cfg.skiplight != ret) { | if (np2cfg.skiplight != ret) { | 
| Line 79  static LRESULT CALLBACK Scropt1DlgProc(H | Line 81  static LRESULT CALLBACK Scropt1DlgProc(H | 
 | if (renewal) { | if (renewal) { | 
 | pal_makeskiptable(); | pal_makeskiptable(); | 
 | } | } | 
| b = GetDlgItemCheck(hWnd, IDC_LCD) | | b = (GetDlgItemCheck(hWnd, IDC_LCD)?0x01:0x00) | | 
| (GetDlgItemCheck(hWnd, IDC_LCDX) << 1); | (GetDlgItemCheck(hWnd, IDC_LCDX)?0x02:0x00); | 
 | if (np2cfg.LCD_MODE != b) { | if (np2cfg.LCD_MODE != b) { | 
 | np2cfg.LCD_MODE = b; | np2cfg.LCD_MODE = b; | 
 | pal_makelcdpal(); | pal_makelcdpal(); | 
| Line 128  static LRESULT CALLBACK Scropt2DlgProc(H | Line 130  static LRESULT CALLBACK Scropt2DlgProc(H | 
 | case WM_NOTIFY: | case WM_NOTIFY: | 
 | if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) { | if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) { | 
 | update = 0; | update = 0; | 
| b = GetDlgItemCheck(hWnd, IDC_GDC72020); | b = (UINT8)GetDlgItemCheck(hWnd, IDC_GDC72020); | 
 | if (np2cfg.uPD72020 != b) { | if (np2cfg.uPD72020 != b) { | 
 | np2cfg.uPD72020 = b; | np2cfg.uPD72020 = b; | 
 | update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; | 
| Line 141  static LRESULT CALLBACK Scropt2DlgProc(H | Line 143  static LRESULT CALLBACK Scropt2DlgProc(H | 
 | update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; | 
 | gdcs.grphdisp |= GDCSCRN_ALLDRAW2; | gdcs.grphdisp |= GDCSCRN_ALLDRAW2; | 
 | } | } | 
| b = GetDlgItemCheck(hWnd, IDC_PC980124); | b = (UINT8)GetDlgItemCheck(hWnd, IDC_PC980124); | 
 | if (np2cfg.color16 != b) { | if (np2cfg.color16 != b) { | 
 | np2cfg.color16 = b; | np2cfg.color16 = b; | 
 | update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; | 
| Line 157  static LRESULT CALLBACK Scropt2DlgProc(H | Line 159  static LRESULT CALLBACK Scropt2DlgProc(H | 
 | static LRESULT CALLBACK Scropt3DlgProc(HWND hWnd, UINT msg, | static LRESULT CALLBACK Scropt3DlgProc(HWND hWnd, UINT msg, | 
 | WPARAM wp, LPARAM lp) { | WPARAM wp, LPARAM lp) { | 
 |  |  | 
| char    work[32]; | TCHAR   work[32]; | 
 | UINT8   value[6]; | UINT8   value[6]; | 
 | UINT8   b; | UINT8   b; | 
 | UINT    update; | UINT    update; | 
| Line 168  static LRESULT CALLBACK Scropt3DlgProc(H | Line 170  static LRESULT CALLBACK Scropt3DlgProc(H | 
 | MAKELONG(0, 32)); | MAKELONG(0, 32)); | 
 | SendDlgItemMessage(hWnd, IDC_TRAMWAIT, TBM_SETPOS, TRUE, | SendDlgItemMessage(hWnd, IDC_TRAMWAIT, TBM_SETPOS, TRUE, | 
 | np2cfg.wait[0]); | np2cfg.wait[0]); | 
| wsprintf(work, str_u, np2cfg.wait[0]); | wsprintf(work, tchar_u, np2cfg.wait[0]); | 
 | SetDlgItemText(hWnd, IDC_TRAMSTR, work); | SetDlgItemText(hWnd, IDC_TRAMSTR, work); | 
 | SendDlgItemMessage(hWnd, IDC_VRAMWAIT, TBM_SETRANGE, TRUE, | SendDlgItemMessage(hWnd, IDC_VRAMWAIT, TBM_SETRANGE, TRUE, | 
 | MAKELONG(0, 32)); | MAKELONG(0, 32)); | 
 | SendDlgItemMessage(hWnd, IDC_VRAMWAIT, TBM_SETPOS, TRUE, | SendDlgItemMessage(hWnd, IDC_VRAMWAIT, TBM_SETPOS, TRUE, | 
 | np2cfg.wait[2]); | np2cfg.wait[2]); | 
| wsprintf(work, str_u, np2cfg.wait[2]); | wsprintf(work, tchar_u, np2cfg.wait[2]); | 
 | SetDlgItemText(hWnd, IDC_VRAMSTR, work); | SetDlgItemText(hWnd, IDC_VRAMSTR, work); | 
 | SendDlgItemMessage(hWnd, IDC_GRCGWAIT, TBM_SETRANGE, TRUE, | SendDlgItemMessage(hWnd, IDC_GRCGWAIT, TBM_SETRANGE, TRUE, | 
 | MAKELONG(0, 32)); | MAKELONG(0, 32)); | 
 | SendDlgItemMessage(hWnd, IDC_GRCGWAIT, TBM_SETPOS, TRUE, | SendDlgItemMessage(hWnd, IDC_GRCGWAIT, TBM_SETPOS, TRUE, | 
 | np2cfg.wait[4]); | np2cfg.wait[4]); | 
| wsprintf(work, str_u, np2cfg.wait[4]); | wsprintf(work, tchar_u, np2cfg.wait[4]); | 
 | SetDlgItemText(hWnd, IDC_GRCGSTR, work); | SetDlgItemText(hWnd, IDC_GRCGSTR, work); | 
 |  |  | 
 | SendDlgItemMessage(hWnd, IDC_REALPAL, TBM_SETRANGE, TRUE, | SendDlgItemMessage(hWnd, IDC_REALPAL, TBM_SETRANGE, TRUE, | 
 | MAKELONG(0, 64)); | MAKELONG(0, 64)); | 
 | SendDlgItemMessage(hWnd, IDC_REALPAL, TBM_SETPOS, TRUE, | SendDlgItemMessage(hWnd, IDC_REALPAL, TBM_SETPOS, TRUE, | 
 | np2cfg.realpal); | np2cfg.realpal); | 
| wsprintf(work, str_d, (int)np2cfg.realpal - 32); | wsprintf(work, tchar_d, (int)np2cfg.realpal - 32); | 
 | SetDlgItemText(hWnd, IDC_REALPALSTR, work); | SetDlgItemText(hWnd, IDC_REALPALSTR, work); | 
 |  |  | 
 | return(TRUE); | return(TRUE); | 
| Line 197  static LRESULT CALLBACK Scropt3DlgProc(H | Line 199  static LRESULT CALLBACK Scropt3DlgProc(H | 
 | case IDC_TRAMWAIT: | case IDC_TRAMWAIT: | 
 | b = (UINT8)SendDlgItemMessage(hWnd, IDC_TRAMWAIT, | b = (UINT8)SendDlgItemMessage(hWnd, IDC_TRAMWAIT, | 
 | TBM_GETPOS, 0, 0); | TBM_GETPOS, 0, 0); | 
| wsprintf(work, str_u, b); | wsprintf(work, tchar_u, b); | 
 | SetDlgItemText(hWnd, IDC_TRAMSTR, work); | SetDlgItemText(hWnd, IDC_TRAMSTR, work); | 
 | break; | break; | 
 |  |  | 
 | case IDC_VRAMWAIT: | case IDC_VRAMWAIT: | 
 | b = (UINT8)SendDlgItemMessage(hWnd, IDC_VRAMWAIT, | b = (UINT8)SendDlgItemMessage(hWnd, IDC_VRAMWAIT, | 
 | TBM_GETPOS, 0, 0); | TBM_GETPOS, 0, 0); | 
| wsprintf(work, str_u, b); | wsprintf(work, tchar_u, b); | 
 | SetDlgItemText(hWnd, IDC_VRAMSTR, work); | SetDlgItemText(hWnd, IDC_VRAMSTR, work); | 
 | break; | break; | 
 |  |  | 
 | case IDC_GRCGWAIT: | case IDC_GRCGWAIT: | 
 | b = (UINT8)SendDlgItemMessage(hWnd, IDC_GRCGWAIT, | b = (UINT8)SendDlgItemMessage(hWnd, IDC_GRCGWAIT, | 
 | TBM_GETPOS, 0, 0); | TBM_GETPOS, 0, 0); | 
| wsprintf(work, str_u, b); | wsprintf(work, tchar_u, b); | 
 | SetDlgItemText(hWnd, IDC_GRCGSTR, work); | SetDlgItemText(hWnd, IDC_GRCGSTR, work); | 
 | break; | break; | 
 |  |  | 
 | case IDC_REALPAL: | case IDC_REALPAL: | 
 | b = (UINT8)SendDlgItemMessage(hWnd, IDC_REALPAL, | b = (UINT8)SendDlgItemMessage(hWnd, IDC_REALPAL, | 
 | TBM_GETPOS, 0, 0); | TBM_GETPOS, 0, 0); | 
| wsprintf(work, str_d, (int)b - 32); | wsprintf(work, tchar_d, (int)b - 32); | 
 | SetDlgItemText(hWnd, IDC_REALPALSTR, work); | SetDlgItemText(hWnd, IDC_REALPALSTR, work); | 
 | } | } | 
 | break; | break; | 
| Line 259  static LRESULT CALLBACK Scropt3DlgProc(H | Line 264  static LRESULT CALLBACK Scropt3DlgProc(H | 
 | return(FALSE); | return(FALSE); | 
 | } | } | 
 |  |  | 
 |  | static const TCHAR *pszZoom[] = { | 
 |  | MAKEINTRESOURCE(IDS_ZOOM_NONE), | 
 |  | MAKEINTRESOURCE(IDS_ZOOM_FIXEDASPECT), | 
 |  | MAKEINTRESOURCE(IDS_ZOOM_ADJUSTASPECT), | 
 |  | MAKEINTRESOURCE(IDS_ZOOM_FULL)}; | 
 |  |  | 
 |  | static LRESULT CALLBACK ScroptFullScreenDlgProc(HWND hWnd, UINT uMsg, | 
 |  | WPARAM wParam, LPARAM lParam) | 
 |  | { | 
 |  | UINT8   c; | 
 |  | UINT    uUpdate; | 
 |  |  | 
 |  | switch(uMsg) | 
 |  | { | 
 |  | case WM_INITDIALOG: | 
 |  | c = np2oscfg.fscrnmod; | 
 |  | SetDlgItemCheck(hWnd, IDC_FULLSCREEN_SAMEBPP, | 
 |  | (c & FSCRNMOD_SAMEBPP)); | 
 |  | SetDlgItemCheck(hWnd, IDC_FULLSCREEN_SAMERES, | 
 |  | (c & FSCRNMOD_SAMERES)); | 
 |  | dlgs_setdroplistitem(hWnd, IDC_FULLSCREEN_ZOOM, | 
 |  | pszZoom, NELEMENTS(pszZoom)); | 
 |  | dlgs_setdroplistnumber(hWnd, IDC_FULLSCREEN_ZOOM, (c & 3)); | 
 |  | EnableWindow(GetDlgItem(hWnd, IDC_FULLSCREEN_ZOOM), | 
 |  | (c & FSCRNMOD_SAMERES) != 0); | 
 |  | return(TRUE); | 
 |  |  | 
 |  | case WM_COMMAND: | 
 |  | switch(LOWORD(wParam)) | 
 |  | { | 
 |  | case IDC_FULLSCREEN_SAMERES: | 
 |  | dlgs_enablebyautocheck(hWnd, IDC_FULLSCREEN_ZOOM, | 
 |  | IDC_FULLSCREEN_SAMERES); | 
 |  | break; | 
 |  | } | 
 |  | break; | 
 |  |  | 
 |  | case WM_NOTIFY: | 
 |  | if ((((NMHDR *)lParam)->code) == (UINT)PSN_APPLY) | 
 |  | { | 
 |  | c = 0; | 
 |  | if (GetDlgItemCheck(hWnd, IDC_FULLSCREEN_SAMEBPP)) | 
 |  | { | 
 |  | c |= FSCRNMOD_SAMEBPP; | 
 |  | } | 
 |  | if (GetDlgItemCheck(hWnd, IDC_FULLSCREEN_SAMERES)) | 
 |  | { | 
 |  | c |= FSCRNMOD_SAMERES; | 
 |  | } | 
 |  | c |= (dlgs_getdroplistnumber(hWnd, IDC_FULLSCREEN_ZOOM) & 3); | 
 |  | if (np2oscfg.fscrnmod != c) | 
 |  | { | 
 |  | np2oscfg.fscrnmod = c; | 
 |  | uUpdate |= SYS_UPDATEOSCFG; | 
 |  | } | 
 |  | sysmng_update(uUpdate); | 
 |  | return(TRUE); | 
 |  | } | 
 |  | break; | 
 |  | } | 
 |  | return(FALSE); | 
 |  | } | 
 |  |  | 
 | void dialog_scropt(HWND hWnd) { | void dialog_scropt(HWND hWnd) { | 
 |  |  | 
 | HINSTANCE               hinst; | HINSTANCE               hinst; | 
 | PROPSHEETPAGE   psp; | PROPSHEETPAGE   psp; | 
 | PROPSHEETHEADER psh; | PROPSHEETHEADER psh; | 
| HPROPSHEETPAGE  hpsp[3]; | HPROPSHEETPAGE  hpsp[4]; | 
 |  |  | 
| hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE); | hinst = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE); | 
 |  |  | 
 | ZeroMemory(&psp, sizeof(psp)); | ZeroMemory(&psp, sizeof(psp)); | 
 | psp.dwSize = sizeof(PROPSHEETPAGE); | psp.dwSize = sizeof(PROPSHEETPAGE); | 
| Line 285  void dialog_scropt(HWND hWnd) { | Line 353  void dialog_scropt(HWND hWnd) { | 
 | psp.pfnDlgProc = (DLGPROC)Scropt3DlgProc; | psp.pfnDlgProc = (DLGPROC)Scropt3DlgProc; | 
 | hpsp[2] = CreatePropertySheetPage(&psp); | hpsp[2] = CreatePropertySheetPage(&psp); | 
 |  |  | 
 |  | psp.pszTemplate = MAKEINTRESOURCE(IDD_SCROPT_FULLSCREEN); | 
 |  | psp.pfnDlgProc = (DLGPROC)ScroptFullScreenDlgProc; | 
 |  | hpsp[3] = CreatePropertySheetPage(&psp); | 
 |  |  | 
 | ZeroMemory(&psh, sizeof(psh)); | ZeroMemory(&psh, sizeof(psh)); | 
 | psh.dwSize = sizeof(PROPSHEETHEADER); | psh.dwSize = sizeof(PROPSHEETHEADER); | 
 | psh.dwFlags = PSH_NOAPPLYNOW | PSH_USEHICON | PSH_USECALLBACK; | psh.dwFlags = PSH_NOAPPLYNOW | PSH_USEHICON | PSH_USECALLBACK; | 
 | psh.hwndParent = hWnd; | psh.hwndParent = hWnd; | 
 | psh.hInstance = hinst; | psh.hInstance = hinst; | 
 | psh.hIcon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_ICON2)); | psh.hIcon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_ICON2)); | 
| psh.nPages = 3; | psh.nPages = 4; | 
 | psh.phpage = hpsp; | psh.phpage = hpsp; | 
 | psh.pszCaption = str_scropt; | psh.pszCaption = str_scropt; | 
 | psh.pfnCallback = np2class_propetysheet; | psh.pfnCallback = np2class_propetysheet; |