| version 1.17, 2005/03/20 13:12:50 | version 1.22, 2007/11/11 11:00:02 | 
| Line 1 | Line 1 | 
 | #include        "compiler.h" | #include        "compiler.h" | 
 | #include        <windowsx.h> |  | 
 | #include        <commctrl.h> | #include        <commctrl.h> | 
 | #include        <prsht.h> | #include        <prsht.h> | 
 | #include        "strres.h" | #include        "strres.h" | 
| Line 21 | Line 20 | 
 | #include        "dipswbmp.h" | #include        "dipswbmp.h" | 
 |  |  | 
 |  |  | 
| static const TCHAR str_0088[] = _T("0088"); | static const CBPARAM cpIO26[] = | 
| static const TCHAR str_0188[] = _T("0188"); | { | 
| static const TCHAR str_0288[] = _T("0288"); | {MAKEINTRESOURCE(IDS_0088),             0x00}, | 
| static const TCHAR str_0388[] = _T("0388"); | {MAKEINTRESOURCE(IDS_0188),             0x10}, | 
| static const TCHAR str_c8000[] = _T("C8000"); | }; | 
| static const TCHAR str_cc000[] = _T("CC000"); |  | 
| static const TCHAR str_d0000[] = _T("D0000"); | static const CBPARAM cpIO86[] = | 
| static const TCHAR str_d4000[] = _T("D4000"); | { | 
| static const TCHAR str_n0x[] = _T("0x"); | {MAKEINTRESOURCE(IDS_0188),             0x01}, | 
| static const TCHAR str_n1x[] = _T("1x"); | {MAKEINTRESOURCE(IDS_0288),             0x00}, | 
| static const TCHAR str_n2x[] = _T("2x"); | }; | 
| static const TCHAR str_n3x[] = _T("3x"); |  | 
| static const TCHAR str_n4x[] = _T("4x"); | static const CBPARAM cpInt26[] = | 
| static const TCHAR str_n5x[] = _T("5x"); | { | 
| static const TCHAR str_n6x[] = _T("6x"); | {MAKEINTRESOURCE(IDS_INT0),             0x00}, | 
| static const TCHAR str_n7x[] = _T("7x"); | {MAKEINTRESOURCE(IDS_INT41),    0x80}, | 
| static const TCHAR *sndioport[4] = | {MAKEINTRESOURCE(IDS_INT5),             0xc0}, | 
| {str_0088, str_0188, str_0288, str_0388}; | {MAKEINTRESOURCE(IDS_INT6),             0x40}, | 
| static const TCHAR *sndinterrupt[4] = | }; | 
| {str_int0, str_int4, str_int5, str_int6}; |  | 
| static const TCHAR *sndromaddr[5] = | static const CBPARAM cpInt86[] = | 
| {str_c8000, str_cc000, str_d0000, str_d4000, str_nc}; | { | 
| static const TCHAR *sndid[8] = | {MAKEINTRESOURCE(IDS_INT0),             0x00}, | 
| {str_n0x, str_n1x, str_n2x, str_n3x, | {MAKEINTRESOURCE(IDS_INT41),    0x08}, | 
| str_n4x, str_n5x, str_n6x, str_n7x}; | {MAKEINTRESOURCE(IDS_INT5),             0x0c}, | 
|  | {MAKEINTRESOURCE(IDS_INT6),             0x04}, | 
|  | }; | 
|  |  | 
|  | static const CBPARAM cpAddr[] = | 
|  | { | 
|  | {MAKEINTRESOURCE(IDS_C8000),            0x00}, | 
|  | {MAKEINTRESOURCE(IDS_CC000),            0x01}, | 
|  | {MAKEINTRESOURCE(IDS_D0000),            0x02}, | 
|  | {MAKEINTRESOURCE(IDS_D4000),            0x03}, | 
|  | {MAKEINTRESOURCE(IDS_NONCONNECT),       0x04}, | 
|  | }; | 
|  |  | 
|  | static const CBPARAM cpID[] = | 
|  | { | 
|  | {MAKEINTRESOURCE(IDS_0X),       0xe0}, | 
|  | {MAKEINTRESOURCE(IDS_1X),       0xc0}, | 
|  | {MAKEINTRESOURCE(IDS_2X),       0xa0}, | 
|  | {MAKEINTRESOURCE(IDS_3X),       0x80}, | 
|  | {MAKEINTRESOURCE(IDS_4X),       0x60}, | 
|  | {MAKEINTRESOURCE(IDS_5X),       0x40}, | 
|  | {MAKEINTRESOURCE(IDS_6X),       0x20}, | 
|  | {MAKEINTRESOURCE(IDS_7X),       0x00}, | 
|  | }; | 
 |  |  | 
 | static const TCHAR str_sndopt[] = _T("Sound board option"); | static const TCHAR str_sndopt[] = _T("Sound board option"); | 
 |  |  | 
| Line 234  static LRESULT CALLBACK Snd14optDlgProc( | Line 256  static LRESULT CALLBACK Snd14optDlgProc( | 
 |  |  | 
 | // ---- 26K, SPB jumper | // ---- 26K, SPB jumper | 
 |  |  | 
| static const UINT snd26paranum[4] = {0, 3, 1, 2}; | static void setsnd26io(HWND hWnd, UINT uID, UINT8 cValue) | 
|  | { | 
| static void setsnd26iopara(HWND hWnd, UINT8 value) { | dlgs_setcbcur(hWnd, uID, cValue & 0x10); | 
|  |  | 
| SendMessage(hWnd, CB_SETCURSEL, (WPARAM)((value >> 4) & 1), (LPARAM)0); |  | 
 | } | } | 
 |  |  | 
| static UINT8 getsnd26io(HWND hWnd, UINT16 res) { | static UINT8 getsnd26io(HWND hWnd, UINT uID) | 
|  | { | 
| TCHAR   work[8]; | return dlgs_getcbcur(hWnd, uID, 0x10); | 
|  |  | 
| GetDlgItemText(hWnd, res, work, NELEMENTS(work)); |  | 
| return((UINT8)((work[1] == '1')?0x10:0x00)); |  | 
 | } | } | 
 |  |  | 
| static void setsnd26intpara(HWND hWnd, UINT8 value) { | static void setsnd26int(HWND hWnd, UINT uID, UINT8 cValue) | 
|  | { | 
| SendMessage(hWnd, CB_SETCURSEL, | dlgs_setcbcur(hWnd, uID, cValue & 0xc0); | 
| (WPARAM)snd26paranum[(value >> 6) & 3], (LPARAM)0); |  | 
 | } | } | 
 |  |  | 
| static UINT8 getsnd26int(HWND hWnd, UINT16 res) { | static UINT8 getsnd26int(HWND hWnd, UINT uID) | 
|  | { | 
| TCHAR   work[8]; | return dlgs_getcbcur(hWnd, uID, 0xc0); | 
|  |  | 
| GetDlgItemText(hWnd, res, work, NELEMENTS(work)); |  | 
| switch(work[3]) { |  | 
| case '0': |  | 
| return(0x00); |  | 
|  |  | 
| case '4': |  | 
| return(0x80); |  | 
|  |  | 
| case '6': |  | 
| return(0x40); |  | 
| } |  | 
| return(0xc0); |  | 
 | } | } | 
 |  |  | 
| static void setsnd26rompara(HWND hWnd, UINT8 value) { | static void setsnd26rom(HWND hWnd, UINT uID, UINT8 cValue) | 
|  | { | 
| int             para; | UINT    uParam; | 
 |  |  | 
| para = value & 7; | uParam = cValue & 0x07; | 
| if (para > 4) { | uParam = min(uParam, 0x04); | 
| para = 4; | dlgs_setcbcur(hWnd, uID, uParam); | 
| } |  | 
| SendMessage(hWnd, CB_SETCURSEL, (WPARAM)para, (LPARAM)0); |  | 
 | } | } | 
 |  |  | 
| static UINT8 getsnd26rom(HWND hWnd, UINT16 res) { | static UINT8 getsnd26rom(HWND hWnd, UINT uID) | 
|  | { | 
| TCHAR   work[8]; | return dlgs_getcbcur(hWnd, uID, 0x04); | 
| UINT32  adrs; |  | 
|  |  | 
| GetDlgItemText(hWnd, res, work, NELEMENTS(work)); |  | 
| adrs = ((UINT32)miltchar_solveHEX(work) - 0xc8000) >> 14; |  | 
| if (adrs < 4) { |  | 
| return((UINT8)adrs); |  | 
| } |  | 
| return(4); |  | 
 | } | } | 
 |  |  | 
 |  |  | 
| Line 302  static UINT8 getsnd26rom(HWND hWnd, UINT | Line 295  static UINT8 getsnd26rom(HWND hWnd, UINT | 
 |  |  | 
 | static  UINT8   snd26 = 0; | static  UINT8   snd26 = 0; | 
 |  |  | 
 |  | static void snd26set(HWND hWnd, UINT8 cValue) | 
 |  | { | 
 |  | setsnd26io(hWnd, IDC_SND26IO, cValue); | 
 |  | setsnd26int(hWnd, IDC_SND26INT, cValue); | 
 |  | setsnd26rom(hWnd, IDC_SND26ROM, cValue); | 
 |  | } | 
 |  |  | 
 | static void set26jmp(HWND hWnd, UINT8 value, UINT8 bit) { | static void set26jmp(HWND hWnd, UINT8 value, UINT8 bit) { | 
 |  |  | 
 | if ((snd26 ^ value) & bit) { | if ((snd26 ^ value) & bit) { | 
| Line 336  static void snd26cmdjmp(HWND hWnd) { | Line 336  static void snd26cmdjmp(HWND hWnd) { | 
 | if ((snd26 ^ b) & 7) { | if ((snd26 ^ b) & 7) { | 
 | snd26 &= ~0x07; | snd26 &= ~0x07; | 
 | snd26 |= b; | snd26 |= b; | 
| setsnd26rompara(GetDlgItem(hWnd, IDC_SND26ROM), b); | setsnd26rom(hWnd, IDC_SND26ROM, b); | 
 | redraw = TRUE; | redraw = TRUE; | 
 | } | } | 
 | } | } | 
| Line 358  static void snd26cmdjmp(HWND hWnd) { | Line 358  static void snd26cmdjmp(HWND hWnd) { | 
 | } | } | 
 | if (snd26 != b) { | if (snd26 != b) { | 
 | snd26 = b; | snd26 = b; | 
| setsnd26intpara(GetDlgItem(hWnd, IDC_SND26INT), b); | setsnd26int(hWnd, IDC_SND26INT, b); | 
 | redraw = TRUE; | redraw = TRUE; | 
 | } | } | 
 | } | } | 
| Line 367  static void snd26cmdjmp(HWND hWnd) { | Line 367  static void snd26cmdjmp(HWND hWnd) { | 
 | if ((snd26 ^ b) & 0x10) { | if ((snd26 ^ b) & 0x10) { | 
 | snd26 &= ~0x10; | snd26 &= ~0x10; | 
 | snd26 |= b; | snd26 |= b; | 
| setsnd26iopara(GetDlgItem(hWnd, IDC_SND26IO), b); | setsnd26io(hWnd, IDC_SND26IO, b); | 
 | redraw = TRUE; | redraw = TRUE; | 
 | } | } | 
 | } | } | 
| Line 384  static LRESULT CALLBACK Snd26optDlgProc( | Line 384  static LRESULT CALLBACK Snd26optDlgProc( | 
 | switch(msg) { | switch(msg) { | 
 | case WM_INITDIALOG: | case WM_INITDIALOG: | 
 | snd26 = np2cfg.snd26opt; | snd26 = np2cfg.snd26opt; | 
| SETnLISTSTR(hWnd, IDC_SND26IO, sndioport, 2); | dlgs_setcbitem(hWnd, IDC_SND26IO, cpIO26, NELEMENTS(cpIO26)); | 
| setsnd26iopara(GetDlgItem(hWnd, IDC_SND26IO), snd26); | dlgs_setcbitem(hWnd, IDC_SND26INT, cpInt26, NELEMENTS(cpInt26)); | 
| SETLISTSTR(hWnd, IDC_SND26INT, sndinterrupt); | dlgs_setcbitem(hWnd, IDC_SND26ROM, cpAddr, NELEMENTS(cpAddr)); | 
| setsnd26intpara(GetDlgItem(hWnd, IDC_SND26INT), snd26); | snd26set(hWnd, snd26); | 
| SETLISTSTR(hWnd, IDC_SND26ROM, sndromaddr); |  | 
| setsnd26rompara(GetDlgItem(hWnd, IDC_SND26ROM), snd26); |  | 
 | sub = GetDlgItem(hWnd, IDC_SND26JMP); | sub = GetDlgItem(hWnd, IDC_SND26JMP); | 
 | SetWindowLong(sub, GWL_STYLE, SS_OWNERDRAW + | SetWindowLong(sub, GWL_STYLE, SS_OWNERDRAW + | 
 | (GetWindowLong(sub, GWL_STYLE) & (~SS_TYPEMASK))); | (GetWindowLong(sub, GWL_STYLE) & (~SS_TYPEMASK))); | 
| Line 411  static LRESULT CALLBACK Snd26optDlgProc( | Line 409  static LRESULT CALLBACK Snd26optDlgProc( | 
 |  |  | 
 | case IDC_SND26DEF: | case IDC_SND26DEF: | 
 | snd26 = 0xd1; | snd26 = 0xd1; | 
| setsnd26iopara(GetDlgItem(hWnd, IDC_SND26IO), snd26); | snd26set(hWnd, snd26); | 
| setsnd26intpara(GetDlgItem(hWnd, IDC_SND26INT), snd26); |  | 
| setsnd26rompara(GetDlgItem(hWnd, IDC_SND26ROM), snd26); |  | 
 | InvalidateRect(GetDlgItem(hWnd, IDC_SND26JMP), NULL, TRUE); | InvalidateRect(GetDlgItem(hWnd, IDC_SND26JMP), NULL, TRUE); | 
 | break; | break; | 
 |  |  | 
| Line 438  static LRESULT CALLBACK Snd26optDlgProc( | Line 434  static LRESULT CALLBACK Snd26optDlgProc( | 
 | dlgs_drawbmp(((LPDRAWITEMSTRUCT)lp)->hDC, | dlgs_drawbmp(((LPDRAWITEMSTRUCT)lp)->hDC, | 
 | dipswbmp_getsnd26(snd26)); | dipswbmp_getsnd26(snd26)); | 
 | } | } | 
| return(FALSE); | break; | 
 | } | } | 
 | return(FALSE); | return(FALSE); | 
 | } | } | 
| Line 448  static LRESULT CALLBACK Snd26optDlgProc( | Line 444  static LRESULT CALLBACK Snd26optDlgProc( | 
 |  |  | 
 | static  UINT8   snd86 = 0; | static  UINT8   snd86 = 0; | 
 |  |  | 
| static const UINT snd86paranum[4] = {0, 1, 3, 2}; | static void setsnd86io(HWND hWnd, UINT uID, UINT8 cValue) | 
|  | { | 
|  | dlgs_setcbcur(hWnd, uID, cValue & 0x01); | 
| static void setsnd86iopara(HWND hWnd, UINT8 value) { |  | 
|  |  | 
| SendMessage(hWnd, CB_SETCURSEL, (WPARAM)((~value) & 1), (LPARAM)0); |  | 
 | } | } | 
 |  |  | 
| static UINT8 getsnd86io(HWND hWnd, UINT16 res) { | static UINT8 getsnd86io(HWND hWnd, UINT uID) | 
|  | { | 
| TCHAR   work[8]; | return dlgs_getcbcur(hWnd, uID, 0x01); | 
|  |  | 
| GetDlgItemText(hWnd, res, work, NELEMENTS(work)); |  | 
| return((UINT8)((work[1] == '1')?0x01:0x00)); |  | 
 | } | } | 
 |  |  | 
| static void setsnd86intpara(HWND hWnd, UINT8 value) { | static void setsnd86int(HWND hWnd, UINT uID, UINT8 cValue) | 
|  | { | 
| SendMessage(hWnd, CB_SETCURSEL, | dlgs_setcbcur(hWnd, uID, cValue & 0x0c); | 
| (WPARAM)snd86paranum[(value >> 2) & 3], (LPARAM)0); |  | 
 | } | } | 
 |  |  | 
| static UINT8 getsnd86int(HWND hWnd) { | static UINT8 getsnd86int(HWND hWnd, INT uID) | 
|  | { | 
| TCHAR   work[8]; | return dlgs_getcbcur(hWnd, uID, 0x0c); | 
|  |  | 
| Edit_GetText(hWnd, work, NELEMENTS(work)); |  | 
| switch(work[3]) { |  | 
| case '0': |  | 
| return(0x00); |  | 
|  |  | 
| case '4': |  | 
| return(0x04); |  | 
|  |  | 
| case '6': |  | 
| return(0x08); |  | 
| } |  | 
| return(0x0c); |  | 
 | } | } | 
 |  |  | 
| static void setsnd86idpara(HWND hWnd, UINT8 value) { | static void setsnd86id(HWND hWnd, UINT uID, UINT8 cValue) | 
|  | { | 
| SendMessage(hWnd, CB_SETCURSEL, (WPARAM)(((~value) >> 5) & 7), (LPARAM)0); | dlgs_setcbcur(hWnd, uID, cValue & 0xe0); | 
 | } | } | 
 |  |  | 
| static UINT8 getsnd86id(HWND hWnd) { | static UINT8 getsnd86id(HWND hWnd, UINT uID) | 
|  | { | 
| TCHAR   work[8]; | return dlgs_getcbcur(hWnd, uID, 0x00); | 
|  |  | 
| Edit_GetText(hWnd, work, NELEMENTS(work)); |  | 
| return((~work[0] & 7) << 5); |  | 
 | } | } | 
 |  |  | 
 | static void set86jmp(HWND hWnd, UINT8 value, UINT8 bit) { | static void set86jmp(HWND hWnd, UINT8 value, UINT8 bit) { | 
| Line 531  static void snd86cmddipsw(HWND hWnd) { | Line 504  static void snd86cmddipsw(HWND hWnd) { | 
 | snd86 ^= (1 << p.x); | snd86 ^= (1 << p.x); | 
 | switch(p.x) { | switch(p.x) { | 
 | case 0: | case 0: | 
| setsnd86iopara(GetDlgItem(hWnd, IDC_SND86IO), snd86); | setsnd86io(hWnd, IDC_SND86IO, snd86); | 
 | break; | break; | 
 |  |  | 
 | case 1: | case 1: | 
| Button_SetCheck(GetDlgItem(hWnd, IDC_SND86ROM), snd86 & 2); | SetDlgItemCheck(hWnd, IDC_SND86ROM, snd86 & 2); | 
 | break; | break; | 
 |  |  | 
 | case 2: | case 2: | 
 | case 3: | case 3: | 
| setsnd86intpara(GetDlgItem(hWnd, IDC_SND86INTA), snd86); | setsnd86int(hWnd, IDC_SND86INTA, snd86); | 
 | break; | break; | 
 |  |  | 
 | case 4: | case 4: | 
| Button_SetCheck(GetDlgItem(hWnd, IDC_SND86INT), snd86 & 0x10); | SetDlgItemCheck(hWnd, IDC_SND86INT, snd86 & 0x10); | 
 | break; | break; | 
 |  |  | 
 | case 5: | case 5: | 
 | case 6: | case 6: | 
 | case 7: | case 7: | 
| setsnd86idpara(GetDlgItem(hWnd, IDC_SND86ID), snd86); | setsnd86id(hWnd, IDC_SND86ID, snd86); | 
 | break; | break; | 
 | } | } | 
 | InvalidateRect(GetDlgItem(hWnd, IDC_SND86DIP), NULL, TRUE); | InvalidateRect(GetDlgItem(hWnd, IDC_SND86DIP), NULL, TRUE); | 
| Line 564  static LRESULT CALLBACK Snd86optDlgProc( | Line 537  static LRESULT CALLBACK Snd86optDlgProc( | 
 | switch(msg) { | switch(msg) { | 
 | case WM_INITDIALOG: | case WM_INITDIALOG: | 
 | snd86 = np2cfg.snd86opt; | snd86 = np2cfg.snd86opt; | 
| SETnLISTSTR(hWnd, IDC_SND86IO, sndioport+1, 2); | dlgs_setcbitem(hWnd, IDC_SND86IO, cpIO86, NELEMENTS(cpIO86)); | 
| setsnd86iopara(GetDlgItem(hWnd, IDC_SND86IO), snd86); | setsnd86io(hWnd, IDC_SND86IO, snd86); | 
| Button_SetCheck(GetDlgItem(hWnd, IDC_SND86INT), snd86 & 0x10); | SetDlgItemCheck(hWnd, IDC_SND86INT, snd86 & 0x10); | 
| SETLISTSTR(hWnd, IDC_SND86INTA, sndinterrupt); | dlgs_setcbitem(hWnd, IDC_SND86INTA, cpInt86, NELEMENTS(cpInt86)); | 
| setsnd86intpara(GetDlgItem(hWnd, IDC_SND86INTA), snd86); | setsnd86int(hWnd, IDC_SND86INTA, snd86); | 
| SETLISTSTR(hWnd, IDC_SND86ID, sndid); | dlgs_setcbitem(hWnd, IDC_SND86ID, cpID, NELEMENTS(cpID)); | 
| setsnd86idpara(GetDlgItem(hWnd, IDC_SND86ID), snd86); | setsnd86id(hWnd, IDC_SND86ID, snd86); | 
| Button_SetCheck(GetDlgItem(hWnd, IDC_SND86ROM), snd86 & 2); | SetDlgItemCheck(hWnd, IDC_SND86ROM, snd86 & 2); | 
 |  |  | 
 | sub = GetDlgItem(hWnd, IDC_SND86DIP); | sub = GetDlgItem(hWnd, IDC_SND86DIP); | 
 | SetWindowLong(sub, GWL_STYLE, SS_OWNERDRAW + | SetWindowLong(sub, GWL_STYLE, SS_OWNERDRAW + | 
| Line 583  static LRESULT CALLBACK Snd86optDlgProc( | Line 556  static LRESULT CALLBACK Snd86optDlgProc( | 
 | case IDC_SND86IO: | case IDC_SND86IO: | 
 | set86jmp(hWnd, getsnd86io(hWnd, IDC_SND86IO), 0x01); | set86jmp(hWnd, getsnd86io(hWnd, IDC_SND86IO), 0x01); | 
 | break; | break; | 
 |  |  | 
 | case IDC_SND86INT: | case IDC_SND86INT: | 
 | set86jmp(hWnd, | set86jmp(hWnd, | 
| ((Button_GetCheck(GetDlgItem(hWnd, IDC_SND86INT))) | (GetDlgItemCheck(hWnd, IDC_SND86INT))?0x10:0x00, | 
| ?0x10:0x00), 0x10); | 0x10); | 
 | break; | break; | 
 |  |  | 
 | case IDC_SND86INTA: | case IDC_SND86INTA: | 
| set86jmp(hWnd, | set86jmp(hWnd, getsnd86int(hWnd, IDC_SND86INTA), 0x0c); | 
| getsnd86int(GetDlgItem(hWnd, IDC_SND86INTA)), 0x0c); |  | 
 | break; | break; | 
 |  |  | 
 | case IDC_SND86ROM: | case IDC_SND86ROM: | 
 | set86jmp(hWnd, | set86jmp(hWnd, | 
| ((Button_GetCheck(GetDlgItem(hWnd, IDC_SND86ROM))) | (GetDlgItemCheck(hWnd, IDC_SND86ROM))?0x02:0x00, | 
| ?0x02:0x00), 0x02); | 0x02); | 
 | break; | break; | 
 |  |  | 
 | case IDC_SND86ID: | case IDC_SND86ID: | 
| set86jmp(hWnd, | set86jmp(hWnd, getsnd86id(hWnd, IDC_SND86ID), 0xe0); | 
| getsnd86id(GetDlgItem(hWnd, IDC_SND86ID)), 0xe0); |  | 
 | break; | break; | 
 |  |  | 
 | case IDC_SND86DEF: | case IDC_SND86DEF: | 
 | snd86 = 0x7f; | snd86 = 0x7f; | 
| setsnd86iopara(GetDlgItem(hWnd, IDC_SND86IO), snd86); | setsnd86io(hWnd, IDC_SND86IO, snd86); | 
| Button_SetCheck(GetDlgItem(hWnd, IDC_SND86INT), TRUE); | SetDlgItemCheck(hWnd, IDC_SND86INT, TRUE); | 
| setsnd86intpara(GetDlgItem(hWnd, IDC_SND86INTA), snd86); | setsnd86int(hWnd, IDC_SND86INTA, snd86); | 
| setsnd86idpara(GetDlgItem(hWnd, IDC_SND86ID), snd86); | setsnd86id(hWnd, IDC_SND86ID, snd86); | 
| Button_SetCheck(GetDlgItem(hWnd, IDC_SND86ROM), TRUE); | SetDlgItemCheck(hWnd, IDC_SND86ROM, TRUE); | 
 | InvalidateRect(GetDlgItem(hWnd, IDC_SND86DIP), NULL, TRUE); | InvalidateRect(GetDlgItem(hWnd, IDC_SND86DIP), NULL, TRUE); | 
 | break; | break; | 
 |  |  | 
| Line 646  static UINT8 spbvrc = 0; | Line 621  static UINT8 spbvrc = 0; | 
 |  |  | 
 | static void setspbVRch(HWND hWnd) { | static void setspbVRch(HWND hWnd) { | 
 |  |  | 
| Button_SetCheck(GetDlgItem(hWnd, IDC_SPBVRL), spbvrc & 1); | SetDlgItemCheck(hWnd, IDC_SPBVRL, spbvrc & 1); | 
| Button_SetCheck(GetDlgItem(hWnd, IDC_SPBVRR), spbvrc & 2); | SetDlgItemCheck(hWnd, IDC_SPBVRR, spbvrc & 2); | 
 | } | } | 
 |  |  | 
| static void spbcreate(HWND hWnd) { | static void spbcreate(HWND hWnd) | 
|  | { | 
 | HWND    sub; | HWND    sub; | 
 |  |  | 
 | spb = np2cfg.spbopt; | spb = np2cfg.spbopt; | 
| SETnLISTSTR(hWnd, IDC_SPBIO, sndioport, 2); |  | 
| setsnd26iopara(GetDlgItem(hWnd, IDC_SPBIO), spb); | dlgs_setcbitem(hWnd, IDC_SPBIO, cpIO26, NELEMENTS(cpIO26)); | 
| SETLISTSTR(hWnd, IDC_SPBINT, sndinterrupt); | setsnd26io(hWnd, IDC_SPBIO, spb); | 
| setsnd26intpara(GetDlgItem(hWnd, IDC_SPBINT), spb); | dlgs_setcbitem(hWnd, IDC_SPBINT, cpInt26, NELEMENTS(cpInt26)); | 
| SETLISTSTR(hWnd, IDC_SPBROM, sndromaddr); | setsnd26int(hWnd, IDC_SPBINT, spb); | 
| setsnd26rompara(GetDlgItem(hWnd, IDC_SPBROM), spb); | dlgs_setcbitem(hWnd, IDC_SPBROM, cpAddr, NELEMENTS(cpAddr)); | 
|  | setsnd26rom(hWnd, IDC_SPBROM, spb); | 
 | spbvrc = np2cfg.spb_vrc;                                                                // ver0.30 | spbvrc = np2cfg.spb_vrc;                                                                // ver0.30 | 
 | setspbVRch(hWnd); | setspbVRch(hWnd); | 
 | SendDlgItemMessage(hWnd, IDC_SPBVRLEVEL, TBM_SETRANGE, TRUE, | SendDlgItemMessage(hWnd, IDC_SPBVRLEVEL, TBM_SETRANGE, TRUE, | 
 | MAKELONG(0, 24)); | MAKELONG(0, 24)); | 
 | SendDlgItemMessage(hWnd, IDC_SPBVRLEVEL, TBM_SETPOS, TRUE, | SendDlgItemMessage(hWnd, IDC_SPBVRLEVEL, TBM_SETPOS, TRUE, | 
 | np2cfg.spb_vrl); | np2cfg.spb_vrl); | 
| Button_SetCheck(GetDlgItem(hWnd, IDC_SPBREVERSE), np2cfg.spb_x); | SetDlgItemCheck(hWnd, IDC_SPBREVERSE, np2cfg.spb_x); | 
 |  |  | 
 | sub = GetDlgItem(hWnd, IDC_SPBJMP); | sub = GetDlgItem(hWnd, IDC_SPBJMP); | 
 | SetWindowLong(sub, GWL_STYLE, SS_OWNERDRAW + | SetWindowLong(sub, GWL_STYLE, SS_OWNERDRAW + | 
| Line 712  static void spbcmdjmp(HWND hWnd) { | Line 688  static void spbcmdjmp(HWND hWnd) { | 
 | } | } | 
 | if (spb != b) { | if (spb != b) { | 
 | spb = b; | spb = b; | 
| setsnd26intpara(GetDlgItem(hWnd, IDC_SPBINT), b); | setsnd26int(hWnd, IDC_SPBINT, b); | 
 | redraw = TRUE; | redraw = TRUE; | 
 | } | } | 
 | } | } | 
| Line 725  static void spbcmdjmp(HWND hWnd) { | Line 701  static void spbcmdjmp(HWND hWnd) { | 
 | if ((spb ^ b) & 0x10) { | if ((spb ^ b) & 0x10) { | 
 | spb &= ~0x10; | spb &= ~0x10; | 
 | spb |= b; | spb |= b; | 
| setsnd26iopara(GetDlgItem(hWnd, IDC_SPBIO), b); | setsnd26io(hWnd, IDC_SPBIO, b); | 
 | redraw = TRUE; | redraw = TRUE; | 
 | } | } | 
 | } | } | 
| Line 734  static void spbcmdjmp(HWND hWnd) { | Line 710  static void spbcmdjmp(HWND hWnd) { | 
 | if ((spb ^ b) & 7) { | if ((spb ^ b) & 7) { | 
 | spb &= ~0x07; | spb &= ~0x07; | 
 | spb |= b; | spb |= b; | 
| setsnd26rompara(GetDlgItem(hWnd, IDC_SPBROM), b); | setsnd26rom(hWnd, IDC_SPBROM, b); | 
 | redraw = TRUE; | redraw = TRUE; | 
 | } | } | 
 | } | } | 
| Line 762  static UINT8 getspbVRch(HWND hWnd) { | Line 738  static UINT8 getspbVRch(HWND hWnd) { | 
 | UINT8   ret; | UINT8   ret; | 
 |  |  | 
 | ret = 0; | ret = 0; | 
| if (Button_GetCheck(GetDlgItem(hWnd, IDC_SPBVRL))) { | if (GetDlgItemCheck(hWnd, IDC_SPBVRL)) { | 
| ret++; | ret += 1; | 
 | } | } | 
| if (Button_GetCheck(GetDlgItem(hWnd, IDC_SPBVRR))) { | if (GetDlgItemCheck(hWnd, IDC_SPBVRR)) { | 
 | ret += 2; | ret += 2; | 
 | } | } | 
 | return(ret); | return(ret); | 
| Line 797  static LRESULT CALLBACK SPBoptDlgProc(HW | Line 773  static LRESULT CALLBACK SPBoptDlgProc(HW | 
 |  |  | 
 | case IDC_SPBDEF: | case IDC_SPBDEF: | 
 | spb = 0xd1; | spb = 0xd1; | 
| setsnd26iopara(GetDlgItem(hWnd, IDC_SPBIO), spb); | setsnd26io(hWnd, IDC_SPBIO, spb); | 
| setsnd26intpara(GetDlgItem(hWnd, IDC_SPBINT), spb); | setsnd26int(hWnd, IDC_SPBINT, spb); | 
| setsnd26rompara(GetDlgItem(hWnd, IDC_SPBROM), spb); | setsnd26rom(hWnd, IDC_SPBROM, spb); | 
 | spbvrc = 0; | spbvrc = 0; | 
 | setspbVRch(hWnd); | setspbVRch(hWnd); | 
 | InvalidateRect(GetDlgItem(hWnd, IDC_SPBJMP), NULL, TRUE); | InvalidateRect(GetDlgItem(hWnd, IDC_SPBJMP), NULL, TRUE); | 
| Line 839  static LRESULT CALLBACK SPBoptDlgProc(HW | Line 815  static LRESULT CALLBACK SPBoptDlgProc(HW | 
 | update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; | 
 | } | } | 
 | opngen_setVR(np2cfg.spb_vrc, np2cfg.spb_vrl); | opngen_setVR(np2cfg.spb_vrc, np2cfg.spb_vrl); | 
| b = (UINT8)(Button_GetCheck(GetDlgItem(hWnd, IDC_SPBREVERSE)) | b = (UINT8)GetDlgItemCheck(hWnd, IDC_SPBREVERSE); | 
| ?1:0); |  | 
 | if (np2cfg.spb_x != b) { | if (np2cfg.spb_x != b) { | 
 | np2cfg.spb_x = b; | np2cfg.spb_x = b; | 
 | update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; | 
| Line 887  static const CHECKTBL pad1opt[13] = { | Line 862  static const CHECKTBL pad1opt[13] = { | 
 |  |  | 
 | static void checkbtnres_load(HWND hWnd, const CHECKTBL *item) { | static void checkbtnres_load(HWND hWnd, const CHECKTBL *item) { | 
 |  |  | 
| Button_SetCheck(GetDlgItem(hWnd, item->res), | SetDlgItemCheck(hWnd, item->res, (*(item->ptr)) & (1 << (item->bit))); | 
| (*(item->ptr)) & (1 << (item->bit))); |  | 
 | } | } | 
 |  |  | 
 | static UINT8 checkbtnres_store(HWND hWnd, const CHECKTBL *item) { | static UINT8 checkbtnres_store(HWND hWnd, const CHECKTBL *item) { | 
| Line 898  static UINT8 checkbtnres_store(HWND hWnd | Line 872  static UINT8 checkbtnres_store(HWND hWnd | 
 | UINT8   ret; | UINT8   ret; | 
 |  |  | 
 | bit = 1 << (item->bit); | bit = 1 << (item->bit); | 
| value = ((Button_GetCheck(GetDlgItem(hWnd, item->res)))?0xff:0) & bit; | value = GetDlgItemCheck(hWnd, item->res)?bit:0; | 
 | ret = ((*(item->ptr)) ^ value) & bit; | ret = ((*(item->ptr)) ^ value) & bit; | 
 | if (ret) { | if (ret) { | 
 | (*(item->ptr)) ^= bit; | (*(item->ptr)) ^= bit; | 
| Line 918  static LRESULT CALLBACK PAD1optDlgProc(H | Line 892  static LRESULT CALLBACK PAD1optDlgProc(H | 
 | checkbtnres_load(hWnd, pad1opt + i); | checkbtnres_load(hWnd, pad1opt + i); | 
 | } | } | 
 | if (np2oscfg.JOYPAD1 & 2) { | if (np2oscfg.JOYPAD1 & 2) { | 
| Button_Enable(GetDlgItem(hWnd, IDC_JOYPAD1), FALSE); | EnableWindow(GetDlgItem(hWnd, IDC_JOYPAD1), FALSE); | 
 | } | } | 
 | return(TRUE); | return(TRUE); | 
 |  |  | 
| Line 949  void dialog_sndopt(HWND hWnd) { | Line 923  void dialog_sndopt(HWND hWnd) { | 
 | PROPSHEETHEADER psh; | PROPSHEETHEADER psh; | 
 | HPROPSHEETPAGE  hpsp[6]; | HPROPSHEETPAGE  hpsp[6]; | 
 |  |  | 
| 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 998  void dialog_sndopt(HWND hWnd) { | Line 972  void dialog_sndopt(HWND hWnd) { | 
 | // ---- | // ---- | 
 |  |  | 
 | #if defined(SUPPORT_S98) | #if defined(SUPPORT_S98) | 
 | static const OEMCHAR s98ui_file[] = OEMTEXT("NP2_%04d.S98"); |  | 
 | static const TCHAR s98ui_title[] = _T("Save as S98 log"); |  | 
 | static const TCHAR s98ui_ext[] = _T("s98"); |  | 
 | static const TCHAR s98ui_filter[] = _T("S98 log (*.s98)\0*.s98\0"); |  | 
 | static const FILESEL s98ui = {s98ui_title, s98ui_ext, s98ui_filter, 1}; |  | 
 |  |  | 
| void dialog_s98(HWND hWnd) { | static const FSPARAM fpS98 = | 
|  | { | 
| BOOL    check; | MAKEINTRESOURCE(IDS_S98TITLE), | 
| OEMCHAR path[MAX_PATH]; | MAKEINTRESOURCE(IDS_S98EXT), | 
|  | MAKEINTRESOURCE(IDS_S98FILTER), | 
|  | 1 | 
|  | }; | 
|  | static const OEMCHAR szS98File[] = OEMTEXT("NP2_####.S98"); | 
|  |  | 
|  | void dialog_s98(HWND hWnd) | 
|  | { | 
|  | BOOL    bCheck; | 
|  | OEMCHAR szPath[MAX_PATH]; | 
 |  |  | 
 | S98_close(); | S98_close(); | 
| check = FALSE; | bCheck = FALSE; | 
| file_cpyname(path, bmpfilefolder, NELEMENTS(path)); | file_cpyname(szPath, bmpfilefolder, NELEMENTS(szPath)); | 
| file_cutname(path); | file_cutname(szPath); | 
| file_catname(path, s98ui_file, NELEMENTS(path)); | file_catname(szPath, szS98File, NELEMENTS(szPath)); | 
| if ((dlgs_selectwritenum(hWnd, &s98ui, path, NELEMENTS(path))) && | if ((dlgs_createfilenum(hWnd, &fpS98, szPath, NELEMENTS(szPath))) && | 
| (S98_open(path) == SUCCESS)) { | (S98_open(szPath) == SUCCESS)) | 
| file_cpyname(bmpfilefolder, path, NELEMENTS(bmpfilefolder)); | { | 
|  | file_cpyname(bmpfilefolder, szPath, NELEMENTS(bmpfilefolder)); | 
 | sysmng_update(SYS_UPDATEOSCFG); | sysmng_update(SYS_UPDATEOSCFG); | 
| check = TRUE; | bCheck = TRUE; | 
 | } | } | 
| xmenu_sets98logging(check); | xmenu_sets98logging(bCheck); | 
 | } | } | 
| #endif | #endif  // defined(SUPPORT_S98) | 
 |  |  | 
 |  |  | 
 | // ---- | // ---- | 
 |  |  | 
 | #if defined(SUPPORT_WAVEREC) | #if defined(SUPPORT_WAVEREC) | 
 | static const OEMCHAR wrui_file[] = OEMTEXT("NP2_%04d.WAV"); |  | 
 | static const TCHAR wrui_title[] = _T("Save as Sound"); |  | 
 | static const TCHAR wrui_ext[] = _T("WAV"); |  | 
 | static const TCHAR wrui_filter[] = _T("Wave files (*.wav)\0*.wav\0"); |  | 
 | static const FILESEL wrui = {wrui_title, wrui_ext, wrui_filter, 1}; |  | 
 |  |  | 
 | void dialog_waverec(HWND hWnd) { |  | 
 |  |  | 
| UINT8   check; | static const FSPARAM fpWave = | 
| OEMCHAR path[MAX_PATH]; | { | 
|  | MAKEINTRESOURCE(IDS_WAVETITLE), | 
|  | MAKEINTRESOURCE(IDS_WAVEEXT), | 
|  | MAKEINTRESOURCE(IDS_WAVEFILTER), | 
|  | 1 | 
|  | }; | 
|  | static const OEMCHAR szWaveFile[] = OEMTEXT("NP2_####.WAV"); | 
|  |  | 
|  | void dialog_waverec(HWND hWnd) | 
|  | { | 
|  | UINT8   bCheck; | 
|  | OEMCHAR szPath[MAX_PATH]; | 
 |  |  | 
| check = FALSE; | bCheck = FALSE; | 
 | sound_recstop(); | sound_recstop(); | 
| file_cpyname(path, bmpfilefolder, NELEMENTS(path)); | file_cpyname(szPath, bmpfilefolder, NELEMENTS(szPath)); | 
| file_cutname(path); | file_cutname(szPath); | 
| file_catname(path, wrui_file, NELEMENTS(path)); | file_catname(szPath, szWaveFile, NELEMENTS(szPath)); | 
| if ((dlgs_selectwritenum(hWnd, &wrui, path, NELEMENTS(path))) && | if ((dlgs_createfilenum(hWnd, &fpWave, szPath, NELEMENTS(szPath))) && | 
| (sound_recstart(path) == SUCCESS)) { | (sound_recstart(szPath) == SUCCESS)) | 
| file_cpyname(bmpfilefolder, path, NELEMENTS(bmpfilefolder)); | { | 
|  | file_cpyname(bmpfilefolder, szPath, NELEMENTS(bmpfilefolder)); | 
 | sysmng_update(SYS_UPDATEOSCFG); | sysmng_update(SYS_UPDATEOSCFG); | 
| check = TRUE; | bCheck = TRUE; | 
 | } | } | 
| xmenu_setwaverec(check); | xmenu_setwaverec(bCheck); | 
 | } | } | 
| #endif | #endif  // defined(SUPPORT_WAVEREC) | 
 |  |  |