--- np2/win9x/dialog/d_sound.cpp 2003/11/04 19:23:03 1.9 +++ np2/win9x/dialog/d_sound.cpp 2005/03/20 13:12:50 1.17 @@ -5,6 +5,7 @@ #include "strres.h" #include "resource.h" #include "np2.h" +#include "oemtext.h" #include "dosio.h" #include "joymng.h" #include "sysmng.h" @@ -12,45 +13,66 @@ #include "np2class.h" #include "dialog.h" #include "dialogs.h" -#include "bit2res.h" #include "pccore.h" #include "iocore.h" #include "sound.h" #include "fmboard.h" #include "s98.h" +#include "dipswbmp.h" -static const char *sndioport[4] = {"0088", "0188", "0288", "0388"}; -static const char *sndinterrupt[4] = {str_int0, str_int4, str_int5, str_int6}; -static const char *sndromaddr[5] = {"C8000", "CC000", "D0000", "D4000", "N/C"}; -static const char *sndid[8] = {"0x", "1x", "2x", "3x", "4x", "5x", "6x", "7x"}; +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 char str_sndopt[] = "Sound board option"; +static const TCHAR str_sndopt[] = _T("Sound board option"); typedef struct { UINT16 res; UINT16 resstr; - BYTE *value; + UINT8 *value; UINT16 min; UINT16 max; } SLIDERTBL; -static void slidersetvaluestr(HWND hWnd, const SLIDERTBL *item, BYTE value) { +static void slidersetvaluestr(HWND hWnd, const SLIDERTBL *item, UINT8 value) { - char work[32]; + TCHAR work[32]; - wsprintf(work, str_d, value); + wsprintf(work, tchar_d, value); SetDlgItemText(hWnd, item->resstr, work); } -static void slidersetvalue(HWND hWnd, const SLIDERTBL *item, BYTE value) { +static void slidersetvalue(HWND hWnd, const SLIDERTBL *item, UINT8 value) { - if (value > (BYTE)(item->max)) { - value = (BYTE)(item->max); + if (value > (UINT8)item->max) { + value = (UINT8)item->max; } - else if (value < (BYTE)(item->min)) { - value = (BYTE)(item->min); + else if (value < (UINT8)item->min) { + value = (UINT8)item->min; } SendDlgItemMessage(hWnd, item->res, TBM_SETPOS, TRUE, value); slidersetvaluestr(hWnd, item, value); @@ -65,29 +87,29 @@ static void sliderinit(HWND hWnd, const static void sliderresetpos(HWND hWnd, const SLIDERTBL *item) { - BYTE value; + UINT8 value; - value = (BYTE)SendDlgItemMessage(hWnd, item->res, TBM_GETPOS, 0, 0); - if (value > (BYTE)(item->max)) { - value = (BYTE)(item->max); + value = (UINT8)SendDlgItemMessage(hWnd, item->res, TBM_GETPOS, 0, 0); + if (value > (UINT8)item->max) { + value = (UINT8)item->max; } - else if (value < (BYTE)(item->min)) { - value = (BYTE)(item->min); + else if (value < (UINT8)item->min) { + value = (UINT8)item->min; } slidersetvaluestr(hWnd, item, value); } -static BYTE sliderrestore(HWND hWnd, const SLIDERTBL *item) { +static UINT8 sliderrestore(HWND hWnd, const SLIDERTBL *item) { - BYTE value; - BYTE ret; + UINT8 value; + UINT8 ret; - value = (BYTE)SendDlgItemMessage(hWnd, item->res, TBM_GETPOS, 0, 0); - if (value > (BYTE)(item->max)) { - value = (BYTE)(item->max); + value = (UINT8)SendDlgItemMessage(hWnd, item->res, TBM_GETPOS, 0, 0); + if (value > (UINT8)item->max) { + value = (UINT8)item->max; } - else if (value < (BYTE)(item->min)) { - value = (BYTE)(item->min); + else if (value < (UINT8)item->min) { + value = (UINT8)item->min; } ret = (*(item->value)) - value; if (ret) { @@ -119,7 +141,7 @@ static LRESULT CALLBACK SndmixDlgProc(HW return(TRUE); case WM_COMMAND: - switch (LOWORD(wp)) { + switch(LOWORD(wp)) { case IDC_SNDMIXDEF: for (i=0; i<5; i++) { slidersetvalue(hWnd, &sndmixitem[i], 64); @@ -214,30 +236,30 @@ static LRESULT CALLBACK Snd14optDlgProc( static const UINT snd26paranum[4] = {0, 3, 1, 2}; -static void setsnd26iopara(HWND hWnd, BYTE value) { +static void setsnd26iopara(HWND hWnd, UINT8 value) { SendMessage(hWnd, CB_SETCURSEL, (WPARAM)((value >> 4) & 1), (LPARAM)0); } -static BYTE getsnd26io(HWND hWnd, WORD res) { +static UINT8 getsnd26io(HWND hWnd, UINT16 res) { - char work[8]; + TCHAR work[8]; - GetDlgItemText(hWnd, res, work, sizeof(work)); - return((BYTE)((work[1] == '1')?0x10:0x00)); + GetDlgItemText(hWnd, res, work, NELEMENTS(work)); + return((UINT8)((work[1] == '1')?0x10:0x00)); } -static void setsnd26intpara(HWND hWnd, BYTE value) { +static void setsnd26intpara(HWND hWnd, UINT8 value) { SendMessage(hWnd, CB_SETCURSEL, (WPARAM)snd26paranum[(value >> 6) & 3], (LPARAM)0); } -static BYTE getsnd26int(HWND hWnd, WORD res) { +static UINT8 getsnd26int(HWND hWnd, UINT16 res) { - char work[8]; + TCHAR work[8]; - GetDlgItemText(hWnd, res, work, sizeof(work)); + GetDlgItemText(hWnd, res, work, NELEMENTS(work)); switch(work[3]) { case '0': return(0x00); @@ -251,7 +273,7 @@ static BYTE getsnd26int(HWND hWnd, WORD return(0xc0); } -static void setsnd26rompara(HWND hWnd, BYTE value) { +static void setsnd26rompara(HWND hWnd, UINT8 value) { int para; @@ -262,49 +284,25 @@ static void setsnd26rompara(HWND hWnd, B SendMessage(hWnd, CB_SETCURSEL, (WPARAM)para, (LPARAM)0); } -static BYTE getsnd26rom(HWND hWnd, WORD res) { +static UINT8 getsnd26rom(HWND hWnd, UINT16 res) { - char work[8]; - DWORD adrs; + TCHAR work[8]; + UINT32 adrs; - GetDlgItemText(hWnd, res, work, sizeof(work)); - adrs = ((DWORD)milstr_solveHEX(work) - 0xc8000) >> 14; + GetDlgItemText(hWnd, res, work, NELEMENTS(work)); + adrs = ((UINT32)miltchar_solveHEX(work) - 0xc8000) >> 14; if (adrs < 4) { - return((BYTE)adrs); + return((UINT8)adrs); } return(4); } -void setsnd26iodip(BYTE *image, int px, int py, int align, BYTE v) { - - if (v & 0x10) { - px++; - } - dlgs_setjumpery(image, px, py, align); -} - -void setsnd26intdip(BYTE *image, int px, int py, int align, BYTE v) { - - dlgs_setjumperx(image, px + ((v & 0x80)?0:1), py, align); - dlgs_setjumperx(image, px + ((v & 0x40)?0:1), py + 1, align); -} - -void setsnd26romdip(BYTE *image, int px, int py, int align, BYTE v) { - - v &= 7; - if (v >= 4) { - v = 4; - } - dlgs_setjumpery(image, px + v, py, align); -} - // ---- PC-9801-26 -static BYTE snd26 = 0; - +static UINT8 snd26 = 0; -static void set26jmp(HWND hWnd, BYTE value, BYTE bit) { +static void set26jmp(HWND hWnd, UINT8 value, UINT8 bit) { if ((snd26 ^ value) & bit) { snd26 &= ~bit; @@ -319,8 +317,8 @@ static void snd26cmdjmp(HWND hWnd) { RECT rect2; POINT p; BOOL redraw; - BYTE b; - BYTE bit; + UINT8 b; + UINT8 bit; GetWindowRect(GetDlgItem(hWnd, IDC_SND26JMP), &rect1); GetClientRect(GetDlgItem(hWnd, IDC_SND26JMP), &rect2); @@ -334,7 +332,7 @@ static void snd26cmdjmp(HWND hWnd) { return; } if ((p.x >= 2) && (p.x < 7)) { - b = (BYTE)(p.x - 2); + b = (UINT8)(p.x - 2); if ((snd26 ^ b) & 7) { snd26 &= ~0x07; snd26 |= b; @@ -365,7 +363,7 @@ static void snd26cmdjmp(HWND hWnd) { } } else if ((p.x >= 15) && (p.x < 17)) { - b = (BYTE)((p.x - 15) << 4); + b = (UINT8)((p.x - 15) << 4); if ((snd26 ^ b) & 0x10) { snd26 &= ~0x10; snd26 |= b; @@ -378,36 +376,6 @@ static void snd26cmdjmp(HWND hWnd) { } } -static void snd26drawjmp(HWND hWnd, HDC hdc) { - - BITMAPINFO *bmi; - HBITMAP hbmp; - BYTE *image; - int align; - BYTE *imgbtm; - HDC hmdc; - - bmi = (BITMAPINFO *)_MALLOC(bit2res_getsize(&snd26dip), "bitmap"); - if (bmi == NULL) { - return; - } - bit2res_sethead(bmi, &snd26dip); - hbmp = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, - (void **)&image, NULL, 0); - bit2res_setdata(image, &snd26dip); - align = ((snd26dip.x + 7) / 2) & ~3; - imgbtm = image + align * (snd26dip.y - 1); - setsnd26iodip(imgbtm, 15, 1, align, snd26); - setsnd26intdip(imgbtm, 9, 1, align, snd26); - setsnd26romdip(imgbtm, 2, 1, align, snd26); - hmdc = CreateCompatibleDC(hdc); - SelectObject(hmdc, hbmp); - BitBlt(hdc, 0, 0, snd26dip.x, snd26dip.y, hmdc, 0, 0, SRCCOPY); - DeleteDC(hmdc); - DeleteObject(hbmp); - _MFREE(bmi); -} - static LRESULT CALLBACK Snd26optDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { @@ -428,7 +396,7 @@ static LRESULT CALLBACK Snd26optDlgProc( return(TRUE); case WM_COMMAND: - switch (LOWORD(wp)) { + switch(LOWORD(wp)) { case IDC_SND26IO: set26jmp(hWnd, getsnd26io(hWnd, IDC_SND26IO), 0x10); break; @@ -467,7 +435,8 @@ static LRESULT CALLBACK Snd26optDlgProc( case WM_DRAWITEM: if (LOWORD(wp) == IDC_SND26JMP) { - snd26drawjmp(hWnd, ((LPDRAWITEMSTRUCT)lp)->hDC); + dlgs_drawbmp(((LPDRAWITEMSTRUCT)lp)->hDC, + dipswbmp_getsnd26(snd26)); } return(FALSE); } @@ -477,36 +446,35 @@ static LRESULT CALLBACK Snd26optDlgProc( // ---- PC-9801-86 -static BYTE snd86 = 0; +static UINT8 snd86 = 0; static const UINT snd86paranum[4] = {0, 1, 3, 2}; - -static void setsnd86iopara(HWND hWnd, BYTE value) { +static void setsnd86iopara(HWND hWnd, UINT8 value) { SendMessage(hWnd, CB_SETCURSEL, (WPARAM)((~value) & 1), (LPARAM)0); } -static BYTE getsnd86io(HWND hWnd, WORD res) { +static UINT8 getsnd86io(HWND hWnd, UINT16 res) { - char work[8]; + TCHAR work[8]; - GetDlgItemText(hWnd, res, work, sizeof(work)); - return((BYTE)((work[1] == '1')?0x01:0x00)); + GetDlgItemText(hWnd, res, work, NELEMENTS(work)); + return((UINT8)((work[1] == '1')?0x01:0x00)); } -static void setsnd86intpara(HWND hWnd, BYTE value) { +static void setsnd86intpara(HWND hWnd, UINT8 value) { SendMessage(hWnd, CB_SETCURSEL, (WPARAM)snd86paranum[(value >> 2) & 3], (LPARAM)0); } -static BYTE getsnd86int(HWND hWnd) { +static UINT8 getsnd86int(HWND hWnd) { - char work[8]; + TCHAR work[8]; - Edit_GetText(hWnd, work, sizeof(work)); + Edit_GetText(hWnd, work, NELEMENTS(work)); switch(work[3]) { case '0': return(0x00); @@ -520,20 +488,20 @@ static BYTE getsnd86int(HWND hWnd) { return(0x0c); } -static void setsnd86idpara(HWND hWnd, BYTE value) { +static void setsnd86idpara(HWND hWnd, UINT8 value) { SendMessage(hWnd, CB_SETCURSEL, (WPARAM)(((~value) >> 5) & 7), (LPARAM)0); } -static BYTE getsnd86id(HWND hWnd) { +static UINT8 getsnd86id(HWND hWnd) { - char work[8]; + TCHAR work[8]; - Edit_GetText(hWnd, work, sizeof(work)); + Edit_GetText(hWnd, work, NELEMENTS(work)); return((~work[0] & 7) << 5); } -static void set86jmp(HWND hWnd, BYTE value, BYTE bit) { +static void set86jmp(HWND hWnd, UINT8 value, UINT8 bit) { if ((snd86 ^ value) & bit) { snd86 &= ~bit; @@ -588,42 +556,6 @@ static void snd86cmddipsw(HWND hWnd) { InvalidateRect(GetDlgItem(hWnd, IDC_SND86DIP), NULL, TRUE); } -static void snd86drawdipsw(HWND hWnd, HDC hdc) { - - BITMAPINFO *bmi; - HBITMAP hbmp; - BYTE *image; - int align; - BYTE *imgbtm; - HDC hmdc; - int i; - int x, y, yl; - - bmi = (BITMAPINFO *)_MALLOC(bit2res_getsize(&snd86dip), "bitmap"); - if (bmi == NULL) { - return; - } - bit2res_sethead(bmi, &snd86dip); - hbmp = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, - (void **)&image, NULL, 0); - bit2res_setdata(image, &snd86dip); - align = ((snd86dip.x + 7) / 2) & ~3; - imgbtm = image + align * (snd86dip.y - 1); - for (i=0; i<8; i++) { - x = i * 8 + 17; - y = (snd86 & (1 << i))?16:9; - for (yl=0; yl<7; yl++) { - dlgs_linex(imgbtm, x, y++, 6, align, 3); - } - } - hmdc = CreateCompatibleDC(hdc); - SelectObject(hmdc, hbmp); - BitBlt(hdc, 0, 0, snd86dip.x, snd86dip.y, hmdc, 0, 0, SRCCOPY); - DeleteDC(hmdc); - DeleteObject(hbmp); - _MFREE(bmi); -} - static LRESULT CALLBACK Snd86optDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { @@ -647,7 +579,7 @@ static LRESULT CALLBACK Snd86optDlgProc( return(TRUE); case WM_COMMAND: - switch (LOWORD(wp)) { + switch(LOWORD(wp)) { case IDC_SND86IO: set86jmp(hWnd, getsnd86io(hWnd, IDC_SND86IO), 0x01); break; @@ -698,7 +630,8 @@ static LRESULT CALLBACK Snd86optDlgProc( case WM_DRAWITEM: if (LOWORD(wp) == IDC_SND86DIP) { - snd86drawdipsw(hWnd, ((LPDRAWITEMSTRUCT)lp)->hDC); + dlgs_drawbmp(((LPDRAWITEMSTRUCT)lp)->hDC, + dipswbmp_getsnd86(snd86)); } return(FALSE); } @@ -708,9 +641,8 @@ static LRESULT CALLBACK Snd86optDlgProc( // ---- Speak board -static BYTE spb = 0; -static BYTE spbvrc = 0; - +static UINT8 spb = 0; +static UINT8 spbvrc = 0; static void setspbVRch(HWND hWnd) { @@ -748,8 +680,8 @@ static void spbcmdjmp(HWND hWnd) { RECT rect2; POINT p; BOOL redraw; - BYTE b; - BYTE bit; + UINT8 b; + UINT8 bit; GetWindowRect(GetDlgItem(hWnd, IDC_SPBJMP), &rect1); GetClientRect(GetDlgItem(hWnd, IDC_SPBJMP), &rect2); @@ -789,7 +721,7 @@ static void spbcmdjmp(HWND hWnd) { redraw = TRUE; } else if ((p.x >= 10) && (p.x < 12)) { - b = (BYTE)((p.x - 10) << 4); + b = (UINT8)((p.x - 10) << 4); if ((spb ^ b) & 0x10) { spb &= ~0x10; spb |= b; @@ -798,7 +730,7 @@ static void spbcmdjmp(HWND hWnd) { } } else if ((p.x >= 14) && (p.x < 19)) { - b = (BYTE)(p.x - 14); + b = (UINT8)(p.x - 14); if ((spb ^ b) & 7) { spb &= ~0x07; spb |= b; @@ -807,7 +739,7 @@ static void spbcmdjmp(HWND hWnd) { } } else if ((p.x >= 21) && (p.x < 24)) { - spbvrc ^= (BYTE)(3 - p.y); + spbvrc ^= (UINT8)(3 - p.y); setspbVRch(hWnd); redraw = TRUE; } @@ -816,42 +748,7 @@ static void spbcmdjmp(HWND hWnd) { } } -static void spbdrawjumper(HWND hWnd, HDC hdc) { - - BITMAPINFO *bmi; - HBITMAP hbmp; - BYTE *image; - int align; - BYTE *imgbtm; - HDC hmdc; - - bmi = (BITMAPINFO *)_MALLOC(bit2res_getsize(&spbdip), "bitmap"); - if (bmi == NULL) { - return; - } - bit2res_sethead(bmi, &spbdip); - hbmp = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, - (void **)&image, NULL, 0); - bit2res_setdata(image, &spbdip); - align = ((spbdip.x + 7) / 2) & ~3; - imgbtm = image + align * (spbdip.y - 1); - setsnd26intdip(imgbtm, 2, 1, align, spb); - setsnd26iodip(imgbtm, 10, 1, align, spb); - setsnd26romdip(imgbtm, 14, 1, align, spb); - if (spb & 0x20) { - dlgs_setjumpery(imgbtm, 7, 1, align); - } - dlgs_setjumperx(imgbtm, ((spbvrc&2)?21:22), 1, align); - dlgs_setjumperx(imgbtm, ((spbvrc&1)?21:22), 2, align); - hmdc = CreateCompatibleDC(hdc); - SelectObject(hmdc, hbmp); - BitBlt(hdc, 0, 0, spbdip.x, spbdip.y, hmdc, 0, 0, SRCCOPY); - DeleteDC(hmdc); - DeleteObject(hbmp); - _MFREE(bmi); -} - -static void setspbjmp(HWND hWnd, BYTE value, BYTE bit) { +static void setspbjmp(HWND hWnd, UINT8 value, UINT8 bit) { if ((spb ^ value) & bit) { spb &= ~bit; @@ -860,9 +757,9 @@ static void setspbjmp(HWND hWnd, BYTE va } } -static BYTE getspbVRch(HWND hWnd) { +static UINT8 getspbVRch(HWND hWnd) { - BYTE ret; + UINT8 ret; ret = 0; if (Button_GetCheck(GetDlgItem(hWnd, IDC_SPBVRL))) { @@ -876,7 +773,7 @@ static BYTE getspbVRch(HWND hWnd) { static LRESULT CALLBACK SPBoptDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { - BYTE b; + UINT8 b; UINT update; switch(msg) { @@ -885,7 +782,7 @@ static LRESULT CALLBACK SPBoptDlgProc(HW return(TRUE); case WM_COMMAND: - switch (LOWORD(wp)) { + switch(LOWORD(wp)) { case IDC_SPBIO: setspbjmp(hWnd, getsnd26io(hWnd, IDC_SPBIO), 0x10); break; @@ -935,14 +832,15 @@ static LRESULT CALLBACK SPBoptDlgProc(HW np2cfg.spb_vrc = spbvrc; update |= SYS_UPDATECFG; } - b = (BYTE)SendDlgItemMessage(hWnd, IDC_SPBVRLEVEL, + b = (UINT8)SendDlgItemMessage(hWnd, IDC_SPBVRLEVEL, TBM_GETPOS, 0, 0); if (np2cfg.spb_vrl != b) { np2cfg.spb_vrl = b; update |= SYS_UPDATECFG; } opngen_setVR(np2cfg.spb_vrc, np2cfg.spb_vrl); - b = (BYTE)(Button_GetCheck(GetDlgItem(hWnd, IDC_SPBREVERSE))? 1:0); + b = (UINT8)(Button_GetCheck(GetDlgItem(hWnd, IDC_SPBREVERSE)) + ?1:0); if (np2cfg.spb_x != b) { np2cfg.spb_x = b; update |= SYS_UPDATECFG; @@ -954,7 +852,8 @@ static LRESULT CALLBACK SPBoptDlgProc(HW case WM_DRAWITEM: if (LOWORD(wp) == IDC_SPBJMP) { - spbdrawjumper(hWnd, ((LPDRAWITEMSTRUCT)lp)->hDC); + dlgs_drawbmp(((LPDRAWITEMSTRUCT)lp)->hDC, + dipswbmp_getsndspb(spb, spbvrc)); } return(FALSE); } @@ -967,7 +866,7 @@ static LRESULT CALLBACK SPBoptDlgProc(HW typedef struct { UINT16 res; UINT16 bit; - BYTE *ptr; + UINT8 *ptr; } CHECKTBL; static const CHECKTBL pad1opt[13] = { @@ -992,11 +891,11 @@ static void checkbtnres_load(HWND hWnd, (*(item->ptr)) & (1 << (item->bit))); } -static BYTE checkbtnres_store(HWND hWnd, const CHECKTBL *item) { +static UINT8 checkbtnres_store(HWND hWnd, const CHECKTBL *item) { - BYTE value; - BYTE bit; - BYTE ret; + UINT8 value; + UINT8 bit; + UINT8 ret; bit = 1 << (item->bit); value = ((Button_GetCheck(GetDlgItem(hWnd, item->res)))?0xff:0) & bit; @@ -1011,7 +910,7 @@ static LRESULT CALLBACK PAD1optDlgProc(H WPARAM wp, LPARAM lp) { int i; - BYTE renewal; + UINT8 renewal; switch(msg) { case WM_INITDIALOG: @@ -1030,7 +929,7 @@ static LRESULT CALLBACK PAD1optDlgProc(H renewal |= checkbtnres_store(hWnd, pad1opt + i); } if (renewal) { - joy_init(); + joymng_initialize(); sysmng_update(SYS_UPDATECFG); } return(TRUE); @@ -1048,7 +947,7 @@ void dialog_sndopt(HWND hWnd) { HINSTANCE hinst; PROPSHEETPAGE psp; PROPSHEETHEADER psh; - HPROPSHEETPAGE hpsp[6]; // ver0.29 + HPROPSHEETPAGE hpsp[6]; hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE); @@ -1098,28 +997,60 @@ void dialog_sndopt(HWND hWnd) { // ---- -static const char s98ui_file[] = "NP2_%04d.S98"; -static const char s98ui_title[] = "Save as S98 log"; -static const char s98ui_ext[] = "s98"; -static const char s98ui_filter[] = "S98 log (*.s98)\0*.s98\0"; +#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; - char path[MAX_PATH]; + OEMCHAR path[MAX_PATH]; S98_close(); check = FALSE; - file_cpyname(path, bmpfilefolder, sizeof(path)); + file_cpyname(path, bmpfilefolder, NELEMENTS(path)); file_cutname(path); - file_catname(path, s98ui_file, sizeof(path)); - if ((dlgs_selectwritenum(hWnd, &s98ui, path, sizeof(path))) && + file_catname(path, s98ui_file, NELEMENTS(path)); + if ((dlgs_selectwritenum(hWnd, &s98ui, path, NELEMENTS(path))) && (S98_open(path) == SUCCESS)) { - file_cpyname(bmpfilefolder, path, sizeof(bmpfilefolder)); + file_cpyname(bmpfilefolder, path, NELEMENTS(bmpfilefolder)); sysmng_update(SYS_UPDATEOSCFG); check = TRUE; } xmenu_sets98logging(check); } +#endif + + +// ---- + +#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]; + + check = 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)); + sysmng_update(SYS_UPDATEOSCFG); + check = TRUE; + } + xmenu_setwaverec(check); +} +#endif