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